diff src/modplug/archive/arch_rar.cxx @ 963:9549fea94794 trunk

[svn] Warning fixes from SuSe.
author chainsaw
date Tue, 17 Apr 2007 14:45:19 -0700
parents 3da1b8942b8b
children 269d1f2187bd
line wrap: on
line diff
--- a/src/modplug/archive/arch_rar.cxx	Mon Apr 16 01:35:24 2007 -0700
+++ b/src/modplug/archive/arch_rar.cxx	Tue Apr 17 14:45:19 2007 -0700
@@ -45,7 +45,13 @@
 
 	int num = 7;
 	while (num--) // ignore 7 lines.
-		fgets(lBuffer, 90, f);
+	{
+		if(!fgets(lBuffer, 90, f))
+		{
+			mSize = 0;
+			return;
+		}
+        }
 	
 	bool eof = false;
 	while(!eof)
@@ -112,7 +118,8 @@
 		return;
 	}
 
-	fread((char *)mMap, sizeof(char), mSize, f);
+	if(fread((char *)mMap, sizeof(char), mSize, f) != mSize)
+		mSize = 0;
 	
 	pclose(f);
 }
@@ -145,7 +152,15 @@
 
 	int num = 7;
 	while (num--)
-		fgets(lBuffer, 90, f); //ignore a line.
+	{
+		
+		if(!fgets(lBuffer, 90, f)) //ignore a line.
+		{
+			pclose(f);
+			return false;
+		}
+
+	}
 
 	bool eof = false;
 	while(!eof)