On Wed, Mar 16, 2011 at 8:09 PM,  <svn_gr...@osgeo.org> wrote:
> Author: glynn
> Date: 2011-03-16 12:09:47 -0700 (Wed, 16 Mar 2011)
> New Revision: 45681
>
> Modified:
>   grass/trunk/lib/raster/reclass.c
> Log:
> Fix bugs in reclassed_to handling
>
>
> Modified: grass/trunk/lib/raster/reclass.c

Please verify the G6 backport which I have created from r45681,
diff attached.
Question: only G6.5 or also G6.4?

Markus
Index: lib/gis/reclass.c
===================================================================
--- lib/gis/reclass.c	(revision 45682)
+++ lib/gis/reclass.c	(working copy)
@@ -109,6 +109,8 @@
 	(*rmaps)[i - 1] = NULL;
     }
 
+    fclose(fd);
+
     return i;
 }
 
@@ -226,8 +228,9 @@
 {
     FILE *fd;
     long min, max;
-    int i;
-    char buf1[GPATH_MAX], buf2[GNAME_MAX], buf3[GNAME_MAX], *p;
+    int found;
+    char buf1[GPATH_MAX], buf2[GNAME_MAX], *p;
+    char *xname;
 
     switch (reclass->type) {
     case RECLASS_TABLE:
@@ -299,18 +302,22 @@
 
     fseek(fd, 0L, SEEK_SET);
 
-    sprintf(buf2, "%s@%s\n", name, G_mapset());
-    for (i = 0; !feof(fd) && fgets(buf3, 255, fd);) {
-	if (!(strcmp(buf2, buf3))) {
-	    i = 1;
+    xname = G_fully_qualified_name(name, G_mapset());
+    found = 0;
+    for (;;) {
+	char buf[GNAME_MAX + GMAPSET_MAX];
+	if (!G_getl2(buf, sizeof(buf), fd))
 	    break;
+	if (strcmp(xname, buf) == 0) {
+	    found = 1;
+	    break;
 	}
     }
 
-    if (!i) {
-	fprintf(fd, "%s@%s\n", name, G_mapset());
-    }
+    if (!found)
+	fprintf(fd, "%s\n", xname);
 
+    G_free(xname);
     fclose(fd);
 
     return 1;
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to