[mapserver-commits] r8488 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Feb 3 10:04:16 EST 2009
Author: assefa
Date: 2009-02-03 10:04:16 -0500 (Tue, 03 Feb 2009)
New Revision: 8488
Modified:
trunk/mapserver/maperror.c
trunk/mapserver/mapwms.c
Log:
wms exception might be sent in GIF format when map is set with AGG driver #2874
Modified: trunk/mapserver/maperror.c
===================================================================
--- trunk/mapserver/maperror.c 2009-02-02 20:01:42 UTC (rev 8487)
+++ trunk/mapserver/maperror.c 2009-02-03 15:04:16 UTC (rev 8488)
@@ -393,6 +393,8 @@
int nBlack = 0;
outputFormatObj *format = NULL;
char *errormsg = msGetErrorString("; ");
+ char *pFormatBuffer;
+ char cGDFormat[128];
if (map) {
if( map->width != -1 && map->height != -1 )
{
@@ -403,7 +405,7 @@
}
/* Default to GIF if no suitable GD output format set */
- if (format == NULL || !MS_DRIVER_GD(format))
+ if (format == NULL || (!MS_DRIVER_GD(format) && !MS_DRIVER_AGG(format)))
format = msCreateDefaultOutputFormat( NULL, "GD/PC256" );
img = gdImageCreate(width, height);
@@ -466,7 +468,17 @@
/* actually write the image */
if(!filename)
msIO_printf("Content-type: %s%c%c", MS_IMAGE_MIME_TYPE(format), 10,10);
- msSaveImageGD(img, filename, format);
+ if (MS_DRIVER_GD(format))
+ msSaveImageGD(img, filename, format);
+ else
+ {
+ strcpy(cGDFormat, "gd/");
+ strcat(cGDFormat, &(format->driver[4]));
+ format->driver = &cGDFormat[0];
+ msSaveImageGD(img, filename, format);
+ format->driver = pFormatBuffer;
+ }
+
gdImageDestroy(img);
if (format->refcount == 0)
Modified: trunk/mapserver/mapwms.c
===================================================================
--- trunk/mapserver/mapwms.c 2009-02-02 20:01:42 UTC (rev 8487)
+++ trunk/mapserver/mapwms.c 2009-02-03 15:04:16 UTC (rev 8488)
@@ -417,7 +417,7 @@
int j, k, iLayer;
layers = msStringSplit(values[i], ',', &numlayers);
- if (layers==NULL || numlayers < 1) {
+ if (layers==NULL || strlen(values[i]) <=0 || numlayers < 1) {
msSetError(MS_WMSERR, "At least one layer name required in LAYERS.",
"msWMSLoadGetMapParams()");
return msWMSException(map, nVersion, NULL);
@@ -2218,6 +2218,7 @@
if (msSaveImage(map, img, NULL) != MS_SUCCESS)
return msWMSException(map, nVersion, NULL);
+
msFreeImage(img);
return(MS_SUCCESS);
More information about the mapserver-commits
mailing list