Skip to content

Commit

Permalink
fix compiler warnings (MapServer#5122)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort committed Jul 22, 2015
1 parent cb8e7c3 commit 960a9b1
Show file tree
Hide file tree
Showing 44 changed files with 635 additions and 630 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions fontcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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 )
Expand Down
3 changes: 2 additions & 1 deletion mapcairo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mapcluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion mapcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ int msLoadMapContextGeneral(mapObj *map, CPLXMLNode *psGeneral,

char *pszProj=NULL;
char *pszValue, *pszValue1, *pszValue2;
int nTmp;

/* Projection */
pszValue = (char*)CPLGetXMLValue(psGeneral,
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions mapdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -285,7 +285,7 @@ void msDebugCleanup()

#ifdef USE_THREAD
{
int thread_id = msGetThreadId();
void* thread_id = msGetThreadId();
debugInfoObj *link;

msAcquireLock( TLOCK_DEBUGOBJ );
Expand Down
16 changes: 7 additions & 9 deletions maperror.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;

Expand All @@ -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 );
Expand Down Expand Up @@ -240,7 +240,7 @@ void msResetErrorList()
/* -------------------------------------------------------------------- */
#ifdef USE_THREAD
{
int thread_id = msGetThreadId();
void* thread_id = msGetThreadId();
te_info_t *link;

msAcquireLock( TLOCK_ERROROBJ );
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down
4 changes: 3 additions & 1 deletion maperror.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#ifndef MAPERROR_H
#define MAPERROR_H

#include "mapthread.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -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;

Expand Down
17 changes: 11 additions & 6 deletions mapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ void freeJoin(joinObj *join)

int loadJoin(joinObj *join)
{
int nTmp;
initJoin(join);

for(;;) {
Expand All @@ -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()");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions mapgeos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 );

Expand Down
10 changes: 4 additions & 6 deletions mapio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion mapkmlrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading

0 comments on commit 960a9b1

Please sign in to comment.