[Git][debian-gis-team/mapserver][upstream] New upstream version 7.6.0~rc3
Bas Couwenberg
gitlab at salsa.debian.org
Sat Apr 25 06:21:34 BST 2020
Bas Couwenberg pushed to branch upstream at Debian GIS Project / mapserver
Commits:
ea33d100 by Bas Couwenberg at 2020-04-25T06:43:19+02:00
New upstream version 7.6.0~rc3
- - - - -
15 changed files:
- CMakeLists.txt
- HISTORY.TXT
- mapcontext.c
- mapfile.c
- maplabel.c
- mapogcsld.c
- mapogroutput.c → mapogroutput.cpp
- mapscript/swiginc/map.i
- mapscript/swiginc/mapzoom.i
- mapserver.h
- mapshape.c
- mapshape.h
- mapstring.c
- maputil.c
- mapxbase.c
Changes:
=====================================
CMakeLists.txt
=====================================
@@ -18,7 +18,7 @@ include(CheckCSourceCompiles)
set (MapServer_VERSION_MAJOR 7)
set (MapServer_VERSION_MINOR 6)
set (MapServer_VERSION_REVISION 0)
-set (MapServer_VERSION_SUFFIX "-rc2")
+set (MapServer_VERSION_SUFFIX "-rc3")
# Set C++ version
# Make CMAKE_CXX_STANDARD available as cache option overridable by user
@@ -282,7 +282,7 @@ mapraster.c mapuvraster.c mapdummyrenderer.c mapobject.c maprasterquery.c
mapwcs.c maperror.c mapogcfilter.c mapregex.c mapwcs11.c mapfile.c
mapogcfiltercommon.cpp maprendering.c mapwcs20.c mapogcsld.c mapmetadata.c
mapresample.c mapwfs.c mapgdal.c mapogcsos.c mapscale.c mapwfs11.c mapwfs20.c
-mapgeomtransform.c mapogroutput.c mapwfslayer.c mapagg.cpp mapkml.cpp
+mapgeomtransform.c mapogroutput.cpp mapwfslayer.c mapagg.cpp mapkml.cpp
mapgeomutil.cpp mapkmlrenderer.cpp fontcache.c textlayout.c maputfgrid.cpp
mapogr.cpp mapcontour.c mapsmoothing.c mapv8.cpp ${REGEX_SOURCES} kerneldensity.c
mapcompositingfilter.c mapmvt.c)
=====================================
HISTORY.TXT
=====================================
@@ -12,6 +12,13 @@ For a complete change history, please see the Git log comments. For more
details about recent point releases, please see the online changelog at:
http://mapserver.org/development/changelog/
+7.6.0-rc3 release (2020-04-24)
+------------------------------
+
+- Handle special characters in paths on Windows (#5995)
+
+- Add attribute binding for label ALIGN, OFFSET, POSITION (#6052)
+
7.6.0-rc2 release (2020-04-10)
------------------------------
=====================================
mapcontext.c
=====================================
@@ -29,6 +29,8 @@
#include "mapserver.h"
#include "mapows.h"
+#include "cpl_vsi.h"
+
#if defined(USE_WMS_LYR)
@@ -47,12 +49,12 @@
char * msGetMapContextFileText(char *filename)
{
char *pszBuffer;
- FILE *stream;
+ VSILFILE *stream;
int nLength;
/* open file */
if(filename != NULL && strlen(filename) > 0) {
- stream = fopen(filename, "rb");
+ stream = VSIFOpenL(filename, "rb");
if(!stream) {
msSetError(MS_IOERR, "(%s)", "msGetMapContextFileText()", filename);
return NULL;
@@ -62,26 +64,26 @@ char * msGetMapContextFileText(char *filename)
return NULL;
}
- fseek( stream, 0, SEEK_END );
- nLength = ftell( stream );
- fseek( stream, 0, SEEK_SET );
+ VSIFSeekL( stream, 0, SEEK_END );
+ nLength = (int) VSIFTellL( stream );
+ VSIFSeekL( stream, 0, SEEK_SET );
pszBuffer = (char *) malloc(nLength+1);
if( pszBuffer == NULL ) {
msSetError(MS_MEMERR, "(%s)", "msGetMapContextFileText()", filename);
- fclose( stream );
+ VSIFCloseL( stream );
return NULL;
}
- if(fread( pszBuffer, nLength, 1, stream ) == 0 && !feof(stream)) {
+ if(VSIFReadL( pszBuffer, nLength, 1, stream ) == 0) {
free( pszBuffer );
- fclose( stream );
+ VSIFCloseL( stream );
msSetError(MS_IOERR, "(%s)", "msGetMapContextFileText()", filename);
return NULL;
}
pszBuffer[nLength] = '\0';
- fclose( stream );
+ VSIFCloseL( stream );
return pszBuffer;
}
@@ -1275,7 +1277,7 @@ int msLoadMapContext(mapObj *map, char *filename, int unique_layer_names)
int msSaveMapContext(mapObj *map, char *filename)
{
#if defined(USE_WMS_LYR)
- FILE *stream;
+ VSILFILE *stream;
char szPath[MS_MAXPATHLEN];
int nStatus;
=====================================
mapfile.c
=====================================
@@ -299,7 +299,7 @@ int msBuildPluginLibraryPath(char **dest, const char *lib_str, mapObj *map)
char szLibPath[MS_MAXPATHLEN] = { '\0' };
char szLibPathExt[MS_MAXPATHLEN] = { '\0' };
const char *plugin_dir = NULL;
-
+
if (map)
plugin_dir = msLookupHashTable(&(map->configoptions), "MS_PLUGIN_DIR");
@@ -972,7 +972,7 @@ static int loadFeature(layerObj *player, int type)
msFreeShape(shape);
msFree(shape);
if(getString(&string) == MS_FAILURE) return(MS_FAILURE);
-
+
if((shape = msShapeFromWKT(string)) == NULL)
status = MS_FAILURE;
@@ -1529,7 +1529,16 @@ static int loadLabel(labelObj *label)
}
break;
case(ALIGN):
- if((label->align = getSymbol(3, MS_ALIGN_LEFT,MS_ALIGN_CENTER,MS_ALIGN_RIGHT)) == -1) return(-1);
+ if((symbol = getSymbol(4, MS_ALIGN_LEFT,MS_ALIGN_CENTER,MS_ALIGN_RIGHT,MS_BINDING)) == -1)
+ return(-1);
+ if((symbol == MS_ALIGN_LEFT)||(symbol == MS_ALIGN_CENTER)||(symbol == MS_ALIGN_RIGHT)) {
+ label->align = symbol;
+ } else {
+ if (label->bindings[MS_LABEL_BINDING_ALIGN].item != NULL)
+ msFree(label->bindings[MS_LABEL_BINDING_ALIGN].item);
+ label->bindings[MS_LABEL_BINDING_ALIGN].item = msStrdup(msyystring_buffer);
+ label->numbindings++;
+ }
break;
case(ANTIALIAS): /*ignore*/
msyylex();
@@ -1633,8 +1642,25 @@ static int loadLabel(labelObj *label)
if(getInteger(&(label->minsize)) == -1) return(-1);
break;
case(OFFSET):
- if(getInteger(&(label->offsetx)) == -1) return(-1);
- if(getInteger(&(label->offsety)) == -1) return(-1);
+ if((symbol = getSymbol(2, MS_NUMBER,MS_BINDING)) == -1) return(MS_FAILURE);
+ if(symbol == MS_NUMBER)
+ label->offsetx = (int) msyynumber;
+ else {
+ if (label->bindings[MS_LABEL_BINDING_OFFSET_X].item != NULL)
+ msFree(label->bindings[MS_LABEL_BINDING_OFFSET_X].item);
+ label->bindings[MS_LABEL_BINDING_OFFSET_X].item = msStrdup(msyystring_buffer);
+ label->numbindings++;
+ }
+
+ if((symbol = getSymbol(2, MS_NUMBER,MS_BINDING)) == -1) return(MS_FAILURE);
+ if(symbol == MS_NUMBER)
+ label->offsety = (int) msyynumber;
+ else {
+ if (label->bindings[MS_LABEL_BINDING_OFFSET_Y].item != NULL)
+ msFree(label->bindings[MS_LABEL_BINDING_OFFSET_Y].item);
+ label->bindings[MS_LABEL_BINDING_OFFSET_Y].item = msStrdup(msyystring_buffer);
+ label->numbindings++;
+ }
break;
case(OUTLINECOLOR):
if(loadColor(&(label->outlinecolor), &(label->bindings[MS_LABEL_BINDING_OUTLINECOLOR])) != MS_SUCCESS) return(-1);
@@ -1767,7 +1793,7 @@ int msUpdateLabelFromString(labelObj *label, char *string, int url_string)
if(!label || !string) return MS_FAILURE;
msAcquireLock( TLOCK_PARSER );
-
+
if(url_string)
msyystate = MS_TOKENIZE_URL_STRING;
else
@@ -1967,7 +1993,7 @@ void msFreeExpression(expressionObj *exp)
int loadExpression(expressionObj *exp)
{
- /* TODO: should we fall msFreeExpression if exp->string != NULL? We do some checking to avoid a leak but is it enough... */
+ /* TODO: should we fall msFreeExpression if exp->string != NULL? We do some checking to avoid a leak but is it enough... */
msyystring_icase = MS_TRUE;
if((exp->type = getSymbol(6, MS_STRING,MS_EXPRESSION,MS_REGEX,MS_ISTRING,MS_IREGEX,MS_LIST)) == -1) return(-1);
@@ -3627,9 +3653,9 @@ int initLayer(layerObj *layer, mapObj *map)
msInitExpression(&(layer->utfdata));
layer->utfitem = NULL;
layer->utfitemindex = -1;
-
+
layer->encoding = NULL;
-
+
layer->sortBy.nProperties = 0;
layer->sortBy.properties = NULL;
layer->orig_st = NULL;
@@ -3700,7 +3726,7 @@ int freeLayer(layerObj *layer)
msProjectDestroyReprojector(layer->reprojectorMapToLayer);
msFreeProjection(&(layer->projection));
msFreeExpression(&layer->_geomtransform);
-
+
freeCluster(&layer->cluster);
for(i=0; i<layer->maxclasses; i++) {
@@ -3754,9 +3780,9 @@ int freeLayer(layerObj *layer)
if(layer->maskimage) {
msFreeImage(layer->maskimage);
}
-
+
if(layer->compositer) {
- freeLayerCompositer(layer->compositer);
+ freeLayerCompositer(layer->compositer);
}
if (layer->grid) {
@@ -3766,7 +3792,7 @@ int freeLayer(layerObj *layer)
msFreeExpression(&(layer->utfdata));
msFree(layer->utfitem);
-
+
for(i=0;i<layer->sortBy.nProperties;i++)
msFree(layer->sortBy.properties[i].item);
msFree(layer->sortBy.properties);
@@ -3842,7 +3868,7 @@ int loadScaletoken(scaleTokenObj *token, layerObj *layer) {
case(EOF):
msSetError(MS_EOFERR, NULL, "loadScaletoken()");
return(MS_FAILURE);
- case(END):
+ case(END):
stop = 1;
if(token->n_entries == 0) {
msSetError(MS_PARSEERR,"Scaletoken (line:%d) has no VALUES defined","loadScaleToken()",msyylineno);
@@ -3853,7 +3879,7 @@ int loadScaletoken(scaleTokenObj *token, layerObj *layer) {
case(MS_STRING):
/* we have a key */
token->tokens = msSmallRealloc(token->tokens,(token->n_entries+1)*sizeof(scaleTokenEntryObj));
-
+
if(1 != sscanf(msyystring_buffer,"%lf",&token->tokens[token->n_entries].minscale)) {
msSetError(MS_PARSEERR, "failed to parse SCALETOKEN VALUE (%s):(line %d), expecting \"minscale\"", "loadScaletoken()",
msyystring_buffer,msyylineno);
@@ -4661,7 +4687,7 @@ static void writeLayer(FILE *stream, int indent, layerObj *layer)
writeIndent(stream, indent + 1);
fprintf(stream, "GEOMTRANSFORM (%s)\n", layer->_geomtransform.string);
}
-
+
writeString(stream, indent, "HEADER", NULL, layer->header);
/* join - see below */
writeKeyword(stream, indent, "LABELCACHE", layer->labelcache, 1, MS_OFF, "OFF");
@@ -5014,7 +5040,7 @@ static int loadOutputFormat(mapObj *map)
}
case(NAME):
msFree( name );
- if((name = getToken()) == NULL)
+ if((name = getToken()) == NULL)
goto load_output_error;
break;
case(MIMETYPE):
@@ -6157,7 +6183,7 @@ int msSaveMap(mapObj *map, char *filename)
{
FILE *stream;
char szPath[MS_MAXPATHLEN];
-
+
if(!map) {
msSetError(MS_MISCERR, "Map is undefined.", "msSaveMap()");
return(-1);
@@ -6843,7 +6869,7 @@ static void layerSubstituteString(layerObj *layer, const char *from, const char
if(layer->tileindex) layer->tileindex = msCaseReplaceSubstring(layer->tileindex, from, to);
if(layer->connection) layer->connection = msCaseReplaceSubstring(layer->connection, from, to);
if(layer->filter.string) layer->filter.string = msCaseReplaceSubstring(layer->filter.string, from, to);
-
+
/* The bindvalues are most useful when able to substitute values from the URL */
hashTableSubstituteString(&layer->bindvals, from, to);
hashTableSubstituteString(&layer->metadata, from, to);
=====================================
maplabel.c
=====================================
@@ -36,7 +36,8 @@
#include "mapserver.h"
#include "fontcache.h"
-
+#include "cpl_vsi.h"
+#include "cpl_string.h"
@@ -774,8 +775,8 @@ int msFreeFontSet(fontSetObj *fontset)
int msLoadFontSet(fontSetObj *fontset, mapObj *map)
{
- FILE *stream;
- char buffer[MS_BUFFER_LENGTH];
+ VSILFILE *stream;
+ const char* line;
char alias[64], file1[MS_PATH_LENGTH], file2[MS_PATH_LENGTH];
char *path;
char szPath[MS_MAXPATHLEN];
@@ -798,7 +799,7 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)
/* return(-1); */
/* } */
- stream = fopen( msBuildPath(szPath, fontset->map->mappath, fontset->filename), "r");
+ stream = VSIFOpenL( msBuildPath(szPath, fontset->map->mappath, fontset->filename), "rb");
if(!stream) {
msSetError(MS_IOERR, "Error opening fontset %s.", "msLoadFontset()",
fontset->filename);
@@ -806,12 +807,12 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)
}
i = 0;
- while(fgets(buffer, MS_BUFFER_LENGTH, stream)) { /* while there's something to load */
+ while( (line = CPLReadLineL(stream)) != NULL ) { /* while there's something to load */
- if(buffer[0] == '#' || buffer[0] == '\n' || buffer[0] == '\r' || buffer[0] == ' ')
+ if(line[0] == '#' || line[0] == '\n' || line[0] == '\r' || line[0] == ' ')
continue; /* skip comments and blank lines */
- sscanf(buffer,"%s %s", alias, file1);
+ sscanf(line,"%s %s", alias, file1);
if (!(*file1) || !(*alias) || (strlen(file1) <= 0))
continue;
@@ -845,7 +846,7 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)
}
fontset->numfonts = i;
- fclose(stream); /* close the file */
+ VSIFCloseL(stream); /* close the file */
free(path);
return(0);
=====================================
mapogcsld.c
=====================================
@@ -1384,7 +1384,7 @@ int msSLDParseOgcExpression(CPLXMLNode *psRoot, void *psObj, int binding,
propertyString = msStringConcatenate(propertyString, psRoot->psChild->pszValue);
propertyString = msStringConcatenate(propertyString, "]");
propertyString = msStringConcatenate(propertyString, strDelim);
- msInitExpression(&(psStyle->exprBindings[binding]));
+ msInitExpression(&(exprBindings[binding]));
exprBindings[binding].string = propertyString;
exprBindings[binding].type = MS_EXPRESSION;
(*nexprbindings)++;
=====================================
mapogroutput.c → mapogroutput.cpp
=====================================
@@ -33,13 +33,14 @@
#include "mapthread.h"
#include "mapows.h"
-#define __USE_LARGEFILE64 1
#include "ogr_api.h"
#include "ogr_srs_api.h"
#include "cpl_conv.h"
#include "cpl_vsi.h"
#include "cpl_string.h"
+#include <string>
+
/************************************************************************/
/* msInitDefaultOGROutputFormat() */
/************************************************************************/
@@ -717,21 +718,19 @@ int msOGRWriteFromQuery( mapObj *map, outputFormatObj *format, int sendheaders )
CSLFetchNameValueDef(layer_options, "NATIVE_DATA", "{}");
if( pszNativeData[strlen(pszNativeData)-1] == '}' )
{
- char szTemp[32];
- char* pszTemplate = msSmallMalloc(strlen(pszNativeData) + 32);
- strcpy(pszTemplate, pszNativeData);
- pszTemplate[strlen(pszTemplate)-1] = 0;
+ std::string tmpl(pszNativeData);
+ tmpl.resize(tmpl.size() - 1);
if( strlen(pszNativeData) > 2 )
- strcat(pszTemplate, ",");
- sprintf(szTemp, "\"numberMatched\":%d}", nMatchingFeatures);
- strcat(pszTemplate, szTemp);
+ tmpl += ',';
+ tmpl += "\"numberMatched\":";
+ tmpl += std::to_string(nMatchingFeatures);
+ tmpl += '}';
layer_options = CSLSetNameValue(layer_options,
"NATIVE_MEDIA_TYPE",
"application/vnd.geo+json");
layer_options = CSLSetNameValue(layer_options,
"NATIVE_DATA",
- pszTemplate);
- msFree(pszTemplate);
+ tmpl.c_str());
}
}
if(!strcasecmp("true",msGetOutputFormatOption(format,"USE_FEATUREID","false"))) {
@@ -1129,11 +1128,11 @@ int msOGRWriteFromQuery( mapObj *map, outputFormatObj *format, int sendheaders )
msShapeGetClass(layer, map, &resultshape, NULL, -1);
if( resultshape.classindex >= 0
- && (layer->class[resultshape.classindex]->text.string
+ && (layer->_class[resultshape.classindex]->text.string
|| layer->labelitem)
- && layer->class[resultshape.classindex]->numlabels > 0
- && layer->class[resultshape.classindex]->labels[0]->size != -1 ) {
- resultshape.text = msShapeGetLabelAnnotation(layer,&resultshape,layer->class[resultshape.classindex]->labels[0]);
+ && layer->_class[resultshape.classindex]->numlabels > 0
+ && layer->_class[resultshape.classindex]->labels[0]->size != -1 ) {
+ resultshape.text = msShapeGetLabelAnnotation(layer,&resultshape,layer->_class[resultshape.classindex]->labels[0]);
}
/*
=====================================
mapscript/swiginc/map.i
=====================================
@@ -111,6 +111,17 @@
{
return msMapSetSize(self, width, height);
}
+
+ void pixelToGeoref(double pixPosX, double pixPosY, pointObj *geoPos)
+ {
+ geoPos->x = self->gt.geotransform[0] + self->gt.geotransform[1] * pixPosX + self->gt.geotransform[2] * pixPosY;
+ geoPos->y = self->gt.geotransform[3] + self->gt.geotransform[4] * pixPosX + self->gt.geotransform[5] * pixPosY;
+ }
+
+ double getRotation()
+ {
+ return self->gt.rotation_angle;
+ }
int setRotation( double rotation_angle )
{
=====================================
mapscript/swiginc/mapzoom.i
=====================================
@@ -73,6 +73,11 @@
dY = dfDeltaY/((double)height);
dfGeoPosX = poGeorefExt->minx + dX * (double)poPixPos->x;
dfGeoPosY = poGeorefExt->maxy - dY * (double)poPixPos->y;
+
+ if (self->gt.rotation_angle != 0) {
+ dfGeoPosX = self->gt.geotransform[0] + self->gt.geotransform[1] * (double)poPixPos->x + self->gt.geotransform[2] * (double)poPixPos->y;
+ dfGeoPosY = self->gt.geotransform[3] + self->gt.geotransform[4] * (double)poPixPos->x + self->gt.geotransform[5] * (double)poPixPos->y;
+ }
/* --- -------------------------------------------------------- */
/* zoom in */
@@ -427,6 +432,11 @@
dY = dfDeltaY/((double)height);
dfGeoPosX = poGeorefExt->minx + dX * (double)poPixPos->x;
dfGeoPosY = poGeorefExt->maxy - dY * (double)poPixPos->y;
+
+ if (self->gt.rotation_angle != 0) {
+ dfGeoPosX = self->gt.geotransform[0] + self->gt.geotransform[1] * (double)poPixPos->x + self->gt.geotransform[2] * (double)poPixPos->y;
+ dfGeoPosY = self->gt.geotransform[3] + self->gt.geotransform[4] * (double)poPixPos->x + self->gt.geotransform[5] * (double)poPixPos->y;
+ }
/* ------------------------------------------------------------ */
/* Calculate new extents based on the scale. */
=====================================
mapserver.h
=====================================
@@ -578,7 +578,7 @@ extern "C" {
char *filter;
struct _CompositingFilter *next;
} CompositingFilter;
-
+
typedef struct _LayerCompositer{
CompositingOperation comp_op;
int opacity;
@@ -623,8 +623,8 @@ extern "C" {
/* Define supported bindings here (only covers existing bindings at first). Not accessible directly using MapScript. */
#define MS_STYLE_BINDING_LENGTH 12
enum MS_STYLE_BINDING_ENUM { MS_STYLE_BINDING_SIZE, MS_STYLE_BINDING_WIDTH, MS_STYLE_BINDING_ANGLE, MS_STYLE_BINDING_COLOR, MS_STYLE_BINDING_OUTLINECOLOR, MS_STYLE_BINDING_SYMBOL, MS_STYLE_BINDING_OUTLINEWIDTH, MS_STYLE_BINDING_OPACITY, MS_STYLE_BINDING_OFFSET_X, MS_STYLE_BINDING_OFFSET_Y, MS_STYLE_BINDING_POLAROFFSET_PIXEL, MS_STYLE_BINDING_POLAROFFSET_ANGLE };
-#define MS_LABEL_BINDING_LENGTH 9
- enum MS_LABEL_BINDING_ENUM { MS_LABEL_BINDING_SIZE, MS_LABEL_BINDING_ANGLE, MS_LABEL_BINDING_COLOR, MS_LABEL_BINDING_OUTLINECOLOR, MS_LABEL_BINDING_FONT, MS_LABEL_BINDING_PRIORITY, MS_LABEL_BINDING_POSITION, MS_LABEL_BINDING_SHADOWSIZEX, MS_LABEL_BINDING_SHADOWSIZEY };
+#define MS_LABEL_BINDING_LENGTH 12
+ enum MS_LABEL_BINDING_ENUM { MS_LABEL_BINDING_SIZE, MS_LABEL_BINDING_ANGLE, MS_LABEL_BINDING_COLOR, MS_LABEL_BINDING_OUTLINECOLOR, MS_LABEL_BINDING_FONT, MS_LABEL_BINDING_PRIORITY, MS_LABEL_BINDING_POSITION, MS_LABEL_BINDING_SHADOWSIZEX, MS_LABEL_BINDING_SHADOWSIZEY, MS_LABEL_BINDING_OFFSET_X, MS_LABEL_BINDING_OFFSET_Y,MS_LABEL_BINDING_ALIGN };
/************************************************************************/
/* attributeBindingObj */
@@ -768,7 +768,7 @@ extern "C" {
colorObj *pixel; /* for raster layers */
shapeObj *shape; /* for vector layers */
double dblval; /* for map cellsize used by simplify */
- double dblval2; /* for data cellsize */
+ double dblval2; /* for data cellsize */
expressionObj *expr; /* expression to be evaluated (contains tokens) */
int type; /* type of parse: boolean, string/text or shape/geometry */
parseResultObj result; /* parse result */
@@ -877,10 +877,10 @@ extern "C" {
long tileindex;
int clear_resultcache;
- int maxfeatures; /* global maxfeatures */
+ int maxfeatures; /* global maxfeatures */
int startindex;
int only_cache_result_count; /* set to 1 sometimes by WFS 2.0 GetFeature request */
-
+
expressionObj filter; /* by filter */
char *filteritem;
@@ -1136,7 +1136,7 @@ extern "C" {
labelLeaderObj *leader;
};
-
+
#ifdef SWIG
#ifdef __cplusplus
extern "C" {
@@ -1153,7 +1153,7 @@ typedef struct labelObj labelObj;
lineObj *poly;
rectObj bbox;
} label_bounds;
-
+
typedef struct {
labelObj *label;
char *annotext;
@@ -1176,14 +1176,14 @@ typedef struct labelObj labelObj;
/* */
/* basic symbolization and classification information */
/************************************************************************/
-
+
struct classObj {
#ifndef SWIG
expressionObj expression; /* the expression to be matched */
#endif
int status;
- int isfallback; // TRUE if this class should be applied if and only if
+ int isfallback; // TRUE if this class should be applied if and only if
// no other class is applicable (e.g. SLD <ElseFilter/>)
#ifndef SWIG
@@ -1574,7 +1574,7 @@ typedef struct labelObj labelObj;
double maxscale;
char *value;
} scaleTokenEntryObj;
-
+
typedef struct {
char *name;
int n_entries;
@@ -1659,7 +1659,7 @@ typedef struct labelObj labelObj;
scaleTokenObj *scaletokens;
int numscaletokens;
originalScaleTokenStrings *orig_st;
-
+
#endif
char *data; /* filename, can be relative or full path */
@@ -1785,7 +1785,7 @@ typedef struct labelObj labelObj;
#endif
char *mask;
-#ifndef SWIG
+#ifndef SWIG
expressionObj _geomtransform;
#endif
@@ -1799,7 +1799,7 @@ typedef struct labelObj labelObj;
#ifndef SWIG
sortByClause sortBy;
#endif
-
+
LayerCompositer *compositer;
hashTableObj connectionoptions;
@@ -2533,7 +2533,7 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
MS_DLL_EXPORT int msGraticuleLayerInitializeVirtualTable(layerObj *layer);
MS_DLL_EXPORT int msRASTERLayerInitializeVirtualTable(layerObj *layer);
MS_DLL_EXPORT int msUVRASTERLayerInitializeVirtualTable(layerObj *layer);
- MS_DLL_EXPORT int msContourLayerInitializeVirtualTable(layerObj *layer);
+ MS_DLL_EXPORT int msContourLayerInitializeVirtualTable(layerObj *layer);
MS_DLL_EXPORT int msPluginLayerInitializeVirtualTable(layerObj *layer);
MS_DLL_EXPORT int msUnionLayerInitializeVirtualTable(layerObj *layer);
MS_DLL_EXPORT void msPluginFreeVirtualTableFactory(void);
@@ -2554,7 +2554,7 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
MS_DLL_EXPORT int msDrawQueryLayer(mapObj *map, layerObj *layer, imageObj *image);
MS_DLL_EXPORT int msDrawWMSLayer(mapObj *map, layerObj *layer, imageObj *image);
MS_DLL_EXPORT int msDrawWFSLayer(mapObj *map, layerObj *layer, imageObj *image);
-
+
#define MS_DRAWMODE_FEATURES 0x00001
#define MS_DRAW_FEATURES(mode) (MS_DRAWMODE_FEATURES&(mode))
#define MS_DRAWMODE_LABELS 0x00002
@@ -2700,7 +2700,7 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
MS_DLL_EXPORT unsigned char *msSaveImageBuffer(imageObj* image, int *size_ptr, outputFormatObj *format);
MS_DLL_EXPORT shapeObj* msOffsetPolyline(shapeObj* shape, double offsetx, double offsety);
MS_DLL_EXPORT int msMapSetLayerProjections(mapObj* map);
-
+
/* Functions to chnage the drawing order of the layers. */
/* Defined in mapobject.c */
MS_DLL_EXPORT int msMoveLayerUp(mapObj *map, int nLayerIndex);
@@ -2946,8 +2946,8 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
MS_DLL_EXPORT void msStyleSetGeomTransform(styleObj *s, char *transform);
MS_DLL_EXPORT char *msStyleGetGeomTransform(styleObj *style);
- MS_DLL_EXPORT int msGeomTransformShape(mapObj *map, layerObj *layer, shapeObj *shape);
-
+ MS_DLL_EXPORT int msGeomTransformShape(mapObj *map, layerObj *layer, shapeObj *shape);
+
/* ==================================================================== */
/* end of prototypes for functions in mapgeomtransform.c */
/* ==================================================================== */
@@ -2967,7 +2967,7 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
/* prototypes for functions in mapsmoothing.c */
/* ==================================================================== */
MS_DLL_EXPORT shapeObj* msSmoothShapeSIA(shapeObj *shape, int ss, int si, char *preprocessing);
-
+
/* ==================================================================== */
/* end of prototypes for functions in mapsmoothing.c */
/* ==================================================================== */
@@ -2982,7 +2982,7 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
MS_DLL_EXPORT char* msV8GetFeatureStyle(mapObj *map, const char *filename,
layerObj *layer, shapeObj *shape);
MS_DLL_EXPORT shapeObj *msV8TransformShape(shapeObj *shape,
- const char* filename);
+ const char* filename);
#endif
/* ==================================================================== */
/* end of prototypes for functions in mapv8.cpp */
@@ -3112,10 +3112,10 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
int msSaveRasterBuffer(mapObj *map, rasterBufferObj *data, FILE *stream, outputFormatObj *format);
int msSaveRasterBufferToBuffer(rasterBufferObj *data, bufferObj *buffer, outputFormatObj *format);
int msLoadMSRasterBufferFromFile(char *path, rasterBufferObj *rb);
-
+
/* in mapagg.cpp */
void msApplyBlurringCompositingFilter(rasterBufferObj *rb, unsigned int radius);
-
+
int WARN_UNUSED msApplyCompositingFilter(mapObj *map, rasterBufferObj *rb, CompositingFilter *filter);
void msBufferInit(bufferObj *buffer);
=====================================
mapshape.c
=====================================
@@ -151,8 +151,8 @@ static void writeHeader( SHPHandle psSHP )
/* -------------------------------------------------------------------- */
/* Write .shp file header. */
/* -------------------------------------------------------------------- */
- fseek( psSHP->fpSHP, 0, 0 );
- fwrite( abyHeader, 100, 1, psSHP->fpSHP );
+ VSIFSeekL( psSHP->fpSHP, 0, 0 );
+ VSIFWriteL( abyHeader, 100, 1, psSHP->fpSHP );
/* -------------------------------------------------------------------- */
/* Prepare, and write .shx file header. */
@@ -161,8 +161,8 @@ static void writeHeader( SHPHandle psSHP )
ByteCopy( &i32, abyHeader+24, 4 );
if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
- fseek( psSHP->fpSHX, 0, 0 );
- fwrite( abyHeader, 100, 1, psSHP->fpSHX );
+ VSIFSeekL( psSHP->fpSHX, 0, 0 );
+ VSIFWriteL( abyHeader, 100, 1, psSHP->fpSHX );
/* -------------------------------------------------------------------- */
/* Write out the .shx contents. */
@@ -178,7 +178,7 @@ static void writeHeader( SHPHandle psSHP )
}
}
- fwrite( panSHX, sizeof(ms_int32) * 2, psSHP->nRecords, psSHP->fpSHX );
+ VSIFWriteL( panSHX, sizeof(ms_int32) * 2, psSHP->nRecords, psSHP->fpSHX );
free( panSHX );
}
@@ -247,10 +247,10 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess )
/* -------------------------------------------------------------------- */
pszFullname = (char *) msSmallMalloc(strlen(pszBasename) + 5);
sprintf( pszFullname, "%s.shp", pszBasename );
- psSHP->fpSHP = fopen(pszFullname, pszAccess );
+ psSHP->fpSHP = VSIFOpenL(pszFullname, pszAccess );
if( psSHP->fpSHP == NULL ) {
sprintf( pszFullname, "%s.SHP", pszBasename );
- psSHP->fpSHP = fopen(pszFullname, pszAccess );
+ psSHP->fpSHP = VSIFOpenL(pszFullname, pszAccess );
}
if( psSHP->fpSHP == NULL ) {
msFree(pszBasename);
@@ -260,13 +260,13 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess )
}
sprintf( pszFullname, "%s.shx", pszBasename );
- psSHP->fpSHX = fopen(pszFullname, pszAccess );
+ psSHP->fpSHX = VSIFOpenL(pszFullname, pszAccess );
if( psSHP->fpSHX == NULL ) {
sprintf( pszFullname, "%s.SHX", pszBasename );
- psSHP->fpSHX = fopen(pszFullname, pszAccess );
+ psSHP->fpSHX = VSIFOpenL(pszFullname, pszAccess );
}
if( psSHP->fpSHX == NULL ) {
- fclose(psSHP->fpSHP);
+ VSIFCloseL(psSHP->fpSHP);
msFree(pszBasename);
msFree(pszFullname);
msFree(psSHP);
@@ -280,9 +280,9 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess )
/* Read the file size from the SHP file. */
/* -------------------------------------------------------------------- */
pabyBuf = (uchar *) msSmallMalloc(100);
- if(1 != fread( pabyBuf, 100, 1, psSHP->fpSHP )) {
- fclose( psSHP->fpSHP );
- fclose( psSHP->fpSHX );
+ if(1 != VSIFReadL( pabyBuf, 100, 1, psSHP->fpSHP )) {
+ VSIFCloseL( psSHP->fpSHP );
+ VSIFCloseL( psSHP->fpSHX );
free( psSHP );
free(pabyBuf);
return( NULL );
@@ -296,10 +296,10 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess )
/* -------------------------------------------------------------------- */
/* Read SHX file Header info */
/* -------------------------------------------------------------------- */
- if(1 != fread( pabyBuf, 100, 1, psSHP->fpSHX )) {
+ if(1 != VSIFReadL( pabyBuf, 100, 1, psSHP->fpSHX )) {
msSetError(MS_SHPERR, "Corrupted .shx file", "msSHPOpen()");
- fclose( psSHP->fpSHP );
- fclose( psSHP->fpSHX );
+ VSIFCloseL( psSHP->fpSHP );
+ VSIFCloseL( psSHP->fpSHX );
free( psSHP );
free(pabyBuf);
return( NULL );
@@ -307,8 +307,8 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess )
if( pabyBuf[0] != 0 || pabyBuf[1] != 0 || pabyBuf[2] != 0x27 || (pabyBuf[3] != 0x0a && pabyBuf[3] != 0x0d) ) {
msSetError(MS_SHPERR, "Corrupted .shp file", "msSHPOpen()");
- fclose( psSHP->fpSHP );
- fclose( psSHP->fpSHX );
+ VSIFCloseL( psSHP->fpSHP );
+ VSIFCloseL( psSHP->fpSHX );
free( psSHP );
free(pabyBuf);
@@ -322,8 +322,8 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess )
if( psSHP->nRecords < 0 || psSHP->nRecords > 256000000 ) {
msSetError(MS_SHPERR, "Corrupted .shp file : nRecords = %d.", "msSHPOpen()",
psSHP->nRecords);
- fclose( psSHP->fpSHP );
- fclose( psSHP->fpSHX );
+ VSIFCloseL( psSHP->fpSHP );
+ VSIFCloseL( psSHP->fpSHX );
free( psSHP );
free(pabyBuf);
return( NULL );
@@ -386,8 +386,8 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess )
free(psSHP->panRecOffset);
free(psSHP->panRecSize);
free(psSHP->panRecLoaded);
- fclose( psSHP->fpSHP );
- fclose( psSHP->fpSHX );
+ VSIFCloseL( psSHP->fpSHP );
+ VSIFCloseL( psSHP->fpSHX );
free( psSHP );
msSetError(MS_MEMERR, "Out of memory", "msSHPOpen()");
return( NULL );
@@ -421,8 +421,8 @@ void msSHPClose(SHPHandle psSHP )
free(psSHP->pabyRec);
free(psSHP->panParts);
- fclose( psSHP->fpSHX );
- fclose( psSHP->fpSHP );
+ VSIFCloseL( psSHP->fpSHX );
+ VSIFCloseL( psSHP->fpSHP );
free( psSHP );
}
@@ -451,7 +451,7 @@ SHPHandle msSHPCreate( const char * pszLayer, int nShapeType )
{
char *pszBasename, *pszFullname;
int i;
- FILE *fpSHP, *fpSHX;
+ VSILFILE *fpSHP, *fpSHX;
uchar abyHeader[100];
ms_int32 i32;
double dValue;
@@ -499,7 +499,7 @@ SHPHandle msSHPCreate( const char * pszLayer, int nShapeType )
/* -------------------------------------------------------------------- */
pszFullname = (char *) msSmallMalloc(strlen(pszBasename) + 5);
sprintf( pszFullname, "%s.shp", pszBasename );
- fpSHP = fopen(pszFullname, "wb" );
+ fpSHP = VSIFOpenL(pszFullname, "wb" );
if( fpSHP == NULL ) {
free( pszFullname );
free(pszBasename);
@@ -507,9 +507,9 @@ SHPHandle msSHPCreate( const char * pszLayer, int nShapeType )
}
sprintf( pszFullname, "%s.shx", pszBasename );
- fpSHX = fopen(pszFullname, "wb" );
+ fpSHX = VSIFOpenL(pszFullname, "wb" );
if( fpSHX == NULL ) {
- fclose(fpSHP);
+ VSIFCloseL(fpSHP);
free( pszFullname );
free(pszBasename);
return( NULL );
@@ -548,7 +548,7 @@ SHPHandle msSHPCreate( const char * pszLayer, int nShapeType )
/* -------------------------------------------------------------------- */
/* Write .shp file header. */
/* -------------------------------------------------------------------- */
- fwrite( abyHeader, 100, 1, fpSHP );
+ VSIFWriteL( abyHeader, 100, 1, fpSHP );
/* -------------------------------------------------------------------- */
/* Prepare, and write .shx file header. */
@@ -557,13 +557,13 @@ SHPHandle msSHPCreate( const char * pszLayer, int nShapeType )
ByteCopy( &i32, abyHeader+24, 4 );
if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
- fwrite( abyHeader, 100, 1, fpSHX );
+ VSIFWriteL( abyHeader, 100, 1, fpSHX );
/* -------------------------------------------------------------------- */
/* Close the files, and then open them as regular existing files. */
/* -------------------------------------------------------------------- */
- fclose( fpSHP );
- fclose( fpSHX );
+ VSIFCloseL( fpSHP );
+ VSIFCloseL( fpSHX );
return( msSHPOpen( pszLayer, "rb+" ) );
}
@@ -677,8 +677,8 @@ int msSHPWritePoint(SHPHandle psSHP, pointObj *point )
/* -------------------------------------------------------------------- */
/* Write out record. */
/* -------------------------------------------------------------------- */
- if(fseek( psSHP->fpSHP, nRecordOffset, 0 ) == 0) {
- fwrite( pabyRec, nRecordSize+8, 1, psSHP->fpSHP );
+ if(VSIFSeekL( psSHP->fpSHP, nRecordOffset, 0 ) == 0) {
+ VSIFWriteL( pabyRec, nRecordSize+8, 1, psSHP->fpSHP );
psSHP->panRecSize[psSHP->nRecords-1] = nRecordSize;
psSHP->nFileSize += nRecordSize + 8;
@@ -969,8 +969,8 @@ int msSHPWriteShape(SHPHandle psSHP, shapeObj *shape )
/* -------------------------------------------------------------------- */
/* Write out record. */
/* -------------------------------------------------------------------- */
- if(fseek( psSHP->fpSHP, nRecordOffset, 0 ) == 0) {
- fwrite( pabyRec, nRecordSize+8, 1, psSHP->fpSHP );
+ if(VSIFSeekL( psSHP->fpSHP, nRecordOffset, 0 ) == 0) {
+ VSIFWriteL( pabyRec, nRecordSize+8, 1, psSHP->fpSHP );
psSHP->panRecSize[psSHP->nRecords-1] = nRecordSize;
psSHP->nFileSize += nRecordSize + 8;
@@ -1082,11 +1082,11 @@ int msSHPReadPoint( SHPHandle psSHP, int hEntity, pointObj *point )
/* -------------------------------------------------------------------- */
/* Read the record. */
/* -------------------------------------------------------------------- */
- if( 0 != fseek( psSHP->fpSHP, msSHXReadOffset( psSHP, hEntity), 0 )) {
+ if( 0 != VSIFSeekL( psSHP->fpSHP, msSHXReadOffset( psSHP, hEntity), 0 )) {
msSetError(MS_IOERR, "failed to seek offset", "msSHPReadPoint()");
return(MS_FAILURE);
}
- if( 1 != fread( psSHP->pabyRec, nEntitySize, 1, psSHP->fpSHP )) {
+ if( 1 != VSIFReadL( psSHP->pabyRec, nEntitySize, 1, psSHP->fpSHP )) {
msSetError(MS_IOERR, "failed to fread record", "msSHPReadPoint()");
return(MS_FAILURE);
}
@@ -1122,13 +1122,13 @@ int msSHXLoadPage( SHPHandle psSHP, int shxBufferPage )
if( shxBufferPage < 0 )
return(MS_FAILURE);
- if( 0 != fseek( psSHP->fpSHX, 100 + shxBufferPage * SHX_BUFFER_PAGE * 8, 0 )) {
+ if( 0 != VSIFSeekL( psSHP->fpSHX, 100 + shxBufferPage * SHX_BUFFER_PAGE * 8, 0 )) {
/*
* msSetError(MS_IOERR, "failed to seek offset", "msSHXLoadPage()");
* return(MS_FAILURE);
*/
}
- if( SHX_BUFFER_PAGE != fread( buffer, 8, SHX_BUFFER_PAGE, psSHP->fpSHX )) {
+ if( SHX_BUFFER_PAGE != VSIFReadL( buffer, 8, SHX_BUFFER_PAGE, psSHP->fpSHX )) {
/*
* msSetError(MS_IOERR, "failed to fread SHX record", "msSHXLoadPage()");
* return(MS_FAILURE);
@@ -1175,7 +1175,7 @@ int msSHXLoadAll( SHPHandle psSHP )
uchar *pabyBuf;
pabyBuf = (uchar *) msSmallMalloc(8 * psSHP->nRecords );
- if(psSHP->nRecords != fread( pabyBuf, 8, psSHP->nRecords, psSHP->fpSHX )) {
+ if(psSHP->nRecords != VSIFReadL( pabyBuf, 8, psSHP->nRecords, psSHP->fpSHX )) {
msSetError(MS_IOERR, "failed to read shx records", "msSHXLoadAll()");
free(pabyBuf);
return MS_FAILURE;
@@ -1268,12 +1268,12 @@ void msSHPReadShape( SHPHandle psSHP, int hEntity, shapeObj *shape )
/* -------------------------------------------------------------------- */
/* Read the record. */
/* -------------------------------------------------------------------- */
- if( 0 != fseek( psSHP->fpSHP, msSHXReadOffset( psSHP, hEntity), 0 )) {
+ if( 0 != VSIFSeekL( psSHP->fpSHP, msSHXReadOffset( psSHP, hEntity), 0 )) {
msSetError(MS_IOERR, "failed to seek offset", "msSHPReadShape()");
shape->type = MS_SHAPE_NULL;
return;
}
- if( 1 != fread( psSHP->pabyRec, nEntitySize, 1, psSHP->fpSHP )) {
+ if( 1 != VSIFReadL( psSHP->pabyRec, nEntitySize, 1, psSHP->fpSHP )) {
msSetError(MS_IOERR, "failed to fread record", "msSHPReadPoint()");
shape->type = MS_SHAPE_NULL;
return;
@@ -1645,11 +1645,11 @@ int msSHPReadBounds( SHPHandle psSHP, int hEntity, rectObj *padBounds)
}
if( psSHP->nShapeType != SHP_POINT && psSHP->nShapeType != SHP_POINTZ && psSHP->nShapeType != SHP_POINTM) {
- if( 0 != fseek( psSHP->fpSHP, msSHXReadOffset( psSHP, hEntity) + 12, 0 )) {
+ if( 0 != VSIFSeekL( psSHP->fpSHP, msSHXReadOffset( psSHP, hEntity) + 12, 0 )) {
msSetError(MS_IOERR, "failed to seek offset", "msSHPReadBounds()");
return(MS_FAILURE);
}
- if( 1 != fread( padBounds, sizeof(double)*4, 1, psSHP->fpSHP )) {
+ if( 1 != VSIFReadL( padBounds, sizeof(double)*4, 1, psSHP->fpSHP )) {
msSetError(MS_IOERR, "failed to fread record", "msSHPReadBounds()");
return(MS_FAILURE);
}
@@ -1671,11 +1671,11 @@ int msSHPReadBounds( SHPHandle psSHP, int hEntity, rectObj *padBounds)
/* minimum and maximum bound. */
/* -------------------------------------------------------------------- */
- if( 0 != fseek( psSHP->fpSHP, msSHXReadOffset( psSHP, hEntity) + 12, 0 )) {
+ if( 0 != VSIFSeekL( psSHP->fpSHP, msSHXReadOffset( psSHP, hEntity) + 12, 0 )) {
msSetError(MS_IOERR, "failed to seek offset", "msSHPReadBounds()");
return(MS_FAILURE);
}
- if( 1 != fread( padBounds, sizeof(double)*2, 1, psSHP->fpSHP )) {
+ if( 1 != VSIFReadL( padBounds, sizeof(double)*2, 1, psSHP->fpSHP )) {
msSetError(MS_IOERR, "failed to fread record", "msSHPReadBounds()");
return(MS_FAILURE);
}
@@ -2678,14 +2678,14 @@ int msSHPLayerOpen(layerObj *layer)
{
const char* pszPRJFilename = CPLResetExtension(szPath, "prj");
int bOK = MS_FALSE;
- FILE* fp = fopen(pszPRJFilename, "rb");
+ VSILFILE* fp = VSIFOpenL(pszPRJFilename, "rb");
if( fp != NULL )
{
char szPRJ[2048];
OGRSpatialReferenceH hSRS;
int nRead;
- nRead = (int)fread(szPRJ, 1, sizeof(szPRJ) - 1, fp);
+ nRead = (int)VSIFReadL(szPRJ, 1, sizeof(szPRJ) - 1, fp);
szPRJ[nRead] = '\0';
hSRS = OSRNewSpatialReference(szPRJ);
if( hSRS != NULL )
@@ -2705,7 +2705,7 @@ int msSHPLayerOpen(layerObj *layer)
}
OSRDestroySpatialReference(hSRS);
}
- fclose(fp);
+ VSIFCloseL(fp);
}
if( bOK != MS_TRUE )
=====================================
mapshape.h
=====================================
@@ -34,6 +34,8 @@
#include "mapprimitive.h"
#include "mapproject.h"
+#include "cpl_vsi.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -79,8 +81,8 @@ extern "C" {
typedef unsigned char uchar;
typedef struct {
- FILE *fpSHP;
- FILE *fpSHX;
+ VSILFILE *fpSHP;
+ VSILFILE *fpSHX;
int nShapeType; /* SHPT_* */
int nFileSize; /* SHP file */
@@ -113,7 +115,7 @@ extern "C" {
#ifdef SWIG
%immutable;
#endif
- FILE *fp;
+ VSILFILE *fp;
int nRecords;
=====================================
mapstring.c
=====================================
@@ -34,6 +34,7 @@
#include "mapserver.h"
#include "mapthread.h"
+#include "cpl_vsi.h"
#include <ctype.h>
#include <string.h>
@@ -760,17 +761,17 @@ char *msBuildPath3(char *pszReturnPath, const char *abs_path, const char *path1,
char *msTryBuildPath(char *szReturnPath, const char *abs_path, const char *path)
{
- FILE *fp;
+ VSILFILE *fp;
if( msBuildPath( szReturnPath, abs_path, path ) == NULL )
return NULL;
- fp = fopen( szReturnPath, "r" );
+ fp = VSIFOpenL( szReturnPath, "r" );
if( fp == NULL ) {
strlcpy( szReturnPath, path, MS_MAXPATHLEN);
return NULL;
} else
- fclose( fp );
+ VSIFCloseL( fp );
return szReturnPath;
}
@@ -785,17 +786,17 @@ char *msTryBuildPath(char *szReturnPath, const char *abs_path, const char *path)
char *msTryBuildPath3(char *szReturnPath, const char *abs_path, const char *path1, const char *path2)
{
- FILE *fp;
+ VSILFILE *fp;
if( msBuildPath3( szReturnPath, abs_path, path1, path2 ) == NULL )
return NULL;
- fp = fopen( szReturnPath, "r" );
+ fp = VSIFOpenL( szReturnPath, "r" );
if( fp == NULL ) {
strlcpy( szReturnPath, path2, MS_MAXPATHLEN);
return NULL;
} else
- fclose( fp );
+ VSIFCloseL( fp );
return szReturnPath;
}
=====================================
maputil.c
=====================================
@@ -304,6 +304,34 @@ static void bindLabel(layerObj *layer, shapeObj *shape, labelObj *label, int dra
bindIntegerAttribute(&label->shadowsizey, shape->values[label->bindings[MS_LABEL_BINDING_SHADOWSIZEY].index]);
}
+ if(label->bindings[MS_LABEL_BINDING_OFFSET_X].index != -1) {
+ label->offsetx = 0;
+ bindIntegerAttribute(&label->offsetx, shape->values[label->bindings[MS_LABEL_BINDING_OFFSET_X].index]);
+ }
+
+ if(label->bindings[MS_LABEL_BINDING_OFFSET_Y].index != -1) {
+ label->offsety = 0;
+ bindIntegerAttribute(&label->offsety, shape->values[label->bindings[MS_LABEL_BINDING_OFFSET_Y].index]);
+ }
+
+ if(label->bindings[MS_LABEL_BINDING_ALIGN].index != -1) {
+ int tmpAlign = 0;
+ bindIntegerAttribute(&tmpAlign, shape->values[label->bindings[MS_LABEL_BINDING_ALIGN].index]);
+ if(tmpAlign != 0) { /* is this test sufficient? */
+ label->align = tmpAlign;
+ } else { /* Integer binding failed, look for strings like cc, ul, lr, etc... */
+ if(strlen(shape->values[label->bindings[MS_LABEL_BINDING_ALIGN].index]) >= 4) {
+ char *va = shape->values[label->bindings[MS_LABEL_BINDING_ALIGN].index];
+ if(!strncasecmp(va,"center",5))
+ label->align = MS_ALIGN_CENTER;
+ else if(!strncasecmp(va,"left",4))
+ label->align = MS_ALIGN_LEFT;
+ else if(!strncasecmp(va,"right",5))
+ label->align = MS_ALIGN_RIGHT;
+ }
+ }
+ }
+
if(label->bindings[MS_LABEL_BINDING_POSITION].index != -1) {
int tmpPosition = 0;
bindIntegerAttribute(&tmpPosition, shape->values[label->bindings[MS_LABEL_BINDING_POSITION].index]);
@@ -2264,10 +2292,10 @@ void msRGBtoHSL(colorObj *rgb, double *h, double *s, double *l) {
double r = rgb->red/255.0, g = rgb->green/255.0, b = rgb->blue/255.0;
double maxv = MS_MAX(MS_MAX(r, g), b), minv = MS_MIN(MS_MIN(r, g), b);
double d = maxv - minv;
-
+
*h = 0, *s = 0;
*l = (maxv + minv) / 2;
-
+
if (maxv != minv)
{
*s = *l > 0.5 ? d / (2 - maxv - minv) : d / (maxv + minv);
@@ -2289,11 +2317,11 @@ static double hue_to_rgb(double p, double q, double t) {
void msHSLtoRGB(double h, double s, double l, colorObj *rgb) {
double r, g, b;
-
+
if(s == 0){
r = g = b = l;
} else {
-
+
double q = l < 0.5 ? l * (1 + s) : l + s - l * s;
double p = 2 * l - q;
r = hue_to_rgb(p, q, h + 0.33333333333333333);
@@ -2530,7 +2558,7 @@ char *msBuildOnlineResource(mapObj *map, cgiRequestObj *req)
port = getenv("HTTP_X_FORWARDED_PORT");
if(!port)
port = getenv("SERVER_PORT");
-
+
script = getenv("SCRIPT_NAME");
/* HTTPS is set by Apache to "on" in an HTTPS server ... if not set */
@@ -2715,15 +2743,15 @@ shapeObj* msGeneralize(shapeObj *shape, double tolerance)
if (shape->numlines<1)
return newShape;
-
+
/* Clean shape */
for (int i=0; i < newShape->numlines; i++)
free(newShape->line[i].point);
newShape->numlines = 0;
if (newShape->line) free(newShape->line);
-
+
msAddLine(newShape, &newLine);
-
+
if (shape->line[0].numpoints==0) {
return newShape;
}
@@ -2737,7 +2765,7 @@ shapeObj* msGeneralize(shapeObj *shape, double tolerance)
{
double dX1 = shape->line[0].point[i].x;
double dY1 = shape->line[0].point[i].y;
-
+
const double dX = dX1-dX0;
const double dY = dY1-dY0;
const double dSqDist = dX*dX + dY*dY;
@@ -2746,15 +2774,15 @@ shapeObj* msGeneralize(shapeObj *shape, double tolerance)
pointObj p;
p.x = dX1;
p.y = dY1;
-
+
/* Keep this point (always keep the last point) */
msAddPointToLine(&newShape->line[0],
- &p);
+ &p);
dX0 = dX1;
dY0 = dY1;
}
}
-
+
return newShape;
}
=====================================
mapxbase.c
=====================================
@@ -28,22 +28,11 @@
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
-#define _FILE_OFFSET_BITS 64
-
#include "mapserver.h"
#include <stdlib.h> /* for atof() and atoi() */
#include <math.h>
-
-
-/* try to use a large file version of fseek for files up to 4GB (#3514) */
-#if _MSC_VER > 1310
-# define safe_fseek _fseeki64
-#elif defined(fseeko)
-# define safe_fseek fseeko
-#else
-# define safe_fseek fseek
-#endif
+#include "cpl_vsi.h"
static inline void IGUR_sizet(size_t ignored) { (void)ignored; } /* Ignore GCC Unused Result */
@@ -98,9 +87,9 @@ static void writeHeader(DBFHandle psDBF)
/* Write the initial 32 byte file header, and all the field */
/* descriptions. */
/* -------------------------------------------------------------------- */
- fseek( psDBF->fp, 0, 0 );
- fwrite( abyHeader, 32, 1, psDBF->fp );
- fwrite( psDBF->pszHeader, 32, psDBF->nFields, psDBF->fp );
+ VSIFSeekL( psDBF->fp, 0, 0 );
+ VSIFWriteL( abyHeader, 32, 1, psDBF->fp );
+ VSIFWriteL( psDBF->pszHeader, 32, psDBF->nFields, psDBF->fp );
/* -------------------------------------------------------------------- */
/* Write out the newline character if there is room for it. */
@@ -109,7 +98,7 @@ static void writeHeader(DBFHandle psDBF)
char cNewline;
cNewline = 0x0d;
- fwrite( &cNewline, 1, 1, psDBF->fp );
+ VSIFWriteL( &cNewline, 1, 1, psDBF->fp );
}
}
@@ -129,8 +118,8 @@ static void flushRecord( DBFHandle psDBF )
nRecordOffset = psDBF->nRecordLength * psDBF->nCurrentRecord
+ psDBF->nHeaderLength;
- safe_fseek( psDBF->fp, nRecordOffset, 0 );
- fwrite( psDBF->pszCurrentRecord, psDBF->nRecordLength, 1, psDBF->fp );
+ VSIFSeekL( psDBF->fp, nRecordOffset, 0 );
+ VSIFWriteL( psDBF->pszCurrentRecord, psDBF->nRecordLength, 1, psDBF->fp );
}
}
@@ -174,12 +163,12 @@ DBFHandle msDBFOpen( const char * pszFilename, const char * pszAccess )
/* -------------------------------------------------------------------- */
psDBF = (DBFHandle) calloc( 1, sizeof(DBFInfo) );
MS_CHECK_ALLOC(psDBF, sizeof(DBFInfo), NULL);
- psDBF->fp = fopen( pszDBFFilename, pszAccess );
+ psDBF->fp = VSIFOpenL( pszDBFFilename, pszAccess );
if( psDBF->fp == NULL )
{
if( strcmp(pszDBFFilename+strlen(pszDBFFilename)-4,".dbf") == 0 ) {
strcpy( pszDBFFilename+strlen(pszDBFFilename)-4, ".DBF");
- psDBF->fp = fopen( pszDBFFilename, pszAccess );
+ psDBF->fp = VSIFOpenL( pszDBFFilename, pszAccess );
}
}
if( psDBF->fp == NULL ) {
@@ -201,7 +190,7 @@ DBFHandle msDBFOpen( const char * pszFilename, const char * pszAccess )
/* Read Table Header info */
/* -------------------------------------------------------------------- */
pabyBuf = (uchar *) msSmallMalloc(500);
- if( fread( pabyBuf, 32, 1, psDBF->fp ) != 1 )
+ if( VSIFReadL( pabyBuf, 32, 1, psDBF->fp ) != 1 )
{
msFree(psDBF);
msFree(pabyBuf);
@@ -224,8 +213,8 @@ DBFHandle msDBFOpen( const char * pszFilename, const char * pszAccess )
pabyBuf = (uchar *) SfRealloc(pabyBuf,nHeadLen);
psDBF->pszHeader = (char *) pabyBuf;
- fseek( psDBF->fp, 32, 0 );
- if( fread( pabyBuf, nHeadLen - 32, 1, psDBF->fp ) != 1 )
+ VSIFSeekL( psDBF->fp, 32, 0 );
+ if( VSIFReadL( pabyBuf, nHeadLen - 32, 1, psDBF->fp ) != 1 )
{
msFree(psDBF->pszCurrentRecord);
msFree(psDBF);
@@ -283,8 +272,8 @@ void msDBFClose(DBFHandle psDBF)
if( psDBF->bUpdated ) {
uchar abyFileHeader[32];
- fseek( psDBF->fp, 0, 0 );
- IGUR_sizet(fread( abyFileHeader, 32, 1, psDBF->fp ));
+ VSIFSeekL( psDBF->fp, 0, 0 );
+ IGUR_sizet(VSIFReadL( abyFileHeader, 32, 1, psDBF->fp ));
abyFileHeader[1] = 95; /* YY */
abyFileHeader[2] = 7; /* MM */
@@ -295,14 +284,14 @@ void msDBFClose(DBFHandle psDBF)
abyFileHeader[6] = (psDBF->nRecords/(256*256)) % 256;
abyFileHeader[7] = (psDBF->nRecords/(256*256*256)) % 256;
- fseek( psDBF->fp, 0, 0 );
- fwrite( abyFileHeader, 32, 1, psDBF->fp );
+ VSIFSeekL( psDBF->fp, 0, 0 );
+ VSIFWriteL( abyFileHeader, 32, 1, psDBF->fp );
}
/* -------------------------------------------------------------------- */
/* Close, and free resources. */
/* -------------------------------------------------------------------- */
- fclose( psDBF->fp );
+ VSIFCloseL( psDBF->fp );
if( psDBF->panFieldOffset != NULL ) {
free( psDBF->panFieldOffset );
@@ -328,19 +317,22 @@ DBFHandle msDBFCreate( const char * pszFilename )
{
DBFHandle psDBF;
- FILE *fp;
+ VSILFILE *fp;
/* -------------------------------------------------------------------- */
/* Create the file. */
/* -------------------------------------------------------------------- */
- fp = fopen( pszFilename, "wb" );
+ fp = VSIFOpenL( pszFilename, "wb" );
if( fp == NULL )
return( NULL );
- fputc( 0, fp );
- fclose( fp );
+ {
+ char ch = 0;
+ VSIFWriteL(&ch, 1, 1, fp);
+ }
+ VSIFCloseL( fp );
- fp = fopen( pszFilename, "rb+" );
+ fp = VSIFOpenL( pszFilename, "rb+" );
if( fp == NULL )
return( NULL );
@@ -351,7 +343,7 @@ DBFHandle msDBFCreate( const char * pszFilename )
if (psDBF == NULL) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msDBFCreate()",
__FILE__, __LINE__, (unsigned int)sizeof(DBFInfo));
- fclose(fp);
+ VSIFCloseL(fp);
return NULL;
}
@@ -533,8 +525,8 @@ static const char *msDBFReadAttribute(DBFHandle psDBF, int hEntity, int iField )
nRecordOffset = psDBF->nRecordLength * hEntity + psDBF->nHeaderLength;
- safe_fseek( psDBF->fp, nRecordOffset, 0 );
- if( fread( psDBF->pszCurrentRecord, psDBF->nRecordLength, 1, psDBF->fp ) != 1 )
+ VSIFSeekL( psDBF->fp, nRecordOffset, 0 );
+ if( VSIFReadL( psDBF->pszCurrentRecord, psDBF->nRecordLength, 1, psDBF->fp ) != 1 )
{
msSetError(MS_DBFERR, "Cannot read record %d.", "msDBFReadAttribute()",hEntity );
return( NULL );
@@ -724,8 +716,8 @@ static int msDBFWriteAttribute(DBFHandle psDBF, int hEntity, int iField, void *
nRecordOffset = psDBF->nRecordLength * hEntity + psDBF->nHeaderLength;
- safe_fseek( psDBF->fp, nRecordOffset, 0 );
- if( fread( psDBF->pszCurrentRecord, psDBF->nRecordLength, 1, psDBF->fp ) != 1 )
+ VSIFSeekL( psDBF->fp, nRecordOffset, 0 );
+ if( VSIFReadL( psDBF->pszCurrentRecord, psDBF->nRecordLength, 1, psDBF->fp ) != 1 )
return MS_FALSE;
psDBF->nCurrentRecord = hEntity;
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapserver/-/commit/ea33d100de86ad2455802babfbfd34445edba2b6
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapserver/-/commit/ea33d100de86ad2455802babfbfd34445edba2b6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20200425/bb660d46/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list