From d9ab1d2b92ebd252f24d364784e6322d3e62400d Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Wed, 9 Feb 2011 22:45:45 +0000 Subject: [PATCH] fixed build on Windows with MSVC2010 --- modules/core/test/test_arithm.cpp | 18 +++++++++--------- modules/features2d/src/blobdetector.cpp | 1 + modules/imgproc/test/test_canny.cpp | 2 +- modules/ts/include/opencv2/ts/ts.hpp | 4 ++++ modules/ts/src/precomp.hpp | 2 ++ modules/ts/src/ts.cpp | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 74d4e46acf..258b4bd5b2 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -18,7 +18,7 @@ struct BaseElemWiseOp BaseElemWiseOp(int _ninputs, int _flags, double _alpha, double _beta, Scalar _gamma=Scalar::all(0), int _context=1) : ninputs(_ninputs), flags(_flags), alpha(_alpha), beta(_beta), gamma(_gamma), context(_context) {} - BaseElemWiseOp() { flags = alpha = beta = 0; gamma = Scalar::all(0); } + BaseElemWiseOp() { flags = 0; alpha = beta = 0; gamma = Scalar::all(0); } virtual ~BaseElemWiseOp() {} virtual void op(const vector&, Mat&, const Mat&) {} virtual void refop(const vector&, Mat&, const Mat&) {} @@ -288,7 +288,7 @@ struct LogicOp : public BaseElemWiseOp else cvtest::logicOp(src[0], src[1], dst, opcode); } - double getMaxErr(int depth) + double getMaxErr(int) { return 0; } @@ -339,7 +339,7 @@ struct MinOp : public BaseElemWiseOp { cvtest::min(src[0], src[1], dst); } - double getMaxErr(int depth) + double getMaxErr(int) { return 0; } @@ -356,7 +356,7 @@ struct MaxOp : public BaseElemWiseOp { cvtest::max(src[0], src[1], dst); } - double getMaxErr(int depth) + double getMaxErr(int) { return 0; } @@ -373,7 +373,7 @@ struct MinSOp : public BaseElemWiseOp { cvtest::min(src[0], gamma[0], dst); } - double getMaxErr(int depth) + double getMaxErr(int) { return 0; } @@ -390,7 +390,7 @@ struct MaxSOp : public BaseElemWiseOp { cvtest::max(src[0], gamma[0], dst); } - double getMaxErr(int depth) + double getMaxErr(int) { return 0; } @@ -482,7 +482,7 @@ struct SetOp : public BaseElemWiseOp { dst.setTo(gamma, mask); } - void refop(const vector& src, Mat& dst, const Mat& mask) + void refop(const vector&, Mat& dst, const Mat& mask) { cvtest::set(dst, gamma, mask); } @@ -808,7 +808,7 @@ struct FlipOp : public BaseElemWiseOp { cvtest::flip(src[0], dst, flipcode); } - void generateScalars(int depth, RNG& rng) + void generateScalars(int, RNG& rng) { flipcode = rng.uniform(0, 3) - 1; } @@ -1291,7 +1291,7 @@ TEST_P(ElemWiseTest, accuracy) ElemWiseOpPtr op = GetParam(); int testIdx = 0; - RNG rng(cvtest::ARITHM_RNG_SEED); + RNG rng((uint64)cvtest::ARITHM_RNG_SEED); for( testIdx = 0; testIdx < cvtest::ARITHM_NTESTS; testIdx++ ) { vector size; diff --git a/modules/features2d/src/blobdetector.cpp b/modules/features2d/src/blobdetector.cpp index b4fbe20cb7..240cfd3383 100644 --- a/modules/features2d/src/blobdetector.cpp +++ b/modules/features2d/src/blobdetector.cpp @@ -41,6 +41,7 @@ //M*/ #include "precomp.hpp" +#include //#define DEBUG_BLOB_DETECTOR diff --git a/modules/imgproc/test/test_canny.cpp b/modules/imgproc/test/test_canny.cpp index c07c76f378..568cc7c5b6 100644 --- a/modules/imgproc/test/test_canny.cpp +++ b/modules/imgproc/test/test_canny.cpp @@ -184,7 +184,7 @@ test_Canny( const Mat& src, Mat& dst, int dxval = dx.at(y, x), dyval = dy.at(y, x); mag.at(y, x) = use_true_gradient ? (float)sqrt((double)(dxval*dxval + dyval*dyval)) : - (float)(fabs(dxval) + fabs(dyval)); + (float)(fabs((double)dxval) + fabs((double)dyval)); } } diff --git a/modules/ts/include/opencv2/ts/ts.hpp b/modules/ts/include/opencv2/ts/ts.hpp index d08e357408..d6b3a27be0 100644 --- a/modules/ts/include/opencv2/ts/ts.hpp +++ b/modules/ts/include/opencv2/ts/ts.hpp @@ -1,6 +1,10 @@ #ifndef __OPENCV_GTESTCV_HPP__ #define __OPENCV_GTESTCV_HPP__ +#ifndef GTEST_CREATE_AS_SHARED_LIBRARY +#define GTEST_LINKED_AS_SHARED_LIBRARY 1 +#endif + #include "opencv2/ts/ts_gtest.h" #include "opencv2/core/core.hpp" diff --git a/modules/ts/src/precomp.hpp b/modules/ts/src/precomp.hpp index c7a0720759..5ff93954cd 100644 --- a/modules/ts/src/precomp.hpp +++ b/modules/ts/src/precomp.hpp @@ -1,2 +1,4 @@ +#define GTEST_CREATE_AS_SHARED_LIBRARY 1 + #include "opencv2/ts/ts.hpp" #include "opencv2/core/core_c.h" diff --git a/modules/ts/src/ts.cpp b/modules/ts/src/ts.cpp index f753d394d0..77ede878cb 100644 --- a/modules/ts/src/ts.cpp +++ b/modules/ts/src/ts.cpp @@ -68,7 +68,7 @@ namespace cvtest #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 #ifdef _MSC_VER -static void setSEHTranslator( unsigned int /*u*/, EXCEPTION_POINTERS* pExp ) +static void SEHTranslator( unsigned int /*u*/, EXCEPTION_POINTERS* pExp ) { int code = TS::FAIL_EXCEPTION; switch( pExp->ExceptionRecord->ExceptionCode )