aboutsummaryrefslogtreecommitdiff
path: root/graphics/xv/files
diff options
context:
space:
mode:
authorDirk Meyer <dinoex@FreeBSD.org>2009-05-17 13:20:46 +0000
committerDirk Meyer <dinoex@FreeBSD.org>2009-05-17 13:20:46 +0000
commitcc6b3f8340d65c714cb1b43f28a22d54b43a41d6 (patch)
treecb13c5cdd801361c17ca837d9dcd44cb94c056e0 /graphics/xv/files
parent2905f006181e7fedaa713202431e6694649dc1aa (diff)
downloadports-cc6b3f8340d65c714cb1b43f28a22d54b43a41d6.tar.gz
ports-cc6b3f8340d65c714cb1b43f28a22d54b43a41d6.zip
Notes
Diffstat (limited to 'graphics/xv/files')
-rw-r--r--graphics/xv/files/patch-CAN-2005-066511
-rw-r--r--graphics/xv/files/patch-Imakefile (renamed from graphics/xv/files/patch-ad)58
-rw-r--r--graphics/xv/files/patch-ab79
-rw-r--r--graphics/xv/files/patch-ae539
-rw-r--r--graphics/xv/files/patch-af58
-rw-r--r--graphics/xv/files/patch-ag47
-rw-r--r--graphics/xv/files/patch-config.h (renamed from graphics/xv/files/patch-ac)12
-rw-r--r--graphics/xv/files/patch-suse-2003-01-27675
-rw-r--r--graphics/xv/files/patch-suse-2004-07-28195
-rw-r--r--graphics/xv/files/patch-suse-2004-08-24138
-rw-r--r--graphics/xv/files/patch-xv.h11
-rw-r--r--graphics/xv/files/patch-xvgif.c15
-rw-r--r--graphics/xv/files/patch-xvimage.c67
-rw-r--r--graphics/xv/files/patch-xvxwd.c171
14 files changed, 78 insertions, 1998 deletions
diff --git a/graphics/xv/files/patch-CAN-2005-0665 b/graphics/xv/files/patch-CAN-2005-0665
deleted file mode 100644
index 7c61c540108f..000000000000
--- a/graphics/xv/files/patch-CAN-2005-0665
+++ /dev/null
@@ -1,11 +0,0 @@
---- xv.c.orig Mon Mar 21 22:00:43 2005
-+++ xv.c Mon Mar 21 22:21:53 2005
-@@ -2197,7 +2197,7 @@
- SetISTR(ISTR_INFO,formatStr);
-
- SetInfoMode(INF_PART);
-- SetISTR(ISTR_FILENAME,
-+ SetISTR(ISTR_FILENAME, "%s",
- (filenum==DFLTPIC || filenum==GRABBED || frompipe)
- ? "<none>" : basefname);
-
diff --git a/graphics/xv/files/patch-ad b/graphics/xv/files/patch-Imakefile
index ea06f11a1925..04c633252cd2 100644
--- a/graphics/xv/files/patch-ad
+++ b/graphics/xv/files/patch-Imakefile
@@ -1,5 +1,5 @@
---- Imakefile.orig Mon Nov 15 10:27:12 2004
-+++ Imakefile Mon Nov 15 10:28:32 2004
+--- Imakefile.orig 2009-05-17 15:02:50.000000000 +0200
++++ Imakefile 2009-05-17 15:05:52.000000000 +0200
@@ -6,13 +6,15 @@
/* if, for whatever reason, you're unable to get the JPEG library to compile
* on your machine, *COMMENT OUT* the following line
@@ -18,7 +18,7 @@
/* if, for whatever reason, you're unable to get the PDS/VICAR support
-@@ -124,16 +126,30 @@
+@@ -124,20 +126,48 @@
JPEG = -DDOJPEG
JPEGDIR = jpeg
LIBJPEG = $(JPEGDIR)/libjpeg.a
@@ -41,7 +41,7 @@
#endif
+#ifdef UseInstalledTiff
-+TIFF = -DDOTIFF
++TIFF = -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX
+LIBTIFF = -L${LOCALBASE}/lib -ltiff
+TIFFINCLUDE = -I${LOCALBASE}/include
+#endif
@@ -49,23 +49,65 @@
#ifdef HavePDS
PDS = -DDOPDS
#endif
-@@ -149,12 +165,12 @@
+
++PNG = -DDOPNG
++PNGINC = -I${LOCALBASE}/include
++PNGLIB = -L${LOCALBASE}/lib -lpng
++
++JP2K = -DDOJP2K
++JP2KINC = -I${LOCALBASE}/include
++JP2KLIB = -L${LOCALBASE}/lib -ljasper
++
++ZLIBDIR = /usr
++ZLIBINC = -I$(ZLIBDIR)/include
++ZLIBLIB = -L$(ZLIBDIR)/lib -lz
++
++DOCDIR = -L${PREFIX}/share/doc/xv
++SYSCONFDIR = ${PREFIX}/etc/
+
+ #if defined(SCOArchitecture)
+ SCO= -Dsco -DPOSIX -DNO_RANDOM
+@@ -149,14 +179,17 @@
#endif
-DEPLIBS = $(LIBJPEG) $(LIBTIFF)
-LOCAL_LIBRARIES = $(XLIB) $(DEPLIBS)
+DEPLIBS = $(DEPLIBJPEG) $(DEPLIBTIFF)
-+LOCAL_LIBRARIES = $(XLIB) $(LIBJPEG) $(LIBTIFF)
++LOCAL_LIBRARIES = $(XLIB) $(LIBJPEG) $(LIBTIFF) ${PNGLIB} ${JP2KLIB} ${ZLIBLIB}
DEFINES= $(SCO) $(UNIX) $(NODIRENT) $(VPRINTF) $(TIMERS) \
$(HPUX7) $(JPEG) $(TIFF) $(PDS) $(DXWM) $(RAND) \
- $(BACKING_STORE) $(BSDTYPES) $(SGI) $(MGCSFX)
++ ${PNG} ${JP2K} $(TVL10N) \
++ -DDOCDIR=\"$(DOCDIR)\" \
++ -DSYSCONFDIR=\"$(SYSCONFDIR)\" \
+ $(BACKING_STORE) $(BSDTYPES) $(SGI) $(MGCSFX) $(LOCALE_EXTENSION)
- INCLUDES = $(JPEGINCLUDE) $(TIFFINCLUDE)
+-INCLUDES = $(JPEGINCLUDE) $(TIFFINCLUDE)
++INCLUDES = $(JPEGINCLUDE) $(TIFFINCLUDE) ${PNGINC} ${JP2KINC} ${ZLIBINC}
+
+ SRCS1 = xv.c xvevent.c xvroot.c xvmisc.c xvimage.c xvcolor.c xvsmooth.c \
+ xv24to8.c xvgif.c xvpm.c xvinfo.c xvctrl.c xvscrl.c xvalg.c \
+@@ -166,7 +199,7 @@
+ xvbrowse.c xvtext.c xvpcx.c xviff.c xvtarga.c xvxpm.c xvcut.c \
+ xvxwd.c xvfits.c xvpng.c xvzx.c xvwbmp.c xvpcd.c \
+ xvmag.c xvpic.c xvmaki.c xvpi.c xvpic2.c xvvd.c xvmgcsfx.c \
+- xvml.c
++ xvml.c xvjp2k.c xvhips.c
+
+ OBJS1 = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
+ xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
+@@ -176,7 +209,7 @@
+ xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
+ xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o \
+ xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \
+- xvml.o
++ xvml.o xvjp2k.o xvhips.o
-@@ -271,11 +287,11 @@
+ SRCS2= bggen.c
+ OBJS2= bggen.o
+@@ -271,11 +304,11 @@
#endif
diff --git a/graphics/xv/files/patch-ab b/graphics/xv/files/patch-ab
deleted file mode 100644
index f3b6231fc185..000000000000
--- a/graphics/xv/files/patch-ab
+++ /dev/null
@@ -1,79 +0,0 @@
-*** vdcomp.c.orig Fri Dec 23 01:34:47 1994
---- vdcomp.c Mon Nov 18 02:52:59 1996
-***************
-*** 108,114 ****
- !defined(bsd43) && \
- !defined(aux) && \
- !defined(__bsdi__) && \
-! !defined(sequent)
-
- # if defined(hp300) || defined(hp800) || defined(NeXT)
- # include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
---- 108,115 ----
- !defined(bsd43) && \
- !defined(aux) && \
- !defined(__bsdi__) && \
-! !defined(sequent) && \
-! !defined(__FreeBSD__)
-
- # if defined(hp300) || defined(hp800) || defined(NeXT)
- # include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
-***************
-*** 429,438 ****
- {
- short shortint;
- typedef long off_t;
-
- if (inname[0] == ' ') {
- printf("\nEnter name of file to be decompressed: ");
-! gets (inname);
- }
-
- if (host == 1 | host == 2) {
---- 430,442 ----
- {
- short shortint;
- typedef long off_t;
-+ char *s;
-
- if (inname[0] == ' ') {
- printf("\nEnter name of file to be decompressed: ");
-! fgets (inname, sizeof(inname), stdin);
-! if ((s = strchr(inname, '\n')) != NULL)
-! *s = '\0';
- }
-
- if (host == 1 | host == 2) {
-***************
-*** 474,486 ****
- printf("\n 3. VICAR format.");
- printf("\n 4. Unlabelled binary array.\n");
- printf("\n Enter format number:");
-! gets(inname);
- output_format = atoi(inname);
- } while (output_format < 1 || output_format > 4);
-
- if (outname[0] == ' ') {
- printf("\nEnter name of uncompressed output file: ");
-! gets (outname);
- }
-
- return(host);
---- 478,494 ----
- printf("\n 3. VICAR format.");
- printf("\n 4. Unlabelled binary array.\n");
- printf("\n Enter format number:");
-! fgets (inname, sizeof(inname), stdin);
-! if ((s = strchr(inname, '\n')) != NULL)
-! *s = '\0';
- output_format = atoi(inname);
- } while (output_format < 1 || output_format > 4);
-
- if (outname[0] == ' ') {
- printf("\nEnter name of uncompressed output file: ");
-! fgets (outname, sizeof(outname), stdin);
-! if ((s = strchr(outname, '\n')) != NULL)
-! *s = '\0';
- }
-
- return(host);
diff --git a/graphics/xv/files/patch-ae b/graphics/xv/files/patch-ae
deleted file mode 100644
index f608332c6250..000000000000
--- a/graphics/xv/files/patch-ae
+++ /dev/null
@@ -1,539 +0,0 @@
---- xvimage.c
-+++ xvimage.c Wed Jan 12 15:10:24 2000
-@@ -29,40 +29,302 @@
- static void flipSel PARM((int));
- static void do_zoom PARM((int, int));
- static void compute_zoom_rect PARM((int, int, int*, int*, int*, int*));
- static void do_unzoom PARM((void));
- static void do_pan PARM((int, int));
- static void do_pan_calc PARM((int, int, int *, int *));
- static void crop1 PARM((int, int, int, int, int));
- static int doAutoCrop24 PARM((void));
- static void floydDitherize1 PARM((XImage *, byte *, int, int, int,
- byte *, byte *,byte *));
- static int highbit PARM((unsigned long));
-
- static int doPadSolid PARM((char *, int, int, int, int));
- static int doPadBggen PARM((char *, int, int, int, int));
- static int doPadLoad PARM((char *, int, int, int, int));
-
- static int doPadPaste PARM((byte *, int, int, int, int));
- static int ReadImageFile1 PARM((char *, PICINFO *));
-
-
-+/* The following array represents the pixel values for each shade
-+ * of the primary color components.
-+ * If 'p' is a pointer to a source image rgb-byte-triplet, we can
-+ * construct the output pixel value simply by 'oring' together
-+ * the corresponding components:
-+ *
-+ * unsigned char *p;
-+ * unsigned long pixval;
-+ *
-+ * pixval = screen_rgb[0][*p++];
-+ * pixval |= screen_rgb[1][*p++];
-+ * pixval |= screen_rgb[2][*p++];
-+ *
-+ * This is both efficient and generic, since the only assumption
-+ * is that the primary color components have separate bits.
-+ * The order and distribution of bits does not matter, and we
-+ * don't need additional variables and shifting/masking code.
-+ * The array size is 3 KBytes total and thus very reasonable.
-+ */
-+
-+static unsigned long screen_rgb[3][256];
-+
-+/* The following array holds the exact color representations
-+ * reported by the system.
-+ * This is useful for less than 24 bit deep displays as a base
-+ * for additional dithering to get smoother output.
-+ */
-+
-+static byte screen_set[3][256];
-+
-+/* The following routine initializes the screen_rgb and screen_set
-+ * arrays.
-+ * Since it is executed only once per program run, it does not need
-+ * to be super-efficient.
-+ *
-+ * The method is to draw points in a pixmap with the specified shades
-+ * of primary colors and then get the corresponding XImage pixel
-+ * representation.
-+ * Thus we can get away with any Bit-order/Byte-order dependencies.
-+ *
-+ * The routine uses some global X variables:
-+ * theDisp, theScreen, dispDEEP, and theCmap.
-+ * Adapt these to your application as necessary.
-+ * I've not passed them in as parameters, since for other platforms
-+ * than X these may be different (see vfixpix.c), and so the
-+ * screen_init() interface is unique.
-+ */
-+
-+static void screen_init()
-+{
-+ static int init_flag; /* assume auto-init as 0 */
-+ Pixmap check_map;
-+ GC check_gc;
-+ XColor check_col;
-+ XImage *check_image;
-+ int ci, i;
-+
-+ if (init_flag) return;
-+ init_flag = 1;
-+
-+ check_map = XCreatePixmap(theDisp, RootWindow(theDisp,theScreen),
-+ 1, 1, dispDEEP);
-+ check_gc = XCreateGC(theDisp, check_map, 0, NULL);
-+ for (ci = 0; ci < 3; ci++) {
-+ for (i = 0; i < 256; i++) {
-+ check_col.red = 0;
-+ check_col.green = 0;
-+ check_col.blue = 0;
-+ /* Do proper upscaling from unsigned 8 bit (image data values)
-+ to unsigned 16 bit (X color representation). */
-+ ((unsigned short *)&check_col.red)[ci] = (unsigned short)((i << 8) | i);
-+ if (theVisual->class == TrueColor)
-+ XAllocColor(theDisp, theCmap, &check_col);
-+ else
-+ xvAllocColor(theDisp, theCmap, &check_col);
-+ screen_set[ci][i] =
-+ (((unsigned short *)&check_col.red)[ci] >> 8) & 0xff;
-+ XSetForeground(theDisp, check_gc, check_col.pixel);
-+ XDrawPoint(theDisp, check_map, check_gc, 0, 0);
-+ check_image = XGetImage(theDisp, check_map, 0, 0, 1, 1,
-+ AllPlanes, ZPixmap);
-+ if (check_image) {
-+ switch (check_image->bits_per_pixel) {
-+ case 8:
-+ screen_rgb[ci][i] = *(CARD8 *)check_image->data;
-+ break;
-+ case 16:
-+ screen_rgb[ci][i] = *(CARD16 *)check_image->data;
-+ break;
-+ case 24:
-+ screen_rgb[ci][i] =
-+ ((unsigned long)*(CARD8 *)check_image->data << 16) |
-+ ((unsigned long)*(CARD8 *)(check_image->data + 1) << 8) |
-+ (unsigned long)*(CARD8 *)(check_image->data + 2);
-+ break;
-+ case 32:
-+ screen_rgb[ci][i] = *(CARD32 *)check_image->data;
-+ break;
-+ }
-+ XDestroyImage(check_image);
-+ }
-+ }
-+ }
-+ XFreeGC(theDisp, check_gc);
-+ XFreePixmap(theDisp, check_map);
-+}
-+
-+
-+/* The following switch should better be provided at runtime for
-+ * comparison purposes.
-+ * At the moment it's only compile time, unfortunately.
-+ * Who can make adaptions for use as a runtime switch by a menu option?
-+ */
-+
-+#define DO_FIXPIX_SMOOTH
-+
-+#ifdef DO_FIXPIX_SMOOTH
-+
-+/* The following code is based in part on:
-+ *
-+ * jquant1.c
-+ *
-+ * Copyright (C) 1991-1996, Thomas G. Lane.
-+ * This file is part of the Independent JPEG Group's software.
-+ * For conditions of distribution and use, see the accompanying README file.
-+ *
-+ * This file contains 1-pass color quantization (color mapping) routines.
-+ * These routines provide mapping to a fixed color map using equally spaced
-+ * color values. Optional Floyd-Steinberg or ordered dithering is available.
-+ */
-+
-+/* Declarations for Floyd-Steinberg dithering.
-+ *
-+ * Errors are accumulated into the array fserrors[], at a resolution of
-+ * 1/16th of a pixel count. The error at a given pixel is propagated
-+ * to its not-yet-processed neighbors using the standard F-S fractions,
-+ * ... (here) 7/16
-+ * 3/16 5/16 1/16
-+ * We work left-to-right on even rows, right-to-left on odd rows.
-+ *
-+ * We can get away with a single array (holding one row's worth of errors)
-+ * by using it to store the current row's errors at pixel columns not yet
-+ * processed, but the next row's errors at columns already processed. We
-+ * need only a few extra variables to hold the errors immediately around the
-+ * current column. (If we are lucky, those variables are in registers, but
-+ * even if not, they're probably cheaper to access than array elements are.)
-+ *
-+ * We provide (#columns + 2) entries per component; the extra entry at each
-+ * end saves us from special-casing the first and last pixels.
-+ */
-+
-+typedef INT16 FSERROR; /* 16 bits should be enough */
-+typedef int LOCFSERROR; /* use 'int' for calculation temps */
-+
-+typedef struct { byte *colorset;
-+ FSERROR *fserrors;
-+ } FSBUF;
-+
-+/* Floyd-Steinberg initialization function.
-+ *
-+ * It is called 'fs2_init' since it's specialized for our purpose and
-+ * could be embedded in a more general FS-package.
-+ *
-+ * Returns a malloced FSBUF pointer which has to be passed as first
-+ * parameter to subsequent 'fs2_dither' calls.
-+ * The FSBUF structure does not need to be referenced by the calling
-+ * application, it can be treated from the app like a void pointer.
-+ *
-+ * The current implementation does only require to free() this returned
-+ * pointer after processing.
-+ *
-+ * Returns NULL if malloc fails.
-+ *
-+ * NOTE: The FSBUF structure is designed to allow the 'fs2_dither'
-+ * function to work with an *arbitrary* number of color components
-+ * at runtime! This is an enhancement over the IJG code base :-).
-+ * Only fs2_init() specifies the (maximum) number of components.
-+ */
-+
-+static FSBUF *fs2_init(width)
-+int width;
-+{
-+ FSBUF *fs;
-+ FSERROR *p;
-+
-+ fs = (FSBUF *)
-+ malloc(sizeof(FSBUF) * 3 + ((size_t)width + 2) * sizeof(FSERROR) * 3);
-+ if (fs == 0) return fs;
-+
-+ fs[0].colorset = screen_set[0];
-+ fs[1].colorset = screen_set[1];
-+ fs[2].colorset = screen_set[2];
-+
-+ p = (FSERROR *)(fs + 3);
-+ memset(p, 0, ((size_t)width + 2) * sizeof(FSERROR) * 3);
-+
-+ fs[0].fserrors = p;
-+ fs[1].fserrors = p + 1;
-+ fs[2].fserrors = p + 2;
-+
-+ return fs;
-+}
-+
-+/* Floyd-Steinberg dithering function.
-+ *
-+ * NOTE:
-+ * (1) The image data referenced by 'ptr' is *overwritten* (input *and*
-+ * output) to allow more efficient implementation.
-+ * (2) Alternate FS dithering is provided by the sign of 'nc'. Pass in
-+ * a negative value for right-to-left processing. The return value
-+ * provides the right-signed value for subsequent calls!
-+ * (3) This particular implementation assumes *no* padding between lines!
-+ * Adapt this if necessary.
-+ */
-+
-+static int fs2_dither(fs, ptr, nc, num_rows, num_cols)
-+FSBUF *fs;
-+byte *ptr;
-+int nc, num_rows, num_cols;
-+{
-+ int abs_nc, ci, row, col;
-+ LOCFSERROR delta, cur, belowerr, bpreverr;
-+ byte *dataptr, *colsetptr;
-+ FSERROR *errorptr;
-+
-+ if ((abs_nc = nc) < 0) abs_nc = -abs_nc;
-+ for (row = 0; row < num_rows; row++) {
-+ for (ci = 0; ci < abs_nc; ci++, ptr++) {
-+ dataptr = ptr;
-+ colsetptr = fs[ci].colorset;
-+ errorptr = fs[ci].fserrors;
-+ if (nc < 0) {
-+ dataptr += (num_cols - 1) * abs_nc;
-+ errorptr += (num_cols + 1) * abs_nc;
-+ }
-+ cur = belowerr = bpreverr = 0;
-+ for (col = 0; col < num_cols; col++) {
-+ cur += errorptr[nc];
-+ cur += 8; cur >>= 4;
-+ if ((cur += *dataptr) < 0) cur = 0;
-+ else if (cur > 255) cur = 255;
-+ *dataptr = cur & 0xff;
-+ cur -= colsetptr[cur];
-+ delta = cur << 1; cur += delta;
-+ bpreverr += cur; cur += delta;
-+ belowerr += cur; cur += delta;
-+ errorptr[0] = (FSERROR)bpreverr;
-+ bpreverr = belowerr;
-+ belowerr = delta >> 1;
-+ dataptr += nc;
-+ errorptr += nc;
-+ }
-+ errorptr[0] = (FSERROR)bpreverr;
-+ }
-+ ptr += (num_cols - 1) * abs_nc;
-+ nc = -nc;
-+ }
-+ return nc;
-+}
-+
-+#endif /* DO_FIXPIX_SMOOTH */
-+
-
- #define DO_CROP 0
- #define DO_ZOOM 1
-
-
- /***********************************/
- void Resize(w,h)
- int w,h;
- {
- RANGE(w,1,maxWIDE); RANGE(h,1,maxHIGH);
-
- if (HaveSelection()) DrawSelection(0); /* turn off old rect */
-
- if (psUp) PSResize(); /* if PSDialog is open, mention size change */
-
- /* if same size, and Ximage created, do nothing */
- if (w==eWIDE && h==eHIGH && theImage!=NULL) return;
-
- if (DEBUG) fprintf(stderr,"Resize(%d,%d) eSIZE=%d,%d cSIZE=%d,%d\n",
- w,h,eWIDE,eHIGH,cWIDE,cHIGH);
-@@ -1866,156 +2128,145 @@
- if (!xim) FatalError("couldn't create xim!");
-
- imagedata = (byte *) malloc((size_t) (xim->bytes_per_line * high));
- if (!imagedata) FatalError("couldn't malloc imagedata");
-
- xim->data = (char *) imagedata;
- floydDitherize1(xim, pic24,PIC24, (int) wide, (int) high, NULL,NULL,NULL);
-
- return xim;
- }
-
-
-
-
- if (theVisual->class == TrueColor || theVisual->class == DirectColor) {
-
- /************************************************************************/
- /* Non-ColorMapped Visuals: TrueColor, DirectColor */
- /************************************************************************/
-
-- unsigned long r, g, b, rmask, gmask, bmask, xcol;
-- int rshift, gshift, bshift, bperpix, bperline, border, cshift;
-- int maplen;
-+ unsigned long xcol;
-+ int bperpix, bperline;
- byte *imagedata, *lip, *ip, *pp;
-
-
-- /* compute various shifting constants that we'll need... */
--
-- rmask = theVisual->red_mask;
-- gmask = theVisual->green_mask;
-- bmask = theVisual->blue_mask;
--
-- rshift = 7 - highbit(rmask);
-- gshift = 7 - highbit(gmask);
-- bshift = 7 - highbit(bmask);
--
-- maplen = theVisual->map_entries;
-- if (maplen>256) maplen=256;
-- cshift = 7 - highbit((u_long) (maplen-1));
--
- xim = XCreateImage(theDisp, theVisual, dispDEEP, ZPixmap, 0, NULL,
- wide, high, 32, 0);
- if (!xim) FatalError("couldn't create X image!");
-
- bperline = xim->bytes_per_line;
- bperpix = xim->bits_per_pixel;
-- border = xim->byte_order;
-
- imagedata = (byte *) malloc((size_t) (high * bperline));
- if (!imagedata) FatalError("couldn't malloc imagedata");
-
- xim->data = (char *) imagedata;
-
- if (bperpix != 8 && bperpix != 16 && bperpix != 24 && bperpix != 32) {
- char buf[128];
- sprintf(buf,"Sorry, no code written to handle %d-bit %s",
- bperpix, "TrueColor/DirectColor displays!");
- FatalError(buf);
- }
-
-+ screen_init();
-
-- lip = imagedata; pp = pic24;
-- for (i=0; i<high; i++, lip+=bperline) {
-- for (j=0, ip=lip; j<wide; j++) {
-- r = *pp++; g = *pp++; b = *pp++;
--
-- /* shift r,g,b so that high bit of 8-bit color specification is
-- * aligned with high bit of r,g,b-mask in visual,
-- * AND each component with its mask,
-- * and OR the three components together
-- */
--
-- if (theVisual->class == DirectColor) {
-- r = (u_long) directConv[(r>>cshift) & 0xff] << cshift;
-- g = (u_long) directConv[(g>>cshift) & 0xff] << cshift;
-- b = (u_long) directConv[(b>>cshift) & 0xff] << cshift;
-- }
--
--
-- /* shift the bits around */
-- if (rshift<0) r = r << (-rshift);
-- else r = r >> rshift;
--
-- if (gshift<0) g = g << (-gshift);
-- else g = g >> gshift;
--
-- if (bshift<0) b = b << (-bshift);
-- else b = b >> bshift;
--
-- r = r & rmask;
-- g = g & gmask;
-- b = b & bmask;
--
-- xcol = r | g | b;
--
-- if (bperpix == 32) {
-- if (border == MSBFirst) {
-- *ip++ = (xcol>>24) & 0xff;
-- *ip++ = (xcol>>16) & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = xcol & 0xff;
-- }
-- else { /* LSBFirst */
-- *ip++ = xcol & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = (xcol>>16) & 0xff;
-- *ip++ = (xcol>>24) & 0xff;
-+#ifdef DO_FIXPIX_SMOOTH
-+#if 0
-+ /* If we wouldn't have to save the original pic24 image data,
-+ * the following code would do the dither job by overwriting
-+ * the image data, and the normal render code would then work
-+ * without any change on that data.
-+ * Unfortunately, this approach would hurt the xv assumptions...
-+ */
-+ if (bperpix < 24) {
-+ FSBUF *fs = fs2_init(wide);
-+ if (fs) {
-+ fs2_dither(fs, pic24, 3, high, wide);
-+ free(fs);
-+ }
-+ }
-+#else
-+ /* ...so we have to take a different approach with linewise
-+ * dithering/rendering in a loop using a temporary line buffer.
-+ */
-+ if (bperpix < 24) {
-+ FSBUF *fs = fs2_init(wide);
-+ if (fs) {
-+ byte *row_buf = malloc((size_t)wide * 3);
-+ if (row_buf) {
-+ int nc = 3;
-+ byte *picp = pic24; lip = imagedata;
-+ for (i=0; i<high; i++, lip+=bperline, picp+=(size_t)wide*3) {
-+ memcpy(row_buf, picp, (size_t)wide * 3);
-+ nc = fs2_dither(fs, row_buf, nc, 1, wide);
-+ for (j=0, ip=lip, pp=row_buf; j<wide; j++) {
-+
-+ xcol = screen_rgb[0][*pp++];
-+ xcol |= screen_rgb[1][*pp++];
-+ xcol |= screen_rgb[2][*pp++];
-+
-+ switch (bperpix) {
-+ case 8:
-+ *ip++ = xcol & 0xff;
-+ break;
-+ case 16:
-+ *((CARD16 *)ip)++ = (CARD16)xcol;
-+ break;
-+ }
-+ }
- }
-- }
-+ free(row_buf);
-+ free(fs);
-
-- else if (bperpix == 24) {
-- if (border == MSBFirst) {
-- *ip++ = (xcol>>16) & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = xcol & 0xff;
-- }
-- else { /* LSBFirst */
-- *ip++ = xcol & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = (xcol>>16) & 0xff;
-- }
-+ return xim;
- }
-+ free(fs);
-+ }
-+ }
-+#endif
-+#endif
-
-- else if (bperpix == 16) {
-- if (border == MSBFirst) {
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = xcol & 0xff;
-- }
-- else { /* LSBFirst */
-- *ip++ = xcol & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- }
-- }
-+ lip = imagedata; pp = pic24;
-+ for (i=0; i<high; i++, lip+=bperline) {
-+ for (j=0, ip=lip; j<wide; j++) {
-
-- else if (bperpix == 8) {
-- *ip++ = xcol & 0xff;
-+ xcol = screen_rgb[0][*pp++];
-+ xcol |= screen_rgb[1][*pp++];
-+ xcol |= screen_rgb[2][*pp++];
-+
-+ switch (bperpix) {
-+ case 8:
-+ *ip++ = xcol & 0xff;
-+ break;
-+ case 16:
-+ *((CARD16 *)ip)++ = (CARD16)xcol;
-+ break;
-+ case 24:
-+ *ip++ = (xcol >> 16) & 0xff;
-+ *ip++ = (xcol >> 8) & 0xff;
-+ *ip++ = xcol & 0xff;
-+ break;
-+ case 32:
-+ *((CARD32 *)ip)++ = (CARD32)xcol;
-+ break;
- }
- }
- }
- }
-
- else {
-
- /************************************************************************/
- /* CMapped Visuals: PseudoColor, GrayScale, StaticGray, StaticColor... */
- /************************************************************************/
-
- byte *pic8;
- int bwdith;
-
- /* in all cases, make an 8-bit version of the image, either using
- 'black' and 'white', or the stdcmap */
-
- bwdith = 0;
-
- if (ncols == 0 && dispDEEP != 1) { /* do 'black' and 'white' dither */
diff --git a/graphics/xv/files/patch-af b/graphics/xv/files/patch-af
deleted file mode 100644
index eb55dc32ef5c..000000000000
--- a/graphics/xv/files/patch-af
+++ /dev/null
@@ -1,58 +0,0 @@
---- xv.c.orig Sat Mar 8 16:29:05 1997
-+++ xv.c Sat Mar 8 16:38:48 1997
-@@ -3197,9 +3197,17 @@
- hints.flags = 0;
- if ((i&XValue || i&YValue)) hints.flags = USPosition;
-
-- if (i&XValue && i&XNegative) x = vrWIDE - eWIDE - abs(x);
-- if (i&YValue && i&YNegative) y = vrHIGH - eHIGH - abs(y);
--
-+ hints.win_gravity = NorthWestGravity;
-+ if (i&XValue && i&XNegative) {
-+ hints.win_gravity = NorthEastGravity;
-+ x = vrWIDE - (eWIDE + 2 * bwidth) - abs(x);
-+ }
-+ if (i&YValue && i&YNegative) {
-+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
-+ SouthWestGravity : SouthEastGravity;
-+ y = vrHIGH - (eHIGH + 2 * bwidth) - abs(y);
-+ }
-+
- if (x+eWIDE > vrWIDE) x = vrWIDE - eWIDE; /* keep on screen */
- if (y+eHIGH > vrHIGH) y = vrHIGH - eHIGH;
-
-@@ -3218,7 +3226,7 @@
- hints.x = x; hints.y = y;
- hints.width = eWIDE; hints.height = eHIGH;
- hints.max_width = maxWIDE; hints.max_height = maxHIGH;
-- hints.flags |= USSize | PMaxSize;
-+ hints.flags |= USSize | PMaxSize | PWinGravity;
-
- xswa.bit_gravity = StaticGravity;
- xswa.background_pixel = bg;
-@@ -3267,10 +3275,6 @@
- }
- }
-
--
-- XSetStandardProperties(theDisp,mainW,"","",None,NULL,0,&hints);
-- setWinIconNames(name);
--
- xwmh.input = True;
- xwmh.flags = InputHint;
-
-@@ -3295,12 +3299,12 @@
- }
- }
- }
-- XSetWMHints(theDisp, mainW, &xwmh);
-
- classh.res_name = "xv";
- classh.res_class = "XVroot";
-- XSetClassHint(theDisp, mainW, &classh);
-
-+ XmbSetWMProperties(theDisp, mainW, NULL, NULL, NULL, 0, &hints, &xwmh, &classh);
-+ setWinIconNames(name);
-
- if (nodecor) { /* turn of image window decorations (in MWM) */
- Atom mwm_wm_hints;
diff --git a/graphics/xv/files/patch-ag b/graphics/xv/files/patch-ag
deleted file mode 100644
index e5c99aa5334e..000000000000
--- a/graphics/xv/files/patch-ag
+++ /dev/null
@@ -1,47 +0,0 @@
---- xvmisc.c.orig Fri Jan 13 23:41:34 1995
-+++ xvmisc.c Sat Mar 8 16:05:19 1997
-@@ -97,10 +97,18 @@
- if (!usesize || !(i&WidthValue)) w = defw;
- if (!usesize || !(i&HeightValue)) h = defh;
-
-- hints.flags |= USSize;
-+ hints.flags |= USSize | PWinGravity;
-
-- if (i&XValue && i&XNegative) x = dispWIDE - w - abs(x);
-- if (i&YValue && i&YNegative) y = dispHIGH - h - abs(y);
-+ hints.win_gravity = NorthWestGravity;
-+ if (i&XValue && i&XNegative) {
-+ hints.win_gravity = NorthEastGravity;
-+ x = dispWIDE - (w + 2 * bwidth) - abs(x);
-+ }
-+ if (i&YValue && i&YNegative) {
-+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
-+ SouthWestGravity : SouthEastGravity;
-+ y = dispHIGH - (h + 2 * bwidth) - abs(y);
-+ }
-
-
- #define VROOT_TRANS
-@@ -136,19 +144,18 @@
- if (!win) return(win); /* leave immediately if couldn't create */
-
-
-- XSetStandardProperties(theDisp, win, name, name, None, NULL, 0, &hints);
--
- xwmh.input = True;
- xwmh.flags = InputHint;
- if (iconPix) { xwmh.icon_pixmap = iconPix; xwmh.flags |= IconPixmapHint; }
-- XSetWMHints(theDisp, win, &xwmh);
-
- if (clname && strlen(clname)) {
- classh.res_name = "xv";
- classh.res_class = clname;
-- XSetClassHint(theDisp, win, &classh);
- StoreDeleteWindowProp(win);
- }
-+
-+ XmbSetWMProperties(theDisp, win, name, name, NULL, 0, &hints, &xwmh,
-+ clname ? &classh : NULL);
-
- return(win);
- }
diff --git a/graphics/xv/files/patch-ac b/graphics/xv/files/patch-config.h
index eadf0014f223..5d36a12b5046 100644
--- a/graphics/xv/files/patch-ac
+++ b/graphics/xv/files/patch-config.h
@@ -1,19 +1,11 @@
--- config.h.orig Thu Aug 27 04:50:47 1998
+++ config.h Thu Aug 27 04:51:05 1998
-@@ -13,7 +13,7 @@
- * definition appropriately. (use 'which gunzip' to find if you have gunzip,
- * and where it lives)
- */
--#undef USE_GUNZIP
-+#define USE_GUNZIP
-
- #ifdef USE_GUNZIP
- # ifdef VMS
-@@ -103,9 +103,9 @@
+@@ -103,10 +103,9 @@
* should not need to be changed
*/
-/* #define GS_PATH "/usr/local/bin/gs" */
+-#define GS_PATH "gs"
-/* #define GS_LIB "." */
-/* #define GS_DEV "ppmraw" */
+#define GS_PATH "%%LOCALBASE%%/bin/gs"
diff --git a/graphics/xv/files/patch-suse-2003-01-27 b/graphics/xv/files/patch-suse-2003-01-27
deleted file mode 100644
index 60cee57cd57d..000000000000
--- a/graphics/xv/files/patch-suse-2003-01-27
+++ /dev/null
@@ -1,675 +0,0 @@
---- xv.c
-+++ xv.c 2003-01-27 00:03:36.000000000 +0100
-@@ -146,9 +146,7 @@
- rmodeset, gamset, cgamset, perfect, owncmap, rwcolor, stdcmap;
- int nodecor;
- double gamval, rgamval, ggamval, bgamval;
--
--
--
-+winRepositionningInfoST winRepositionningInfo = { 0, 0};
-
- /*******************************************/
- int main(argc, argv)
-@@ -2125,6 +2145,7 @@
- /* if the file is STDIN, write it out to a temp file */
-
- if (strcmp(filename,STDINSTR)==0) {
-+ int tmpfd;
- FILE *fp;
-
- #ifndef VMS
-@@ -2135,11 +2156,15 @@
- mktemp(filename);
-
- clearerr(stdin);
-- fp = fopen(filename,"w");
-+ tmpfd = open(filename,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) FatalError("openPic(): can't create temporary file");
-+ fp = fdopen(tmpfd,"w");
- if (!fp) FatalError("openPic(): can't write temporary file");
-
- while ( (i=getchar()) != EOF) putc(i,fp);
-+ fflush(fp);
- fclose(fp);
-+ close(tmpfd);
-
- /* and remove it from list, since we can never reload from stdin */
- if (strcmp(namelist[0], STDINSTR)==0) deleteFromList(0);
-@@ -2672,7 +2697,11 @@
- to generate the correct exposes (particularly with 'BitGravity' turned
- on */
-
-- if (mainW && !useroot) GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
-+ /*Brian T. Schellenberger: fix for X 4.2 refresh problem*/
-+ if (mainW && !useroot) {
-+ XSync(theDisp, False);
-+ GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
-+ }
-
- return 1;
-
-@@ -2812,7 +2846,8 @@
-
- #ifdef GS_PATH
- else if (strncmp((char *) magicno, "%!", (size_t) 2)==0 ||
-- strncmp((char *) magicno, "\004%!", (size_t) 3)==0) rv = RFT_PS;
-+ strncmp((char *) magicno, "\004%!", (size_t) 3)==0 ||
-+ strncmp((char *) magicno, "%PDF", (size_t) 4)==0) rv = RFT_PS;
- #endif
-
- #ifdef HAVE_MAG
-@@ -2959,6 +2998,7 @@
- returns '0' on failure */
-
- char namez[128], *fname, buf[512];
-+ int tmpfd;
-
- fname = name;
- namez[0] = '\0';
-@@ -3047,15 +3090,18 @@
- char *src, *dst;
- {
- char tmpname[128], buffer[8192]; /* XXX */
-- int n, eof;
-+ int n, eof, tmpfd;
- FILE *sfp, *dfp;
-
- sprintf(dst, "%s/xvmXXXXXX", tmpdir);
- mktemp(dst);
-+ tmpfd = open(dst,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) FatalError("RemoveMacbinary(): can't create temporary file");
-+
- SetISTR(ISTR_INFO, "Removing MacBinary...");
-
- sfp = xv_fopen(src, "r");
-- dfp = xv_fopen(dst, "w");
-+ dfp = fdopen(tmpfd, "w");
- if (!sfp || !dfp) {
- SetISTR(ISTR_INFO, "Unable to remove a InfoFile header form '%s'.", src);
- Warning();
-@@ -3067,7 +3113,9 @@
- if (eof = feof(sfp))
- fwrite(buffer, 1, n, dfp);
- fclose(sfp);
-+ fflush(dfp);
- fclose(dfp);
-+ close(tmpfd);
- if (!eof) {
- SetISTR(ISTR_INFO, "Unable to remove a InfoFile header form '%s'.", src);
- Warning();
-@@ -3199,7 +3247,7 @@
- */
-
- char fullcmd[512], tmpname[64], str[512];
-- int i;
-+ int i, tmpfd;
-
- if (!cmd || (strlen(cmd) < (size_t) 2)) return 1;
-
-@@ -3210,6 +3258,9 @@
- ErrPopUp(str, "\nHow unlikely!");
- return 1;
- }
-+ tmpfd = open(tmpname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) FatalError("openPic(): can't create temporary file");
-+ close(tmpfd);
-
- /* build command */
- strcpy(fullcmd, cmd+1); /* skip the leading '!' character in cmd */
---- xv.h
-+++ xv.h 2003-01-27 00:03:36.000000000 +0100
-@@ -310,7 +294,9 @@
- # endif
- #endif
-
--
-+#ifndef S_IRWUSR
-+# define S_IRWUSR (S_IRUSR|S_IWRITE)
-+#endif
-
- #ifndef MAXPATHLEN
- # define MAXPATHLEN 256
-@@ -813,6 +811,13 @@
- #define WHERE
- #endif
-
-+/* Needed for repositionning with negative geometries */
-+typedef struct {
-+ int negativeX;
-+ int negativeY;
-+} winRepositionningInfoST;
-+extern winRepositionningInfoST winRepositionningInfo;
-+
- typedef unsigned char byte;
-
- typedef struct scrl {
---- xvdir.c
-+++ xvdir.c 2003-01-27 00:03:36.000000000 +0100
-@@ -80,7 +83,7 @@
- "PIC",
- #endif /* HAVE_PIC */
- #ifdef HAVE_MAKI
-- "MAKI",
-+ "MAKI (640x400 only)",
- #endif /* HAVE_MAKI */
- #ifdef HAVE_PI
- "PI",
---- xvevent.c
-+++ xvevent.c 2003-01-27 00:03:36.000000000 +0100
-@@ -64,6 +64,8 @@
-
- static void annotatePic PARM((void));
-
-+static int debkludge_offx;
-+static int debkludge_offy;
-
- /****************/
- int EventLoop()
-@@ -676,6 +694,29 @@
- p_offy = xwa.y;
- }
-
-+ /* Gather info to keep right border inside */
-+ {
-+ Window current;
-+ Window root_r;
-+ Window parent_r;
-+ Window *children_r;
-+ int nchildren_r;
-+ XWindowAttributes xwa;
-+
-+ parent_r=mainW;
-+ current=mainW;
-+ do {
-+ current=parent_r;
-+ XQueryTree(theDisp, current, &root_r, &parent_r,
-+ &children_r, &nchildren_r);
-+ if (children_r!=NULL) {
-+ XFree(children_r);
-+ }
-+ } while(parent_r!=root_r);
-+ XGetWindowAttributes(theDisp, current, &xwa);
-+ debkludge_offx=eWIDE-xwa.width+p_offx;
-+ debkludge_offy=eHIGH-xwa.height+p_offy;
-+ }
-
- /* move window around a bit... */
- {
-@@ -2078,6 +2127,26 @@
- if (xwa->width < dispWIDE && xwc.x < p_offx) xwc.x = p_offx;
- if (xwa->height < dispHIGH && xwc.y < p_offy) xwc.y = p_offy;
-
-+ /* Try to keep bottom right decorations inside */
-+ if (xwc.x+eWIDE-debkludge_offx>dispWIDE) {
-+ xwc.x=dispWIDE-eWIDE+debkludge_offx;
-+ if (xwc.x<0) xwc.x=0;
-+ }
-+ if (xwc.y+eHIGH-debkludge_offy>dispHIGH) {
-+ xwc.y=dispHIGH-eHIGH+debkludge_offy;
-+ if (xwc.y<0) xwc.y=0;
-+ }
-+
-+ /* In case of negative offset for first image */
-+ if (winRepositionningInfo.negativeX) {
-+ xwc.x+=winRepositionningInfo.negativeX;
-+ winRepositionningInfo.negativeX=0;
-+ }
-+ if (winRepositionningInfo.negativeY) {
-+ xwc.y+=winRepositionningInfo.negativeY;
-+ winRepositionningInfo.negativeY=0;
-+ }
-+
- xwc.width = xwa->width;
- xwc.height = xwa->height;
-
---- xvfits.c
-+++ xvfits.c 2003-01-27 00:03:36.000000000 +0100
-@@ -14,7 +14,7 @@
- * provided "as is" without express or implied warranty.
- */
-
--
-+#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
- #include "xv.h"
-
- #define NCARDS (36)
-@@ -223,7 +223,7 @@
- * If there was a problem writing files, then a error message will be set.
- */
-
-- int i, np=nx * ny, ioerror, nwrt;
-+ int i, np=nx * ny, ioerror, nwrt, tmpfd;
- FILE *fp;
- char *error;
- byte *work;
-@@ -246,7 +246,12 @@
-
- for (i=0; i < nz && !error; i++) {
- sprintf(filename, "%s%d", basename, i+1);
-- fp = xv_fopen(filename, "w");
-+ tmpfd = open(filename,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) {
-+ error = "Unable to open temporary file";
-+ break;
-+ }
-+ fp = fdopen(tmpfd, "w");
- if (!fp) {
- error = "Unable to open temporary file";
- break;
-@@ -254,13 +259,17 @@
-
- if (wrheader(fp, nx, ny, comment)) {
- error = "I/O error writing temporary file";
-+ fflush(fp);
- fclose(fp);
-+ close(tmpfd);
- unlink(filename);
- break;
- }
-
- nwrt = fwrite(image+i*np, sizeof(byte), (size_t) np, fp);
-+ fflush(fp);
- fclose(fp);
-+ close(tmpfd);
-
- if (nwrt == 0) { /* failed to write any data */
- error = "I/O error writing temporary file";
---- xvimage.c
-+++ xvimage.c 2003-01-27 00:03:36.000000000 +0100
-@@ -21,6 +21,7 @@
- * int LoadPad(pinfo, fname);
- */
-
-+#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
- #include "copyright.h"
-
- #include "xv.h"
-@@ -2927,7 +2930,7 @@
- char *str;
- int wide, high, opaque,omode;
- {
-- int i;
-+ int i, tmpfd;
- byte *bgpic24;
- char syscmd[512], fname[128], errstr[512];
- PICINFO pinfo;
-@@ -2949,6 +2952,13 @@
- strcpy(fname, "Sys$Disk:[]xvuXXXXXX");
- #endif
- mktemp(fname);
-+ tmpfd = open(fname, O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) {
-+ sprintf(errstr, "Error: can't create temporary file %s", fname);
-+ ErrPopUp(errstr, "\nDoh!");
-+ return 0;
-+ }
-+ close(tmpfd);
-
- /* run bggen to generate the background */
- sprintf(syscmd, "bggen -g %dx%d %s > %s", wide, high, str, fname);
---- xvmaki.c
-+++ xvmaki.c 2003-01-27 00:03:36.000000000 +0100
-@@ -355,8 +355,12 @@
- return -1;
- }
-
-- if(w != 640 || h != 400)
-+ if(w != 640 || h != 400) {
-+ char str[512];
-+ sprintf(str,"MAKI: %s Should be 640x400", maki_msgs[MAKI_SIZE]);
-+ ErrPopUp(str, "\nBummer!");
- maki_error(mi, MAKI_SIZE);
-+ }
-
- maki.fp = fp;
- maki.width = w;
-@@ -669,6 +673,7 @@
- static void maki_init_info(mi)
- struct maki_info *mi;
- {
-+ xvbzero((char *)mi, sizeof(struct maki_info));
- mi->fp = NULL;
- mi->fsize = 0;
- mi->x0 = mi->y0 = mi->x1 = mi->y1 = 0;
---- xvpds.c
-+++ xvpds.c 2003-01-27 00:03:36.000000000 +0100
-@@ -102,7 +102,7 @@
- * This software is provided "as is" without any express or implied warranty.
- */
-
--
-+#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
- #include "xv.h"
-
- #ifdef HAVE_PDS
-@@ -250,7 +250,7 @@
- {
- /* returns '1' on success, '0' on failure */
-
-- int tempnum;
-+ int tempnum, tmpfd;
- FILE *zf;
- static int isfixed,teco,i,j,itype,vaxbyte,
- recsize,hrecsize,irecsize,isimage,labelrecs,labelsofar,
-@@ -690,6 +690,12 @@
- #ifndef VMS
- sprintf(pdsuncompfname,"%s/xvhuffXXXXXX", tmpdir);
- mktemp(pdsuncompfname);
-+ tmpfd = open(pdsuncompfname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) {
-+ SetISTR(ISTR_WARNING,"Unable to create temporarly file.");
-+ return 0;
-+ }
-+ close(tmpfd);
- sprintf(scanbuff,"%s %s - 4 >%s",PDSUNCOMP,fname,pdsuncompfname);
- #else
- strcpy(pdsuncompfname,"sys$disk:[]xvhuffXXXXXX");
---- xvps.c
-+++ xvps.c 2003-01-27 00:03:36.000000000 +0100
-@@ -1564,7 +1564,7 @@
- /* build command string */
-
- #ifndef VMS /* VMS needs quotes around mixed case command lines */
-- sprintf(tmp, "%s -sDEVICE=%s -r%d -q -dNOPAUSE -sOutputFile=%s%%d ",
-+ sprintf(tmp, "%s -sDEVICE=%s -r%d -q -dSAFER -dNOPAUSE -sOutputFile=%s%%d ",
- GS_PATH, gsDev, gsRes, tmpname);
- #else
- sprintf(tmp,
---- xvtiff.c
-+++ xvtiff.c 2003-01-27 00:03:36.000000000 +0100
-@@ -5,6 +5,7 @@
- * LoadTIFF(fname, numcols, quick) - load a TIFF file
- */
-
-+#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
- #ifndef va_start
- # define NEEDSARGS
- #endif
-@@ -56,7 +89,7 @@
- return 0;
- }
-
-- fseek(fp, 0L, 2);
-+ fseek(fp, 0L, SEEK_END);
- filesize = ftell(fp);
- fclose(fp);
-
-@@ -1065,7 +1308,7 @@
- int fromskew, toskew;
- {
- while (h-- > 0) {
-- UNROLL8(w,0, *cp++ = PALmap[*pp++][0]);
-+ UNROLL8(w,, *cp++ = PALmap[*pp++][0]);
- cp += toskew;
- pp += fromskew;
- }
-@@ -1262,7 +1504,7 @@
- }
- } else {
- while (h-- > 0) {
-- UNROLL8(w,0,
-+ UNROLL8(w,,
- *cp++ = pp[0];
- *cp++ = pp[1];
- *cp++ = pp[2];
-@@ -1335,7 +1577,7 @@
- }
- } else {
- while (h-- > 0) {
-- UNROLL8(w,0,
-+ UNROLL8(w,,
- *cp++ = *r++;
- *cp++ = *g++;
- *cp++ = *b++;
---- xvtiffwr.c
-+++ xvtiffwr.c 2003-01-27 00:03:36.000000000 +0100
-@@ -78,6 +78,9 @@
- TIFFSetField(tif, TIFFTAG_GROUP3OPTIONS,
- GROUP3OPT_2DENCODING+GROUP3OPT_FILLBITS);
-
-+ if (comp == COMPRESSION_LZW)
-+ TIFFSetField(tif, TIFFTAG_PREDICTOR, 2);
-+
- TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
- TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
- TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
---- xvvd.c
-+++ xvvd.c 2003-01-27 00:03:36.000000000 +0100
-@@ -793,7 +794,7 @@
- returns '0' on failure */
-
- char namez[128], *fname, buf[512], tmp[HEADERSIZE];
-- int n;
-+ int n, tmpfd;
- FILE *pfp, *tfp;
-
- fname = name;
-@@ -834,10 +835,17 @@
- Warning();
- return 0;
- }
-- if ((tfp = fopen(uncompname, "w")) == NULL) {
-+ if ((tmpfd = open(uncompname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR)) < 0) {
-+ SetISTR(ISTR_INFO, "Unable to create temporarly file.",
-+ BaseName(uncompname));
-+ Warning();
-+ pclose(pfp);
-+ }
-+ if ((tfp = fdopen(tmpfd, "w")) == NULL) {
- SetISTR(ISTR_INFO, "Unable to create temporarly file.",
- BaseName(uncompname));
- Warning();
-+ close(tmpfd);
- pclose(pfp);
- return 0;
- }
-@@ -846,11 +854,15 @@
- BaseName(fname));
- Warning();
- pclose(pfp);
-+ fflush(tfp);
- fclose(tfp);
-+ close(tmpfd);
- return 0;
- }
- fwrite(tmp, 1, n, tfp);
-+ fflush(tfp);
- fclose(tfp);
-+ close(tmpfd);
- pclose(pfp);
-
- /* if we renamed the file to end with a .Z for the sake of 'uncompress',
---- xvxpm.c
-+++ xvxpm.c 2003-01-27 00:03:36.000000000 +0100
-@@ -77,96 +77,104 @@
- hentry *clmp; /* colormap hash-table */
- hentry *c_sptr; /* cmap hash-table search pointer*/
- XColor col;
--
-+
- bname = BaseName(fname);
- fp = fopen(fname, "r");
- if (!fp)
- return (XpmLoadError(bname, "couldn't open file"));
--
-+
- if (DEBUG)
- printf("LoadXPM(): Loading xpm from %s\n", fname);
--
-+
- fseek(fp, 0L, 2);
- filesize = ftell(fp);
- fseek(fp, 0L, 0);
--
-+
- bufchar = -2;
- in_quote = FALSE;
--
-+
- /* Read in the values line. It is the first string in the
- * xpm, and contains four numbers. w, h, num_colors, and
- * chars_per_pixel. */
--
-+
- /* First, get to the first string */
- while (((c = XpmGetc(fp))!=EOF) && (c != '"')) ;
- line_pos = 0;
--
-+
- /* Now, read in the string */
- while (((c = XpmGetc(fp))!=EOF) && (line_pos < VALUES_LEN) && (c != '"')) {
- values[line_pos++] = c;
- }
- if (c != '"')
- return (XpmLoadError(bname, "error parsing values line"));
--
-+
- values[line_pos] = '\0';
- sscanf(values, "%d%d%d%d", &w, &h, &nc, &cpp);
- if (nc <= 0 || cpp <= 0)
- return (XpmLoadError(bname, "No colours in Xpm?"));
--
-+
- if (nc > 256)
- pinfo->type = PIC24;
- else
- pinfo->type = PIC8;
--
-+
- if (DEBUG)
- printf("LoadXPM(): reading a %dx%d image (%d colors)\n", w, h, nc);
--
-+
- /* We got this far... */
- WaitCursor();
--
-+
- if (!hash_init(nc))
- return (XpmLoadError(bname, "Not enough memory to hash colormap"));
--
-+
- clmp = (hentry *) malloc(nc * sizeof(hentry)); /* Holds the colormap */
- if (pinfo->type == PIC8) pic = (byte *) malloc((size_t) (w*h));
- else pic = (byte *) malloc((size_t) (w*h*3));
--
-+
- if (!clmp || !pic)
- return (XpmLoadError(bname, "Not enough memory to load pixmap"));
--
-+
- c_sptr = clmp;
- i_sptr = pic;
--
-+
- /* initialize the 'hex' array for zippy ASCII-hex -> int conversion */
--
-+
- for (i = 0 ; i < 256 ; i++) hex[i] = 0;
- for (i = '0'; i <= '9' ; i++) hex[i] = i - '0';
- for (i = 'a'; i <= 'f' ; i++) hex[i] = i - 'a' + 10;
- for (i = 'A'; i <= 'F' ; i++) hex[i] = i - 'A' + 10;
--
-+
- /* Again, we've made progress. */
- WaitCursor();
--
-+
- /* Now, we need to read the colormap. */
- pinfo->colType = F_BWDITHER;
- for (i = 0 ; i < nc ; i++) {
- while (((c = XpmGetc(fp))!=EOF) && (c != '"')) ;
- if (c != '"')
- return (XpmLoadError(bname, "Error reading colormap"));
--
-+
- for (j = 0 ; j < cpp ; j++)
- c_sptr->token[j] = XpmGetc(fp);
- c_sptr->token[j] = '\0';
--
-+
- while (((c = XpmGetc(fp))!=EOF) && ((c == ' ') || (c == '\t'))) ;
- if (c == EOF) /* The failure condition of getc() */
- return (XpmLoadError(bname, "Error parsing colormap line"));
--
-+
- do {
- char key[3];
-- char color[40]; /* Need to figure a good size for this... */
-+ char color[80]; /* Need to figure a good size for this... */
- short hd; /* Hex digits per R, G, or B */
--
-+
-+/*
-+ * Problem with spaces in color names
-+ *
-+ * X s Color Name m Other Name c Last Name
-+ *
-+ * ... this parser doesn't find `Any Name'
-+ */
-+
- for (j=0; j<2 && (c != ' ') && (c != '\t') && (c != EOF); j++) {
- key[j] = c;
- c = XpmGetc(fp);
-@@ -177,7 +185,7 @@
- if (c == EOF) /* The failure condition of getc() */
- return (XpmLoadError(bname, "Error parsing colormap line"));
-
-- for (j=0; j<39 && (c!=' ') && (c!='\t') && (c!='"') && c!=EOF; j++) {
-+ for (j=0; j<79 && (c!=' ') && (c!='\t') && (c!='"') && c!=EOF; j++) {
- color[j] = c;
- c = XpmGetc(fp);
- }
-@@ -236,13 +244,13 @@
- else { /* 'None' or unrecognized color spec */
- int rgb;
-
-- if (strcmp(color, "None") == 0) rgb = 0xb2c0dc; /* infobg */
-+ if (strcasecmp(color, "None") == 0) rgb = 0xb2c0dc; /* infobg */
- else {
- SetISTR(ISTR_INFO, "%s: unknown color spec '%s'", bname, color);
- Timer(1000);
- rgb = 0x808080;
- }
--
-+
- if (pinfo->type == PIC8) {
- pinfo->r[i] = (rgb>>16) & 0xff;
- pinfo->g[i] = (rgb>> 8) & 0xff;
-@@ -309,28 +317,29 @@
- *i_sptr++ = mapentry->cv_rgb[2];
- }
- } /* for ( j < w ) */
-- (void)XpmGetc(fp); /* Throw away the close " */
--
-+ while (((c = XpmGetc(fp))!=EOF) && /* Throw away the close " and */
-+ (c != '"')) ; /* erase all remaining pixels */
-+
- if (!(i%7)) WaitCursor();
- } /* for ( i < h ) */
--
-+
- pinfo->pic = pic;
- pinfo->normw = pinfo->w = w;
- pinfo->normh = pinfo->h = h;
- pinfo->frmType = F_XPM;
-
- if (DEBUG) printf("LoadXPM(): pinfo->colType is %d\n", pinfo->colType);
--
-+
- sprintf(pinfo->fullInfo, "Xpm v3 Pixmap (%ld bytes)", filesize);
- sprintf(pinfo->shrtInfo, "%dx%d Xpm.", w, h);
- pinfo->comment = (char *)NULL;
--
-+
- hash_destroy();
- free(clmp);
--
-+
- if (fp != stdin)
- fclose(fp);
--
-+
- return(1);
- }
-
diff --git a/graphics/xv/files/patch-suse-2004-07-28 b/graphics/xv/files/patch-suse-2004-07-28
deleted file mode 100644
index 8a230f18dc43..000000000000
--- a/graphics/xv/files/patch-suse-2004-07-28
+++ /dev/null
@@ -1,195 +0,0 @@
---- xvbmp.c
-+++ xvbmp.c Wed Jul 28 15:16:05 2004
-@@ -32,7 +32,7 @@
- static int loadBMP1 PARM((FILE *, byte *, u_int, u_int));
- static int loadBMP4 PARM((FILE *, byte *, u_int, u_int, u_int));
- static int loadBMP8 PARM((FILE *, byte *, u_int, u_int, u_int));
--static int loadBMP24 PARM((FILE *, byte *, u_int, u_int));
-+static int loadBMP24 PARM((FILE *, byte *, u_int, u_int, u_int));
- static u_int getshort PARM((FILE *));
- static u_int getint PARM((FILE *));
- static void putshort PARM((FILE *, int));
-@@ -127,7 +127,8 @@
-
-
- /* error checking */
-- if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 && biBitCount!=24) ||
-+ if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 &&
-+ biBitCount!=24 && biBitCount!=32) ||
- biPlanes!=1 || biCompression>BI_RLE4) {
-
- sprintf(buf,"Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)",
-@@ -137,7 +138,8 @@
- goto ERROR;
- }
-
-- if (((biBitCount==1 || biBitCount==24) && biCompression != BI_RGB) ||
-+ if (((biBitCount==1 || biBitCount==24 || biBitCount==32)
-+ && biCompression != BI_RGB) ||
- (biBitCount==4 && biCompression==BI_RLE8) ||
- (biBitCount==8 && biCompression==BI_RLE4)) {
-
-@@ -159,7 +161,7 @@
- }
-
- /* load up colormap, if any */
-- if (biBitCount!=24) {
-+ if (biBitCount!=24 && biBitCount!=32) {
- int i, cmaplen;
-
- cmaplen = (biClrUsed) ? biClrUsed : 1 << biBitCount;
-@@ -197,7 +199,7 @@
-
- /* create pic8 or pic24 */
-
-- if (biBitCount==24) {
-+ if (biBitCount==24 || biBitCount==32) {
- pic24 = (byte *) calloc((size_t) biWidth * biHeight * 3, (size_t) 1);
- if (!pic24) return (bmpError(bname, "couldn't malloc 'pic24'"));
- }
-@@ -212,16 +214,18 @@
- if (biBitCount == 1) rv = loadBMP1(fp,pic8,biWidth,biHeight);
- else if (biBitCount == 4) rv = loadBMP4(fp,pic8,biWidth,biHeight,
- biCompression);
-- else if (biBitCount == 8) rv = loadBMP8(fp,pic8,biWidth,biHeight,
-+ else if (biBitCount == 8) rv = loadBMP8(fp,pic8,biWidth,biHeight,
- biCompression);
-- else rv = loadBMP24(fp,pic24,biWidth,biHeight);
-+ else rv = loadBMP24(fp,pic24,biWidth,biHeight,
-+ biBitCount);
-+
-
- if (rv) bmpError(bname, "File appears truncated. Winging it.\n");
-
- fclose(fp);
-
-
-- if (biBitCount == 24) {
-+ if (biBitCount == 24 || biBitCount == 32) {
- pinfo->pic = pic24;
- pinfo->type = PIC24;
- }
-@@ -264,12 +268,13 @@
- u_int w,h;
- {
- int i,j,c,bitnum,padw;
-- byte *pp;
-+ byte *pp = pic8 + ((h - 1) * w);
-+ size_t l = w*h;
-
- c = 0;
- padw = ((w + 31)/32) * 32; /* 'w', padded to be a multiple of 32 */
-
-- for (i=h-1; i>=0; i--) {
-+ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
- pp = pic8 + (i * w);
- if ((i&0x3f)==0) WaitCursor();
- for (j=bitnum=0; j<padw; j++,bitnum++) {
-@@ -298,8 +303,8 @@
- u_int w,h,comp;
- {
- int i,j,c,c1,x,y,nybnum,padw,rv;
-- byte *pp;
--
-+ byte *pp = pic8 + ((h - 1) * w);
-+ size_t l = w*h;
-
- rv = 0;
- c = c1 = 0;
-@@ -307,7 +312,7 @@
- if (comp == BI_RGB) { /* read uncompressed data */
- padw = ((w + 7)/8) * 8; /* 'w' padded to a multiple of 8pix (32 bits) */
-
-- for (i=h-1; i>=0; i--) {
-+ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
- pp = pic8 + (i * w);
- if ((i&0x3f)==0) WaitCursor();
-
-@@ -335,7 +340,7 @@
-
- if (c) { /* encoded mode */
- c1 = getc(fp);
-- for (i=0; i<c; i++,x++,pp++)
-+ for (i=0; i<c && (pp - pic8 <= l); i++,x++,pp++)
- *pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
- }
-
-@@ -355,7 +360,7 @@
- }
-
- else { /* absolute mode */
-- for (i=0; i<c; i++, x++, pp++) {
-+ for (i=0; i<c && (pp - pic8 <= l); i++, x++, pp++) {
- if ((i&1) == 0) c1 = getc(fp);
- *pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
- }
-@@ -384,14 +389,15 @@
- u_int w,h,comp;
- {
- int i,j,c,c1,padw,x,y,rv;
-- byte *pp;
-+ byte *pp = pic8 + ((h - 1) * w);
-+ size_t l = w*h;
-
- rv = 0;
-
- if (comp == BI_RGB) { /* read uncompressed data */
- padw = ((w + 3)/4) * 4; /* 'w' padded to a multiple of 4pix (32 bits) */
-
-- for (i=h-1; i>=0; i--) {
-+ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
- pp = pic8 + (i * w);
- if ((i&0x3f)==0) WaitCursor();
-
-@@ -412,7 +418,7 @@
-
- if (c) { /* encoded mode */
- c1 = getc(fp);
-- for (i=0; i<c; i++,x++,pp++) *pp = c1;
-+ for (i=0; i<c && (pp - pic8 <= l); i++,x++,pp++) *pp = c1;
- }
-
- else { /* c==0x00 : escape codes */
-@@ -431,7 +437,7 @@
- }
-
- else { /* absolute mode */
-- for (i=0; i<c; i++, x++, pp++) {
-+ for (i=0; i<c && (pp - pic8 <= l); i++, x++, pp++) {
- c1 = getc(fp);
- *pp = c1;
- }
-@@ -454,19 +460,21 @@
-
-
- /*******************************************/
--static int loadBMP24(fp, pic24, w, h)
-+static int loadBMP24(fp, pic24, w, h, bits)
- FILE *fp;
- byte *pic24;
-- u_int w,h;
-+ u_int w,h, bits;
- {
- int i,j,padb,rv;
-- byte *pp;
-+ byte *pp = pic24 + ((h - 1) * w * 3);
-+ size_t l = w*h*3;
-
- rv = 0;
-
- padb = (4 - ((w*3) % 4)) & 0x03; /* # of pad bytes to read at EOscanline */
-+ if (bits==32) padb = 0;
-
-- for (i=h-1; i>=0; i--) {
-+ for (i=h-1; i>=0 && (pp - pic24 <= l); i--) {
- pp = pic24 + (i * w * 3);
- if ((i&0x3f)==0) WaitCursor();
-
-@@ -474,6 +482,7 @@
- pp[2] = getc(fp); /* blue */
- pp[1] = getc(fp); /* green */
- pp[0] = getc(fp); /* red */
-+ if (bits==32) getc(fp);
- pp += 3;
- }
-
diff --git a/graphics/xv/files/patch-suse-2004-08-24 b/graphics/xv/files/patch-suse-2004-08-24
deleted file mode 100644
index d49f23292c91..000000000000
--- a/graphics/xv/files/patch-suse-2004-08-24
+++ /dev/null
@@ -1,138 +0,0 @@
---- xvbmp.c
-+++ xvbmp.c Tue Aug 24 12:42:52 2004
-@@ -129,7 +129,9 @@
- /* error checking */
- if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 &&
- biBitCount!=24 && biBitCount!=32) ||
-- biPlanes!=1 || biCompression>BI_RLE4) {
-+ biPlanes!=1 || biCompression>BI_RLE4 ||
-+ biWidth<= 0 || biHeight <= 0 ||
-+ (biClrUsed && biClrUsed > (1 << biBitCount))) {
-
- sprintf(buf,"Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)",
- biBitCount, biPlanes, biCompression);
-@@ -159,6 +161,9 @@
-
- bPad = bfOffBits - (biSize + 14);
- }
-+
-+ if (biClrUsed > (1 << biBitCount))
-+ biClrUsed = (1 << biBitCount);
-
- /* load up colormap, if any */
- if (biBitCount!=24 && biBitCount!=32) {
---- xviris.c
-+++ xviris.c Tue Aug 24 13:01:42 2004
-@@ -267,6 +267,12 @@
-
- rlebuflen = 2 * xsize + 10;
- tablen = ysize * zsize;
-+
-+ if (rlebuflen <= 0 || tablen <= 0 || (tablen * sizeof(long)) < 0) {
-+ loaderr = "Bogus IRIS File!";
-+ return (byte *)NULL;
-+ }
-+
- starttab = (u_long *) malloc((size_t) tablen * sizeof(long));
- lengthtab = (u_long *) malloc((size_t) tablen * sizeof(long));
- rledat = (byte *) malloc((size_t) rlebuflen);
---- xvpcx.c
-+++ xvpcx.c Tue Aug 24 13:12:15 2004
-@@ -222,7 +222,14 @@
- byte *image;
-
- /* note: overallocation to make life easier... */
-- image = (byte *) malloc((size_t) (pinfo->h + 1) * pinfo->w + 16);
-+ int count = (pinfo->h + 1) * pinfo->w + 16;
-+
-+ if (count <= 0 || pinfo->h <= 0 || pinfo->w <= 0) {
-+ pcxError(fname, "Bogus PCX file!!");
-+ return (0);
-+ }
-+
-+ image = (byte *) malloc((size_t) count);
- if (!image) FatalError("Can't alloc 'image' in pcxLoadImage8()");
-
- xvbzero((char *) image, (size_t) ((pinfo->h+1) * pinfo->w + 16));
-@@ -250,17 +257,25 @@
- {
- byte *pix, *pic24, scale[256];
- int c, i, j, w, h, maxv, cnt, planes, bperlin, nbytes;
-+ int count;
-
- w = pinfo->w; h = pinfo->h;
-
- planes = (int) hdr[PCX_PLANES];
- bperlin = hdr[PCX_BPRL] + ((int) hdr[PCX_BPRH]<<8);
-
-+ count = w*h*planes;
-+
-+ if (count <= 0 || planes <= 0 || w <= 0 || h <= 0) {
-+ pcxError(fname, "Bogus PCX file!!");
-+ return (0);
-+ }
-+
- /* allocate 24-bit image */
-- pic24 = (byte *) malloc((size_t) w*h*planes);
-+ pic24 = (byte *) malloc((size_t) count);
- if (!pic24) FatalError("couldn't malloc 'pic24'");
-
-- xvbzero((char *) pic24, (size_t) w*h*planes);
-+ xvbzero((char *) pic24, (size_t) count);
-
- maxv = 0;
- pix = pinfo->pic = pic24;
-@@ -268,6 +283,12 @@
- j = 0; /* bytes per line, in this while loop */
- nbytes = bperlin*h*planes;
-
-+ if (nbytes < 0) {
-+ pcxError(fname, "Bogus PCX file!!");
-+ free(pic24);
-+ return (0);
-+ }
-+
- while (nbytes > 0 && (c = getc(fp)) != EOF) {
- if ((c & 0xC0) == 0xC0) { /* have a rep. count */
- cnt = c & 0x3F;
---- xvpm.c
-+++ xvpm.c Tue Aug 24 13:16:43 2004
-@@ -119,6 +119,9 @@
-
- isize = pm_isize(&thePic);
-
-+ if (isize <= 0)
-+ return pmError(bname, "Bogus PM file!!");
-+
- if (DEBUG)
- fprintf(stderr,"%s: LoadPM() - loading a %dx%d %s pic, %d planes\n",
- cmd, w, h, (thePic.pm_form==PM_I) ? "PM_I" : "PM_C",
-@@ -135,6 +138,8 @@
- return( pmError(bname, "file read error") );
- }
-
-+ if (thePic.pm_cmtsize+1 <= 0)
-+ return pmError(bname, "Bogus PM file!!");
-
- /* alloc and read in comment, if any */
- if (thePic.pm_cmtsize>0) {
-@@ -155,6 +160,9 @@
- int *intptr;
- byte *pic24, *picptr;
-
-+ if (w <= 0 || h <= 0 || w*h*3 <= 0)
-+ return pmError(bname, "Bogus PM file!!");
-+
- if ((pic24 = (byte *) malloc((size_t) w*h*3))==NULL) {
- if (thePic.pm_cmt) free(thePic.pm_cmt);
- return( pmError(bname, "unable to malloc 24-bit picture") );
-@@ -189,6 +197,9 @@
-
- else if (thePic.pm_form == PM_C && thePic.pm_np>1) {
- byte *pic24, *picptr, *rptr, *gptr, *bptr;
-+
-+ if (w <= 0 || h <= 0 || w*h*3 <= 0)
-+ return pmError(bname, "Bogus PM file!!");
-
- if ((pic24 = (byte *) malloc((size_t) w*h*3))==NULL) {
- if (thePic.pm_cmt) free(thePic.pm_cmt);
diff --git a/graphics/xv/files/patch-xv.h b/graphics/xv/files/patch-xv.h
new file mode 100644
index 000000000000..631f2cc5515e
--- /dev/null
+++ b/graphics/xv/files/patch-xv.h
@@ -0,0 +1,11 @@
+--- xv.h.orig 2009-05-17 12:01:21.000000000 +0200
++++ xv.h 2009-05-17 12:02:58.000000000 +0200
+@@ -158,7 +159,7 @@
+
+ #ifndef VMS
+ # include <errno.h>
+-# ifndef __NetBSD__
++# if !defined(__NetBSD__) && !defined(__FreeBSD__)
+ # if !(defined __GLIBC__ && __GLIBC__ >= 2)
+ extern int errno; /* SHOULD be in errno.h, but often isn't */
+ extern char *sys_errlist[]; /* this too... */
diff --git a/graphics/xv/files/patch-xvgif.c b/graphics/xv/files/patch-xvgif.c
new file mode 100644
index 000000000000..9c769565196c
--- /dev/null
+++ b/graphics/xv/files/patch-xvgif.c
@@ -0,0 +1,15 @@
+--- xvgif.c.orig 2009-05-17 08:25:07.000000000 +0200
++++ xvgif.c 2009-05-17 09:37:28.000000000 +0200
+@@ -169,8 +169,12 @@
+
+ aspect = NEXTBYTE;
+ if (aspect) {
++#if 0
+ if (!gif89) return(gifError(pinfo,"corrupt GIF file (screen descriptor)"));
+ else normaspect = (float) (aspect + 15) / 64.0; /* gif89 aspect ratio */
++#else
++ normaspect = (float) (aspect + 15) / 64.0; /* gif89 aspect ratio */
++#endif
+ if (DEBUG) fprintf(stderr,"GIF89 aspect = %f\n", normaspect);
+ }
+
diff --git a/graphics/xv/files/patch-xvimage.c b/graphics/xv/files/patch-xvimage.c
deleted file mode 100644
index a233568a4955..000000000000
--- a/graphics/xv/files/patch-xvimage.c
+++ /dev/null
@@ -1,67 +0,0 @@
---- xvimage.c.orig Fri Dec 15 07:32:23 2006
-+++ xvimage.c Fri Dec 15 07:45:46 2006
-@@ -1977,10 +1977,10 @@
- case 12:
- case 15:
- case 16: {
-- unsigned short *imagedata, *ip;
-+ byte *imagedata, *ip;
- byte *pp;
-
-- imagedata = (unsigned short *) malloc((size_t) (2*wide*high));
-+ imagedata = (byte *) malloc((size_t) (2*wide*high));
- if (!imagedata) FatalError("couldn't malloc imagedata");
-
- xim = XCreateImage(theDisp,theVisual,dispDEEP,ZPixmap,0,
-@@ -2003,8 +2003,8 @@
- if (dithpic) xcol = ((*pp) ? white : black) & 0xffff;
- else xcol = xcolors[*pp] & 0xffff;
-
-- *((unsigned char *)ip)++ = (xcol>>8) & 0xff;
-- *((unsigned char *)ip)++ = (xcol) & 0xff;
-+ *(ip++) = (xcol>>8) & 0xff;
-+ *(ip++) = (xcol) & 0xff;
- }
- }
- else { /* LSBFirst */
-@@ -2014,8 +2014,8 @@
- if (dithpic) xcol = ((*pp) ? white : black) & 0xffff;
- else xcol = xcolors[*pp];
-
-- *((unsigned char *)ip)++ = (xcol) & 0xff;
-- *((unsigned char *)ip)++ = (xcol>>8) & 0xff;
-+ *(ip++) = (xcol) & 0xff;
-+ *(ip++) = (xcol>>8) & 0xff;
- }
- }
- }
-@@ -2214,7 +2214,8 @@
- *ip++ = xcol & 0xff;
- break;
- case 16:
-- *((CARD16 *)ip)++ = (CARD16)xcol;
-+ *((CARD16 *)ip) = (CARD16)xcol;
-+ ip += 2;
- break;
- }
- }
-@@ -2243,7 +2244,8 @@
- *ip++ = xcol & 0xff;
- break;
- case 16:
-- *((CARD16 *)ip)++ = (CARD16)xcol;
-+ *((CARD16 *)ip) = (CARD16)xcol;
-+ ip += 2;
- break;
- case 24:
- *ip++ = (xcol >> 16) & 0xff;
-@@ -2251,7 +2253,8 @@
- *ip++ = xcol & 0xff;
- break;
- case 32:
-- *((CARD32 *)ip)++ = (CARD32)xcol;
-+ *((CARD32 *)ip) = (CARD32)xcol;
-+ ip += 4;
- break;
- }
- }
diff --git a/graphics/xv/files/patch-xvxwd.c b/graphics/xv/files/patch-xvxwd.c
deleted file mode 100644
index f1c280d6f5cf..000000000000
--- a/graphics/xv/files/patch-xvxwd.c
+++ /dev/null
@@ -1,171 +0,0 @@
---- xvxwd.c.orig Sun Jul 9 18:12:45 2006
-+++ xvxwd.c Mon Jul 10 20:04:55 2006
-@@ -19,7 +19,7 @@
- */
-
- #include "xv.h"
--
-+#include <sys/endian.h>
-
- /***************************** x11wd.h *****************************/
- #define X11WD_FILE_VERSION 7
-@@ -66,23 +66,30 @@
-
- typedef byte pixel;
-
-+#if __FreeBSD_cc_version < 500000
-+static CARD16 bs_short(CARD16 x);
-+static CARD32 bs_long(CARD32 x);
-+#else
-+#define bs_short(x) bswap16(x)
-+#define bs_long(x) bswap32(x)
-+#endif
-+
- /* local functions */
- static int getinit PARM((FILE *, int*, int*, int*, CARD32 *,
- CARD32, PICINFO *));
- static CARD32 getpixnum PARM((FILE *));
- static int xwdError PARM((char *));
- static void xwdWarning PARM((char *));
--static int bs_short PARM((int));
--static CARD32 bs_long PARM((CARD32));
- static int readbigshort PARM((FILE *, CARD16 *));
- static int readbiglong PARM((FILE *, CARD32 *));
- static int readlittleshort PARM((FILE *, CARD16 *));
- static int readlittlelong PARM((FILE *, CARD32 *));
- static int writebigshort PARM((FILE *, int));
- static int writebiglong PARM((FILE *, CARD32));
--
-+static int get_shift PARM((CARD32));
- static byte *pic8, *pic24;
- static CARD32 red_mask, green_mask, blue_mask;
-+static int red_shift, green_shift, blue_shift;
- static int bits_per_item, bits_used, bit_shift, bits_per_pixel;
- static char buf[4];
- static char *byteP;
-@@ -181,24 +188,9 @@
- CARD32 ul;
-
- ul = getpixnum(ifp);
-- switch (bits_per_pixel) {
-- case 16:
-- *xP++ = ((ul & red_mask) >> 0);
-- *xP++ = ((ul & green_mask) >> 5);
-- *xP++ = ((ul & blue_mask) >> 10);
-- break;
--
-- case 24:
-- case 32:
-- *xP++ = (ul ) & 0xff;
-- *xP++ = (ul>> 8) & 0xff;
-- *xP++ = (ul>>16) & 0xff;
-- break;
--
-- default:
-- xwdError("True/Direct only supports 16, 24, and 32 bits");
-- return 0;
-- }
-+ *xP++ = ((ul & red_mask) << red_shift) >> 24;
-+ *xP++ = ((ul & green_mask) << green_shift) >> 24;
-+ *xP++ = ((ul & blue_mask) << blue_shift) >> 24;
- }
-
- for (col=0; col<padright; col++) getpixnum(ifp);
-@@ -266,6 +258,8 @@
- byte_swap = 1;
- h11P->header_size = bs_long(h11P->header_size);
- h11P->file_version = bs_long(h11P->file_version);
-+ if (h11P->file_version != X11WD_FILE_VERSION)
-+ return(xwdError("unsupported X11 XWD file version"));
- h11P->pixmap_format = bs_long(h11P->pixmap_format);
- h11P->pixmap_depth = bs_long(h11P->pixmap_depth);
- h11P->pixmap_width = bs_long(h11P->pixmap_width);
-@@ -427,6 +421,10 @@
- green_mask = h11P->green_mask;
- blue_mask = h11P->blue_mask;
-
-+ red_shift = get_shift(red_mask);
-+ green_shift = get_shift(green_mask);
-+ blue_shift = get_shift(blue_mask);
-+
- byteP = (char *) buf;
- shortP = (CARD16 *) buf;
- longP = (CARD32 *) buf;
-@@ -534,39 +532,21 @@
- * Byte-swapping junk.
- */
-
--union cheat {
-- CARD32 l;
-- CARD16 s;
-- CARD8 c[sizeof(CARD32)];
--};
--
--static int bs_short(s)
-- int s;
-+#if __FreeBSD_cc_version < 500000
-+static CARD32 bs_long(CARD32 x)
- {
-- union cheat u;
-- unsigned char t;
--
-- u.s = (CARD16) s;
-- t = u.c[0]; u.c[0] = u.c[1]; u.c[1] = t;
-- return (int) u.s;
-+ return (((x & 0xff000000U) >> 24) |
-+ ((x & 0x00ff0000U) >> 8) |
-+ ((x & 0x0000ff00U) << 8) |
-+ ((x & 0x000000ffU) << 24));
- }
-
--static CARD32 bs_long(l)
-- CARD32 l;
-+
-+static CARD16 bs_short(CARD16 x)
- {
-- union cheat u;
-- unsigned char t;
--
-- u.l = l;
-- t = u.c[0]; u.c[0] = u.c[3]; u.c[3] = t;
-- t = u.c[1]; u.c[1] = u.c[2]; u.c[2] = t;
-- return u.l;
-+ return (((x & 0xff00U) >> 8) | ((x & 0x00ffU) << 8));
- }
--
--
--
--
--
-+#endif
-
- /*
- * Endian I/O.
-@@ -623,7 +603,7 @@
- }
-
-
--static int writebiglong(out, l)
-+ static int writebiglong(out, l)
- FILE* out;
- CARD32 l;
- {
-@@ -642,4 +622,17 @@
- putc((s>>8)&0xff, out);
- putc(s&0xff, out);
- return 0;
-+}
-+
-+
-+static int get_shift(val)
-+ CARD32 val;
-+{
-+ int shift;
-+
-+if (!val)
-+ return (0);
-+ for (shift = 0; !(val & 0x80000000); shift++)
-+ val <<= 1;
-+ return (shift);
- }
-