Przeglądaj źródła

r.quantile: attempt to fix integer overflow

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@70982 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 8 lat temu
rodzic
commit
ec88ab7b8a
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      raster/r.quantile/main.c

+ 3 - 2
raster/r.quantile/main.c

@@ -18,11 +18,12 @@
 #include <grass/raster.h>
 #include <grass/glocale.h>
 
+/* TODO: replace long with either size_t or a guaranteed 64 bit integer */
 struct bin
 {
     unsigned long origin;
     DCELL min, max;
-    int base, count;
+    long base, count;
 };
 
 static int rows, cols;
@@ -34,7 +35,7 @@ static int num_slots;
 static unsigned int *slots;
 static DCELL slot_size;
 static unsigned long total;
-static int num_values;
+static size_t num_values;
 static unsigned short *slot_bins;
 static int num_bins;
 static struct bin *bins;