* Enabled -Wnarrowing warning
* Fixed type narrowing issues
* Cast python constants
* Use long long for python constants
* Use int for python constants with fallback to long
* Update cv2.cpp
add_extra_compiler_option(-Wcast-align)
add_extra_compiler_option(-Wstrict-aliasing=2)
else()
- add_extra_compiler_option(-Wno-narrowing)
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
add_extra_compiler_option(-Wno-unnamed-type-template-args)
add_extra_compiler_option(-Wno-comment)
struct ConstDef
{
const char * name;
- long val;
+ long long val;
};
static void init_submodule(PyObject * root, const char * name, PyMethodDef * methods, ConstDef * consts)
}
for (ConstDef * c = consts; c->name != NULL; ++c)
{
- PyDict_SetItemString(d, c->name, PyInt_FromLong(c->val));
+ PyDict_SetItemString(d, c->name, PyLong_FromLongLong(c->val));
}
}
#include <assert.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <limits>
#ifdef HAVE_CAMV4L2
#include <asm/types.h> /* for videodev2.h */
void CvCaptureCAM_V4L::v4l2_create_frame()
{
- CvSize size = {form.fmt.pix.width, form.fmt.pix.height};
+ CV_Assert(form.fmt.pix.width <= (uint)std::numeric_limits<int>::max());
+ CV_Assert(form.fmt.pix.height <= (uint)std::numeric_limits<int>::max());
+ CvSize size = {(int)form.fmt.pix.width, (int)form.fmt.pix.height};
int channels = 3;
int depth = IPL_DEPTH_8U;