[mapserver-commits] r12715 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Thu Oct 27 11:10:24 EDT 2011


Author: tbonfort
Date: 2011-10-27 08:10:24 -0700 (Thu, 27 Oct 2011)
New Revision: 12715

Modified:
   trunk/mapserver/mapcache/src/cache_tiff.c
   trunk/mapserver/mapcache/src/core.c
   trunk/mapserver/mapcache/src/imageio_png.c
   trunk/mapserver/mapcache/src/service_wmts.c
   trunk/mapserver/mapcache/src/tileset.c
Log:
remove some harmless compiler warnings


Modified: trunk/mapserver/mapcache/src/cache_tiff.c
===================================================================
--- trunk/mapserver/mapcache/src/cache_tiff.c	2011-10-27 13:09:11 UTC (rev 12714)
+++ trunk/mapserver/mapcache/src/cache_tiff.c	2011-10-27 15:10:24 UTC (rev 12715)
@@ -506,7 +506,7 @@
 
    /* find the location of the last '/' in the string */
    char *hackptr1,*hackptr2;
-   hackptr1 = filename;
+   hackptr2 = hackptr1 = filename;
    while(*hackptr1) {
       if(*hackptr1 == '/')
          hackptr2 = hackptr1;

Modified: trunk/mapserver/mapcache/src/core.c
===================================================================
--- trunk/mapserver/mapcache/src/core.c	2011-10-27 13:09:11 UTC (rev 12714)
+++ trunk/mapserver/mapcache/src/core.c	2011-10-27 15:10:24 UTC (rev 12715)
@@ -52,7 +52,7 @@
    mapcache_http_response *response = mapcache_http_response_create(ctx->pool);
    int i;
    char *timestr;
-   mapcache_image *base,*overlay;
+   mapcache_image *base=NULL,*overlay;
 
    /* this loop retrieves the tiles from the caches, and eventually decodes and merges them together
     * if multiple tiles were asked for */

Modified: trunk/mapserver/mapcache/src/imageio_png.c
===================================================================
--- trunk/mapserver/mapcache/src/imageio_png.c	2011-10-27 13:09:11 UTC (rev 12714)
+++ trunk/mapserver/mapcache/src/imageio_png.c	2011-10-27 15:10:24 UTC (rev 12715)
@@ -32,7 +32,15 @@
 #include <png.h>
 #include <apr_strings.h>
 
+#ifndef Z_BEST_SPEED
+#define Z_BEST_SPEED 1
+#endif
+#ifndef Z_BEST_COMPRESSION
+#define Z_BEST_COMPRESSION 9
+#endif
 
+
+
 /**\addtogroup imageio_png */
 /** @{ */
 typedef struct _mapcache_buffer_closure _mapcache_buffer_closure;
@@ -1122,7 +1130,6 @@
  */
 mapcache_buffer* _mapcache_imageio_png_q_encode( mapcache_context *ctx, mapcache_image *image,
       mapcache_image_format *format) {
-   int ret;
    mapcache_buffer *buffer = mapcache_buffer_create(3000,ctx->pool);
    mapcache_image_format_png_q *f = (mapcache_image_format_png_q*)format;
    int compression = f->format.compression_level;
@@ -1130,8 +1137,16 @@
    unsigned char *pixels = (unsigned char*)apr_pcalloc(ctx->pool,image->w*image->h*sizeof(unsigned char));
    rgbaPixel palette[256];
    unsigned int maxval;
-   ret = _mapcache_imageio_quantize_image(image,&numPaletteEntries,palette, &maxval, NULL, 0);
-   ret = _mapcache_imageio_classify(image,pixels,palette,numPaletteEntries);
+   
+   if(MAPCACHE_SUCCESS != _mapcache_imageio_quantize_image(image,&numPaletteEntries,palette, &maxval, NULL, 0)) {
+      ctx->set_error(ctx,500,"failed to quantize image buffer");
+      return NULL;
+   }
+   if(MAPCACHE_SUCCESS != _mapcache_imageio_classify(image,pixels,palette,numPaletteEntries)) {
+      ctx->set_error(ctx,500,"failed to quantize image buffer");
+      return NULL;
+   }
+
    png_infop info_ptr;
    rgbPixel rgb[256];
    unsigned char a[256];

Modified: trunk/mapserver/mapcache/src/service_wmts.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wmts.c	2011-10-27 13:09:11 UTC (rev 12714)
+++ trunk/mapserver/mapcache/src/service_wmts.c	2011-10-27 15:10:24 UTC (rev 12715)
@@ -308,7 +308,10 @@
 void _mapcache_service_wmts_parse_request(mapcache_context *ctx, mapcache_service *this, mapcache_request **request,
       const char *pathinfo, apr_table_t *params, mapcache_cfg *config) {
    const char *str, *service = NULL, *style = NULL, *version = NULL, *layer = NULL, *matrixset = NULL,
-               *matrix = NULL, *tilecol = NULL, *tilerow = NULL, *format = NULL, *extension = NULL,
+#ifdef PEDANTIC_WMTS_FORMAT_CHECK
+               *format = NULL,
+#endif
+               *matrix = NULL, *tilecol = NULL, *tilerow = NULL, *extension = NULL,
                *infoformat = NULL, *fi_i = NULL, *fi_j = NULL;
    apr_table_t *dimtable = NULL;
    mapcache_tileset *tileset = NULL;
@@ -341,7 +344,9 @@
          style = apr_table_get(params,"STYLE");
          if(!style || !*style) style = "default";
          tilecol = apr_table_get(params,"TILECOL");
+#ifdef PEDANTIC_WMTS_FORMAT_CHECK
          format = apr_table_get(params,"FORMAT");
+#endif
          layer = apr_table_get(params,"LAYER");
          if(!layer) { /*we have to validate this now in order to be able to extract dimensions*/
             ctx->set_error(ctx, 400, "received wmts request with no layer");

Modified: trunk/mapserver/mapcache/src/tileset.c
===================================================================
--- trunk/mapserver/mapcache/src/tileset.c	2011-10-27 13:09:11 UTC (rev 12714)
+++ trunk/mapserver/mapcache/src/tileset.c	2011-10-27 15:10:24 UTC (rev 12715)
@@ -124,7 +124,7 @@
       return;
    }
    rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, f);
-   if(!finfo.size) {
+   if(rv != APR_SUCCESS || !finfo.size) {
       ctx->set_error(ctx, 500, "watermark %s has no data",filename);
       return;
    }



More information about the mapserver-commits mailing list