/*
- * "$Id$"
+ * "$Id: raster.c 6274 2007-02-13 21:05:28Z mike $"
*
* Raster file routines for the Common UNIX Printing System (CUPS).
*
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
- * This code and any derivative of it may be used and distributed
- * freely under the terms of the GNU General Public License when
- * used with GNU/GPL Ghostscript or its derivatives. Use of the
- * code (or any derivative of it) with software other than GNU/GPL
- * GhostScript (or its derivatives) is governed by the CUPS license
- * agreement.
- *
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
* Include necessary headers...
*/
-#include "raster.h"
+#include "image-private.h"
#include <cups/debug.h>
#include <stdlib.h>
#include <errno.h>
cups_raster_t *r; /* New stream */
+ _cupsRasterClearError();
+
if ((r = calloc(sizeof(cups_raster_t), 1)) == NULL)
+ {
+ _cupsRasterAddError("Unable to allocate memory for raster stream: %s\n",
+ strerror(errno));
return (NULL);
+ }
r->fd = fd;
r->mode = mode == CUPS_RASTER_WRITE_COMPRESSED ? CUPS_RASTER_WRITE : mode;
if (!cups_read(r->fd, (unsigned char *)&(r->sync), sizeof(r->sync)))
{
+ _cupsRasterAddError("Unable to read header from raster stream: %s\n",
+ strerror(errno));
free(r);
return (NULL);
}
r->sync != CUPS_RASTER_SYNCv2 &&
r->sync != CUPS_RASTER_REVSYNCv2)
{
+ _cupsRasterAddError("Unknown raster format %08x!\n", r->sync);
free(r);
return (NULL);
}
if (cups_write(r->fd, (unsigned char *)&(r->sync), sizeof(r->sync))
< sizeof(r->sync))
{
+ _cupsRasterAddError("Unable to write raster stream header: %s\n",
+ strerror(errno));
free(r);
return (NULL);
}
/*
- * End of "$Id$".
+ * End of "$Id: raster.c 6274 2007-02-13 21:05:28Z mike $".
*/