Fix build with png-1.5.

This commit is contained in:
wiz 2011-04-05 11:27:28 +00:00
parent 3755e97d2f
commit 691f21761e
4 changed files with 84 additions and 6 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.5 2010/06/13 22:44:10 wiz Exp $
$NetBSD: distinfo,v 1.6 2011/04/05 11:27:28 wiz Exp $
SHA1 (teem-1.8.0-src.tar.gz) = fd57c40136d877d33cb45b2afc54a95564e67225
RMD160 (teem-1.8.0-src.tar.gz) = 7154b1a7b12a08f7267017e213794673f6192827
@ -6,4 +6,4 @@ Size (teem-1.8.0-src.tar.gz) = 1127914 bytes
SHA1 (patch-aa) = ebb0d5be710416276fbc028ee8e635b669eaa378
SHA1 (patch-ab) = 0dbbe8290711e18d4c1312a452aaee19a13b5a04
SHA1 (patch-ac) = 5e3f9a3fcf2c3807025fec65f5bb034691ba9457
SHA1 (patch-ad) = 8a342c486f4bbbce1ac7c54ded5ebcf7eca63bdd
SHA1 (patch-ad) = f72fbafa21ca882ec17afb9370395a6ee2a424c4

View file

@ -1,7 +1,27 @@
$NetBSD: patch-ad,v 1.1 2010/06/13 22:44:11 wiz Exp $
$NetBSD: patch-ad,v 1.2 2011/04/05 11:27:29 wiz Exp $
Fix build with png-1.5.
--- src/nrrd/formatPNG.c.orig 2005-03-01 22:27:40.000000000 +0000
+++ src/nrrd/formatPNG.c
@@ -116,7 +116,7 @@ _nrrdErrorHandlerPNG (png_structp png, p
sprintf(err, "%s: PNG error: %s", me, message);
biffAdd(NRRD, err);
/* longjmp back to the setjmp, return 1 */
- longjmp(png->jmpbuf, 1);
+ longjmp(png_jmpbuf(png), 1);
}
void
@@ -192,7 +192,7 @@ _nrrdFormatPNG_read(FILE *file, Nrrd *nr
biffAdd(NRRD, err); return 1;
}
/* set up png style error handling */
- if (setjmp(png->jmpbuf)) {
+ if (setjmp(png_jmpbuf(png))) {
/* the error is reported inside the handler,
but we still need to clean up and return */
png_destroy_read_struct(&png, &info, NULL);
@@ -216,7 +216,7 @@ _nrrdFormatPNG_read(FILE *file, Nrrd *nr
png_set_palette_to_rgb(png);
/* expand grayscale images to 8 bits from 1, 2, or 4 bits */
@ -11,3 +31,12 @@ $NetBSD: patch-ad,v 1.1 2010/06/13 22:44:11 wiz Exp $
/* expand paletted or rgb images with transparency to full alpha
channels so the data will be available as rgba quartets */
if (png_get_valid(png, info, PNG_INFO_tRNS))
@@ -409,7 +409,7 @@ _nrrdFormatPNG_write(FILE *file, const N
biffAdd(NRRD, err); return 1;
}
/* set up error png style error handling */
- if (setjmp(png->jmpbuf))
+ if (setjmp(png_jmpbuf(png)))
{
/* the error is reported inside the error handler,
but we still need to clean up an return with an error */

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.4 2010/06/13 22:44:24 wiz Exp $
$NetBSD: distinfo,v 1.5 2011/04/05 11:32:46 wiz Exp $
SHA1 (ufoai-2.2.1-data.tar) = eb071333478bd6860179e12d8655301980f87d60
RMD160 (ufoai-2.2.1-data.tar) = af91dd473f59c73e705181759059bd37ba215f62
@ -10,5 +10,5 @@ SHA1 (ufoai-2.2.1-source.tar.bz2) = 6ad1b8c357fdbbe9a31839b3bf8de46ad17a40eb
RMD160 (ufoai-2.2.1-source.tar.bz2) = 980405a5d38bcbb5ae2cea4e25c54374c7dd8e99
Size (ufoai-2.2.1-source.tar.bz2) = 7640531 bytes
SHA1 (patch-aa) = 2b196e8d94a1848b42212f32c90a259e56440382
SHA1 (patch-ab) = 3700077a35ba84648b52449be047b39f1274c9ee
SHA1 (patch-ab) = 0d02436454b3dbd85b8027fcf321714be8bf05a2
SHA1 (patch-ac) = 29069a06c2442060734e32162a9b561c19be8739

View file

@ -1,4 +1,8 @@
$NetBSD: patch-ab,v 1.2 2010/06/13 22:44:24 wiz Exp $
$NetBSD: patch-ab,v 1.3 2011/04/05 11:32:46 wiz Exp $
Fix build with png-1.5.
Last chunk: ?
--- src/renderer/r_image.c.orig 2008-04-25 16:15:02.000000000 +0000
+++ src/renderer/r_image.c
@ -11,6 +15,51 @@ $NetBSD: patch-ab,v 1.2 2010/06/13 22:44:24 wiz Exp $
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(png_ptr);
@@ -268,32 +268,32 @@ static int R_LoadPNG (const char *name,
row_pointers = png_get_rows(png_ptr, info_ptr);
rowptr = 0;
- img = VID_TagAlloc(vid_imagePool, info_ptr->width * info_ptr->height * 4, 0);
+ img = VID_TagAlloc(vid_imagePool, png_get_image_width(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr) * 4, 0);
if (pic)
*pic = img;
- if (info_ptr->channels == 4) {
- for (i = 0; i < info_ptr->height; i++) {
- memcpy (img + rowptr, row_pointers[i], info_ptr->rowbytes);
- rowptr += info_ptr->rowbytes;
+ if (png_get_channels(png_ptr, info_ptr) == 4) {
+ for (i = 0; i < png_get_image_height(png_ptr, info_ptr); i++) {
+ memcpy (img + rowptr, row_pointers[i], png_get_rowbytes(png_ptr, info_ptr));
+ rowptr += png_get_rowbytes(png_ptr, info_ptr);
}
} else {
uint32_t j;
- memset(img, 255, info_ptr->width * info_ptr->height * 4);
- for (rowptr = 0, i = 0; i < info_ptr->height; i++) {
- for (j = 0; j < info_ptr->rowbytes; j += info_ptr->channels) {
- memcpy(img + rowptr, row_pointers[i] + j, info_ptr->channels);
+ memset(img, 255, png_get_image_width(png_ptr, info_ptr) * png_get_image_height(png_ptr, info_ptr) * 4);
+ for (rowptr = 0, i = 0; i < png_get_image_height(png_ptr, info_ptr); i++) {
+ for (j = 0; j < png_get_rowbytes(png_ptr, info_ptr); j += png_get_channels(png_ptr, info_ptr)) {
+ memcpy(img + rowptr, row_pointers[i] + j, png_get_channels(png_ptr, info_ptr));
rowptr += 4;
}
}
}
if (width)
- *width = info_ptr->width;
+ *width = png_get_image_width(png_ptr, info_ptr);
if (height)
- *height = info_ptr->height;
- samples = info_ptr->channels;
+ *height = png_get_image_height(png_ptr, info_ptr);
+ samples = png_get_channels(png_ptr, info_ptr);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
@@ -651,17 +651,6 @@ static void jpg_skip_input_data (j_decom
cinfo->src->bytes_in_buffer -= (size_t) num_bytes;
}