Permalink
Browse files

fix various compiler warnings

  • Loading branch information...
1 parent 02e56f7 commit 204b68b4e37cf2a327c48a14a0f9c6b73e3b517b @tbonfort tbonfort committed Jul 30, 2012
Showing with 147 additions and 313 deletions.
  1. +3 −3 mapdraw.c
  2. +11 −6 mapdrawgdal.c
  3. +11 −11 mapgml.c
  4. +2 −3 mapimageio.c
  5. +8 −6 maplabel.c
  6. +3 −7 mapogcfilter.c
  7. +2 −162 mapogcsld.c
  8. +27 −28 mapogcsos.c
  9. +5 −4 mapogr.cpp
  10. +1 −2 mapowscommon.c
  11. +2 −1 mapproject.c
  12. +20 −25 mapresample.c
  13. +3 −4 mapservutil.c
  14. +0 −1 mapshape.c
  15. +7 −8 maptemplate.c
  16. +4 −5 maptile.c
  17. +2 −0 maputil.c
  18. +1 −1 mapuvraster.c
  19. +6 −8 mapwcs11.c
  20. +8 −12 mapwcs20.c
  21. +3 −3 mapwfs.c
  22. +2 −3 mapwfs11.c
  23. +2 −2 mapwmslayer.c
  24. +1 −2 mapxbase.c
  25. +6 −3 shptreetst.c
  26. +7 −3 shptreevis.c
