From owner-freebsd-ports@FreeBSD.ORG Thu Apr 7 07:55:49 2005 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F42E16A4CE for ; Thu, 7 Apr 2005 07:55:49 +0000 (GMT) Received: from thing1.auspcmarket.com.au (thing1.auspcmarket.com.au [203.31.169.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1F2643D5E for ; Thu, 7 Apr 2005 07:55:47 +0000 (GMT) (envelope-from alan@fromorbit.com) Received: from [192.168.1.99] (unknown [192.168.1.99]) by thing1.auspcmarket.com.au (Postfix) with ESMTP id D7EB95C2C; Thu, 7 Apr 2005 10:21:37 +1000 (EST) From: Alan Garfield To: ports@FreeBSD.org Content-Type: multipart/mixed; boundary="=-pY2AtAbylAMd+GVgzUWA" Message-Id: <1112833292.4791.27.camel@random.fromorbit.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 07 Apr 2005 10:21:32 +1000 cc: uwe@steinmann.cx Subject: [PATCH] pslib-0.2.5 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2005 07:55:49 -0000 --=-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--