Commit c0620105 authored by Bas Couwenberg's avatar Bas Couwenberg

Imported Upstream version 6.4.2

parent 93aca188
.gitattributes export-ignore
.gitignore export-ignore
build
*.swp
nbproject
tags
tests/map.png
language: php
php:
- 5.5
- 5.6
env:
global:
......@@ -42,10 +43,10 @@ compiler:
before_install:
- git submodule update --init --recursive
- sudo mv /etc/apt/sources.list.d/pgdg-source.list* /tmp
- sudo apt-get -qq remove postgis
- sudo apt-get remove postgis libpq5 libpq-dev postgresql-9.1-postgis postgresql-9.2-postgis postgresql-9.3-postgis postgresql-9.1 postgresql-9.2 postgresql-9.3 libgdal1
- sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
- sudo apt-get update -qq
- sudo apt-get install -qq bison flex swig cmake librsvg2-dev colordiff postgis postgresql-9.1-postgis-2.0-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-xpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev php5-dev libexempi-dev lcov lftp
- sudo apt-get update
- sudo apt-get install bison flex swig cmake librsvg2-dev colordiff postgis postgresql-9.1 postgresql-9.1-postgis-2.1 postgresql-9.1-postgis-2.1-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-xpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev php5-dev libexempi-dev lcov lftp
- sudo pip install git+git://github.com/tbonfort/cpp-coveralls.git@extensions
- cd msautotest
- ./create_postgis_test_data.sh
......
......@@ -17,7 +17,7 @@ include(CheckCSourceCompiles)
set (MapServer_VERSION_MAJOR 6)
set (MapServer_VERSION_MINOR 4)
set (MapServer_VERSION_REVISION 1)
set (MapServer_VERSION_REVISION 2)
set (MapServer_VERSION_SUFFIX "")
set(TARGET_VERSION_MAJOR ${MapServer_VERSION_MAJOR})
......@@ -120,7 +120,7 @@ option(WITH_LIBXML2 "Choose if libxml2 support should be built in (used for sos,
option(WITH_THREAD_SAFETY "Choose if a thread-safe version of libmapserver should be built (only recommended for some mapscripts)" OFF)
option(WITH_GIF "Enable GIF support (for PIXMAP loading)" ON)
option(WITH_PYTHON "Enable Python mapscript support" OFF)
option(WITH_PHP "Enable Python mapscript support" OFF)
option(WITH_PHP "Enable PHP mapscript support" OFF)
option(WITH_PERL "Enable Perl mapscript support" OFF)
option(WITH_RUBY "Enable Ruby mapscript support" OFF)
option(WITH_JAVA "Enable Java mapscript support" OFF)
......@@ -530,7 +530,7 @@ if(WITH_SVGCAIRO)
endif(WITH_RSVG)
find_package(SVGCairo)
if(SVGCAIRO_FOUND)
include_directories(${SVGCAIRO_INCLUDE_DIR})
include_directories(${SVG_INCLUDE_DIR} ${SVGCAIRO_INCLUDE_DIR})
ms_link_libraries( ${SVG_LIBRARY} ${SVGCAIRO_LIBRARY})
set (USE_SVG_CAIRO 1)
else(SVGCAIRO_FOUND)
......
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'socket'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.hostname = "mapserver-vagrant"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.host_name = "mapserver-vagrant"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.name = "mapserver-vagrant"
end
ppaRepos = [
"ppa:ubuntugis/ppa",
]
packageList = [
"git",
"build-essential",
"pkg-config",
"cmake",
"libgeos-dev",
"libpq-dev",
"python-all-dev",
"libproj-dev",
"libxml2-dev",
"postgis",
"postgresql-server-dev-9.1",
"postgresql-9.1-postgis",
"vim",
"bison",
"flex",
"swig",
"librsvg2-dev",
"libpng12-dev",
"libjpeg-dev",
"libgif-dev",
"libgd2-xpm-dev",
"libfreetype6-dev",
"libfcgi-dev",
"libcurl4-gnutls-dev",
"libcairo2-dev",
"libgdal1-dev",
"php5-dev",
"libexempi-dev"
];
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
pkg_cmd = "sed -i 's#deb http://us.archive.ubuntu.com/ubuntu/#deb mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list; "
pkg_cmd << "apt-get update -qq; apt-get install -q -y python-software-properties; "
if ppaRepos.length > 0
ppaRepos.each { |repo| pkg_cmd << "add-apt-repository -y " << repo << " ; " }
pkg_cmd << "apt-get update -qq; "
end
# install packages we need we need
pkg_cmd << "apt-get install -q -y " + packageList.join(" ") << " ; "
config.vm.provision :shell, :inline => pkg_cmd
scripts = [
"mapserver.sh",
"postgis.sh"
];
scripts.each { |script| config.vm.provision :shell, :path => "scripts/vagrant/" << script }
end
end
......@@ -386,33 +386,15 @@ int rind(char *s, char c)
return -1;
}
int _getline(char *s, int n, FILE *f)
{
register int i=0;
while(1) {
s[i] = (char)fgetc(f);
if(s[i] == CR)
s[i] = fgetc(f);
if((s[i] == 0x4) || (s[i] == LF) || (i == (n-1))) {
s[i] = '\0';
return (feof(f) ? 1 : 0);
}
++i;
}
}
void send_fd(FILE *f, FILE *fd)
{
char c;
int c;
while (1) {
c = fgetc(f);
if(feof(f))
if(c == EOF)
return;
fputc(c,fd);
fputc((char)c,fd);
}
}
......
......@@ -87,7 +87,6 @@ MS_DLL_EXPORT char x2c(char *);
MS_DLL_EXPORT void unescape_url(char *);
MS_DLL_EXPORT void plustospace(char *);
MS_DLL_EXPORT int rind(char *, char);
MS_DLL_EXPORT int _getline(char *, int, FILE *);
MS_DLL_EXPORT void send_fd(FILE *, FILE *);
MS_DLL_EXPORT int ind(char *, char);
MS_DLL_EXPORT void escape_shell_cmd(char *);
......
......@@ -24,9 +24,8 @@ find_program(HTTPD_EXECUTABLE NAMES httpd
)
if(APXS_BIN)
EXEC_PROGRAM(${APXS_BIN}
ARGS -q LIBEXECDIR
OUTPUT_VARIABLE APACHE_MODULE_DIR )
EXECUTE_PROCESS(COMMAND ${APXS_BIN} -q LIBEXECDIR
OUTPUT_VARIABLE APACHE_MODULE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(APXS_BIN)
include(FindPackageHandleStandardArgs)
......
......@@ -37,8 +37,8 @@ if(DEFINED ENV{ORACLE_HOME})
${ORACLE_HOME}/OCI/include) # Oracle XE on Windows
set(ORACLE_OCI_NAMES clntsh libclntsh oci)
set(ORACLE_NNZ_NAMES nnz10 libnnz10 nnz11 libnnz11 ociw32)
set(ORACLE_OCCI_NAMES libocci occi oraocci10 oraocci11)
set(ORACLE_NNZ_NAMES nnz10 libnnz10 nnz11 libnnz11 nnz12 libnnz12 ociw32)
set(ORACLE_OCCI_NAMES libocci occi oraocci10 oraocci11 oraocci12)
set(ORACLE_LIB_DIR
${ORACLE_HOME}
......
......@@ -58,7 +58,6 @@ void initClassHitTests(classObj *c, class_hittest *ch, int default_status) {
void initLayerHitTests(layerObj *l, layer_hittest *lh) {
int i,default_status;
lh->classhits = msSmallCalloc(l->numclasses,sizeof(class_hittest));
lh->status = default_status;
switch(l->type) {
case MS_LAYER_POLYGON:
......@@ -71,6 +70,7 @@ void initLayerHitTests(layerObj *l, layer_hittest *lh) {
default_status = 1; /* no hittesting needed, use traditional mode */
break;
}
lh->status = default_status;
for(i=0; i<l->numclasses; i++) {
initClassHitTests(l->class[i],&lh->classhits[i], default_status);
}
......
......@@ -218,7 +218,6 @@ public:
}
private:
shapeObj *s;
double ox,oy;
lineObj *m_line, /*pointer to current line*/
*m_lend; /*pointer to after last line of the shape*/
pointObj *m_point, /*pointer to current vertex*/
......@@ -562,8 +561,8 @@ int agg2RenderBitmapGlyphs(imageObj *img, double x, double y, labelStyleObj *sty
glyph_gen glyph(0);
mapserver::renderer_raster_htext_solid<renderer_base, glyph_gen> rt(r->m_renderer_base, glyph);
glyph.font(rasterfonts[size]);
int numlines=0;
char **lines;
int numlines=1;
char **lines = NULL;
/*masking out the out-of-range character codes*/
int len;
int cc_start = rasterfonts[size][2];
......@@ -571,35 +570,32 @@ int agg2RenderBitmapGlyphs(imageObj *img, double x, double y, labelStyleObj *sty
if(msCountChars(text,'\n')) {
if((lines = msStringSplit((const char*)text, '\n', &(numlines))) == NULL)
return(-1);
} else {
lines = &text;
numlines = 1;
}
y -= glyph.base_line();
for(int n=0; n<numlines; n++) {
len = strlen(lines[n]);
if(lines) text = lines[n];
len = strlen(text);
for (int i = 0; i < len; i++)
if (lines[n][i] < cc_start || lines[n][i] > cc_end)
lines[n][i] = '.';
if (text[i] < cc_start || text[i] > cc_end)
text[i] = '.';
if(style->outlinewidth > 0) {
rt.color(aggColor(style->outlinecolor));
for(int i=-1; i<=1; i++) {
for(int j=-1; j<=1; j++) {
if(i||j) {
rt.render_text(x+i, y+j, lines[n], true);
rt.render_text(x+i, y+j, text, true);
}
}
}
}
assert(style->color);
rt.color(aggColor(style->color));
rt.render_text(x, y, lines[n], true);
rt.render_text(x, y, text, true);
y += glyph.height();
}
if(*lines != text)
if(lines)
msFreeCharArray(lines, numlines);
return MS_SUCCESS;
return MS_SUCCESS;
}
int agg2RenderGlyphsLine(imageObj *img, labelPathObj *labelpath, labelStyleObj *style, char *text)
......@@ -820,6 +816,10 @@ int agg2RenderTruetypeSymbol(imageObj *img, double x, double y,
msUTF8ToUniChar(symbol->character, &unicode);
const mapserver::glyph_cache* glyph = cache->m_fman.glyph(unicode);
if(!glyph || glyph->glyph_index == 0) {
msSetError(MS_TTFERR, "invalid/not-found glpyh index", "agg2RenderTruetypeSymbol()");
return MS_FAILURE;
}
double ox = (glyph->bounds.x1 + glyph->bounds.x2) / 2.;
double oy = (glyph->bounds.y1 + glyph->bounds.y2) / 2.;
......@@ -994,11 +994,6 @@ int agg2GetTruetypeTextBBox(rendererVTableObj *renderer, char **fonts, int numfo
const mapserver::glyph_cache* glyph;
string += msUTF8ToUniChar(string, &unicode);
if(curfontidx != 0) {
if(aggLoadFont(cache,fonts[0],size) == MS_FAILURE)
return MS_FAILURE;
curfontidx = 0;
}
glyph = cache->m_fman.glyph(unicode);
if(!glyph || glyph->glyph_index == 0) {
int i;
......
......@@ -855,9 +855,7 @@ static void msTransformToGeospatialPDF(imageObj *img, mapObj *map, cairo_rendere
msBufferResize(r->outputStream, nFileSize);
VSIFSeekL(fp, 0, SEEK_SET);
VSIFReadL(r->outputStream->data, 1, nFileSize, fp);
r->outputStream->size = nFileSize;
r->outputStream->size = VSIFReadL(r->outputStream->data, 1, nFileSize, fp);
VSIFCloseL(fp);
fp = NULL;
......@@ -990,7 +988,7 @@ int getRasterBufferCopyCairo(imageObj *img, rasterBufferObj *rb)
rb->data.rgba.pixel_step=4;
rb->width = cairo_image_surface_get_width(r->surface);
rb->height = cairo_image_surface_get_height(r->surface);
pb = (unsigned char*)malloc(rb->height * rb->data.rgba.row_step * sizeof(unsigned char*));
pb = (unsigned char*)malloc(rb->height * rb->data.rgba.row_step * sizeof(unsigned char));
memcpy(pb,cairo_image_surface_get_data(r->surface),rb->height * rb->data.rgba.row_step);
rb->data.rgba.pixels = pb;
rb->data.rgba.r = &(pb[2]);
......@@ -1012,7 +1010,7 @@ int mergeRasterBufferCairo(imageObj *img, rasterBufferObj *rb, double opacity,
cairo_surface_t *src;
cairo_renderer *r;
/* not implemented for src,dst,width and height */
if(!rb->type == MS_BUFFER_BYTE_RGBA) {
if(rb->type != MS_BUFFER_BYTE_RGBA) {
return MS_FAILURE;
}
r = CAIRO_RENDERER(img);
......@@ -1135,6 +1133,7 @@ int msPreloadSVGSymbol(symbolObj *symbol)
cache->svgc = rsvg_handle_new_from_file(symbol->full_pixmap_path,NULL);
if(!cache->svgc) {
msSetError(MS_RENDERERERR,"failed to load svg file %s", "msPreloadSVGSymbol()", symbol->full_pixmap_path);
return MS_FAILURE;
}
rsvg_handle_get_dimensions_sub (cache->svgc, &dim, NULL);
symbol->sizex = dim.width;
......
......@@ -392,6 +392,7 @@ int msLoadMapContextLayerFormat(CPLXMLNode *psFormat, layerObj *layer)
pszValue = msLookupHashTable(&(layer->metadata), "wms_format");
if (
pszValue && (
#if !(defined USE_GD_PNG || defined USE_PNG)
strcasecmp(pszValue, "image/png") == 0 ||
strcasecmp(pszValue, "PNG") == 0 ||
......@@ -404,7 +405,7 @@ int msLoadMapContextLayerFormat(CPLXMLNode *psFormat, layerObj *layer)
strcasecmp(pszValue, "image/gif") == 0 ||
strcasecmp(pszValue, "GIF") == 0 ||
#endif
0 ) {
0 )) {
char **papszList=NULL;
int i, numformats=0;
......
......@@ -387,6 +387,10 @@ static int msContourLayerReadRaster(layerObj *layer, rectObj rect)
src_yoff = 0;
dst_xsize = src_xsize = MIN(map->width,src_xsize);
dst_ysize = src_ysize = MIN(map->height,src_ysize);
copyRect.minx = copyRect.miny = 0;
copyRect.maxx = map->width;
copyRect.maxy = map->height;
dst_cellsize_y = dst_cellsize_x = 1;
}
/* -------------------------------------------------------------------- */
......
......@@ -271,7 +271,6 @@ int msCopyLeader(labelLeaderObj *dst, labelLeaderObj *src)
if( freeStyle(dst->styles[i]) == MS_SUCCESS ) msFree(dst->styles[i]);
}
}
msFree(dst->styles);
dst->numstyles = 0;
for (i = 0; i < src->numstyles; i++) {
......@@ -366,7 +365,6 @@ int msCopyLabel(labelObj *dst, labelObj *src)
if( freeStyle(dst->styles[i]) == MS_SUCCESS ) msFree(dst->styles[i]);
}
}
msFree(dst->styles);
dst->numstyles = 0;
for (i = 0; i < src->numstyles; i++) {
......@@ -524,7 +522,6 @@ int msCopyClass(classObj *dst, classObj *src, layerObj *layer)
}
}
}
msFree(dst->styles);
dst->numstyles = 0;
for (i = 0; i < src->numstyles; i++) {
......
......@@ -90,17 +90,13 @@ debugInfoObj *msGetDebugInfoObj()
else if( link == NULL || link->next == NULL ) {
debugInfoObj *new_link;
new_link = (debugInfoObj *) malloc(sizeof(debugInfoObj));
if (new_link != NULL) {
new_link->next = debuginfo_list;
new_link->thread_id = thread_id;
new_link->global_debug_level = MS_DEBUGLEVEL_ERRORSONLY;
new_link->debug_mode = MS_DEBUGMODE_OFF;
new_link->errorfile = NULL;
new_link->fp = NULL;
} else
msSetError(MS_MEMERR, "Out of memory allocating %u bytes.\n", "msGetDebugInfoObj()", (unsigned int)sizeof(debugInfoObj));
new_link = (debugInfoObj *) msSmallMalloc(sizeof(debugInfoObj));
new_link->next = debuginfo_list;
new_link->thread_id = thread_id;
new_link->global_debug_level = MS_DEBUGLEVEL_ERRORSONLY;
new_link->debug_mode = MS_DEBUGMODE_OFF;
new_link->errorfile = NULL;
new_link->fp = NULL;
debuginfo_list = new_link;
}
......@@ -146,7 +142,7 @@ int msSetErrorFile(const char *pszErrorFile, const char *pszRelToPath)
pszErrorFile = extended_path;
}
if (debuginfo && debuginfo->errorfile && pszErrorFile &&
if (debuginfo->errorfile && pszErrorFile &&
strcmp(debuginfo->errorfile, pszErrorFile) == 0) {
/* Nothing to do, already writing to the right place */
return MS_SUCCESS;
......
......@@ -446,14 +446,13 @@ imageObj *msDrawMap(mapObj *map, int querymap)
return(NULL);
}
}
}
if(map->debug >= MS_DEBUGLEVEL_TUNING || lp->debug >= MS_DEBUGLEVEL_TUNING) {
msGettimeofday(&endtime, NULL);
msDebug("msDrawMap(): Layer %d (%s), %.3fs\n",
map->layerorder[i], lp->name?lp->name:"(null)",
(endtime.tv_sec+endtime.tv_usec/1.0e6)-
(starttime.tv_sec+starttime.tv_usec/1.0e6) );
if(map->debug >= MS_DEBUGLEVEL_TUNING || lp->debug >= MS_DEBUGLEVEL_TUNING) {
msGettimeofday(&endtime, NULL);
msDebug("msDrawMap(): Layer %d (%s), %.3fs\n",
map->layerorder[i], lp->name?lp->name:"(null)",
(endtime.tv_sec+endtime.tv_usec/1.0e6)-
(starttime.tv_sec+starttime.tv_usec/1.0e6) );
}
}
}
......@@ -467,6 +466,13 @@ imageObj *msDrawMap(mapObj *map, int querymap)
if(MS_SUCCESS != msEmbedScalebar(map, image)) {
msFreeImage( image );
#if defined(USE_WMS_LYR) || defined(USE_WFS_LYR)
/* Cleanup WMS/WFS Request stuff */
if (pasOWSReqInfo) {
msHTTPFreeRequestObj(pasOWSReqInfo, numOWSRequests);
msFree(pasOWSReqInfo);
}
#endif
return NULL;
}
......@@ -478,6 +484,13 @@ imageObj *msDrawMap(mapObj *map, int querymap)
if(map->legend.status == MS_EMBED && !map->legend.postlabelcache) {
if( msEmbedLegend(map, image) != MS_SUCCESS ) {
msFreeImage( image );
#if defined(USE_WMS_LYR) || defined(USE_WFS_LYR)
/* Cleanup WMS/WFS Request stuff */
if (pasOWSReqInfo) {
msHTTPFreeRequestObj(pasOWSReqInfo, numOWSRequests);
msFree(pasOWSReqInfo);
}
#endif
return NULL;
}
}
......@@ -565,6 +578,13 @@ imageObj *msDrawMap(mapObj *map, int querymap)
if(MS_SUCCESS != msEmbedScalebar(map, image)) {
msFreeImage( image );
#if defined(USE_WMS_LYR) || defined(USE_WFS_LYR)
/* Cleanup WMS/WFS Request stuff */
if (pasOWSReqInfo) {
msHTTPFreeRequestObj(pasOWSReqInfo, numOWSRequests);
msFree(pasOWSReqInfo);
}
#endif
return NULL;
}
......@@ -1270,19 +1290,16 @@ int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image)
/* if MS_HILITE, alter the one style (always at least 1 style), and set a MINDISTANCE for the labelObj to avoid duplicates */
if(map->querymap.style == MS_HILITE) {
if (layer->numclasses > 0) {
colorbuffer = (colorObj*)malloc(layer->numclasses*sizeof(colorObj));
mindistancebuffer = (int*)malloc(layer->numclasses*sizeof(int));
if (colorbuffer == NULL || mindistancebuffer == NULL) {
msSetError(MS_MEMERR, "Failed to allocate memory for colorbuffer/mindistancebuffer", "msDrawQueryLayer()");
return MS_FAILURE;
}
colorbuffer = (colorObj*)msSmallMalloc(layer->numclasses*sizeof(colorObj));
mindistancebuffer = (int*)msSmallMalloc(layer->numclasses*sizeof(int));
}
for(i=0; i<layer->numclasses; i++) {
if(layer->type == MS_LAYER_POLYGON) { /* alter BOTTOM style since that's almost always the fill */
if (layer->class[i]->styles == NULL) {
msSetError(MS_MISCERR, "Don't know how to draw class %s of layer %s without a style definition.", "msDrawQueryLayer()", layer->class[i]->name, layer->name);
msFree(colorbuffer);
msFree(mindistancebuffer);
return(MS_FAILURE);
}
if(MS_VALID_COLOR(layer->class[i]->styles[0]->color)) {
......@@ -1368,7 +1385,11 @@ int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image)
}
if(cache) {
if(insertFeatureList(&shpcache, &shape) == NULL) return(MS_FAILURE); /* problem adding to the cache */
if(insertFeatureList(&shpcache, &shape) == NULL) {
msFree(colorbuffer);
msFree(mindistancebuffer);
return(MS_FAILURE); /* problem adding to the cache */
}
}
maxnumstyles = MS_MAX(maxnumstyles, layer->class[shape.classindex]->numstyles);
......@@ -2229,7 +2250,7 @@ int msDrawPoint(mapObj *map, layerObj *layer, pointObj *point, imageObj *image,
} else
msOffsetPointRelativeTo(point, layer);
if(labeltext) {
if(label) {
if(layer->labelcache) {
if(msAddLabel(map, label, layer->index, classindex, NULL, point, NULL, -1) != MS_SUCCESS) return(MS_FAILURE);
} else {
......@@ -2256,7 +2277,7 @@ int msDrawPoint(mapObj *map, layerObj *layer, pointObj *point, imageObj *image,
if(msScaleInBounds(map->scaledenom, theclass->styles[s]->minscaledenom, theclass->styles[s]->maxscaledenom))
msDrawMarkerSymbol(&map->symbolset, image, point, theclass->styles[s], layer->scalefactor);
}
if(labeltext) {
if(label) {
if(layer->labelcache) {
if(msAddLabel(map, label, layer->index, classindex, NULL, point, NULL, -1) != MS_SUCCESS) return(MS_FAILURE);
} else
......
This diff is collapsed.
......@@ -582,7 +582,7 @@ symbolObj* rotateVectorSymbolPoints(symbolObj *symbol, double angle_rad)
/* center at 0,0 and rotate; then move back */
for( i=0; i < symbol->numpoints; i++) {
/* don't rotate PENUP commands (TODO: should use a constant here) */
if ((symbol->points[i].x == -99.0) && (symbol->points[i].x == -99.0) ) {
if ((symbol->points[i].x == -99.0) && (symbol->points[i].y == -99.0) ) {
newSymbol->points[i].x = -99.0;
newSymbol->points[i].y = -99.0;
continue;
......@@ -598,7 +598,7 @@ symbolObj* rotateVectorSymbolPoints(symbolObj *symbol, double angle_rad)
xcor = minx*-1.0; /* symbols always start at 0,0 so get the shift vector */
ycor = miny*-1.0;
for( i=0; i < newSymbol->numpoints; i++) {
if ((newSymbol->points[i].x == -99.0) && (newSymbol->points[i].x == -99.0))
if ((newSymbol->points[i].x == -99.0) && (newSymbol->points[i].y == -99.0))
continue;
newSymbol->points[i].x = newSymbol->points[i].x + xcor;
newSymbol->points[i].y = newSymbol->points[i].y + ycor;
......@@ -651,7 +651,7 @@ int renderVectorSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, s
k = 0; /* point counter */
for(j=0; j < symbol->numpoints; j++) {
if((symbol->points[j].x == -99) && (symbol->points[j].x == -99)) { /* new polygon (PENUP) */
if((symbol->points[j].x == -99) && (symbol->points[j].y == -99)) { /* new polygon (PENUP) */
if(k>2) {
if(fc >= 0)
gdImageFilledPolygon(ip, mPoints, k, fc);
......@@ -681,7 +681,7 @@ int renderVectorSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, s
gdImageSetThickness(ip, style->outlinewidth);
for(j=1; j < symbol->numpoints; j++) { /* step through the marker */
if((symbol->points[j].x != -99) || (symbol->points[j].x != -99)) {
if((symbol->points[j].x != -99) || (symbol->points[j].y != -99)) {
if((symbol->points[j-1].x == -99) && (symbol->points[j-1].y == -99)) { /* Last point was PENUP, now a new beginning */
oldpnt.x = MS_NINT(style->scale*symbol->points[j].x + x);
oldpnt.y = MS_NINT(style->scale*symbol->points[j].y + y);
......@@ -1010,7 +1010,7 @@ int renderBitmapGlyphsGD(imageObj *img, double x, double y, labelStyleObj *style
}
if(*lines != text)
if(lines != &text)
msFreeCharArray(lines, numlines);
return MS_SUCCESS;
}
......
......@@ -269,14 +269,17 @@ static GEOSGeom msGEOSShape2Geometry_simplepolygon(shapeObj *shape, int r, int *
if(numInnerRings > 0) {
k = 0; /* inner ring counter */
innerRings = malloc(numInnerRings*sizeof(GEOSGeom));
if(!innerRings) return NULL; /* todo, this will leak memory (outerRing) */
innerRings = msSmallMalloc(numInnerRings*sizeof(GEOSGeom));
for(j=0; j<shape->numlines; j++) {
if(innerList[j] == MS_FALSE) continue;
coords = GEOSCoordSeq_create_r(handle,shape->line[j].numpoints, 2); /* todo handle z's */
if(!coords) return NULL; /* todo, this will leak memory (shell + allocated holes) */
if(!coords) {
free(innerRings);
free(innerList);
return NULL; /* todo, this will leak memory (shell + allocated holes) */
}
for(i=0; i<shape->line[j].numpoints; i++) {
GEOSCoordSeq_setX_r(handle,coords, i, shape->line[j].point[i].x);
......@@ -316,8 +319,7 @@ static GEOSGeom msGEOSShape2Geometry_polygon(shapeObj *shape)
if(numOuterRings == 1) {
g = msGEOSShape2Geometry_simplepolygon(shape, lastOuterRing, outerList);
} else { /* a true multipolygon */
polygons = malloc(numOuterRings*sizeof(GEOSGeom));
if(!polygons) return NULL;
polygons = msSmallMalloc(numOuterRings*sizeof(GEOSGeom));
j = 0; /* part counter */
for(i=0; i<shape->numlines; i++) {
......
......@@ -123,7 +123,7 @@ static void gmlEndGeometryContainer(FILE *stream, char *name, char *namespace, c
static int gmlWriteGeometry_GML2(FILE *stream, gmlGeometryListObj *geometryList, shapeObj *shape, const char *srsname, char *namespace, char *tab)
{
int i, j, k;
int *innerlist, *outerlist, numouters;
int *innerlist, *outerlist=NULL, numouters;
char *srsname_encoded = NULL;
int geometry_aggregate_index, geometry_simple_index;
......@@ -311,6 +311,7 @@ static int gmlWriteGeometry_GML2(FILE *stream, gmlGeometryListObj *geometryList,
gmlEndGeometryContainer(stream, geometry_simple_name, namespace, tab);
}
free(outerlist);
outerlist = NULL;
} else if(geometry_aggregate_index != -1 || (geometryList->numgeometries == 0)) { /* write a MultiPolygon */
gmlStartGeometryContainer(stream, geometry_aggregate_name, namespace, tab);
......@@ -362,6 +363,7 @@ static int gmlWriteGeometry_GML2(FILE *stream, gmlGeometryListObj *geometryList,
msIO_fprintf(stream, "%s</gml:MultiPolygon>\n", tab);
free(outerlist);
outerlist = NULL;
gmlEndGeometryContainer(stream, geometry_aggregate_name, namespace, tab);
} else {
......@@ -375,6 +377,7 @@ static int gmlWriteGeometry_GML2(FILE *stream, gmlGeometryListObj *geometryList,
/* clean-up */
msFree(srsname_encoded);
msFree(outerlist);
return(MS_SUCCESS);
}
......@@ -383,7 +386,7 @@ static int gmlWriteGeometry_GML2(FILE *stream, gmlGeometryListObj *geometryList,
static int gmlWriteGeometry_GML3(FILE *stream, gmlGeometryListObj *geometryList, shapeObj *shape, const char *srsname, char *namespace, char *tab)
{
int i, j, k;
int *innerlist, *outerlist, numouters;
int *innerlist, *outerlist=NULL, numouters;
char *srsname_encoded = NULL;
int geometry_aggregate_index, geometry_simple_index;
......@@ -571,6 +574,7 @@ static int gmlWriteGeometry_GML3(FILE *stream, gmlGeometryListObj *geometryList,
gmlEndGeometryContainer(stream, geometry_simple_name, namespace, tab);
}
free(outerlist);
outerlist = NULL;
} else if(geometry_aggregate_index != -1 || (geometryList->numgeometries == 0)) { /* write a MultiSurface */
gmlStartGeometryContainer(stream, geometry_aggregate_name, namespace, tab);
......@@ -624,6 +628,7 @@ static int gmlWriteGeometry_GML3(FILE *stream, gmlGeometryListObj *geometryList,
msIO_fprintf(stream, "%s </gml:MultiSurface>\n", tab);
free(outerlist);
outerlist = NULL;
gmlEndGeometryContainer(stream, geometry_aggregate_name, namespace, tab);
} else {
......@@ -636,6 +641,7 @@ static int gmlWriteGeometry_GML3(FILE *stream, gmlGeometryListObj *geometryList,
}
/* clean-up */
msFree(outerlist);
msFree(srsname_encoded);
return(MS_SUCCESS);
......@@ -767,6 +773,7 @@ gmlGeometryListObj *msGMLGetGeometries(layerObj *layer, const char *metadata_nam
else
geometry->occurmax = atof(occur[1]);
}
msFreeCharArray(occur,numoccur);
}
}
......@@ -1117,6 +1124,7 @@ static void msGMLWriteGroup(FILE *stream, gmlGroupObj *group, shapeObj *shape, g
else
msIO_fprintf(stream, "%s</%s>\n", tab, group->name);
free(itemtab);
return;
}
#endif
......@@ -1211,7 +1219,13 @@ int msGMLWriteQuery(mapObj *map, char *filename, const char *namespaces)