[GRASS-SVN] r57867 - grass/branches/releasebranch_6_4/imagery/i.landsat.toar

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 30 07:37:54 PDT 2013


Author: neteler
Date: 2013-09-30 07:37:54 -0700 (Mon, 30 Sep 2013)
New Revision: 57867

Modified:
   grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat_met.c
   grass/branches/releasebranch_6_4/imagery/i.landsat.toar/main.c
Log:
i.landsat.toar: fix compiler warnings (author: E. Jorge Tizado)

Modified: grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat_met.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat_met.c	2013-09-30 02:12:02 UTC (rev 57866)
+++ grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat_met.c	2013-09-30 14:37:54 UTC (rev 57867)
@@ -17,7 +17,7 @@
 #define TM5_MET_SIZE    28700	/* .met file size 28686 bytes */
 
 
-inline void chrncpy(char *dest, char src[], int n)
+static void chrncpy(char *dest, char src[], int n)
 {
     int i;
 
@@ -31,7 +31,7 @@
     while (*str) {
 	if (*str == '/')
 	    *str = '-';
-	*str++;
+	str++;
     }
 }
 
@@ -46,9 +46,9 @@
 	if (ptr != NULL) {
 	    while (*ptr++ != '=') ;
 	    while (*ptr <= ' ')
-		*ptr++;
+		ptr++;
 	    if (*ptr == '\"')
-		*ptr++;
+		ptr++;
 	    while (i < MAX_STR && *ptr != '\"' && *ptr >= ' ')
 		value[i++] = *ptr++;
 	}
@@ -64,9 +64,9 @@
     if (ptr != NULL) {
 	while (*ptr++ != '=') ;
 	while (*ptr <= ' ')
-	    *ptr++;
+	    ptr++;
 	if (*ptr == '\"')
-	    *ptr++;
+	    ptr++;
 	while (i < MAX_STR && *ptr != '\"' && *ptr > ' ')
 	    value[i++] = *ptr++;
     }

Modified: grass/branches/releasebranch_6_4/imagery/i.landsat.toar/main.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.landsat.toar/main.c	2013-09-30 02:12:02 UTC (rev 57866)
+++ grass/branches/releasebranch_6_4/imagery/i.landsat.toar/main.c	2013-09-30 14:37:54 UTC (rev 57867)
@@ -335,6 +335,8 @@
 	    G_set_window(&cellhd);
 
 	    in_data_type = G_raster_map_type(band_in, mapset);
+	    if (in_data_type < 0)
+	        G_fatal_error(_("Unable to read data type of raster map <%s>"), band_in);
 	    inrast = G_allocate_raster_buf(in_data_type);
 
 	    nrows = G_window_rows();
@@ -357,6 +359,10 @@
 			ptr = (void *)((DCELL *) inrast + col);
 			q = (int)*((DCELL *) ptr);
 			break;
+		   default:
+		        ptr = NULL;
+		        q = -1.;
+			break;
 		    }
 		    if (!G_is_null_value(ptr, in_data_type) &&
 			q >= lsat.band[i].qcalmin &&
@@ -470,6 +476,8 @@
 	if ((infd = G_open_cell_old(band_in, mapset)) < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"), band_in);
 	in_data_type = G_raster_map_type(band_in, mapset);
+	if (in_data_type < 0)
+	    G_fatal_error(_("Unable to read data type of raster map <%s>"), band_in);
 	if (G_get_cellhd(band_in, mapset, &cellhd) < 0)
 	    G_fatal_error(_("Unable to read header of raster map <%s>"),
 			  band_in);
@@ -515,6 +523,10 @@
 		    ptr = (void *)((DCELL *) inrast + col);
 		    qcal = (double)((DCELL *) inrast)[col];
 		    break;
+		default:
+		  ptr = NULL;
+		  qcal = -1.;
+		  break;
 		}
 		if (G_is_null_value(ptr, in_data_type) ||
 		    qcal < lsat.band[i].qcalmin) {



More information about the grass-commit mailing list