From: Vadim Pisarevsky Date: Mon, 20 Jun 2011 07:53:46 +0000 (+0000) Subject: fixed errors and warnings when building with MSVC X-Git-Tag: accepted/2.0/20130307.220821~2696 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24cb30fed550823d3c01cf0fdbfa85e654d246e6;p=profile%2Fivi%2Fopencv.git fixed errors and warnings when building with MSVC --- diff --git a/modules/flann/include/opencv2/flann/dist.h b/modules/flann/include/opencv2/flann/dist.h index dcb4b5d..2b30059 100644 --- a/modules/flann/include/opencv2/flann/dist.h +++ b/modules/flann/include/opencv2/flann/dist.h @@ -34,7 +34,12 @@ #include #include #include +#ifdef _MSC_VER +typedef unsigned uint32_t; +typedef unsigned __int64 uint64_t; +#else #include +#endif #include "defines.h" @@ -150,10 +155,10 @@ struct L2 /* Process 4 items with each loop for efficiency. */ while (a < lastgroup) { - diff0 = a[0] - b[0]; - diff1 = a[1] - b[1]; - diff2 = a[2] - b[2]; - diff3 = a[3] - b[3]; + diff0 = (ResultType)(a[0] - b[0]); + diff1 = (ResultType)(a[1] - b[1]); + diff2 = (ResultType)(a[2] - b[2]); + diff3 = (ResultType)(a[3] - b[3]); result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3; a += 4; b += 4; diff --git a/modules/flann/include/opencv2/flann/dynamic_bitset.h b/modules/flann/include/opencv2/flann/dynamic_bitset.h index 4fb8138..e88cfaa 100644 --- a/modules/flann/include/opencv2/flann/dynamic_bitset.h +++ b/modules/flann/include/opencv2/flann/dynamic_bitset.h @@ -138,7 +138,7 @@ public: */ bool test(size_t index) const { - return (bool)(bitset_[index / cell_bit_size_] & (size_t(1) << (index % cell_bit_size_))); + return (bitset_[index / cell_bit_size_] & (size_t(1) << (index % cell_bit_size_))) != 0; } private: diff --git a/modules/flann/include/opencv2/flann/flann.hpp b/modules/flann/include/opencv2/flann/flann.hpp index 052515a..99f4bef 100644 --- a/modules/flann/include/opencv2/flann/flann.hpp +++ b/modules/flann/include/opencv2/flann/flann.hpp @@ -57,7 +57,7 @@ namespace cvflann FLANN_DEPRECATED inline void set_distance_type(flann_distance_t distance_type, int order = 0) { - flann_distance_type_() = distance_type; + flann_distance_type_() = (flann_distance_t)((size_t)distance_type + order*0); } } diff --git a/modules/flann/include/opencv2/flann/hierarchical_clustering_index.h b/modules/flann/include/opencv2/flann/hierarchical_clustering_index.h index 64d7cf1..9c3d16e 100644 --- a/modules/flann/include/opencv2/flann/hierarchical_clustering_index.h +++ b/modules/flann/include/opencv2/flann/hierarchical_clustering_index.h @@ -224,7 +224,7 @@ private: // Repeat several trials double bestNewPot = -1; - int bestNewIndex; + int bestNewIndex = 0; for (int localTrial = 0; localTrial < numLocalTries; localTrial++) { // Choose our center - have to be slightly careful to return a valid answer even accounting diff --git a/modules/flann/include/opencv2/flann/lsh_table.h b/modules/flann/include/opencv2/flann/lsh_table.h index cf39993..c74baab 100644 --- a/modules/flann/include/opencv2/flann/lsh_table.h +++ b/modules/flann/include/opencv2/flann/lsh_table.h @@ -46,7 +46,7 @@ #include #endif #include -#include +#include #include "dynamic_bitset.h" #include "matrix.h" @@ -385,7 +385,7 @@ inline size_t LshTable::getKey(const unsigned char* feature) cons size_t mask_block = *pmask_block; while (mask_block) { // Get the lowest set bit in the mask block - size_t lowest_bit = mask_block & (-mask_block); + size_t lowest_bit = mask_block & (-(ptrdiff_t)mask_block); // Add it to the current subsignature if necessary subsignature += (feature_block & lowest_bit) ? bit_index : 0; // Reset the bit in the mask block