]> git.pld-linux.org Git - packages/imlib.git/blame - imlib-libpng15.patch
- rebuild without libjpeg.la
[packages/imlib.git] / imlib-libpng15.patch
CommitLineData
ea41a3c0
AG
1$OpenBSD: patch-Imlib_utils_c,v 1.4 2011/07/08 20:36:09 naddy Exp $
2--- Imlib/utils.c.orig Fri Mar 22 07:43:04 2002
3+++ Imlib/utils.c Mon Jul 4 17:36:44 2011
4@@ -801,6 +801,7 @@ Imlib_crop_and_clone_image(ImlibData * id, ImlibImage
5 unsigned char *ptr1, *ptr2;
6 ImlibImage *im2;
7 char *s;
8+ size_t s_size;
9
10 if (!im)
11 return NULL;
12@@ -872,10 +873,11 @@ Imlib_crop_and_clone_image(ImlibData * id, ImlibImage
13 im2->rgb_width = w;
14 im2->rgb_height = h;
15 im2->alpha_data = NULL;
16- s = malloc(strlen(im->filename) + 320);
17+ s_size = strlen(im->filename + 320);
18+ s = malloc(s_size);
19 if (s)
20 {
21- snprintf(s, sizeof(s), "%s_%x_%x", im->filename, (int)time(NULL), (int)rand());
22+ snprintf(s, s_size, "%s_%x_%x", im->filename, (int)time(NULL), (int)rand());
23 im2->filename = malloc(strlen(s) + 1);
24 if (im2->filename)
25 strcpy(im2->filename, s);
26@@ -1211,6 +1213,7 @@ Imlib_clone_image(ImlibData * id, ImlibImage * im)
27 {
28 ImlibImage *im2;
29 char *s;
30+ size_t s_size;
31
32 if (!im)
33 return NULL;
34@@ -1239,10 +1242,11 @@ Imlib_clone_image(ImlibData * id, ImlibImage * im)
35 }
36 else
37 im2->alpha_data = NULL;
38- s = malloc(strlen(im->filename) + 320);
39+ s_size = strlen(im->filename) + 320;
40+ s = malloc(s_size);
41 if (s)
42 {
43- snprintf(s, sizeof(s), "%s_%x_%x", im->filename, (int)time(NULL), (int)rand());
44+ snprintf(s, s_size, "%s_%x_%x", im->filename, (int)time(NULL), (int)rand());
45 im2->filename = malloc(strlen(s) + 1);
46 if (im2->filename)
47 strcpy(im2->filename, s);
48@@ -1285,6 +1289,7 @@ Imlib_clone_scaled_image(ImlibData * id, ImlibImage *
49 {
50 ImlibImage *im2;
51 char *s;
52+ size_t s_size;
53
54 if ((!im) || (w <= 0) || (h <= 0))
55 return NULL;
56@@ -1417,10 +1422,11 @@ Imlib_clone_scaled_image(ImlibData * id, ImlibImage *
57 }
58 else
59 im2->alpha_data = NULL;
60- s = malloc(strlen(im->filename) + 320);
61+ s_size = strlen(im->filename) + 320;
62+ s = malloc(s_size);
63 if (s)
64 {
65- snprintf(s, sizeof(s), "%s_%x_%x_%x_%x", im->filename, (int)time(NULL), w, h, (int)rand());
66+ snprintf(s, s_size, "%s_%x_%x_%x_%x", im->filename, (int)time(NULL), w, h, (int)rand());
67 im2->filename = malloc(strlen(s) + 1);
68 if (im2->filename)
69 strcpy(im2->filename, s);
70@@ -1596,7 +1602,7 @@ Imlib_create_image_from_xpm_data(ImlibData * id, char
71 {
72 if (line[k] != ' ')
73 {
74- sscanf(&line[k], "%65536s", s);
75+ sscanf(&line[k], "%255s", s);
76 k += strlen(s);
77 if (!strcmp(s, "c"))
78 iscolor = 1;
79@@ -1959,13 +1965,13 @@ Imlib_inlined_png_to_image(ImlibData *id, unsigned cha
80 return NULL;
81 }
82
83- if (setjmp(png_ptr->jmpbuf))
84+ if (setjmp(png_jmpbuf(png_ptr)))
85 {
86 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
87 return NULL;
88 }
89
90- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
91+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
92 {
93 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
94 return NULL;
95$OpenBSD: patch-Imlib_load_c,v 1.7 2011/07/08 20:36:09 naddy Exp $
96--- Imlib/load.c.orig Fri Mar 22 07:43:04 2002
97+++ Imlib/load.c Mon Jul 4 17:33:14 2011
98@@ -191,12 +191,12 @@ _LoadPNG(ImlibData * id, FILE * f, int *w, int *h, int
99 png_destroy_read_struct(&png_ptr, NULL, NULL);
100 return NULL;
101 }
102- if (setjmp(png_ptr->jmpbuf))
103+ if (setjmp(png_jmpbuf(png_ptr)))
104 {
105 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
106 return NULL;
107 }
108- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
109+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
110 {
111 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
112 return NULL;
113@@ -254,7 +254,8 @@ _LoadPNG(ImlibData * id, FILE * f, int *w, int *h, int
114 png_read_image(png_ptr, lines);
115 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
116 ptr = data;
117- if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
118+ if (color_type == PNG_COLOR_TYPE_GRAY
119+ || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
120 {
121 for (y = 0; y < *h; y++)
122 {
123@@ -1061,7 +1098,7 @@ _LoadXPM(ImlibData * id, FILE *file, int *w, int *h, i
124 if (line[k] != ' ')
125 {
126 s[0] = 0;
127- sscanf(&line[k], "%256s", s);
128+ sscanf(&line[k], "%255s", s);
129 slen = strlen(s);
130 k += slen;
131 if (!strcmp(s, "c"))
132@@ -1861,7 +1898,7 @@ Imlib_load_image(ImlibData * id, char *file)
133 free(im);
134 return NULL;
135 }
136- sscanf(s, "%256s %i", s1, &num);
137+ sscanf(s, "%255s %i", s1, &num);
138 if (num <= 0)
139 {
140 fclose(p);
141@@ -1870,10 +1907,10 @@ Imlib_load_image(ImlibData * id, char *file)
142 }
143 while (fgets(s, 4096, p))
144 {
145- sscanf(s, "%256s", s1);
146+ sscanf(s, "%255s", s1);
147 if (!strcmp("IMAGE", s1))
148 {
149- sscanf(s, "%256s %i %256s %i %i %i %i %i %i %i %i %i", s1, &size,
150+ sscanf(s, "%255s %i %255s %i %i %i %i %i %i %i %i %i", s1, &size,
151 s2, &w, &h, &r, &g, &b, &bl, &br, &bt, &bb);
152 if (!iden[0])
153 break;
154$OpenBSD: patch-gdk_imlib_io-png_c,v 1.4 2011/07/08 20:36:09 naddy Exp $
155
156Fix build with png-1.5.
157
158--- gdk_imlib/io-png.c.orig Mon Mar 4 10:06:29 2002
159+++ gdk_imlib/io-png.c Mon Jul 4 17:01:55 2011
160@@ -40,13 +40,13 @@ loader_png (FILE * f, int *w, int *h, int *t)
161 return NULL;
162 }
163
164- if (setjmp(png_ptr->jmpbuf))
165+ if (setjmp(png_jmpbuf(png_ptr)))
166 {
167 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
168 return NULL;
169 }
170
171- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
172+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
173 {
174 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
175 return NULL;
176@@ -275,13 +275,13 @@ inline_png(unsigned char *data, int data_size)
177 return NULL;
178 }
179
180- if (setjmp(png_ptr->jmpbuf))
181+ if (setjmp(png_jmpbuf(png_ptr)))
182 {
183 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
184 return NULL;
185 }
186
187- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
188+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
189 {
190 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
191 return NULL;
192@@ -301,6 +301,8 @@ inline_png(unsigned char *data, int data_size)
193 /* Setup Translators */
194 if (color_type == PNG_COLOR_TYPE_PALETTE)
195 png_set_expand(png_ptr);
196+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
197+ png_set_expand(png_ptr);
198 png_set_strip_16(png_ptr);
199 png_set_packing(png_ptr);
200 if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
201@@ -440,13 +442,13 @@ _loader_alpha_png (FILE * f, int *w, int *h, int *t, u
202 return NULL;
203 }
204
205- if (setjmp(png_ptr->jmpbuf))
206+ if (setjmp(png_jmpbuf(png_ptr)))
207 {
208 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
209 return NULL;
210 }
211
212- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
213+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
214 {
215 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
216 return NULL;
217@@ -635,7 +637,7 @@ saver_png (GdkImlibImage *im, char *file, GdkImlibSave
218 png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
219 return 0;
220 }
221- if (setjmp(png_ptr->jmpbuf))
222+ if (setjmp(png_jmpbuf(png_ptr)))
223 {
224 fclose(f);
225 png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
226--- Imlib/save.c~ 2004-09-21 02:22:59.000000000 +0200
227+++ Imlib/save.c 2012-02-12 14:36:50.271138211 +0100
228@@ -342,7 +342,7 @@
229 png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
230 return 0;
231 }
232- if (setjmp(png_ptr->jmpbuf))
233+ if (setjmp(png_jmpbuf(png_ptr)))
234 {
235 fclose(f);
236 png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
This page took 0.127894 seconds and 4 git commands to generate.