From 67c7b86eeed109cf9c632dafcd70130fdc89b7ca Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Mon, 15 Oct 2012 16:11:26 +0000 Subject: [PATCH 01/22] Fix WFS GetFeature result bounds are not written in requested projection (#4494) --- HISTORY.TXT | 3 +++ mapwfs.c | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/HISTORY.TXT b/HISTORY.TXT index 42257756ab..fed66daadd 100644 --- a/HISTORY.TXT +++ b/HISTORY.TXT @@ -1,3 +1,4 @@ + MapServer Revision History ========================== @@ -14,6 +15,8 @@ For a complete change history, please see the Git log comments. Current Version (git master, 6.3-dev, future 6.4): -------------------------------------------------- +- Fix WFS GetFeature result bounds are not written in requested projection (#4494) + - Fixed wrong size in LegendURL of root layer (#4441) - Fixed wms_style_name in GetMap requests (#4439) diff --git a/mapwfs.c b/mapwfs.c index a8cc6b55d2..411d709c98 100644 --- a/mapwfs.c +++ b/mapwfs.c @@ -2022,7 +2022,9 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req, ow bFeatureIdSet = 1; } - + /* Apply the requested SRS */ + if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) + return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); #ifdef USE_OGR if (bFilterSet && pszFilter && strlen(pszFilter) > 0) { @@ -2117,7 +2119,7 @@ this request. Check wfs/ows_enable_request settings.", "msWFSGetFeature()", laye /*preparse the filter for gml aliases*/ FLTPreParseFilterForAlias(psNode, map, iLayerIndex, "G"); - + /* run filter. If no results are found, do not throw exception */ /* this is a null result */ if( FLTApplyFilterToLayer(psNode, map, iLayerIndex) != MS_SUCCESS ) { @@ -2203,8 +2205,6 @@ this request. Check wfs/ows_enable_request settings.", "msWFSGetFeature()", laye lp->status = MS_ON; } } - if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) - return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); } for (j=0; j< iFIDLayers; j++) { @@ -2263,10 +2263,6 @@ this request. Check wfs/ows_enable_request settings.", "msWFSGetFeature()", if(layers) msFreeCharArray(layers, numlayers); - - if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) - return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); - /* ** Perform Query (only BBOX for now) */ From 2326932194ec0629c731a7775ed5765c9dc477e6 Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Mon, 15 Oct 2012 16:17:30 +0000 Subject: [PATCH 02/22] Revert small change related to (#4494) --- mapwfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mapwfs.c b/mapwfs.c index 411d709c98..db5b43b506 100644 --- a/mapwfs.c +++ b/mapwfs.c @@ -2204,6 +2204,8 @@ this request. Check wfs/ows_enable_request settings.", "msWFSGetFeature()", laye strcasecmp(lp->name, aFIDLayers[j]) == 0) { lp->status = MS_ON; } + if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) + return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); } } From ad1b12c3c44492c45b8a3269e1ab24773637df61 Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Mon, 15 Oct 2012 16:42:12 +0000 Subject: [PATCH 03/22] Modified the fix for the writing of wfs getfeature bounds (#4494) --- mapwfs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mapwfs.c b/mapwfs.c index db5b43b506..de198b8876 100644 --- a/mapwfs.c +++ b/mapwfs.c @@ -2022,10 +2022,6 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req, ow bFeatureIdSet = 1; } - /* Apply the requested SRS */ - if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) - return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); - #ifdef USE_OGR if (bFilterSet && pszFilter && strlen(pszFilter) > 0) { char **tokens = NULL; @@ -2222,6 +2218,9 @@ this request. Check wfs/ows_enable_request settings.", "msWFSGetFeature()", laye } psNode = FLTCreateFeatureIdFilterEncoding(aFIDValues[j]); + if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) + return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); + if( FLTApplyFilterToLayer(psNode, map, lp->index) != MS_SUCCESS ) { msSetError(MS_WFSERR, "FLTApplyFilterToLayer() failed", "msWFSGetFeature"); return msWFSException(map, "mapserv", "NoApplicableCode", paramsObj->pszVersion); @@ -2265,6 +2264,10 @@ this request. Check wfs/ows_enable_request settings.", "msWFSGetFeature()", if(layers) msFreeCharArray(layers, numlayers); + /* Apply the requested SRS */ + if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) + return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); + /* ** Perform Query (only BBOX for now) */ From 1085541cbb475f588523a3e176ecebd4d492dba6 Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Mon, 15 Oct 2012 16:47:23 +0000 Subject: [PATCH 04/22] msWFSGetFeatureApplySRS() has to be called before FLTApplyFilterToLayer --- mapwfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mapwfs.c b/mapwfs.c index de198b8876..1b1d10b1a0 100644 --- a/mapwfs.c +++ b/mapwfs.c @@ -2115,7 +2115,10 @@ this request. Check wfs/ows_enable_request settings.", "msWFSGetFeature()", laye /*preparse the filter for gml aliases*/ FLTPreParseFilterForAlias(psNode, map, iLayerIndex, "G"); - + + if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) + return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); + /* run filter. If no results are found, do not throw exception */ /* this is a null result */ if( FLTApplyFilterToLayer(psNode, map, iLayerIndex) != MS_SUCCESS ) { @@ -2217,9 +2220,6 @@ this request. Check wfs/ows_enable_request settings.", "msWFSGetFeature()", laye lp->template = msStrdup("ttt.html"); } psNode = FLTCreateFeatureIdFilterEncoding(aFIDValues[j]); - - if (msWFSGetFeatureApplySRS(map, paramsObj->pszSrs, paramsObj->pszVersion) == MS_FAILURE) - return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion); if( FLTApplyFilterToLayer(psNode, map, lp->index) != MS_SUCCESS ) { msSetError(MS_WFSERR, "FLTApplyFilterToLayer() failed", "msWFSGetFeature"); From ee9e43b39f3345ffa45fc38d3d93d25105316946 Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Tue, 16 Oct 2012 17:00:27 +0000 Subject: [PATCH 05/22] Fix UVRaster layer issue with reprojection (#4495) --- mapuvraster.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mapuvraster.c b/mapuvraster.c index 8bd0131172..be5776feac 100644 --- a/mapuvraster.c +++ b/mapuvraster.c @@ -66,8 +66,6 @@ typedef struct { int refcount; - rectObj which_rect; - /* query bound in force shapeObj *searchshape;*/ @@ -332,11 +330,11 @@ static char **msUVRASTERGetValues(layerObj *layer, float *u, float *v) } int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) - { uvRasterLayerInfo *uvlinfo = (uvRasterLayerInfo *) layer->layerinfo; imageObj *image_tmp; mapObj map_tmp; + double map_cellsize; unsigned int spacing; int width, height, u_src_off, v_src_off, i, x, y; char **alteredProcessing = NULL; @@ -361,9 +359,9 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) return MS_FAILURE; } /* -------------------------------------------------------------------- */ - /* Determine desired spacing. Default to 30 if not otherwise set */ + /* Determine desired spacing. Default to 32 if not otherwise set */ /* -------------------------------------------------------------------- */ - spacing = 30; + spacing = 32; if( CSLFetchNameValue( layer->processing, "UV_SPACING" ) != NULL ) { spacing = atoi(CSLFetchNameValue( layer->processing, "UV_SPACING" )); @@ -371,8 +369,10 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) width = (int)ceil(layer->map->width/spacing); height = (int)ceil(layer->map->height/spacing); - map_tmp.cellsize = layer->map->cellsize*spacing; - + map_cellsize = MS_MAX(MS_CELLSIZE(rect.minx, rect.maxx,layer->map->width), + MS_CELLSIZE(rect.miny,rect.maxy,layer->map->height)); + map_tmp.cellsize = map_cellsize*spacing; + if (layer->debug) msDebug("msUVRASTERLayerWhichShapes(): width: %d, height: %d, cellsize: %g\n", width, height, map_tmp.cellsize); @@ -393,14 +393,14 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) map_tmp.mappath = layer->map->mappath; map_tmp.shapepath = layer->map->shapepath; - map_tmp.extent.minx = layer->map->extent.minx-(0.5*layer->map->cellsize)+(0.5*map_tmp.cellsize); - map_tmp.extent.miny = layer->map->extent.miny-(0.5*layer->map->cellsize)+(0.5*map_tmp.cellsize); + map_tmp.extent.minx = rect.minx-(0.5*map_cellsize)+(0.5*map_tmp.cellsize); + map_tmp.extent.miny = rect.miny-(0.5*map_cellsize)+(0.5*map_tmp.cellsize); map_tmp.extent.maxx = map_tmp.extent.minx+((width-1)*map_tmp.cellsize); map_tmp.extent.maxy = map_tmp.extent.miny+((height-1)*map_tmp.cellsize); map_tmp.gt.rotation_angle = 0.0; msInitProjection(&map_tmp.projection); - msCopyProjection(&map_tmp.projection, &layer->map->projection); + msCopyProjection(&map_tmp.projection, &layer->projection); if (layer->debug == 5) msDebug("msUVRASTERLayerWhichShapes(): extent: %g %d %g %g\n", @@ -484,7 +484,6 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) msFreeImage(image_tmp); /* we do not need the imageObj anymore */ - uvlinfo->which_rect = map_tmp.extent; uvlinfo->next_shape = 0; return MS_SUCCESS; From e8708cbef36bfe76dfbb3335aebaa176c0b4e417 Mon Sep 17 00:00:00 2001 From: Thomas Bonfort Date: Fri, 19 Oct 2012 13:51:20 +0200 Subject: [PATCH 06/22] update tests for uvraster --- msautotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msautotest b/msautotest index a8d3ec7ee5..7590a0ba43 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit a8d3ec7ee5c98575c7cf34fec4916da99440d5e2 +Subproject commit 7590a0ba43fd378120a11be3fb63fb7852459d25 From d21772e4d47112646574a947b980dd09da2017bc Mon Sep 17 00:00:00 2001 From: Thomas Bonfort Date: Fri, 19 Oct 2012 14:05:46 +0200 Subject: [PATCH 07/22] module update --- msautotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msautotest b/msautotest index 7590a0ba43..bffca9c5c6 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit 7590a0ba43fd378120a11be3fb63fb7852459d25 +Subproject commit bffca9c5c668695f7347476094ed66886edb2296 From df6ef971ac168ea0ca6d35b8268cefd51c857d07 Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Fri, 19 Oct 2012 18:53:06 +0200 Subject: [PATCH 08/22] Adjusting version parameter (#4503). --- mapwcs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mapwcs.c b/mapwcs.c index 6c5d739cf3..ceacabf3da 100644 --- a/mapwcs.c +++ b/mapwcs.c @@ -2060,7 +2060,7 @@ int msWCSDispatch(mapObj *map, cgiRequestObj *request, owsRequestObj *ows_reques if (status == MS_FAILURE) { msWCSFreeParamsObj20(params); return msWCSException(map, "InvalidParameterValue", - "request", "2.0"); + "request", "2.0.1"); } /* VERSION negotiation */ @@ -2160,7 +2160,7 @@ int msWCSDispatch(mapObj *map, cgiRequestObj *request, owsRequestObj *ows_reques if (status == MS_FAILURE) { msWCSFreeParamsObj20(params); return msWCSException(map, "InvalidParameterValue", - "request", "2.0"); + "request", "2.0.1"); } } @@ -2174,7 +2174,7 @@ int msWCSDispatch(mapObj *map, cgiRequestObj *request, owsRequestObj *ows_reques msSetError(MS_WCSERR, "Layer name '%s' is not a valid NCName.", "msWCSDispatch()", map->layers[i]->name); msWCSFreeParamsObj20(params); - return msWCSException(map, "mapserv", "Internal", "2.0"); + return msWCSException(map, "mapserv", "Internal", "2.0.1"); } } @@ -2189,7 +2189,7 @@ int msWCSDispatch(mapObj *map, cgiRequestObj *request, owsRequestObj *ows_reques msSetError(MS_WCSERR, "Invalid request '%s'.", "msWCSDispatch20()", ows_request->request); retVal = msWCSException20(map, "InvalidParameterValue", - "request", "2.0"); + "request", "2.0.1"); } /* clean up */ msWCSFreeParamsObj20(params); @@ -2197,7 +2197,7 @@ int msWCSDispatch(mapObj *map, cgiRequestObj *request, owsRequestObj *ows_reques #else /* def USE_LIBXML2 */ msSetError(MS_WCSERR, "WCS 2.0 needs mapserver to be compiled with libxml2.", "msWCSDispatch()"); - return msWCSException(map, "mapserv", "NoApplicableCode", "1.0.0"); + return msWCSException(map, "mapserv", "NoApplicableCode", "2.0.1"); #endif /* def USE_LIBXML2 */ } else { /* unsupported version */ msSetError(MS_WCSERR, "WCS Server does not support VERSION %s.", From b0422d36243378f0acfd12eaa59427d7ad7da593 Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Fri, 19 Oct 2012 18:58:20 +0200 Subject: [PATCH 09/22] update msautotest submodule --- msautotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msautotest b/msautotest index bffca9c5c6..8522448c2a 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit bffca9c5c668695f7347476094ed66886edb2296 +Subproject commit 8522448c2a67071fe62e6a704d13e56014632b27 From 0eb2aeb756f219e7c134d2fe53537e5076096c53 Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Tue, 30 Oct 2012 15:34:04 +0000 Subject: [PATCH 10/22] Fix segfault in uvraster on missing data --- mapuvraster.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mapuvraster.c b/mapuvraster.c index be5776feac..6f6a04d7b6 100644 --- a/mapuvraster.c +++ b/mapuvraster.c @@ -391,6 +391,7 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) map_tmp.outputformat->renderer = MS_RENDER_WITH_RAWDATA; map_tmp.outputformat->imagemode = MS_IMAGEMODE_FLOAT32; + map_tmp.configoptions = layer->map->configoptions; map_tmp.mappath = layer->map->mappath; map_tmp.shapepath = layer->map->shapepath; map_tmp.extent.minx = rect.minx-(0.5*map_cellsize)+(0.5*map_tmp.cellsize); From 4f16404514a15dfa005f46701eb8d6f27dff0211 Mon Sep 17 00:00:00 2001 From: szekerest Date: Fri, 2 Nov 2012 22:41:19 +0100 Subject: [PATCH 11/22] Expose labelObj.text and labelObj.expression (#4310) --- mapscript/swiginc/label.i | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/mapscript/swiginc/label.i b/mapscript/swiginc/label.i index 8445c3e310..3e2706b5e1 100644 --- a/mapscript/swiginc/label.i +++ b/mapscript/swiginc/label.i @@ -93,6 +93,33 @@ return MS_SUCCESS; } + + int setExpression(char *expression) + { + if (!expression || strlen(expression) == 0) { + freeExpression(&self->expression); + return MS_SUCCESS; + } + else return msLoadExpressionString(&self->expression, expression); + } + + %newobject getExpressionString; + char *getExpressionString() { + return msGetExpressionString(&(self->expression)); + } + + int setText(char *text) { + if (!text || strlen(text) == 0) { + freeExpression(&self->text); + return MS_SUCCESS; + } + else return msLoadExpressionString(&self->text, text); + } + + %newobject getTextString; + char *getTextString() { + return msGetExpressionString(&(self->text)); + } %newobject getStyle; styleObj *getStyle(int i) { From 069c8d8b20389c1da59df9a528caf9fc01d2c0fe Mon Sep 17 00:00:00 2001 From: szekerest Date: Fri, 2 Nov 2012 22:46:07 +0100 Subject: [PATCH 12/22] Fix cleaning up label expressions in msLayerClose (#4127) --- maplayer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/maplayer.c b/maplayer.c index 7892bd81e1..2504b0ba7a 100644 --- a/maplayer.c +++ b/maplayer.c @@ -204,7 +204,7 @@ int msLayerGetShape(layerObj *layer, shapeObj *shape, resultObj *record) */ void msLayerClose(layerObj *layer) { - int i,j; + int i,j,k; /* no need for items once the layer is closed */ msLayerFreeItemInfo(layer); @@ -223,6 +223,10 @@ void msLayerClose(layerObj *layer) freeExpressionTokens(&(layer->class[i]->text)); for(j=0; jclass[i]->numstyles; j++) freeExpressionTokens(&(layer->class[i]->styles[j]->_geomtransform)); + for(k=0; kclass[i]->numlabels; k++) { + freeExpressionTokens(&(layer->class[i]->labels[k]->expression)); + freeExpressionTokens(&(layer->class[i]->labels[k]->text)); + } } if (layer->vtable) { From e62fba06797e1e0c77260cf3eeb7e5d9cfee5756 Mon Sep 17 00:00:00 2001 From: szekerest Date: Fri, 2 Nov 2012 23:13:06 +0100 Subject: [PATCH 13/22] Fix msDrawLabel to be aware of label->status when labelcache is not set (#932) --- mapdraw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapdraw.c b/mapdraw.c index ac15adcd90..ea6a0d48b5 100644 --- a/mapdraw.c +++ b/mapdraw.c @@ -2274,7 +2274,7 @@ int msDrawLabel(mapObj *map, imageObj *image, pointObj labelPnt, char *string, l if(!string) return MS_SUCCESS; /* not an error, just don't need to do anything more */ if(strlen(string) == 0) return MS_SUCCESS; /* not an error, just don't need to do anything more */ - + if(label->status == MS_OFF) return(MS_SUCCESS); /* not an error */ if(label->type == MS_TRUETYPE) { From 2a2a4db60331fbd583ca1a10eb70660e436a81d6 Mon Sep 17 00:00:00 2001 From: szekerest Date: Mon, 5 Nov 2012 12:55:36 +0100 Subject: [PATCH 14/22] Fix OGR autostyle font mapping problem (#3893) --- mapogr.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/mapogr.cpp b/mapogr.cpp index 4fdee6de9c..18d83ba730 100644 --- a/mapogr.cpp +++ b/mapogr.cpp @@ -2553,21 +2553,28 @@ static int msOGRUpdateStyle(OGRStyleMgrH hStyleMgr, mapObj *map, layerObj *layer const char *pszFontName = OGR_ST_GetParamStr(hLabelStyle, OGRSTLabelFontName, &bIsNull); - const char *pszName = CPLSPrintf("%s%s%s", pszFontName, pszBold, pszItalic); + /* replace spaces with hyphens to allow mapping to a valid hashtable entry*/ + char* pszFontNameEscaped = NULL; + if (pszFontName != NULL) { + pszFontNameEscaped = strdup(pszFontName); + msReplaceChar(pszFontNameEscaped, ' ', '-'); + } + + const char *pszName = CPLSPrintf("%s%s%s", pszFontNameEscaped, pszBold, pszItalic); bool bFont = true; - if (pszFontName != NULL && !bIsNull && pszFontName[0] != '\0') { + if (pszFontNameEscaped != NULL && !bIsNull && pszFontNameEscaped[0] != '\0') { if (msLookupHashTable(&(map->fontset.fonts), (char*)pszName) != NULL) { c->labels[0]->type = MS_TRUETYPE; c->labels[0]->font = msStrdup(pszName); if (layer->debug >= MS_DEBUGLEVEL_VVV) msDebug("** Using '%s' TTF font **\n", pszName); - } else if ( (strcmp(pszFontName,pszName) != 0) && - msLookupHashTable(&(map->fontset.fonts), (char*)pszFontName) != NULL) { + } else if ( (strcmp(pszFontNameEscaped,pszName) != 0) && + msLookupHashTable(&(map->fontset.fonts), (char*)pszFontNameEscaped) != NULL) { c->labels[0]->type = MS_TRUETYPE; - c->labels[0]->font = msStrdup(pszFontName); + c->labels[0]->font = msStrdup(pszFontNameEscaped); if (layer->debug >= MS_DEBUGLEVEL_VVV) - msDebug("** Using '%s' TTF font **\n", pszFontName); + msDebug("** Using '%s' TTF font **\n", pszFontNameEscaped); } else if (msLookupHashTable(&(map->fontset.fonts),"default") != NULL) { c->labels[0]->type = MS_TRUETYPE; c->labels[0]->font = msStrdup("default"); @@ -2577,6 +2584,8 @@ static int msOGRUpdateStyle(OGRStyleMgrH hStyleMgr, mapObj *map, layerObj *layer bFont = false; } + msFree(pszFontNameEscaped); + if (!bFont) { c->labels[0]->type = MS_BITMAP; c->labels[0]->size = MS_MEDIUM; From a6265e265a1518c7e5c6b8e1a10d72406b284896 Mon Sep 17 00:00:00 2001 From: szekerest Date: Mon, 5 Nov 2012 15:10:05 +0100 Subject: [PATCH 15/22] Reset layer level item indexes in msLayerWhichItems (#4517) --- maplayer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/maplayer.c b/maplayer.c index 2504b0ba7a..5691c2e67b 100644 --- a/maplayer.c +++ b/maplayer.c @@ -482,6 +482,11 @@ int msLayerWhichItems(layerObj *layer, int get_all, char *metadata) */ /* layer level counts */ + layer->classitemindex = -1; + layer->filteritemindex = -1; + layer->styleitemindex = -1; + layer->labelitemindex = -1; + if(layer->classitem) nt++; if(layer->filteritem) nt++; if(layer->styleitem && strcasecmp(layer->styleitem, "AUTO") != 0) nt++; From 0a51b578d722045c209df1c3f195754c6f88e9d2 Mon Sep 17 00:00:00 2001 From: szekerest Date: Mon, 5 Nov 2012 22:10:04 +0100 Subject: [PATCH 16/22] Flushing stdout at process termination of mapserv.exe (#4505) --- mapserv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mapserv.c b/mapserv.c index 09ef7257c5..78a796990e 100644 --- a/mapserv.c +++ b/mapserv.c @@ -286,5 +286,11 @@ int main(int argc, char *argv[]) (execstarttime.tv_sec+execstarttime.tv_usec/1.0e6) ); } msCleanup(0); + +#ifdef _WIN32 + /* flush pending writes to stdout */ + fflush(stdout); +#endif + exit( 0 ); } From 4c065b926c2674a9a9ab51c739a88c060f5b36db Mon Sep 17 00:00:00 2001 From: Umberto Nicoletti Date: Tue, 6 Nov 2012 17:16:00 +0100 Subject: [PATCH 17/22] Rolled back bc4ccf09b9450b30a2bfcdbf0fb4ec20cd53fc7c to fix pagination loop issue #4508 with oracle spatial layers --- maporaclespatial.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/maporaclespatial.c b/maporaclespatial.c index f28a793006..9ea972966e 100644 --- a/maporaclespatial.c +++ b/maporaclespatial.c @@ -2148,9 +2148,6 @@ int msOracleSpatialLayerNextShape( layerObj *layer, shapeObj *shape ) do { /* is buffer empty? */ if (sthand->row >= sthand->rows_fetched) { - if (sthand->row_num >= sthand->rows_count) - return MS_DONE; - /* fetch more */ success = TRY( hand, OCIStmtFetch2( sthand->stmthp, hand->errhp, (ub4)ARRAY_SIZE, (ub2)OCI_FETCH_NEXT, (sb4)0, (ub4)OCI_DEFAULT ) ) && TRY( hand, OCIAttrGet( (dvoid *)sthand->stmthp, (ub4)OCI_HTYPE_STMT, (dvoid *)&sthand->rows_fetched, (ub4 *)0, (ub4)OCI_ATTR_ROWS_FETCHED, hand->errhp ) ) @@ -2159,6 +2156,8 @@ int msOracleSpatialLayerNextShape( layerObj *layer, shapeObj *shape ) if(layer->debug >= 4 ) msDebug("msOracleSpatialLayerNextShape on layer %p, Fetched %d more rows (%d total)\n", layer, sthand->rows_fetched, sthand->rows_count); + if (sthand->row_num >= sthand->rows_count) + return MS_DONE; if (!success || sthand->rows_fetched == 0) return MS_DONE; From a8d2a073c96bd18a38e78cf20093de0ca16a39b0 Mon Sep 17 00:00:00 2001 From: szekerest Date: Wed, 7 Nov 2012 15:17:04 +0100 Subject: [PATCH 18/22] Fix mssql driver to handle field names with spaces (#4519) --- mapmssql2008.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mapmssql2008.c b/mapmssql2008.c index 27a0c13e88..733da3ba26 100644 --- a/mapmssql2008.c +++ b/mapmssql2008.c @@ -824,22 +824,22 @@ static int prepare_database(layerObj *layer, rectObj rect, char **query_string) char buffer[1000]; if (layerinfo->geometry_format == MSSQLGEOMETRY_NATIVE) - snprintf(buffer, sizeof(buffer), "%s,convert(varchar(36), %s)", layerinfo->geom_column, layerinfo->urid_name); + snprintf(buffer, sizeof(buffer), "[%s],convert(varchar(36), [%s])", layerinfo->geom_column, layerinfo->urid_name); else - snprintf(buffer, sizeof(buffer), "%s.STAsBinary(),convert(varchar(36), %s)", layerinfo->geom_column, layerinfo->urid_name); + snprintf(buffer, sizeof(buffer), "[%s].STAsBinary(),convert(varchar(36), [%s])", layerinfo->geom_column, layerinfo->urid_name); columns_wanted = msStrdup(buffer); } else { char buffer[10000] = ""; for(t = 0; t < layer->numitems; t++) { - snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "convert(varchar(max), %s),", layer->items[t]); + snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "convert(varchar(max), [%s]),", layer->items[t]); } if (layerinfo->geometry_format == MSSQLGEOMETRY_NATIVE) - snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "%s,convert(varchar(36), %s)", layerinfo->geom_column, layerinfo->urid_name); + snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "[%s],convert(varchar(36), [%s])", layerinfo->geom_column, layerinfo->urid_name); else - snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "%s.STAsBinary(),convert(varchar(36), %s)", layerinfo->geom_column, layerinfo->urid_name); + snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "[%s].STAsBinary(),convert(varchar(36), [%s])", layerinfo->geom_column, layerinfo->urid_name); columns_wanted = msStrdup(buffer); } From 3bb5cefee2a24c1e4a348c225141e7dcf4722db7 Mon Sep 17 00:00:00 2001 From: szekerest Date: Wed, 7 Nov 2012 15:58:06 +0100 Subject: [PATCH 19/22] MSSQL: Fix crash caused by lengthy DATA sections (#3911) --- mapmssql2008.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mapmssql2008.c b/mapmssql2008.c index 733da3ba26..b66600b4c0 100644 --- a/mapmssql2008.c +++ b/mapmssql2008.c @@ -1820,9 +1820,8 @@ int msMSSQL2008LayerGetShape(layerObj *layer, shapeObj *shape, resultObj *record int msMSSQL2008LayerGetItems(layerObj *layer) { msMSSQL2008LayerInfo *layerinfo; - char *geom_column_name = 0; - char sql[1000]; - int t; + char *sql = NULL; + int t, sqlSize; char found_geom = 0; int item_num; SQLSMALLINT cols = 0; @@ -1846,14 +1845,18 @@ int msMSSQL2008LayerGetItems(layerObj *layer) return MS_FAILURE; } - snprintf(sql, sizeof(sql), "SELECT top 0 * FROM %s", layerinfo->geom_table); + sqlSize = strlen(layerinfo->geom_table) + 30; + sql = msSmallMalloc(sizeof(char *) * sqlSize); - if (!executeSQL(layerinfo->conn, sql)) { - msFree(geom_column_name); + snprintf(sql, sqlSize, "SELECT top 0 * FROM %s", layerinfo->geom_table); + if (!executeSQL(layerinfo->conn, sql)) { + msFree(sql); return MS_FAILURE; } + msFree(sql); + SQLNumResultCols (layerinfo->conn->hstmt, &cols); layer->numitems = cols - 1; /* dont include the geometry column */ From 530980cc19323039320d807fa5d2ee392a98e932 Mon Sep 17 00:00:00 2001 From: szekerest Date: Wed, 7 Nov 2012 16:20:00 +0100 Subject: [PATCH 20/22] MSSQL: Fix problem using TAB in DATA section (#3914) --- mapmssql2008.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mapmssql2008.c b/mapmssql2008.c index b66600b4c0..a7cda7781d 100644 --- a/mapmssql2008.c +++ b/mapmssql2008.c @@ -2001,7 +2001,9 @@ static int msMSSQL2008LayerParseData(layerObj *layer, char **geom_column_name, c char *pos_opt, *pos_scn, *tmp, *pos_srid, *pos_urid, *pos_geomtype, *pos_geomtype2, *pos_indexHint, *data; int slength; - data = layer->data; + data = msStrdup(layer->data); + /* replace tabs with spaces */ + msReplaceChar(data, '\t', ' '); /* given a string of the from 'geom from ctivalues' or 'geom from () as foo' * return geom_column_name as 'geom' @@ -2032,6 +2034,7 @@ static int msMSSQL2008LayerParseData(layerObj *layer, char **geom_column_name, c if(!slength) { msSetError(MS_QUERYERR, DATA_ERROR_MESSAGE, "msMSSQL2008LayerParseData()", "Error parsing MSSQL2008 data variable: You specified 'using SRID=#' but didnt have any numbers!

\n\nMore Help:

\n\n", data); + msFree(data); return MS_FAILURE; } else { *user_srid = (char *) msSmallMalloc(slength + 1); @@ -2062,6 +2065,7 @@ static int msMSSQL2008LayerParseData(layerObj *layer, char **geom_column_name, c if(!pos_scn) { msSetError(MS_QUERYERR, DATA_ERROR_MESSAGE, "msMSSQL2008LayerParseData()", "Error parsing MSSQL2008 data variable. Must contain 'geometry_column from table_name' or 'geom from (subselect) as foo' (couldn't find ' from '). More help:

\n\n", data); + msFree(data); return MS_FAILURE; } @@ -2076,6 +2080,7 @@ static int msMSSQL2008LayerParseData(layerObj *layer, char **geom_column_name, c ++pos_geomtype2; if (*pos_geomtype2 != ')' || pos_geomtype2 == pos_geomtype) { msSetError(MS_QUERYERR, DATA_ERROR_MESSAGE, "msMSSQL2008LayerParseData()", "Error parsing MSSQL2008 data variable. Invalid syntax near geometry column type.", data); + msFree(data); return MS_FAILURE; } @@ -2098,6 +2103,7 @@ static int msMSSQL2008LayerParseData(layerObj *layer, char **geom_column_name, c if(strlen(*table_name) < 1 || strlen(*geom_column_name) < 1) { msSetError(MS_QUERYERR, DATA_ERROR_MESSAGE, "msMSSQL2008LayerParseData()", "Error parsing MSSQL2008 data variable. Must contain 'geometry_column from table_name' or 'geom from (subselect) as foo' (couldnt find a geometry_column or table/subselect). More help:

\n\n", data); + msFree(data); return MS_FAILURE; } @@ -2106,6 +2112,7 @@ static int msMSSQL2008LayerParseData(layerObj *layer, char **geom_column_name, c msSetError(MS_QUERYERR, DATA_ERROR_MESSAGE, "msMSSQL2008LayerParseData()", "No primary key defined for table, or primary key contains more that one column\n\n", *table_name); + msFree(data); return MS_FAILURE; } } @@ -2114,6 +2121,7 @@ static int msMSSQL2008LayerParseData(layerObj *layer, char **geom_column_name, c msDebug("msMSSQL2008LayerParseData: unique column = %s, srid='%s', geom_column_name = %s, table_name=%s\n", *urid_name, *user_srid, *geom_column_name, *table_name); } + msFree(data); return MS_SUCCESS; } From f50776ede92c53f0bee1a5556086e6f8948c6deb Mon Sep 17 00:00:00 2001 From: szekerest Date: Sun, 21 Oct 2012 22:13:39 +0200 Subject: [PATCH 21/22] loadSymbolSet doesn't reset lexer state (#4506) --- mapsymbol.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mapsymbol.c b/mapsymbol.c index cd987f9311..4e8fd29964 100644 --- a/mapsymbol.c +++ b/mapsymbol.c @@ -44,6 +44,8 @@ extern char *msyystring_buffer; extern int msyylineno; extern FILE *msyyin; +extern int msyystate; + static const unsigned char PNGsig[8] = {137, 80, 78, 71, 13, 10, 26, 10}; /* 89 50 4E 47 0D 0A 1A 0A hex */ static const unsigned char JPEGsig[3] = {255, 216, 255}; /* FF D8 FF hex */ @@ -549,6 +551,9 @@ int loadSymbolSet(symbolSetObj *symbolset, mapObj *map) pszSymbolPath = msGetPath(szPath); + msyystate = MS_TOKENIZE_FILE; /* restore lexer state to INITIAL, and do return comments */ + msyylex(); /* sets things up, but doesn't process any tokens */ + msyylineno = 0; /* reset line counter */ msyyrestart(msyyin); /* flush the scanner - there's a better way but this works for now */ From 1da915d2b294155d79b2b4bc64b6e08149e587a5 Mon Sep 17 00:00:00 2001 From: Thomas Bonfort Date: Fri, 9 Nov 2012 13:42:21 +0100 Subject: [PATCH 22/22] avoid integer division on pixmap size calulation (#4409) --- mapsymbol.c | 2 +- msautotest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mapsymbol.c b/mapsymbol.c index 4e8fd29964..2c1c35a408 100644 --- a/mapsymbol.c +++ b/mapsymbol.c @@ -656,7 +656,7 @@ int msGetMarkerSize(symbolSetObj *symbolset, styleObj *style, double *width, dou *width = MS_MAX(*width, symbol->pixmap_buffer->width); *height = MS_MAX(*height, symbol->pixmap_buffer->height); } else { - *width = MS_MAX(*width, ((size/symbol->pixmap_buffer->height) * symbol->pixmap_buffer->width)); + *width = MS_MAX(*width, (((double)size/(double)symbol->pixmap_buffer->height) * symbol->pixmap_buffer->width)); *height = MS_MAX(*height, size); } break; diff --git a/msautotest b/msautotest index 8522448c2a..d5eafa9524 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit 8522448c2a67071fe62e6a704d13e56014632b27 +Subproject commit d5eafa9524cf395de665b6d5263cdd349cdfc55a