| @@ -1,39 +1,39 @@ | | | @@ -1,39 +1,39 @@ |
1 | $NetBSD: patch-aa,v 1.5 2011/01/13 17:07:53 wiz Exp $ | | 1 | $NetBSD: patch-aa,v 1.6 2012/03/07 15:28:12 wiz Exp $ |
2 | | | 2 | |
3 | Fix build with png-1.5. | | 3 | Fix build with png-1.5. |
4 | | | 4 | |
5 | --- gif2png.c.orig 2009-11-11 20:28:02.000000000 +0000 | | 5 | --- gif2png.c.orig 2012-01-28 23:02:06.000000000 +0000 |
6 | +++ gif2png.c | | 6 | +++ gif2png.c |
7 | @@ -10,6 +10,7 @@ | | 7 | @@ -10,6 +10,7 @@ |
8 | #include <string.h> | | 8 | #include <string.h> |
9 | #include <stdlib.h> | | 9 | #include <stdlib.h> |
10 | #include <unistd.h> /* for isatty() */ | | 10 | #include <unistd.h> /* for isatty() */ |
11 | +#include <zlib.h> | | 11 | +#include <zlib.h> |
| | | 12 | #include <sys/stat.h> |
| | | 13 | #include <utime.h> |
12 | | | 14 | |
13 | #if !defined(TRUE) | | 15 | @@ -122,8 +123,8 @@ int writefile(struct GIFelement *s,struc |
14 | #define FALSE 0 | | | |
15 | @@ -120,8 +121,8 @@ int writefile(struct GIFelement *s,struc | | | |
16 | int colors_used = 0; | | 16 | int colors_used = 0; |
17 | byte remap[MAXCMSIZE]; | | 17 | byte remap[MAXCMSIZE]; |
18 | int low_prec; | | 18 | int low_prec; |
19 | - png_struct *png_ptr = xalloc(sizeof (png_struct)); | | 19 | - png_struct *png_ptr = xalloc(sizeof (png_struct)); |
20 | - png_info *info_ptr = xalloc(sizeof (png_info)); | | 20 | - png_info *info_ptr = xalloc(sizeof (png_info)); |
21 | + png_struct *png_ptr; | | 21 | + png_struct *png_ptr; |
22 | + png_info *info_ptr; | | 22 | + png_info *info_ptr; |
23 | int p; | | 23 | int p; |
24 | int gray_bitdepth; | | 24 | int gray_bitdepth; |
25 | png_color pal_rgb[MAXCMSIZE], *pltep; | | 25 | png_color pal_rgb[MAXCMSIZE], *pltep; |
26 | @@ -136,6 +137,19 @@ int writefile(struct GIFelement *s,struc | | 26 | @@ -138,6 +139,19 @@ int writefile(struct GIFelement *s,struc |
27 | png_text software; | | 27 | png_text software; |
28 | png_text comment; | | 28 | png_text comment; |
29 | | | 29 | |
30 | + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); | | 30 | + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); |
31 | + if (png_ptr == NULL) { | | 31 | + if (png_ptr == NULL) { |
32 | + fprintf(stderr, "gif2png: fatal error, out of memory\n"); | | 32 | + fprintf(stderr, "gif2png: fatal error, out of memory\n"); |
33 | + fprintf(stderr, "gif2png: exiting ungracefully\n"); | | 33 | + fprintf(stderr, "gif2png: exiting ungracefully\n"); |
34 | + exit(1); | | 34 | + exit(1); |
35 | + } | | 35 | + } |
36 | + info_ptr = png_create_info_struct(png_ptr); | | 36 | + info_ptr = png_create_info_struct(png_ptr); |
37 | + if (info_ptr == NULL) { | | 37 | + if (info_ptr == NULL) { |
38 | + fprintf(stderr, "gif2png: fatal error, out of memory\n"); | | 38 | + fprintf(stderr, "gif2png: fatal error, out of memory\n"); |
39 | + fprintf(stderr, "gif2png: exiting ungracefully\n"); | | 39 | + fprintf(stderr, "gif2png: exiting ungracefully\n"); |