eed7c62887
All fixes by yours truly.
59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
$OpenBSD: patch-source_m-png_c,v 1.1 2011/07/08 20:38:01 naddy Exp $
|
|
|
|
Fix build with png-1.5.
|
|
|
|
--- source/m-png.c.orig Tue Jul 5 17:14:51 2011
|
|
+++ source/m-png.c Tue Jul 5 17:19:24 2011
|
|
@@ -65,7 +65,7 @@ static void MdcPngErr(png_structp png_ptr, png_const_c
|
|
|
|
if (!png_ptr) return;
|
|
|
|
- longjmp(png_ptr->jmpbuf, 1);
|
|
+ png_longjmp(png_ptr, 1);
|
|
}
|
|
|
|
static void MdcPngWarn(png_structp png_ptr, png_const_charp warning_msg)
|
|
@@ -95,11 +95,12 @@ char *MdcReadPNG(FILEINFO *fi)
|
|
{
|
|
png_structp png_ptr;
|
|
png_infop info_ptr;
|
|
+ png_textp text_ptr;
|
|
png_uint_32 width, height, rowbytes;
|
|
png_colorp palette;
|
|
png_bytepp row_pointers;
|
|
Uint32 i, commentsize;
|
|
- int bit_depth, color_type, transform, num_palette;
|
|
+ int bit_depth, color_type, transform, num_palette, num_text;
|
|
Uint8 *imgRGB, *pbuf;
|
|
IMG_DATA *id;
|
|
|
|
@@ -161,21 +162,21 @@ char *MdcReadPNG(FILEINFO *fi)
|
|
}
|
|
|
|
/* get comment */
|
|
- if(info_ptr->num_text > 0) {
|
|
+ if(png_get_text(png_ptr, info_ptr, &text_ptr, &num_text) > 0) {
|
|
commentsize = 1;
|
|
|
|
- for(i = 0; i < info_ptr->num_text; i++)
|
|
- commentsize += strlen(info_ptr->text[i].key) + 1 +
|
|
- info_ptr->text[i].text_length + 2;
|
|
+ for(i = 0; i < num_text; i++)
|
|
+ commentsize += strlen(text_ptr[i].key) + 1 +
|
|
+ text_ptr[i].text_length + 2;
|
|
|
|
if ((fi->comment = malloc(commentsize)) == NULL) {
|
|
MdcPngWarn(png_ptr,"PNG Can't malloc comment string");
|
|
}else{
|
|
fi->comment[0] = '\0';
|
|
- for (i = 0; i < info_ptr->num_text; i++) {
|
|
- strcat(fi->comment, info_ptr->text[i].key);
|
|
+ for (i = 0; i < num_text; i++) {
|
|
+ strcat(fi->comment, text_ptr[i].key);
|
|
strcat(fi->comment, "::");
|
|
- strcat(fi->comment, info_ptr->text[i].text);
|
|
+ strcat(fi->comment, text_ptr[i].text);
|
|
strcat(fi->comment, "\n");
|
|
}
|
|
}
|