[GRASS-SVN] r68376 - grass/trunk/raster/r.volume
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 3 19:11:09 PDT 2016
Author: annakrat
Date: 2016-05-03 19:11:09 -0700 (Tue, 03 May 2016)
New Revision: 68376
Modified:
grass/trunk/raster/r.volume/centroids.c
grass/trunk/raster/r.volume/local_proto.h
grass/trunk/raster/r.volume/main.c
Log:
r.volume: change int type to prevent overflow, see #3004
Modified: grass/trunk/raster/r.volume/centroids.c
===================================================================
--- grass/trunk/raster/r.volume/centroids.c 2016-05-03 19:16:43 UTC (rev 68375)
+++ grass/trunk/raster/r.volume/centroids.c 2016-05-04 02:11:09 UTC (rev 68376)
@@ -22,7 +22,7 @@
int centroids(int fd, /* File descriptor of map layer to process */
/* This file is assumed to be opened before calling */
/* centroids. */
- int *e, int *n, /* Pointers to arrays at least max+1 long */
+ unsigned long *e, unsigned long *n, /* Pointers to arrays at least max+1 long */
int method, /* 0, 1, or 2; see above. */
int max)
{ /* Highest positive cat number in map layer */
Modified: grass/trunk/raster/r.volume/local_proto.h
===================================================================
--- grass/trunk/raster/r.volume/local_proto.h 2016-05-03 19:16:43 UTC (rev 68375)
+++ grass/trunk/raster/r.volume/local_proto.h 2016-05-04 02:11:09 UTC (rev 68376)
@@ -1,3 +1,3 @@
#define SEP "-----------------------------------------------------------------------------"
-int centroids(int, int *, int *, int, int);
+int centroids(int, unsigned long*, unsigned long*, int, int);
Modified: grass/trunk/raster/r.volume/main.c
===================================================================
--- grass/trunk/raster/r.volume/main.c 2016-05-03 19:16:43 UTC (rev 68375)
+++ grass/trunk/raster/r.volume/main.c 2016-05-04 02:11:09 UTC (rev 68376)
@@ -41,7 +41,8 @@
CELL i, max;
int row, col, rows, cols;
- int out_mode, use_MASK, *n, *e;
+ int out_mode, use_MASK;
+ unsigned long *n, *e;
long int *count;
int fd_data, fd_clump;
@@ -216,8 +217,8 @@
G_free(clump_buf);
/* data lists for centroids of clumps */
- e = (int *)G_malloc((max + 1) * sizeof(int));
- n = (int *)G_malloc((max + 1) * sizeof(int));
+ e = (unsigned long*)G_malloc((max + 1) * sizeof(unsigned long));
+ n = (unsigned long*)G_malloc((max + 1) * sizeof(unsigned long));
i = centroids(fd_clump, e, n, 1, max);
More information about the grass-commit
mailing list