Permalink
Browse files

Fix use of printf-like functions to avoid warnings; 2 actual error fo…

…unds
1 parent 77f9b81 commit 4d83a011d488ef1ece30658ade13914e8f5621cb @rouault rouault committed Jul 6, 2013
Showing with 873 additions and 934 deletions.
  1. +1 −1 cgiutil.c
  2. +1 −1 mapagg.cpp
  3. +3 −3 mapchart.c
  4. +1 −1 mapdebug.c
  5. +1 −1 mapdraw.c
  6. +2 −2 mapdrawgdal.c
  7. +4 −4 mapgd.c
  8. +1 −1 mapgdal.c
  9. +5 −5 mapgeomutil.cpp
  10. +4 −4 mapgml.c
  11. +1 −1 maphttp.c
  12. +1 −1 mapimagemap.c
  13. +1 −3 mapkmlrenderer.cpp
  14. +343 −343 maplexer.c
  15. +1 −1 maplexer.l
  16. +5 −5 mapogr.cpp
  17. +2 −2 mapogroutput.c
  18. +436 −485 mapparser.c
  19. +9 −7 mapparser.h
  20. +1 −1 mapparser.y
  21. +4 −4 mappostgis.c
  22. +1 −1 mappostgresql.c
  23. +7 −7 mapquery.c
  24. +1 −1 maprasterquery.c
  25. +3 −15 mapresample.c
  26. +2 −2 mapserver.h
  27. +5 −5 mapservutil.c
  28. +3 −3 mapshape.c
  29. +7 −7 maptemplate.c
  30. +1 −1 maputil.c
  31. +6 −6 mapuvraster.c
  32. +1 −1 mapwcs.c
  33. +4 −4 mapwcs20.c
  34. +2 −2 mapwfs.c
  35. +2 −2 mapwms.c
  36. +1 −1 mapxbase.c
