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;
12 @@ -872,10 +873,11 @@ Imlib_crop_and_clone_image(ImlibData * id, ImlibImage
15 im2->alpha_data = NULL;
16 - s = malloc(strlen(im->filename) + 320);
17 + s_size = strlen(im->filename + 320);
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);
25 strcpy(im2->filename, s);
26 @@ -1211,6 +1213,7 @@ Imlib_clone_image(ImlibData * id, ImlibImage * im)
34 @@ -1239,10 +1242,11 @@ Imlib_clone_image(ImlibData * id, ImlibImage * im)
37 im2->alpha_data = NULL;
38 - s = malloc(strlen(im->filename) + 320);
39 + s_size = strlen(im->filename) + 320;
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);
47 strcpy(im2->filename, s);
48 @@ -1285,6 +1289,7 @@ Imlib_clone_scaled_image(ImlibData * id, ImlibImage *
54 if ((!im) || (w <= 0) || (h <= 0))
56 @@ -1417,10 +1422,11 @@ Imlib_clone_scaled_image(ImlibData * id, ImlibImage *
59 im2->alpha_data = NULL;
60 - s = malloc(strlen(im->filename) + 320);
61 + s_size = strlen(im->filename) + 320;
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);
69 strcpy(im2->filename, s);
70 @@ -1596,7 +1602,7 @@ Imlib_create_image_from_xpm_data(ImlibData * id, char
74 - sscanf(&line[k], "%65536s", s);
75 + sscanf(&line[k], "%255s", s);
79 @@ -1959,13 +1965,13 @@ Imlib_inlined_png_to_image(ImlibData *id, unsigned cha
83 - if (setjmp(png_ptr->jmpbuf))
84 + if (setjmp(png_jmpbuf(png_ptr)))
86 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
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)
93 png_destroy_read_struct(&png_ptr, &info_ptr, 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);
102 - if (setjmp(png_ptr->jmpbuf))
103 + if (setjmp(png_jmpbuf(png_ptr)))
105 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
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)
111 png_destroy_read_struct(&png_ptr, &info_ptr, 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);
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)
121 for (y = 0; y < *h; y++)
123 @@ -1061,7 +1098,7 @@ _LoadXPM(ImlibData * id, FILE *file, int *w, int *h, i
127 - sscanf(&line[k], "%256s", s);
128 + sscanf(&line[k], "%255s", s);
132 @@ -1861,7 +1898,7 @@ Imlib_load_image(ImlibData * id, char *file)
136 - sscanf(s, "%256s %i", s1, &num);
137 + sscanf(s, "%255s %i", s1, &num);
141 @@ -1870,10 +1907,10 @@ Imlib_load_image(ImlibData * id, char *file)
143 while (fgets(s, 4096, p))
145 - sscanf(s, "%256s", s1);
146 + sscanf(s, "%255s", s1);
147 if (!strcmp("IMAGE", s1))
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);
154 $OpenBSD: patch-gdk_imlib_io-png_c,v 1.4 2011/07/08 20:36:09 naddy Exp $
156 Fix build with png-1.5.
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)
164 - if (setjmp(png_ptr->jmpbuf))
165 + if (setjmp(png_jmpbuf(png_ptr)))
167 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
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)
174 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
176 @@ -275,13 +275,13 @@ inline_png(unsigned char *data, int data_size)
180 - if (setjmp(png_ptr->jmpbuf))
181 + if (setjmp(png_jmpbuf(png_ptr)))
183 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
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)
190 png_destroy_read_struct(&png_ptr, &info_ptr, 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
205 - if (setjmp(png_ptr->jmpbuf))
206 + if (setjmp(png_jmpbuf(png_ptr)))
208 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
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)
215 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
217 @@ -635,7 +637,7 @@ saver_png (GdkImlibImage *im, char *file, GdkImlibSave
218 png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
221 - if (setjmp(png_ptr->jmpbuf))
222 + if (setjmp(png_jmpbuf(png_ptr)))
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
229 png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
232 - if (setjmp(png_ptr->jmpbuf))
233 + if (setjmp(png_jmpbuf(png_ptr)))
236 png_destroy_write_struct(&png_ptr, (png_infopp) NULL);