/*
- * "$Id$"
+ * "$Id: image-sun.c 7223 2008-01-16 23:41:19Z mike $"
*
* Sun Raster image file routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 1993-2006 by Easy Software Products.
+ * Copyright 2007-2008 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
img->ysize == 0 || img->ysize > CUPS_IMAGE_MAX_HEIGHT ||
ras_depth == 0 || ras_depth > 32)
{
- fputs("ERROR: Raster image cannot be loaded!\n", stderr);
+ fputs("DEBUG: Raster image cannot be loaded!\n", stderr);
return (1);
}
in = malloc(img->xsize * 3 + 1);
}
- bpp = cupsImageGetDepth(img);
- out = malloc(img->xsize * bpp);
- scanline = malloc(scanwidth);
+ if (!in)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ return (1);
+ }
+
+ bpp = cupsImageGetDepth(img);
+
+ if ((out = malloc(img->xsize * bpp)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ return (1);
+ }
+
+ if ((scanline = malloc(scanwidth)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ free(out);
+ return (1);
+ }
+
run_count = 0;
run_value = 0;
for (y = 0; y < img->ysize; y ++)
{
- if (ras_depth != 8 || ras_maplength > 0)
+ if ((ras_depth != 8 && ras_depth != 24) || ras_maplength > 0)
p = scanline;
else
p = in;
*p = 0;
if (bit > 1)
+ bit >>= 1;
+ else
{
bit = 128;
scanptr ++;
}
- else
- bit >>= 1;
}
}
else if (ras_depth == 1)
}
if (bit > 1)
+ bit >>= 1;
+ else
{
bit = 128;
scanptr ++;
}
- else
- bit >>= 1;
}
}
else if (ras_depth == 8 && ras_maplength > 0)
/*
- * End of "$Id$".
+ * End of "$Id: image-sun.c 7223 2008-01-16 23:41:19Z mike $".
*/