[GRASS-SVN] r32906 - grass/trunk/raster/r.support

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 19 18:35:42 EDT 2008


Author: glynn
Date: 2008-08-19 18:35:42 -0400 (Tue, 19 Aug 2008)
New Revision: 32906

Modified:
   grass/trunk/raster/r.support/check.c
   grass/trunk/raster/r.support/histo.c
Log:
Don't use EXIT_{SUCCESS,FAILURE} for function return values


Modified: grass/trunk/raster/r.support/check.c
===================================================================
--- grass/trunk/raster/r.support/check.c	2008-08-19 22:31:35 UTC (rev 32905)
+++ grass/trunk/raster/r.support/check.c	2008-08-19 22:35:42 UTC (rev 32906)
@@ -23,10 +23,11 @@
     data_type = G_raster_map_type(name, "");
 
     G_message(_("\n  Updating statistics for [%s]"), name);
-    if (!do_histogram(name))
-	return EXIT_SUCCESS;
+    if (do_histogram(name) < 0)
+	return 0;
+
     if (G_read_histogram(name, "", &histogram) <= 0)
-	return EXIT_SUCCESS;
+	return 0;
 
     /* Init histogram range */
     if (data_type == CELL_TYPE)
@@ -72,5 +73,5 @@
     G_free_histogram(&histogram);
     G_free_cats(&cats);
 
-    return EXIT_SUCCESS;
+    return 0;
 }

Modified: grass/trunk/raster/r.support/histo.c
===================================================================
--- grass/trunk/raster/r.support/histo.c	2008-08-19 22:31:35 UTC (rev 32905)
+++ grass/trunk/raster/r.support/histo.c	2008-08-19 22:35:42 UTC (rev 32906)
@@ -30,8 +30,10 @@
 
     G_init_cell_stats(&statf);
     for (row = 0; row < nrows; row++) {
-	if (G_get_map_row_nomask(fd, cell, row) < 0)
+	if (G_get_map_row_nomask(fd, cell, row) < 0) {
+	    G_warning(_("Unable to read row %d"), row);
 	    break;
+	}
 
 	G_update_cell_stats(cell, ncols, &statf);
     }
@@ -43,8 +45,8 @@
     G_close_cell(fd);
     G_free(cell);
 
-    if (row == nrows)
-	return EXIT_SUCCESS;
+    if (row < nrows)
+	return -1;
 
-    return EXIT_FAILURE;
+    return 0;
 }



More information about the grass-commit mailing list