]> git.pld-linux.org Git - packages/xv.git/blame - xv-3.10a-enhancements.20070520-20081216.diff
- initial
[packages/xv.git] / xv-3.10a-enhancements.20070520-20081216.diff
CommitLineData
2af41b64 1 20070621
2 fixed improper ClearCode termination condition in GIF decoder (JZ); fixed
3 some minor inconsistencies in Makefile (GRR)
4 - xv-joe-zbiciak-20070621-gif-decoder-bugfix.dif
5
6 20080121
7 removed duplicate "XDestroyWindow(theDisp, pngW);" in xvmisc.c (IMC); fixed
8 empty-filename click-and-crash bug in xvdir.c (IMC, DB)
9 - xv-ian-collier-20080118-crash-fixes.msg
10 - xv-david-bath-20080901-empty-filename-save-crash-fix.dif
11
12 20081205
13 reverted xvxwd.c to SJT's version (bug reported by Jari Ruusu)
14
15 20081216
16 fixed crash-bug in IFF decoder (EP)
17 - xv-elmar-plischke-20081216-xviff-crash-fix.dif
18
19
20
21diff -ru ../test3.20070520.stock/xv-3.10a/xv.h ./xv.h
22--- ../test3.20070520.stock/xv-3.10a/xv.h 2007-05-20 22:23:33.000000000 -0700
23+++ ./xv.h 2008-12-16 09:45:00.000000000 -0800
24@@ -16,8 +16,9 @@
25 /* GRR 2nd public jumbo F+E patches: 20050410 */
26 /* GRR 3rd public jumbo F+E patches: 20050501 */
27 /* GRR 4th public jumbo F+E patch: 20070520 */
28-#define REVDATE "version 3.10a-jumboFix+Enh of 20070520"
29-#define VERSTR "3.10a-20070520"
30+/* GRR 5th public jumbo F+E patch: 200xxxxx (probably mid-2009) */
31+#define REVDATE "version 3.10a-jumboFix+Enh of 20081216 (interim!)"
32+#define VERSTR "3.10a-20081216"
33
34 /*
35 * uncomment the following, and modify for your site, but only if you've
36
37
38
39diff -ru ../test3.20070520.stock/xv-3.10a/xvdir.c ./xvdir.c
40--- ../test3.20070520.stock/xv-3.10a/xvdir.c 2007-05-20 22:23:33.000000000 -0700
41+++ ./xvdir.c 2008-01-21 13:02:38.000000000 -0800
42@@ -539,8 +539,9 @@
43 return -1;
44 }
45
46- /* handle clicks inside the filename box */
47- if (x > 80 &&
48+ /* handle clicks inside the filename box, but only when box is not empty */
49+ if (enPos > stPos &&
50+ x > 80 &&
51 y > dList.y + (int) dList.h + 30 &&
52 x < 80 + DNAMWIDE+6 &&
53 y < dList.y + (int) dList.h + 30 + LINEHIGH+5) {
54
55
56
57diff -ru ../test3.20070520.stock/xv-3.10a/xvgif.c ./xvgif.c
58--- ../test3.20070520.stock/xv-3.10a/xvgif.c 2007-05-20 22:23:33.000000000 -0700
59+++ ./xvgif.c 2007-06-21 09:36:40.000000000 -0700
60@@ -700,7 +700,7 @@
61 * associated output code on the output queue.
62 */
63
64- while (CurCode > BitMask) {
65+ while (CurCode >= ClearCode) { /* Joe Zbiciak fix, 20070621 */
66 if (OutCount > 4096) break; /* corrupt file */
67 OutCode[OutCount++] = Suffix[CurCode];
68 CurCode = Prefix[CurCode];
69
70
71
72diff -ru ../test3.20070520.stock/xv-3.10a/xvmisc.c ./xvmisc.c
73--- ../test3.20070520.stock/xv-3.10a/xvmisc.c 2007-05-20 22:23:33.000000000 -0700
74+++ ./xvmisc.c 2008-01-21 12:57:29.000000000 -0800
75@@ -561,10 +561,6 @@
76 if (mgcsfxW) XDestroyWindow(theDisp, mgcsfxW);
77 #endif
78
79-#ifdef HAVE_PNG
80- if (pngW) XDestroyWindow(theDisp, pngW);
81-#endif
82-
83 /* if NOT using stdcmap for images, free stdcmap */
84 if (colorMapMode != CM_STDCMAP) {
85 int j;
86
87
88
89[This one reverts xvxwd.c to the pre-2007 SJT version, which actually worked...]
90
91diff -ru ../test3.20070520.stock/xv-3.10a/xvxwd.c ./xvxwd.c
92--- ../test3.20070520.stock/xv-3.10a/xvxwd.c 2007-05-20 22:23:33.000000000 -0700
93+++ ./xvxwd.c 2008-12-06 00:30:44.000000000 -0800
94@@ -19,6 +19,12 @@
95 */
96
97 #include "xv.h"
98+#include <limits.h> /* for CHAR_BIT */
99+
100+/* SJT: just in case ... */
101+#ifndef CHAR_BIT
102+# define CHAR_BIT 8
103+#endif
104
105
106 /***************************** x11wd.h *****************************/
107@@ -83,9 +89,14 @@
108 static int writebiglong PARM((FILE *, CARD32));
109 #endif
110
111+static void getcolorshift PARM((CARD32, int *, int *)); /* SJT */
112+
113+/* SJT: for 16bpp and 24bpp shifts */
114+static int red_shift_right, red_justify_left,
115+ grn_shift_right, grn_justify_left,
116+ blu_shift_right, blu_justify_left;
117 static byte *pic8, *pic24;
118-static CARD32 red_mask, green_mask, blue_mask;
119-static int red_shift, green_shift, blue_shift;
120+static CARD32 red_mask, grn_mask, blu_mask;
121 static int bits_per_item, bits_used, bit_shift,
122 bits_per_pixel, bits_per_rgb;
123 static char buf[4];
124@@ -189,38 +200,34 @@
125 return 0;
126 }
127
128- switch (bits_per_pixel) {
129- case 16:
130- case 24:
131- case 32:
132- ;
133- default:
134- xwdError("True/Direct supports only 16, 24, and 32 bits");
135- return 0;
136- }
137+ for (row=0; row<rows; row++) {
138+ for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
139+ CARD32 ul;
140
141- if (byte_order == MSBFirst) {
142- for (row=0; row<rows; row++) {
143- for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
144- register CARD32 ul = getpixnum(ifp);
145-
146- *xP++ = ul >> red_shift & red_mask ;
147- *xP++ = ul >> green_shift & green_mask;
148- *xP++ = ul >> blue_shift & blue_mask ;
149- };
150- for (col=0; col<padright; col++) getpixnum(ifp);
151- }
152- } else {
153- for (row=0; row<rows; row++) {
154- for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
155- register CARD32 ul = getpixnum(ifp);
156-
157- *xP++ = ul >> blue_shift & blue_mask ;
158- *xP++ = ul >> green_shift & green_mask;
159- *xP++ = ul >> red_shift & red_mask ;
160- };
161- for (col=0; col<padright; col++) getpixnum(ifp);
162+ ul = getpixnum(ifp);
163+ switch (bits_per_pixel) {
164+ case 16:
165+ case 24:
166+ case 32:
167+ /* SJT: shift all the way to the right and then shift left. The
168+ pairs of shifts could be combined. There will be two right and
169+ one left shift, but it's unknown which will be which. It seems
170+ easier to do the shifts (which might be 0) separately than to
171+ have a complex set of tests. I believe this is independent of
172+ byte order but I have no way to test.
173+ */
174+ *xP++ = ((ul & red_mask) >> red_shift_right) << red_justify_left;
175+ *xP++ = ((ul & grn_mask) >> grn_shift_right) << grn_justify_left;
176+ *xP++ = ((ul & blu_mask) >> blu_shift_right) << blu_justify_left;
177+ break;
178+
179+ default:
180+ xwdError("True/Direct supports only 16, 24, and 32 bits");
181+ return 0;
182+ }
183 }
184+
185+ for (col=0; col<padright; col++) getpixnum(ifp);
186 }
187
188 pinfo->type = PIC24;
189@@ -445,28 +452,18 @@
190 (i.e., 3 bytes, no alpha/padding) */
191
192
193- bits_used = bits_per_item;
194+ bits_used = bits_per_item;
195
196 if (bits_per_pixel == sizeof(pixel_mask) * 8) pixel_mask = (CARD32) -1;
197 else pixel_mask = (1 << bits_per_pixel) - 1;
198
199- red_mask = h11P->red_mask;
200- green_mask = h11P->grn_mask;
201- blue_mask = h11P->blu_mask;
202-
203- red_shift = blue_shift = green_shift = 0;
204- while (!(red_mask & 1)) {
205- red_mask >>= 1;
206- ++red_shift;
207- }
208- while (!(blue_mask & 1)) {
209- blue_mask >>= 1;
210- ++blue_shift;
211- }
212- while (!(green_mask & 1)) {
213- green_mask >>= 1;
214- ++green_shift;
215- }
216+ red_mask = h11P->red_mask;
217+ grn_mask = h11P->grn_mask;
218+ blu_mask = h11P->blu_mask;
219+
220+ getcolorshift(red_mask, &red_shift_right, &red_justify_left);
221+ getcolorshift(grn_mask, &grn_shift_right, &grn_justify_left);
222+ getcolorshift(blu_mask, &blu_shift_right, &blu_justify_left);
223
224 byteP = (char *) buf;
225 shortP = (CARD16 *) buf;
226@@ -476,6 +473,45 @@
227 }
228
229
230+/* SJT: figure out the proper shifts */
231+static void getcolorshift (CARD32 mask, int *rightshift, int *leftshift)
232+{
233+ int lshift, rshift;
234+ unsigned int uu;
235+
236+ if (mask == 0)
237+ {
238+ *rightshift = *leftshift = 0;
239+ return;
240+ }
241+
242+ uu = mask;
243+ lshift = rshift = 0;
244+ while ((uu & 0xf) == 0)
245+ {
246+ rshift += 4;
247+ uu >>= 4;
248+ }
249+ while ((uu & 1) == 0)
250+ {
251+ rshift++;
252+ uu >>= 1;
253+ }
254+
255+ while (uu != 0)
256+ {
257+ if (uu & 1)
258+ {
259+ lshift++;
260+ uu >>= 1;
261+ }
262+ }
263+ *rightshift = rshift;
264+ *leftshift = CHAR_BIT * sizeof(pixel) - lshift;
265+ return;
266+}
267+
268+
269 /******************************/
270 static CARD32 getpixnum(file)
271 FILE* file;
272
273
274
275diff -ru ../test3.20070520.stock/xv-3.10a/xviff.c ./xviff.c
276--- ../test3.20070520.stock/xv-3.10a/xviff.c 2007-05-13 17:50:59.000000000 -0700
277+++ ./xviff.c 2008-12-16 09:20:25.000000000 -0800
278@@ -73,6 +73,7 @@
279 int BMHDok, CMAPok, CAMGok;
280 int bmhd_width, bmhd_height, bmhd_bitplanes, bmhd_transcol;
281 int i, j, k, lineskip, colors, fmt;
282+ int npixels = 0; /* needs to be initialized _outside_ while-loop */
283 byte bmhd_masking, bmhd_compression;
284 long chunkLen, camg_viewmode;
285 byte *databuf, *dataptr, *cmapptr, *picptr, *pic, *bodyptr;
286@@ -138,7 +139,6 @@
287 BODY chunk was found or dataptr ran over end of file */
288
289 while ((rv<0) && (dataptr < (databuf + filesize))) {
290- int npixels = 0;
291 chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe; /* make even */
292
293 if (strncmp((char *) dataptr, "BMHD", (size_t) 4)==0) { /* BMHD chunk? */
This page took 0.101177 seconds and 4 git commands to generate.