Explorar el Código

size_t: update bitmap lib

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52042 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz hace 13 años
padre
commit
017bf50fee
Se han modificado 4 ficheros con 8 adiciones y 8 borrados
  1. 1 1
      include/bitmap.h
  2. 2 2
      include/defs/bitmap.h
  3. 2 2
      lib/bitmap/bitmap.c
  4. 3 3
      lib/bitmap/sparse.c

+ 1 - 1
include/bitmap.h

@@ -18,7 +18,7 @@ struct BM
 {
     int rows;
     int cols;
-    int bytes;
+    size_t bytes;
     unsigned char *data;
     int sparse;
     /* char *token; */

+ 2 - 2
include/defs/bitmap.h

@@ -7,7 +7,7 @@ int BM_destroy(struct BM *);
 int BM_set_mode(int, int);
 int BM_set(struct BM *, int, int, int);
 int BM_get(struct BM *, int, int);
-int BM_get_map_size(struct BM *);
+size_t BM_get_map_size(struct BM *);
 int BM_file_write(FILE *, struct BM *);
 struct BM *BM_file_read(FILE *);
 
@@ -16,7 +16,7 @@ struct BM *BM_create_sparse(int, int);
 int BM_destroy_sparse(struct BM *);
 int BM_set_sparse(struct BM *, int, int, int);
 int BM_get_sparse(struct BM *, int, int);
-int BM_get_map_size_sparse(struct BM *);
+size_t BM_get_map_size_sparse(struct BM *);
 int BM_dump_map_sparse(struct BM *);
 int BM_dump_map_row_sparse(struct BM *, int);
 int BM_file_write_sparse(FILE *, struct BM *);

+ 2 - 2
lib/bitmap/bitmap.c

@@ -242,12 +242,12 @@ int BM_get(struct BM *map, int x, int y)
  *  \return int
  */
 
-int BM_get_map_size(struct BM *map)
+size_t BM_get_map_size(struct BM *map)
 {
     if (map->sparse)
 	return BM_get_map_size_sparse(map);
 
-    return map->bytes * map->rows;
+    return (size_t) map->bytes * map->rows;
 }
 
 

+ 3 - 3
lib/bitmap/sparse.c

@@ -269,13 +269,13 @@ int BM_get_sparse(struct BM *map, int x, int y)
  *  \return int
  */
 
-int BM_get_map_size_sparse(struct BM *map)
+size_t BM_get_map_size_sparse(struct BM *map)
 {
     int i;
-    int size;
+    size_t size;
     struct BMlink *p;
 
-    size = map->rows * sizeof(struct BMlink *);
+    size = (size_t) map->rows * sizeof(struct BMlink *);
     for (i = 0; i < map->rows; i++) {
 	p = ((struct BMlink **)(map->data))[i];
 	while (p != NULL) {