[mapserver-commits] r8755 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Mar 10 09:35:20 EDT 2009
Author: jlacroix
Date: 2009-03-10 09:35:19 -0400 (Tue, 10 Mar 2009)
New Revision: 8755
Modified:
trunk/mapserver/mapbits.c
trunk/mapserver/mapserver.h
trunk/mapserver/mapshape.c
Log:
Add msSetAllBits function to set all bit in a bitmask array to 1 or 0
Modified: trunk/mapserver/mapbits.c
===================================================================
--- trunk/mapserver/mapbits.c 2009-03-10 13:24:04 UTC (rev 8754)
+++ trunk/mapserver/mapbits.c 2009-03-10 13:35:19 UTC (rev 8755)
@@ -104,6 +104,14 @@
else
*array &= ~(1 << (index % MS_ARRAY_BIT)); /* clear bit */
}
+
+void msSetAllBits(ms_bitarray array, int numbits, int value)
+{
+ if (value)
+ memset(array, 0xff, ((numbits + 7) / 8) ); /* set bit */
+ else
+ memset(array, 0x0, ((numbits + 7) / 8) ); /* clear bit */
+}
void msFlipBit(ms_bitarray array, int index)
{
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2009-03-10 13:24:04 UTC (rev 8754)
+++ trunk/mapserver/mapserver.h 2009-03-10 13:35:19 UTC (rev 8755)
@@ -1779,6 +1779,7 @@
MS_DLL_EXPORT ms_bitarray msAllocBitArray(int numbits);
MS_DLL_EXPORT int msGetBit(ms_bitarray array, int index);
MS_DLL_EXPORT void msSetBit(ms_bitarray array, int index, int value);
+MS_DLL_EXPORT void msSetAllBits(ms_bitarray array, int index, int value);
MS_DLL_EXPORT void msFlipBit(ms_bitarray array, int index);
MS_DLL_EXPORT int msGetNextBit(ms_bitarray array, int index, int size);
Modified: trunk/mapserver/mapshape.c
===================================================================
--- trunk/mapserver/mapshape.c 2009-03-10 13:24:04 UTC (rev 8754)
+++ trunk/mapserver/mapshape.c 2009-03-10 13:35:19 UTC (rev 8755)
@@ -1756,9 +1756,7 @@
msSetError(MS_MEMERR, NULL, "msShapefileWhichShapes()");
return(MS_FAILURE);
}
- for(i=0;i<shpfile->numshapes;i++) {
- msSetBit(shpfile->status, i, 1);
- }
+ msSetAllBits(shpfile->status, shpfile->numshapes, 1);
}
else {
More information about the mapserver-commits
mailing list