fixed errors and warnings when building with MSVC
authorVadim Pisarevsky <no@email>
Mon, 20 Jun 2011 07:53:46 +0000 (07:53 +0000)
committerVadim Pisarevsky <no@email>
Mon, 20 Jun 2011 07:53:46 +0000 (07:53 +0000)
modules/flann/include/opencv2/flann/dist.h
modules/flann/include/opencv2/flann/dynamic_bitset.h
modules/flann/include/opencv2/flann/flann.hpp
modules/flann/include/opencv2/flann/hierarchical_clustering_index.h
modules/flann/include/opencv2/flann/lsh_table.h

index dcb4b5d..2b30059 100644 (file)
 #include <cmath>
 #include <cstdlib>
 #include <string.h>
+#ifdef _MSC_VER
+typedef unsigned uint32_t;
+typedef unsigned __int64 uint64_t;
+#else
 #include <stdint.h>
+#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;
index 4fb8138..e88cfaa 100644 (file)
@@ -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:
index 052515a..99f4bef 100644 (file)
@@ -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);
     }
 }
 
index 64d7cf1..9c3d16e 100644 (file)
@@ -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
index cf39993..c74baab 100644 (file)
@@ -46,7 +46,7 @@
 #include <map>
 #endif
 #include <math.h>
-#include <stdint.h>
+#include <stddef.h>
 
 #include "dynamic_bitset.h"
 #include "matrix.h"
@@ -385,7 +385,7 @@ inline size_t LshTable<unsigned char>::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