]> git.pld-linux.org Git - packages/XmHTML.git/blame - XmHTML-libpng.patch
- fix format string error
[packages/XmHTML.git] / XmHTML-libpng.patch
CommitLineData
f1628199
JB
1--- XmHTML-1.1.7/lib/common/readPNG.c.orig 1998-11-16 23:56:19.000000000 +0100
2+++ XmHTML-1.1.7/lib/common/readPNG.c 2012-02-12 17:27:36.741501024 +0100
3@@ -132,7 +132,7 @@
4
5 _XmHTMLWarning(__WFUNC__(NULL, "png_error"), XMHTML_MSG_121, "png",
6 ib->file, msg);
7- longjmp(png_ptr->jmpbuf, 1);
8+ longjmp(png_jmpbuf(png_ptr), 1);
9 }
10
11 /*****
12@@ -184,9 +184,11 @@
13 int i, idx, npass;
14 int width, height, color_type;
15 int ncolors, max_colors;
16- float gamma, fg_gamma;
17+ float gamma;
18+ double fg_gamma;
19 Boolean has_alpha = False, has_cmap = False, do_gamma = True;
20 png_bytep *row_ptrs;
21+ png_colorp palette;
22 char msg[128];
23 static XmHTMLRawImageData *img_data;
24
25@@ -232,7 +234,7 @@
26 return((XmHTMLRawImageData*)NULL);
27 }
28 /* now set error handler */
29- if(setjmp(png_ptr->jmpbuf))
30+ if(setjmp(png_jmpbuf(png_ptr)))
31 {
32 /*
33 * PNG signalled an error. Destroy image data, free any allocated
34@@ -265,17 +267,18 @@
35 ResetRawImage(img_data);
36
37 /* save width & height */
38- width = img_data->width = info_ptr->width;
39- height = img_data->height = info_ptr->height;
40+ width = img_data->width = png_get_image_width(png_ptr, info_ptr);
41+ height = img_data->height = png_get_image_height(png_ptr, info_ptr);
42
43 /* image depth */
44- ib->depth = info_ptr->bit_depth;
45+ ib->depth = png_get_bit_depth(png_ptr, info_ptr);
46
47 /* no of colors */
48- ncolors = img_data->cmapsize = info_ptr->num_palette;
49+ png_get_PLTE(png_ptr, info_ptr, &palette, &ncolors);
50+ img_data->cmapsize = ncolors;
51
52 /* type of image */
53- color_type = info_ptr->color_type;
54+ color_type = png_get_color_type(png_ptr, info_ptr);
55
56 /*
57 * The fun stuff. This is based on readPNG by Greg Roelofs as found
58@@ -306,7 +309,7 @@
59 * Actual image creation is postponed until the image is
60 * needed.
61 */
62- if(info_ptr->valid & PNG_INFO_tRNS)
63+ if(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
64 {
65 _XmHTMLDebug(15, ("readPNG.c: tRNS chunk present\n"));
66 png_set_expand(png_ptr);
67@@ -319,9 +322,9 @@
68 AllocRawImageCmap(img_data, ncolors);
69 for(i = 0; i < ncolors; i++)
70 {
71- GETR(img_data->cmap[i]) = info_ptr->palette[i].red;
72- GETG(img_data->cmap[i]) = info_ptr->palette[i].green;
73- GETB(img_data->cmap[i]) = info_ptr->palette[i].blue;
74+ GETR(img_data->cmap[i]) = palette[i].red;
75+ GETG(img_data->cmap[i]) = palette[i].green;
76+ GETB(img_data->cmap[i]) = palette[i].blue;
77 }
78 has_cmap = True;
79 data = (Byte*)malloc(width*height*sizeof(Byte));
80@@ -355,7 +358,7 @@
81 * grayscale with transparency is expanded to RGB with alpha
82 * channel.
83 */
84- if(info_ptr->valid & PNG_INFO_tRNS)
85+ if(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
86 {
87 _XmHTMLDebug(15, ("readPNG.c: tRNS chunk present\n"));
88 png_set_gray_to_rgb(png_ptr);
89@@ -434,7 +437,7 @@
90 break;
91 default:
92 sprintf(msg, "bad PNG image: unknown color type (%d)",
93- info_ptr->color_type);
94+ png_get_color_type(png_ptr, info_ptr));
95 my_png_error(png_ptr, msg);
96 break;
97 }
98@@ -444,15 +447,17 @@
99 * Doing that for alpha channel images would change the colortype of the
100 * current image, leading to weird results.
101 */
102- if(!has_alpha && info_ptr->valid & PNG_INFO_bKGD)
103+ if(!has_alpha && png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD))
104 {
105- png_set_background(png_ptr, &(info_ptr->background),
106+ png_color_16p background;
107+ png_get_bKGD(png_ptr, info_ptr, &background);
108+ png_set_background(png_ptr, background,
109 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
110- img_data->bg = info_ptr->background.index;
111+ img_data->bg = background->index;
112 }
113
114 /* handle gamma correction */
115- if(info_ptr->valid & PNG_INFO_gAMA)
116- fg_gamma = info_ptr->gamma;
117+ if(png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA))
118+ png_get_gAMA(png_ptr, info_ptr, &fg_gamma);
119 else
120 fg_gamma = 0.45;
121@@ -464,20 +469,20 @@
122 /* dithering gets handled by caller */
123
124 /* one byte per pixel */
125- if(info_ptr->bit_depth < 8)
126+ if(png_get_bit_depth(png_ptr, info_ptr) < 8)
127 png_set_packing(png_ptr);
128
129 /* no tRNS chunk handling, we've expanded it to an alpha channel. */
130
131 /* handle interlacing */
132- if(info_ptr->interlace_type)
133+ if(png_get_interlace_type(png_ptr, info_ptr))
134 npass = png_set_interlace_handling(png_ptr);
135
136 /* and now update everything */
137 png_read_update_info(png_ptr, info_ptr);
138
139 /* has possibly changed if we have promoted GrayScale or tRNS chunks */
140- color_type = info_ptr->color_type;
141+ color_type = png_get_color_type(png_ptr, info_ptr);
142
143 /* new color_type? */
144 if(color_type == PNG_COLOR_TYPE_RGB_ALPHA)
145@@ -497,10 +502,10 @@
146 * will call doAlphaChannel to do the actual image creation.
147 */
148 row_ptrs = (png_bytep*)malloc(height*sizeof(png_bytep));
149- png_data = (png_bytep)malloc(height*info_ptr->rowbytes);
150+ png_data = (png_bytep)malloc(height*png_get_rowbytes(png_ptr, info_ptr));
151
152 for(i = 0; i < height; i++)
153- row_ptrs[i] = (png_bytep)png_data + i*info_ptr->rowbytes;
154+ row_ptrs[i] = (png_bytep)png_data + i*png_get_rowbytes(png_ptr, info_ptr);
155
156 /* read it */
157 png_read_image(png_ptr, row_ptrs);
158@@ -529,7 +534,7 @@
159 row_ptrs = (png_bytep*)malloc(height*sizeof(png_bytep));
160
161 for(i = 0; i < height; ++i)
162- row_ptrs[i] = (png_bytep)data + i*info_ptr->rowbytes;
163+ row_ptrs[i] = (png_bytep)data + i*png_get_rowbytes(png_ptr, info_ptr);
164
165 /* read it */
166 png_read_image(png_ptr, row_ptrs);
This page took 0.51214 seconds and 4 git commands to generate.