[mapserver-commits] r9753 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Jan 25 19:54:57 EST 2010


Author: pramsey
Date: 2010-01-25 19:54:54 -0500 (Mon, 25 Jan 2010)
New Revision: 9753

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapraster.c
Log:
Apply ON_MISSING_DATA to zero-length WMS client calls (#2785, #3243)



Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-01-25 22:35:53 UTC (rev 9752)
+++ trunk/mapserver/HISTORY.TXT	2010-01-26 00:54:54 UTC (rev 9753)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Apply ON_MISSING_DATA to zero-length WMS client calls (#2785, #3243)
+
 - PHP/Mapscript: added labelCacheMember object and mapObj::getLabel() method (#1794)
 
 - Add shplabel tag support in templates (#3241)

Modified: trunk/mapserver/mapraster.c
===================================================================
--- trunk/mapserver/mapraster.c	2010-01-25 22:35:53 UTC (rev 9752)
+++ trunk/mapserver/mapraster.c	2010-01-26 00:54:54 UTC (rev 9753)
@@ -1452,7 +1452,32 @@
       strcpy( szPath, filename );
 #endif
     } else {
-      fread(dd,8,1,f); /* read some bytes to try and identify the file */
+      /* read some bytes to try and identify the file */
+      if( ! fread(dd,8,1,f) ) {
+        /* zero-length file or corrupt file */
+        int ignore_missing = msMapIgnoreMissingData(map);
+        if(ignore_missing == MS_MISSING_DATA_FAIL) {
+          msSetError(MS_IOERR, "Corrupt or empty file '%s' for layer '%s'", "msDrawRasterLayerLow()", szPath, layer->name);
+          return(MS_FAILURE); 
+        }
+        else if( ignore_missing == MS_MISSING_DATA_LOG ) {
+          if( layer->debug || layer->map->debug ) {
+            msDebug( "Corrupt or empty file '%s' for layer '%s' ... ignoring this missing data.\n", szPath, layer->name );
+          }
+          done = MS_TRUE;
+          continue;
+        }
+        else if( ignore_missing == MS_MISSING_DATA_IGNORE ) {
+          done = MS_TRUE;
+          continue;
+        }
+        else {
+          /* never get here */
+          msSetError(MS_IOERR, "msIgnoreMissingData returned unexpected value.", "msDrawRasterLayerLow()");
+          return(MS_FAILURE);
+        }
+        
+      }
       fclose(f);
     }
 



More information about the mapserver-commits mailing list