fixed just introduced compile errors on Mac

This commit is contained in:
Vadim Pisarevsky 2011-07-19 13:07:51 +00:00
parent ff5e97c8e4
commit f4f2340039

View File

@ -262,7 +262,7 @@ static PyObject *iplimage_tostring(PyObject *self, PyObject *args)
bps = 8; bps = 8;
break; break;
default: default:
return failmsg("Unrecognised depth %d", i->depth), 0; return failmsg("Unrecognised depth %d", i->depth), (PyObject*)0;
} }
int bpl = i->width * i->nChannels * bps; int bpl = i->width * i->nChannels * bps;
if (PyString_Check(pc->data) && bpl == i->widthStep && pc->offset == 0 && ((bpl * i->height) == what_size(pc->data))) { if (PyString_Check(pc->data) && bpl == i->widthStep && pc->offset == 0 && ((bpl * i->height) == what_size(pc->data))) {
@ -417,7 +417,7 @@ static PyObject *cvmat_tostring(PyObject *self, PyObject *args)
bps = CV_MAT_CN(m->type) * 8; bps = CV_MAT_CN(m->type) * 8;
break; break;
default: default:
return failmsg("Unrecognised depth %d", CV_MAT_DEPTH(m->type)), 0; return failmsg("Unrecognised depth %d", CV_MAT_DEPTH(m->type)), (PyObject*)0;
} }
int bpl = m->cols * bps; // bytes per line int bpl = m->cols * bps; // bytes per line
@ -744,7 +744,7 @@ static PyObject *cvmatnd_tostring(PyObject *self, PyObject *args)
bps = CV_MAT_CN(m->type) * 8; bps = CV_MAT_CN(m->type) * 8;
break; break;
default: default:
return failmsg("Unrecognised depth %d", CV_MAT_DEPTH(m->type)), 0; return failmsg("Unrecognised depth %d", CV_MAT_DEPTH(m->type)), (PyObject*)0;
} }
int d, l = bps; int d, l = bps;
@ -2838,20 +2838,20 @@ static PyObject *fromarray(PyObject *o, int allowND)
cvmat_t *m = PyObject_NEW(cvmat_t, &cvmat_Type); cvmat_t *m = PyObject_NEW(cvmat_t, &cvmat_Type);
if (pai->nd == 2) { if (pai->nd == 2) {
if (pai->strides[1] != pai->itemsize) { if (pai->strides[1] != pai->itemsize) {
return failmsg("cv.fromarray array can only accept arrays with contiguous data"), 0; return failmsg("cv.fromarray array can only accept arrays with contiguous data"), (PyObject*)0;
} }
ERRWRAP(m->a = cvCreateMatHeader((int)pai->shape[0], (int)pai->shape[1], type)); ERRWRAP(m->a = cvCreateMatHeader((int)pai->shape[0], (int)pai->shape[1], type));
m->a->step = (int)pai->strides[0]; m->a->step = (int)pai->strides[0];
} else if (pai->nd == 3) { } else if (pai->nd == 3) {
if (pai->shape[2] > CV_CN_MAX) { if (pai->shape[2] > CV_CN_MAX) {
Py_DECREF(ao); Py_DECREF(ao);
return failmsg("cv.fromarray too many channels, see allowND argument"), 0; return failmsg("cv.fromarray too many channels, see allowND argument"), (PyObject*)0;
} }
ERRWRAP(m->a = cvCreateMatHeader((int)pai->shape[0], (int)pai->shape[1], type + ((int)(pai->shape[2] - 1) << CV_CN_SHIFT))); ERRWRAP(m->a = cvCreateMatHeader((int)pai->shape[0], (int)pai->shape[1], type + ((int)(pai->shape[2] - 1) << CV_CN_SHIFT)));
m->a->step = (int)pai->strides[0]; m->a->step = (int)pai->strides[0];
} else { } else {
Py_DECREF(ao); Py_DECREF(ao);
return failmsg("cv.fromarray array can be 2D or 3D only, see allowND argument"), 0; return failmsg("cv.fromarray array can be 2D or 3D only, see allowND argument"), (PyObject*)0;
} }
m->a->data.ptr = (uchar*)pai->data; m->a->data.ptr = (uchar*)pai->data;
//retval = pythonize_foreign_CvMat(m); //retval = pythonize_foreign_CvMat(m);
@ -3018,18 +3018,18 @@ static PyObject *cvarr_GetItem(PyObject *o, PyObject *key)
// negative steps are illegal for OpenCV // negative steps are illegal for OpenCV
for (int i = 0; i < dd.count; i++) { for (int i = 0; i < dd.count; i++) {
if (dd.step[i] < 0) if (dd.step[i] < 0)
return failmsg("Negative step is illegal"), 0; return failmsg("Negative step is illegal"), (PyObject*)0;
} }
// zero length illegal for OpenCV // zero length illegal for OpenCV
for (int i = 0; i < dd.count; i++) { for (int i = 0; i < dd.count; i++) {
if (dd.length[i] == 0) if (dd.length[i] == 0)
return failmsg("Zero sized dimension is illegal"), 0; return failmsg("Zero sized dimension is illegal"), (PyObject*)0;
} }
// column step can only be 0 or 1 // column step can only be 0 or 1
if ((dd.step[dd.count-1] != 0) && (dd.step[dd.count-1] != 1)) if ((dd.step[dd.count-1] != 0) && (dd.step[dd.count-1] != 1))
return failmsg("Column step is illegal"), 0; return failmsg("Column step is illegal"), (PyObject*)0;
if (is_cvmat(o) || is_iplimage(o)) { if (is_cvmat(o) || is_iplimage(o)) {
cvmat_t *sub = PyObject_NEW(cvmat_t, &cvmat_Type); cvmat_t *sub = PyObject_NEW(cvmat_t, &cvmat_Type);
@ -3476,7 +3476,7 @@ static PyObject *pycvSubdiv2DLocate(PyObject *self, PyObject *args)
Py_INCREF(Py_None); Py_INCREF(Py_None);
break; break;
default: default:
return failmsg("Unexpected loc from cvSubdiv2DLocate"), 0; return failmsg("Unexpected loc from cvSubdiv2DLocate"), (PyObject*)0;
} }
return Py_BuildValue("iO", (int)loc, r); return Py_BuildValue("iO", (int)loc, r);
} }
@ -3693,7 +3693,7 @@ static PyObject *shareData(PyObject *donor, CvArr *pdonor, CvMat *precipient)
arr_data = ((iplimage_t*)donor)->data; arr_data = ((iplimage_t*)donor)->data;
((cvmat_t*)recipient)->offset += ((iplimage_t*)donor)->offset; ((cvmat_t*)recipient)->offset += ((iplimage_t*)donor)->offset;
} else { } else {
return failmsg("Argument 'mat' must be either IplImage or CvMat"), 0; return failmsg("Argument 'mat' must be either IplImage or CvMat"), (PyObject*)0;
} }
((cvmat_t*)recipient)->data = arr_data; ((cvmat_t*)recipient)->data = arr_data;
Py_INCREF(arr_data); Py_INCREF(arr_data);