From de4f1aeb06804990bcfb864ef3eb01df721345f7 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Sat, 20 Nov 2010 12:05:28 +0000 Subject: [PATCH] fixed some GCC 4.4 warnings --- CMakeLists.txt | 6 +++--- modules/core/src/lapack.cpp | 3 +-- modules/core/src/matrix.cpp | 14 ++++++++++---- modules/imgproc/src/featureselect.cpp | 3 +-- modules/imgproc/src/histogram.cpp | 3 +-- modules/ml/src/knearest.cpp | 2 +- modules/python/opencv2x.h | 6 ------ 7 files changed, 17 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 970d053..d5d7b17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -562,10 +562,10 @@ if (WITH_TBB) if (TBB_FOUND) set(HAVE_TBB 1) - if(NOT "${TBB_INCLUDE_DIRS}" STREQUAL "") - include_directories("${TBB_INCLUDE_DIRS}") + if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "") + include_directories(${TBB_INCLUDE_DIRS}) endif() - link_directories("${TBB_LIBRARY_DIRS}") + link_directories(${TBB_LIBRARY_DIRS}) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES}) else() set(TBB_DEFAULT_INCLUDE_DIRS diff --git a/modules/core/src/lapack.cpp b/modules/core/src/lapack.cpp index 8871e0a..f678085 100644 --- a/modules/core/src/lapack.cpp +++ b/modules/core/src/lapack.cpp @@ -1454,8 +1454,7 @@ void SVD::backSubst( const Mat& w, const Mat& u, const Mat& vt, const Mat& rhs, AutoBuffer buffer(nb); CV_Assert( u.data && vt.data && w.data ); - if( rhs.data ) - CV_Assert( rhs.type() == type && rhs.rows == m ); + CV_Assert( rhs.data == 0 || (rhs.type() == type && rhs.rows == m) ); dst.create( n, nb, type ); if( type == CV_32F ) diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 6ed7d6a..1e61d9a 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -685,8 +685,11 @@ void extractImageCOI(const CvArr* arr, Mat& ch, int coi) { Mat mat = cvarrToMat(arr, false, true, 1); ch.create(mat.dims, mat.size, mat.depth()); - if(coi < 0) - CV_Assert( CV_IS_IMAGE(arr) && (coi = cvGetImageCOI((const IplImage*)arr)-1) >= 0 ); + if(coi < 0) + { + CV_Assert( CV_IS_IMAGE(arr) ); + coi = cvGetImageCOI((const IplImage*)arr)-1; + } CV_Assert(0 <= coi && coi < mat.channels()); int _pairs[] = { coi, 0 }; mixChannels( &mat, 1, &ch, 1, _pairs, 1 ); @@ -695,8 +698,11 @@ void extractImageCOI(const CvArr* arr, Mat& ch, int coi) void insertImageCOI(const Mat& ch, CvArr* arr, int coi) { Mat mat = cvarrToMat(arr, false, true, 1); - if(coi < 0) - CV_Assert( CV_IS_IMAGE(arr) && (coi = cvGetImageCOI((const IplImage*)arr)-1) >= 0 ); + if(coi < 0) + { + CV_Assert( CV_IS_IMAGE(arr) ); + coi = cvGetImageCOI((const IplImage*)arr)-1; + } CV_Assert(ch.size == mat.size && ch.depth() == mat.depth() && 0 <= coi && coi < mat.channels()); int _pairs[] = { 0, coi }; mixChannels( &ch, 1, &mat, 1, _pairs, 1 ); diff --git a/modules/imgproc/src/featureselect.cpp b/modules/imgproc/src/featureselect.cpp index 9c68df7..b469db5 100644 --- a/modules/imgproc/src/featureselect.cpp +++ b/modules/imgproc/src/featureselect.cpp @@ -57,8 +57,7 @@ void goodFeaturesToTrack( const Mat& image, vector& corners, { CV_Assert( qualityLevel > 0 && minDistance >= 0 && maxCorners >= 0 ); - if( mask.data ) - CV_Assert( mask.type() == CV_8UC1 && mask.size() == image.size() ); + CV_Assert( mask.empty() || (mask.type() == CV_8UC1 && mask.size() == image.size()) ); Mat eig, tmp; if( useHarrisDetector ) diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index a68f301..c68ed94 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -117,8 +117,7 @@ static void histPrepareImages( const Mat* images, int nimages, const int* channe Size& imsize, vector& uniranges ) { int i, j, c; - if(!channels) - CV_Assert( nimages == dims ); + CV_Assert( channels != 0 || nimages == dims ); imsize = images[0].size(); int depth = images[0].depth(), esz1 = (int)images[0].elemSize1(); diff --git a/modules/ml/src/knearest.cpp b/modules/ml/src/knearest.cpp index e930c3f..c5e4ef4 100644 --- a/modules/ml/src/knearest.cpp +++ b/modules/ml/src/knearest.cpp @@ -427,7 +427,7 @@ float CvKNearest::find_nearest( const Mat& _samples, int k, Mat* _results, { if(!(_results->data && (_results->type() == CV_32F || (_results->type() == CV_32S && regression)) && - (_results->cols == 1 || _results->rows == 1) || + (_results->cols == 1 || _results->rows == 1) && _results->cols + _results->rows - 1 == _samples.rows) ) _results->create(_samples.rows, 1, CV_32F); presults = &(results = *_results); diff --git a/modules/python/opencv2x.h b/modules/python/opencv2x.h index d971c2e..4f2ec2c 100644 --- a/modules/python/opencv2x.h +++ b/modules/python/opencv2x.h @@ -76,8 +76,6 @@ public: void allocate(int dims, const int* sizes, int type, int*& refcount, uchar*& datastart, uchar*& data, size_t* step) { - static int ncalls = 0; - int depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); const int f = (int)(sizeof(size_t)/8); @@ -108,8 +106,6 @@ public: void deallocate(int* refcount, uchar* datastart, uchar* data) { - static int ncalls = 0; - if( !refcount ) return; PyObject* o = pyObjectFromRefcount(refcount); @@ -124,8 +120,6 @@ enum { ARG_NONE = 0, ARG_MAT = 1, ARG_SCALAR = 2 }; static int pyopencv_to(const PyObject* o, Mat& m, const char* name = "", bool allowND=true) { - static int call_idx = 0; - if(!o || o == Py_None) { if( !m.data ) -- 2.7.4