Permalink
Browse files

fix compiler warnings (#5122)

  • Loading branch information...
tbonfort committed Jul 20, 2015
1 parent cb8e7c3 commit 960a9b192328ac9cf63e0b76d2fc75a39dd7a8a2
View
@@ -56,7 +56,7 @@ lexer: maplexer.c
parser: mapparser.c
maplexer.c: maplexer.l
- $(FLEX) --nounistd -Pmsyy -i -o$(CURDIR)/maplexer.c $(CURDIR)/maplexer.l
+ $(FLEX) --nounistd -Pmsyy -i -o$(CURDIR)/maplexer.c maplexer.l
mapparser.c: mapparser.y
- $(YACC) -d -o$(CURDIR)/mapparser.c $(CURDIR)/mapparser.y
+ $(YACC) -d -o$(CURDIR)/mapparser.c mapparser.y
View
@@ -41,7 +41,7 @@ typedef struct {
#ifdef USE_THREAD
typedef struct ft_thread_cache ft_thread_cache;
struct ft_thread_cache{
- int thread_id;
+ void* thread_id;
ft_thread_cache *next;
ft_cache cache;
};
@@ -102,7 +102,7 @@ ft_cache* msGetFontCache() {
#ifndef USE_THREAD
return &global_ft_cache;
#else
- int nThreadId = msGetThreadId();
+ void* nThreadId = msGetThreadId();
ft_thread_cache *prev = NULL, *cur = ft_caches;
if( cur != NULL && cur->thread_id == nThreadId )
View
@@ -1084,7 +1084,8 @@ int msRenderRasterizedSVGSymbol(imageObj *img, double x, double y, symbolObj *sy
pixsymbol.pixmap_buffer = svg_cache->pixmap_buffer;
pixsymbol.type = MS_SYMBOL_PIXMAP;
- MS_IMAGE_RENDERER(img)->renderPixmapSymbol(img,x,y,&pixsymbol,&pixstyle);
+ if(MS_SUCCESS != MS_IMAGE_RENDERER(img)->renderPixmapSymbol(img,x,y,&pixsymbol,&pixstyle))
+ return MS_FAILURE;
MS_IMAGE_RENDERER(img)->freeSymbol(&pixsymbol);
return MS_SUCCESS;
#else
View
@@ -803,7 +803,7 @@ int selectClusterShape(layerObj* layer, long shapeindex)
}
/* update the parameters from the related shapes */
-#ifndef NDEBUG
+#ifdef ms_notused
static void UpdateClusterParameters(msClusterLayerInfo* layerinfo, clusterTreeNode *node, clusterInfo *shape)
{
int i;
View
@@ -661,6 +661,7 @@ int msLoadMapContextGeneral(mapObj *map, CPLXMLNode *psGeneral,
char *pszProj=NULL;
char *pszValue, *pszValue1, *pszValue2;
+ int nTmp;
/* Projection */
pszValue = (char*)CPLGetXMLValue(psGeneral,
@@ -678,12 +679,14 @@ int msLoadMapContextGeneral(mapObj *map, CPLXMLNode *psGeneral,
map->projection.numargs++;
msProcessProjection(&map->projection);
- if( (map->units = GetMapserverUnitUsingProj(&(map->projection))) == -1) {
+ if( (nTmp = GetMapserverUnitUsingProj(&(map->projection))) == -1) {
free(pszProj);
msSetError( MS_MAPCONTEXTERR,
"Unable to set units for projection '%s'",
"msLoadMapContext()", pszProj );
return MS_FAILURE;
+ } else {
+ map->units = nTmp;
}
free(pszProj);
} else {
View
@@ -68,7 +68,7 @@ static debugInfoObj *debuginfo_list = NULL;
debugInfoObj *msGetDebugInfoObj()
{
debugInfoObj *link;
- int thread_id;
+ void* thread_id;
debugInfoObj *ret_obj;
msAcquireLock( TLOCK_DEBUGOBJ );
@@ -285,7 +285,7 @@ void msDebugCleanup()
#ifdef USE_THREAD
{
- int thread_id = msGetThreadId();
+ void* thread_id = msGetThreadId();
debugInfoObj *link;
msAcquireLock( TLOCK_DEBUGOBJ );
View
@@ -90,7 +90,7 @@ static char *ms_errorCodes[MS_NUMERRORCODES] = {"",
errorObj *msGetErrorObj()
{
- static errorObj ms_error = {MS_NOERR, "", "", MS_FALSE, NULL};
+ static errorObj ms_error = {MS_NOERR, "", "", MS_FALSE, 0, NULL};
return &ms_error;
}
@@ -100,7 +100,7 @@ errorObj *msGetErrorObj()
typedef struct te_info {
struct te_info *next;
- int thread_id;
+ void* thread_id;
errorObj ms_error;
} te_info_t;
@@ -109,7 +109,7 @@ static te_info_t *error_list = NULL;
errorObj *msGetErrorObj()
{
te_info_t *link;
- int thread_id;
+ void* thread_id;
errorObj *ret_obj;
msAcquireLock( TLOCK_ERROROBJ );
@@ -240,7 +240,7 @@ void msResetErrorList()
/* -------------------------------------------------------------------- */
#ifdef USE_THREAD
{
- int thread_id = msGetThreadId();
+ void* thread_id = msGetThreadId();
te_info_t *link;
msAcquireLock( TLOCK_ERROROBJ );
@@ -392,7 +392,6 @@ void msWriteErrorXML(FILE *stream)
void msWriteErrorImage(mapObj *map, char *filename, int blank)
{
imageObj *img;
- rendererVTableObj *renderer;
int width=400, height=300;
int nMargin =5;
int nTextLength = 0;
@@ -442,8 +441,6 @@ void msWriteErrorImage(mapObj *map, char *filename, int blank)
}
img = msImageCreate(width,height,format,imagepath,imageurl,MS_DEFAULT_RESOLUTION,MS_DEFAULT_RESOLUTION,imagecolorptr);
- renderer = MS_IMAGE_RENDERER(img);
-
nTextLength = strlen(errormsg);
nWidthTxt = nTextLength * charWidth;
@@ -491,8 +488,9 @@ void msWriteErrorImage(mapObj *map, char *filename, int blank)
initTextSymbol(&ts);
msPopulateTextSymbolForLabelAndString(&ts,&label,papszLines[i],1,1,0);
if(LIKELY(MS_SUCCESS == msComputeTextPath(map,&ts))) {
- int idontcare;
- idontcare = msDrawTextSymbol(NULL,img,pnt,&ts);
+ if(MS_SUCCESS!=msDrawTextSymbol(NULL,img,pnt,&ts)) {
+ /* an error occured, but there's nothing much we can do about it here as we are already handling an error condition */
+ }
freeTextSymbol(&ts);
}
}
View
@@ -30,6 +30,8 @@
#ifndef MAPERROR_H
#define MAPERROR_H
+#include "mapthread.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -162,7 +164,7 @@ extern "C" {
char *errorfile;
FILE *fp;
/* The following 2 members are used only with USE_THREAD (but we won't #ifndef them) */
- int thread_id;
+ void* thread_id;
struct debug_info_obj *next;
} debugInfoObj;
View
@@ -722,6 +722,7 @@ void freeJoin(joinObj *join)
int loadJoin(joinObj *join)
{
+ int nTmp;
initJoin(join);
for(;;) {
@@ -730,7 +731,8 @@ int loadJoin(joinObj *join)
if(getString(&join->connection) == MS_FAILURE) return(-1);
break;
case(CONNECTIONTYPE):
- if((join->connectiontype = getSymbol(5, MS_DB_XBASE, MS_DB_MYSQL, MS_DB_ORACLE, MS_DB_POSTGRES, MS_DB_CSV)) == -1) return(-1);
+ if((nTmp = getSymbol(5, MS_DB_XBASE, MS_DB_MYSQL, MS_DB_ORACLE, MS_DB_POSTGRES, MS_DB_CSV)) == -1) return(-1);
+ join->connectiontype = nTmp;
break;
case(EOF):
msSetError(MS_EOFERR, NULL, "loadJoin()");
@@ -769,7 +771,8 @@ int loadJoin(joinObj *join)
if(getString(&join->to) == MS_FAILURE) return(-1);
break;
case(TYPE):
- if((join->type = getSymbol(2, MS_JOIN_ONE_TO_ONE, MS_JOIN_ONE_TO_MANY)) == -1) return(-1);
+ if((nTmp = getSymbol(2, MS_JOIN_ONE_TO_ONE, MS_JOIN_ONE_TO_MANY)) == -1) return(-1);
+ join->type = nTmp;
break;
default:
msSetError(MS_IDENTERR, "Parsing error near (%s):(line %d)", "loadJoin()", msyystring_buffer, msyylineno);
@@ -4259,7 +4262,8 @@ int loadLayer(layerObj *layer, mapObj *map)
}
break;
case(CONNECTIONTYPE):
- if((layer->connectiontype = getSymbol(11, MS_OGR, MS_POSTGIS, MS_WMS, MS_ORACLESPATIAL, MS_WFS, MS_GRATICULE, MS_PLUGIN, MS_UNION, MS_UVRASTER, MS_CONTOUR, MS_KERNELDENSITY)) == -1) return(-1);
+ if((type = getSymbol(11, MS_OGR, MS_POSTGIS, MS_WMS, MS_ORACLESPATIAL, MS_WFS, MS_GRATICULE, MS_PLUGIN, MS_UNION, MS_UVRASTER, MS_CONTOUR, MS_KERNELDENSITY)) == -1) return(-1);
+ layer->connectiontype = type;
break;
case(DATA):
if(getString(&layer->data) == MS_FAILURE) return(-1); /* getString() cleans up previously allocated string */
@@ -4627,12 +4631,13 @@ int loadLayer(layerObj *layer, mapObj *map)
if((layer->transform = getSymbol(11, MS_TRUE,MS_FALSE, MS_UL,MS_UC,MS_UR,MS_CL,MS_CC,MS_CR,MS_LL,MS_LC,MS_LR)) == -1) return(-1);
break;
case(TYPE):
- if((layer->type = getSymbol(9, MS_LAYER_POINT,MS_LAYER_LINE,MS_LAYER_RASTER,MS_LAYER_POLYGON,MS_LAYER_ANNOTATION,MS_LAYER_QUERY,MS_LAYER_CIRCLE,MS_LAYER_CHART,TILEINDEX)) == -1) return(-1);
- if(layer->type == TILEINDEX) layer->type = MS_LAYER_TILEINDEX; /* TILEINDEX is also a parameter */
- if(layer->type == MS_LAYER_ANNOTATION) {
+ if((type = getSymbol(9, MS_LAYER_POINT,MS_LAYER_LINE,MS_LAYER_RASTER,MS_LAYER_POLYGON,MS_LAYER_ANNOTATION,MS_LAYER_QUERY,MS_LAYER_CIRCLE,MS_LAYER_CHART,TILEINDEX)) == -1) return(-1);
+ if(type == TILEINDEX) type = MS_LAYER_TILEINDEX; /* TILEINDEX is also a parameter */
+ if(type == MS_LAYER_ANNOTATION) {
msSetError(MS_IDENTERR, "Annotation Layers have been removed. To obtain same functionality, use a layer with label->styles and no class->styles", "loadLayer()");
return -1;
}
+ layer->type = type;
break;
case(UNITS):
if((layer->units = getSymbol(9, MS_INCHES,MS_FEET,MS_MILES,MS_METERS,MS_KILOMETERS,MS_NAUTICALMILES,MS_DD,MS_PIXELS,MS_PERCENTAGES)) == -1) return(-1);
View
@@ -68,7 +68,7 @@ static inline GEOSContextHandle_t msGetGeosContextHandle()
#include "mapthread.h"
typedef struct geos_thread_info {
struct geos_thread_info *next;
- int thread_id;
+ void* thread_id;
GEOSContextHandle_t geos_handle;
} geos_thread_info_t;
@@ -78,7 +78,7 @@ static GEOSContextHandle_t msGetGeosContextHandle()
{
geos_thread_info_t *link;
GEOSContextHandle_t ret_obj;
- int thread_id;
+ void* thread_id;
msAcquireLock( TLOCK_GEOS );
View
10 mapio.c
@@ -53,7 +53,7 @@ typedef struct msIOContextGroup_t {
msIOContext stdout_context;
msIOContext stderr_context;
- int thread_id;
+ void* thread_id;
struct msIOContextGroup_t *next;
} msIOContextGroup;
@@ -95,7 +95,7 @@ void msIO_Cleanup()
static msIOContextGroup *msIO_GetContextGroup()
{
- int nThreadId = msGetThreadId();
+ void* nThreadId = msGetThreadId();
msIOContextGroup *prev = NULL, *group = io_context_list;
if( group != NULL && group->thread_id == nThreadId )
@@ -149,7 +149,7 @@ static msIOContextGroup *msIO_GetContextGroup()
/* returns MS_TRUE if the msIO standard output hasn't been redirected */
int msIO_isStdContext() {
msIOContextGroup *group = io_context_list;
- int nThreadId = msGetThreadId();
+ void* nThreadId = msGetThreadId();
if(!group || group->thread_id != nThreadId) {
group = msIO_GetContextGroup();
if(!group) {
@@ -170,7 +170,7 @@ int msIO_isStdContext() {
msIOContext *msIO_getHandler( FILE * fp )
{
- int nThreadId = msGetThreadId();
+ void* nThreadId = msGetThreadId();
msIOContextGroup *group = io_context_list;
msIO_Initialize();
@@ -536,8 +536,6 @@ static int msIO_stdioWrite( void *cbData, void *data, int byteCount )
static void msIO_Initialize( void )
{
- const char* pszStripHTTPHeader;
-
if( is_msIO_initialized == MS_TRUE )
return;
View
@@ -770,7 +770,8 @@ int KmlRenderer::createIconImage(char *fileName, symbolObj *symbol, symbolStyleO
p.z = 0.0;
#endif
- msDrawMarkerSymbol(map,tmpImg, &p, symstyle->style, 1);
+ if(msDrawMarkerSymbol(map,tmpImg, &p, symstyle->style, 1) != MS_SUCCESS)
+ return MS_FAILURE;
return msSaveImage(map, tmpImg, fileName);
}
Oops, something went wrong.

0 comments on commit 960a9b1

Please sign in to comment.