View
@@ -64,7 +64,7 @@ int readPostBody( cgiRequestObj *request, char **data )
if( *data == NULL ) {
msIO_setHeader("Content-Type","text/html");
msIO_sendHeaders();
- msIO_printf("malloc() failed, Content-Length: %u unreasonably large?\n", data_max );
+ msIO_printf("malloc() failed, Content-Length: %u unreasonably large?\n", (unsigned int)data_max );
return MS_FAILURE;
}
View
@@ -826,7 +826,7 @@ imageObj *agg2CreateImage(int width, int height, outputFormatObj *format, colorO
r->buffer = (band_type*)malloc(width * height * 4 * sizeof(band_type));
if (r->buffer == NULL) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "agg2CreateImage()",
- __FILE__, __LINE__, width * height * 4 * sizeof(band_type));
+ __FILE__, __LINE__, (unsigned int)(width * height * 4 * sizeof(band_type)));
free(image);
return NULL;
}
View
@@ -368,7 +368,7 @@ int msDrawPieChartLayer(mapObj *map, layerObj *layer, imageObj *image)
styles = (styleObj**)malloc((numvalues)*sizeof(styleObj*));
if (styles == NULL) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msDrawPieChartLayer()",
- __FILE__, __LINE__, numvalues*sizeof(styleObj*));
+ __FILE__, __LINE__, (unsigned int)(numvalues*sizeof(styleObj*)));
free(values);
return MS_FAILURE;
}
@@ -450,7 +450,7 @@ int msDrawVBarChartLayer(mapObj *map, layerObj *layer, imageObj *image)
styles = (styleObj**)malloc(numvalues*sizeof(styleObj*));
if (styles == NULL) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msDrawVBarChartLayer()",
- __FILE__, __LINE__, numvalues*sizeof(styleObj*));
+ __FILE__, __LINE__, (unsigned int)(numvalues*sizeof(styleObj*)));
free(values);
return MS_FAILURE;
}
@@ -540,7 +540,7 @@ int msDrawBarChartLayer(mapObj *map, layerObj *layer, imageObj *image)
styles = (styleObj**)malloc(numvalues*sizeof(styleObj*));
if (styles == NULL) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msDrawBarChartLayer()",
- __FILE__, __LINE__, numvalues*sizeof(styleObj*));
+ __FILE__, __LINE__, (unsigned int)(numvalues*sizeof(styleObj*)));
free(values);
return MS_FAILURE;
}
View
@@ -99,7 +99,7 @@ debugInfoObj *msGetDebugInfoObj()
new_link->errorfile = NULL;
new_link->fp = NULL;
} else
- msSetError(MS_MEMERR, "Out of memory allocating %u bytes.\n", "msGetDebugInfoObj()", sizeof(debugInfoObj));
+ msSetError(MS_MEMERR, "Out of memory allocating %u bytes.\n", "msGetDebugInfoObj()", (unsigned int)sizeof(debugInfoObj));
debuginfo_list = new_link;
}
View
@@ -983,7 +983,7 @@ int msDrawVectorLayer(mapObj *map, layerObj *layer, imageObj *image)
/* Check if the shape size is ok to be drawn */
if((shape.type == MS_SHAPE_LINE || shape.type == MS_SHAPE_POLYGON) && (minfeaturesize > 0) && (msShapeCheckSize(&shape, minfeaturesize) == MS_FALSE)) {
if(layer->debug >= MS_DEBUGLEVEL_V)
- msDebug("msDrawVectorLayer(): Skipping shape (%d) because LAYER::MINFEATURESIZE is bigger than shape size\n", shape.index);
+ msDebug("msDrawVectorLayer(): Skipping shape (%ld) because LAYER::MINFEATURESIZE is bigger than shape size\n", shape.index);
msFreeShape(&shape);
continue;
}
View
@@ -1284,7 +1284,7 @@ static int ApplyLUT( int iColorIndex, layerObj *layer,
msSetError(MS_IOERR,
"LUT definition from file %s longer than maximum buffer size (%d bytes).",
"drawGDAL()",
- path, sizeof(lut_def_fromfile) );
+ path, (int)sizeof(lut_def_fromfile) );
return -1;
}
@@ -1932,7 +1932,7 @@ msDrawRasterLayerGDAL_RawMode(
f_nodatas = (float *) calloc(sizeof(float),band_count);
if (f_nodatas == NULL) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msDrawRasterLayerGDAL_RawMode()",
- __FILE__, __LINE__, sizeof(float)*band_count);
+ __FILE__, __LINE__, (unsigned int)(sizeof(float)*band_count));
free( band_list );
return -1;
}
View
@@ -469,7 +469,7 @@ int renderGlyphsGD(imageObj *img, double x, double y, labelStyleObj *style, char
if(style->outlinewidth > 0) { /* handle the outline color */
error = gdImageStringFT(ip, bbox, oc, style->fonts[0], style->size, style->rotation, x, y-1, text);
if(error) {
- msSetError(MS_TTFERR, error, "msDrawTextGD()");
+ msSetError(MS_TTFERR, "%s", "msDrawTextGD()", error);
return(MS_FAILURE);
}
@@ -732,7 +732,7 @@ int renderTruetypeSymbolGD(imageObj *img, double x, double y, symbolObj *symbol,
if( s->outlinecolor ) {
error = gdImageStringFT(ip, bbox, oc, symbol->full_font_path, s->scale, s->rotation, x, y-1, symbol->character);
if(error) {
- msSetError(MS_TTFERR, error, "renderTruetypeSymbolGD()");
+ msSetError(MS_TTFERR, "%s", "renderTruetypeSymbolGD()", error);
return MS_FAILURE;
}
@@ -923,7 +923,7 @@ int getTruetypeTextBBoxGD(rendererVTableObj *renderer, char **fonts, int numfont
strex.flags = gdFTEX_XSHOW;
error = gdImageStringFTEx(NULL, bbox, 0, fonts[0], size, 0, 0, 0, string, &strex);
if(error) {
- msSetError(MS_TTFERR, error, "gdImageStringFTEx()");
+ msSetError(MS_TTFERR, "%s", "gdImageStringFTEx()", error);
return(MS_FAILURE);
}
@@ -950,7 +950,7 @@ int getTruetypeTextBBoxGD(rendererVTableObj *renderer, char **fonts, int numfont
} else {
error = gdImageStringFT(NULL, bbox, 0, fonts[0], size, 0, 0, 0, string);
if(error) {
- msSetError(MS_TTFERR, error, "msGetTruetypeTextBBoxGD()");
+ msSetError(MS_TTFERR, "%s", "msGetTruetypeTextBBoxGD()", error);
return(MS_FAILURE);
}
View
@@ -468,7 +468,7 @@ int msSaveImageGDAL( mapObj *map, imageObj *image, char *filename )
if (papszOptions == NULL) {
msReleaseLock( TLOCK_GDAL );
msSetError( MS_MEMERR, "Out of memory allocating %u bytes.\n", "msSaveImageGDAL()",
- sizeof(char *)*(format->numformatoptions+1));
+ (unsigned int)(sizeof(char *)*(format->numformatoptions+1)));
return MS_FAILURE;
}
View
@@ -47,7 +47,7 @@ shapeObj *msRasterizeArc(double x0, double y0, double radius, double startAngle,
lineObj *line = (lineObj*)calloc(1,sizeof(lineObj));
if (!line) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msRasterizeArc()" ,
- __FILE__, __LINE__, sizeof(lineObj));
+ __FILE__, __LINE__, (unsigned int)sizeof(lineObj));
free(shape);
return NULL;
}
@@ -56,7 +56,7 @@ shapeObj *msRasterizeArc(double x0, double y0, double radius, double startAngle,
line->point = (pointObj*)calloc(allocated_size,sizeof(pointObj));
if (!line->point) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msRasterizeArc()" ,
- __FILE__, __LINE__, allocated_size*sizeof(pointObj));
+ __FILE__, __LINE__, (unsigned int)(allocated_size*sizeof(pointObj)));
free(line);
free(shape);
return NULL;
@@ -78,7 +78,7 @@ shapeObj *msRasterizeArc(double x0, double y0, double radius, double startAngle,
line->point = (pointObj*)realloc(line->point, allocated_size * sizeof(pointObj));
if (!line->point) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msRasterizeArc()" ,
- __FILE__, __LINE__, allocated_size * sizeof(pointObj));
+ __FILE__, __LINE__, (unsigned int)(allocated_size * sizeof(pointObj)));
free(line);
free(shape);
return NULL;
@@ -98,7 +98,7 @@ shapeObj *msRasterizeArc(double x0, double y0, double radius, double startAngle,
line->point = (pointObj*)realloc(line->point, allocated_size * sizeof(pointObj));
if (!line->point) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msRasterizeArc()" ,
- __FILE__, __LINE__, allocated_size * sizeof(pointObj));
+ __FILE__, __LINE__, (unsigned int)(allocated_size * sizeof(pointObj)));
free(line);
free(shape);
return NULL;
@@ -116,7 +116,7 @@ shapeObj *msRasterizeArc(double x0, double y0, double radius, double startAngle,
line->point = (pointObj*)realloc(line->point, allocated_size * sizeof(pointObj));
if (!line->point) {
msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n", "msRasterizeArc()" ,
- __FILE__, __LINE__, allocated_size * sizeof(pointObj));
+ __FILE__, __LINE__, (unsigned int)(allocated_size * sizeof(pointObj)));
free(line);
free(shape);
return NULL;
View
@@ -737,7 +737,7 @@ gmlGeometryListObj *msGMLGetGeometries(layerObj *layer, const char *metadata_nam
geometryList->geometries = (gmlGeometryObj *) malloc(sizeof(gmlGeometryObj)*geometryList->numgeometries);
if (geometryList->geometries == NULL) {
msSetError(MS_MEMERR, "Out of memory allocating %u bytes.\n", "msGMLGetGeometries()",
- sizeof(gmlGeometryObj)*geometryList->numgeometries);
+ (unsigned int)(sizeof(gmlGeometryObj)*geometryList->numgeometries));
free(geometryList);
return NULL;
}
@@ -864,7 +864,7 @@ gmlNamespaceListObj *msGMLGetNamespaces(webObj *web, const char *metadata_namesp
namespaceList->namespaces = (gmlNamespaceObj *) malloc(sizeof(gmlNamespaceObj)*namespaceList->numnamespaces);
if (namespaceList->namespaces == NULL) {
msSetError(MS_MEMERR, "Out of memory allocating %u bytes.\n", "msGMLGetNamespaces()",
- sizeof(gmlNamespaceObj)*namespaceList->numnamespaces);
+ (unsigned int)(sizeof(gmlNamespaceObj)*namespaceList->numnamespaces));
free(namespaceList);
return NULL;
}
@@ -933,7 +933,7 @@ gmlConstantListObj *msGMLGetConstants(layerObj *layer, const char *metadata_name
constantList->constants = (gmlConstantObj *) malloc(sizeof(gmlConstantObj)*constantList->numconstants);
if (constantList->constants == NULL) {
msSetError(MS_MEMERR, "Out of memory allocating %u bytes.\n", "msGMLGetConstants()",
- sizeof(gmlConstantObj)*constantList->numconstants);
+ (unsigned int)(sizeof(gmlConstantObj)*constantList->numconstants));
free(constantList);
return NULL;
}
@@ -1024,7 +1024,7 @@ gmlGroupListObj *msGMLGetGroups(layerObj *layer, const char *metadata_namespaces
groupList->groups = (gmlGroupObj *) malloc(sizeof(gmlGroupObj)*groupList->numgroups);
if (groupList->groups == NULL) {
msSetError(MS_MEMERR, "Out of memory allocating %u bytes.\n", "msGMLGetGroups()",
- sizeof(gmlGroupObj)*groupList->numgroups);
+ (unsigned int)(sizeof(gmlGroupObj)*groupList->numgroups));
free(groupList);
return NULL;
}
View
@@ -220,7 +220,7 @@ static size_t msHTTPWriteFct(void *buffer, size_t size, size_t nmemb,
if (psReq->debug) {
msDebug("msHTTPWriteFct(id=%d, %d bytes)\n",
- psReq->nLayerId, size*nmemb);
+ psReq->nLayerId, (int)(size*nmemb));
}
/* Case where we are writing to a disk file. */
View
@@ -698,7 +698,7 @@ int msSaveImageIM(imageObj* img, char *filename, outputFormatObj *format )
}
if (iIndice < size) {
sprintf(workbuffer, "%s", img->img.imagemap+iIndice );
- msIO_fprintf(stream, workbuffer);
+ msIO_fprintf(stream, "%s", workbuffer);
}
} else
msIO_fwrite(img->img.imagemap, size, 1, stream);
View
@@ -984,9 +984,7 @@ char* KmlRenderer::lookupSymbolUrl(imageObj *img, symbolObj *symbol, symbolStyle
}
if (createIconImage(iconFileName, symbol, symstyle) != MS_SUCCESS) {
- char errMsg[512];
- sprintf(errMsg, "Error creating icon file '%s'", iconFileName);
- msSetError(MS_IOERR, errMsg, "KmlRenderer::lookupSymbolStyle()" );
+ msSetError(MS_IOERR, "Error creating icon file '%s'", "KmlRenderer::lookupSymbolStyle()", iconFileName);
return NULL;
}
Oops, something went wrong.

0 comments on commit 4d83a01

Please sign in to comment.