aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c_extension.c21
-rw-r--r--setup_c_extension.py2
2 files changed, 18 insertions, 5 deletions
diff --git a/c_extension.c b/c_extension.c
index 7aebced..d2e7e4e 100644
--- a/c_extension.c
+++ b/c_extension.c
@@ -328,16 +328,28 @@ _abort_video_main1:
static PyObject* video_images_get(PyObject* self, PyObject* args) {
- npy_intp dims[3];
+ if (!recthread_data_recent) {
+ // fprintf(stderr, "%s: no data from video thread", __func__);
+ PyErr_SetString(PyExc_RuntimeError, "No data from video thread");
+ return NULL;
+ }
struct color_pipe_t *cp = recthread_data_recent->color_pipe;
-
+
+ if (!cp) {
+ // fprintf(stderr, "%s: cannot read color pipeline\n", __func__);
+ PyErr_SetString(PyExc_RuntimeError, "Cannot read color pipeline");
+ return NULL;
+ }
if (!is_color) {
- fprintf(stderr, "%s: not implemented for gray images\n", __func__);
+ // fprintf(stderr, "%s: not implemented for gray images\n", __func__);
+ PyErr_SetString(PyExc_RuntimeError, "Not implemented for gray images");
return NULL;
}
+ npy_intp dims[3];
+
dims[0] = cp->height;
dims[1] = cp->width;
dims[2] = 3;
@@ -388,7 +400,7 @@ static PyObject* video_deinit(PyObject* self, PyObject* args) {
static PyObject* video_xml_send(PyObject* self, PyObject* args) {
Py_ssize_t count;
- const uint8_t* str;
+ const char* str;
if (!PyArg_ParseTuple(args, "s#", &str, &count)) {
return NULL;
}
@@ -421,3 +433,4 @@ PyMODINIT_FUNC PyInit_o3000(void) {
_import_array();
return PyModule_Create(&o3000);
}
+
diff --git a/setup_c_extension.py b/setup_c_extension.py
index e01837f..f1f3e08 100644
--- a/setup_c_extension.py
+++ b/setup_c_extension.py
@@ -12,5 +12,5 @@ setup(name = 'o3000', version = '1.0',
sources = ['c_extension.c', 'helpers.c'],
libraries = ['o3000', 'o3000_imgpipe', 'tiff'],
include_dirs = [str(numpy_headers_path)],
- # extra_compile_args = ['-Wextra']
+ extra_compile_args = ['-Wextra', '-Wall', '-Wno-unused-parameter']
)])