[mapserver-commits] r12166 - trunk/mapserver/mapcache/src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:03:43 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:03:43 -0700 (Fri, 26 Aug 2011)
New Revision: 12166
Modified:
trunk/mapserver/mapcache/src/configuration.c
trunk/mapserver/mapcache/src/fastcgi_geocache.c
trunk/mapserver/mapcache/src/imageio.c
trunk/mapserver/mapcache/src/imageio_png.c
Log:
add two missing functions for older versions of apr
thomas.bonfort | 2010-12-09 10:25:30 +0100 (Thu, 09 Dec 2010)
Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:03:37 UTC (rev 12165)
+++ trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:03:43 UTC (rev 12166)
@@ -177,12 +177,12 @@
ctx->set_error(ctx, GEOCACHE_PARSE_ERROR, "unknown tag %s for format \"%s\"", cur_node->name, name);
return;
}
- if(colors == -1) {
- format = geocache_imageio_create_png_format(ctx->pool,name,compression);
- } else {
- format = geocache_imageio_create_png_q_format(ctx->pool,name,compression, colors);
- }
}
+ if(colors == -1) {
+ format = geocache_imageio_create_png_format(ctx->pool,name,compression);
+ } else {
+ format = geocache_imageio_create_png_q_format(ctx->pool,name,compression, colors);
+ }
} else if(!strcmp(type,"JPEG")){
int quality = 95;
for(cur_node = node->children; cur_node; cur_node = cur_node->next) {
Modified: trunk/mapserver/mapcache/src/fastcgi_geocache.c
===================================================================
--- trunk/mapserver/mapcache/src/fastcgi_geocache.c 2011-08-26 11:03:37 UTC (rev 12165)
+++ trunk/mapserver/mapcache/src/fastcgi_geocache.c 2011-08-26 11:03:43 UTC (rev 12166)
@@ -105,7 +105,7 @@
geocache_context_fcgi *ctx = apr_pcalloc(pool, sizeof(geocache_context_fcgi));
ctx->ctx.pool = pool;
init_fcgi_context(ctx);
- ret = apr_proc_mutex_create(&ctx->mutex,"/tmp/geocache.mutex",APR_LOCK_PROC_PTHREAD,pool);
+ ret = apr_proc_mutex_create(&ctx->mutex,"geocache_mutex",APR_LOCK_DEFAULT,pool);
if(ret != APR_SUCCESS) {
ctx->ctx.set_error(&ctx->ctx,GEOCACHE_MUTEX_ERROR,"failed to created mutex");
} else {
@@ -176,7 +176,7 @@
apr_table_t *params;
geocache_context *ctx = (geocache_context*) fcgi_context_request_create(globalctx,out,err);
geocache_tile *tile;
- geocache_request *request;
+ geocache_request *request = NULL;
char *pathInfo = FCGX_GetParam("PATH_INFO",envp);
int i;
Modified: trunk/mapserver/mapcache/src/imageio.c
===================================================================
--- trunk/mapserver/mapcache/src/imageio.c 2011-08-26 11:03:37 UTC (rev 12165)
+++ trunk/mapserver/mapcache/src/imageio.c 2011-08-26 11:03:43 UTC (rev 12166)
@@ -24,14 +24,14 @@
int geocache_imageio_image_has_alpha(geocache_image *img) {
int i,j;
unsigned char *ptr, *rptr = img->data;
- for(i=0;i<img->h;i++) {
- rptr += img->stride;
+ for(i=0;i<img->h;i++) {
ptr = rptr;
- for(j=0;j<img->w;i++) {
+ for(j=0;j<img->w;j++) {
if(ptr[3]<255)
return 1;
ptr += 4;
}
+ rptr += img->stride;
}
return 0;
}
Modified: trunk/mapserver/mapcache/src/imageio_png.c
===================================================================
--- trunk/mapserver/mapcache/src/imageio_png.c 2011-08-26 11:03:37 UTC (rev 12165)
+++ trunk/mapserver/mapcache/src/imageio_png.c 2011-08-26 11:03:43 UTC (rev 12166)
@@ -84,7 +84,7 @@
img->stride = img->w * 4;
row_pointers = apr_pcalloc(ctx->pool,img->h * sizeof(unsigned char*));
- png_bytep rowptr = img->data;
+ unsigned char *rowptr = img->data;
for(i=0;i<img->h;i++) {
row_pointers[i] = rowptr;
rowptr += img->stride;
@@ -95,7 +95,7 @@
png_set_strip_16(png_ptr);
png_set_gray_to_rgb(png_ptr);
png_set_add_alpha(png_ptr, 0xff, PNG_FILLER_AFTER);
-
+
png_read_update_info(png_ptr, info_ptr);
#ifdef DEBUG
if(img->stride != png_get_rowbytes(png_ptr, info_ptr)) {
@@ -105,6 +105,7 @@
#endif
png_read_image(png_ptr, row_pointers);
+
png_read_end(png_ptr,NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
@@ -153,7 +154,7 @@
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
else
color_type = PNG_COLOR_TYPE_RGB;
-
+
png_set_IHDR(png_ptr, info_ptr, img->w, img->h,
8, color_type, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
@@ -163,6 +164,8 @@
png_set_compression_level (png_ptr, Z_BEST_SPEED);
png_write_info(png_ptr, info_ptr);
+ if(color_type == PNG_COLOR_TYPE_RGB)
+ png_set_filler(png_ptr, 255, PNG_FILLER_AFTER);
png_bytep rowptr = img->data;
for(row=0;row<img->h;row++) {
More information about the mapserver-commits
mailing list