[GRASS5] PATCH: lib/gis compiler shutups

Brad Douglas rez at touchofmadness.com
Wed Mar 23 15:32:58 EST 2005


Here's a patch against lib/gis to mostly quiet GCC:

Index: lib/gis/ask.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/ask.c,v
retrieving revision 2.1
diff -u -r2.1 ask.c
--- lib/gis/ask.c	1 Mar 2005 21:50:46 -0000	2.1
+++ lib/gis/ask.c	23 Mar 2005 11:51:11 -0000
@@ -81,6 +81,7 @@
 ******************************************************************/
 #include <string.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include "gis.h"
 #include "glocale.h"
 
Index: lib/gis/cell_stats.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/cell_stats.c,v
retrieving revision 2.0
diff -u -r2.0 cell_stats.c
--- lib/gis/cell_stats.c	9 Nov 2004 12:14:30 -0000	2.0
+++ lib/gis/cell_stats.c	23 Mar 2005 11:51:11 -0000
@@ -289,7 +289,7 @@
 	return 1;
 /* start at root and go all the way to the left */
     s->curp = 1;
-    while (q = s->node[s->curp].left)
+    while ((q = s->node[s->curp].left))
 	s->curp = q;
     s->curoffset = -1;
 
@@ -312,7 +312,7 @@
 	return 1;
     }
 
-    while (q = s->node[s->curp].left)   /* now go all the way left */
+    while ((q = s->node[s->curp].left))   /* now go all the way left */
 	s->curp = q;
 
     return 1;
@@ -385,7 +385,7 @@
 	    s->curoffset = -1;
 	    continue;
 	}
