[mapserver-commits] r11176 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Mar 16 15:01:00 EDT 2011


Author: schpidi
Date: 2011-03-16 12:01:00 -0700 (Wed, 16 Mar 2011)
New Revision: 11176

Modified:
   trunk/mapserver/mapdrawgdal.c
Log:
Resolved a bug with writing to far in image->img_mask.


Modified: trunk/mapserver/mapdrawgdal.c
===================================================================
--- trunk/mapserver/mapdrawgdal.c	2011-03-16 16:49:36 UTC (rev 11175)
+++ trunk/mapserver/mapdrawgdal.c	2011-03-16 19:01:00 UTC (rev 11176)
@@ -2123,6 +2123,7 @@
                 {
                     int off = j + i * image->width
                         + band*image->width*image->height;
+                    int off_mask = j + i * image->width;
 
                     if( i_nodatas 
                         && ((GInt16 *) pBuffer)[k] == i_nodatas[band] )
@@ -2132,7 +2133,7 @@
                     }
 
                     image->img.raw_16bit[off] = ((GInt16 *) pBuffer)[k++];
-                    MS_SET_BIT(image->img_mask,off);
+                    MS_SET_BIT(image->img_mask,off_mask);
                 }
             }
             else if( image->format->imagemode == MS_IMAGEMODE_FLOAT32 )
@@ -2141,6 +2142,7 @@
                 {
                     int off = j + i * image->width
                         + band*image->width*image->height;
+                    int off_mask = j + i * image->width;
 
                     if( f_nodatas 
                         && ((float *) pBuffer)[k] == f_nodatas[band] )
@@ -2150,7 +2152,7 @@
                     }
 
                     image->img.raw_float[off] = ((float *) pBuffer)[k++];
-                    MS_SET_BIT(image->img_mask,off);
+                    MS_SET_BIT(image->img_mask,off_mask);
                 }
             }
             else if( image->format->imagemode == MS_IMAGEMODE_BYTE )
@@ -2159,6 +2161,7 @@
                 {
                     int off = j + i * image->width
                         + band*image->width*image->height;
+                    int off_mask = j + i * image->width;
 
                     if( b_nodatas 
                         && ((unsigned char *) pBuffer)[k] == b_nodatas[band] )
@@ -2168,7 +2171,7 @@
                     }
 
                     image->img.raw_byte[off] = ((unsigned char *) pBuffer)[k++];
-                    MS_SET_BIT(image->img_mask,off);
+                    MS_SET_BIT(image->img_mask,off_mask);
                 }
             }
         }



More information about the mapserver-commits mailing list