]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/raster.c
Load cups into easysw/current.
[thirdparty/cups.git] / filter / raster.c
index 953f359c4cd71ec6fcd32b9a0e0fc0843432e332..32155073bfdd49a45babe4be201820f10f914891 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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:
@@ -60,7 +53,7 @@
  * Include necessary headers...
  */
 
-#include "raster.h"
+#include "image-private.h"
 #include <cups/debug.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -143,8 +136,14 @@ cupsRasterOpen(int         fd,             /* I - File descriptor */
   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;
@@ -157,6 +156,8 @@ cupsRasterOpen(int         fd,              /* I - File descriptor */
 
     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);
     }
@@ -168,6 +169,7 @@ cupsRasterOpen(int         fd,              /* I - File descriptor */
         r->sync != CUPS_RASTER_SYNCv2 &&
         r->sync != CUPS_RASTER_REVSYNCv2)
     {
+      _cupsRasterAddError("Unknown raster format %08x!\n", r->sync);
       free(r);
       return (NULL);
     }
@@ -198,6 +200,8 @@ cupsRasterOpen(int         fd,              /* I - File descriptor */
     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);
     }
@@ -1161,5 +1165,5 @@ cups_write(int                 fd,        /* I - File descriptor */
 
 
 /*
- * End of "$Id$".
+ * End of "$Id: raster.c 6274 2007-02-13 21:05:28Z mike $".
  */