[GRASS-SVN] r52044 - in grass/trunk: include include/defs lib/ogsf

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 12 05:08:34 PDT 2012


Author: mmetz
Date: 2012-06-12 05:08:33 -0700 (Tue, 12 Jun 2012)
New Revision: 52044

Modified:
   grass/trunk/include/defs/ogsf.h
   grass/trunk/include/ogsf.h
   grass/trunk/lib/ogsf/gs.c
   grass/trunk/lib/ogsf/gsds.c
   grass/trunk/lib/ogsf/rowcol.h
Log:
size_t: update ogsf lib

Modified: grass/trunk/include/defs/ogsf.h
===================================================================
--- grass/trunk/include/defs/ogsf.h	2012-06-12 11:48:20 UTC (rev 52043)
+++ grass/trunk/include/defs/ogsf.h	2012-06-12 12:08:33 UTC (rev 52044)
@@ -382,7 +382,7 @@
 int gs_get_att_type(geosurf *, int);
 int gs_get_att_src(geosurf *, int);
 typbuff *gs_get_att_typbuff(geosurf *, int, int);
-int gs_malloc_att_buff(geosurf *, int, int);
+size_t gs_malloc_att_buff(geosurf *, int, int);
 int gs_malloc_lookup(geosurf *, int);
 int gs_set_att_type(geosurf *, int, int);
 int gs_set_att_src(geosurf *, int, int);
@@ -615,8 +615,8 @@
 char *gsds_get_name(int);
 int gsds_free_datah(int);
 int gsds_free_data_buff(int, int);
-int free_data_buffs(dataset *, int);
-int gsds_alloc_typbuff(int, int *, int, int);
+size_t free_data_buffs(dataset *, int);
+size_t gsds_alloc_typbuff(int, int *, int, int);
 int gsds_get_changed(int);
 int gsds_set_changed(int, IFLAG);
 int gsds_get_type(int);

Modified: grass/trunk/include/ogsf.h
===================================================================
--- grass/trunk/include/ogsf.h	2012-06-12 11:48:20 UTC (rev 52043)
+++ grass/trunk/include/ogsf.h	2012-06-12 12:08:33 UTC (rev 52044)
@@ -234,7 +234,7 @@
     int data_id;
     int dims[MAXDIMS];
     int ndims;
-    int numbytes;
+    size_t numbytes;
     char *unique_name;
     typbuff databuff;
     IFLAG changed;

Modified: grass/trunk/lib/ogsf/gs.c
===================================================================
--- grass/trunk/lib/ogsf/gs.c	2012-06-12 11:48:20 UTC (rev 52043)
+++ grass/trunk/lib/ogsf/gs.c	2012-06-12 12:08:33 UTC (rev 52044)
@@ -712,9 +712,9 @@
    \param type buffer type (based on raster map type)
 
    \return -1 on error
-   \return pointer to typbuff (casted)
+   \return amount of allocated memory
  */
-int gs_malloc_att_buff(geosurf * gs, int desc, int type)
+size_t gs_malloc_att_buff(geosurf * gs, int desc, int type)
 {
     int hdata, dims[2], ndims;
 

Modified: grass/trunk/lib/ogsf/gsds.c
===================================================================
--- grass/trunk/lib/ogsf/gsds.c	2012-06-12 11:48:20 UTC (rev 52043)
+++ grass/trunk/lib/ogsf/gsds.c	2012-06-12 12:08:33 UTC (rev 52044)
@@ -76,7 +76,7 @@
 
 static int Cur_id = LUCKY;
 static int Cur_max;
-static int Tot_mem = 0;
+static size_t Tot_mem = 0;
 
 /*!
    \brief Initialize gsds
@@ -390,9 +390,10 @@
 
    \return freed size
  */
-int free_data_buffs(dataset * ds, int typ)
+size_t free_data_buffs(dataset * ds, int typ)
 {
-    int nsiz = 1, i, siz, freed = 0;
+    int i;
+    size_t siz, nsiz = 1, freed = 0;
 
     for (i = 0; i < ds->ndims; i++) {
 	nsiz *= ds->dims[i];
@@ -476,12 +477,13 @@
    \param ndims number of dimensions
    \param type data type
 
-   \return
+   \return amount of allocated memory
  */
-int gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
+size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
 {
     dataset *ds;
-    int i, siz = 1;
+    int i;
+    size_t siz = 1;
 
     if ((ds = get_dataset(id))) {
 	/*

Modified: grass/trunk/lib/ogsf/rowcol.h
===================================================================
--- grass/trunk/lib/ogsf/rowcol.h	2012-06-12 11:48:20 UTC (rev 52043)
+++ grass/trunk/lib/ogsf/rowcol.h	2012-06-12 12:08:33 UTC (rev 52044)
@@ -3,6 +3,8 @@
 
 /* these defines work with modeling coordinates only */
 
+/* TODO: avoid integer overflow */
+
 /* view resolutions */
 #define VXRES(gs)   (gs->x_mod * gs->xres)
 #define VYRES(gs)   (gs->y_mod * gs->yres)



More information about the grass-commit mailing list