[GRASSLIST:5319] Compilation error in r.mapcalc

Tom Russo russo at bogodyn.org
Wed Jan 12 12:03:16 EST 2005


I'm running Grass5.7 on FreeBSD 4.x, which still uses GCC 2.95.  When I updated
today and tried to build I got a compilation error in r.mapcalc.  Turns
out that in Monday's commit to map3.c, a variable declaration was inserted
after the first executable line in a block --- something that GCC 2.95 
considers a syntax error but GCC 3.x does not.

The attached patch fixes it by moving the declaration of "handle" before
the call to setup_region.

Could someone commit this?

-- 
Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
 "When life gives you lemons, find someone with a paper cut."
-------------- next part --------------
Index: map3.c
===================================================================
RCS file: /home/grass/grassrepository/grass51/raster/r.mapcalc/map3.c,v
retrieving revision 2.2
diff -u -u -r2.2 map3.c
--- map3.c	10 Jan 2005 17:23:46 -0000	2.2
+++ map3.c	12 Jan 2005 16:58:47 -0000
@@ -497,8 +497,9 @@
 		mapset = G_find_grid3(tmpname, "");
 		if (mapset)
 		{
+                        void *handle;
 			setup_region(); /* TODO: setup_region should be called by evaluate() ? */
-			void *handle = G3d_openCellOld(
+			handle = G3d_openCellOld(
 				tmpname, mapset, &current_region3,
 				G3D_TILE_SAME_AS_FILE, G3D_NO_CACHE);
 			result = (G3d_fileTypeMap == G3D_FLOAT)


More information about the grass-user mailing list