[mapserver-commits] r7532 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sat Apr 26 17:48:04 EDT 2008


Author: pramsey
Date: 2008-04-26 17:48:04 -0400 (Sat, 26 Apr 2008)
New Revision: 7532

Modified:
   trunk/mapserver/mapshape.c
Log:
Move all variable declarations to front of functions to make MSVC happier.


Modified: trunk/mapserver/mapshape.c
===================================================================
--- trunk/mapserver/mapshape.c	2008-04-26 14:24:02 UTC (rev 7531)
+++ trunk/mapserver/mapshape.c	2008-04-26 21:48:04 UTC (rev 7532)
@@ -1054,20 +1054,21 @@
 */
 int msSHXLoadPage( SHPHandle psSHP, int shxBufferPage )
 {
+  int i;
+
+  /* Each SHX record is 8 bytes long (two ints), hence our buffer size. */
+  char buffer[SHX_BUFFER_PAGE * 8];
+
   /*  Validate the page number. */
   if( shxBufferPage < 0  )
     return(MS_FAILURE);
 
-  /* Each SHX record is 8 bytes long (two ints), hence our buffer size. */
-  char buffer[SHX_BUFFER_PAGE * 8];
-
   /* The SHX file starts with 100 bytes of header, skip that. */
   fseek( psSHP->fpSHX, 100 + shxBufferPage * SHX_BUFFER_PAGE * 8, 0 );
   fread( buffer, 8, SHX_BUFFER_PAGE, psSHP->fpSHX );
 
   /* Copy the buffer contents out into the working arrays. */
   /* TODO: need to check end case so we don't memcpy too far. */
-  int i;
   for( i = 0; i < SHX_BUFFER_PAGE; i++ ) {
     int tmpOffset, tmpSize;
     
@@ -1124,12 +1125,12 @@
 
 int msSHXReadOffset( SHPHandle psSHP, int hEntity ) {
 
+  int shxBufferPage = hEntity / SHX_BUFFER_PAGE;
+
   /*  Validate the record/entity number. */
   if( hEntity < 0 || hEntity >= psSHP->nRecords )
     return(MS_FAILURE);
 
-  int shxBufferPage = hEntity / SHX_BUFFER_PAGE;
-
   if( ! msGetBit(psSHP->panRecLoaded, shxBufferPage) ) {
     msSHXLoadPage( psSHP, shxBufferPage );
   }
@@ -1140,12 +1141,12 @@
 
 int msSHXReadSize( SHPHandle psSHP, int hEntity ) {
 
+  int shxBufferPage = hEntity / SHX_BUFFER_PAGE;
+
   /*  Validate the record/entity number. */
   if( hEntity < 0 || hEntity >= psSHP->nRecords )
     return(MS_FAILURE);
 
-  int shxBufferPage = hEntity / SHX_BUFFER_PAGE;
-
   if( ! msGetBit(psSHP->panRecLoaded, shxBufferPage) ) {
     msSHXLoadPage( psSHP, shxBufferPage );
   }



More information about the mapserver-commits mailing list