View
@@ -2822,7 +2822,7 @@ int msDrawLabelCache(imageObj *image, mapObj *map)
msDrawTextLine(image, labelPtr->annotext, labelPtr, cachePtr->labelpath, &(map->fontset), layerPtr->scalefactor); /* Draw the curved label */
} else { /* point-based label */
-
+ scalefactor = layerPtr->scalefactor; /* FIXME avoid compiler warning, see also #4408 */
marker_offset_x = marker_offset_y = 0; /* assume no marker */
/* compute label bbox of a marker used in an annotation layer and/or
@@ -3123,8 +3123,8 @@ int msDrawLabelCache(imageObj *image, mapObj *map)
for(i=0; i<labelPtr->numstyles; i++) {
if(labelPtr->styles[i]->_geomtransform.type == MS_GEOMTRANSFORM_LABELPOINT)
msDrawMarkerSymbol(&map->symbolset, image, &(cachePtr->point), labelPtr->styles[i], layerPtr->scalefactor);
- else if(labelPtr->styles[i]->_geomtransform.type == MS_GEOMTRANSFORM_LABELPOLY) {
- msDrawShadeSymbol(&map->symbolset, image, labelPtr->annopoly, labelPtr->styles[i], scalefactor);
+ else if(labelPtr->styles[i]->_geomtransform.type == MS_GEOMTRANSFORM_LABELPOLY && labelPtr->annotext) {
+ msDrawShadeSymbol(&map->symbolset, image, labelPtr->annopoly, labelPtr->styles[i], scalefactor); /* FIXME: scalefactor here should be adjusted by the label minsize/maxsize adjustments of each label, not only the last one. see #4408 */
} else {
msSetError(MS_MISCERR,"Labels only support LABELPNT and LABELPOLY GEOMTRANSFORMS", "msDrawLabelCAche()");
return MS_FAILURE;
View
@@ -109,7 +109,10 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
{
int i,j, k; /* loop counters */
- int cmap[MAXCOLORS], cmap_set = FALSE;
+ int cmap[MAXCOLORS];
+#ifndef NDEBUG
+ int cmap_set = FALSE;
+#endif
unsigned char rb_cmap[4][MAXCOLORS];
double adfGeoTransform[6], adfInvGeoTransform[6];
int dst_xoff, dst_yoff, dst_xsize, dst_ysize;
@@ -556,7 +559,9 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
if( classified ) {
int c, color_count;
+#ifndef NDEBUG
cmap_set = TRUE;
+#endif
if( hColorMap == NULL ) {
msSetError(MS_IOERR,
@@ -638,7 +643,9 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
#ifdef USE_GD
} else if( hColorMap != NULL && rb->type == MS_BUFFER_GD ) {
int color_count;
+#ifndef NDEBUG
cmap_set = TRUE;
+#endif
color_count = MIN(256,GDALGetColorEntryCount(hColorMap));
@@ -660,7 +667,9 @@ int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
#endif
} else if( hBand2 == NULL && hColorMap != NULL && rb->type == MS_BUFFER_BYTE_RGBA ) {
int color_count;
+#ifndef NDEBUG
cmap_set = TRUE;
+#endif
color_count = MIN(256,GDALGetColorEntryCount(hColorMap));
@@ -2064,7 +2073,6 @@ msDrawRasterLayerGDAL_16BitClassification(
float fDataMin=0.0, fDataMax=255.0, fNoDataValue;
const char *pszScaleInfo;
const char *pszBuckets;
- int bUseIntegers = FALSE;
int *cmap, c, j, k, bGotNoData = FALSE, bGotFirstValue;
unsigned char *rb_cmap[4];
CPLErr eErr;
@@ -2162,7 +2170,6 @@ msDrawRasterLayerGDAL_16BitClassification(
if( pszBuckets == NULL ) {
nBucketCount = (int) floor(fDataMax - fDataMin + 1.1);
- bUseIntegers = TRUE;
}
}
@@ -2264,8 +2271,6 @@ msDrawRasterLayerGDAL_16BitClassification(
k = 0;
for( i = dst_yoff; i < dst_yoff + dst_ysize; i++ ) {
- int result;
-
for( j = dst_xoff; j < dst_xoff + dst_xsize; j++ ) {
float fRawValue = pafRawData[k++];
int iMapIndex;
@@ -2288,7 +2293,7 @@ msDrawRasterLayerGDAL_16BitClassification(
}
#ifdef USE_GD
if( rb->type == MS_BUFFER_GD ) {
- result = cmap[iMapIndex];
+ int result = cmap[iMapIndex];
if( result == -1 )
continue;
View
@@ -1563,7 +1563,7 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, int startindex, int maxfeature
xmlNodePtr msGML3BoundedBy(xmlNsPtr psNs, double minx, double miny, double maxx, double maxy, const char *psEpsg)
{
- xmlNodePtr psNode = NULL, psSubNode = NULL, psSubSubNode = NULL;
+ xmlNodePtr psNode = NULL, psSubNode = NULL;
char *pszTmp = NULL;
char *pszTmp2 = NULL;
char *pszEpsg = NULL;
@@ -1591,15 +1591,15 @@ xmlNodePtr msGML3BoundedBy(xmlNsPtr psNs, double minx, double miny, double maxx,
pszTmp = msStringConcatenate(pszTmp, " ");
pszTmp2 = msDoubleToString(miny, MS_TRUE);
pszTmp = msStringConcatenate(pszTmp, pszTmp2);
- psSubSubNode = xmlNewChild(psSubNode, NULL, BAD_CAST "lowerCorner", BAD_CAST pszTmp);
+ xmlNewChild(psSubNode, NULL, BAD_CAST "lowerCorner", BAD_CAST pszTmp);
free(pszTmp);
free(pszTmp2);
pszTmp = msDoubleToString(maxx, MS_TRUE);
pszTmp = msStringConcatenate(pszTmp, " ");
pszTmp2 = msDoubleToString(maxy,MS_TRUE);
pszTmp = msStringConcatenate(pszTmp, pszTmp2);
- psSubSubNode = xmlNewChild(psSubNode, NULL, BAD_CAST "upperCorner", BAD_CAST pszTmp);
+ xmlNewChild(psSubNode, NULL, BAD_CAST "upperCorner", BAD_CAST pszTmp);
free(pszTmp);
free(pszTmp2);
return psNode;
@@ -1623,7 +1623,7 @@ xmlNodePtr msGML3BoundedBy(xmlNsPtr psNs, double minx, double miny, double maxx,
xmlNodePtr msGML3Point(xmlNsPtr psNs, const char *psSrsName, const char *id, double x, double y)
{
- xmlNodePtr psNode = NULL, psSubNode = NULL;
+ xmlNodePtr psNode = NULL;
char *pszTmp = NULL;
int dimension = 2;
char *pszSrsName = NULL;
@@ -1655,7 +1655,7 @@ xmlNodePtr msGML3Point(xmlNsPtr psNs, const char *psSrsName, const char *id, dou
pszTmp = msStringConcatenate(pszTmp, " ");
pszTmp2 = msDoubleToString(y, MS_TRUE);
pszTmp = msStringConcatenate(pszTmp, pszTmp2);
- psSubNode = xmlNewChild(psNode, NULL, BAD_CAST "pos", BAD_CAST pszTmp);
+ xmlNewChild(psNode, NULL, BAD_CAST "pos", BAD_CAST pszTmp);
free(pszTmp);
free(pszTmp2);
@@ -1677,14 +1677,14 @@ xmlNodePtr msGML3Point(xmlNsPtr psNs, const char *psSrsName, const char *id, dou
xmlNodePtr msGML3TimePeriod(xmlNsPtr psNs, char *pszStart, char *pszEnd)
{
- xmlNodePtr psNode=NULL,psSubNode=NULL;
+ xmlNodePtr psNode=NULL;
psNode = xmlNewNode(psNs, BAD_CAST "TimePeriod");
- psSubNode = xmlNewChild(psNode, NULL, BAD_CAST "beginPosition", BAD_CAST pszStart);
+ xmlNewChild(psNode, NULL, BAD_CAST "beginPosition", BAD_CAST pszStart);
if (pszEnd)
- psSubNode = xmlNewChild(psNode, NULL, BAD_CAST "endPosition", BAD_CAST pszEnd);
+ xmlNewChild(psNode, NULL, BAD_CAST "endPosition", BAD_CAST pszEnd);
else {
- psSubNode = xmlNewChild(psNode, NULL, BAD_CAST "endPosition", NULL);
+ xmlNewChild(psNode, NULL, BAD_CAST "endPosition", NULL);
xmlNewProp(psNode, BAD_CAST "indeterminatePosition", BAD_CAST "now");
}
return psNode;
@@ -1704,10 +1704,10 @@ xmlNodePtr msGML3TimePeriod(xmlNsPtr psNs, char *pszStart, char *pszEnd)
xmlNodePtr msGML3TimeInstant(xmlNsPtr psNs, char *pszTime)
{
- xmlNodePtr psNode=NULL,psSubNode=NULL;
+ xmlNodePtr psNode=NULL;
psNode = xmlNewNode(psNs, BAD_CAST "TimeInstant");
- psSubNode = xmlNewChild(psNode, NULL, BAD_CAST "timePosition", BAD_CAST pszTime);
+ xmlNewChild(psNode, NULL, BAD_CAST "timePosition", BAD_CAST pszTime);
return psNode;
}
View
@@ -728,7 +728,7 @@ int msLoadGDRasterBufferFromFile(char *path, rasterBufferObj *rb)
int readPNG(char *path, rasterBufferObj *rb)
{
- png_uint_32 width,height,row_bytes;
+ png_uint_32 width,height;
unsigned char *a,*r,*g,*b;
int bit_depth,color_type,i;
unsigned char **row_pointers;
@@ -800,8 +800,7 @@ int readPNG(char *path, rasterBufferObj *rb)
png_set_add_alpha(png_ptr, 0xff, PNG_FILLER_AFTER);
png_read_update_info(png_ptr, info_ptr);
- row_bytes = png_get_rowbytes(png_ptr, info_ptr);
- assert(row_bytes == rb->data.rgba.row_step);
+ assert(png_get_rowbytes(png_ptr, info_ptr) == rb->data.rgba.row_step);
png_read_image(png_ptr, row_pointers);
free(row_pointers);
View
@@ -338,6 +338,7 @@ int msAddLabelGroup(mapObj *map, int layerindex, int classindex, shapeObj *shape
if(layerPtr->mask) {
int maskLayerIdx = msGetLayerIndex(map,layerPtr->mask);
layerObj *maskLayer = GET_LAYER(map,maskLayerIdx);
+ unsigned char *alphapixptr;
if(maskLayer->maskimage && MS_IMAGE_RENDERER(maskLayer->maskimage)->supports_pixel_buffer) {
rasterBufferObj rb;
int x,y;
@@ -347,7 +348,7 @@ int msAddLabelGroup(mapObj *map, int layerindex, int classindex, shapeObj *shape
y = MS_NINT(point->y);
#ifdef USE_GD
if(rb.type == MS_BUFFER_BYTE_RGBA) {
- unsigned char *alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
+ alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
if(!*alphapixptr) {
/* label point does not intersect mask */
return MS_SUCCESS;
@@ -358,7 +359,7 @@ int msAddLabelGroup(mapObj *map, int layerindex, int classindex, shapeObj *shape
}
#else
assert(rb.type == MS_BUFFER_BYTE_RGBA);
- unsigned char *alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
+ alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
if(!*alphapixptr) {
/* label point does not intersect mask */
return MS_SUCCESS;
@@ -529,6 +530,7 @@ int msAddLabel(mapObj *map, labelObj *label, int layerindex, int classindex, sha
if (layerPtr->mask) {
int maskLayerIdx = msGetLayerIndex(map, layerPtr->mask);
layerObj *maskLayer = GET_LAYER(map, maskLayerIdx);
+ unsigned char *alphapixptr;
if (maskLayer->maskimage && MS_IMAGE_RENDERER(maskLayer->maskimage)->supports_pixel_buffer) {
rasterBufferObj rb;
memset(&rb, 0, sizeof (rasterBufferObj));
@@ -538,7 +540,7 @@ int msAddLabel(mapObj *map, labelObj *label, int layerindex, int classindex, sha
int y = MS_NINT(point->y);
#ifdef USE_GD
if(rb.type == MS_BUFFER_BYTE_RGBA) {
- unsigned char *alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
+ alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
if(!*alphapixptr) {
/* label point does not intersect mask */
return MS_SUCCESS;
@@ -549,7 +551,7 @@ int msAddLabel(mapObj *map, labelObj *label, int layerindex, int classindex, sha
}
#else
assert(rb.type == MS_BUFFER_BYTE_RGBA);
- unsigned char *alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
+ alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
if(!*alphapixptr) {
/* label point does not intersect mask */
return MS_SUCCESS;
@@ -562,7 +564,7 @@ int msAddLabel(mapObj *map, labelObj *label, int layerindex, int classindex, sha
int y = MS_NINT(labelpath->path.point[i].y);
#ifdef USE_GD
if (rb.type == MS_BUFFER_BYTE_RGBA) {
- unsigned char *alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x;
+ alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x;
if (!*alphapixptr) {
/* label point does not intersect mask */
return MS_SUCCESS;
@@ -573,7 +575,7 @@ int msAddLabel(mapObj *map, labelObj *label, int layerindex, int classindex, sha
}
#else
assert(rb.type == MS_BUFFER_BYTE_RGBA);
- unsigned char *alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x;
+ alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x;
if (!*alphapixptr) {
/* label point does not intersect mask */
return MS_SUCCESS;
View
@@ -147,8 +147,7 @@ char *FLTGetExpressionForValuesRanges(layerObj *lp, char *item, char *value, in
char *pszExpression = NULL, *pszEscapedStr=NULL, *pszTmpExpression=NULL;
char **paszElements = NULL, **papszRangeElements=NULL;
int numelements,i,nrangeelements;
- double minval, maxval;
-
+ /* double minval, maxval; */
if (lp && item && value) {
if (lp->connectiontype == MS_POSTGIS || lp->connectiontype == MS_ORACLESPATIAL ||
lp->connectiontype == MS_SDE || lp->connectiontype == MS_PLUGIN)
@@ -221,8 +220,10 @@ char *FLTGetExpressionForValuesRanges(layerObj *lp, char *item, char *value, in
if (papszRangeElements && nrangeelements > 0) {
pszTmpExpression = msStringConcatenate(pszTmpExpression, "(");
if (nrangeelements == 2 || nrangeelements == 3) {
+ /*
minval = atof(papszRangeElements[0]);
maxval = atof(papszRangeElements[1]);
+ */
if (bSqlLayer)
pszTmpExpression = msStringConcatenate(pszTmpExpression, item);
else {
@@ -2102,7 +2103,6 @@ char *FLTGetMapserverExpression(FilterEncodingNode *psFilterNode, layerObj *lp)
char *FLTGetSQLExpression(FilterEncodingNode *psFilterNode, layerObj *lp)
{
char *pszExpression = NULL;
- int connectiontype;
const char *pszAttribute = NULL;
char szTmp[256];
char **tokens = NULL;
@@ -2111,7 +2111,6 @@ char *FLTGetSQLExpression(FilterEncodingNode *psFilterNode, layerObj *lp)
if (psFilterNode == NULL || lp == NULL)
return NULL;
- connectiontype = lp->connectiontype;
if (psFilterNode->eType == FILTER_NODE_TYPE_COMPARISON) {
if ( psFilterNode->psLeftNode && psFilterNode->psRightNode) {
if (FLTIsBinaryComparisonFilterType(psFilterNode->pszValue)) {
@@ -2232,13 +2231,10 @@ char *FLTGetLogicalComparisonSQLExpresssion(FilterEncodingNode *psFilterNode,
char *pszBuffer = NULL;
char *pszTmp = NULL;
int nTmp = 0;
- int connectiontype;
if (lp == NULL)
return NULL;
- connectiontype = lp->connectiontype;
-
/* ==================================================================== */
/* special case for BBOX node. */
/* ==================================================================== */
Oops, something went wrong.

0 comments on commit 204b68b

Please sign in to comment.