[mapserver-commits] r9470 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri Oct 16 12:09:32 EDT 2009
Author: sdlime
Date: 2009-10-16 12:09:31 -0400 (Fri, 16 Oct 2009)
New Revision: 9470
Modified:
trunk/mapserver/mapserv.c
trunk/mapserver/maptemplate.c
Log:
Updated msGenerateImages() to return MS_SUCCESS/MS_FAILURE and msReturnPageTemplate() to properly trap errors from that function.
Modified: trunk/mapserver/mapserv.c
===================================================================
--- trunk/mapserver/mapserv.c 2009-10-16 01:38:33 UTC (rev 9469)
+++ trunk/mapserver/mapserv.c 2009-10-16 16:09:31 UTC (rev 9470)
@@ -1372,7 +1372,7 @@
/* -------------------------------------------------------------------- */
/* generate map, legend, scalebar and refernce images. */
/* -------------------------------------------------------------------- */
- if(msGenerateImages(mapserv, MS_FALSE, MS_TRUE) == MS_FALSE)
+ if(msGenerateImages(mapserv, MS_FALSE, MS_TRUE) != MS_SUCCESS)
writeError();
if(QueryFile) {
Modified: trunk/mapserver/maptemplate.c
===================================================================
--- trunk/mapserver/maptemplate.c 2009-10-16 01:38:33 UTC (rev 9469)
+++ trunk/mapserver/maptemplate.c 2009-10-16 16:09:31 UTC (rev 9470)
@@ -206,7 +206,7 @@
i = msGetOutputFormatIndex(mapserv->map, queryFormat); /* queryFormat can be a mime-type or name */
if(i >= 0) outputFormat = mapserv->map->outputformatlist[i];
-
+
if(outputFormat) {
if( !MS_RENDERER_TEMPLATE(outputFormat) ) { /* got an image format, return the query results that way */
outputFormatObj *tempOutputFormat = mapserv->map->outputformat; /* save format */
@@ -233,7 +233,8 @@
*/
if(mapserv->map->querymap.status) {
checkWebScale(mapserv);
- msGenerateImages(mapserv, MS_TRUE, MS_TRUE);
+ if(msGenerateImages(mapserv, MS_TRUE, MS_TRUE) != MS_SUCCESS)
+ return MS_FAILURE;
}
if(outputFormat) {
@@ -3920,18 +3921,18 @@
/* render the map OR query map */
if((!bQueryMap && mapserv->map->status == MS_ON) || (bQueryMap && mapserv->map->querymap.status == MS_ON)) {
imageObj *image = NULL;
+
image = msDrawMap(mapserv->map, bQueryMap);
-
if(image) {
snprintf(buffer, sizeof(buffer), "%s%s%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
if(msSaveImage(mapserv->map, image, buffer) != MS_SUCCESS && bReturnOnError) {
msFreeImage(image);
- return MS_FALSE;
+ return MS_FAILURE;
}
msFreeImage(image);
} else if(bReturnOnError)
- return MS_FALSE;
+ return MS_FAILURE;
}
/* render the legend */
@@ -3943,11 +3944,11 @@
if(msSaveImage(mapserv->map, image, buffer) != MS_SUCCESS && bReturnOnError) {
msFreeImage(image);
- return MS_FALSE;
+ return MS_FAILURE;
}
msFreeImage(image);
} else if(bReturnOnError)
- return MS_FALSE;
+ return MS_FAILURE;
}
/* render the scalebar */
@@ -3958,11 +3959,11 @@
snprintf(buffer, sizeof(buffer), "%s%ssb%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
if(msSaveImage(mapserv->map, image, buffer) != MS_SUCCESS && bReturnOnError) {
msFreeImage(image);
- return MS_FALSE;
+ return MS_FAILURE;
}
msFreeImage(image);
} else if(bReturnOnError)
- return MS_FALSE;
+ return MS_FAILURE;
}
/* render the reference map */
@@ -3973,16 +3974,16 @@
snprintf(buffer, sizeof(buffer), "%s%sref%s.%s", mapserv->map->web.imagepath, mapserv->map->name, mapserv->Id, MS_IMAGE_EXTENSION(mapserv->map->outputformat));
if(msSaveImage(mapserv->map, image, buffer) != MS_SUCCESS && bReturnOnError) {
msFreeImage(image);
- return MS_FALSE;
+ return MS_FAILURE;
}
msFreeImage(image);
} else if(bReturnOnError)
- return MS_FALSE;
+ return MS_FAILURE;
}
}
- return MS_TRUE;
+ return MS_SUCCESS;
}
/*
More information about the mapserver-commits
mailing list