Переглянути джерело

ogsf lib: fix return types and var types

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52049 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 13 роки тому
батько
коміт
17bf321444
5 змінених файлів з 25 додано та 23 видалено
  1. 7 7
      lib/ogsf/GS2.c
  2. 1 1
      lib/ogsf/gs.c
  3. 2 2
      lib/ogsf/gsd_img_tif.c
  4. 2 0
      lib/ogsf/gsd_wire.c
  5. 13 13
      lib/ogsf/gsds.c

+ 7 - 7
lib/ogsf/GS2.c

@@ -1730,13 +1730,13 @@ int GS_load_att_map(int id, const char *filename, int att)
 	    atty = ATTY_INT;
 	}
 
-	if (0 > gs_malloc_att_buff(gs, att, ATTY_NULL)) {
+	if (0 == gs_malloc_att_buff(gs, att, ATTY_NULL)) {
 	    G_fatal_error(_("GS_load_att_map(): Out of memory. Unable to load map"));
 	}
 
 	switch (atty) {
 	case ATTY_MASK:
-	    if (0 > gs_malloc_att_buff(gs, att, ATTY_MASK)) {
+	    if (0 == gs_malloc_att_buff(gs, att, ATTY_MASK)) {
 		G_fatal_error(_("GS_load_att_map(): Out of memory. Unable to load map"));
 	    }
 
@@ -1744,7 +1744,7 @@ int GS_load_att_map(int id, const char *filename, int att)
 	    
 	    break;
 	case ATTY_CHAR:
-	    if (0 > gs_malloc_att_buff(gs, att, ATTY_CHAR)) {
+	    if (0 == gs_malloc_att_buff(gs, att, ATTY_CHAR)) {
 		G_fatal_error(_("GS_load_att_map(): Out of memory. Unable to load map"));
 	    }
 
@@ -1753,7 +1753,7 @@ int GS_load_att_map(int id, const char *filename, int att)
 
 	    break;
 	case ATTY_SHORT:
-	    if (0 > gs_malloc_att_buff(gs, att, ATTY_SHORT)) {
+	    if (0 == gs_malloc_att_buff(gs, att, ATTY_SHORT)) {
 		G_fatal_error(_("GS_load_att_map(): Out of memory. Unable to load map"));
 	    }
 
@@ -1761,7 +1761,7 @@ int GS_load_att_map(int id, const char *filename, int att)
 				      tbuff->nm, &has_null);
 	    break;
 	case ATTY_FLOAT:
-	    if (0 > gs_malloc_att_buff(gs, att, ATTY_FLOAT)) {
+	    if (0 == gs_malloc_att_buff(gs, att, ATTY_FLOAT)) {
 		G_fatal_error(_("GS_load_att_map(): Out of memory. Unable to load map"));
 	    }
 
@@ -1771,7 +1771,7 @@ int GS_load_att_map(int id, const char *filename, int att)
 	    break;
 	case ATTY_INT:
 	default:
-	    if (0 > gs_malloc_att_buff(gs, att, ATTY_INT)) {
+	    if (0 == gs_malloc_att_buff(gs, att, ATTY_INT)) {
 		G_fatal_error(_("GS_load_att_map(): Out of memory. Unable to load map"));
 	    }
 
@@ -1819,7 +1819,7 @@ int GS_load_att_map(int id, const char *filename, int att)
 	}
 	else if (ATTY_FLOAT == atty) {
 	    if (!reuse) {
-		if (0 > gs_malloc_att_buff(gs, att, ATTY_INT)) {
+		if (0 == gs_malloc_att_buff(gs, att, ATTY_INT)) {
 		    G_fatal_error(_("GS_load_att_map(): Out of memory. Unable to load map"));
 		}
 

+ 1 - 1
lib/ogsf/gs.c

@@ -731,7 +731,7 @@ size_t gs_malloc_att_buff(geosurf * gs, int desc, int type)
 	}
     }
 
-    return (-1);
+    return 0;
 }
 
 /*!

+ 2 - 2
lib/ogsf/gsd_img_tif.c

@@ -51,7 +51,7 @@ unsigned short rowsperstrip = 0;
 int GS_write_tif(const char *name)
 {
     TIFF *out;
-    int y, x;
+    unsigned int y, x;
     unsigned int xsize, ysize;
     int mapsize, linebytes;
     unsigned char *buf, *tmpptr;
@@ -96,7 +96,7 @@ int GS_write_tif(const char *name)
 
     /* Done with Header Info */
     for (y = 0; y < ysize; y++) {
-	int yy = ysize - y - 1;
+	unsigned int yy = ysize - y - 1;
 
 	tmpptr = buf;
 

+ 2 - 0
lib/ogsf/gsd_wire.c

@@ -485,6 +485,7 @@ int gsd_wire_arrows(geosurf * surf)
      */
 
     check_color = 1;
+    curcolor = 0;
     coloratt = &(surf->att[ATT_COLOR]);
     col_src = surf->att[ATT_COLOR].att_src;
 
@@ -690,6 +691,7 @@ int gsd_coarse_surf_map(geosurf * surf)
     /* will need to check for color source of FUNC_ATT & NOTSET_ATT, 
        or else use more general and inefficient gets */
     check_color = 1;
+    curcolor = 0;
     coloratt = &(surf->att[ATT_COLOR]);
     col_src = surf->att[ATT_COLOR].att_src;
 

+ 13 - 13
lib/ogsf/gsds.c

@@ -502,11 +502,11 @@ size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
 	case ATTY_NULL:
 	    if (ndims != 2) {
 		/* higher dimension bitmaps not supported */
-		return (-1);
+		return 0;
 	    }
 
 	    if (NULL == (ds->databuff.nm = BM_create(dims[1], dims[0]))) {
-		return (-1);
+		return 0;
 	    }
 
 	    siz = BM_get_map_size(ds->databuff.nm);
@@ -520,7 +520,7 @@ size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
 	    }
 
 	    if (NULL == (ds->databuff.bm = BM_create(dims[1], dims[0]))) {
-		return (-1);
+		return 0;
 	    }
 
 	    siz = BM_get_map_size(ds->databuff.bm);
@@ -533,11 +533,11 @@ size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
 	    if (siz) {
 		if (NULL ==
 		    (ds->databuff.cb = (unsigned char *)G_malloc(siz))) {
-		    return (-1);
+		    return 0;
 		}
 	    }
 	    else {
-		return (-1);
+		return 0;
 	    }
 
 	    break;
@@ -547,11 +547,11 @@ size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
 
 	    if (siz) {
 		if (NULL == (ds->databuff.sb = (short *)G_malloc(siz))) {
-		    return (-1);
+		    return 0;
 		}
 	    }
 	    else {
-		return (-1);
+		return 0;
 	    }
 
 	    break;
@@ -561,11 +561,11 @@ size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
 
 	    if (siz) {
 		if (NULL == (ds->databuff.ib = (int *)G_malloc(siz))) {
-		    return (-1);
+		    return 0;
 		}
 	    }
 	    else {
-		return (-1);
+		return 0;
 	    }
 
 	    break;
@@ -575,17 +575,17 @@ size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
 
 	    if (siz) {
 		if (NULL == (ds->databuff.fb = (float *)G_malloc(siz))) {
-		    return (-1);
+		    return 0;
 		}
 	    }
 	    else {
-		return (-1);
+		return 0;
 	    }
 
 	    break;
 
 	default:
-	    return (-1);
+	    return 0;
 	}
 
 	ds->changed = 0;	/* starting with clean slate */
@@ -601,7 +601,7 @@ size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
 	return (siz);
     }
 
-    return (-1);
+    return 0;
 }
 
 /*!