diff options
author | wiz <wiz@pkgsrc.org> | 2011-01-26 00:16:31 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2011-01-26 00:16:31 +0000 |
commit | 44f2b697956d4676d9648c4140dce63920c72877 (patch) | |
tree | d51c4c1fdf27cdafacc340f2c9401c02335d4494 /x11/XmHTML | |
parent | c02173193b6170723e74d412fe4f238bfa57be61 (diff) | |
download | pkgsrc-44f2b697956d4676d9648c4140dce63920c72877.tar.gz |
Fix build with png-1.5. Problem reported by chuck.
Diffstat (limited to 'x11/XmHTML')
-rw-r--r-- | x11/XmHTML/distinfo | 3 | ||||
-rw-r--r-- | x11/XmHTML/patches/patch-aj | 173 |
2 files changed, 175 insertions, 1 deletions
diff --git a/x11/XmHTML/distinfo b/x11/XmHTML/distinfo index 1c3aac4da61..af0415c4d4b 100644 --- a/x11/XmHTML/distinfo +++ b/x11/XmHTML/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.9 2009/09/08 19:20:49 joerg Exp $ +$NetBSD: distinfo,v 1.10 2011/01/26 00:16:31 wiz Exp $ SHA1 (XmHTML-1.1.7.tar.gz) = 4d8c82f88cf0700f6fc8898323d865b83d2a1ff1 RMD160 (XmHTML-1.1.7.tar.gz) = 0e5cf4a0d24fc73277186a726a3997dea4ea82db @@ -12,3 +12,4 @@ SHA1 (patch-af) = de3658ddbe191deb3d838f500d985c950ab4a967 SHA1 (patch-ag) = acac76543e8fe98d79064bbec7830f285e9c50cd SHA1 (patch-ah) = 78ad8dc486da8aad6911f79eb8bd22d8417aec1f SHA1 (patch-ai) = 300b35e24698d6e717f0b1bdfd577df91244fba4 +SHA1 (patch-aj) = 7dbd41eb4c07f094f614a0ad91fbda242d167c31 diff --git a/x11/XmHTML/patches/patch-aj b/x11/XmHTML/patches/patch-aj new file mode 100644 index 00000000000..ef1bef7e101 --- /dev/null +++ b/x11/XmHTML/patches/patch-aj @@ -0,0 +1,173 @@ +$NetBSD: patch-aj,v 1.1 2011/01/26 00:16:32 wiz Exp $ + +Fix build with png-1.5. + +--- lib/common/readPNG.c.orig 1998-11-16 22:56:19.000000000 +0000 ++++ lib/common/readPNG.c +@@ -132,7 +132,11 @@ my_png_error(png_structp png_ptr, String + + _XmHTMLWarning(__WFUNC__(NULL, "png_error"), XMHTML_MSG_121, "png", + ib->file, msg); ++#if (PNG_LIBPNG_VER < 10500) + longjmp(png_ptr->jmpbuf, 1); ++#else ++ png_longjmp(png_ptr, 1); ++#endif + } + + /***** +@@ -189,6 +193,10 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + png_bytep *row_ptrs; + char msg[128]; + static XmHTMLRawImageData *img_data; ++ png_colorp palette; ++ int num_palette; ++ double png_gamma; ++ png_color_16p background; + + img_data = NULL; + data = 0; +@@ -232,7 +240,7 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + return((XmHTMLRawImageData*)NULL); + } + /* now set error handler */ +- if(setjmp(png_ptr->jmpbuf)) ++ if(setjmp(png_jmpbuf(png_ptr))) + { + /* + * PNG signalled an error. Destroy image data, free any allocated +@@ -265,17 +273,18 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + ResetRawImage(img_data); + + /* save width & height */ +- width = img_data->width = info_ptr->width; +- height = img_data->height = info_ptr->height; ++ width = img_data->width = png_get_image_width(png_ptr, info_ptr); ++ height = img_data->height = png_get_image_height(png_ptr, info_ptr); + + /* image depth */ +- ib->depth = info_ptr->bit_depth; ++ ib->depth = png_get_bit_depth(png_ptr, info_ptr); + ++ png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette); + /* no of colors */ +- ncolors = img_data->cmapsize = info_ptr->num_palette; ++ ncolors = img_data->cmapsize = num_palette; + + /* type of image */ +- color_type = info_ptr->color_type; ++ color_type = png_get_color_type(png_ptr, info_ptr); + + /* + * The fun stuff. This is based on readPNG by Greg Roelofs as found +@@ -306,7 +315,7 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + * Actual image creation is postponed until the image is + * needed. + */ +- if(info_ptr->valid & PNG_INFO_tRNS) ++ if(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) + { + _XmHTMLDebug(15, ("readPNG.c: tRNS chunk present\n")); + png_set_expand(png_ptr); +@@ -319,9 +328,9 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + AllocRawImageCmap(img_data, ncolors); + for(i = 0; i < ncolors; i++) + { +- GETR(img_data->cmap[i]) = info_ptr->palette[i].red; +- GETG(img_data->cmap[i]) = info_ptr->palette[i].green; +- GETB(img_data->cmap[i]) = info_ptr->palette[i].blue; ++ GETR(img_data->cmap[i]) = palette[i].red; ++ GETG(img_data->cmap[i]) = palette[i].green; ++ GETB(img_data->cmap[i]) = palette[i].blue; + } + has_cmap = True; + data = (Byte*)malloc(width*height*sizeof(Byte)); +@@ -355,7 +364,7 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + * grayscale with transparency is expanded to RGB with alpha + * channel. + */ +- if(info_ptr->valid & PNG_INFO_tRNS) ++ if(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) + { + _XmHTMLDebug(15, ("readPNG.c: tRNS chunk present\n")); + png_set_gray_to_rgb(png_ptr); +@@ -434,7 +443,7 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + break; + default: + sprintf(msg, "bad PNG image: unknown color type (%d)", +- info_ptr->color_type); ++ png_get_color_type(png_ptr, info_ptr)); + my_png_error(png_ptr, msg); + break; + } +@@ -444,16 +453,19 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + * Doing that for alpha channel images would change the colortype of the + * current image, leading to weird results. + */ +- if(!has_alpha && info_ptr->valid & PNG_INFO_bKGD) ++ if(!has_alpha && png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD)) + { +- png_set_background(png_ptr, &(info_ptr->background), ++ png_get_bKGD(png_ptr, info_ptr, &background); ++ png_set_background(png_ptr, background, + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); +- img_data->bg = info_ptr->background.index; ++ img_data->bg = background->index; + } + ++ png_get_gAMA(png_ptr, info_ptr, &png_gamma); ++ + /* handle gamma correction */ +- if(info_ptr->valid & PNG_INFO_gAMA) +- fg_gamma = info_ptr->gamma; ++ if(png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA)) ++ fg_gamma = png_gamma; + else + fg_gamma = 0.45; + +@@ -464,20 +476,20 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + /* dithering gets handled by caller */ + + /* one byte per pixel */ +- if(info_ptr->bit_depth < 8) ++ if(png_get_bit_depth(png_ptr, info_ptr) < 8) + png_set_packing(png_ptr); + + /* no tRNS chunk handling, we've expanded it to an alpha channel. */ + + /* handle interlacing */ +- if(info_ptr->interlace_type) ++ if(png_get_interlace_type(png_ptr, info_ptr)) + npass = png_set_interlace_handling(png_ptr); + + /* and now update everything */ + png_read_update_info(png_ptr, info_ptr); + + /* has possibly changed if we have promoted GrayScale or tRNS chunks */ +- color_type = info_ptr->color_type; ++ color_type = png_get_color_type(png_ptr, info_ptr); + + /* new color_type? */ + if(color_type == PNG_COLOR_TYPE_RGB_ALPHA) +@@ -497,10 +509,10 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + * will call doAlphaChannel to do the actual image creation. + */ + row_ptrs = (png_bytep*)malloc(height*sizeof(png_bytep)); +- png_data = (png_bytep)malloc(height*info_ptr->rowbytes); ++ png_data = (png_bytep)malloc(height*png_get_rowbytes(png_ptr, info_ptr)); + + for(i = 0; i < height; i++) +- row_ptrs[i] = (png_bytep)png_data + i*info_ptr->rowbytes; ++ row_ptrs[i] = (png_bytep)png_data + i*png_get_rowbytes(png_ptr, info_ptr); + + /* read it */ + png_read_image(png_ptr, row_ptrs); +@@ -529,7 +541,7 @@ _XmHTMLReadPNG(Widget html, ImageBuffer + row_ptrs = (png_bytep*)malloc(height*sizeof(png_bytep)); + + for(i = 0; i < height; ++i) +- row_ptrs[i] = (png_bytep)data + i*info_ptr->rowbytes; ++ row_ptrs[i] = (png_bytep)data + i*png_get_rowbytes(png_ptr, info_ptr); + + /* read it */ + png_read_image(png_ptr, row_ptrs); |