From: Vadim Pisarevsky Date: Thu, 4 Nov 2010 15:59:10 +0000 (+0000) Subject: fixed several GCC warnings; fixed crash in kmeans test (because of cv::swap(Mat&a... X-Git-Tag: accepted/2.0/20130307.220821~4278 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ced8192174db0e782cbe27c69a333085f78bf2fd;p=profile%2Fivi%2Fopencv.git fixed several GCC warnings; fixed crash in kmeans test (because of cv::swap(Mat&a, Mat&b)) (ticket #616) --- diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp index cd96c13..48ced29 100644 --- a/modules/core/include/opencv2/core/core.hpp +++ b/modules/core/include/opencv2/core/core.hpp @@ -2776,12 +2776,9 @@ public: MatCommaInitializer_(Mat_<_Tp>* _m); //! the operator that takes the next value and put it to the matrix template MatCommaInitializer_<_Tp>& operator , (T2 v); - //! the conversion operator - //operator Mat_<_Tp>() const; //! another form of conversion operator Mat_<_Tp> operator *() const; operator Mat_<_Tp>() const; - virtual void assignTo(Mat& m, int type=-1) const; protected: MatIterator_<_Tp> it; }; diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp index c4c7008..da05e17 100644 --- a/modules/core/include/opencv2/core/mat.hpp +++ b/modules/core/include/opencv2/core/mat.hpp @@ -1938,12 +1938,6 @@ template inline MatCommaInitializer_<_Tp>::operator Mat_<_Tp>() co return Mat_<_Tp>(*this->it.m); } -template inline void -MatCommaInitializer_<_Tp>::assignTo(Mat& m, int type) const -{ - Mat_<_Tp>(*this).assignTo(m, type); -} - template static inline MatCommaInitializer_<_Tp> operator << (const Mat_<_Tp>& m, T2 val) { diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 11641d0..d599e0d 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -50,11 +50,26 @@ namespace cv { void swap( Mat& a, Mat& b ) { - int *ap = (int*)&a, *bp = (int*)&b; + /*int *ap = (int*)&a, *bp = (int*)&b; size_t i, n = sizeof(Mat)/sizeof(ap[0]); for( i = 0; i < n; i++ ) - std::swap(ap[i], bp[i]); + std::swap(ap[i], bp[i]);*/ + std::swap(a.flags, b.flags); + std::swap(a.dims, b.dims); + std::swap(a.rows, b.rows); + std::swap(a.cols, b.cols); + std::swap(a.data, b.data); + std::swap(a.refcount, b.refcount); + std::swap(a.datastart, b.datastart); + std::swap(a.dataend, b.dataend); + std::swap(a.datalimit, b.datalimit); + std::swap(a.allocator, b.allocator); + + std::swap(a.size.p, b.size.p); + std::swap(a.step.p, b.step.p); + std::swap(a.step.buf[0], b.step.buf[0]); + std::swap(a.step.buf[1], b.step.buf[1]); if( a.step.p == b.step.buf ) { diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 0b4350e..0691f8a 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -2325,7 +2325,7 @@ public: virtual void train(); - virtual bool supportMask() { matcher->supportMask(); } + virtual bool supportMask() { return matcher->supportMask(); } virtual void read( const FileNode& fn ); virtual void write( FileStorage& fs ) const; diff --git a/tests/ml/src/mltest_main.cpp b/tests/ml/src/mltest_main.cpp index 4cbfff0..7946fb9 100644 --- a/tests/ml/src/mltest_main.cpp +++ b/tests/ml/src/mltest_main.cpp @@ -45,7 +45,7 @@ CvTS test_system("ml"); const char* blacklist[] = { - "kmeans", //ticket 616 + //"kmeans", //ticket 616 "artrees", //ticket 460 "aboost", //ticket 474 0