[gs-devel] Re: [Gimp-print-devel] IJS breaks with large raster images
Robert L Krawitz
rlk@alum.mit.edu
Sat Jun 1 00:22:32 PDT 2002
Date: Fri, 31 May 2002 19:53:48 +0200
From: Till Kamppeter <till.kamppeter@gmx.net>
Now both times with "export STP_DEBUG=-1", once with and once without
"strace -f":
wget http://www.linuxprinting.org/till/tmp/GS-IJS-A1-strace-f-DEBUG.txt
wget http://www.linuxprinting.org/till/tmp/GS-IJS-A1-DEBUG.txt
I hope this helps.
Never mind. It isn't dumping core. It's getting an IJS_ERANGE error:
#define IJS_ERANGE -4 /* out of range */
This is actually a bug in (at least) the ijsgimpprint driver. It's
overflowing 31 bits. How do you like that?
img.total_bytes = ((ph.n_chan * ph.bps * ph.width + 7) >> 3)
* ph.height;
So let's plug in some numbers -- 24" wide, 33" long, 1440x720 DPI, 3
channels, 8 bps:
[2(rlk)||{!13}<dsl092-065-009>/home/rlk/sandbox]
$ expr 1440 \* 720 \* 24 \* 33
821145600
[2(rlk)||{!14}<dsl092-065-009>/home/rlk/sandbox]
$ expr 1440 \* 720 \* 24 \* 33 \* 3
-1831530496
Oops. This should fix it (at least on the ijsgimpprint side).
However, it's a rather ugly fix, and I really don't know why I did it
this way, rather than doing it in terms of rows. It really should
count rows.
*** ijsgimpprint.c.~1.10.~ Wed Apr 3 19:08:35 2002
--- ijsgimpprint.c Fri May 31 19:21:55 2002
***************
*** 83,90 ****
int row; /* row number in buffer */
int row_width; /* length of a row */
char *row_buf; /* buffer for raster */
! int total_bytes; /* total size of raster */
! int bytes_left; /* bytes remaining to be read */
GimpParamList *params;
} IMAGE;
--- 83,90 ----
int row; /* row number in buffer */
int row_width; /* length of a row */
char *row_buf; /* buffer for raster */
! double total_bytes; /* total size of raster */
! double bytes_left; /* bytes remaining to be read */
GimpParamList *params;
} IMAGE;
***************
*** 664,680 ****
image_next_row(IMAGE *img)
{
int status = 0;
! int n_bytes = img->bytes_left;
if (img->bytes_left)
{
if (n_bytes > img->row_width)
n_bytes = img->row_width;
#ifdef VERBOSE
! STP_DEBUG(fprintf(stderr, "%d bytes left, reading %d, on row %d\n",
! bytes_left, n_bytes, img->row));
#endif
! status = ijs_server_get_data(img->ctx, img->row_buf, n_bytes);
if (status)
{
STP_DEBUG(fprintf(stderr, "page aborted!\n"));
--- 664,680 ----
image_next_row(IMAGE *img)
{
int status = 0;
! double n_bytes = img->bytes_left;
if (img->bytes_left)
{
if (n_bytes > img->row_width)
n_bytes = img->row_width;
#ifdef VERBOSE
! STP_DEBUG(fprintf(stderr, "%.0f bytes left, reading %.d, on row %d\n",
! img->bytes_left, (int) n_bytes, img->row));
#endif
! status = ijs_server_get_data(img->ctx, img->row_buf, (int) n_bytes);
if (status)
{
STP_DEBUG(fprintf(stderr, "page aborted!\n"));
--
Robert Krawitz <rlk@alum.mit.edu> http://www.tiac.net/users/rlk/
Tall Clubs International -- http://www.tall.org/ or 1-888-IM-TALL-2
Member of the League for Programming Freedom -- mail lpf@uunet.uu.net
Project lead for Gimp Print/stp -- http://gimp-print.sourceforge.net
"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton
More information about the gs-devel
mailing list