]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Move raster functions into libcups, with stubs that call back to libcups in libcupsimage.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 11 Oct 2018 00:22:24 +0000 (20:22 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 11 Oct 2018 00:22:24 +0000 (20:22 -0400)
14 files changed:
cups/Makefile
cups/cups-private.h
cups/error.c [deleted file]
cups/globals.c
cups/ppd-private.h
cups/ppd.h
cups/raster-error.c [new file with mode: 0644]
cups/raster-interpret.c [moved from cups/interpret.c with 99% similarity]
cups/raster-interstub.c [new file with mode: 0644]
cups/raster-private.h
cups/raster-stream.c [moved from cups/raster.c with 69% similarity]
cups/raster-stubs.c [new file with mode: 0644]
cups/raster.h
xcode/CUPS.xcodeproj/project.pbxproj

index 94f5e9f10e493cc12c3895a029ac2f576cb83433..6550f42bfd63eb4a82c2a206f26e7cbb95149352 100644 (file)
@@ -59,6 +59,9 @@ LIBOBJS       =       \
                ppd-page.o \
                ppd-util.o \
                pwg-media.o \
+               raster-error.o \
+               raster-interpret.o \
+               raster-stream.o \
                request.o \
                sidechannel.o \
                snmp.o \
@@ -71,9 +74,8 @@ LIBOBJS       =       \
                usersys.o \
                util.o
 IMAGEOBJS      = \
-               error.o \
-               interpret.o \
-               raster.o
+               raster-interstub.o \
+               raster-stubs.o
 TESTOBJS       = \
                rasterbench.o \
                testadmin.o \
@@ -335,10 +337,10 @@ uninstall:
 # libcups.so.2
 #
 
-libcups.so.2:  $(LIBOBJS)
+libcups.so.2:  $(LIBOBJS) $(IMAGEOBJS)
        echo Linking $@...
-       $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
-               $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
+       $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(IMAGEOBJS) \
+               $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
        $(RM) `basename $@ .2`
        $(LN) $@ `basename $@ .2`
 
@@ -347,14 +349,14 @@ libcups.so.2:     $(LIBOBJS)
 # libcups.2.dylib
 #
 
-libcups.2.dylib:       $(LIBOBJS)
+libcups.2.dylib:       $(LIBOBJS) $(IMAGEOBJS)
        echo Linking $@...
        $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
                -install_name $(libdir)/$@ \
                -current_version 2.14.0 \
                -compatibility_version 2.0.0 \
-               $(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
-               $(COMMONLIBS) $(LIBZ)
+               $(LIBOBJS) $(IMAGEOBJS) \
+               $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
        $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
        $(RM) libcups.dylib
        $(LN) $@ libcups.dylib
@@ -364,9 +366,10 @@ libcups.2.dylib:   $(LIBOBJS)
 # libcups.la
 #
 
-libcups.la:    $(LIBOBJS)
+libcups.la:    $(LIBOBJS) $(IMAGEOBJS)
        echo Linking $@...
-       $(LD_CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
+       $(LD_CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
+               $(LIBOBJS:.o=.lo) $(IMAGEOBJS:.o=.lo) \
                -rpath $(LIBDIR) -version-info 2:14 $(LIBGSSAPI) $(SSLLIBS) \
                $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
 
@@ -375,10 +378,10 @@ libcups.la:    $(LIBOBJS)
 # libcups.a
 #
 
-libcups.a:     $(LIBOBJS)
+libcups.a:     $(LIBOBJS) $(IMAGEOBJS)
        echo Archiving $@...
        $(RM) $@
-       $(AR) $(ARFLAGS) $@ $(LIBOBJS)
+       $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(IMAGEOBJS)
        $(RANLIB) $@
 
 
@@ -453,9 +456,9 @@ libcupsimage.a:     $(IMAGEOBJS)
 # rasterbench (dependency on static CUPS library is intentional)
 #
 
-rasterbench:   rasterbench.o libcups.a $(LIBCUPSSTATIC)
+rasterbench:   rasterbench.o $(LIBCUPSSTATIC)
        echo Linking $@...
-       $(LD_CC) $(LDFLAGS) -o $@ rasterbench.o libcupsimage.a $(LIBCUPSSTATIC) \
+       $(LD_CC) $(LDFLAGS) -o $@ rasterbench.o $(LIBCUPSSTATIC) \
                $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
        $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
 
@@ -682,9 +685,9 @@ testpwg:    testpwg.o $(LIBCUPSSTATIC) test.ppd
 # testraster (dependency on static CUPS library is intentional)
 #
 
-testraster:    testraster.o $(LIBCUPSSTATIC) libcupsimage.a
+testraster:    testraster.o $(LIBCUPSSTATIC)
        echo Linking $@...
-       $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testraster.o libcupsimage.a \
+       $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testraster.o \
                $(LIBCUPSSTATIC) $(IMGLIBS) $(DSOLIBS) $(COMMONLIBS) \
                $(SSLLIBS) $(DNSSDLIBS) $(LIBGSSAPI)
        $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
index da3a49c95ac235507591045ab49b42a79e686e9b..451254ba4d1bad8ec3d96647484581ba4cbe1458 100644 (file)
@@ -51,6 +51,13 @@ typedef struct _cups_buffer_s                /**** Read/write buffer ****/
                        d[1];           /* Data buffer */
 } _cups_buffer_t;
 
+typedef struct _cups_raster_error_s    /**** Error buffer structure ****/
+{
+  char *start,                         /* Start of buffer */
+       *current,                       /* Current position in buffer */
+       *end;                           /* End of buffer */
+} _cups_raster_error_t;
+
 typedef struct _cups_globals_s         /**** CUPS global state data ****/
 {
   /* Multiple places... */
@@ -122,6 +129,9 @@ typedef struct _cups_globals_s              /**** CUPS global state data ****/
   char                 pwg_name[65],   /* PWG media name for custom size */
                        ppd_name[41];   /* PPD media name for custom size */
 
+  /* raster-error.c */
+  _cups_raster_error_t raster_error;   /* Raster error information */
+
   /* request.c */
   http_t               *http;          /* Current server connection */
   ipp_status_t         last_error;     /* Last IPP error */
diff --git a/cups/error.c b/cups/error.c
deleted file mode 100644 (file)
index 0916a15..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Raster error handling for CUPS.
- *
- * Copyright 2007-2015 by Apple Inc.
- * Copyright 2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
- */
-
-/*
- * Include necessary headers...
- */
-
-#include <cups/raster-private.h>
-
-
-/*
- * Local structures...
- */
-
-typedef struct _cups_raster_error_s    /**** Error buffer structure ****/
-{
-  char *start,                         /* Start of buffer */
-       *current,                       /* Current position in buffer */
-       *end;                           /* End of buffer */
-} _cups_raster_error_t;
-
-
-/*
- * Local functions...
- */
-
-static _cups_raster_error_t    *get_error_buffer(void);
-
-
-/*
- * '_cupsRasterAddError()' - Add an error message to the error buffer.
- */
-
-void
-_cupsRasterAddError(const char *f,     /* I - Printf-style error message */
-                    ...)               /* I - Additional arguments as needed */
-{
-  _cups_raster_error_t *buf = get_error_buffer();
-                                       /* Error buffer */
-  va_list      ap;                     /* Pointer to additional arguments */
-  char         s[2048];                /* Message string */
-  ssize_t      bytes;                  /* Bytes in message string */
-
-
-  DEBUG_printf(("_cupsRasterAddError(f=\"%s\", ...)", f));
-
-  va_start(ap, f);
-  bytes = vsnprintf(s, sizeof(s), f, ap);
-  va_end(ap);
-
-  if (bytes <= 0)
-    return;
-
-  DEBUG_printf(("1_cupsRasterAddError: %s", s));
-
-  bytes ++;
-
-  if ((size_t)bytes >= sizeof(s))
-    return;
-
-  if (bytes > (ssize_t)(buf->end - buf->current))
-  {
-   /*
-    * Allocate more memory...
-    */
-
-    char       *temp;                  /* New buffer */
-    size_t     size;                   /* Size of buffer */
-
-
-    size = (size_t)(buf->end - buf->start + 2 * bytes + 1024);
-
-    if (buf->start)
-      temp = realloc(buf->start, size);
-    else
-      temp = malloc(size);
-
-    if (!temp)
-      return;
-
-   /*
-    * Update pointers...
-    */
-
-    buf->end     = temp + size;
-    buf->current = temp + (buf->current - buf->start);
-    buf->start   = temp;
-  }
-
- /*
-  * Append the message to the end of the current string...
-  */
-
-  memcpy(buf->current, s, (size_t)bytes);
-  buf->current += bytes - 1;
-}
-
-
-/*
- * '_cupsRasterClearError()' - Clear the error buffer.
- */
-
-void
-_cupsRasterClearError(void)
-{
-  _cups_raster_error_t *buf = get_error_buffer();
-                                       /* Error buffer */
-
-
-  buf->current = buf->start;
-
-  if (buf->start)
-    *(buf->start) = '\0';
-}
-
-
-/*
- * 'cupsRasterErrorString()' - Return the last error from a raster function.
- *
- * If there are no recent errors, NULL is returned.
- *
- * @since CUPS 1.3/macOS 10.5@
- */
-
-const char *                           /* O - Last error */
-cupsRasterErrorString(void)
-{
-  _cups_raster_error_t *buf = get_error_buffer();
-                                       /* Error buffer */
-
-
-  if (buf->current == buf->start)
-    return (NULL);
-  else
-    return (buf->start);
-}
-
-
-#ifdef HAVE_PTHREAD_H
-/*
- * Implement per-thread globals...
- */
-
-#  include <pthread.h>
-
-
-/*
- * Local globals...
- */
-
-static pthread_key_t   raster_key = 0; /* Thread local storage key */
-static pthread_once_t  raster_key_once = PTHREAD_ONCE_INIT;
-                                       /* One-time initialization object */
-
-
-/*
- * Local functions...
- */
-
-static void    raster_init(void);
-static void    raster_destructor(void *value);
-
-
-/*
- * 'get_error_buffer()' - Return a pointer to thread local storage.
- */
-
-_cups_raster_error_t *                 /* O - Pointer to error buffer */
-get_error_buffer(void)
-{
-  _cups_raster_error_t *buf;           /* Pointer to error buffer */
-
-
- /*
-  * Initialize the global data exactly once...
-  */
-
-  DEBUG_puts("3get_error_buffer()");
-
-  pthread_once(&raster_key_once, raster_init);
-
- /*
-  * See if we have allocated the data yet...
-  */
-
-  if ((buf = (_cups_raster_error_t *)pthread_getspecific(raster_key))
-          == NULL)
-  {
-    DEBUG_puts("4get_error_buffer: allocating memory for thread.");
-
-   /*
-    * No, allocate memory as set the pointer for the key...
-    */
-
-    buf = calloc(1, sizeof(_cups_raster_error_t));
-    pthread_setspecific(raster_key, buf);
-
-    DEBUG_printf(("4get_error_buffer: buf=%p", (void *)buf));
-  }
-
- /*
-  * Return the pointer to the data...
-  */
-
-  return (buf);
-}
-
-
-/*
- * 'raster_init()' - Initialize error buffer once.
- */
-
-static void
-raster_init(void)
-{
-  pthread_key_create(&raster_key, raster_destructor);
-
-  DEBUG_printf(("3raster_init(): raster_key=%x(%u)", (unsigned)raster_key, (unsigned)raster_key));
-}
-
-
-/*
- * 'raster_destructor()' - Free memory allocated by get_error_buffer().
- */
-
-static void
-raster_destructor(void *value)         /* I - Data to free */
-{
-  _cups_raster_error_t *buf = (_cups_raster_error_t *)value;
-                                       /* Error buffer */
-
-
-  DEBUG_printf(("3raster_destructor(value=%p)", value));
-
-  if (buf->start)
-    free(buf->start);
-
-  free(value);
-}
-
-
-#else
-/*
- * Implement static globals...
- */
-
-/*
- * 'get_error_buffer()' - Return a pointer to thread local storage.
- */
-
-_cups_raster_error_t *                 /* O - Pointer to error buffer */
-get_error_buffer(void)
-{
-  static _cups_raster_error_t buf = { 0, 0, 0 };
-                                       /* Error buffer */
-
-
-  return (&buf);
-}
-#endif /* HAVE_PTHREAD_H */
index d67c752ce6f54bf652ab7f17dd32d21b980dd397..fde4d133fa947ea12689b0375526f93f8d442c0d 100644 (file)
@@ -352,6 +352,9 @@ cups_globals_free(_cups_globals_t *cg)      /* I - Pointer to global data */
 
   cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings);
 
+  if (cg->raster_error.start)
+    free(cg->raster_error.start);
+
   free(cg);
 }
 #endif /* HAVE_PTHREAD_H || _WIN32 */
index 9aa15059bf3f98666c06925ddbf5ba1519babe41..bb094edf5b317ec625fee03f2f670be25fa0bf3c 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Private PPD definitions for CUPS.
  *
- * Copyright 2007-2018 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
  * Licensed under Apache License v2.0.  See the file "LICENSE" for more
  * information.
@@ -156,6 +156,8 @@ struct _ppd_cache_s                 /**** PPD cache and PWG conversion data ****/
  */
 
 extern int             _cupsConvertOptions(ipp_t *request, ppd_file_t *ppd, _ppd_cache_t *pc, ipp_attribute_t *media_col_sup, ipp_attribute_t *doc_handling_sup, ipp_attribute_t *print_color_mode_sup, const char *user, const char *format, int copies, int num_options, cups_option_t *options) _CUPS_PRIVATE;
+extern int             _cupsRasterInterpretPPD(cups_page_header2_t *h, ppd_file_t *ppd, int num_options, cups_option_t *options, cups_interpret_cb_t func) _CUPS_PRIVATE;
+
 extern _ppd_cache_t    *_ppdCacheCreateWithFile(const char *filename,
                                                 ipp_t **attrs) _CUPS_PRIVATE;
 extern _ppd_cache_t    *_ppdCacheCreateWithPPD(ppd_file_t *ppd) _CUPS_PRIVATE;
index 3c46c07412307571aebdd09318708b7714002095..12b57ca30137f62425475507a9cee65d5236246b 100644 (file)
@@ -56,6 +56,20 @@ extern "C" {
  * Types and structures...
  */
 
+typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits);
+                                       /**** cupsRasterInterpretPPD callback function
+                                        *
+                                        * This function is called by
+                                        * @link cupsRasterInterpretPPD@ to
+                                        * validate (and update, as needed)
+                                        * the page header attributes. The
+                                        * "preferred_bits" argument provides
+                                        * the value of the
+                                        * @code cupsPreferredBitsPerColor@
+                                        * key from the PostScript page device
+                                        * dictionary and is 0 if undefined.
+                                        ****/
+
 typedef enum ppd_ui_e                  /**** UI Types @deprecated@ ****/
 {
   PPD_UI_BOOLEAN,                      /* True or False option */
diff --git a/cups/raster-error.c b/cups/raster-error.c
new file mode 100644 (file)
index 0000000..639c5b4
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Raster error handling for CUPS.
+ *
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 2007 by Easy Software Products.
+ *
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/cups-private.h>
+#include <cups/raster-private.h>
+
+
+/*
+ * Local structures...
+ */
+
+
+
+/*
+ * Local functions...
+ */
+
+static _cups_raster_error_t    *get_error_buffer(void);
+
+
+/*
+ * '_cupsRasterAddError()' - Add an error message to the error buffer.
+ */
+
+void
+_cupsRasterAddError(const char *f,     /* I - Printf-style error message */
+                    ...)               /* I - Additional arguments as needed */
+{
+  _cups_globals_t      *cg = _cupsGlobals();
+                                       /* Thread globals */
+  _cups_raster_error_t *buf = &cg->raster_error;
+                                       /* Error buffer */
+  va_list      ap;                     /* Pointer to additional arguments */
+  char         s[2048];                /* Message string */
+  ssize_t      bytes;                  /* Bytes in message string */
+
+
+  DEBUG_printf(("_cupsRasterAddError(f=\"%s\", ...)", f));
+
+  va_start(ap, f);
+  bytes = vsnprintf(s, sizeof(s), f, ap);
+  va_end(ap);
+
+  if (bytes <= 0)
+    return;
+
+  DEBUG_printf(("1_cupsRasterAddError: %s", s));
+
+  bytes ++;
+
+  if ((size_t)bytes >= sizeof(s))
+    return;
+
+  if (bytes > (ssize_t)(buf->end - buf->current))
+  {
+   /*
+    * Allocate more memory...
+    */
+
+    char       *temp;                  /* New buffer */
+    size_t     size;                   /* Size of buffer */
+
+
+    size = (size_t)(buf->end - buf->start + 2 * bytes + 1024);
+
+    if (buf->start)
+      temp = realloc(buf->start, size);
+    else
+      temp = malloc(size);
+
+    if (!temp)
+      return;
+
+   /*
+    * Update pointers...
+    */
+
+    buf->end     = temp + size;
+    buf->current = temp + (buf->current - buf->start);
+    buf->start   = temp;
+  }
+
+ /*
+  * Append the message to the end of the current string...
+  */
+
+  memcpy(buf->current, s, (size_t)bytes);
+  buf->current += bytes - 1;
+}
+
+
+/*
+ * '_cupsRasterClearError()' - Clear the error buffer.
+ */
+
+void
+_cupsRasterClearError(void)
+{
+  _cups_globals_t      *cg = _cupsGlobals();
+                                       /* Thread globals */
+  _cups_raster_error_t *buf = &cg->raster_error;
+                                       /* Error buffer */
+
+
+  buf->current = buf->start;
+
+  if (buf->start)
+    *(buf->start) = '\0';
+}
+
+
+/*
+ * '_cupsRasterErrorString()' - Return the last error from a raster function.
+ *
+ * If there are no recent errors, NULL is returned.
+ *
+ * @since CUPS 1.3/macOS 10.5@
+ */
+
+const char *                           /* O - Last error */
+_cupsRasterErrorString(void)
+{
+  _cups_globals_t      *cg = _cupsGlobals();
+                                       /* Thread globals */
+  _cups_raster_error_t *buf = &cg->raster_error;
+                                       /* Error buffer */
+
+
+  if (buf->current == buf->start)
+    return (NULL);
+  else
+    return (buf->start);
+}
similarity index 99%
rename from cups/interpret.c
rename to cups/raster-interpret.c
index bb3de30049898e0449b414b3c424dc8d97547b2d..a93f220358308bb8201d8c5402febb9edfbdb3e4 100644 (file)
@@ -90,7 +90,7 @@ static void           DEBUG_stack(const char *prefix, _cups_ps_stack_t *st);
 
 
 /*
- * 'cupsRasterInterpretPPD()' - Interpret PPD commands to create a page header.
+ * '_cupsRasterInterpretPPD()' - Interpret PPD commands to create a page header.
  *
  * This function is used by raster image processing (RIP) filters like
  * cgpdftoraster and imagetoraster when writing CUPS raster data for a page.
@@ -120,7 +120,7 @@ static void         DEBUG_stack(const char *prefix, _cups_ps_stack_t *st);
  */
 
 int                                    /* O - 0 on success, -1 on failure */
-cupsRasterInterpretPPD(
+_cupsRasterInterpretPPD(
     cups_page_header2_t *h,            /* O - Page header to create */
     ppd_file_t          *ppd,          /* I - PPD file */
     int                 num_options,   /* I - Number of options */
diff --git a/cups/raster-interstub.c b/cups/raster-interstub.c
new file mode 100644 (file)
index 0000000..8355d22
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * cupsRasterInterpretPPD stub for CUPS.
+ *
+ * Copyright © 2018 by Apple Inc.
+ *
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/ppd-private.h>
+
+
+/*
+ * This stub wraps the _cupsRasterInterpretPPD function in libcups - this allows
+ * one library to provide all of the CUPS API functions while still supporting
+ * the old split library organization...
+ */
+
+
+/*
+ * 'cupsRasterInterpretPPD()' - Interpret PPD commands to create a page header.
+ *
+ * This function is used by raster image processing (RIP) filters like
+ * cgpdftoraster and imagetoraster when writing CUPS raster data for a page.
+ * It is not used by raster printer driver filters which only read CUPS
+ * raster data.
+ *
+ *
+ * @code cupsRasterInterpretPPD@ does not mark the options in the PPD using
+ * the "num_options" and "options" arguments.  Instead, mark the options with
+ * @code cupsMarkOptions@ and @code ppdMarkOption@ prior to calling it -
+ * this allows for per-page options without manipulating the options array.
+ *
+ * The "func" argument specifies an optional callback function that is
+ * called prior to the computation of the final raster data.  The function
+ * can make changes to the @link cups_page_header2_t@ data as needed to use a
+ * supported raster format and then returns 0 on success and -1 if the
+ * requested attributes cannot be supported.
+ *
+ *
+ * @code cupsRasterInterpretPPD@ supports a subset of the PostScript language.
+ * Currently only the @code [@, @code ]@, @code <<@, @code >>@, @code {@,
+ * @code }@, @code cleartomark@, @code copy@, @code dup@, @code index@,
+ * @code pop@, @code roll@, @code setpagedevice@, and @code stopped@ operators
+ * are supported.
+ *
+ * @since CUPS 1.2/macOS 10.5@
+ */
+
+int                                    /* O - 0 on success, -1 on failure */
+cupsRasterInterpretPPD(
+    cups_page_header2_t *h,            /* O - Page header to create */
+    ppd_file_t          *ppd,          /* I - PPD file */
+    int                 num_options,   /* I - Number of options */
+    cups_option_t       *options,      /* I - Options */
+    cups_interpret_cb_t func)          /* I - Optional page header callback (@code NULL@ for none) */
+{
+  return (_cupsRasterInterpretPPD(h, ppd, num_options, options, func));
+}
index 0cca21f9a8342a6e8a0e7530a96c48e54055f8dc..1852341b7b0b87ec095b3060f00f854c8295aaf0 100644 (file)
 #    include <fcntl.h>
 #  endif /* _WIN32 */
 
+#  ifdef __cplusplus
+extern "C" {
+#  endif /* __cplusplus */
+
 
+/*
+ * Structure...
+ */
+
+struct _cups_raster_s                  /**** Raster stream data ****/
+{
+  unsigned             sync;           /* Sync word from start of stream */
+  void                 *ctx;           /* File descriptor */
+  cups_raster_iocb_t   iocb;           /* IO callback */
+  cups_mode_t          mode;           /* Read/write mode */
+  cups_page_header2_t  header;         /* Raster header for current page */
+  unsigned             rowheight,      /* Row height in lines */
+                       count,          /* Current row run-length count */
+                       remaining,      /* Remaining rows in page image */
+                       bpp;            /* Bytes per pixel/color */
+  unsigned char                *pixels,        /* Pixels for current row */
+                       *pend,          /* End of pixel buffer */
+                       *pcurrent;      /* Current byte in pixel buffer */
+  int                  compressed,     /* Non-zero if data is compressed */
+                       swapped;        /* Non-zero if data is byte-swapped */
+  unsigned char                *buffer,        /* Read/write buffer */
+                       *bufptr,        /* Current (read) position in buffer */
+                       *bufend;        /* End of current (read) buffer */
+  size_t               bufsize;        /* Buffer size */
+#  ifdef DEBUG
+  size_t               iostart,        /* Start of read/write buffer */
+                       iocount;        /* Number of bytes read/written */
+#  endif /* DEBUG */
+  unsigned             apple_page_count;/* Apple raster page count */
+};
+
+
+#if 0
 /*
  * min/max macros...
  */
 #  ifndef min
 #    define    min(a,b)        ((a) < (b) ? (a) : (b))
 #  endif /* !min */
+#endif // 0
 
 
 /*
  * Prototypes...
  */
 
-extern int             _cupsRasterExecPS(cups_page_header2_t *h, int *preferred_bits, const char *code) _CUPS_NONNULL(3) _CUPS_PRIVATE;
 extern void            _cupsRasterAddError(const char *f, ...) _CUPS_FORMAT(1,2) _CUPS_PRIVATE;
 extern void            _cupsRasterClearError(void) _CUPS_PRIVATE;
+extern const char      *_cupsRasterColorSpaceString(cups_cspace_t cspace) _CUPS_PRIVATE;
+extern void            _cupsRasterDelete(cups_raster_t *r) _CUPS_PRIVATE;
+extern const char      *_cupsRasterErrorString(void) _CUPS_PRIVATE;
+extern int             _cupsRasterExecPS(cups_page_header2_t *h, int *preferred_bits, const char *code) _CUPS_NONNULL(3) _CUPS_PRIVATE;
+extern int             _cupsRasterInitPWGHeader(cups_page_header2_t *h, pwg_media_t *media, const char *type, int xdpi, int ydpi, const char *sides, const char *sheet_back) _CUPS_PRIVATE;
+extern cups_raster_t   *_cupsRasterNew(cups_raster_iocb_t iocb, void *ctx, cups_mode_t mode) _CUPS_PRIVATE;
+extern unsigned                _cupsRasterReadHeader(cups_raster_t *r) _CUPS_PRIVATE;
+extern unsigned                _cupsRasterReadPixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PRIVATE;
+extern unsigned                _cupsRasterWriteHeader(cups_raster_t *r) _CUPS_PRIVATE;
+extern unsigned                _cupsRasterWritePixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PRIVATE;
+
+#  ifdef __cplusplus
+}
+#  endif /* __cplusplus */
 
 #endif /* !_CUPS_RASTER_PRIVATE_H_ */
similarity index 69%
rename from cups/raster.c
rename to cups/raster-stream.c
index cfac0c5f72e9568dfb0ad60e3fe524f68399713c..ac2e3518c52b3a1c7f13c0c4ca68783f09347d85 100644 (file)
  * Private structures...
  */
 
-struct _cups_raster_s                  /**** Raster stream data ****/
-{
-  unsigned             sync;           /* Sync word from start of stream */
-  void                 *ctx;           /* File descriptor */
-  cups_raster_iocb_t   iocb;           /* IO callback */
-  cups_mode_t          mode;           /* Read/write mode */
-  cups_page_header2_t  header;         /* Raster header for current page */
-  unsigned             rowheight,      /* Row height in lines */
-                       count,          /* Current row run-length count */
-                       remaining,      /* Remaining rows in page image */
-                       bpp;            /* Bytes per pixel/color */
-  unsigned char                *pixels,        /* Pixels for current row */
-                       *pend,          /* End of pixel buffer */
-                       *pcurrent;      /* Current byte in pixel buffer */
-  int                  compressed,     /* Non-zero if data is compressed */
-                       swapped;        /* Non-zero if data is byte-swapped */
-  unsigned char                *buffer,        /* Read/write buffer */
-                       *bufptr,        /* Current (read) position in buffer */
-                       *bufend;        /* End of current (read) buffer */
-  size_t               bufsize;        /* Buffer size */
-#ifdef DEBUG
-  size_t               iostart,        /* Start of read/write buffer */
-                       iocount;        /* Number of bytes read/written */
-#endif /* DEBUG */
-  unsigned             apple_page_count;/* Apple raster page count */
-};
-
 typedef void (*_cups_copyfunc_t)(void *dst, const void *src, size_t bytes);
 
 
@@ -59,6 +32,38 @@ typedef void (*_cups_copyfunc_t)(void *dst, const void *src, size_t bytes);
  */
 
 #ifdef DEBUG
+static const char * const cups_modes[] =
+{                                      /* Open modes */
+  "CUPS_RASTER_READ",
+  "CUPS_RASTER_WRITE",
+  "CUPS_RASTER_WRITE_COMPRESSED",
+  "CUPS_RASTER_WRITE_PWG",
+  "CUPS_RASTER_WRITE_APPLE"
+};
+#endif /* DEBUG */
+
+
+/*
+ * Local functions...
+ */
+
+static ssize_t cups_raster_io(cups_raster_t *r, unsigned char *buf, size_t bytes);
+static ssize_t cups_raster_read(cups_raster_t *r, unsigned char *buf, size_t bytes);
+static int     cups_raster_update(cups_raster_t *r);
+static ssize_t cups_raster_write(cups_raster_t *r, const unsigned char *pixels);
+static void    cups_swap(unsigned char *buf, size_t bytes);
+static void    cups_swap_copy(unsigned char *dst, const unsigned char *src, size_t bytes);
+
+
+/*
+ * '_cupsRasterColorSpaceString()' - Return the colorspace name for a
+ *                                   cupsColorSpace value.
+ */
+
+const char *
+_cupsRasterColorSpaceString(
+    cups_cspace_t cspace)              /* I - cupsColorSpace value */
+{
   static const char * const cups_color_spaces[] =
   {                                    /* Color spaces */
     "CUPS_CSPACE_W",
@@ -125,41 +130,23 @@ typedef void (*_cups_copyfunc_t)(void *dst, const void *src, size_t bytes);
     "CUPS_CSPACE_DEVICEE",
     "CUPS_CSPACE_DEVICEF"
   };
-  static const char * const cups_modes[] =
-  {                                    /* Open modes */
-    "CUPS_RASTER_READ",
-    "CUPS_RASTER_WRITE",
-    "CUPS_RASTER_WRITE_COMPRESSED",
-    "CUPS_RASTER_WRITE_PWG",
-    "CUPS_RASTER_WRITE_APPLE"
-  };
-#endif /* DEBUG */
-
-
-/*
- * Local functions...
- */
 
-static ssize_t cups_raster_io(cups_raster_t *r, unsigned char *buf, size_t bytes);
-static unsigned        cups_raster_read_header(cups_raster_t *r);
-static ssize_t cups_raster_read(cups_raster_t *r, unsigned char *buf, size_t bytes);
-static int     cups_raster_update(cups_raster_t *r);
-static ssize_t cups_raster_write(cups_raster_t *r, const unsigned char *pixels);
-static ssize_t cups_read_fd(void *ctx, unsigned char *buf, size_t bytes);
-static void    cups_swap(unsigned char *buf, size_t bytes);
-static void    cups_swap_copy(unsigned char *dst, const unsigned char *src, size_t bytes);
-static ssize_t cups_write_fd(void *ctx, unsigned char *buf, size_t bytes);
+  if (cspace < CUPS_CSPACE_W || cspace > CUPS_CSPACE_DEVICEF)
+    return ("Unknown");
+  else
+    return (cups_color_spaces[cspace]);
+}
 
 
 /*
- * 'cupsRasterClose()' - Close a raster stream.
+ * '_cupsRasterDelete()' - Free a raster stream.
  *
  * The file descriptor associated with the raster stream must be closed
  * separately as needed.
  */
 
 void
-cupsRasterClose(cups_raster_t *r)      /* I - Stream to close */
+_cupsRasterDelete(cups_raster_t *r)    /* I - Stream to free */
 {
   if (r != NULL)
   {
@@ -175,7 +162,7 @@ cupsRasterClose(cups_raster_t *r)   /* I - Stream to close */
 
 
 /*
- * 'cupsRasterInitPWGHeader()' - Initialize a page header for PWG Raster output.
+ * '_cupsRasterInitPWGHeader()' - Initialize a page header for PWG Raster output.
  *
  * The "media" argument specifies the media to use.
  *
@@ -192,7 +179,7 @@ cupsRasterClose(cups_raster_t *r)   /* I - Stream to close */
  */
 
 int                                    /* O - 1 on success, 0 on failure */
-cupsRasterInitPWGHeader(
+_cupsRasterInitPWGHeader(
     cups_page_header2_t *h,            /* I - Page header */
     pwg_media_t         *media,                /* I - PWG media information */
     const char          *type,         /* I - PWG raster type string */
@@ -415,37 +402,7 @@ cupsRasterInitPWGHeader(
 
 
 /*
- * 'cupsRasterOpen()' - Open a raster stream using a file descriptor.
- *
- * This function associates a raster stream with the given file descriptor.
- * For most printer driver filters, "fd" will be 0 (stdin).  For most raster
- * image processor (RIP) filters that generate raster data, "fd" will be 1
- * (stdout).
- *
- * When writing raster data, the @code CUPS_RASTER_WRITE@,
- * @code CUPS_RASTER_WRITE_COMPRESS@, or @code CUPS_RASTER_WRITE_PWG@ mode can
- * be used - compressed and PWG output is generally 25-50% smaller but adds a
- * 100-300% execution time overhead.
- */
-
-cups_raster_t *                                /* O - New stream */
-cupsRasterOpen(int         fd,         /* I - File descriptor */
-               cups_mode_t mode)       /* I - Mode - @code CUPS_RASTER_READ@,
-                                              @code CUPS_RASTER_WRITE@,
-                                              @code CUPS_RASTER_WRITE_COMPRESSED@,
-                                              or @code CUPS_RASTER_WRITE_PWG@ */
-{
-  DEBUG_printf(("cupsRasterOpen(fd=%d, mode=%s)", fd, cups_modes[mode]));
-
-  if (mode == CUPS_RASTER_READ)
-    return (cupsRasterOpenIO(cups_read_fd, (void *)((intptr_t)fd), mode));
-  else
-    return (cupsRasterOpenIO(cups_write_fd, (void *)((intptr_t)fd), mode));
-}
-
-
-/*
- * 'cupsRasterOpenIO()' - Open a raster stream using a callback function.
+ * '_cupsRasterNew()' - Create a raster stream using a callback function.
  *
  * This function associates a raster stream with the given callback function and
  * context pointer.
@@ -457,7 +414,7 @@ cupsRasterOpen(int         fd,              /* I - File descriptor */
  */
 
 cups_raster_t *                                /* O - New stream */
-cupsRasterOpenIO(
+_cupsRasterNew(
     cups_raster_iocb_t iocb,           /* I - Read/write callback */
     void               *ctx,           /* I - Context pointer for callback */
     cups_mode_t        mode)           /* I - Mode - @code CUPS_RASTER_READ@,
@@ -468,7 +425,7 @@ cupsRasterOpenIO(
   cups_raster_t        *r;                     /* New stream */
 
 
-  DEBUG_printf(("cupsRasterOpenIO(iocb=%p, ctx=%p, mode=%s)", (void *)iocb, ctx, cups_modes[mode]));
+  DEBUG_printf(("_cupsRasterOpenIO(iocb=%p, ctx=%p, mode=%s)", (void *)iocb, ctx, cups_modes[mode]));
 
   _cupsRasterClearError();
 
@@ -476,7 +433,7 @@ cupsRasterOpenIO(
   {
     _cupsRasterAddError("Unable to allocate memory for raster stream: %s\n",
                         strerror(errno));
-    DEBUG_puts("1cupsRasterOpenIO: Returning NULL.");
+    DEBUG_puts("1_cupsRasterOpenIO: Returning NULL.");
     return (NULL);
   }
 
@@ -496,7 +453,7 @@ cupsRasterOpenIO(
       _cupsRasterAddError("Unable to read header from raster stream: %s\n",
                           strerror(errno));
       free(r);
-      DEBUG_puts("1cupsRasterOpenIO: Unable to read header, returning NULL.");
+      DEBUG_puts("1_cupsRasterOpenIO: Unable to read header, returning NULL.");
       return (NULL);
     }
 
@@ -511,7 +468,7 @@ cupsRasterOpenIO(
     {
       _cupsRasterAddError("Unknown raster format %08x!\n", r->sync);
       free(r);
-      DEBUG_puts("1cupsRasterOpenIO: Unknown format, returning NULL.");
+      DEBUG_puts("1_cupsRasterOpenIO: Unknown format, returning NULL.");
       return (NULL);
     }
 
@@ -521,7 +478,7 @@ cupsRasterOpenIO(
         r->sync == CUPS_RASTER_REVSYNCapple)
       r->compressed = 1;
 
-    DEBUG_printf(("1cupsRasterOpenIO: sync=%08x", r->sync));
+    DEBUG_printf(("1_cupsRasterOpenIO: sync=%08x", r->sync));
 
     if (r->sync == CUPS_RASTER_REVSYNC ||
         r->sync == CUPS_RASTER_REVSYNCv1 ||
@@ -540,7 +497,7 @@ cupsRasterOpenIO(
        _cupsRasterAddError("Unable to read header from raster stream: %s\n",
                            strerror(errno));
        free(r);
-       DEBUG_puts("1cupsRasterOpenIO: Unable to read header, returning NULL.");
+       DEBUG_puts("1_cupsRasterOpenIO: Unable to read header, returning NULL.");
        return (NULL);
       }
     }
@@ -586,111 +543,164 @@ cupsRasterOpenIO(
       _cupsRasterAddError("Unable to write raster stream header: %s\n",
                           strerror(errno));
       free(r);
-      DEBUG_puts("1cupsRasterOpenIO: Unable to write header, returning NULL.");
+      DEBUG_puts("1_cupsRasterOpenIO: Unable to write header, returning NULL.");
       return (NULL);
     }
   }
 
-  DEBUG_printf(("1cupsRasterOpenIO: compressed=%d, swapped=%d, returning %p", r->compressed, r->swapped, (void *)r));
+  DEBUG_printf(("1_cupsRasterOpenIO: compressed=%d, swapped=%d, returning %p", r->compressed, r->swapped, (void *)r));
 
   return (r);
 }
 
 
 /*
- * 'cupsRasterReadHeader()' - Read a raster page header and store it in a
- *                            version 1 page header structure.
- *
- * This function is deprecated. Use @link cupsRasterReadHeader2@ instead.
- *
- * Version 1 page headers were used in CUPS 1.0 and 1.1 and contain a subset
- * of the version 2 page header data. This function handles reading version 2
- * page headers and copying only the version 1 data into the provided buffer.
- *
- * @deprecated@
+ * '_cupsRasterReadHeader()' - Read a raster page header.
  */
 
-unsigned                               /* O - 1 on success, 0 on failure/end-of-file */
-cupsRasterReadHeader(
-    cups_raster_t      *r,             /* I - Raster stream */
-    cups_page_header_t *h)             /* I - Pointer to header data */
+unsigned                               /* O - 1 on success, 0 on fail */
+_cupsRasterReadHeader(
+    cups_raster_t *r)                  /* I - Raster stream */
 {
-  DEBUG_printf(("cupsRasterReadHeader(r=%p, h=%p)", (void *)r, (void *)h));
+  size_t       len;                    /* Length for read/swap */
 
- /*
-  * Get the raster header...
-  */
 
-  if (!cups_raster_read_header(r))
-  {
-    memset(h, 0, sizeof(cups_page_header_t));
-    DEBUG_puts("1cupsRasterReadHeader: Unable to read page header, returning 0.");
+  DEBUG_printf(("3_cupsRasterReadHeader(r=%p), r->mode=%s", (void *)r, r ? cups_modes[r->mode] : ""));
+
+  if (r == NULL || r->mode != CUPS_RASTER_READ)
     return (0);
-  }
+
+  DEBUG_printf(("4_cupsRasterReadHeader: r->iocount=" CUPS_LLFMT, CUPS_LLCAST r->iocount));
+
+  memset(&(r->header), 0, sizeof(r->header));
 
  /*
-  * Copy the header to the user-supplied buffer...
+  * Read the header...
   */
 
-  memcpy(h, &(r->header), sizeof(cups_page_header_t));
+  switch (r->sync)
+  {
+    default :
+       /*
+       * Get the length of the raster header...
+       */
 
-  DEBUG_printf(("1cupsRasterReadHeader: cupsColorSpace=%s", cups_color_spaces[h->cupsColorSpace]));
-  DEBUG_printf(("1cupsRasterReadHeader: cupsBitsPerColor=%u", h->cupsBitsPerColor));
-  DEBUG_printf(("1cupsRasterReadHeader: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
-  DEBUG_printf(("1cupsRasterReadHeader: cupsBytesPerLine=%u", h->cupsBytesPerLine));
-  DEBUG_printf(("1cupsRasterReadHeader: cupsWidth=%u", h->cupsWidth));
-  DEBUG_printf(("1cupsRasterReadHeader: cupsHeight=%u", h->cupsHeight));
+       if (r->sync == CUPS_RASTER_SYNCv1 || r->sync == CUPS_RASTER_REVSYNCv1)
+         len = sizeof(cups_page_header_t);
+       else
+         len = sizeof(cups_page_header2_t);
 
-  DEBUG_puts("1cupsRasterReadHeader: Returning 1.");
-  return (1);
-}
+       DEBUG_printf(("4_cupsRasterReadHeader: len=%d", (int)len));
 
+       /*
+        * Read it...
+        */
 
-/*
- * 'cupsRasterReadHeader2()' - Read a raster page header and store it in a
- *                             version 2 page header structure.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+       if (cups_raster_read(r, (unsigned char *)&(r->header), len) < (ssize_t)len)
+       {
+         DEBUG_printf(("4_cupsRasterReadHeader: EOF, r->iocount=" CUPS_LLFMT, CUPS_LLCAST r->iocount));
+         return (0);
+       }
 
-unsigned                               /* O - 1 on success, 0 on failure/end-of-file */
-cupsRasterReadHeader2(
-    cups_raster_t       *r,            /* I - Raster stream */
-    cups_page_header2_t *h)            /* I - Pointer to header data */
-{
- /*
-  * Get the raster header...
-  */
+       /*
+       * Swap bytes as needed...
+       */
 
-  DEBUG_printf(("cupsRasterReadHeader2(r=%p, h=%p)", (void *)r, (void *)h));
+       if (r->swapped)
+       {
+         unsigned      *s,             /* Current word */
+                       temp;           /* Temporary copy */
 
-  if (!cups_raster_read_header(r))
-  {
-    memset(h, 0, sizeof(cups_page_header2_t));
-    DEBUG_puts("1cupsRasterReadHeader2: Unable to read header, returning 0.");
-    return (0);
+
+         DEBUG_puts("4_cupsRasterReadHeader: Swapping header bytes.");
+
+         for (len = 81, s = &(r->header.AdvanceDistance);
+              len > 0;
+              len --, s ++)
+         {
+           temp = *s;
+           *s   = ((temp & 0xff) << 24) |
+                  ((temp & 0xff00) << 8) |
+                  ((temp & 0xff0000) >> 8) |
+                  ((temp & 0xff000000) >> 24);
+
+           DEBUG_printf(("4_cupsRasterReadHeader: %08x => %08x", temp, *s));
+         }
+       }
+        break;
+
+    case CUPS_RASTER_SYNCapple :
+    case CUPS_RASTER_REVSYNCapple :
+        {
+          unsigned char        appleheader[32];        /* Raw header */
+          static const unsigned rawcspace[] =
+          {
+            CUPS_CSPACE_SW,
+            CUPS_CSPACE_SRGB,
+            CUPS_CSPACE_RGBW,
+            CUPS_CSPACE_ADOBERGB,
+            CUPS_CSPACE_W,
+            CUPS_CSPACE_RGB,
+            CUPS_CSPACE_CMYK
+          };
+          static const unsigned rawnumcolors[] =
+          {
+            1,
+            3,
+            4,
+            3,
+            1,
+            3,
+            4
+          };
+
+         if (cups_raster_read(r, appleheader, sizeof(appleheader)) < (ssize_t)sizeof(appleheader))
+         {
+           DEBUG_printf(("4_cupsRasterReadHeader: EOF, r->iocount=" CUPS_LLFMT, CUPS_LLCAST r->iocount));
+           return (0);
+         }
+
+         strlcpy(r->header.MediaClass, "PwgRaster", sizeof(r->header.MediaClass));
+                                             /* PwgRaster */
+          r->header.cupsBitsPerPixel = appleheader[0];
+          r->header.cupsColorSpace   = appleheader[1] >= (sizeof(rawcspace) / sizeof(rawcspace[0])) ? CUPS_CSPACE_DEVICE1 : rawcspace[appleheader[1]];
+          r->header.cupsNumColors    = appleheader[1] >= (sizeof(rawnumcolors) / sizeof(rawnumcolors[0])) ? 1 : rawnumcolors[appleheader[1]];
+          r->header.cupsBitsPerColor = r->header.cupsBitsPerPixel / r->header.cupsNumColors;
+          r->header.cupsWidth        = ((((((unsigned)appleheader[12] << 8) | (unsigned)appleheader[13]) << 8) | (unsigned)appleheader[14]) << 8) | (unsigned)appleheader[15];
+          r->header.cupsHeight       = ((((((unsigned)appleheader[16] << 8) | (unsigned)appleheader[17]) << 8) | (unsigned)appleheader[18]) << 8) | (unsigned)appleheader[19];
+          r->header.cupsBytesPerLine = r->header.cupsWidth * r->header.cupsBitsPerPixel / 8;
+          r->header.cupsColorOrder   = CUPS_ORDER_CHUNKED;
+          r->header.HWResolution[0]  = r->header.HWResolution[1] = ((((((unsigned)appleheader[20] << 8) | (unsigned)appleheader[21]) << 8) | (unsigned)appleheader[22]) << 8) | (unsigned)appleheader[23];
+
+          if (r->header.HWResolution[0] > 0)
+          {
+           r->header.PageSize[0]     = (unsigned)(r->header.cupsWidth * 72 / r->header.HWResolution[0]);
+           r->header.PageSize[1]     = (unsigned)(r->header.cupsHeight * 72 / r->header.HWResolution[1]);
+           r->header.cupsPageSize[0] = (float)(r->header.cupsWidth * 72.0 / r->header.HWResolution[0]);
+           r->header.cupsPageSize[1] = (float)(r->header.cupsHeight * 72.0 / r->header.HWResolution[1]);
+          }
+
+          r->header.cupsInteger[0] = r->apple_page_count;
+          r->header.cupsInteger[7] = 0xffffff;
+        }
+        break;
   }
 
  /*
-  * Copy the header to the user-supplied buffer...
+  * Update the header and row count...
   */
 
-  memcpy(h, &(r->header), sizeof(cups_page_header2_t));
+  if (!cups_raster_update(r))
+    return (0);
 
-  DEBUG_printf(("1cupsRasterReadHeader2: cupsColorSpace=%s", cups_color_spaces[h->cupsColorSpace]));
-  DEBUG_printf(("1cupsRasterReadHeader2: cupsBitsPerColor=%u", h->cupsBitsPerColor));
-  DEBUG_printf(("1cupsRasterReadHeader2: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
-  DEBUG_printf(("1cupsRasterReadHeader2: cupsBytesPerLine=%u", h->cupsBytesPerLine));
-  DEBUG_printf(("1cupsRasterReadHeader2: cupsWidth=%u", h->cupsWidth));
-  DEBUG_printf(("1cupsRasterReadHeader2: cupsHeight=%u", h->cupsHeight));
+  DEBUG_printf(("4_cupsRasterReadHeader: cupsBitsPerPixel=%u, cupsBitsPerColor=%u, cupsBytesPerLine=%u, cupsWidth=%u, cupsHeight=%u, r->bpp=%d", r->header.cupsBitsPerPixel, r->header.cupsBitsPerColor, r->header.cupsBytesPerLine, r->header.cupsWidth, r->header.cupsHeight, r->bpp));
 
-  DEBUG_puts("1cupsRasterReadHeader2: Returning 1.");
-  return (1);
+  return (r->header.cupsBitsPerPixel > 0 && r->header.cupsBitsPerPixel <= 240 && r->header.cupsBitsPerColor > 0 && r->header.cupsBitsPerColor <= 16 && r->header.cupsBytesPerLine > 0 && r->header.cupsBytesPerLine <= 0x7fffffff && r->header.cupsHeight != 0 && (r->header.cupsBytesPerLine % r->bpp) == 0);
 }
 
 
 /*
- * 'cupsRasterReadPixels()' - Read raster pixels.
+ * '_cupsRasterReadPixels()' - Read raster pixels.
  *
  * For best performance, filters should read one or more whole lines.
  * The "cupsBytesPerLine" value from the page header can be used to allocate
@@ -698,9 +708,10 @@ cupsRasterReadHeader2(
  */
 
 unsigned                               /* O - Number of bytes read */
-cupsRasterReadPixels(cups_raster_t *r, /* I - Raster stream */
-                     unsigned char *p, /* I - Pointer to pixel buffer */
-                    unsigned      len) /* I - Number of bytes to read */
+_cupsRasterReadPixels(
+    cups_raster_t *r,                  /* I - Raster stream */
+    unsigned char *p,                  /* I - Pointer to pixel buffer */
+    unsigned      len)                 /* I - Number of bytes to read */
 {
   ssize_t      bytes;                  /* Bytes read */
   unsigned     cupsBytesPerLine;       /* cupsBytesPerLine value */
@@ -711,16 +722,16 @@ cupsRasterReadPixels(cups_raster_t *r,    /* I - Raster stream */
   unsigned     count;                  /* Repetition count */
 
 
-  DEBUG_printf(("cupsRasterReadPixels(r=%p, p=%p, len=%u)", (void *)r, (void *)p, len));
+  DEBUG_printf(("_cupsRasterReadPixels(r=%p, p=%p, len=%u)", (void *)r, (void *)p, len));
 
   if (r == NULL || r->mode != CUPS_RASTER_READ || r->remaining == 0 ||
       r->header.cupsBytesPerLine == 0)
   {
-    DEBUG_puts("1cupsRasterReadPixels: Returning 0.");
+    DEBUG_puts("1_cupsRasterReadPixels: Returning 0.");
     return (0);
   }
 
-  DEBUG_printf(("1cupsRasterReadPixels: compressed=%d, remaining=%u", r->compressed, r->remaining));
+  DEBUG_printf(("1_cupsRasterReadPixels: compressed=%d, remaining=%u", r->compressed, r->remaining));
 
   if (!r->compressed)
   {
@@ -732,7 +743,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
 
     if (cups_raster_io(r, p, len) < (ssize_t)len)
     {
-      DEBUG_puts("1cupsRasterReadPixels: Read error, returning 0.");
+      DEBUG_puts("1_cupsRasterReadPixels: Read error, returning 0.");
       return (0);
     }
 
@@ -750,7 +761,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
     * Return...
     */
 
-    DEBUG_printf(("1cupsRasterReadPixels: Returning %u", len));
+    DEBUG_printf(("1_cupsRasterReadPixels: Returning %u", len));
 
     return (len);
   }
@@ -781,7 +792,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
 
       if (!cups_raster_read(r, &byte, 1))
       {
-       DEBUG_puts("1cupsRasterReadPixels: Read error, returning 0.");
+       DEBUG_puts("1_cupsRasterReadPixels: Read error, returning 0.");
        return (0);
       }
 
@@ -801,7 +812,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
 
         if (!cups_raster_read(r, &byte, 1))
        {
-         DEBUG_puts("1cupsRasterReadPixels: Read error, returning 0.");
+         DEBUG_puts("1_cupsRasterReadPixels: Read error, returning 0.");
          return (0);
        }
 
@@ -842,7 +853,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
 
           if (!cups_raster_read(r, temp, count))
          {
-           DEBUG_puts("1cupsRasterReadPixels: Read error, returning 0.");
+           DEBUG_puts("1_cupsRasterReadPixels: Read error, returning 0.");
            return (0);
          }
 
@@ -866,7 +877,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
 
           if (!cups_raster_read(r, temp, r->bpp))
          {
-           DEBUG_puts("1cupsRasterReadPixels: Read error, returning 0.");
+           DEBUG_puts("1_cupsRasterReadPixels: Read error, returning 0.");
            return (0);
          }
 
@@ -891,7 +902,7 @@ cupsRasterReadPixels(cups_raster_t *r,      /* I - Raster stream */
            r->header.cupsBitsPerPixel == 16) &&
           r->swapped)
       {
-        DEBUG_puts("1cupsRasterReadPixels: Swapping bytes.");
+        DEBUG_puts("1_cupsRasterReadPixels: Swapping bytes.");
         cups_swap(ptr, (size_t)cupsBytesPerLine);
       }
 
@@ -943,60 +954,44 @@ cupsRasterReadPixels(cups_raster_t *r,    /* I - Raster stream */
     p         += bytes;
   }
 
-  DEBUG_printf(("1cupsRasterReadPixels: Returning %u", len));
+  DEBUG_printf(("1_cupsRasterReadPixels: Returning %u", len));
 
   return (len);
 }
 
 
 /*
- * 'cupsRasterWriteHeader()' - Write a raster page header from a version 1 page
- *                             header structure.
- *
- * This function is deprecated. Use @link cupsRasterWriteHeader2@ instead.
- *
- * @deprecated@
+ * '_cupsRasterWriteHeader()' - Write a raster page header.
  */
 
 unsigned                               /* O - 1 on success, 0 on failure */
-cupsRasterWriteHeader(
-    cups_raster_t      *r,             /* I - Raster stream */
-    cups_page_header_t *h)             /* I - Raster page header */
+_cupsRasterWriteHeader(
+    cups_raster_t *r)                  /* I - Raster stream */
 {
-  DEBUG_printf(("cupsRasterWriteHeader(r=%p, h=%p)", (void *)r, (void *)h));
-
-  if (r == NULL || r->mode == CUPS_RASTER_READ)
-  {
-    DEBUG_puts("1cupsRasterWriteHeader: Returning 0.");
-    return (0);
-  }
+  DEBUG_printf(("_cupsRasterWriteHeader(r=%p)", (void *)r));
 
-  DEBUG_printf(("1cupsRasterWriteHeader: cupsColorSpace=%s", cups_color_spaces[h->cupsColorSpace]));
-  DEBUG_printf(("1cupsRasterWriteHeader: cupsBitsPerColor=%u", h->cupsBitsPerColor));
-  DEBUG_printf(("1cupsRasterWriteHeader: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
-  DEBUG_printf(("1cupsRasterWriteHeader: cupsBytesPerLine=%u", h->cupsBytesPerLine));
-  DEBUG_printf(("1cupsRasterWriteHeader: cupsWidth=%u", h->cupsWidth));
-  DEBUG_printf(("1cupsRasterWriteHeader: cupsHeight=%u", h->cupsHeight));
+  DEBUG_printf(("1_cupsRasterWriteHeader: cupsColorSpace=%s", _cupsRasterColorSpaceString(r->header.cupsColorSpace)));
+  DEBUG_printf(("1_cupsRasterWriteHeader: cupsBitsPerColor=%u", r->header.cupsBitsPerColor));
+  DEBUG_printf(("1_cupsRasterWriteHeader: cupsBitsPerPixel=%u", r->header.cupsBitsPerPixel));
+  DEBUG_printf(("1_cupsRasterWriteHeader: cupsBytesPerLine=%u", r->header.cupsBytesPerLine));
+  DEBUG_printf(("1_cupsRasterWriteHeader: cupsWidth=%u", r->header.cupsWidth));
+  DEBUG_printf(("1_cupsRasterWriteHeader: cupsHeight=%u", r->header.cupsHeight));
 
  /*
-  * Make a copy of the header, and compute the number of raster
-  * lines in the page image...
+  * Compute the number of raster lines in the page image...
   */
 
-  memset(&(r->header), 0, sizeof(r->header));
-  memcpy(&(r->header), h, sizeof(cups_page_header_t));
-
   if (!cups_raster_update(r))
   {
-    DEBUG_puts("1cupsRasterWriteHeader: Unable to update parameters, returning 0.");
+    DEBUG_puts("1_cupsRasterWriteHeader: Unable to update parameters, returning 0.");
     return (0);
   }
 
   if (r->mode == CUPS_RASTER_WRITE_APPLE)
   {
-    r->rowheight = h->HWResolution[0] / h->HWResolution[1];
+    r->rowheight = r->header.HWResolution[0] / r->header.HWResolution[1];
 
-    if (h->HWResolution[0] != (r->rowheight * h->HWResolution[1]))
+    if (r->header.HWResolution[0] != (r->rowheight * r->header.HWResolution[1]))
       return (0);
   }
   else
@@ -1147,182 +1142,7 @@ cupsRasterWriteHeader(
 
 
 /*
- * 'cupsRasterWriteHeader2()' - Write a raster page header from a version 2
- *                              page header structure.
- *
- * The page header can be initialized using @link cupsRasterInitPWGHeader@.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
-
-unsigned                               /* O - 1 on success, 0 on failure */
-cupsRasterWriteHeader2(
-    cups_raster_t       *r,            /* I - Raster stream */
-    cups_page_header2_t *h)            /* I - Raster page header */
-{
-  DEBUG_printf(("cupsRasterWriteHeader(r=%p, h=%p)", (void *)r, (void *)h));
-
-  if (r == NULL || r->mode == CUPS_RASTER_READ)
-  {
-    DEBUG_puts("1cupsRasterWriteHeader2: Returning 0.");
-    return (0);
-  }
-
-  DEBUG_printf(("1cupsRasterWriteHeader2: cupsColorSpace=%s", cups_color_spaces[h->cupsColorSpace]));
-  DEBUG_printf(("1cupsRasterWriteHeader2: cupsBitsPerColor=%u", h->cupsBitsPerColor));
-  DEBUG_printf(("1cupsRasterWriteHeader2: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
-  DEBUG_printf(("1cupsRasterWriteHeader2: cupsBytesPerLine=%u", h->cupsBytesPerLine));
-  DEBUG_printf(("1cupsRasterWriteHeader2: cupsWidth=%u", h->cupsWidth));
-  DEBUG_printf(("1cupsRasterWriteHeader2: cupsHeight=%u", h->cupsHeight));
-
- /*
-  * Make a copy of the header, and compute the number of raster
-  * lines in the page image...
-  */
-
-  memcpy(&(r->header), h, sizeof(cups_page_header2_t));
-
-  if (!cups_raster_update(r))
-  {
-    DEBUG_puts("1cupsRasterWriteHeader: Unable to update parameters, returning 0.");
-    return (0);
-  }
-
-  if (r->mode == CUPS_RASTER_WRITE_APPLE)
-  {
-    r->rowheight = h->HWResolution[0] / h->HWResolution[1];
-
-    if (h->HWResolution[0] != (r->rowheight * h->HWResolution[1]))
-      return (0);
-  }
-  else
-    r->rowheight = 1;
-
- /*
-  * Write the raster header...
-  */
-
-  if (r->mode == CUPS_RASTER_WRITE_PWG)
-  {
-   /*
-    * PWG raster data is always network byte order with most of the page header
-    * zeroed.
-    */
-
-    cups_page_header2_t        fh;             /* File page header */
-
-    memset(&fh, 0, sizeof(fh));
-    strlcpy(fh.MediaClass, "PwgRaster", sizeof(fh.MediaClass));
-    strlcpy(fh.MediaColor, r->header.MediaColor, sizeof(fh.MediaColor));
-    strlcpy(fh.MediaType, r->header.MediaType, sizeof(fh.MediaType));
-    strlcpy(fh.OutputType, r->header.OutputType, sizeof(fh.OutputType));
-    strlcpy(fh.cupsRenderingIntent, r->header.cupsRenderingIntent,
-            sizeof(fh.cupsRenderingIntent));
-    strlcpy(fh.cupsPageSizeName, r->header.cupsPageSizeName,
-            sizeof(fh.cupsPageSizeName));
-
-    fh.CutMedia              = htonl(r->header.CutMedia);
-    fh.Duplex                = htonl(r->header.Duplex);
-    fh.HWResolution[0]       = htonl(r->header.HWResolution[0]);
-    fh.HWResolution[1]       = htonl(r->header.HWResolution[1]);
-    fh.ImagingBoundingBox[0] = htonl(r->header.ImagingBoundingBox[0]);
-    fh.ImagingBoundingBox[1] = htonl(r->header.ImagingBoundingBox[1]);
-    fh.ImagingBoundingBox[2] = htonl(r->header.ImagingBoundingBox[2]);
-    fh.ImagingBoundingBox[3] = htonl(r->header.ImagingBoundingBox[3]);
-    fh.InsertSheet           = htonl(r->header.InsertSheet);
-    fh.Jog                   = htonl(r->header.Jog);
-    fh.LeadingEdge           = htonl(r->header.LeadingEdge);
-    fh.ManualFeed            = htonl(r->header.ManualFeed);
-    fh.MediaPosition         = htonl(r->header.MediaPosition);
-    fh.MediaWeight           = htonl(r->header.MediaWeight);
-    fh.NumCopies             = htonl(r->header.NumCopies);
-    fh.Orientation           = htonl(r->header.Orientation);
-    fh.PageSize[0]           = htonl(r->header.PageSize[0]);
-    fh.PageSize[1]           = htonl(r->header.PageSize[1]);
-    fh.Tumble                = htonl(r->header.Tumble);
-    fh.cupsWidth             = htonl(r->header.cupsWidth);
-    fh.cupsHeight            = htonl(r->header.cupsHeight);
-    fh.cupsBitsPerColor      = htonl(r->header.cupsBitsPerColor);
-    fh.cupsBitsPerPixel      = htonl(r->header.cupsBitsPerPixel);
-    fh.cupsBytesPerLine      = htonl(r->header.cupsBytesPerLine);
-    fh.cupsColorOrder        = htonl(r->header.cupsColorOrder);
-    fh.cupsColorSpace        = htonl(r->header.cupsColorSpace);
-    fh.cupsNumColors         = htonl(r->header.cupsNumColors);
-    fh.cupsInteger[0]        = htonl(r->header.cupsInteger[0]);
-    fh.cupsInteger[1]        = htonl(r->header.cupsInteger[1]);
-    fh.cupsInteger[2]        = htonl(r->header.cupsInteger[2]);
-    fh.cupsInteger[3]        = htonl((unsigned)(r->header.cupsImagingBBox[0] * r->header.HWResolution[0] / 72.0));
-    fh.cupsInteger[4]        = htonl((unsigned)(r->header.cupsImagingBBox[1] * r->header.HWResolution[1] / 72.0));
-    fh.cupsInteger[5]        = htonl((unsigned)(r->header.cupsImagingBBox[2] * r->header.HWResolution[0] / 72.0));
-    fh.cupsInteger[6]        = htonl((unsigned)(r->header.cupsImagingBBox[3] * r->header.HWResolution[1] / 72.0));
-    fh.cupsInteger[7]        = htonl(0xffffff);
-
-    return (cups_raster_io(r, (unsigned char *)&fh, sizeof(fh)) == sizeof(fh));
-  }
-  else if (r->mode == CUPS_RASTER_WRITE_APPLE)
-  {
-   /*
-    * Raw raster data is always network byte order with most of the page header
-    * zeroed.
-    */
-
-    unsigned char appleheader[32];     /* Raw page header */
-    unsigned height = r->header.cupsHeight * r->rowheight;
-                                       /* Computed page height */
-
-    if (r->apple_page_count == 0xffffffffU)
-    {
-     /*
-      * Write raw page count from raster page header...
-      */
-
-      r->apple_page_count = r->header.cupsInteger[0];
-
-      appleheader[0] = 'A';
-      appleheader[1] = 'S';
-      appleheader[2] = 'T';
-      appleheader[3] = 0;
-      appleheader[4] = (unsigned char)(r->apple_page_count >> 24);
-      appleheader[5] = (unsigned char)(r->apple_page_count >> 16);
-      appleheader[6] = (unsigned char)(r->apple_page_count >> 8);
-      appleheader[7] = (unsigned char)(r->apple_page_count);
-
-      if (cups_raster_io(r, appleheader, 8) != 8)
-        return (0);
-    }
-
-    memset(appleheader, 0, sizeof(appleheader));
-
-    appleheader[0]  = (unsigned char)r->header.cupsBitsPerPixel;
-    appleheader[1]  = r->header.cupsColorSpace == CUPS_CSPACE_SRGB ? 1 :
-                        r->header.cupsColorSpace == CUPS_CSPACE_RGBW ? 2 :
-                        r->header.cupsColorSpace == CUPS_CSPACE_ADOBERGB ? 3 :
-                        r->header.cupsColorSpace == CUPS_CSPACE_W ? 4 :
-                        r->header.cupsColorSpace == CUPS_CSPACE_RGB ? 5 :
-                        r->header.cupsColorSpace == CUPS_CSPACE_CMYK ? 6 : 0;
-    appleheader[12] = (unsigned char)(r->header.cupsWidth >> 24);
-    appleheader[13] = (unsigned char)(r->header.cupsWidth >> 16);
-    appleheader[14] = (unsigned char)(r->header.cupsWidth >> 8);
-    appleheader[15] = (unsigned char)(r->header.cupsWidth);
-    appleheader[16] = (unsigned char)(height >> 24);
-    appleheader[17] = (unsigned char)(height >> 16);
-    appleheader[18] = (unsigned char)(height >> 8);
-    appleheader[19] = (unsigned char)(height);
-    appleheader[20] = (unsigned char)(r->header.HWResolution[0] >> 24);
-    appleheader[21] = (unsigned char)(r->header.HWResolution[0] >> 16);
-    appleheader[22] = (unsigned char)(r->header.HWResolution[0] >> 8);
-    appleheader[23] = (unsigned char)(r->header.HWResolution[0]);
-
-    return (cups_raster_io(r, appleheader, sizeof(appleheader)) == sizeof(appleheader));
-  }
-  else
-    return (cups_raster_io(r, (unsigned char *)&(r->header), sizeof(r->header))
-               == sizeof(r->header));
-}
-
-
-/*
- * 'cupsRasterWritePixels()' - Write raster pixels.
+ * '_cupsRasterWritePixels()' - Write raster pixels.
  *
  * For best performance, filters should write one or more whole lines.
  * The "cupsBytesPerLine" value from the page header can be used to allocate
@@ -1330,15 +1150,16 @@ cupsRasterWriteHeader2(
  */
 
 unsigned                               /* O - Number of bytes written */
-cupsRasterWritePixels(cups_raster_t *r,        /* I - Raster stream */
-                      unsigned char *p,        /* I - Bytes to write */
-                     unsigned      len)/* I - Number of bytes to write */
+_cupsRasterWritePixels(
+    cups_raster_t *r,                  /* I - Raster stream */
+    unsigned char *p,                  /* I - Bytes to write */
+    unsigned      len)                 /* I - Number of bytes to write */
 {
   ssize_t      bytes;                  /* Bytes read */
   unsigned     remaining;              /* Bytes remaining */
 
 
-  DEBUG_printf(("cupsRasterWritePixels(r=%p, p=%p, len=%u), remaining=%u", (void *)r, (void *)p, len, r->remaining));
+  DEBUG_printf(("_cupsRasterWritePixels(r=%p, p=%p, len=%u), remaining=%u", (void *)r, (void *)p, len, r->remaining));
 
   if (r == NULL || r->mode == CUPS_RASTER_READ || r->remaining == 0)
     return (0);
@@ -1501,151 +1322,6 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */
 }
 
 
-/*
- * 'cups_raster_read_header()' - Read a raster page header.
- */
-
-static unsigned                                /* O - 1 on success, 0 on fail */
-cups_raster_read_header(
-    cups_raster_t *r)                  /* I - Raster stream */
-{
-  size_t       len;                    /* Length for read/swap */
-
-
-  DEBUG_printf(("3cups_raster_read_header(r=%p), r->mode=%s", (void *)r, r ? cups_modes[r->mode] : ""));
-
-  if (r == NULL || r->mode != CUPS_RASTER_READ)
-    return (0);
-
-  DEBUG_printf(("4cups_raster_read_header: r->iocount=" CUPS_LLFMT, CUPS_LLCAST r->iocount));
-
-  memset(&(r->header), 0, sizeof(r->header));
-
- /*
-  * Read the header...
-  */
-
-  switch (r->sync)
-  {
-    default :
-       /*
-       * Get the length of the raster header...
-       */
-
-       if (r->sync == CUPS_RASTER_SYNCv1 || r->sync == CUPS_RASTER_REVSYNCv1)
-         len = sizeof(cups_page_header_t);
-       else
-         len = sizeof(cups_page_header2_t);
-
-       DEBUG_printf(("4cups_raster_read_header: len=%d", (int)len));
-
-       /*
-        * Read it...
-        */
-
-       if (cups_raster_read(r, (unsigned char *)&(r->header), len) < (ssize_t)len)
-       {
-         DEBUG_printf(("4cups_raster_read_header: EOF, r->iocount=" CUPS_LLFMT, CUPS_LLCAST r->iocount));
-         return (0);
-       }
-
-       /*
-       * Swap bytes as needed...
-       */
-
-       if (r->swapped)
-       {
-         unsigned      *s,             /* Current word */
-                       temp;           /* Temporary copy */
-
-
-         DEBUG_puts("4cups_raster_read_header: Swapping header bytes.");
-
-         for (len = 81, s = &(r->header.AdvanceDistance);
-              len > 0;
-              len --, s ++)
-         {
-           temp = *s;
-           *s   = ((temp & 0xff) << 24) |
-                  ((temp & 0xff00) << 8) |
-                  ((temp & 0xff0000) >> 8) |
-                  ((temp & 0xff000000) >> 24);
-
-           DEBUG_printf(("4cups_raster_read_header: %08x => %08x", temp, *s));
-         }
-       }
-        break;
-
-    case CUPS_RASTER_SYNCapple :
-    case CUPS_RASTER_REVSYNCapple :
-        {
-          unsigned char        appleheader[32];        /* Raw header */
-          static const unsigned rawcspace[] =
-          {
-            CUPS_CSPACE_SW,
-            CUPS_CSPACE_SRGB,
-            CUPS_CSPACE_RGBW,
-            CUPS_CSPACE_ADOBERGB,
-            CUPS_CSPACE_W,
-            CUPS_CSPACE_RGB,
-            CUPS_CSPACE_CMYK
-          };
-          static const unsigned rawnumcolors[] =
-          {
-            1,
-            3,
-            4,
-            3,
-            1,
-            3,
-            4
-          };
-
-         if (cups_raster_read(r, appleheader, sizeof(appleheader)) < (ssize_t)sizeof(appleheader))
-         {
-           DEBUG_printf(("4cups_raster_read_header: EOF, r->iocount=" CUPS_LLFMT, CUPS_LLCAST r->iocount));
-           return (0);
-         }
-
-         strlcpy(r->header.MediaClass, "PwgRaster", sizeof(r->header.MediaClass));
-                                             /* PwgRaster */
-          r->header.cupsBitsPerPixel = appleheader[0];
-          r->header.cupsColorSpace   = appleheader[1] >= (sizeof(rawcspace) / sizeof(rawcspace[0])) ? CUPS_CSPACE_DEVICE1 : rawcspace[appleheader[1]];
-          r->header.cupsNumColors    = appleheader[1] >= (sizeof(rawnumcolors) / sizeof(rawnumcolors[0])) ? 1 : rawnumcolors[appleheader[1]];
-          r->header.cupsBitsPerColor = r->header.cupsBitsPerPixel / r->header.cupsNumColors;
-          r->header.cupsWidth        = ((((((unsigned)appleheader[12] << 8) | (unsigned)appleheader[13]) << 8) | (unsigned)appleheader[14]) << 8) | (unsigned)appleheader[15];
-          r->header.cupsHeight       = ((((((unsigned)appleheader[16] << 8) | (unsigned)appleheader[17]) << 8) | (unsigned)appleheader[18]) << 8) | (unsigned)appleheader[19];
-          r->header.cupsBytesPerLine = r->header.cupsWidth * r->header.cupsBitsPerPixel / 8;
-          r->header.cupsColorOrder   = CUPS_ORDER_CHUNKED;
-          r->header.HWResolution[0]  = r->header.HWResolution[1] = ((((((unsigned)appleheader[20] << 8) | (unsigned)appleheader[21]) << 8) | (unsigned)appleheader[22]) << 8) | (unsigned)appleheader[23];
-
-          if (r->header.HWResolution[0] > 0)
-          {
-           r->header.PageSize[0]     = (unsigned)(r->header.cupsWidth * 72 / r->header.HWResolution[0]);
-           r->header.PageSize[1]     = (unsigned)(r->header.cupsHeight * 72 / r->header.HWResolution[1]);
-           r->header.cupsPageSize[0] = (float)(r->header.cupsWidth * 72.0 / r->header.HWResolution[0]);
-           r->header.cupsPageSize[1] = (float)(r->header.cupsHeight * 72.0 / r->header.HWResolution[1]);
-          }
-
-          r->header.cupsInteger[0] = r->apple_page_count;
-          r->header.cupsInteger[7] = 0xffffff;
-        }
-        break;
-  }
-
- /*
-  * Update the header and row count...
-  */
-
-  if (!cups_raster_update(r))
-    return (0);
-
-  DEBUG_printf(("4cups_raster_read_header: cupsBitsPerPixel=%u, cupsBitsPerColor=%u, cupsBytesPerLine=%u, cupsWidth=%u, cupsHeight=%u, r->bpp=%d", r->header.cupsBitsPerPixel, r->header.cupsBitsPerColor, r->header.cupsBytesPerLine, r->header.cupsWidth, r->header.cupsHeight, r->bpp));
-
-  return (r->header.cupsBitsPerPixel > 0 && r->header.cupsBitsPerPixel <= 240 && r->header.cupsBitsPerColor > 0 && r->header.cupsBitsPerColor <= 16 && r->header.cupsBytesPerLine > 0 && r->header.cupsBytesPerLine <= 0x7fffffff && r->header.cupsHeight != 0 && (r->header.cupsBytesPerLine % r->bpp) == 0);
-}
-
-
 /*
  * 'cups_raster_io()' - Read/write bytes from a context, handling interruptions.
  */
@@ -2117,37 +1793,6 @@ cups_raster_write(
 }
 
 
-/*
- * 'cups_read_fd()' - Read bytes from a file.
- */
-
-static ssize_t                         /* O - Bytes read or -1 */
-cups_read_fd(void          *ctx,       /* I - File descriptor as pointer */
-             unsigned char *buf,       /* I - Buffer for read */
-            size_t        bytes)       /* I - Maximum number of bytes to read */
-{
-  int          fd = (int)((intptr_t)ctx);
-                                       /* File descriptor */
-  ssize_t      count;                  /* Number of bytes read */
-
-
-#ifdef _WIN32 /* Sigh */
-  while ((count = read(fd, buf, (unsigned)bytes)) < 0)
-#else
-  while ((count = read(fd, buf, bytes)) < 0)
-#endif /* _WIN32 */
-    if (errno != EINTR && errno != EAGAIN)
-    {
-      DEBUG_printf(("8cups_read_fd: %s", strerror(errno)));
-      return (-1);
-    }
-
-  DEBUG_printf(("8cups_read_fd: Returning %d bytes.", (int)count));
-
-  return (count);
-}
-
-
 /*
  * 'cups_swap()' - Swap bytes in raster data...
  */
@@ -2196,32 +1841,3 @@ cups_swap_copy(
     bytes --;
   }
 }
-
-
-/*
- * 'cups_write_fd()' - Write bytes to a file.
- */
-
-static ssize_t                         /* O - Bytes written or -1 */
-cups_write_fd(void          *ctx,      /* I - File descriptor pointer */
-              unsigned char *buf,      /* I - Bytes to write */
-             size_t        bytes)      /* I - Number of bytes to write */
-{
-  int          fd = (int)((intptr_t)ctx);
-                                       /* File descriptor */
-  ssize_t      count;                  /* Number of bytes written */
-
-
-#ifdef _WIN32 /* Sigh */
-  while ((count = write(fd, buf, (unsigned)bytes)) < 0)
-#else
-  while ((count = write(fd, buf, bytes)) < 0)
-#endif /* _WIN32 */
-    if (errno != EINTR && errno != EAGAIN)
-    {
-      DEBUG_printf(("8cups_write_fd: %s", strerror(errno)));
-      return (-1);
-    }
-
-  return (count);
-}
diff --git a/cups/raster-stubs.c b/cups/raster-stubs.c
new file mode 100644 (file)
index 0000000..34dde82
--- /dev/null
@@ -0,0 +1,397 @@
+/*
+ * Imaging library stubs for CUPS.
+ *
+ * Copyright © 2018 by Apple Inc.
+ *
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include <cups/raster-private.h>
+
+
+/*
+ * These stubs wrap the real functions in libcups - this allows one library to
+ * provide all of the CUPS API functions while still supporting the old split
+ * library organization...
+ */
+
+
+/*
+ * Local functions...
+ */
+
+static ssize_t cups_read_fd(void *ctx, unsigned char *buf, size_t bytes);
+static ssize_t cups_write_fd(void *ctx, unsigned char *buf, size_t bytes);
+
+
+
+/*
+ * 'cupsRasterClose()' - Close a raster stream.
+ *
+ * The file descriptor associated with the raster stream must be closed
+ * separately as needed.
+ */
+
+void
+cupsRasterClose(cups_raster_t *r)      /* I - Stream to close */
+{
+  _cupsRasterDelete(r);
+}
+
+
+/*
+ * 'cupsRasterErrorString()' - Return the last error from a raster function.
+ *
+ * If there are no recent errors, `NULL` is returned.
+ *
+ * @since CUPS 1.3/macOS 10.5@
+ */
+
+const char *                           /* O - Last error or `NULL` */
+cupsRasterErrorString(void)
+{
+  return (_cupsRasterErrorString());
+}
+
+
+/*
+ * 'cupsRasterInitPWGHeader()' - Initialize a page header for PWG Raster output.
+ *
+ * The "media" argument specifies the media to use.
+ *
+ * The "type" argument specifies a "pwg-raster-document-type-supported" value
+ * that controls the color space and bit depth of the raster data.
+ *
+ * The "xres" and "yres" arguments specify the raster resolution in dots per
+ * inch.
+ *
+ * The "sheet_back" argument specifies a "pwg-raster-document-sheet-back" value
+ * to apply for the back side of a page.  Pass @code NULL@ for the front side.
+ *
+ * @since CUPS 2.2/macOS 10.12@
+ */
+
+int                                    /* O - 1 on success, 0 on failure */
+cupsRasterInitPWGHeader(
+    cups_page_header2_t *h,            /* I - Page header */
+    pwg_media_t         *media,                /* I - PWG media information */
+    const char          *type,         /* I - PWG raster type string */
+    int                 xdpi,          /* I - Cross-feed direction (horizontal) resolution */
+    int                 ydpi,          /* I - Feed direction (vertical) resolution */
+    const char          *sides,                /* I - IPP "sides" option value */
+    const char          *sheet_back)   /* I - Transform for back side or @code NULL@ for none */
+{
+  return (_cupsRasterInitPWGHeader(h, media, type, xdpi, ydpi, sides, sheet_back));
+}
+
+
+/*
+ * 'cupsRasterOpen()' - Open a raster stream using a file descriptor.
+ *
+ * This function associates a raster stream with the given file descriptor.
+ * For most printer driver filters, "fd" will be 0 (stdin).  For most raster
+ * image processor (RIP) filters that generate raster data, "fd" will be 1
+ * (stdout).
+ *
+ * When writing raster data, the @code CUPS_RASTER_WRITE@,
+ * @code CUPS_RASTER_WRITE_COMPRESS@, or @code CUPS_RASTER_WRITE_PWG@ mode can
+ * be used - compressed and PWG output is generally 25-50% smaller but adds a
+ * 100-300% execution time overhead.
+ */
+
+cups_raster_t *                                /* O - New stream */
+cupsRasterOpen(int         fd,         /* I - File descriptor */
+               cups_mode_t mode)       /* I - Mode - @code CUPS_RASTER_READ@,
+                                              @code CUPS_RASTER_WRITE@,
+                                              @code CUPS_RASTER_WRITE_COMPRESSED@,
+                                              or @code CUPS_RASTER_WRITE_PWG@ */
+{
+  if (mode == CUPS_RASTER_READ)
+    return (_cupsRasterNew(cups_read_fd, (void *)((intptr_t)fd), mode));
+  else
+    return (_cupsRasterNew(cups_write_fd, (void *)((intptr_t)fd), mode));
+}
+
+
+/*
+ * 'cupsRasterOpenIO()' - Open a raster stream using a callback function.
+ *
+ * This function associates a raster stream with the given callback function and
+ * context pointer.
+ *
+ * When writing raster data, the @code CUPS_RASTER_WRITE@,
+ * @code CUPS_RASTER_WRITE_COMPRESS@, or @code CUPS_RASTER_WRITE_PWG@ mode can
+ * be used - compressed and PWG output is generally 25-50% smaller but adds a
+ * 100-300% execution time overhead.
+ */
+
+cups_raster_t *                                /* O - New stream */
+cupsRasterOpenIO(
+    cups_raster_iocb_t iocb,           /* I - Read/write callback */
+    void               *ctx,           /* I - Context pointer for callback */
+    cups_mode_t        mode)           /* I - Mode - @code CUPS_RASTER_READ@,
+                                              @code CUPS_RASTER_WRITE@,
+                                              @code CUPS_RASTER_WRITE_COMPRESSED@,
+                                              or @code CUPS_RASTER_WRITE_PWG@ */
+{
+  return (_cupsRasterNew(iocb, ctx, mode));
+}
+
+
+/*
+ * 'cupsRasterReadHeader()' - Read a raster page header and store it in a
+ *                            version 1 page header structure.
+ *
+ * This function is deprecated. Use @link cupsRasterReadHeader2@ instead.
+ *
+ * Version 1 page headers were used in CUPS 1.0 and 1.1 and contain a subset
+ * of the version 2 page header data. This function handles reading version 2
+ * page headers and copying only the version 1 data into the provided buffer.
+ *
+ * @deprecated@
+ */
+
+unsigned                               /* O - 1 on success, 0 on failure/end-of-file */
+cupsRasterReadHeader(
+    cups_raster_t      *r,             /* I - Raster stream */
+    cups_page_header_t *h)             /* I - Pointer to header data */
+{
+  DEBUG_printf(("cupsRasterReadHeader(r=%p, h=%p)", (void *)r, (void *)h));
+
+ /*
+  * Get the raster header...
+  */
+
+  if (!_cupsRasterReadHeader(r))
+  {
+    memset(h, 0, sizeof(cups_page_header_t));
+    DEBUG_puts("1cupsRasterReadHeader: Unable to read page header, returning 0.");
+    return (0);
+  }
+
+ /*
+  * Copy the header to the user-supplied buffer...
+  */
+
+  memcpy(h, &(r->header), sizeof(cups_page_header_t));
+
+  DEBUG_printf(("1cupsRasterReadHeader: cupsColorSpace=%s", _cupsRasterColorSpaceString(h->cupsColorSpace)));
+  DEBUG_printf(("1cupsRasterReadHeader: cupsBitsPerColor=%u", h->cupsBitsPerColor));
+  DEBUG_printf(("1cupsRasterReadHeader: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
+  DEBUG_printf(("1cupsRasterReadHeader: cupsBytesPerLine=%u", h->cupsBytesPerLine));
+  DEBUG_printf(("1cupsRasterReadHeader: cupsWidth=%u", h->cupsWidth));
+  DEBUG_printf(("1cupsRasterReadHeader: cupsHeight=%u", h->cupsHeight));
+
+  DEBUG_puts("1cupsRasterReadHeader: Returning 1.");
+  return (1);
+}
+
+
+/*
+ * 'cupsRasterReadHeader2()' - Read a raster page header and store it in a
+ *                             version 2 page header structure.
+ *
+ * @since CUPS 1.2/macOS 10.5@
+ */
+
+unsigned                               /* O - 1 on success, 0 on failure/end-of-file */
+cupsRasterReadHeader2(
+    cups_raster_t       *r,            /* I - Raster stream */
+    cups_page_header2_t *h)            /* I - Pointer to header data */
+{
+ /*
+  * Get the raster header...
+  */
+
+  DEBUG_printf(("cupsRasterReadHeader2(r=%p, h=%p)", (void *)r, (void *)h));
+
+  if (!_cupsRasterReadHeader(r))
+  {
+    memset(h, 0, sizeof(cups_page_header2_t));
+    DEBUG_puts("1cupsRasterReadHeader2: Unable to read header, returning 0.");
+    return (0);
+  }
+
+ /*
+  * Copy the header to the user-supplied buffer...
+  */
+
+  memcpy(h, &(r->header), sizeof(cups_page_header2_t));
+
+  DEBUG_printf(("1cupsRasterReadHeader2: cupsColorSpace=%s", _cupsRasterColorSpaceString(h->cupsColorSpace)));
+  DEBUG_printf(("1cupsRasterReadHeader2: cupsBitsPerColor=%u", h->cupsBitsPerColor));
+  DEBUG_printf(("1cupsRasterReadHeader2: cupsBitsPerPixel=%u", h->cupsBitsPerPixel));
+  DEBUG_printf(("1cupsRasterReadHeader2: cupsBytesPerLine=%u", h->cupsBytesPerLine));
+  DEBUG_printf(("1cupsRasterReadHeader2: cupsWidth=%u", h->cupsWidth));
+  DEBUG_printf(("1cupsRasterReadHeader2: cupsHeight=%u", h->cupsHeight));
+
+  DEBUG_puts("1cupsRasterReadHeader2: Returning 1.");
+  return (1);
+}
+
+
+/*
+ * 'cupsRasterReadPixels()' - Read raster pixels.
+ *
+ * For best performance, filters should read one or more whole lines.
+ * The "cupsBytesPerLine" value from the page header can be used to allocate
+ * the line buffer and as the number of bytes to read.
+ */
+
+unsigned                               /* O - Number of bytes read */
+cupsRasterReadPixels(
+    cups_raster_t *r,                  /* I - Raster stream */
+    unsigned char *p,                  /* I - Pointer to pixel buffer */
+    unsigned      len)                 /* I - Number of bytes to read */
+{
+  return (_cupsRasterReadPixels(r, p, len));
+}
+
+
+/*
+ * 'cupsRasterWriteHeader()' - Write a raster page header from a version 1 page
+ *                             header structure.
+ *
+ * This function is deprecated. Use @link cupsRasterWriteHeader2@ instead.
+ *
+ * @deprecated@
+ */
+
+unsigned                               /* O - 1 on success, 0 on failure */
+cupsRasterWriteHeader(
+    cups_raster_t      *r,             /* I - Raster stream */
+    cups_page_header_t *h)             /* I - Raster page header */
+{
+  DEBUG_printf(("cupsRasterWriteHeader(r=%p, h=%p)", (void *)r, (void *)h));
+
+  if (r == NULL || r->mode == CUPS_RASTER_READ)
+  {
+    DEBUG_puts("1cupsRasterWriteHeader: Stream NULL or open for reading, returning 0.");
+    return (0);
+  }
+
+ /*
+  * Make a copy of the header and write using the private function...
+  */
+
+  memset(&(r->header), 0, sizeof(r->header));
+  memcpy(&(r->header), h, sizeof(cups_page_header_t));
+
+  return (_cupsRasterWriteHeader(r));
+}
+
+
+/*
+ * 'cupsRasterWriteHeader2()' - Write a raster page header from a version 2
+ *                              page header structure.
+ *
+ * The page header can be initialized using @link cupsRasterInitPWGHeader@.
+ *
+ * @since CUPS 1.2/macOS 10.5@
+ */
+
+unsigned                               /* O - 1 on success, 0 on failure */
+cupsRasterWriteHeader2(
+    cups_raster_t       *r,            /* I - Raster stream */
+    cups_page_header2_t *h)            /* I - Raster page header */
+{
+  DEBUG_printf(("cupsRasterWriteHeader(r=%p, h=%p)", (void *)r, (void *)h));
+
+  if (r == NULL || r->mode == CUPS_RASTER_READ)
+  {
+    DEBUG_puts("1cupsRasterWriteHeader2: Stream NULL or open for reading, returning 0.");
+    return (0);
+  }
+
+ /*
+  * Make a copy of the header, and compute the number of raster
+  * lines in the page image...
+  */
+
+  memcpy(&(r->header), h, sizeof(cups_page_header2_t));
+
+  return (_cupsRasterWriteHeader(r));
+}
+
+
+/*
+ * 'cupsRasterWritePixels()' - Write raster pixels.
+ *
+ * For best performance, filters should write one or more whole lines.
+ * The "cupsBytesPerLine" value from the page header can be used to allocate
+ * the line buffer and as the number of bytes to write.
+ */
+
+unsigned                               /* O - Number of bytes written */
+cupsRasterWritePixels(
+    cups_raster_t *r,                  /* I - Raster stream */
+    unsigned char *p,                  /* I - Bytes to write */
+    unsigned      len)                 /* I - Number of bytes to write */
+{
+  return (_cupsRasterWritePixels(r, p, len));
+}
+
+
+/*
+ * 'cups_read_fd()' - Read bytes from a file.
+ */
+
+static ssize_t                         /* O - Bytes read or -1 */
+cups_read_fd(void          *ctx,       /* I - File descriptor as pointer */
+             unsigned char *buf,       /* I - Buffer for read */
+            size_t        bytes)       /* I - Maximum number of bytes to read */
+{
+  int          fd = (int)((intptr_t)ctx);
+                                       /* File descriptor */
+  ssize_t      count;                  /* Number of bytes read */
+
+
+#ifdef _WIN32 /* Sigh */
+  while ((count = read(fd, buf, (unsigned)bytes)) < 0)
+#else
+  while ((count = read(fd, buf, bytes)) < 0)
+#endif /* _WIN32 */
+    if (errno != EINTR && errno != EAGAIN)
+    {
+      DEBUG_printf(("8cups_read_fd: %s", strerror(errno)));
+      return (-1);
+    }
+
+  DEBUG_printf(("8cups_read_fd: Returning %d bytes.", (int)count));
+
+  return (count);
+}
+
+
+/*
+ * 'cups_write_fd()' - Write bytes to a file.
+ */
+
+static ssize_t                         /* O - Bytes written or -1 */
+cups_write_fd(void          *ctx,      /* I - File descriptor pointer */
+              unsigned char *buf,      /* I - Bytes to write */
+             size_t        bytes)      /* I - Number of bytes to write */
+{
+  int          fd = (int)((intptr_t)ctx);
+                                       /* File descriptor */
+  ssize_t      count;                  /* Number of bytes written */
+
+
+#ifdef _WIN32 /* Sigh */
+  while ((count = write(fd, buf, (unsigned)bytes)) < 0)
+#else
+  while ((count = write(fd, buf, bytes)) < 0)
+#endif /* _WIN32 */
+    if (errno != EINTR && errno != EAGAIN)
+    {
+      DEBUG_printf(("8cups_write_fd: %s", strerror(errno)));
+      return (-1);
+    }
+
+  return (count);
+}
index 329e72c1c21888980eb4a353bf8f412550835984..7d98a4e8ae68debaa2354eb876e080cc7680ad99 100644 (file)
@@ -1,12 +1,13 @@
 /*
  * Raster file definitions for CUPS.
  *
- * Copyright 2007-2016 by Apple Inc.
- * Copyright 1997-2006 by Easy Software Products.
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 1997-2006 by Easy Software Products.
  *
  * This file is part of the CUPS Imaging library.
  *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  */
 
 #ifndef _CUPS_RASTER_H_
@@ -353,20 +354,6 @@ typedef struct cups_page_header2_s /**** Version 2 page header @since CUPS 1.2/m
 typedef struct _cups_raster_s cups_raster_t;
                                        /**** Raster stream data ****/
 
-typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits);
-                                       /**** cupsRasterInterpretPPD callback function
-                                        *
-                                        * This function is called by
-                                        * @link cupsRasterInterpretPPD@ to
-                                        * validate (and update, as needed)
-                                        * the page header attributes. The
-                                        * "preferred_bits" argument provides
-                                        * the value of the
-                                        * @code cupsPreferredBitsPerColor@
-                                        * key from the PostScript page device
-                                        * dictionary and is 0 if undefined.
-                                        ****/
-
 /**** New in CUPS 1.5 ****/
 typedef ssize_t (*cups_raster_iocb_t)(void *ctx, unsigned char *buffer, size_t length);
                                        /**** cupsRasterOpenIO callback function
@@ -385,29 +372,22 @@ typedef ssize_t (*cups_raster_iocb_t)(void *ctx, unsigned char *buffer, size_t l
  * Prototypes...
  */
 
-extern void            cupsRasterClose(cups_raster_t *r);
-extern cups_raster_t   *cupsRasterOpen(int fd, cups_mode_t mode);
-extern unsigned                cupsRasterReadHeader(cups_raster_t *r,
-                                            cups_page_header_t *h) _CUPS_DEPRECATED_MSG("Use cupsRasterReadHeader2 instead.");
-extern unsigned                cupsRasterReadPixels(cups_raster_t *r,
-                                            unsigned char *p, unsigned len);
-extern unsigned                cupsRasterWriteHeader(cups_raster_t *r,
-                                             cups_page_header_t *h) _CUPS_DEPRECATED_MSG("Use cupsRasterWriteHeader2 instead.");
-extern unsigned                cupsRasterWritePixels(cups_raster_t *r,
-                                             unsigned char *p, unsigned len);
+extern void            cupsRasterClose(cups_raster_t *r) _CUPS_PUBLIC;
+extern cups_raster_t   *cupsRasterOpen(int fd, cups_mode_t mode) _CUPS_PUBLIC;
+extern unsigned                cupsRasterReadHeader(cups_raster_t *r, cups_page_header_t *h) _CUPS_DEPRECATED_MSG("Use cupsRasterReadHeader2 instead.") _CUPS_PUBLIC;
+extern unsigned                cupsRasterReadPixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PUBLIC;
+extern unsigned                cupsRasterWriteHeader(cups_raster_t *r, cups_page_header_t *h) _CUPS_DEPRECATED_MSG("Use cupsRasterWriteHeader2 instead.") _CUPS_PUBLIC;
+extern unsigned                cupsRasterWritePixels(cups_raster_t *r, unsigned char *p, unsigned len) _CUPS_PUBLIC;
 
 /**** New in CUPS 1.2 ****/
-extern unsigned                cupsRasterReadHeader2(cups_raster_t *r,
-                                             cups_page_header2_t *h) _CUPS_API_1_2;
-extern unsigned                cupsRasterWriteHeader2(cups_raster_t *r,
-                                              cups_page_header2_t *h) _CUPS_API_1_2;
+extern unsigned                cupsRasterReadHeader2(cups_raster_t *r, cups_page_header2_t *h) _CUPS_API_1_2;
+extern unsigned                cupsRasterWriteHeader2(cups_raster_t *r, cups_page_header2_t *h) _CUPS_API_1_2;
 
 /**** New in CUPS 1.3 ****/
 extern const char      *cupsRasterErrorString(void) _CUPS_API_1_3;
 
 /**** New in CUPS 1.5 ****/
-extern cups_raster_t   *cupsRasterOpenIO(cups_raster_iocb_t iocb, void *ctx,
-                                         cups_mode_t mode);
+extern cups_raster_t   *cupsRasterOpenIO(cups_raster_iocb_t iocb, void *ctx, cups_mode_t mode) _CUPS_API_1_5;
 
 /**** New in CUPS 2.2/macOS 10.12 ****/
 extern int             cupsRasterInitPWGHeader(cups_page_header2_t *h, pwg_media_t *media, const char *type, int xdpi, int ydpi, const char *sides, const char *sheet_back) _CUPS_API_2_2;
index 4cdbee74964a8d108a9ce2368cc6a3b1d307c328..376d04f59f780532abd2ed4aab5c7c5d4835a100 100644 (file)
                724FA76F1CC03B820092477B /* cgi-private.h in Headers */ = {isa = PBXBuildFile; fileRef = 727EF030192E3498001EF690 /* cgi-private.h */; settings = {ATTRIBUTES = (Private, ); }; };
                724FA7701CC03B820092477B /* cgi.h in Headers */ = {isa = PBXBuildFile; fileRef = 727EF031192E3498001EF690 /* cgi.h */; settings = {ATTRIBUTES = (Private, ); }; };
                724FA7711CC03B920092477B /* raster-private.h in Headers */ = {isa = PBXBuildFile; fileRef = 2767FC76192696A0000F61D3 /* raster-private.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               7253C454216E97FF00494ADD /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 72F75A691336FA8A004BB496 /* error.c */; };
+               7253C455216E980000494ADD /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 72F75A691336FA8A004BB496 /* error.c */; };
+               7253C456216E980200494ADD /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 72F75A691336FA8A004BB496 /* error.c */; };
+               7253C457216E981000494ADD /* raster.c in Sources */ = {isa = PBXBuildFile; fileRef = 72F75A6B1336FA8A004BB496 /* raster.c */; };
+               7253C458216E981200494ADD /* raster.c in Sources */ = {isa = PBXBuildFile; fileRef = 72F75A6B1336FA8A004BB496 /* raster.c */; };
+               7253C459216E981200494ADD /* raster.c in Sources */ = {isa = PBXBuildFile; fileRef = 72F75A6B1336FA8A004BB496 /* raster.c */; };
+               7253C45A216E981900494ADD /* interpret.c in Sources */ = {isa = PBXBuildFile; fileRef = 72F75A6A1336FA8A004BB496 /* interpret.c */; };
+               7253C45B216E981A00494ADD /* interpret.c in Sources */ = {isa = PBXBuildFile; fileRef = 72F75A6A1336FA8A004BB496 /* interpret.c */; };
                7258EAED134594EB009286F1 /* rastertopwg.c in Sources */ = {isa = PBXBuildFile; fileRef = 7258EAEC134594EB009286F1 /* rastertopwg.c */; };
                7258EAF413459B6D009286F1 /* libcups.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72220EAE1333047D00FCA411 /* libcups.dylib */; };
                7258EAF513459B6D009286F1 /* libcupsimage.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72F75A611336F9A3004BB496 /* libcupsimage.dylib */; };
                                270696121CADF3E200FFE5FB /* http-addrlist.c in Sources */,
                                270696131CADF3E200FFE5FB /* http-support.c in Sources */,
                                270696141CADF3E200FFE5FB /* http.c in Sources */,
+                               7253C458216E981200494ADD /* raster.c in Sources */,
                                270696161CADF3E200FFE5FB /* dest-options.c in Sources */,
                                270696171CADF3E200FFE5FB /* ipp-support.c in Sources */,
                                270696181CADF3E200FFE5FB /* ipp.c in Sources */,
                                270696291CADF3E200FFE5FB /* request.c in Sources */,
                                2706962C1CADF3E200FFE5FB /* snprintf.c in Sources */,
                                2706962D1CADF3E200FFE5FB /* string.c in Sources */,
+                               7253C455216E980000494ADD /* error.c in Sources */,
                                2706965B1CAE1A9A00FFE5FB /* util.c in Sources */,
                                2706962E1CADF3E200FFE5FB /* tempfile.c in Sources */,
                                2706962F1CADF3E200FFE5FB /* thread.c in Sources */,
                        files = (
                                274FF68B1333B1C400317ECB /* adminutil.c in Sources */,
                                274FF68C1333B1C400317ECB /* array.c in Sources */,
+                               7253C459216E981200494ADD /* raster.c in Sources */,
                                274FF68D1333B1C400317ECB /* ppd-attr.c in Sources */,
                                274FF68E1333B1C400317ECB /* auth.c in Sources */,
                                274FF68F1333B1C400317ECB /* backchannel.c in Sources */,
                                274FF69E1333B1C400317ECB /* http-addrlist.c in Sources */,
                                274FF69F1333B1C400317ECB /* http-support.c in Sources */,
                                274FF6A01333B1C400317ECB /* http.c in Sources */,
+                               7253C45B216E981A00494ADD /* interpret.c in Sources */,
                                72A8B3D81C188CB900A1A547 /* ppd-util.c in Sources */,
                                2767FC7419268F0C000F61D3 /* dest-options.c in Sources */,
                                274FF6A11333B1C400317ECB /* ipp-support.c in Sources */,
                                274FF6AA1333B1C400317ECB /* options.c in Sources */,
                                727AD5B819100A58009F6862 /* tls.c in Sources */,
                                274FF6AB1333B1C400317ECB /* ppd-page.c in Sources */,
+                               7253C456216E980200494ADD /* error.c in Sources */,
                                274FF6AC1333B1C400317ECB /* ppd-cache.c in Sources */,
                                2767FC7219268F06000F61D3 /* dest-job.c in Sources */,
                                274FF6AD1333B1C400317ECB /* ppd.c in Sources */,
                        files = (
                                72220EB61333052D00FCA411 /* adminutil.c in Sources */,
                                72220EC51333056300FCA411 /* array.c in Sources */,
+                               7253C457216E981000494ADD /* raster.c in Sources */,
                                72220EC71333056300FCA411 /* ppd-attr.c in Sources */,
                                727AD5B719100A58009F6862 /* tls.c in Sources */,
                                72220EC81333056300FCA411 /* auth.c in Sources */,
                                72220F18133305BB00FCA411 /* http-addr.c in Sources */,
                                72220F19133305BB00FCA411 /* http-addrlist.c in Sources */,
                                72220F1B133305BB00FCA411 /* http-support.c in Sources */,
+                               7253C45A216E981900494ADD /* interpret.c in Sources */,
                                72A8B3D71C188CB800A1A547 /* ppd-util.c in Sources */,
                                72220F1C133305BB00FCA411 /* http.c in Sources */,
                                72CF95E518A13543000FCAE4 /* dest-options.c in Sources */,
                                72220F2B133305BB00FCA411 /* notify.c in Sources */,
                                72220F2C133305BB00FCA411 /* options.c in Sources */,
                                72220F2D133305BB00FCA411 /* ppd-page.c in Sources */,
+                               7253C454216E97FF00494ADD /* error.c in Sources */,
                                72220F2E133305BB00FCA411 /* ppd-cache.c in Sources */,
                                72220F30133305BB00FCA411 /* ppd.c in Sources */,
                                72220F32133305BB00FCA411 /* pwg-media.c in Sources */,