-	if (*count = s->node[s->curp].count[s->curoffset])
+	if ((*count = s->node[s->curp].count[s->curoffset]))
 	{
 	    idx = s->node[s->curp].idx;
 
Index: lib/gis/cellstats_eq.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/cellstats_eq.c,v
retrieving revision 2.0
diff -u -r2.0 cellstats_eq.c
--- lib/gis/cellstats_eq.c	9 Nov 2004 12:14:34 -0000	2.0
+++ lib/gis/cellstats_eq.c	23 Mar 2005 11:51:11 -0000
@@ -7,8 +7,10 @@
     void (*func)())
 {
     long count, total;
-    CELL prev, cat;
-    CELL x, newcat;
+    CELL prev = 0;
+    CELL cat;
+    CELL x;
+    CELL newcat = 0;
     int first;
     double span, sum;
     double range2;
Index: lib/gis/datum.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/datum.c,v
retrieving revision 2.0
diff -u -r2.0 datum.c
--- lib/gis/datum.c	9 Nov 2004 12:16:06 -0000	2.0
+++ lib/gis/datum.c	23 Mar 2005 11:51:12 -0000
@@ -154,7 +154,7 @@
     char *Tmp_file;
     FILE  *Tmp_fd = NULL;
     struct datum_transform_list *list, *listhead, *old;
-    int transformcount, currenttransform, i;
+    int transformcount, currenttransform;
 
     if( G_strcasecmp(datumname, "custom") != 0)
     {
@@ -437,7 +437,6 @@
     for (line = 1; G_getl(buf, sizeof(buf), fd); line++)
     {
         char name[100], descr[100], ellps[100];
-        double dx, dy, dz;
         struct table *t;
 
         G_strip(buf);
Index: lib/gis/get_window.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/get_window.c,v
retrieving revision 2.1
diff -u -r2.1 get_window.c
--- lib/gis/get_window.c	11 Dec 2004 11:50:20 -0000	2.1
+++ lib/gis/get_window.c	23 Mar 2005 11:51:13 -0000
@@ -53,7 +53,7 @@
     {
 	char *err;
 
-	if(err = G__get_window (&dbwindow,"","WIND",G_mapset()))
+	if((err = G__get_window (&dbwindow,"","WIND",G_mapset())))
 	{
 	    G_fatal_error (_("region for current mapset %s\nrun \"g.region
\""), err);
 	    G_free (err);
Index: lib/gis/gets.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/gets.c,v
retrieving revision 2.0
diff -u -r2.0 gets.c
--- lib/gis/gets.c	9 Nov 2004 12:17:41 -0000	2.0
+++ lib/gis/gets.c	23 Mar 2005 11:51:13 -0000
@@ -44,7 +44,7 @@
   
   	ctrlz = 0;
 #ifdef SIGTSTP
-  	if (tty = isatty(0))
+  	if ((tty = isatty(0)))
   	{
 		sigtstp = signal (SIGTSTP, catch_ctrlz);
 		if (sigtstp != (void (*)()) SIG_DFL)
Index: lib/gis/gisinit.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/gisinit.c,v
retrieving revision 1.3
diff -u -r1.3 gisinit.c
--- lib/gis/gisinit.c	30 Nov 2004 21:06:18 -0000	1.3
+++ lib/gis/gisinit.c	23 Mar 2005 11:51:13 -0000
@@ -12,7 +12,6 @@
 #include <sys/stat.h>
 #include "gis.h"
 #include "G.h"
-#include "version.h"
 #include "glocale.h"
 
 struct G__ G__ ;
Index: lib/gis/icon.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/icon.c,v
retrieving revision 1.1
diff -u -r1.1 icon.c
--- lib/gis/icon.c	25 Jan 2002 10:41:17 -0000	1.1
+++ lib/gis/icon.c	23 Mar 2005 11:51:15 -0000
@@ -21,7 +21,7 @@
 /* Plot icon */
 int G_plot_icon (double xc, double yc, int type, double angle, double
scale) 
 {
-    int    i, np;
+    int    i, np = 0;
     double x[10], y[10];
     
     
Index: lib/gis/locale.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/locale.c,v
retrieving revision 2.0
diff -u -r2.0 locale.c
--- lib/gis/locale.c	9 Nov 2004 12:19:25 -0000	2.0
+++ lib/gis/locale.c	23 Mar 2005 11:51:19 -0000
@@ -6,6 +6,7 @@
 #include <string.h>
 #include <locale.h>
 
+#if defined(HAVE_LIBINTL_H) && defined(USE_NLS)
 static char *
 locale_dir(void)
 {
@@ -25,6 +26,7 @@
 
 	return localedir;
 }
+#endif
 
 char *
 G_gettext(const char *package, const char *msgid)
Index: lib/gis/mach_name.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/mach_name.c,v
retrieving revision 2.0
diff -u -r2.0 mach_name.c
--- lib/gis/mach_name.c	9 Nov 2004 12:19:32 -0000	2.0
+++ lib/gis/mach_name.c	23 Mar 2005 11:51:19 -0000
@@ -13,10 +13,12 @@
 
 #include "config.h"
 
+#ifndef HAVE_GETHOSTNAME
 #ifdef HAVE_SYS_UTSNAME_H
 #include <sys/utsname.h>
 static struct utsname attname;
 #endif
+#endif
 
 char *
 G__machine_name()
@@ -29,7 +31,7 @@
     gethostname(name, sizeof(name));
     name[sizeof(name)-1] = 0;	/* make sure null terminated */
 #else
-#ifdef HAVE_UNAME
+#ifdef HAVE_SYS_UTSNAME_H
     uname (&attname);
     strcpy (name, attname.nodename);
 #endif
Index: lib/gis/opencell.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/opencell.c,v
retrieving revision 2.0
diff -u -r2.0 opencell.c
--- lib/gis/opencell.c	9 Nov 2004 12:20:16 -0000	2.0
+++ lib/gis/opencell.c	23 Mar 2005 11:51:20 -0000
@@ -220,7 +220,7 @@
     char *r_name ;
     char *r_mapset ;
     struct Cell_head cellhd ;
-    int CELL_nbytes;                   /* bytes per cell in CELL map */
+    int CELL_nbytes = 0;                   /* bytes per cell in CELL
map */
     int INTERN_SIZE;
     int reclass_flag, i;
     int MAP_NBYTES;
Index: lib/gis/parser.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/parser.c,v
retrieving revision 1.48
diff -u -r1.48 parser.c
--- lib/gis/parser.c	22 Mar 2005 15:10:37 -0000	1.48
+++ lib/gis/parser.c	23 Mar 2005 11:51:28 -0000
@@ -1422,8 +1422,8 @@
 
 static int set_option (char *string)
 {
-	struct Option *at_opt ;
-	struct Option *opt ;
+	struct Option *at_opt = NULL;
+	struct Option *opt = NULL;
 	int got_one ;
 	int key_len ;
 	char the_key[64] ;
Index: lib/gis/quant_io.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/quant_io.c,v
retrieving revision 2.0
diff -u -r2.0 quant_io.c
--- lib/gis/quant_io.c	9 Nov 2004 12:21:11 -0000	2.0
+++ lib/gis/quant_io.c	23 Mar 2005 11:51:33 -0000
@@ -69,6 +69,7 @@
 
 static int quant_parse_file (FILE *,struct Quant *);
 
+#if 0
 static int
 /* redundant: integer range doesn't exist now: it is defined by
    the quant rules */
@@ -106,6 +107,7 @@
 
   return 1;
 }
+#endif
 
 /*--------------------------------------------------------------------------*/
 
Index: lib/gis/sites.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/sites.c,v
retrieving revision 1.1
diff -u -r1.1 sites.c
--- lib/gis/sites.c	23 Sep 2003 09:00:16 -0000	1.1
+++ lib/gis/sites.c	23 Mar 2005 11:51:35 -0000
@@ -532,7 +532,7 @@
    site structures by category. */
 {
   int result = 0;               /* integer to be returned */
-  double diff;
+  double diff = 0;
  
   switch((*(Site **)a)->cattype)
   {



-- 
Brad Douglas <rez at touchofmadness.com>




More information about the grass-dev mailing list