File gpsdrive-fgets.patch of Package gpsdrive

diff -Nur ../gpsdrive-2.10pre4.orig/src/gpsdrive_config.c ./src/gpsdrive_config.c
--- ../gpsdrive-2.10pre4.orig/src/gpsdrive_config.c	2007-09-15 17:12:03.000000000 +0200
+++ ./src/gpsdrive_config.c	2008-10-28 10:51:22.000000000 +0100
@@ -289,7 +289,7 @@
 	if ( mydebug > 0 )
 		fprintf (stderr,"reading config file %s ...\n", local_config.config_file);
 
-	while ((fgets (buf, 1000, fp)) > 0)
+	while (fgets (buf, 1000, fp))
 		{
 		g_strlcpy (par1, "", sizeof (par1));
 		g_strlcpy (par2, "", sizeof (par2));
diff -Nur ../gpsdrive-2.10pre4.orig/src/map_handler.c ./src/map_handler.c
--- ../gpsdrive-2.10pre4.orig/src/map_handler.c	2007-09-15 09:32:42.000000000 +0200
+++ ./src/map_handler.c	2008-10-28 10:51:34.000000000 +0100
@@ -458,7 +458,7 @@
   gint i;
   gint max_nrmaps = 1000;
   gchar buf[1512], s1[40], s2[40], s3[40], filename[100], minlat[40], minlon[40], maxlat[40], maxlon[40];
-  gint p, e;
+  gint e;
 
   if (mydebug > 50)
     fprintf (stderr, "loadmapconfig()\n");
@@ -494,7 +494,7 @@
   maps = g_new (mapsstruct, max_nrmaps);
   i = nrmaps = 0;
   havenasa = -1;
-  while ((p = fgets (buf, 1512, st) != 0))
+  while (fgets (buf, 1512, st))
     {
       e = sscanf (buf, "%s %s %s %s %s %s %s %s", filename, s1, s2, s3, minlat, minlon, maxlat, maxlon);
       if ((mydebug > 50) && !(nrmaps % 1000))
diff -Nur ../gpsdrive-2.10pre4.orig/src/waypoint.c ./src/waypoint.c
--- ../gpsdrive-2.10pre4.orig/src/waypoint.c	2007-09-14 23:47:13.000000000 +0200
+++ ./src/waypoint.c	2008-10-28 11:12:53.000000000 +0100
@@ -564,11 +564,11 @@
 
 		/* limit waypoint type to 40 chars */
 		g_strlcpy ((wayp + i)->typ, wp_type, 40);
-		(wayp + i)->typ[40] = 0;
+		(wayp + i)->typ[39] = 0;
 		
 		/*  limit waypoint comment to 80 chars */
 		g_strlcpy ((wayp + i)->comment, wp_comment, 80);
-		(wayp + i)->comment[80] = 0;
+		(wayp + i)->comment[79] = 0;
 		
 
 		(wayp + i)->wlan = 0;
@@ -998,7 +998,7 @@
 {
     gchar fn_way_txt[2048];
     FILE *st;
-    gint i, e, p, wlan, action, sqlnr, proximity;
+    gint i, e, wlan, action, sqlnr, proximity;
     gchar buf[512], slat[80], slong[80], typ[40];
     struct stat stat_buf;
     
@@ -1033,7 +1033,7 @@
 	}
 
     i = 0;
-    while ((p = fgets (buf, 512, st) != 0))
+    while (fgets (buf, 512, st))
 	{
 	    e = sscanf (buf, "%s %s %s %s %d %d %d %d\n",
 			(wayp + i)->name, slat, slong, typ,
openSUSE Build Service is sponsored by