diff compat.c @ 1109:1c24949cf853

Fixed a configure warning about datarootdir. (Just ignoring it for now) Upped the version number to 2.1 in configure.in and using autoconf 2.67. Fixed a pair of Linux/gcc warnings in the compat library.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Jul 2011 20:35:05 +0000
parents 13debcad9757
children 404b639f096b
line wrap: on
line diff
--- a/compat.c	Tue Jul 26 10:38:31 2011 +0000
+++ b/compat.c	Tue Jul 26 20:35:05 2011 +0000
@@ -689,7 +689,7 @@
 	}
 }
 
-void _stripcrlf(char *buf)
+int _stripcrlf(char *buf)
 {
 	int z, len = strlen(buf);
 
@@ -698,9 +698,10 @@
 		if(buf[z] == '\r' || buf[z] == '\n')
 		{
 			buf[z] = 0;
-			return;
+			return 1;
 		}
 	}
+	return 1;
 }
 
 #ifdef __WIN32__
@@ -746,9 +747,7 @@
 
 	if(fp)
 	{
-
-		fgets(text, 1024, fp);
-		if(strncasecmp(text, "MESSAGES=", 9) == 0 && (count = atoi(&text[9])) > 0)
+		if(fgets(text, 1024, fp) && strncasecmp(text, "MESSAGES=", 9) == 0 && (count = atoi(&text[9])) > 0)
 		{
 			int current = -1;
 
@@ -756,10 +755,8 @@
 
 			while(!feof(fp))
 			{
-				fgets(text, 1024, fp);
-				_stripcrlf(text);
-
-				if(strncasecmp(text, "LOCALE=", 7) == 0)
+				if(fgets(text, 1024, fp) && _stripcrlf(text) &&
+				   strncasecmp(text, "LOCALE=", 7) == 0)
 				{
 					if(current > -1)
 					{