Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Apr 2005 10:21:32 +1000
From:      Alan Garfield <alan@fromorbit.com>
To:        ports@FreeBSD.org
Cc:        uwe@steinmann.cx
Subject:   [PATCH] pslib-0.2.5
Message-ID:  <1112833292.4791.27.camel@random.fromorbit.com>

next in thread | raw e-mail | index | archive | help

--=-pY2AtAbylAMd+GVgzUWA
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello,

I've tried sending this small patch to the original developers, but I've
had no luck getting any response to any of their email addresses for
over two months!

So anyway, here is a small patch that fixes several bugs in this
library. 

The biggest fix is to ps_ascii85_encode() which fixes image corruption
because of an uncleared variable and an incorrect cast.

The second fix is to open_image_file() which incorrectly didn't set JPEG
images to an RGB colour space. Which meant the postscript output was
incorrect and couldn't be rendered.

To apply the patch :-

> tar zxvf pslib-0.2.5.tar.gz
> cd pslib-0.2.5
> patch -Np1 < ../pslib-0.2.5p3.patch 

Hope this is helpful to someone!

Cheers,
Alan Garfield.



--=-pY2AtAbylAMd+GVgzUWA
Content-Disposition: attachment; filename=pslib-0.2.5p3.patch
Content-Type: text/x-patch; name=pslib-0.2.5p3.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

diff -Naur pslib-0.2.5.orig/src/pslib.c pslib-0.2.5/src/pslib.c
--- pslib-0.2.5.orig/src/pslib.c	2005-01-08 06:13:01.000000000 +1100
+++ pslib-0.2.5/src/pslib.c	2005-04-07 10:03:24.419018445 +1000
@@ -4396,6 +4396,7 @@
 		psimage->height = cinfo.output_height;
 		psimage->components = cinfo.output_components;
 		psimage->bpc = 8;
+    psimage->colorspace = PS_COLORSPACE_RGB;
 		psimage->length = psimage->width * psimage->height * psimage->components;
 		if(NULL == (psimage->data = psdoc->malloc(psdoc, psimage->length, _("Allocate memory for image data.")))) {
 			ps_error(psdoc, PS_MemoryError, _("Could not allocate memory for image data."));
diff -Naur pslib-0.2.5.orig/src/ps_util.c pslib-0.2.5/src/ps_util.c
--- pslib-0.2.5.orig/src/ps_util.c	2004-11-13 08:39:53.000000000 +1100
+++ pslib-0.2.5/src/ps_util.c	2005-04-07 10:02:56.819639316 +1000
@@ -589,10 +589,15 @@
 	unsigned char c;
 	int i, count, cc;
 
+  buffer = 0;
 	count = 0;
 	cc = 0;
 	while(count <= len-4) {
-		buffer = ((long) data[count] << 24) + ((long) data[count+1] << 16) + ((long) data[count+2] << 8) + (long) data[count+3];
+    buffer |= ((unsigned char) data[count] << 24);
+    buffer |= ((unsigned char) data[count+1] << 16);
+    buffer |= ((unsigned char) data[count+2] << 8);
+    buffer |= ((unsigned char) data[count+3]);
+
 		if(buffer == 0) {
 			ps_putc(psdoc, 'z');
 			cc++;

--=-pY2AtAbylAMd+GVgzUWA--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1112833292.4791.27.camel>