[mapserver-commits] r11120 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Mar 8 16:42:22 EST 2011


Author: rouault
Date: 2011-03-08 13:42:22 -0800 (Tue, 08 Mar 2011)
New Revision: 11120

Modified:
   trunk/mapserver/mapimageio.c
Log:
Fix warning that could lead to wrong buffer->size on 64bit big-endian hosts

Modified: trunk/mapserver/mapimageio.c
===================================================================
--- trunk/mapserver/mapimageio.c	2011-03-08 21:28:25 UTC (rev 11119)
+++ trunk/mapserver/mapimageio.c	2011-03-08 21:42:22 UTC (rev 11120)
@@ -801,6 +801,7 @@
 
 int saveGdImageBuffer(gdImagePtr ip, bufferObj *buffer, outputFormatObj *format) {
     gdIOCtx *ctx;
+    int tmp_size;
 
     ctx = gdNewDynamicCtx (2048, NULL);
 
@@ -845,7 +846,10 @@
         return(MS_FAILURE);
     }
 
-    buffer->data = gdDPExtractData (ctx, &buffer->size);
+    /* gdDPExtractData expects a int*, but bufferObj::size is a size_t */
+    /* so use a temp variable to hold it */
+    buffer->data = gdDPExtractData (ctx, &tmp_size);
+    buffer->size = tmp_size;
 
     ctx->gd_free(ctx);
     return MS_SUCCESS;



More information about the mapserver-commits mailing list