[mapserver-commits] r11420 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Mar 31 08:22:19 EDT 2011


Author: tbonfort
Date: 2011-03-31 05:22:19 -0700 (Thu, 31 Mar 2011)
New Revision: 11420

Modified:
   trunk/mapserver/mapimageio.c
Log:
fix compiler warning on unused return value from fread


Modified: trunk/mapserver/mapimageio.c
===================================================================
--- trunk/mapserver/mapimageio.c	2011-03-31 11:48:35 UTC (rev 11419)
+++ trunk/mapserver/mapimageio.c	2011-03-31 12:22:19 UTC (rev 11420)
@@ -618,7 +618,11 @@
         msSetError(MS_MISCERR, "unable to open file %s for reading", "loadGDImg()", path);
         return MS_FAILURE;
     }
-    fread(bytes,8,1,stream); /* read some bytes to try and identify the file */
+    if(1 != fread(bytes,8,1,stream)) /* read some bytes to try and identify the file */
+    {
+        msSetError(MS_MISCERR, "Unable to read header from image file %s", "msLoadGDRasterBufferFromFile()",path);
+        return MS_FAILURE;
+    }
     rewind(stream); /* reset the image for the readers */
     if(memcmp(bytes,"GIF8",4)==0) {
 #ifdef USE_GD_GIF
@@ -627,7 +631,7 @@
         img = gdImageCreateFromGifCtx(ctx);
         ctx->gd_free(ctx);
 #else
-        msSetError(MS_MISCERR, "Unable to load GIF symbol.", "msGetSymbolGdPixmap()");
+        msSetError(MS_MISCERR, "Unable to load GIF symbol.", "msLoadGDRasterBufferFromFile()");
         return MS_FAILURE;
 #endif
     } else if (memcmp(bytes,PNGsig,8)==0) {
@@ -637,7 +641,7 @@
         img = gdImageCreateFromPngCtx(ctx);
         ctx->gd_free(ctx);
 #else
-        msSetError(MS_MISCERR, "Unable to load PNG symbol.", "msGetSymbolGdPixmap()");
+        msSetError(MS_MISCERR, "Unable to load PNG symbol.", "msLoadGDRasterBufferFromFile()");
         return MS_FAILURE;
 #endif
     }
@@ -1175,10 +1179,13 @@
     int ret = MS_FAILURE;
     stream = fopen(path,"rb");
     if(!stream) {
-        msSetError(MS_MISCERR, "unable to open file %s for reading", "msLoadRasterBuffer()", path);
+        msSetError(MS_MISCERR, "unable to open file %s for reading", "msLoadMSRasterBufferFromFile()", path);
         return MS_FAILURE;
     }
-    fread(signature,1,8,stream);
+    if(1 != fread(signature,8,1,stream)) {
+       msSetError(MS_MISCERR, "Unable to read header from image file %s", "msLoadMSRasterBufferFromFile()",path);
+       return MS_FAILURE;
+    }
     fclose(stream);
     if(png_sig_cmp(signature,0,8) == 0) {
         ret = readPNG(path,rb);



More information about the mapserver-commits mailing list