aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-05-14 07:15:36 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-05-14 07:15:36 +0000
commit45c37d599b6dffa2410e0140e804381b9867355c (patch)
tree60e4d808511bcb87c7476178dfb08611131d8810
parentcbb7946eb39b3ac6c0b60b6b30dd63178594300e (diff)
parent1fa6c247571d74dfd48aeb585c950ff095d115cd (diff)
downloadlibcups-oreo-r6-release.tar.gz
Change-Id: I3120c32488ea1b1bb96978b15a982a28852a48c2
-rw-r--r--config.h4
-rw-r--r--cups/Makefile2
-rw-r--r--cups/adminutil.c2
-rw-r--r--cups/adminutil.h2
-rw-r--r--cups/api-filter.shtml2
-rw-r--r--cups/array-private.h2
-rw-r--r--cups/array.c2
-rw-r--r--cups/array.h2
-rw-r--r--cups/auth.c9
-rw-r--r--cups/backchannel.c2
-rw-r--r--cups/backend.c2
-rw-r--r--cups/backend.h2
-rw-r--r--cups/cups-private.h5
-rw-r--r--cups/cups.h13
-rw-r--r--cups/debug-private.h2
-rw-r--r--cups/debug.c2
-rw-r--r--cups/dest-job.c2
-rw-r--r--cups/dest-localization.c2
-rw-r--r--cups/dest-options.c2
-rw-r--r--cups/dest.c2
-rw-r--r--cups/dir.c2
-rw-r--r--cups/dir.h2
-rw-r--r--cups/encode.c2
-rw-r--r--cups/file-private.h2
-rw-r--r--cups/file.c2
-rw-r--r--cups/file.h2
-rw-r--r--cups/getdevices.c2
-rw-r--r--cups/getputfile.c2
-rw-r--r--cups/globals.c2
-rw-r--r--cups/hash.c2
-rw-r--r--cups/http-addr.c14
-rw-r--r--cups/http-addrlist.c6
-rw-r--r--cups/http-private.h2
-rw-r--r--cups/http-support.c2
-rw-r--r--cups/http.c5
-rw-r--r--cups/http.h2
-rw-r--r--cups/ipp-private.h2
-rw-r--r--cups/ipp-support.c96
-rw-r--r--cups/ipp.c33
-rw-r--r--cups/ipp.h7
-rw-r--r--cups/langprintf.c2
-rw-r--r--cups/language-private.h11
-rw-r--r--cups/language.c132
-rw-r--r--cups/language.h2
-rw-r--r--cups/libcups2.def2
-rw-r--r--cups/md5passwd.c2
-rw-r--r--cups/notify.c2
-rw-r--r--cups/options.c2
-rw-r--r--cups/ppd-attr.c2
-rw-r--r--cups/ppd-cache.c886
-rw-r--r--cups/ppd-conflicts.c2
-rw-r--r--cups/ppd-custom.c2
-rw-r--r--cups/ppd-emit.c2
-rw-r--r--cups/ppd-localize.c6
-rw-r--r--cups/ppd-mark.c2
-rw-r--r--cups/ppd-page.c2
-rw-r--r--cups/ppd-private.h21
-rw-r--r--cups/ppd-util.c2
-rw-r--r--cups/ppd.c22
-rw-r--r--cups/ppd.h2
-rw-r--r--cups/pwg-media.c141
-rw-r--r--cups/pwg-private.h2
-rw-r--r--cups/pwg.h2
-rw-r--r--cups/raster-private.h2
-rw-r--r--cups/raster.h15
-rw-r--r--cups/request.c2
-rw-r--r--cups/sidechannel.c2
-rw-r--r--cups/sidechannel.h2
-rw-r--r--cups/snprintf.c2
-rw-r--r--cups/string-private.h2
-rw-r--r--cups/string.c2
-rw-r--r--cups/tempfile.c2
-rw-r--r--cups/testadmin.c2
-rw-r--r--cups/testarray.c2
-rw-r--r--cups/testcache.c2
-rw-r--r--cups/testconflicts.c2
-rw-r--r--cups/testcreds.c2
-rw-r--r--cups/testcups.c2
-rw-r--r--cups/testdest.c2
-rw-r--r--cups/testfile.c2
-rw-r--r--cups/testhttp.c2
-rw-r--r--cups/testi18n.c2
-rw-r--r--cups/testipp.c2
-rw-r--r--cups/testlang.c2
-rw-r--r--cups/testoptions.c2
-rw-r--r--cups/testppd.c4
-rw-r--r--cups/testpwg.c2
-rw-r--r--cups/testsnmp.c2
-rw-r--r--cups/thread-private.h2
-rw-r--r--cups/thread.c2
-rw-r--r--cups/tls-darwin.c20
-rw-r--r--cups/tls-gnutls.c2
-rw-r--r--cups/tls-sspi.c2
-rw-r--r--cups/tls.c2
-rw-r--r--cups/tlscheck.c2
-rw-r--r--cups/transcode.c2
-rw-r--r--cups/transcode.h2
-rw-r--r--cups/usersys.c2
-rw-r--r--cups/util.c2
-rw-r--r--cups/versioning.h2
-rw-r--r--filter/Makefile2
-rw-r--r--filter/api-raster.shtml6
-rw-r--r--filter/commandtops.c2
-rw-r--r--filter/common.c2
-rw-r--r--filter/common.h2
-rw-r--r--filter/error.c2
-rw-r--r--filter/gziptoany.c2
-rw-r--r--filter/interpret.c2
-rw-r--r--filter/pstops.c2
-rw-r--r--filter/raster.c327
-rw-r--r--filter/rasterbench.c2
-rw-r--r--filter/rastertoepson.c2
-rw-r--r--filter/rastertohp.c2
-rw-r--r--filter/rastertolabel.c21
-rw-r--r--filter/rastertopwg.c16
-rw-r--r--filter/testraster.c38
-rw-r--r--libcups_version1
-rwxr-xr-xupdate_libcups.sh11
118 files changed, 1427 insertions, 625 deletions
diff --git a/config.h b/config.h
index ba24f782..ec0f673b 100644
--- a/config.h
+++ b/config.h
@@ -17,8 +17,8 @@
#ifndef _CUPS_CONFIG_H_
#define _CUPS_CONFIG_H_
-#define CUPS_SVERSION "CUPS v2.2.1"
-#define CUPS_MINIMAL "CUPS/2.2.1"
+#define CUPS_SVERSION "CUPS v2.2.3"
+#define CUPS_MINIMAL "CUPS/2.2.3"
#define CUPS_DEFAULT_PRINTOPERATOR_AUTH "@SYSTEM"
#define CUPS_DEFAULT_LOG_LEVEL "warn"
#define CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS "dnssd"
diff --git a/cups/Makefile b/cups/Makefile
index ba9bbed4..1df7d855 100644
--- a/cups/Makefile
+++ b/cups/Makefile
@@ -8,7 +8,7 @@
# property of Apple Inc. and are protected by Federal copyright
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
# which should have been included with this file. If this file is
-# file is missing or damaged, see the license at "http://www.cups.org/".
+# missing or damaged, see the license at "http://www.cups.org/".
#
# This file is subject to the Apple OS-Developed Software exception.
#
diff --git a/cups/adminutil.c b/cups/adminutil.c
index 1a6d6a7c..adb1f7ae 100644
--- a/cups/adminutil.c
+++ b/cups/adminutil.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/adminutil.h b/cups/adminutil.h
index cc119fc5..23f79788 100644
--- a/cups/adminutil.h
+++ b/cups/adminutil.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/api-filter.shtml b/cups/api-filter.shtml
index 1b8f6f3c..bd90333c 100644
--- a/cups/api-filter.shtml
+++ b/cups/api-filter.shtml
@@ -94,7 +94,7 @@ being printed.</p>
<p>Filters and backends may also receive <code>SIGPIPE</code> when an upstream or downstream filter/backend exits with a non-zero status. Developers should generally ignore <code>SIGPIPE</code> at the beginning of <code>main()</code> with the following function call:</p>
<pre class="example">
-#include &lt;signal.h&gt;>
+#include &lt;signal.h&gt;
...
diff --git a/cups/array-private.h b/cups/array-private.h
index c563e25d..ff083e4c 100644
--- a/cups/array-private.h
+++ b/cups/array-private.h
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/array.c b/cups/array.c
index b8bec274..dee4f5e4 100644
--- a/cups/array.c
+++ b/cups/array.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/array.h b/cups/array.h
index c7478310..189c6e1d 100644
--- a/cups/array.h
+++ b/cups/array.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/auth.c b/cups/auth.c
index f9187ffa..8348a2cc 100644
--- a/cups/auth.c
+++ b/cups/auth.c
@@ -1,7 +1,7 @@
/*
* Authentication functions for CUPS.
*
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* This file contains Kerberos support code, copyright 2006 by
@@ -11,7 +11,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -386,10 +386,7 @@ _cupsSetNegotiateAuthString(
if (data.sem)
{
- major_status = gss_acquire_cred_ex_f(NULL, GSS_C_NO_NAME, 0,
- GSS_C_INDEFINITE, GSS_KRB5_MECHANISM,
- GSS_C_INITIATE, &identity, &data,
- cups_gss_acquire);
+ major_status = gss_acquire_cred_ex_f(NULL, GSS_C_NO_NAME, 0, GSS_C_INDEFINITE, GSS_KRB5_MECHANISM, GSS_C_INITIATE, (gss_auth_identity_t)&identity, &data, cups_gss_acquire);
if (major_status == GSS_S_COMPLETE)
{
diff --git a/cups/backchannel.c b/cups/backchannel.c
index 13a95602..e804d45b 100644
--- a/cups/backchannel.c
+++ b/cups/backchannel.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/backend.c b/cups/backend.c
index a21ee387..f1646171 100644
--- a/cups/backend.c
+++ b/cups/backend.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/backend.h b/cups/backend.h
index 709fd6eb..274bcd43 100644
--- a/cups/backend.h
+++ b/cups/backend.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/cups-private.h b/cups/cups-private.h
index 998aeec9..264fd01c 100644
--- a/cups/cups-private.h
+++ b/cups/cups-private.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -124,7 +124,8 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
*ppd_size_lut, /* Lookup table for PPD names */
*pwg_size_lut; /* Lookup table for PWG names */
pwg_media_t pwg_media; /* PWG media data for custom size */
- char pwg_name[65]; /* PWG media name for custom size */
+ char pwg_name[65], /* PWG media name for custom size */
+ ppd_name[41]; /* PPD media name for custom size */
/* request.c */
http_t *http; /* Current server connection */
diff --git a/cups/cups.h b/cups/cups.h
index cef5697a..3205dd82 100644
--- a/cups/cups.h
+++ b/cups/cups.h
@@ -1,14 +1,14 @@
/*
* API definitions for CUPS.
*
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -47,10 +47,10 @@ extern "C" {
* Constants...
*/
-# define CUPS_VERSION 2.0201
+# define CUPS_VERSION 2.0203
# define CUPS_VERSION_MAJOR 2
# define CUPS_VERSION_MINOR 2
-# define CUPS_VERSION_PATCH 1
+# define CUPS_VERSION_PATCH 3
# define CUPS_BC_FD 3
/* Back-channel file descriptor for
@@ -233,13 +233,12 @@ enum cups_ptype_e /* Printer type/capability bit
CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands
* @since CUPS 1.2/macOS 10.5@ */
CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered
- * and added @private@
- * @since Deprecated@ */
+ * and added @private@ */
CUPS_PRINTER_SCANNER = 0x2000000, /* Scanner-only device
* @since CUPS 1.4/macOS 10.6@ */
CUPS_PRINTER_MFP = 0x4000000, /* Printer with scanning capabilities
* @since CUPS 1.4/macOS 10.6@ */
- CUPS_PRINTER_3D = 0x8000000, /* Printer with 3D capabilities @since CUPS 2.1@ */
+ CUPS_PRINTER_3D = 0x8000000, /* Printer with 3D capabilities @private@ */
CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT |
* DEFAULT | FAX | REJECTING | DELETE |
* NOT_SHARED | AUTHENTICATED |
diff --git a/cups/debug-private.h b/cups/debug-private.h
index 8d9861cb..23a0ae17 100644
--- a/cups/debug-private.h
+++ b/cups/debug-private.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/debug.c b/cups/debug.c
index a25e4b1a..bd244fe7 100644
--- a/cups/debug.c
+++ b/cups/debug.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/dest-job.c b/cups/dest-job.c
index 146887ee..b0d89b6e 100644
--- a/cups/dest-job.c
+++ b/cups/dest-job.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/dest-localization.c b/cups/dest-localization.c
index 6358b6db..6d75a972 100644
--- a/cups/dest-localization.c
+++ b/cups/dest-localization.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/dest-options.c b/cups/dest-options.c
index fc3fd357..bf9020ba 100644
--- a/cups/dest-options.c
+++ b/cups/dest-options.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/dest.c b/cups/dest.c
index cd7529c0..b06a9ee1 100644
--- a/cups/dest.c
+++ b/cups/dest.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/dir.c b/cups/dir.c
index 074e6594..65b8c4f9 100644
--- a/cups/dir.c
+++ b/cups/dir.c
@@ -10,7 +10,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*/
/*
diff --git a/cups/dir.h b/cups/dir.h
index 98a6767d..d0105441 100644
--- a/cups/dir.h
+++ b/cups/dir.h
@@ -10,7 +10,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*/
#ifndef _CUPS_DIR_H_
diff --git a/cups/encode.c b/cups/encode.c
index d26d86d3..e60aec0d 100644
--- a/cups/encode.c
+++ b/cups/encode.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/file-private.h b/cups/file-private.h
index 6ce11cf9..b8ca431f 100644
--- a/cups/file-private.h
+++ b/cups/file-private.h
@@ -13,7 +13,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/file.c b/cups/file.c
index b81bfe88..a027df40 100644
--- a/cups/file.c
+++ b/cups/file.c
@@ -13,7 +13,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/file.h b/cups/file.h
index 8a4289f3..177c2e90 100644
--- a/cups/file.h
+++ b/cups/file.h
@@ -13,7 +13,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/getdevices.c b/cups/getdevices.c
index 13bebd2f..0f303ba5 100644
--- a/cups/getdevices.c
+++ b/cups/getdevices.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/getputfile.c b/cups/getputfile.c
index 76a30936..ae33bc59 100644
--- a/cups/getputfile.c
+++ b/cups/getputfile.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/globals.c b/cups/globals.c
index 276bbcf5..8a05c3eb 100644
--- a/cups/globals.c
+++ b/cups/globals.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/hash.c b/cups/hash.c
index d52807ef..ede54616 100644
--- a/cups/hash.c
+++ b/cups/hash.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/http-addr.c b/cups/http-addr.c
index dd61d4a0..12d13a69 100644
--- a/cups/http-addr.c
+++ b/cups/http-addr.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -872,6 +872,18 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
}
/*
+ * Convert the hostname to lowercase as needed...
+ */
+
+ if (s[0] != '/')
+ {
+ char *ptr; /* Pointer into string */
+
+ for (ptr = s; *ptr; ptr ++)
+ *ptr = (char)_cups_tolower((int)*ptr);
+ }
+
+ /*
* Return the hostname with as much domain info as we have...
*/
diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c
index e9ef53ea..723bf029 100644
--- a/cups/http-addrlist.c
+++ b/cups/http-addrlist.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -312,7 +312,7 @@ httpAddrConnect2(
DEBUG_printf(("pfds[%d].revents=%x\n", i, pfds[i].revents));
if (pfds[i].revents && !(pfds[i].revents & (POLLERR | POLLHUP)))
# else
- if (FD_ISSET(fds[i], &input) && !FD_ISSET(fds[i], &error))
+ if (FD_ISSET(fds[i], &input_set) && !FD_ISSET(fds[i], &error_set))
# endif /* HAVE_POLL */
{
*sock = fds[i];
@@ -327,7 +327,7 @@ httpAddrConnect2(
# ifdef HAVE_POLL
else if (pfds[i].revents & (POLLERR | POLLHUP))
# else
- else if (FD_ISSET(fds[i], &error))
+ else if (FD_ISSET(fds[i], &error_set))
# endif /* HAVE_POLL */
{
/*
diff --git a/cups/http-private.h b/cups/http-private.h
index ec297071..ec908a66 100644
--- a/cups/http-private.h
+++ b/cups/http-private.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/http-support.c b/cups/http-support.c
index 21776d70..1ca01b27 100644
--- a/cups/http-support.c
+++ b/cups/http-support.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/http.c b/cups/http.c
index b3abbe73..7925513a 100644
--- a/cups/http.c
+++ b/cups/http.c
@@ -11,7 +11,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -3667,6 +3667,9 @@ httpWriteResponse(http_t *http, /* I - HTTP connection */
return (0);
}
+ if (http->state == HTTP_STATE_POST_RECV || http->state == HTTP_STATE_GET)
+ http->state ++;
+
#ifdef HAVE_LIBZ
/*
* Then start any content encoding...
diff --git a/cups/http.h b/cups/http.h
index 00039ee5..ccbf77ee 100644
--- a/cups/http.h
+++ b/cups/http.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/ipp-private.h b/cups/ipp-private.h
index 0dbd97e1..4b1947c6 100644
--- a/cups/ipp-private.h
+++ b/cups/ipp-private.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/ipp-support.c b/cups/ipp-support.c
index fc53573c..b49ac0d2 100644
--- a/cups/ipp-support.c
+++ b/cups/ipp-support.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -429,10 +429,10 @@ static const char * const ipp_document_states[] =
"punch-quad-top", /* Finishings 2.0 */
"punch-quad-right", /* Finishings 2.0 */
"punch-quad-bottom", /* Finishings 2.0 */
- "86",
- "87",
- "88",
- "89",
+ "punch-multiple-left",/* Finishings 2.1/Canon */
+ "punch-multiple-top", /* Finishings 2.1/Canon */
+ "punch-multiple-right",/* Finishings 2.1/Canon */
+ "punch-multiple-bottom",/* Finishings 2.1/Canon */
"fold-accordian", /* Finishings 2.0 */
"fold-double-gate", /* Finishings 2.0 */
"fold-gate", /* Finishings 2.0 */
@@ -443,7 +443,8 @@ static const char * const ipp_document_states[] =
"fold-parallel", /* Finishings 2.0 */
"fold-poster", /* Finishings 2.0 */
"fold-right-gate", /* Finishings 2.0 */
- "fold-z" /* Finishings 2.0 */
+ "fold-z", /* Finishings 2.0 */
+ "fold-engineering-z" /* Finishings 2.1 */
},
* const ipp_finishings_vendor[] =
{
@@ -896,12 +897,14 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"k-octets",
"k-octets-processed",
"last-document",
+ "materials-col-actual", /* IPP 3D */
"media-actual",
"media-col-actual",
"media-input-tray-check-actual",
"media-sheets",
"media-sheets-completed",
"more-info",
+ "multiple-object-handling-actual", /* IPP 3D */
"number-up-actual",
"orientation-requested-actual",
"output-bin-actual",
@@ -913,12 +916,17 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"pages",
"pages-completed",
"pages-completed-current-copy",
+ "platform-temperature-actual", /* IPP 3D */
"presentation-direction-number-up-actual",
+ "print-accuracy-actual", /* IPP 3D */
+ "print-base-actual", /* IPP 3D */
"print-color-mode-actual",
"print-content-optimize-actual",
+ "print-objects-actual", /* IPP 3D */
"print-quality-actual",
"print-rendering-intent-actual",
"print-scaling-actual", /* IPP Paid Printing */
+ "print-supports-actual", /* IPP 3D */
"printer-resolution-actual",
"printer-up-time",
"separator-sheets-actual",
@@ -973,6 +981,20 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"insert-sheet",
"insert-sheet-default",
"insert-sheet-supported",
+ "material-amount-units-supported", /* IPP 3D */
+ "material-diameter-supported", /* IPP 3D */
+ "material-purpose-supported", /* IPP 3D */
+ "material-rate-supported", /* IPP 3D */
+ "material-rate-units-supported", /* IPP 3D */
+ "material-shell-thickness-supported",/* IPP 3D */
+ "material-temperature-supported", /* IPP 3D */
+ "material-type-supported", /* IPP 3D */
+ "materials-col", /* IPP 3D */
+ "materials-col-database", /* IPP 3D */
+ "materials-col-default", /* IPP 3D */
+ "materials-col-ready", /* IPP 3D */
+ "materials-col-supported", /* IPP 3D */
+ "max-materials-col-supported", /* IPP 3D */
"max-stitching-locations-supported",
"media",
"media-back-coating-supported",
@@ -1005,6 +1027,9 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"multiple-document-handling",
"multiple-document-handling-default",
"multiple-document-handling-supported",
+ "multiple-object-handling", /* IPP 3D */
+ "multiple-object-handling-default", /* IPP 3D */
+ "multiple-object-handling-supported",/* IPP 3D */
"number-up",
"number-up-default",
"number-up-supported",
@@ -1033,15 +1058,27 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"pdl-init-file-name-subdirectory-supported",
"pdl-init-file-name-supported",
"pdl-init-file-supported",
+ "platform-temperature", /* IPP 3D */
+ "platform-temperature-default", /* IPP 3D */
+ "platform-temperature-supported", /* IPP 3D */
"presentation-direction-number-up",
"presentation-direction-number-up-default",
"presentation-direction-number-up-supported",
+ "print-accuracy", /* IPP 3D */
+ "print-accuracy-default", /* IPP 3D */
+ "print-accuracy-supported", /* IPP 3D */
+ "print-base", /* IPP 3D */
+ "print-base-default", /* IPP 3D */
+ "print-base-supported", /* IPP 3D */
"print-color-mode",
"print-color-mode-default",
"print-color-mode-supported",
"print-content-optimize",
"print-content-optimize-default",
"print-content-optimize-supported",
+ "print-objects", /* IPP 3D */
+ "print-objects-default", /* IPP 3D */
+ "print-objects-supported", /* IPP 3D */
"print-quality",
"print-quality-default",
"print-quality-supported",
@@ -1051,6 +1088,9 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"print-scaling", /* IPP Paid Printing */
"print-scaling-default", /* IPP Paid Printing */
"print-scaling-supported", /* IPP Paid Printing */
+ "print-supports", /* IPP 3D */
+ "print-supports-default", /* IPP 3D */
+ "print-supports-supported", /* IPP 3D */
"printer-resolution",
"printer-resolution-default",
"printer-resolution-supported",
@@ -1165,10 +1205,12 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"job-state-reasons",
"job-uri",
"job-uuid",
+ "materials-col-actual", /* IPP 3D */
"media-actual",
"media-col-actual",
"media-check-input-tray-actual",
"multiple-document-handling-actual",
+ "multiple-object-handling-actual", /* IPP 3D */
"number-of-documents",
"number-of-intervening-jobs",
"number-up-actual",
@@ -1180,12 +1222,17 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"page-delivery-actual",
"page-order-received-actual",
"page-ranges-actual",
+ "platform-temperature-actual", /* IPP 3D */
"presentation-direction-number-up-actual",
+ "print-accuracy-actual", /* IPP 3D */
+ "print-base-actual", /* IPP 3D */
"print-color-mode-actual",
"print-content-optimize-actual",
+ "print-objects-actual", /* IPP 3D */
"print-quality-actual",
"print-rendering-intent-actual",
"print-scaling-actual", /* IPP Paid Printing */
+ "print-supports-actual", /* IPP 3D */
"printer-resolution-actual",
"separator-sheets-actual",
"sheet-collate-actual",
@@ -1207,6 +1254,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
};
static const char * const job_template[] =
{ /* job-template group */
+ "accuracy-units-supported", /* IPP 3D */
"confirmation-sheet-print", /* IPP FaxOut */
"confirmation-sheet-print-default",
"copies",
@@ -1314,6 +1362,20 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"job-sheets-default",
"job-sheets-supported",
"logo-uri-schemes-supported",
+ "material-amount-units-supported", /* IPP 3D */
+ "material-diameter-supported", /* IPP 3D */
+ "material-purpose-supported", /* IPP 3D */
+ "material-rate-supported", /* IPP 3D */
+ "material-rate-units-supported", /* IPP 3D */
+ "material-shell-thickness-supported",/* IPP 3D */
+ "material-temperature-supported", /* IPP 3D */
+ "material-type-supported", /* IPP 3D */
+ "materials-col", /* IPP 3D */
+ "materials-col-database", /* IPP 3D */
+ "materials-col-default", /* IPP 3D */
+ "materials-col-ready", /* IPP 3D */
+ "materials-col-supported", /* IPP 3D */
+ "max-materials-col-supported", /* IPP 3D */
"max-save-info-supported",
"max-stitching-locations-supported",
"media",
@@ -1347,6 +1409,9 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"multiple-document-handling",
"multiple-document-handling-default",
"multiple-document-handling-supported",
+ "multiple-object-handling", /* IPP 3D */
+ "multiple-object-handling-default", /* IPP 3D */
+ "multiple-object-handling-supported",/* IPP 3D */
"number-of-retries", /* IPP FaxOut */
"number-of-retries-default",
"number-of-retries-supported",
@@ -1384,15 +1449,27 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"pdl-init-file-name-subdirectory-supported",
"pdl-init-file-name-supported",
"pdl-init-file-supported",
+ "platform-temperature", /* IPP 3D */
+ "platform-temperature-default", /* IPP 3D */
+ "platform-temperature-supported", /* IPP 3D */
"presentation-direction-number-up",
"presentation-direction-number-up-default",
"presentation-direction-number-up-supported",
+ "print-accuracy", /* IPP 3D */
+ "print-accuracy-default", /* IPP 3D */
+ "print-accuracy-supported", /* IPP 3D */
+ "print-base", /* IPP 3D */
+ "print-base-default", /* IPP 3D */
+ "print-base-supported", /* IPP 3D */
"print-color-mode",
"print-color-mode-default",
"print-color-mode-supported",
"print-content-optimize",
"print-content-optimize-default",
"print-content-optimize-supported",
+ "print-objects", /* IPP 3D */
+ "print-objects-default", /* IPP 3D */
+ "print-objects-supported", /* IPP 3D */
"print-quality",
"print-quality-default",
"print-quality-supported",
@@ -1402,6 +1479,9 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"print-scaling", /* IPP Paid Printing */
"print-scaling-default", /* IPP Paid Printing */
"print-scaling-supported", /* IPP Paid Printing */
+ "print-supports", /* IPP 3D */
+ "print-supports-default", /* IPP 3D */
+ "print-supports-supported", /* IPP 3D */
"printer-resolution",
"printer-resolution-default",
"printer-resolution-supported",
@@ -1532,6 +1612,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"pages-per-minute",
"pages-per-minute-color",
"pdf-k-octets-supported", /* CUPS extension */
+ "pdf-features-supported", /* IPP 3D */
"pdf-versions-supported", /* CUPS extension */
"pdl-override-supported",
"port-monitor", /* CUPS extension */
@@ -1559,6 +1640,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"printer-get-attributes-supported",
"printer-icc-profiles",
"printer-icons",
+ "printer-id", /* CUPS extension */
"printer-info",
"printer-input-tray", /* IPP JPS3 */
"printer-is-accepting-jobs",
@@ -2043,7 +2125,7 @@ ippOpString(ipp_op_t op) /* I - Operation ID */
* See if the operation ID is a known value...
*/
- if (op >= IPP_OP_PRINT_JOB && op <= IPP_OP_VALIDATE_DOCUMENT)
+ if (op >= IPP_OP_PRINT_JOB && op < (ipp_op_t)(sizeof(ipp_std_ops) / sizeof(ipp_std_ops[0])))
return (ipp_std_ops[op]);
else if (op == IPP_OP_PRIVATE)
return ("windows-ext");
diff --git a/cups/ipp.c b/cups/ipp.c
index 1964962c..817c9d5f 100644
--- a/cups/ipp.c
+++ b/cups/ipp.c
@@ -1,14 +1,14 @@
/*
* Internet Printing Protocol functions for CUPS.
*
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -1419,13 +1419,27 @@ ippContainsString(
case IPP_TAG_CHARSET :
case IPP_TAG_KEYWORD :
case IPP_TAG_LANGUAGE :
+ case IPP_TAG_URI :
+ case IPP_TAG_URISCHEME :
+ for (i = attr->num_values, avalue = attr->values;
+ i > 0;
+ i --, avalue ++)
+ {
+ DEBUG_printf(("1ippContainsString: value[%d]=\"%s\"",
+ attr->num_values - i, avalue->string.text));
+
+ if (!strcmp(value, avalue->string.text))
+ {
+ DEBUG_puts("1ippContainsString: Returning 1 (match)");
+ return (1);
+ }
+ }
+
case IPP_TAG_MIMETYPE :
case IPP_TAG_NAME :
case IPP_TAG_NAMELANG :
case IPP_TAG_TEXT :
case IPP_TAG_TEXTLANG :
- case IPP_TAG_URI :
- case IPP_TAG_URISCHEME :
for (i = attr->num_values, avalue = attr->values;
i > 0;
i --, avalue ++)
@@ -1433,7 +1447,7 @@ ippContainsString(
DEBUG_printf(("1ippContainsString: value[%d]=\"%s\"",
attr->num_values - i, avalue->string.text));
- if (!strcmp(value, avalue->string.text))
+ if (!_cups_strcasecmp(value, avalue->string.text))
{
DEBUG_puts("1ippContainsString: Returning 1 (match)");
return (1);
@@ -2556,13 +2570,16 @@ ippGetString(ipp_attribute_t *attr, /* I - IPP attribute */
int element, /* I - Value number (0-based) */
const char **language)/* O - Language code (@code NULL@ for don't care) */
{
+ ipp_tag_t tag; /* Value tag */
+
+
/*
* Range check input...
*/
- if (!attr || element < 0 || element >= attr->num_values ||
- (attr->value_tag != IPP_TAG_TEXTLANG && attr->value_tag != IPP_TAG_NAMELANG &&
- (attr->value_tag < IPP_TAG_TEXT || attr->value_tag > IPP_TAG_MIMETYPE)))
+ tag = ippGetValueTag(attr);
+
+ if (!attr || element < 0 || element >= attr->num_values || (tag != IPP_TAG_TEXTLANG && tag != IPP_TAG_NAMELANG && (tag < IPP_TAG_TEXT || tag > IPP_TAG_MIMETYPE)))
return (NULL);
/*
diff --git a/cups/ipp.h b/cups/ipp.h
index 84585a27..54d9d4bd 100644
--- a/cups/ipp.h
+++ b/cups/ipp.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -150,6 +150,10 @@ typedef enum ipp_finishings_e /**** Finishings ****/
IPP_FINISHINGS_PUNCH_QUAD_TOP, /* Punch 4 holes top edge */
IPP_FINISHINGS_PUNCH_QUAD_RIGHT, /* Punch 4 holes right side */
IPP_FINISHINGS_PUNCH_QUAD_BOTTOM, /* Punch 4 holes bottom edge */
+ IPP_FINISHINGS_PUNCH_MULTIPLE_LEFT, /* Pucnh multiple holes left side */
+ IPP_FINISHINGS_PUNCH_MULTIPLE_TOP, /* Pucnh multiple holes top edge */
+ IPP_FINISHINGS_PUNCH_MULTIPLE_RIGHT, /* Pucnh multiple holes right side */
+ IPP_FINISHINGS_PUNCH_MULTIPLE_BOTTOM, /* Pucnh multiple holes bottom edge */
IPP_FINISHINGS_FOLD_ACCORDIAN = 90, /* Accordian-fold the paper vertically into four sections */
IPP_FINISHINGS_FOLD_DOUBLE_GATE, /* Fold the top and bottom quarters of the paper towards the midline, then fold in half vertically */
IPP_FINISHINGS_FOLD_GATE, /* Fold the top and bottom quarters of the paper towards the midline */
@@ -161,6 +165,7 @@ typedef enum ipp_finishings_e /**** Finishings ****/
IPP_FINISHINGS_FOLD_POSTER, /* Fold the paper in half horizontally and vertically; sometimes also called a cross fold */
IPP_FINISHINGS_FOLD_RIGHT_GATE, /* Fold the bottom quarter of the paper towards the midline */
IPP_FINISHINGS_FOLD_Z, /* Fold the paper vertically into three sections, forming a Z */
+ IPP_FINISHINGS_FOLD_ENGINEERING_Z, /* Fold the paper vertically into two small sections and one larger, forming an elongated Z */
/* CUPS extensions for finishings (pre-standard versions of values above) */
IPP_FINISHINGS_CUPS_PUNCH_TOP_LEFT = 0x40000046,
diff --git a/cups/langprintf.c b/cups/langprintf.c
index 40a6688e..46b6be51 100644
--- a/cups/langprintf.c
+++ b/cups/langprintf.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/language-private.h b/cups/language-private.h
index a597cd3f..49e4b713 100644
--- a/cups/language-private.h
+++ b/cups/language-private.h
@@ -1,14 +1,14 @@
/*
* Private localization support for CUPS.
*
- * Copyright 2007-2010 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -22,6 +22,9 @@
# include <stdio.h>
# include <cups/transcode.h>
+# ifdef __APPLE__
+# include <CoreFoundation/CoreFoundation.h>
+# endif /* __APPLE__ */
# ifdef __cplusplus
extern "C" {
@@ -51,8 +54,8 @@ typedef struct _cups_message_s /**** Message catalog entry ****/
*/
# ifdef __APPLE__
-extern const char *_cupsAppleLanguage(const char *locale, char *language,
- size_t langsize);
+extern const char *_cupsAppleLanguage(const char *locale, char *language, size_t langsize);
+extern const char *_cupsAppleLocale(CFStringRef languageName, char *locale, size_t localesize);
# endif /* __APPLE__ */
extern void _cupsCharmapFlush(void);
extern const char *_cupsEncodingName(cups_encoding_t encoding);
diff --git a/cups/language.c b/cups/language.c
index f1afeccd..f3a3496b 100644
--- a/cups/language.c
+++ b/cups/language.c
@@ -1,14 +1,14 @@
/*
* I18N/language support for CUPS.
*
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -118,11 +118,13 @@ typedef struct
} _apple_language_locale_t;
static const _apple_language_locale_t apple_language_locale[] =
-{ /* Locale to language ID LUT */
- { "en", "en_US" },
- { "nb", "no" },
- { "zh-Hans", "zh_CN" },
- { "zh-Hant", "zh_TW" }
+{ /* Language to locale ID LUT */
+ { "en", "en_US" },
+ { "nb", "no" },
+ { "nb_NO", "no" },
+ { "zh-Hans", "zh_CN" },
+ { "zh-Hant", "zh_TW" },
+ { "zh-Hant_CN", "zh_TW" }
};
#endif /* __APPLE__ */
@@ -239,6 +241,75 @@ _cupsAppleLanguage(const char *locale, /* I - Locale ID */
return (language);
}
+
+
+/*
+ * '_cupsAppleLocale()' - Get the locale associated with an Apple language ID.
+ */
+
+const char * /* O - Locale */
+_cupsAppleLocale(CFStringRef languageName, /* I - Apple language ID */
+ char *locale, /* I - Buffer for locale */
+ size_t localesize) /* I - Size of buffer */
+{
+ int i; /* Looping var */
+ CFStringRef localeName; /* Locale as a CF string */
+
+
+ localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault, languageName);
+
+ if (localeName)
+ {
+ /*
+ * Copy the locale name and tweak as needed...
+ */
+
+ if (!CFStringGetCString(localeName, locale, (CFIndex)localesize, kCFStringEncodingASCII))
+ *locale = '\0';
+
+ CFRelease(localeName);
+
+ /*
+ * Map new language identifiers to locales...
+ */
+
+ for (i = 0;
+ i < (int)(sizeof(apple_language_locale) /
+ sizeof(apple_language_locale[0]));
+ i ++)
+ {
+ if (!strcmp(locale, apple_language_locale[i].language))
+ {
+ strlcpy(locale, apple_language_locale[i].locale, localesize);
+ break;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Just try the Apple language name...
+ */
+
+ if (!CFStringGetCString(languageName, locale, (CFIndex)localesize, kCFStringEncodingASCII))
+ *locale = '\0';
+ }
+
+ if (!*locale)
+ return (NULL);
+
+ /*
+ * Convert language subtag into region subtag...
+ */
+
+ if (locale[2] == '-')
+ locale[2] = '_';
+
+ if (!strchr(locale, '.'))
+ strlcat(locale, ".UTF-8", localesize);
+
+ return (locale);
+}
#endif /* __APPLE__ */
@@ -1134,13 +1205,11 @@ _cupsMessageNew(void *context) /* I - User data */
static const char * /* O - Locale string */
appleLangDefault(void)
{
- int i; /* Looping var */
CFBundleRef bundle; /* Main bundle (if any) */
CFArrayRef bundleList; /* List of localizations in bundle */
CFPropertyListRef localizationList = NULL;
/* List of localization data */
CFStringRef languageName; /* Current name */
- CFStringRef localeName; /* Canonical from of name */
char *lang; /* LANG environment variable */
_cups_globals_t *cg = _cupsGlobals();
/* Pointer to library globals */
@@ -1225,49 +1294,11 @@ appleLangDefault(void)
if (languageName &&
CFGetTypeID(languageName) == CFStringGetTypeID())
{
- localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(
- kCFAllocatorDefault, languageName);
-
- if (localeName)
- {
- CFStringGetCString(localeName, cg->language, sizeof(cg->language),
- kCFStringEncodingASCII);
- CFRelease(localeName);
-
+ if (_cupsAppleLocale(languageName, cg->language, sizeof(cg->language)))
DEBUG_printf(("3appleLangDefault: cg->language=\"%s\"",
cg->language));
-
- /*
- * Map new language identifiers to locales...
- */
-
- for (i = 0;
- i < (int)(sizeof(apple_language_locale) /
- sizeof(apple_language_locale[0]));
- i ++)
- {
- if (!strcmp(cg->language, apple_language_locale[i].language))
- {
- DEBUG_printf(("3appleLangDefault: mapping \"%s\" to \"%s\"...",
- cg->language, apple_language_locale[i].locale));
- strlcpy(cg->language, apple_language_locale[i].locale,
- sizeof(cg->language));
- break;
- }
- }
-
- /*
- * Convert language subtag into region subtag...
- */
-
- if (cg->language[2] == '-')
- cg->language[2] = '_';
-
- if (!strchr(cg->language, '.'))
- strlcat(cg->language, ".UTF-8", sizeof(cg->language));
- }
else
- DEBUG_puts("3appleLangDefault: Unable to get localeName.");
+ DEBUG_puts("3appleLangDefault: Unable to get locale.");
}
}
@@ -1371,10 +1402,11 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
locale = "Japanese";
else if (!strncmp(locale, "es", 2))
locale = "Spanish";
- else if (!strcmp(locale, "zh_HK"))
+ else if (!strcmp(locale, "zh_HK") || !strncmp(locale, "zh-Hant", 7))
{
/*
* <rdar://problem/22130168>
+ * <rdar://problem/27245567>
*
* Try zh_TW first, then zh... Sigh...
*/
diff --git a/cups/language.h b/cups/language.h
index c378e986..0a3da779 100644
--- a/cups/language.h
+++ b/cups/language.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/libcups2.def b/cups/libcups2.def
index 51be135a..a7be679f 100644
--- a/cups/libcups2.def
+++ b/cups/libcups2.def
@@ -118,8 +118,6 @@ _ppdNormalizeMakeAndModel
_ppdOpen
_ppdOpenFile
_ppdParseOptions
-_pwgGenerateSize
-_pwgInitSize
_pwgInputSlotForSource
_pwgMediaNearSize
_pwgMediaTable
diff --git a/cups/md5passwd.c b/cups/md5passwd.c
index 9714aaae..a9817aaa 100644
--- a/cups/md5passwd.c
+++ b/cups/md5passwd.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/notify.c b/cups/notify.c
index 5f6e7fd5..b58a1364 100644
--- a/cups/notify.c
+++ b/cups/notify.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/options.c b/cups/options.c
index a3f57cfc..aa709928 100644
--- a/cups/options.c
+++ b/cups/options.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/ppd-attr.c b/cups/ppd-attr.c
index 6324e6e1..da026373 100644
--- a/cups/ppd-attr.c
+++ b/cups/ppd-attr.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*/
/*
diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c
index 9ce5cfc3..e7123410 100644
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -1,13 +1,13 @@
/*
* PPD cache implementation for CUPS.
*
- * Copyright 2010-2016 by Apple Inc.
+ * Copyright 2010-2017 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -32,10 +32,10 @@
* Local functions...
*/
+static void pwg_add_finishing(cups_array_t *finishings, ipp_finishings_t template, const char *name, const char *value);
static int pwg_compare_finishings(_pwg_finishings_t *a,
_pwg_finishings_t *b);
static void pwg_free_finishings(_pwg_finishings_t *f);
-static void pwg_free_material(_pwg_material_t *m);
static void pwg_ppdize_name(const char *ipp, char *name, size_t namesize);
static void pwg_ppdize_resolution(ipp_attribute_t *attr, int element, int *xres, int *yres, char *name, size_t namesize);
static void pwg_unppdize_name(const char *ppd, char *name, size_t namesize,
@@ -49,21 +49,20 @@ static void pwg_unppdize_name(const char *ppd, char *name, size_t namesize,
* attributes and values and adds them to the specified IPP request.
*/
-int /* O - New number of copies */
-_cupsConvertOptions(ipp_t *request, /* I - IPP request */
- ppd_file_t *ppd, /* I - PPD file */
- _ppd_cache_t *pc, /* I - PPD cache info */
- ipp_attribute_t *media_col_sup,
- /* I - media-col-supported values */
- ipp_attribute_t *doc_handling_sup,
- /* I - multiple-document-handling-supported values */
- ipp_attribute_t *print_color_mode_sup,
- /* I - Printer supports print-color-mode */
- const char *user, /* I - User info */
- const char *format, /* I - document-format value */
- int copies, /* I - Number of copies */
- int num_options, /* I - Number of options */
- cups_option_t *options) /* I - Options */
+int /* O - New number of copies */
+_cupsConvertOptions(
+ ipp_t *request, /* I - IPP request */
+ ppd_file_t *ppd, /* I - PPD file */
+ _ppd_cache_t *pc, /* I - PPD cache info */
+ ipp_attribute_t *media_col_sup, /* I - media-col-supported values */
+ ipp_attribute_t *doc_handling_sup, /* I - multiple-document-handling-supported values */
+ ipp_attribute_t *print_color_mode_sup,
+ /* I - Printer supports print-color-mode */
+ const char *user, /* I - User info */
+ const char *format, /* I - document-format value */
+ int copies, /* I - Number of copies */
+ int num_options, /* I - Number of options */
+ cups_option_t *options) /* I - Options */
{
int i; /* Looping var */
const char *keyword, /* PWG keyword */
@@ -198,41 +197,42 @@ _cupsConvertOptions(ipp_t *request, /* I - IPP request */
if ((keyword = cupsGetOption("PageSize", num_options, options)) == NULL)
keyword = cupsGetOption("media", num_options, options);
- if ((size = _ppdCacheGetSize(pc, keyword)) != NULL)
+ media_source = _ppdCacheGetSource(pc, cupsGetOption("InputSlot", num_options, options));
+ media_type = _ppdCacheGetType(pc, cupsGetOption("MediaType", num_options, options));
+ size = _ppdCacheGetSize(pc, keyword);
+
+ if (size || media_source || media_type)
{
/*
* Add a media-col value...
*/
- media_size = ippNew();
- ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER,
- "x-dimension", size->width);
- ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER,
- "y-dimension", size->length);
-
media_col = ippNew();
- ippAddCollection(media_col, IPP_TAG_ZERO, "media-size", media_size);
- media_source = _ppdCacheGetSource(pc, cupsGetOption("InputSlot",
- num_options,
- options));
- media_type = _ppdCacheGetType(pc, cupsGetOption("MediaType",
- num_options,
- options));
+ if (size)
+ {
+ media_size = ippNew();
+ ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER,
+ "x-dimension", size->width);
+ ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER,
+ "y-dimension", size->length);
+
+ ippAddCollection(media_col, IPP_TAG_ZERO, "media-size", media_size);
+ }
for (i = 0; i < media_col_sup->num_values; i ++)
{
- if (!strcmp(media_col_sup->values[i].string.text, "media-left-margin"))
+ if (size && !strcmp(media_col_sup->values[i].string.text, "media-left-margin"))
ippAddInteger(media_col, IPP_TAG_ZERO, IPP_TAG_INTEGER, "media-left-margin", size->left);
- else if (!strcmp(media_col_sup->values[i].string.text, "media-bottom-margin"))
+ else if (size && !strcmp(media_col_sup->values[i].string.text, "media-bottom-margin"))
ippAddInteger(media_col, IPP_TAG_ZERO, IPP_TAG_INTEGER, "media-bottom-margin", size->bottom);
- else if (!strcmp(media_col_sup->values[i].string.text, "media-right-margin"))
+ else if (size && !strcmp(media_col_sup->values[i].string.text, "media-right-margin"))
ippAddInteger(media_col, IPP_TAG_ZERO, IPP_TAG_INTEGER, "media-right-margin", size->right);
- else if (!strcmp(media_col_sup->values[i].string.text, "media-top-margin"))
+ else if (size && !strcmp(media_col_sup->values[i].string.text, "media-top-margin"))
ippAddInteger(media_col, IPP_TAG_ZERO, IPP_TAG_INTEGER, "media-top-margin", size->top);
- else if (!strcmp(media_col_sup->values[i].string.text, "media-source") && media_source)
+ else if (media_source && !strcmp(media_col_sup->values[i].string.text, "media-source"))
ippAddString(media_col, IPP_TAG_ZERO, IPP_TAG_KEYWORD, "media-source", NULL, media_source);
- else if (!strcmp(media_col_sup->values[i].string.text, "media-type") && media_type)
+ else if (media_type && !strcmp(media_col_sup->values[i].string.text, "media-type"))
ippAddString(media_col, IPP_TAG_ZERO, IPP_TAG_KEYWORD, "media-type", NULL, media_type);
}
@@ -503,53 +503,6 @@ _ppdCacheCreateWithFile(
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
- else if (!_cups_strcasecmp(line, "3D"))
- {
- pc->cups_3d = _cupsStrAlloc(value);
- }
- else if (!_cups_strcasecmp(line, "LayerOrder"))
- {
- pc->cups_layer_order = _cupsStrAlloc(value);
- }
- else if (!_cups_strcasecmp(line, "Accuracy"))
- {
- sscanf(value, "%d%d%d", pc->cups_accuracy + 0, pc->cups_accuracy + 1, pc->cups_accuracy + 2);
- }
- else if (!_cups_strcasecmp(line, "Volume"))
- {
- sscanf(value, "%d%d%d", pc->cups_volume + 0, pc->cups_volume + 1, pc->cups_volume + 2);
- }
- else if (!_cups_strcasecmp(line, "Material"))
- {
- /*
- * Material key "name" name=value ... name=value
- */
-
- if ((valueptr = strchr(value, ' ')) != NULL)
- {
- _pwg_material_t *material = (_pwg_material_t *)calloc(1, sizeof(_pwg_material_t));
-
- *valueptr++ = '\0';
-
- material->key = _cupsStrAlloc(value);
-
- if (*valueptr == '\"')
- {
- value = valueptr + 1;
- if ((valueptr = strchr(value, '\"')) != NULL)
- {
- *valueptr++ = '\0';
- material->name = _cupsStrAlloc(value);
- material->num_props = cupsParseOptions(valueptr, 0, &material->props);
- }
- }
-
- if (!pc->materials)
- pc->materials = cupsArrayNew3(NULL, NULL, NULL, 0, NULL, (cups_afree_func_t)pwg_free_material);
-
- cupsArrayAdd(pc->materials, material);
- }
- }
else if (!_cups_strcasecmp(line, "Filter"))
{
if (!pc->filters)
@@ -1714,6 +1667,10 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
if ((ppd_attr = ppdFindAttr(ppd, "cupsIPPFinishings", NULL)) != NULL)
{
+ /*
+ * Have proper vendor mapping of IPP finishings values to PPD options...
+ */
+
pc->finishings = cupsArrayNew3((cups_array_func_t)pwg_compare_finishings,
NULL, NULL, 0, NULL,
(cups_afree_func_t)pwg_free_finishings);
@@ -1733,6 +1690,114 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
while ((ppd_attr = ppdFindNextAttr(ppd, "cupsIPPFinishings",
NULL)) != NULL);
}
+ else
+ {
+ /*
+ * No IPP mapping data, try to map common/standard PPD keywords...
+ */
+
+ ppd_option_t *ppd_option; /* PPD option */
+
+ pc->finishings = cupsArrayNew3((cups_array_func_t)pwg_compare_finishings, NULL, NULL, 0, NULL, (cups_afree_func_t)pwg_free_finishings);
+
+ if ((ppd_option = ppdFindOption(ppd, "StapleLocation")) != NULL)
+ {
+ /*
+ * Add staple finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "SinglePortrait"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_LEFT, "StapleLocation", "SinglePortrait");
+ if (ppdFindChoice(ppd_option, "UpperLeft")) /* Ricoh extension */
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_LEFT, "StapleLocation", "UpperLeft");
+ if (ppdFindChoice(ppd_option, "UpperRight")) /* Ricoh extension */
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_RIGHT, "StapleLocation", "UpperRight");
+ if (ppdFindChoice(ppd_option, "SingleLandscape"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_BOTTOM_LEFT, "StapleLocation", "SingleLandscape");
+ if (ppdFindChoice(ppd_option, "DualLandscape"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_DUAL_LEFT, "StapleLocation", "DualLandscape");
+ }
+
+ if ((ppd_option = ppdFindOption(ppd, "RIPunch")) != NULL)
+ {
+ /*
+ * Add (Ricoh) punch finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "Left2"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_LEFT, "RIPunch", "Left2");
+ if (ppdFindChoice(ppd_option, "Left3"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_LEFT, "RIPunch", "Left3");
+ if (ppdFindChoice(ppd_option, "Left4"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_LEFT, "RIPunch", "Left4");
+ if (ppdFindChoice(ppd_option, "Right2"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_RIGHT, "RIPunch", "Right2");
+ if (ppdFindChoice(ppd_option, "Right3"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_RIGHT, "RIPunch", "Right3");
+ if (ppdFindChoice(ppd_option, "Right4"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_RIGHT, "RIPunch", "Right4");
+ if (ppdFindChoice(ppd_option, "Upper2"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_TOP, "RIPunch", "Upper2");
+ if (ppdFindChoice(ppd_option, "Upper3"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_TOP, "RIPunch", "Upper3");
+ if (ppdFindChoice(ppd_option, "Upper4"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_TOP, "RIPunch", "Upper4");
+ }
+
+ if ((ppd_option = ppdFindOption(ppd, "BindEdge")) != NULL)
+ {
+ /*
+ * Add bind finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "Left"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_LEFT, "BindEdge", "Left");
+ if (ppdFindChoice(ppd_option, "Right"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_RIGHT, "BindEdge", "Right");
+ if (ppdFindChoice(ppd_option, "Top"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_TOP, "BindEdge", "Top");
+ if (ppdFindChoice(ppd_option, "Bottom"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_BOTTOM, "BindEdge", "Bottom");
+ }
+
+ if ((ppd_option = ppdFindOption(ppd, "FoldType")) != NULL)
+ {
+ /*
+ * Add (Adobe) fold finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "ZFold"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_Z, "FoldType", "ZFold");
+ if (ppdFindChoice(ppd_option, "Saddle"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_HALF, "FoldType", "Saddle");
+ if (ppdFindChoice(ppd_option, "DoubleGate"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_DOUBLE_GATE, "FoldType", "DoubleGate");
+ if (ppdFindChoice(ppd_option, "LeftGate"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LEFT_GATE, "FoldType", "LeftGate");
+ if (ppdFindChoice(ppd_option, "RightGate"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_RIGHT_GATE, "FoldType", "RightGate");
+ if (ppdFindChoice(ppd_option, "Letter"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LETTER, "FoldType", "Letter");
+ if (ppdFindChoice(ppd_option, "XFold"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_POSTER, "FoldType", "XFold");
+ }
+
+ if ((ppd_option = ppdFindOption(ppd, "RIFoldType")) != NULL)
+ {
+ /*
+ * Add (Ricoh) fold finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "OutsideTwoFold"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LETTER, "RIFoldType", "OutsideTwoFold");
+ }
+
+ if (cupsArrayCount(pc->finishings) == 0)
+ {
+ cupsArrayDelete(pc->finishings);
+ pc->finishings = NULL;
+ }
+ }
/*
* Max copies...
@@ -1782,42 +1847,6 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
cupsArrayAdd(pc->support_files, ppd_attr->value);
/*
- * 3D stuff...
- */
-
- if ((ppd_attr = ppdFindAttr(ppd, "cups3D", NULL)) != NULL)
- pc->cups_3d = _cupsStrAlloc(ppd_attr->value);
-
- if ((ppd_attr = ppdFindAttr(ppd, "cupsLayerOrder", NULL)) != NULL)
- pc->cups_layer_order = _cupsStrAlloc(ppd_attr->value);
-
- if ((ppd_attr = ppdFindAttr(ppd, "cupsAccuracy", NULL)) != NULL)
- sscanf(ppd_attr->value, "%d%d%d", pc->cups_accuracy + 0, pc->cups_accuracy + 1, pc->cups_accuracy + 2);
-
- if ((ppd_attr = ppdFindAttr(ppd, "cupsVolume", NULL)) != NULL)
- sscanf(ppd_attr->value, "%d%d%d", pc->cups_volume + 0, pc->cups_volume + 1, pc->cups_volume + 2);
-
- for (ppd_attr = ppdFindAttr(ppd, "cupsMaterial", NULL);
- ppd_attr;
- ppd_attr = ppdFindNextAttr(ppd, "cupsMaterial", NULL))
- {
- /*
- * *cupsMaterial key/name: "name=value ... name=value"
- */
-
- _pwg_material_t *material = (_pwg_material_t *)calloc(1, sizeof(_pwg_material_t));
-
- material->key = _cupsStrAlloc(ppd_attr->name);
- material->name = _cupsStrAlloc(ppd_attr->text);
- material->num_props = cupsParseOptions(ppd_attr->value, 0, &material->props);
-
- if (!pc->materials)
- pc->materials = cupsArrayNew3(NULL, NULL, NULL, 0, NULL, (cups_afree_func_t)pwg_free_material);
-
- cupsArrayAdd(pc->materials, material);
- }
-
- /*
* Return the cache data...
*/
@@ -1924,11 +1953,6 @@ _ppdCacheDestroy(_ppd_cache_t *pc) /* I - PPD cache and mapping data */
cupsArrayDelete(pc->support_files);
- _cupsStrFree(pc->cups_3d);
- _cupsStrFree(pc->cups_layer_order);
-
- cupsArrayDelete(pc->materials);
-
free(pc);
}
@@ -2686,7 +2710,6 @@ _ppdCacheWriteFile(
cups_option_t *option; /* Current option */
const char *value; /* Filter/pre-filter value */
char newfile[1024]; /* New filename */
- _pwg_material_t *m; /* Material */
/*
@@ -2868,32 +2891,6 @@ _ppdCacheWriteFile(
cupsFilePutConf(fp, "SupportFile", value);
/*
- * 3D stuff...
- */
-
- if (pc->cups_3d)
- cupsFilePutConf(fp, "3D", pc->cups_3d);
-
- if (pc->cups_layer_order)
- cupsFilePutConf(fp, "LayerOrder", pc->cups_layer_order);
-
- if (pc->cups_accuracy[0] || pc->cups_accuracy[0] || pc->cups_accuracy[2])
- cupsFilePrintf(fp, "Accuracy %d %d %d\n", pc->cups_accuracy[0], pc->cups_accuracy[1], pc->cups_accuracy[2]);
-
- if (pc->cups_volume[0] || pc->cups_volume[0] || pc->cups_volume[2])
- cupsFilePrintf(fp, "Volume %d %d %d\n", pc->cups_volume[0], pc->cups_volume[1], pc->cups_volume[2]);
-
- for (m = (_pwg_material_t *)cupsArrayFirst(pc->materials);
- m;
- m = (_pwg_material_t *)cupsArrayNext(pc->materials))
- {
- cupsFilePrintf(fp, "Material %s \"%s\"", m->key, m->name);
- for (i = 0; i < m->num_props; i ++)
- cupsFilePrintf(fp, " %s=%s", m->props[i].name, m->props[i].value);
- cupsFilePuts(fp, "\n");
- }
-
- /*
* IPP attributes, if any...
*/
@@ -2925,14 +2922,16 @@ _ppdCacheWriteFile(
* of an IPP printer.
*/
-char * /* O - PPD filename or NULL on error */
+char * /* O - PPD filename or @code NULL@ on error */
_ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
size_t bufsize, /* I - Size of filename buffer */
ipp_t *response) /* I - Get-Printer-Attributes response */
{
cups_file_t *fp; /* PPD file */
+ cups_array_t *sizes; /* Media sizes we've added */
ipp_attribute_t *attr, /* xxx-supported */
*defattr, /* xxx-default */
+ *quality, /* print-quality-supported */
*x_dim, *y_dim; /* Media dimensions */
ipp_t *media_size; /* Media size collection */
char make[256], /* Make and model */
@@ -2944,7 +2943,10 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
bottom, /* Largest bottom margin */
left, /* Largest left margin */
right, /* Largest right margin */
- top; /* Largest top margin */
+ top, /* Largest top margin */
+ is_apple = 0, /* Does the printer support Apple raster? */
+ is_pdf = 0, /* Does the printer support PDF? */
+ is_pwg = 0; /* Does the printer support PWG Raster? */
pwg_media_t *pwg; /* PWG media size */
int xres, yres; /* Resolution values */
cups_lang_t *lang = cupsLangDefault();
@@ -2970,6 +2972,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
{ "fold", _("Fold") },
{ "fold-accordian", _("Accordian Fold") },
{ "fold-double-gate", _("Double Gate Fold") },
+ { "fold-engineering-z", _("Engineering Z Fold") },
{ "fold-gate", _("Gate Fold") },
{ "fold-half", _("Half Fold") },
{ "fold-half-z", _("Half Z Fold") },
@@ -2998,6 +3001,10 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
{ "punch-triple-left", _("3-Hole Punch (Portrait)") },
{ "punch-triple-right", _("3-Hole Punch (Reverse Portrait)") },
{ "punch-triple-top", _("3-Hole Punch (Landscape)") },
+ { "punch-multiple-bottom", _("Multi-Hole Punch (Reverse Landscape)") },
+ { "punch-multiple-left", _("Multi-Hole Punch (Portrait)") },
+ { "punch-multiple-right", _("Multi-Hole Punch (Reverse Portrait)") },
+ { "punch-multiple-top", _("Multi-Hole Punch (Landscape)") },
{ "saddle-stitch", _("Saddle Stitch") },
{ "staple", _("Staple") },
{ "staple-bottom-left", _("Single Staple (Reverse Landscape)") },
@@ -3023,15 +3030,27 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
if (buffer)
*buffer = '\0';
- if (!buffer || bufsize < 1 || !response)
+ if (!buffer || bufsize < 1)
+ {
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+ return (NULL);
+ }
+
+ if (!response)
+ {
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No IPP attributes."), 1);
return (NULL);
+ }
/*
* Open a temporary file for the PPD...
*/
if ((fp = cupsTempFile2(buffer, (int)bufsize)) == NULL)
+ {
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
return (NULL);
+ }
/*
* Standard stuff for PPD file...
@@ -3084,20 +3103,31 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
if ((attr = ippFindAttribute(response, "document-format-supported", IPP_TAG_MIMETYPE)) != NULL)
{
+ is_apple = ippContainsString(attr, "image/urf");
+ is_pdf = ippContainsString(attr, "application/pdf");
+ is_pwg = ippContainsString(attr, "image/pwg-raster");
+
for (i = 0, count = ippGetCount(attr); i < count; i ++)
{
const char *format = ippGetString(attr, i, NULL);
/* PDL */
+ /*
+ * Write cupsFilter2 lines for supported formats...
+ */
+
if (!_cups_strcasecmp(format, "application/pdf"))
cupsFilePuts(fp, "*cupsFilter2: \"application/vnd.cups-pdf application/pdf 10 -\"\n");
- else if (!_cups_strcasecmp(format, "application/postscript"))
- cupsFilePuts(fp, "*cupsFilter2: \"application/vnd.cups-postscript application/postscript 10 -\"\n");
- else if (_cups_strcasecmp(format, "application/octet-stream") && _cups_strcasecmp(format, "application/vnd.hp-pcl") && _cups_strcasecmp(format, "text/plain"))
- cupsFilePrintf(fp, "*cupsFilter2: \"%s %s 10 -\"\n", format, format);
+ else if (!_cups_strcasecmp(format, "image/jpeg") || !_cups_strcasecmp(format, "image/png"))
+ cupsFilePrintf(fp, "*cupsFilter2: \"%s %s 0 -\"\n", format, format);
+ else if (!_cups_strcasecmp(format, "image/pwg-raster") || !_cups_strcasecmp(format, "image/urf"))
+ cupsFilePrintf(fp, "*cupsFilter2: \"%s %s 100 -\"\n", format, format);
}
}
+ if (!is_apple && !is_pdf && !is_pwg)
+ goto bad_ppd;
+
/*
* PageSize/PageRegion/ImageableArea/PaperDimension
*/
@@ -3146,35 +3176,54 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
x_dim = ippFindAttribute(media_size, "x-dimension", IPP_TAG_INTEGER);
y_dim = ippFindAttribute(media_size, "y-dimension", IPP_TAG_INTEGER);
- if (x_dim && y_dim)
- {
- pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0));
+ if (x_dim && y_dim && (pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0))) != NULL)
strlcpy(ppdname, pwg->ppd, sizeof(ppdname));
- }
else
strlcpy(ppdname, "Unknown", sizeof(ppdname));
}
else
strlcpy(ppdname, "Unknown", sizeof(ppdname));
}
+ else if ((pwg = pwgMediaForPWG(ippGetString(ippFindAttribute(response, "media-default", IPP_TAG_ZERO), 0, NULL))) != NULL)
+ strlcpy(ppdname, pwg->ppd, sizeof(ppdname));
+ else
+ strlcpy(ppdname, "Unknown", sizeof(ppdname));
- if ((attr = ippFindAttribute(response, "media-size-supported", IPP_TAG_BEGIN_COLLECTION)) != NULL)
+ if ((attr = ippFindAttribute(response, "media-size-supported", IPP_TAG_BEGIN_COLLECTION)) == NULL)
+ attr = ippFindAttribute(response, "media-supported", IPP_TAG_ZERO);
+ if (attr)
{
cupsFilePrintf(fp, "*OpenUI *PageSize: PickOne\n"
"*OrderDependency: 10 AnySetup *PageSize\n"
"*DefaultPageSize: %s\n", ppdname);
+
+ sizes = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
+
for (i = 0, count = ippGetCount(attr); i < count; i ++)
{
- media_size = ippGetCollection(attr, i);
- x_dim = ippFindAttribute(media_size, "x-dimension", IPP_TAG_INTEGER);
- y_dim = ippFindAttribute(media_size, "y-dimension", IPP_TAG_INTEGER);
+ if (ippGetValueTag(attr) == IPP_TAG_BEGIN_COLLECTION)
+ {
+ media_size = ippGetCollection(attr, i);
+ x_dim = ippFindAttribute(media_size, "x-dimension", IPP_TAG_INTEGER);
+ y_dim = ippFindAttribute(media_size, "y-dimension", IPP_TAG_INTEGER);
- if (x_dim && y_dim)
+ pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0));
+ }
+ else
+ pwg = pwgMediaForPWG(ippGetString(attr, i, NULL));
+
+ if (pwg)
{
char twidth[256], /* Width string */
tlength[256]; /* Length string */
- pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0));
+ if (cupsArrayFind(sizes, (void *)pwg->ppd))
+ {
+ cupsFilePrintf(fp, "*%% warning: Duplicate size '%s' reported by printer.\n", pwg->ppd);
+ continue;
+ }
+
+ cupsArrayAdd(sizes, (void *)pwg->ppd);
_cupsStrFormatd(twidth, twidth + sizeof(twidth), pwg->width * 72.0 / 2540.0, loc);
_cupsStrFormatd(tlength, tlength + sizeof(tlength), pwg->length * 72.0 / 2540.0, loc);
@@ -3184,21 +3233,34 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
}
cupsFilePuts(fp, "*CloseUI: *PageSize\n");
+ cupsArrayDelete(sizes);
+ sizes = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
+
cupsFilePrintf(fp, "*OpenUI *PageRegion: PickOne\n"
"*OrderDependency: 10 AnySetup *PageRegion\n"
"*DefaultPageRegion: %s\n", ppdname);
for (i = 0, count = ippGetCount(attr); i < count; i ++)
{
- media_size = ippGetCollection(attr, i);
- x_dim = ippFindAttribute(media_size, "x-dimension", IPP_TAG_INTEGER);
- y_dim = ippFindAttribute(media_size, "y-dimension", IPP_TAG_INTEGER);
+ if (ippGetValueTag(attr) == IPP_TAG_BEGIN_COLLECTION)
+ {
+ media_size = ippGetCollection(attr, i);
+ x_dim = ippFindAttribute(media_size, "x-dimension", IPP_TAG_INTEGER);
+ y_dim = ippFindAttribute(media_size, "y-dimension", IPP_TAG_INTEGER);
+
+ pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0));
+ }
+ else
+ pwg = pwgMediaForPWG(ippGetString(attr, i, NULL));
- if (x_dim && y_dim)
+ if (pwg)
{
char twidth[256], /* Width string */
tlength[256]; /* Length string */
- pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0));
+ if (cupsArrayFind(sizes, (void *)pwg->ppd))
+ continue;
+
+ cupsArrayAdd(sizes, (void *)pwg->ppd);
_cupsStrFormatd(twidth, twidth + sizeof(twidth), pwg->width * 72.0 / 2540.0, loc);
_cupsStrFormatd(tlength, tlength + sizeof(tlength), pwg->length * 72.0 / 2540.0, loc);
@@ -3208,15 +3270,25 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
}
cupsFilePuts(fp, "*CloseUI: *PageRegion\n");
+ cupsArrayDelete(sizes);
+ sizes = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
+
cupsFilePrintf(fp, "*DefaultImageableArea: %s\n"
"*DefaultPaperDimension: %s\n", ppdname, ppdname);
for (i = 0, count = ippGetCount(attr); i < count; i ++)
{
- media_size = ippGetCollection(attr, i);
- x_dim = ippFindAttribute(media_size, "x-dimension", IPP_TAG_INTEGER);
- y_dim = ippFindAttribute(media_size, "y-dimension", IPP_TAG_INTEGER);
+ if (ippGetValueTag(attr) == IPP_TAG_BEGIN_COLLECTION)
+ {
+ media_size = ippGetCollection(attr, i);
+ x_dim = ippFindAttribute(media_size, "x-dimension", IPP_TAG_INTEGER);
+ y_dim = ippFindAttribute(media_size, "y-dimension", IPP_TAG_INTEGER);
+
+ pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0));
+ }
+ else
+ pwg = pwgMediaForPWG(ippGetString(attr, i, NULL));
- if (x_dim && y_dim)
+ if (pwg)
{
char tleft[256], /* Left string */
tbottom[256], /* Bottom string */
@@ -3225,7 +3297,10 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
twidth[256], /* Width string */
tlength[256]; /* Length string */
- pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0));
+ if (cupsArrayFind(sizes, (void *)pwg->ppd))
+ continue;
+
+ cupsArrayAdd(sizes, (void *)pwg->ppd);
_cupsStrFormatd(tleft, tleft + sizeof(tleft), left * 72.0 / 2540.0, loc);
_cupsStrFormatd(tbottom, tbottom + sizeof(tbottom), bottom * 72.0 / 2540.0, loc);
@@ -3238,18 +3313,22 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
cupsFilePrintf(fp, "*PaperDimension %s: \"%s %s\"\n", pwg->ppd, twidth, tlength);
}
}
+
+ cupsArrayDelete(sizes);
}
+ else
+ goto bad_ppd;
/*
* InputSlot...
*/
- if ((attr = ippFindAttribute(ippGetCollection(defattr, 0), "media-source", IPP_TAG_KEYWORD)) != NULL)
+ if ((attr = ippFindAttribute(ippGetCollection(defattr, 0), "media-source", IPP_TAG_ZERO)) != NULL)
pwg_ppdize_name(ippGetString(attr, 0, NULL), ppdname, sizeof(ppdname));
else
strlcpy(ppdname, "Unknown", sizeof(ppdname));
- if ((attr = ippFindAttribute(response, "media-source-supported", IPP_TAG_KEYWORD)) != NULL && (count = ippGetCount(attr)) > 1)
+ if ((attr = ippFindAttribute(response, "media-source-supported", IPP_TAG_ZERO)) != NULL && (count = ippGetCount(attr)) > 1)
{
static const char * const sources[][2] =
{ /* "media-source" strings */
@@ -3326,12 +3405,12 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
* MediaType...
*/
- if ((attr = ippFindAttribute(ippGetCollection(defattr, 0), "media-type", IPP_TAG_KEYWORD)) != NULL)
+ if ((attr = ippFindAttribute(ippGetCollection(defattr, 0), "media-type", IPP_TAG_ZERO)) != NULL)
pwg_ppdize_name(ippGetString(attr, 0, NULL), ppdname, sizeof(ppdname));
else
strlcpy(ppdname, "Unknown", sizeof(ppdname));
- if ((attr = ippFindAttribute(response, "media-type-supported", IPP_TAG_KEYWORD)) != NULL && (count = ippGetCount(attr)) > 1)
+ if ((attr = ippFindAttribute(response, "media-type-supported", IPP_TAG_ZERO)) != NULL && (count = ippGetCount(attr)) > 1)
{
static const char * const media_types[][2] =
{ /* "media-type" strings */
@@ -3341,6 +3420,19 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
{ "cardboard", _("Cardboard") },
{ "cardstock", _("Cardstock") },
{ "cd", _("CD") },
+ { "com.hp.advanced-photo", _("Advanced Photo Paper") }, /* HP */
+ { "com.hp.brochure-glossy", _("Glossy Brochure Paper") }, /* HP */
+ { "com.hp.brochure-matte", _("Matte Brochure Paper") }, /* HP */
+ { "com.hp.cover-matte", _("Matte Cover Paper") }, /* HP */
+ { "com.hp.ecosmart-lite", _("Office Recycled Paper") }, /* HP */
+ { "com.hp.everyday-glossy", _("Everyday Glossy Photo Paper") }, /* HP */
+ { "com.hp.everyday-matte", _("Everyday Matte Paper") }, /* HP */
+ { "com.hp.extra-heavy", _("Extra Heavyweight Paper") }, /* HP */
+ { "com.hp.intermediate", _("Multipurpose Paper") }, /* HP */
+ { "com.hp.mid-weight", _("Mid-Weight Paper") }, /* HP */
+ { "com.hp.premium-inkjet", _("Premium Inkjet Paper") }, /* HP */
+ { "com.hp.premium-photo", _("Premium Photo Glossy Paper") }, /* HP */
+ { "com.hp.premium-presentation-matte", _("Premium Presentation Matte Paper") }, /* HP */
{ "continuous", _("Continuous") },
{ "continuous-long", _("Continuous Long") },
{ "continuous-short", _("Continuous Short") },
@@ -3388,6 +3480,10 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
{ "gravure-cylinder", _("Gravure Cylinder") },
{ "image-setter-paper", _("Image Setter Paper") },
{ "imaging-cylinder", _("Imaging Cylinder") },
+ { "jp.co.canon_photo-paper-plus-glossy-ii", _("Photo Paper Plus Glossy II") }, /* Canon */
+ { "jp.co.canon_photo-paper-pro-platinum", _("Photo Paper Pro Platinum") }, /* Canon */
+ { "jp.co.canon-photo-paper-plus-glossy-ii", _("Photo Paper Plus Glossy II") }, /* Canon */
+ { "jp.co.canon-photo-paper-pro-platinum", _("Photo Paper Pro Platinum") }, /* Canon */
{ "labels", _("Labels") },
{ "labels-colored", _("Colored Labels") },
{ "labels-glossy", _("Glossy Labels") },
@@ -3411,8 +3507,9 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
{ "multi-part-form", _("Multi Part Form") },
{ "other", _("Other") },
{ "paper", _("Paper") },
+ { "photo", _("Photo Paper") }, /* HP mis-spelling */
{ "photographic", _("Photo Paper") },
- { "photographic-archival", _("Photographic Archival") },
+ { "photographic-archival", _("Archival Photo Paper") },
{ "photographic-film", _("Photo Film") },
{ "photographic-glossy", _("Glossy Photo Paper") },
{ "photographic-high-gloss", _("High Gloss Photo Paper") },
@@ -3439,14 +3536,14 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
{ "single-face", _("Single Face") },
{ "single-wall", _("Single Wall Cardboard") },
{ "sleeve", _("Sleeve") },
- { "stationery", _("Stationery") },
- { "stationery-archival", _("Stationery Archival") },
+ { "stationery", _("Plain Paper") },
+ { "stationery-archival", _("Archival Paper") },
{ "stationery-coated", _("Coated Paper") },
- { "stationery-cotton", _("Stationery Cotton") },
+ { "stationery-cotton", _("Cotton Paper") },
{ "stationery-fine", _("Vellum Paper") },
{ "stationery-heavyweight", _("Heavyweight Paper") },
- { "stationery-heavyweight-coated", _("Stationery Heavyweight Coated") },
- { "stationery-inkjet", _("Stationery Inkjet Paper") },
+ { "stationery-heavyweight-coated", _("Heavyweight Coated Paper") },
+ { "stationery-inkjet", _("Inkjet Paper") },
{ "stationery-letterhead", _("Letterhead") },
{ "stationery-lightweight", _("Lightweight Paper") },
{ "stationery-preprinted", _("Preprinted Paper") },
@@ -3462,14 +3559,20 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
cupsFilePrintf(fp, "*OpenUI *MediaType: PickOne\n"
"*OrderDependency: 10 AnySetup *MediaType\n"
"*DefaultMediaType: %s\n", ppdname);
- for (i = 0; i < (int)(sizeof(media_types) / sizeof(media_types[0])); i ++)
+ for (i = 0; i < count; i ++)
{
- if (!ippContainsString(attr, media_types[i][0]))
- continue;
+ const char *keyword = ippGetString(attr, i, NULL);
- pwg_ppdize_name(media_types[i][0], ppdname, sizeof(ppdname));
+ pwg_ppdize_name(keyword, ppdname, sizeof(ppdname));
- cupsFilePrintf(fp, "*MediaType %s/%s: \"<</MediaType(%s)>>setpagedevice\"\n", ppdname, _cupsLangString(lang, media_types[i][1]), ppdname);
+ for (j = 0; j < (int)(sizeof(media_types) / sizeof(media_types[0])); j ++)
+ if (!strcmp(keyword, media_types[j][0]))
+ break;
+
+ if (j < (int)(sizeof(media_types) / sizeof(media_types[0])))
+ cupsFilePrintf(fp, "*MediaType %s/%s: \"<</MediaType(%s)>>setpagedevice\"\n", ppdname, _cupsLangString(lang, media_types[j][1]), ppdname);
+ else
+ cupsFilePrintf(fp, "*MediaType %s/%s: \"<</MediaType(%s)>>setpagedevice\"\n", ppdname, keyword, ppdname);
}
cupsFilePuts(fp, "*CloseUI: *MediaType\n");
}
@@ -3479,7 +3582,9 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
*/
if ((attr = ippFindAttribute(response, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD)) == NULL)
- attr = ippFindAttribute(response, "print-color-mode-supported", IPP_TAG_KEYWORD);
+ if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) == NULL)
+ if ((attr = ippFindAttribute(response, "print-color-mode-supported", IPP_TAG_KEYWORD)) == NULL)
+ attr = ippFindAttribute(response, "output-mode-supported", IPP_TAG_KEYWORD);
if (attr)
{
@@ -3501,7 +3606,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
if (!default_color)
default_color = "FastGray";
}
- else if (!strcmp(keyword, "sgray_8") || !strcmp(keyword, "monochrome") || !strcmp(keyword, "process-monochrome"))
+ else if (!strcmp(keyword, "sgray_8") || !strcmp(keyword, "W8") || !strcmp(keyword, "monochrome") || !strcmp(keyword, "process-monochrome"))
{
if (!default_color)
cupsFilePrintf(fp, "*OpenUI *ColorModel/%s: PickOne\n"
@@ -3512,7 +3617,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
if (!default_color || !strcmp(default_color, "FastGray"))
default_color = "Gray";
}
- else if (!strcmp(keyword, "srgb_8") || !strcmp(keyword, "color"))
+ else if (!strcmp(keyword, "srgb_8") || !strcmp(keyword, "SRGB24") || !strcmp(keyword, "color"))
{
if (!default_color)
cupsFilePrintf(fp, "*OpenUI *ColorModel/%s: PickOne\n"
@@ -3522,6 +3627,17 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
default_color = "RGB";
}
+ else if (!strcmp(keyword, "adobe-rgb_16") || !strcmp(keyword, "ADOBERGB48"))
+ {
+ if (!default_color)
+ cupsFilePrintf(fp, "*OpenUI *ColorModel/%s: PickOne\n"
+ "*OrderDependency: 10 AnySetup *ColorModel\n", _cupsLangString(lang, _("Color Mode")));
+
+ cupsFilePrintf(fp, "*ColorModel AdobeRGB/%s: \"<</cupsColorSpace 20/cupsBitsPerColor 16/cupsColorOrder 0/cupsCompression 0>>setpagedevice\"\n", _cupsLangString(lang, _("Deep Color")));
+
+ if (!default_color)
+ default_color = "AdobeRGB";
+ }
}
if (default_color)
@@ -3591,95 +3707,261 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
}
/*
+ * Output bin...
+ */
+
+ if ((attr = ippFindAttribute(response, "output-bin-default", IPP_TAG_ZERO)) != NULL)
+ pwg_ppdize_name(ippGetString(attr, 0, NULL), ppdname, sizeof(ppdname));
+ else
+ strlcpy(ppdname, "Unknown", sizeof(ppdname));
+
+ if ((attr = ippFindAttribute(response, "output-bin-supported", IPP_TAG_ZERO)) != NULL && (count = ippGetCount(attr)) > 1)
+ {
+ static const char * const output_bins[][2] =
+ { /* "output-bin" strings */
+ { "auto", _("Automatic") },
+ { "bottom", _("Bottom Tray") },
+ { "center", _("Center Tray") },
+ { "face-down", _("Face Down") },
+ { "face-up", _("Face Up") },
+ { "large-capacity", _("Large Capacity Tray") },
+ { "left", _("Left Tray") },
+ { "mailbox-1", _("Mailbox 1") },
+ { "mailbox-2", _("Mailbox 2") },
+ { "mailbox-3", _("Mailbox 3") },
+ { "mailbox-4", _("Mailbox 4") },
+ { "mailbox-5", _("Mailbox 5") },
+ { "mailbox-6", _("Mailbox 6") },
+ { "mailbox-7", _("Mailbox 7") },
+ { "mailbox-8", _("Mailbox 8") },
+ { "mailbox-9", _("Mailbox 9") },
+ { "mailbox-10", _("Mailbox 10") },
+ { "middle", _("Middle") },
+ { "my-mailbox", _("My Mailbox") },
+ { "rear", _("Rear Tray") },
+ { "right", _("Right Tray") },
+ { "side", _("Side Tray") },
+ { "stacker-1", _("Stacker 1") },
+ { "stacker-2", _("Stacker 2") },
+ { "stacker-3", _("Stacker 3") },
+ { "stacker-4", _("Stacker 4") },
+ { "stacker-5", _("Stacker 5") },
+ { "stacker-6", _("Stacker 6") },
+ { "stacker-7", _("Stacker 7") },
+ { "stacker-8", _("Stacker 8") },
+ { "stacker-9", _("Stacker 9") },
+ { "stacker-10", _("Stacker 10") },
+ { "top", _("Top Tray") },
+ { "tray-1", _("Tray 1") },
+ { "tray-2", _("Tray 2") },
+ { "tray-3", _("Tray 3") },
+ { "tray-4", _("Tray 4") },
+ { "tray-5", _("Tray 5") },
+ { "tray-6", _("Tray 6") },
+ { "tray-7", _("Tray 7") },
+ { "tray-8", _("Tray 8") },
+ { "tray-9", _("Tray 9") },
+ { "tray-10", _("Tray 10") }
+ };
+
+ cupsFilePrintf(fp, "*OpenUI *OutputBin: PickOne\n"
+ "*OrderDependency: 10 AnySetup *OutputBin\n"
+ "*DefaultOutputBin: %s\n", ppdname);
+ for (i = 0; i < (int)(sizeof(output_bins) / sizeof(output_bins[0])); i ++)
+ {
+ if (!ippContainsString(attr, output_bins[i][0]))
+ continue;
+
+ pwg_ppdize_name(output_bins[i][0], ppdname, sizeof(ppdname));
+
+ cupsFilePrintf(fp, "*OutputBin %s/%s: \"\"\n", ppdname, _cupsLangString(lang, output_bins[i][1]));
+ }
+ cupsFilePuts(fp, "*CloseUI: *OutputBin\n");
+ }
+
+ /*
* Finishing options...
+ *
+ * Eventually need to re-add support for finishings-col-database, however
+ * it is difficult to map arbitrary finishing-template values to PPD options
+ * and have the right constraints apply (e.g. stapling vs. folding vs.
+ * punching, etc.)
*/
- if ((attr = ippFindAttribute(response, "finishings-col-database", IPP_TAG_BEGIN_COLLECTION)) != NULL)
+ if ((attr = ippFindAttribute(response, "finishings-supported", IPP_TAG_ENUM)) != NULL)
{
- ipp_t *col; /* Collection value */
- ipp_attribute_t *template; /* "finishing-template" member */
const char *name; /* String name */
- int value; /* Enum value, if any */
+ int value; /* Enum value */
cups_array_t *names; /* Names we've added */
count = ippGetCount(attr);
names = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free);
- cupsFilePrintf(fp, "*OpenUI *cupsFinishingTemplate/%s: PickMany\n"
- "*OrderDependency: 10 AnySetup *cupsFinishingTemplate\n"
- "*DefaultcupsFinishingTemplate: none\n"
- "*cupsFinishingTemplate none/%s: \"\"\n"
- "*cupsIPPFinishings 3/none: \"*cupsFinishingTemplate none\"\n", _cupsLangString(lang, _("Finishing")), _cupsLangString(lang, _("No Finishing")));
+ /*
+ * Staple/Bind/Stitch
+ */
for (i = 0; i < count; i ++)
{
- col = ippGetCollection(attr, i);
- template = ippFindAttribute(col, "finishing-template", IPP_TAG_ZERO);
-
- if ((name = ippGetString(template, 0, NULL)) == NULL || !strcmp(name, "none"))
- continue;
+ value = ippGetInteger(attr, i);
+ name = ippEnumString("finishings", value);
- if (cupsArrayFind(names, (char *)name))
- continue; /* Already did this finishing template */
+ if (!strncmp(name, "staple-", 7) || !strncmp(name, "bind-", 5) || !strncmp(name, "edge-stitch-", 12) || !strcmp(name, "saddle-stitch"))
+ break;
+ }
- cupsArrayAdd(names, (char *)name);
+ if (i < count)
+ {
+ cupsFilePrintf(fp, "*OpenUI *StapleLocation/%s: PickOne\n", _cupsLangString(lang, _("Staple")));
+ cupsFilePuts(fp, "*OrderDependency: 10 AnySetup *StapleLocation\n");
+ cupsFilePuts(fp, "*DefaultStapleLocation: None\n");
+ cupsFilePrintf(fp, "*StapleLocation None/%s: \"\"\n", _cupsLangString(lang, _("None")));
- for (j = 0; j < (int)(sizeof(finishings) / sizeof(finishings[0])); j ++)
+ for (; i < count; i ++)
{
- if (!strcmp(finishings[j][0], name))
- {
- cupsFilePrintf(fp, "*cupsFinishingTemplate %s/%s: \"\"\n", name, _cupsLangString(lang, finishings[j][1]));
+ value = ippGetInteger(attr, i);
+ name = ippEnumString("finishings", value);
+
+ if (strncmp(name, "staple-", 7) && strncmp(name, "bind-", 5) && strncmp(name, "edge-stitch-", 12) && strcmp(name, "saddle-stitch"))
+ continue;
+
+ if (cupsArrayFind(names, (char *)name))
+ continue; /* Already did this finishing template */
+
+ cupsArrayAdd(names, (char *)name);
+
+ for (j = 0; j < (int)(sizeof(finishings) / sizeof(finishings[0])); j ++)
+ {
+ if (!strcmp(finishings[j][0], name))
+ {
+ cupsFilePrintf(fp, "*StapleLocation %s/%s: \"\"\n", name, _cupsLangString(lang, finishings[j][1]));
+ cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*StapleLocation %s\"\n", value, name, name);
+ break;
+ }
+ }
+ }
- value = ippEnumValue("finishings", name);
+ cupsFilePuts(fp, "*CloseUI: *StapleLocation\n");
+ }
- if (value)
- cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*cupsFinishingTemplate %s\"\n", value, name, name);
- break;
- }
- }
+ /*
+ * Fold
+ */
+
+ for (i = 0; i < count; i ++)
+ {
+ value = ippGetInteger(attr, i);
+ name = ippEnumString("finishings", value);
+
+ if (!strncmp(name, "fold-", 5))
+ break;
}
- cupsArrayDelete(names);
+ if (i < count)
+ {
+ cupsFilePrintf(fp, "*OpenUI *FoldType/%s: PickOne\n", _cupsLangString(lang, _("Fold")));
+ cupsFilePuts(fp, "*OrderDependency: 10 AnySetup *FoldType\n");
+ cupsFilePuts(fp, "*DefaultFoldType: None\n");
+ cupsFilePrintf(fp, "*FoldType None/%s: \"\"\n", _cupsLangString(lang, _("None")));
- cupsFilePuts(fp, "*CloseUI: *cupsFinishingTemplate\n");
- }
- else if ((attr = ippFindAttribute(response, "finishings-supported", IPP_TAG_ENUM)) != NULL && (count = ippGetCount(attr)) > 1 )
- {
- const char *name; /* String name */
- int value; /* Enum value, if any */
+ for (; i < count; i ++)
+ {
+ value = ippGetInteger(attr, i);
+ name = ippEnumString("finishings", value);
+
+ if (strncmp(name, "fold-", 5))
+ continue;
+
+ if (cupsArrayFind(names, (char *)name))
+ continue; /* Already did this finishing template */
+
+ cupsArrayAdd(names, (char *)name);
+
+ for (j = 0; j < (int)(sizeof(finishings) / sizeof(finishings[0])); j ++)
+ {
+ if (!strcmp(finishings[j][0], name))
+ {
+ cupsFilePrintf(fp, "*FoldType %s/%s: \"\"\n", name, _cupsLangString(lang, finishings[j][1]));
+ cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*FoldType %s\"\n", value, name, name);
+ break;
+ }
+ }
+ }
- count = ippGetCount(attr);
+ cupsFilePuts(fp, "*CloseUI: *FoldType\n");
+ }
- cupsFilePrintf(fp, "*OpenUI *cupsFinishingTemplate/%s: PickMany\n"
- "*OrderDependency: 10 AnySetup *cupsFinishingTemplate\n"
- "*DefaultcupsFinishingTemplate: none\n"
- "*cupsFinishingTemplate none/%s: \"\"\n"
- "*cupsIPPFinishings 3/none: \"*cupsFinishingTemplate none\"\n", _cupsLangString(lang, _("Finishing")), _cupsLangString(lang, _("No Finishing")));
+ /*
+ * Punch
+ */
for (i = 0; i < count; i ++)
{
- if ((value = ippGetInteger(attr, i)) == 3)
- continue;
+ value = ippGetInteger(attr, i);
+ name = ippEnumString("finishings", value);
+
+ if (!strncmp(name, "punch-", 6))
+ break;
+ }
- name = ippEnumString("finishings", value);
- for (j = 0; j < (int)(sizeof(finishings) / sizeof(finishings[0])); j ++)
+ if (i < count)
+ {
+ cupsFilePrintf(fp, "*OpenUI *PunchMedia/%s: PickOne\n", _cupsLangString(lang, _("Punch")));
+ cupsFilePuts(fp, "*OrderDependency: 10 AnySetup *PunchMedia\n");
+ cupsFilePuts(fp, "*DefaultPunchMedia: None\n");
+ cupsFilePrintf(fp, "*PunchMedia None/%s: \"\"\n", _cupsLangString(lang, _("None")));
+
+ for (i = 0; i < count; i ++)
{
- if (!strcmp(finishings[j][0], name))
- {
- cupsFilePrintf(fp, "*cupsFinishingTemplate %s/%s: \"\"\n", name, _cupsLangString(lang, finishings[j][1]));
- cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*cupsFinishingTemplate %s\"\n", value, name, name);
- break;
- }
+ value = ippGetInteger(attr, i);
+ name = ippEnumString("finishings", value);
+
+ if (strncmp(name, "punch-", 6))
+ continue;
+
+ if (cupsArrayFind(names, (char *)name))
+ continue; /* Already did this finishing template */
+
+ cupsArrayAdd(names, (char *)name);
+
+ for (j = 0; j < (int)(sizeof(finishings) / sizeof(finishings[0])); j ++)
+ {
+ if (!strcmp(finishings[j][0], name))
+ {
+ cupsFilePrintf(fp, "*PunchMedia %s/%s: \"\"\n", name, _cupsLangString(lang, finishings[j][1]));
+ cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*PunchMedia %s\"\n", value, name, name);
+ break;
+ }
+ }
}
+
+ cupsFilePuts(fp, "*CloseUI: *PunchMedia\n");
}
- cupsFilePuts(fp, "*CloseUI: *cupsFinishingTemplate\n");
+ /*
+ * Booklet
+ */
+
+ if (ippContainsInteger(attr, IPP_FINISHINGS_BOOKLET_MAKER))
+ {
+ cupsFilePrintf(fp, "*OpenUI *Booklet/%s: Boolean\n", _cupsLangString(lang, _("Booklet")));
+ cupsFilePuts(fp, "*OrderDependency: 10 AnySetup *Booklet\n");
+ cupsFilePuts(fp, "*DefaultBooklet: False\n");
+ cupsFilePuts(fp, "*Booklet False: \"\"\n");
+ cupsFilePuts(fp, "*Booklet True: \"\"\n");
+ cupsFilePrintf(fp, "*cupsIPPFinishings %d/booklet-maker: \"*Booklet True\"\n", IPP_FINISHINGS_BOOKLET_MAKER);
+ cupsFilePuts(fp, "*CloseUI: *Booklet\n");
+ }
+
+ cupsArrayDelete(names);
}
/*
* cupsPrintQuality and DefaultResolution...
*/
+ quality = ippFindAttribute(response, "print-quality-supported", IPP_TAG_ENUM);
+
if ((attr = ippFindAttribute(response, "pwg-raster-document-resolution-supported", IPP_TAG_RESOLUTION)) != NULL)
{
count = ippGetCount(attr);
@@ -3690,16 +3972,19 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
cupsFilePrintf(fp, "*OpenUI *cupsPrintQuality/%s: PickOne\n"
"*OrderDependency: 10 AnySetup *cupsPrintQuality\n"
"*DefaultcupsPrintQuality: Normal\n", _cupsLangString(lang, _("Print Quality")));
- if (count > 2)
+ if (count > 2 || ippContainsInteger(quality, IPP_QUALITY_DRAFT))
{
pwg_ppdize_resolution(attr, 0, &xres, &yres, NULL, 0);
cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), xres, yres);
}
pwg_ppdize_resolution(attr, count / 2, &xres, &yres, NULL, 0);
cupsFilePrintf(fp, "*cupsPrintQuality Normal/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Normal")), xres, yres);
- if (count > 1)
+ if (count > 1 || ippContainsInteger(quality, IPP_QUALITY_HIGH))
{
- pwg_ppdize_resolution(attr, count - 1, &xres, &yres, NULL, 0);
+ if (count > 1)
+ pwg_ppdize_resolution(attr, count - 1, &xres, &yres, NULL, 0);
+ else
+ pwg_ppdize_resolution(attr, 0, &xres, &yres, NULL, 0);
cupsFilePrintf(fp, "*cupsPrintQuality High/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("High")), xres, yres);
}
@@ -3731,7 +4016,7 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
* Invalid "urf-supported" value...
*/
- cupsFilePuts(fp, "*DefaultResolution: 300dpi\n");
+ goto bad_ppd;
}
else
{
@@ -3746,19 +4031,40 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
"*DefaultcupsPrintQuality: Normal\n", _cupsLangString(lang, _("Print Quality")));
if ((lowdpi & 1) == 0)
cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), lowdpi, lowdpi / 2);
+ else if (ippContainsInteger(quality, IPP_QUALITY_DRAFT))
+ cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), lowdpi, lowdpi);
cupsFilePrintf(fp, "*cupsPrintQuality Normal/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Normal")), lowdpi, lowdpi);
- if (hidpi > lowdpi)
+ if (hidpi > lowdpi || ippContainsInteger(quality, IPP_QUALITY_HIGH))
cupsFilePrintf(fp, "*cupsPrintQuality High/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("High")), hidpi, hidpi);
cupsFilePuts(fp, "*CloseUI: *cupsPrintQuality\n");
}
}
- else if ((attr = ippFindAttribute(response, "printer-resolution-default", IPP_TAG_RESOLUTION)) != NULL)
+ else if (is_apple || is_pwg)
+ goto bad_ppd;
+ else
{
- pwg_ppdize_resolution(attr, 0, &xres, &yres, ppdname, sizeof(ppdname));
+ if ((attr = ippFindAttribute(response, "printer-resolution-default", IPP_TAG_RESOLUTION)) != NULL)
+ {
+ pwg_ppdize_resolution(attr, 0, &xres, &yres, ppdname, sizeof(ppdname));
+ }
+ else
+ {
+ xres = yres = 300;
+ strlcpy(ppdname, "300dpi", sizeof(ppdname));
+ }
+
cupsFilePrintf(fp, "*DefaultResolution: %s\n", ppdname);
+
+ cupsFilePrintf(fp, "*OpenUI *cupsPrintQuality/%s: PickOne\n"
+ "*OrderDependency: 10 AnySetup *cupsPrintQuality\n"
+ "*DefaultcupsPrintQuality: Normal\n", _cupsLangString(lang, _("Print Quality")));
+ if (ippContainsInteger(quality, IPP_QUALITY_DRAFT))
+ cupsFilePrintf(fp, "*cupsPrintQuality Draft/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Draft")), xres, yres);
+ cupsFilePrintf(fp, "*cupsPrintQuality Normal/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("Normal")), xres, yres);
+ if (ippContainsInteger(quality, IPP_QUALITY_HIGH))
+ cupsFilePrintf(fp, "*cupsPrintQuality High/%s: \"<</HWResolution[%d %d]>>setpagedevice\"\n", _cupsLangString(lang, _("High")), xres, yres);
+ cupsFilePuts(fp, "*CloseUI: *cupsPrintQuality\n");
}
- else
- cupsFilePuts(fp, "*DefaultResolution: 300dpi\n");
/*
* Close up and return...
@@ -3767,6 +4073,20 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
cupsFileClose(fp);
return (buffer);
+
+ /*
+ * If we get here then there was a problem creating the PPD...
+ */
+
+ bad_ppd:
+
+ cupsFileClose(fp);
+ unlink(buffer);
+ *buffer = '\0';
+
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Printer does not support required IPP attributes or document formats."), 1);
+
+ return (NULL);
}
@@ -3926,10 +4246,34 @@ _pwgPageSizeForMedia(
/*
+ * 'pwg_add_finishing()' - Add a finishings value.
+ */
+
+static void
+pwg_add_finishing(
+ cups_array_t *finishings, /* I - Finishings array */
+ ipp_finishings_t template, /* I - Finishing template */
+ const char *name, /* I - PPD option */
+ const char *value) /* I - PPD choice */
+{
+ _pwg_finishings_t *f; /* New finishings value */
+
+
+ if ((f = (_pwg_finishings_t *)calloc(1, sizeof(_pwg_finishings_t))) != NULL)
+ {
+ f->value = template;
+ f->num_options = cupsAddOption(name, value, 0, &f->options);
+
+ cupsArrayAdd(finishings, f);
+ }
+}
+
+
+/*
* 'pwg_compare_finishings()' - Compare two finishings values.
*/
-static int /* O- Result of comparison */
+static int /* O - Result of comparison */
pwg_compare_finishings(
_pwg_finishings_t *a, /* I - First finishings value */
_pwg_finishings_t *b) /* I - Second finishings value */
@@ -3952,22 +4296,6 @@ pwg_free_finishings(
/*
- * 'pwg_free_material()' - Free a material value.
- */
-
-static void
-pwg_free_material(_pwg_material_t *m) /* I - Material value */
-{
- _cupsStrFree(m->key);
- _cupsStrFree(m->name);
-
- cupsFreeOptions(m->num_props, m->props);
-
- free(m);
-}
-
-
-/*
* 'pwg_ppdize_name()' - Convert an IPP keyword to a PPD keyword.
*/
@@ -3980,11 +4308,17 @@ pwg_ppdize_name(const char *ipp, /* I - IPP keyword */
*end; /* End of name buffer */
+ if (!ipp)
+ {
+ *name = '\0';
+ return;
+ }
+
*name = (char)toupper(*ipp++);
for (ptr = name + 1, end = name + namesize - 1; *ipp && ptr < end;)
{
- if (*ipp == '-' && _cups_isalpha(ipp[1]))
+ if (*ipp == '-' && _cups_isalnum(ipp[1]))
{
ipp ++;
*ptr++ = (char)toupper(*ipp++ & 255);
diff --git a/cups/ppd-conflicts.c b/cups/ppd-conflicts.c
index 68e03b4d..8f875a57 100644
--- a/cups/ppd-conflicts.c
+++ b/cups/ppd-conflicts.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
diff --git a/cups/ppd-custom.c b/cups/ppd-custom.c
index 6e4d3bd6..b7070fa2 100644
--- a/cups/ppd-custom.c
+++ b/cups/ppd-custom.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
diff --git a/cups/ppd-emit.c b/cups/ppd-emit.c
index 0b4f1c99..36e5bcaf 100644
--- a/cups/ppd-emit.c
+++ b/cups/ppd-emit.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
diff --git a/cups/ppd-localize.c b/cups/ppd-localize.c
index db931709..ed75bf86 100644
--- a/cups/ppd-localize.c
+++ b/cups/ppd-localize.c
@@ -1,14 +1,14 @@
/*
* PPD localization routines for CUPS.
*
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
@@ -665,7 +665,7 @@ _ppdLocalizedAttr(ppd_file_t *ppd, /* I - PPD file */
/*
* <rdar://problem/22130168>
*
- * Hong Kong locale needs special handling... Sigh...
+ * Multiple locales need special handling... Sigh...
*/
if (!strcmp(ll_CC, "zh_HK"))
diff --git a/cups/ppd-mark.c b/cups/ppd-mark.c
index 08bc9931..9fdaf0bd 100644
--- a/cups/ppd-mark.c
+++ b/cups/ppd-mark.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
diff --git a/cups/ppd-page.c b/cups/ppd-page.c
index f18e68d0..ccbf0527 100644
--- a/cups/ppd-page.c
+++ b/cups/ppd-page.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
diff --git a/cups/ppd-private.h b/cups/ppd-private.h
index 83f048e2..b199bbd2 100644
--- a/cups/ppd-private.h
+++ b/cups/ppd-private.h
@@ -1,14 +1,14 @@
/*
* Private PPD definitions for CUPS.
*
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
@@ -47,7 +47,7 @@ extern "C" {
* Constants...
*/
-# define _PPD_CACHE_VERSION 7 /* Version number in cache file */
+# define _PPD_CACHE_VERSION 8 /* Version number in cache file */
/*
@@ -100,7 +100,7 @@ typedef enum _pwg_print_color_mode_e /**** PWG print-color-mode indices ****/
{
_PWG_PRINT_COLOR_MODE_MONOCHROME = 0, /* print-color-mode=monochrome */
_PWG_PRINT_COLOR_MODE_COLOR, /* print-color-mode=color */
- /* Other proposed values are not supported by CUPS yet. */
+ /* Other values are not supported by CUPS yet. */
_PWG_PRINT_COLOR_MODE_MAX
} _pwg_print_color_mode_t;
@@ -119,14 +119,6 @@ typedef struct _pwg_finishings_s /**** PWG finishings mapping data ****/
cups_option_t *options; /* Options to apply */
} _pwg_finishings_t;
-typedef struct _pwg_material_s /**** PWG material mapping data ****/
-{
- char *key, /* material-key value */
- *name; /* material-name value */
- int num_props; /* Number of properties */
- cups_option_t *props; /* Material properties */
-} _pwg_material_t;
-
struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
{
int num_bins; /* Number of output bins */
@@ -166,11 +158,6 @@ struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
cups_array_t *mandatory; /* cupsMandatory value */
char *charge_info_uri; /* cupsChargeInfoURI value */
cups_array_t *support_files; /* Support files - ICC profiles, etc. */
- char *cups_3d, /* cups3D value */
- *cups_layer_order; /* cupsLayerOrder value */
- int cups_accuracy[3]; /* cupsAccuracy value - x, y, and z in nanometers */
- int cups_volume[3]; /* cupsVolume value - x, y, and z in millimeters */
- cups_array_t *materials; /* cupsMaterial values */
};
diff --git a/cups/ppd-util.c b/cups/ppd-util.c
index af5bd200..d0194c80 100644
--- a/cups/ppd-util.c
+++ b/cups/ppd-util.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/ppd.c b/cups/ppd.c
index 44a22c5c..5bd839d1 100644
--- a/cups/ppd.c
+++ b/cups/ppd.c
@@ -1,14 +1,14 @@
/*
* PPD file routines for CUPS.
*
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
@@ -579,12 +579,28 @@ _ppdOpen(
/*
* <rdar://problem/22130168>
+ * <rdar://problem/27245567>
*
* Need to use a different base language for some locales...
*/
if (!strcmp(lang->language, "zh_HK"))
- strlcpy(ll, "zh_TW.", sizeof(ll));
+ { /* Traditional Chinese + variants */
+ strlcpy(ll_CC, "zh_TW.", sizeof(ll_CC));
+ strlcpy(ll, "zh_", sizeof(ll));
+ }
+ else if (!strncmp(lang->language, "zh", 2))
+ strlcpy(ll, "zh_", sizeof(ll)); /* Any Chinese variant */
+ else if (!strncmp(lang->language, "jp", 2))
+ { /* Any Japanese variant */
+ strlcpy(ll_CC, "ja", sizeof(ll_CC));
+ strlcpy(ll, "jp", sizeof(ll));
+ }
+ else if (!strncmp(lang->language, "nb", 2) || !strncmp(lang->language, "no", 2))
+ { /* Any Norwegian variant */
+ strlcpy(ll_CC, "nb", sizeof(ll_CC));
+ strlcpy(ll, "no", sizeof(ll));
+ }
else
snprintf(ll, sizeof(ll), "%2.2s.", lang->language);
diff --git a/cups/ppd.h b/cups/ppd.h
index eb9ab382..fb33c08b 100644
--- a/cups/ppd.h
+++ b/cups/ppd.h
@@ -12,7 +12,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* PostScript is a trademark of Adobe Systems, Inc.
*
diff --git a/cups/pwg-media.c b/cups/pwg-media.c
index 6a206877..73356fd7 100644
--- a/cups/pwg-media.c
+++ b/cups/pwg-media.c
@@ -1,13 +1,13 @@
/*
* PWG media name API implementation for CUPS.
*
- * Copyright 2009-2016 by Apple Inc.
+ * Copyright 2009-2017 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -37,8 +37,7 @@ static int pwg_compare_pwg(pwg_media_t *a, pwg_media_t *b);
static int pwg_compare_ppd(pwg_media_t *a, pwg_media_t *b);
static char *pwg_format_inches(char *buf, size_t bufsize, int val);
static char *pwg_format_millimeters(char *buf, size_t bufsize, int val);
-static int pwg_scan_measurement(const char *buf, char **bufptr, int numer,
- int denom);
+static int pwg_scan_measurement(const char *buf, char **bufptr, int numer, int denom);
/*
@@ -61,7 +60,7 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_IN("na_index-5x8_5x8in", NULL, "5x8", 5, 8),
_PWG_MEDIA_IN("na_number-14_5x11.5in", NULL, "Env14", 5, 11.5),
_PWG_MEDIA_IN("na_invoice_5.5x8.5in", "invoice", "Statement", 5.5, 8.5),
- _PWG_MEDIA_IN("na_index-4x6-ext_6x8in", NULL, NULL, 6, 8),
+ _PWG_MEDIA_IN("na_index-4x6-ext_6x8in", NULL, "6x8", 6, 8),
_PWG_MEDIA_IN("na_6x9_6x9in", "na-6x9-envelope", "6x9", 6, 9),
_PWG_MEDIA_IN("na_c5_6.5x9.5in", NULL, "6.5x9.5", 6.5, 9.5),
_PWG_MEDIA_IN("na_7x9_7x9in", "na-7x9-envelope", "7x9", 7, 9),
@@ -86,7 +85,7 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_IN("na_10x15_10x15in", "na-10x15-envelope", "10x15", 10, 15),
_PWG_MEDIA_IN("na_11x12_11x12in", NULL, "11x12", 11, 12),
_PWG_MEDIA_IN("na_edp_11x14in", NULL, "11x14", 11, 14),
- _PWG_MEDIA_IN("na_fanfold-us_11x14.875in", NULL, NULL, 11, 14.875),
+ _PWG_MEDIA_IN("na_fanfold-us_11x14.875in", NULL, "11x14.875", 11, 14.875),
_PWG_MEDIA_IN("na_11x15_11x15in", NULL, "11x15", 11, 15),
_PWG_MEDIA_IN("na_ledger_11x17in", "tabloid", "Tabloid", 11, 17),
_PWG_MEDIA_IN("na_eur-edp_12x14in", NULL, NULL, 12, 14),
@@ -98,8 +97,8 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_IN("na_arch-c_18x24in", "arch-c", "ARCHC", 18, 24),
_PWG_MEDIA_IN("na_d_22x34in", "d", "AnsiD", 22, 34),
_PWG_MEDIA_IN("na_arch-d_24x36in", "arch-d", "ARCHD", 24, 36),
- _PWG_MEDIA_IN("asme_f_28x40in", "f", NULL, 28, 40),
- _PWG_MEDIA_IN("na_wide-format_30x42in", NULL, NULL, 30, 42),
+ _PWG_MEDIA_IN("asme_f_28x40in", "f", "28x40", 28, 40),
+ _PWG_MEDIA_IN("na_wide-format_30x42in", NULL, "30x42", 30, 42),
_PWG_MEDIA_IN("na_e_34x44in", "e", "AnsiE", 34, 44),
_PWG_MEDIA_IN("na_arch-e_36x48in", "arch-e", "ARCHE", 36, 48),
_PWG_MEDIA_IN("na_f_44x68in", NULL, "AnsiF", 44, 68),
@@ -116,35 +115,35 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("iso_a4-tab_225x297mm", NULL, "A4Tab", 225, 297),
_PWG_MEDIA_MM("iso_a4-extra_235.5x322.3mm", NULL, "A4Extra", 235.5, 322.3),
_PWG_MEDIA_MM("iso_a3_297x420mm", "iso-a3", "A3", 297, 420),
- _PWG_MEDIA_MM("iso_a4x3_297x630mm", "iso-a4x3", NULL, 297, 630),
- _PWG_MEDIA_MM("iso_a4x4_297x841mm", "iso-a4x4", NULL, 297, 841),
- _PWG_MEDIA_MM("iso_a4x5_297x1051mm", "iso-a4x5", NULL, 297, 1051),
- _PWG_MEDIA_MM("iso_a4x6_297x1261mm", "iso-a4x6", NULL, 297, 1261),
- _PWG_MEDIA_MM("iso_a4x7_297x1471mm", "iso-a4x7", NULL, 297, 1471),
- _PWG_MEDIA_MM("iso_a4x8_297x1682mm", "iso-a4x8", NULL, 297, 1682),
- _PWG_MEDIA_MM("iso_a4x9_297x1892mm", "iso-a4x9", NULL, 297, 1892),
+ _PWG_MEDIA_MM("iso_a4x3_297x630mm", "iso-a4x3", "A4x3", 297, 630),
+ _PWG_MEDIA_MM("iso_a4x4_297x841mm", "iso-a4x4", "A4x4", 297, 841),
+ _PWG_MEDIA_MM("iso_a4x5_297x1051mm", "iso-a4x5", "A4x5", 297, 1051),
+ _PWG_MEDIA_MM("iso_a4x6_297x1261mm", "iso-a4x6", "A4x6", 297, 1261),
+ _PWG_MEDIA_MM("iso_a4x7_297x1471mm", "iso-a4x7", "A4x7", 297, 1471),
+ _PWG_MEDIA_MM("iso_a4x8_297x1682mm", "iso-a4x8", "A4x8", 297, 1682),
+ _PWG_MEDIA_MM("iso_a4x9_297x1892mm", "iso-a4x9", "A4x9", 297, 1892),
_PWG_MEDIA_MM("iso_a3-extra_322x445mm", "iso-a3-extra", "A3Extra", 322, 445),
_PWG_MEDIA_MM("iso_a2_420x594mm", "iso-a2", "A2", 420, 594),
- _PWG_MEDIA_MM("iso_a3x3_420x891mm", "iso-a3x3", NULL, 420, 891),
- _PWG_MEDIA_MM("iso_a3x4_420x1189mm", "iso-a3x4", NULL, 420, 1189),
- _PWG_MEDIA_MM("iso_a3x5_420x1486mm", "iso-a3x5", NULL, 420, 1486),
- _PWG_MEDIA_MM("iso_a3x6_420x1783mm", "iso-a3x6", NULL, 420, 1783),
- _PWG_MEDIA_MM("iso_a3x7_420x2080mm", "iso-a3x7", NULL, 420, 2080),
+ _PWG_MEDIA_MM("iso_a3x3_420x891mm", "iso-a3x3", "A3x3", 420, 891),
+ _PWG_MEDIA_MM("iso_a3x4_420x1189mm", "iso-a3x4", "A3x4", 420, 1189),
+ _PWG_MEDIA_MM("iso_a3x5_420x1486mm", "iso-a3x5", "A3x6", 420, 1486),
+ _PWG_MEDIA_MM("iso_a3x6_420x1783mm", "iso-a3x6", "A3x6", 420, 1783),
+ _PWG_MEDIA_MM("iso_a3x7_420x2080mm", "iso-a3x7", "A3x7", 420, 2080),
_PWG_MEDIA_MM("iso_a1_594x841mm", "iso-a1", "A1", 594, 841),
- _PWG_MEDIA_MM("iso_a2x3_594x1261mm", "iso-a2x3", NULL, 594, 1261),
- _PWG_MEDIA_MM("iso_a2x4_594x1682mm", "iso-a2x4", NULL, 594, 1682),
- _PWG_MEDIA_MM("iso_a2x5_594x2102mm", "iso-a2x5", NULL, 594, 2102),
+ _PWG_MEDIA_MM("iso_a2x3_594x1261mm", "iso-a2x3", "A2x3", 594, 1261),
+ _PWG_MEDIA_MM("iso_a2x4_594x1682mm", "iso-a2x4", "A2x4", 594, 1682),
+ _PWG_MEDIA_MM("iso_a2x5_594x2102mm", "iso-a2x5", "A2x5", 594, 2102),
_PWG_MEDIA_MM("iso_a0_841x1189mm", "iso-a0", "A0", 841, 1189),
- _PWG_MEDIA_MM("iso_a1x3_841x1783mm", "iso-a1x3", NULL, 841, 1783),
- _PWG_MEDIA_MM("iso_a1x4_841x2378mm", "iso-a1x4", NULL, 841, 2378),
- _PWG_MEDIA_MM("iso_2a0_1189x1682mm", NULL, NULL, 1189, 1682),
- _PWG_MEDIA_MM("iso_a0x3_1189x2523mm", NULL, NULL, 1189, 2523),
+ _PWG_MEDIA_MM("iso_a1x3_841x1783mm", "iso-a1x3", "A1x3", 841, 1783),
+ _PWG_MEDIA_MM("iso_a1x4_841x2378mm", "iso-a1x4", "A1x4", 841, 2378),
+ _PWG_MEDIA_MM("iso_2a0_1189x1682mm", NULL, "1189x1682mm", 1189, 1682),
+ _PWG_MEDIA_MM("iso_a0x3_1189x2523mm", NULL, "A0x3", 1189, 2523),
_PWG_MEDIA_MM("iso_b10_31x44mm", "iso-b10", "ISOB10", 31, 44),
_PWG_MEDIA_MM("iso_b9_44x62mm", "iso-b9", "ISOB9", 44, 62),
_PWG_MEDIA_MM("iso_b8_62x88mm", "iso-b8", "ISOB8", 62, 88),
_PWG_MEDIA_MM("iso_b7_88x125mm", "iso-b7", "ISOB7", 88, 125),
_PWG_MEDIA_MM("iso_b6_125x176mm", "iso-b6", "ISOB6", 125, 176),
- _PWG_MEDIA_MM("iso_b6c4_125x324mm", NULL, NULL, 125, 324),
+ _PWG_MEDIA_MM("iso_b6c4_125x324mm", NULL, "125x324mm", 125, 324),
_PWG_MEDIA_MM("iso_b5_176x250mm", "iso-b5", "ISOB5", 176, 250),
_PWG_MEDIA_MM("iso_b5-extra_201x276mm", NULL, "ISOB5Extra", 201, 276),
_PWG_MEDIA_MM("iso_b4_250x353mm", "iso-b4", "ISOB4", 250, 353),
@@ -152,11 +151,11 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("iso_b2_500x707mm", "iso-b2", "ISOB2", 500, 707),
_PWG_MEDIA_MM("iso_b1_707x1000mm", "iso-b1", "ISOB1", 707, 1000),
_PWG_MEDIA_MM("iso_b0_1000x1414mm", "iso-b0", "ISOB0", 1000, 1414),
- _PWG_MEDIA_MM("iso_c10_28x40mm", "iso-c10", NULL, 28, 40),
- _PWG_MEDIA_MM("iso_c9_40x57mm", "iso-c9", NULL, 40, 57),
- _PWG_MEDIA_MM("iso_c8_57x81mm", "iso-c8", NULL, 57, 81),
+ _PWG_MEDIA_MM("iso_c10_28x40mm", "iso-c10", "EnvC10", 28, 40),
+ _PWG_MEDIA_MM("iso_c9_40x57mm", "iso-c9", "EnvC9", 40, 57),
+ _PWG_MEDIA_MM("iso_c8_57x81mm", "iso-c8", "EnvC8", 57, 81),
_PWG_MEDIA_MM("iso_c7_81x114mm", "iso-c7", "EnvC7", 81, 114),
- _PWG_MEDIA_MM("iso_c7c6_81x162mm", NULL, NULL, 81, 162),
+ _PWG_MEDIA_MM("iso_c7c6_81x162mm", NULL, "EnvC76", 81, 162),
_PWG_MEDIA_MM("iso_c6_114x162mm", "iso-c6", "EnvC6", 114, 162),
_PWG_MEDIA_MM("iso_c6c5_114x229mm", NULL, "EnvC65", 114, 229),
_PWG_MEDIA_MM("iso_c5_162x229mm", "iso-c5", "EnvC5", 162, 229),
@@ -166,16 +165,16 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("iso_c1_648x917mm", "iso-c1", "EnvC1", 648, 917),
_PWG_MEDIA_MM("iso_c0_917x1297mm", "iso-c0", "EnvC0", 917, 1297),
_PWG_MEDIA_MM("iso_dl_110x220mm", "iso-designated", "EnvDL", 110, 220),
- _PWG_MEDIA_MM("iso_ra4_215x305mm", "iso-ra4", NULL, 215, 305),
- _PWG_MEDIA_MM("iso_sra4_225x320mm", "iso-sra4", NULL, 225, 320),
- _PWG_MEDIA_MM("iso_ra3_305x430mm", "iso-ra3", NULL, 305, 430),
- _PWG_MEDIA_MM("iso_sra3_320x450mm", "iso-sra3", NULL, 320, 450),
- _PWG_MEDIA_MM("iso_ra2_430x610mm", "iso-ra2", NULL, 430, 610),
- _PWG_MEDIA_MM("iso_sra2_450x640mm", "iso-sra2", NULL, 450, 640),
- _PWG_MEDIA_MM("iso_ra1_610x860mm", "iso-ra1", NULL, 610, 860),
- _PWG_MEDIA_MM("iso_sra1_640x900mm", "iso-sra1", NULL, 640, 900),
- _PWG_MEDIA_MM("iso_ra0_860x1220mm", "iso-ra0", NULL, 860, 1220),
- _PWG_MEDIA_MM("iso_sra0_900x1280mm", "iso-sra0", NULL, 900, 1280),
+ _PWG_MEDIA_MM("iso_ra4_215x305mm", "iso-ra4", "RA4", 215, 305),
+ _PWG_MEDIA_MM("iso_sra4_225x320mm", "iso-sra4", "SRA4", 225, 320),
+ _PWG_MEDIA_MM("iso_ra3_305x430mm", "iso-ra3", "RA3", 305, 430),
+ _PWG_MEDIA_MM("iso_sra3_320x450mm", "iso-sra3", "SRA3", 320, 450),
+ _PWG_MEDIA_MM("iso_ra2_430x610mm", "iso-ra2", "RA2", 430, 610),
+ _PWG_MEDIA_MM("iso_sra2_450x640mm", "iso-sra2", "SRA2", 450, 640),
+ _PWG_MEDIA_MM("iso_ra1_610x860mm", "iso-ra1", "RA1", 610, 860),
+ _PWG_MEDIA_MM("iso_sra1_640x900mm", "iso-sra1", "SRA1", 640, 900),
+ _PWG_MEDIA_MM("iso_ra0_860x1220mm", "iso-ra0", "RA0", 860, 1220),
+ _PWG_MEDIA_MM("iso_sra0_900x1280mm", "iso-sra0", "SRA0", 900, 1280),
/* Japanese Standard Sheet Media Sizes */
_PWG_MEDIA_MM("jis_b10_32x45mm", "jis-b10", "B10", 32, 45),
@@ -189,7 +188,7 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("jis_b2_515x728mm", "jis-b2", "B2", 515, 728),
_PWG_MEDIA_MM("jis_b1_728x1030mm", "jis-b1", "B1", 728, 1030),
_PWG_MEDIA_MM("jis_b0_1030x1456mm", "jis-b0", "B0", 1030, 1456),
- _PWG_MEDIA_MM("jis_exec_216x330mm", NULL, NULL, 216, 330),
+ _PWG_MEDIA_MM("jis_exec_216x330mm", NULL, "216x330mm", 216, 330),
_PWG_MEDIA_MM("jpn_kaku2_240x332mm", NULL, "EnvKaku2", 240, 332),
_PWG_MEDIA_MM("jpn_kaku3_216x277mm", NULL, "EnvKaku3", 216, 277),
_PWG_MEDIA_MM("jpn_kaku4_197x267mm", NULL, "EnvKaku4", 197, 267),
@@ -204,7 +203,7 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("jpn_chou3_120x235mm", NULL, "EnvChou3", 120, 235),
_PWG_MEDIA_MM("jpn_chou40_90x225mm", NULL, "EnvChou40", 90, 225),
_PWG_MEDIA_MM("jpn_oufuku_148x200mm", NULL, "DoublePostcardRotated", 148, 200),
- _PWG_MEDIA_MM("jpn_kahu_240x322.1mm", NULL, NULL, 240, 322.1),
+ _PWG_MEDIA_MM("jpn_kahu_240x322.1mm", NULL, "240x322mm", 240, 322.1),
/* Chinese Standard Sheet Media Sizes */
_PWG_MEDIA_MM("prc_32k_97x151mm", NULL, "PRC32K", 97, 151),
@@ -215,9 +214,9 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("prc_6_120x320mm", NULL, NULL, 120, 320),
_PWG_MEDIA_MM("prc_16k_146x215mm", NULL, "PRC16K", 146, 215),
_PWG_MEDIA_MM("prc_7_160x230mm", NULL, "EnvPRC7", 160, 230),
- _PWG_MEDIA_MM("om_juuro-ku-kai_198x275mm", NULL, NULL, 198, 275),
- _PWG_MEDIA_MM("om_pa-kai_267x389mm", NULL, NULL, 267, 389),
- _PWG_MEDIA_MM("om_dai-pa-kai_275x395mm", NULL, NULL, 275, 395),
+ _PWG_MEDIA_MM("om_juuro-ku-kai_198x275mm", NULL, "198x275mm", 198, 275),
+ _PWG_MEDIA_MM("om_pa-kai_267x389mm", NULL, "267x389mm", 267, 389),
+ _PWG_MEDIA_MM("om_dai-pa-kai_275x395mm", NULL, "275x395mm", 275, 395),
/* Chinese Standard Sheet Media Inch Sizes */
_PWG_MEDIA_IN("roc_16k_7.75x10.75in", NULL, "roc16k", 7.75, 10.75),
@@ -227,16 +226,16 @@ static pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_IN("oe_photo-l_3.5x5in", NULL, "3.5x5", 3.5, 5),
/* Other Metric Standard Sheet Media Sizes */
- _PWG_MEDIA_MM("om_small-photo_100x150mm", NULL, "om_small-photo", 100, 150),
+ _PWG_MEDIA_MM("om_small-photo_100x150mm", NULL, "100x150mm", 100, 150),
_PWG_MEDIA_MM("om_italian_110x230mm", NULL, "EnvItalian", 110, 230),
- _PWG_MEDIA_MM("om_large-photo_200x300", NULL, "om_large-photo", 200, 300),
+ _PWG_MEDIA_MM("om_large-photo_200x300", NULL, "200x300mm", 200, 300),
_PWG_MEDIA_MM("om_folio_210x330mm", "folio", "Folio", 210, 330),
_PWG_MEDIA_MM("om_folio-sp_215x315mm", NULL, "FolioSP", 215, 315),
_PWG_MEDIA_MM("om_invite_220x220mm", NULL, "EnvInvite", 220, 220),
- _PWG_MEDIA_MM("om_small-photo_100x200mm", NULL, "om_wide-photo", 100, 200),
+ _PWG_MEDIA_MM("om_small-photo_100x200mm", NULL, "100x200mm", 100, 200),
/* Disc Sizes */
- _PWG_MEDIA_MM("disc_standard_40x118mm", NULL, NULL, 118, 118)
+ _PWG_MEDIA_MM("disc_standard_40x118mm", NULL, "Disc", 118, 118)
};
@@ -378,11 +377,6 @@ pwgFormatSizeName(char *keyword, /* I - Keyword buffer */
return (1);
}
-/* For macOS 10.8 and earlier... */
-void _pwgGenerateSize(char *keyword, size_t keysize, const char *prefix,
- const char *name, int width, int length)
-{ pwgFormatSizeName(keyword, keysize, prefix, name, width, length, NULL); }
-
/*
* 'pwgInitSize()' - Initialize a pwg_size_t structure using IPP Job Template
@@ -560,10 +554,6 @@ pwgInitSize(pwg_size_t *size, /* I - Size to initialize */
return (1);
}
-/* For macOS 10.8 and earlier */
-int _pwgInitSize(pwg_size_t *size, ipp_t *job, int *margins_set)
-{ return (pwgInitSize(size, job, margins_set)); }
-
/*
* 'pwgMediaForLegacy()' - Find a PWG media size by ISO/IPP legacy name.
@@ -771,6 +761,8 @@ pwgMediaForPPD(const char *ppd) /* I - PPD size name */
* [oe|om]_WIDTHxHEIGHTuu_WIDTHxHEIGHTuu
*/
+ char wstr[32], lstr[32]; /* Width and length as strings */
+
size = &(cg->pwg_media);
size->width = w;
size->length = l;
@@ -779,6 +771,12 @@ pwgMediaForPPD(const char *ppd) /* I - PPD size name */
pwgFormatSizeName(cg->pwg_name, sizeof(cg->pwg_name),
custom ? "custom" : NULL, custom ? ppd + 7 : NULL,
size->width, size->length, NULL);
+
+ if ((w % 635) == 0 && (l % 635) == 0)
+ snprintf(cg->ppd_name, sizeof(cg->ppd_name), "%sx%s", pwg_format_inches(wstr, sizeof(wstr), w), pwg_format_inches(lstr, sizeof(lstr), l));
+ else
+ snprintf(cg->ppd_name, sizeof(cg->ppd_name), "%sx%smm", pwg_format_millimeters(wstr, sizeof(wstr), w), pwg_format_millimeters(lstr, sizeof(lstr), l));
+ size->ppd = cg->ppd_name;
}
}
}
@@ -869,6 +867,8 @@ pwgMediaForPWG(const char *pwg) /* I - PWG size name */
if (ptr)
{
+ char wstr[32], lstr[32]; /* Width and length strings */
+
if (!strncmp(pwg, "disc_", 5))
w = l; /* Make the media size OUTERxOUTER */
@@ -878,6 +878,12 @@ pwgMediaForPWG(const char *pwg) /* I - PWG size name */
strlcpy(cg->pwg_name, pwg, sizeof(cg->pwg_name));
size->pwg = cg->pwg_name;
+
+ if (numer == 100)
+ snprintf(cg->ppd_name, sizeof(cg->ppd_name), "%sx%smm", pwg_format_millimeters(wstr, sizeof(wstr), w), pwg_format_millimeters(lstr, sizeof(lstr), l));
+ else
+ snprintf(cg->ppd_name, sizeof(cg->ppd_name), "%sx%s", pwg_format_inches(wstr, sizeof(wstr), w), pwg_format_inches(lstr, sizeof(lstr), l));
+ size->ppd = cg->ppd_name;
}
}
}
@@ -927,6 +933,7 @@ _pwgMediaNearSize(int width, /* I - Width in hundredths of millimeters *
int dw, dl, /* Difference in width and length */
best_dw = 999, /* Best difference in width and length */
best_dl = 999;
+ char wstr[32], lstr[32]; /* Width and length as strings */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
@@ -979,6 +986,12 @@ _pwgMediaNearSize(int width, /* I - Width in hundredths of millimeters *
cg->pwg_media.width = width;
cg->pwg_media.length = length;
+ if ((width % 635) == 0 && (length % 635) == 0)
+ snprintf(cg->ppd_name, sizeof(cg->ppd_name), "%sx%s", pwg_format_inches(wstr, sizeof(wstr), width), pwg_format_inches(lstr, sizeof(lstr), length));
+ else
+ snprintf(cg->ppd_name, sizeof(cg->ppd_name), "%sx%smm", pwg_format_millimeters(wstr, sizeof(wstr), width), pwg_format_millimeters(lstr, sizeof(lstr), length));
+ cg->pwg_media.ppd = cg->ppd_name;
+
return (&(cg->pwg_media));
}
@@ -1038,8 +1051,8 @@ pwg_compare_pwg(pwg_media_t *a, /* I - First size */
static char * /* O - String */
pwg_format_inches(char *buf, /* I - Buffer */
- size_t bufsize, /* I - Size of buffer */
- int val) /* I - Value in hundredths of millimeters */
+ size_t bufsize, /* I - Size of buffer */
+ int val) /* I - Value in hundredths of millimeters */
{
int thousandths, /* Thousandths of inches */
integer, /* Integer portion */
@@ -1079,8 +1092,8 @@ pwg_format_inches(char *buf, /* I - Buffer */
static char * /* O - String */
pwg_format_millimeters(char *buf, /* I - Buffer */
- size_t bufsize, /* I - Size of buffer */
- int val) /* I - Value in hundredths of millimeters */
+ size_t bufsize, /* I - Size of buffer */
+ int val) /* I - Value in hundredths of millimeters */
{
int integer, /* Integer portion */
fraction; /* Fractional portion */
diff --git a/cups/pwg-private.h b/cups/pwg-private.h
index 25fb667a..e7715906 100644
--- a/cups/pwg-private.h
+++ b/cups/pwg-private.h
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/pwg.h b/cups/pwg.h
index f663246c..2269dbe4 100644
--- a/cups/pwg.h
+++ b/cups/pwg.h
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/raster-private.h b/cups/raster-private.h
index 7656b279..38135815 100644
--- a/cups/raster-private.h
+++ b/cups/raster-private.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/raster.h b/cups/raster.h
index 43a9d158..4067b3c3 100644
--- a/cups/raster.h
+++ b/cups/raster.h
@@ -10,7 +10,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -52,6 +52,9 @@ extern "C" {
# define CUPS_RASTER_SYNCv2 0x52615332 /* RaS2 */
# define CUPS_RASTER_REVSYNCv2 0x32536152 /* 2SaR */
+# define CUPS_RASTER_SYNCapple 0x554E4952 /* UNIR */
+# define CUPS_RASTER_REVSYNCapple 0x52494E55 /* RINU */
+
# define CUPS_RASTER_SYNC_PWG CUPS_RASTER_SYNCv2
/*
@@ -76,6 +79,13 @@ extern "C" {
# define CUPS_RASTER_HAVE_PWGRASTER 1
/*
+ * The following definition can be used to determine if Apple Raster is
+ * supported (beta).
+ */
+
+# define CUPS_RASTER_HAVE_APPLERASTER 1
+
+/*
* The following PWG 5102.4 definitions specify indices into the
* cupsInteger[] array in the raster header.
*/
@@ -202,7 +212,8 @@ enum cups_mode_e /**** cupsRasterOpen modes ****/
CUPS_RASTER_READ = 0, /* Open stream for reading */
CUPS_RASTER_WRITE = 1, /* Open stream for writing */
CUPS_RASTER_WRITE_COMPRESSED = 2, /* Open stream for compressed writing @since CUPS 1.3/macOS 10.5@ */
- CUPS_RASTER_WRITE_PWG = 3 /* Open stream for compressed writing in PWG mode @since CUPS 1.5/macOS 10.7@ */
+ CUPS_RASTER_WRITE_PWG = 3, /* Open stream for compressed writing in PWG Raster mode @since CUPS 1.5/macOS 10.7@ */
+ CUPS_RASTER_WRITE_APPLE = 4 /* Open stream for compressed writing in AppleRaster mode (beta) @private@ */
};
typedef enum cups_mode_e cups_mode_t; /**** cupsRasterOpen modes ****/
diff --git a/cups/request.c b/cups/request.c
index 8de44f7e..39cbe6cc 100644
--- a/cups/request.c
+++ b/cups/request.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/sidechannel.c b/cups/sidechannel.c
index 8070ea74..a4cd960a 100644
--- a/cups/sidechannel.c
+++ b/cups/sidechannel.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/sidechannel.h b/cups/sidechannel.h
index 3de45420..a82408f4 100644
--- a/cups/sidechannel.h
+++ b/cups/sidechannel.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/snprintf.c b/cups/snprintf.c
index d586ce92..c5d8908c 100644
--- a/cups/snprintf.c
+++ b/cups/snprintf.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/string-private.h b/cups/string-private.h
index 8b1140bc..e8448d17 100644
--- a/cups/string-private.h
+++ b/cups/string-private.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/string.c b/cups/string.c
index 23b04398..39a787f0 100644
--- a/cups/string.c
+++ b/cups/string.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/tempfile.c b/cups/tempfile.c
index d96ee7db..da705a94 100644
--- a/cups/tempfile.c
+++ b/cups/tempfile.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testadmin.c b/cups/testadmin.c
index f15c8081..69b5efbf 100644
--- a/cups/testadmin.c
+++ b/cups/testadmin.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testarray.c b/cups/testarray.c
index 5ae7315d..6164ffc6 100644
--- a/cups/testarray.c
+++ b/cups/testarray.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testcache.c b/cups/testcache.c
index 9025a0df..e7816a36 100644
--- a/cups/testcache.c
+++ b/cups/testcache.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testconflicts.c b/cups/testconflicts.c
index d07b088e..973c5a04 100644
--- a/cups/testconflicts.c
+++ b/cups/testconflicts.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testcreds.c b/cups/testcreds.c
index 8e3c878a..bc17a202 100644
--- a/cups/testcreds.c
+++ b/cups/testcreds.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testcups.c b/cups/testcups.c
index b6bf78fa..aa587661 100644
--- a/cups/testcups.c
+++ b/cups/testcups.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testdest.c b/cups/testdest.c
index de6f1daa..945e3e11 100644
--- a/cups/testdest.c
+++ b/cups/testdest.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testfile.c b/cups/testfile.c
index dae50fa2..b2ec8cd5 100644
--- a/cups/testfile.c
+++ b/cups/testfile.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testhttp.c b/cups/testhttp.c
index 20c6625a..376d71f6 100644
--- a/cups/testhttp.c
+++ b/cups/testhttp.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testi18n.c b/cups/testi18n.c
index a88f1e1f..beaf2367 100644
--- a/cups/testi18n.c
+++ b/cups/testi18n.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testipp.c b/cups/testipp.c
index 150abe06..017ee9d6 100644
--- a/cups/testipp.c
+++ b/cups/testipp.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testlang.c b/cups/testlang.c
index 6f0691e0..6aa49ab4 100644
--- a/cups/testlang.c
+++ b/cups/testlang.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testoptions.c b/cups/testoptions.c
index 44a3c71d..f5ce2e2e 100644
--- a/cups/testoptions.c
+++ b/cups/testoptions.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testppd.c b/cups/testppd.c
index 6d5065c6..e1b51564 100644
--- a/cups/testppd.c
+++ b/cups/testppd.c
@@ -1,14 +1,14 @@
/*
* PPD test program for CUPS.
*
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testpwg.c b/cups/testpwg.c
index 05aba45e..d2332c29 100644
--- a/cups/testpwg.c
+++ b/cups/testpwg.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/testsnmp.c b/cups/testsnmp.c
index 3ab48af2..4026a28b 100644
--- a/cups/testsnmp.c
+++ b/cups/testsnmp.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/thread-private.h b/cups/thread-private.h
index 64897a35..ca4ef4cb 100644
--- a/cups/thread-private.h
+++ b/cups/thread-private.h
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/thread.c b/cups/thread.c
index b389b153..77b44426 100644
--- a/cups/thread.c
+++ b/cups/thread.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/tls-darwin.c b/cups/tls-darwin.c
index 383a20e9..b6e88b01 100644
--- a/cups/tls-darwin.c
+++ b/cups/tls-darwin.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -41,6 +41,8 @@ static int tls_auto_create = 0;
static char *tls_common_name = NULL;
/* Default common name */
#ifdef HAVE_SECKEYCHAINOPEN
+static int tls_cups_keychain = 0;
+ /* Opened the CUPS keychain? */
static SecKeychainRef tls_keychain = NULL;
/* Server cert keychain */
#else
@@ -1747,6 +1749,7 @@ http_cdsa_copy_server(
CFMutableDictionaryRef query = NULL; /* Query qualifiers */
CFArrayRef list = NULL; /* Keychain list */
SecKeychainRef syschain = NULL;/* System keychain */
+ SecKeychainStatus status = 0; /* Keychain status */
DEBUG_printf(("3http_cdsa_copy_server(common_name=\"%s\")", common_name));
@@ -1769,6 +1772,11 @@ http_cdsa_copy_server(
_cupsMutexLock(&tls_mutex);
+ err = SecKeychainGetStatus(tls_keychain, &status);
+
+ if (err == noErr && !(status & kSecUnlockStateStatus) && tls_cups_keychain)
+ SecKeychainUnlock(tls_keychain, _CUPS_CDSA_PASSLEN, _CUPS_CDSA_PASSWORD, TRUE);
+
CFDictionaryAddValue(query, kSecClass, kSecClassIdentity);
CFDictionaryAddValue(query, kSecMatchPolicy, policy);
CFDictionaryAddValue(query, kSecReturnRef, kCFBooleanTrue);
@@ -1901,9 +1909,15 @@ http_cdsa_open_keychain(
*/
if (!path)
+ {
path = http_cdsa_default_path(filename, filesize);
+ tls_cups_keychain = 1;
+ }
else
+ {
strlcpy(filename, path, filesize);
+ tls_cups_keychain = 0;
+ }
/*
* Save the interaction setting and disable while we open the keychain...
@@ -1912,7 +1926,7 @@ http_cdsa_open_keychain(
SecKeychainGetUserInteractionAllowed(&interaction);
SecKeychainSetUserInteractionAllowed(FALSE);
- if (access(path, R_OK))
+ if (access(path, R_OK) && tls_cups_keychain)
{
/*
* Create a new keychain at the given path...
@@ -1931,7 +1945,7 @@ http_cdsa_open_keychain(
if (err == noErr)
err = SecKeychainGetStatus(keychain, &status);
- if (err == noErr && !(status & kSecUnlockStateStatus))
+ if (err == noErr && !(status & kSecUnlockStateStatus) && tls_cups_keychain)
err = SecKeychainUnlock(keychain, _CUPS_CDSA_PASSLEN, _CUPS_CDSA_PASSWORD, TRUE);
}
diff --git a/cups/tls-gnutls.c b/cups/tls-gnutls.c
index 9941e51e..7193d794 100644
--- a/cups/tls-gnutls.c
+++ b/cups/tls-gnutls.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/tls-sspi.c b/cups/tls-sspi.c
index 8d88faf7..46f6e790 100644
--- a/cups/tls-sspi.c
+++ b/cups/tls-sspi.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/tls.c b/cups/tls.c
index c1db80d2..36d484c3 100644
--- a/cups/tls.c
+++ b/cups/tls.c
@@ -11,7 +11,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/tlscheck.c b/cups/tlscheck.c
index 91972610..32cbcca1 100644
--- a/cups/tlscheck.c
+++ b/cups/tlscheck.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/transcode.c b/cups/transcode.c
index 2aa1a8bc..6f73a426 100644
--- a/cups/transcode.c
+++ b/cups/transcode.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/transcode.h b/cups/transcode.h
index 20d13db0..cd12cb57 100644
--- a/cups/transcode.h
+++ b/cups/transcode.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/usersys.c b/cups/usersys.c
index 9a23d748..333d21e0 100644
--- a/cups/usersys.c
+++ b/cups/usersys.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/util.c b/cups/util.c
index abfb8d47..5db2fc6c 100644
--- a/cups/util.c
+++ b/cups/util.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/cups/versioning.h b/cups/versioning.h
index ed68f82f..2e92e6ba 100644
--- a/cups/versioning.h
+++ b/cups/versioning.h
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/Makefile b/filter/Makefile
index 152bc90c..7da764d3 100644
--- a/filter/Makefile
+++ b/filter/Makefile
@@ -8,7 +8,7 @@
# property of Apple Inc. and are protected by Federal copyright
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
# which should have been included with this file. If this file is
-# file is missing or damaged, see the license at "http://www.cups.org/".
+# missing or damaged, see the license at "http://www.cups.org/".
#
# This file is subject to the Apple OS-Developed Software exception.
#
diff --git a/filter/api-raster.shtml b/filter/api-raster.shtml
index 35996f6f..6d458a2e 100644
--- a/filter/api-raster.shtml
+++ b/filter/api-raster.shtml
@@ -34,7 +34,7 @@ function. For example, to read raster data from the standard input, open
file descriptor 0:</p>
<pre class="example">
-#include &lt;cups/raster.h&gt;>
+#include &lt;cups/raster.h&gt;
<a href="#cups_raster_t">cups_raster_t</a> *ras = <a href="#cupsRasterOpen">cupsRasterOpen</a>(0, CUPS_RASTER_READ);
</pre>
@@ -61,7 +61,7 @@ hardware resolution, and so forth used for the page.</p>
function:</p>
<pre class="example">
-#include &lt;cups/raster.h&gt;>
+#include &lt;cups/raster.h&gt;
<a href="#cups_raster_t">cups_raster_t</a> *ras = <a href="#cupsRasterOpen">cupsRasterOpen</a>(0, CUPS_RASTER_READ);
<a href="#cups_page_header2_t">cups_page_header2_t</a> header;
@@ -84,7 +84,7 @@ function. A <code>for</code> loop is normally used to read the page one line
at a time:</p>
<pre class="example">
-#include &lt;cups/raster.h&gt;>
+#include &lt;cups/raster.h&gt;
<a href="#cups_raster_t">cups_raster_t</a> *ras = <a href="#cupsRasterOpen">cupsRasterOpen</a>(0, CUPS_RASTER_READ);
<a href="#cups_page_header2_t">cups_page_header2_t</a> header;
diff --git a/filter/commandtops.c b/filter/commandtops.c
index 65dcd357..07979e03 100644
--- a/filter/commandtops.c
+++ b/filter/commandtops.c
@@ -7,7 +7,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*/
/*
diff --git a/filter/common.c b/filter/common.c
index bed4a53a..86b5f8ec 100644
--- a/filter/common.c
+++ b/filter/common.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/common.h b/filter/common.h
index 0dcb289f..e72b27fb 100644
--- a/filter/common.h
+++ b/filter/common.h
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/error.c b/filter/error.c
index dfbb5c90..3c552cb0 100644
--- a/filter/error.c
+++ b/filter/error.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/gziptoany.c b/filter/gziptoany.c
index b3f5dffc..0eae85ec 100644
--- a/filter/gziptoany.c
+++ b/filter/gziptoany.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/interpret.c b/filter/interpret.c
index f811d1a0..031b1d5a 100644
--- a/filter/interpret.c
+++ b/filter/interpret.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/pstops.c b/filter/pstops.c
index e9b44389..072356e2 100644
--- a/filter/pstops.c
+++ b/filter/pstops.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/raster.c b/filter/raster.c
index dee8eeca..bacf5ba7 100644
--- a/filter/raster.c
+++ b/filter/raster.c
@@ -10,7 +10,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -36,7 +36,8 @@ struct _cups_raster_s /**** Raster stream data ****/
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 count, /* Current row run-length count */
+ 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 */
@@ -51,6 +52,7 @@ struct _cups_raster_s /**** Raster stream data ****/
#ifdef DEBUG
size_t iocount; /* Number of bytes read/written */
#endif /* DEBUG */
+ unsigned apple_page_count;/* Apple raster page count */
};
@@ -418,7 +420,9 @@ cupsRasterOpenIO(
r->sync != CUPS_RASTER_SYNCv1 &&
r->sync != CUPS_RASTER_REVSYNCv1 &&
r->sync != CUPS_RASTER_SYNCv2 &&
- r->sync != CUPS_RASTER_REVSYNCv2)
+ r->sync != CUPS_RASTER_REVSYNCv2 &&
+ r->sync != CUPS_RASTER_SYNCapple &&
+ r->sync != CUPS_RASTER_REVSYNCapple)
{
_cupsRasterAddError("Unknown raster format %08x!\n", r->sync);
free(r);
@@ -426,14 +430,33 @@ cupsRasterOpenIO(
}
if (r->sync == CUPS_RASTER_SYNCv2 ||
- r->sync == CUPS_RASTER_REVSYNCv2)
+ r->sync == CUPS_RASTER_REVSYNCv2 ||
+ r->sync == CUPS_RASTER_SYNCapple ||
+ r->sync == CUPS_RASTER_REVSYNCapple)
r->compressed = 1;
if (r->sync == CUPS_RASTER_REVSYNC ||
r->sync == CUPS_RASTER_REVSYNCv1 ||
- r->sync == CUPS_RASTER_REVSYNCv2)
+ r->sync == CUPS_RASTER_REVSYNCv2 ||
+ r->sync == CUPS_RASTER_REVSYNCapple)
r->swapped = 1;
+ if (r->sync == CUPS_RASTER_SYNCapple ||
+ r->sync == CUPS_RASTER_REVSYNCapple)
+ {
+ unsigned char header[8]; /* File header */
+
+ if (cups_raster_io(r, (unsigned char *)header, sizeof(header)) !=
+ sizeof(header))
+ {
+ _cupsRasterAddError("Unable to read header from raster stream: %s\n",
+ strerror(errno));
+ free(r);
+ return (NULL);
+ }
+
+ }
+
DEBUG_printf(("1cupsRasterOpenIO: r->swapped=%d, r->sync=%08x\n", r->swapped, r->sync));
}
else
@@ -459,6 +482,13 @@ cupsRasterOpenIO(
r->sync = htonl(CUPS_RASTER_SYNC_PWG);
r->swapped = r->sync != CUPS_RASTER_SYNC_PWG;
break;
+
+ case CUPS_RASTER_WRITE_APPLE :
+ r->compressed = 1;
+ r->sync = htonl(CUPS_RASTER_SYNCapple);
+ r->swapped = r->sync != CUPS_RASTER_SYNCapple;
+ r->apple_page_count = 0xffffffffU;
+ break;
}
if (cups_raster_io(r, (unsigned char *)&(r->sync), sizeof(r->sync)) < (ssize_t)sizeof(r->sync))
@@ -662,7 +692,31 @@ cupsRasterReadPixels(cups_raster_t *r, /* I - Raster stream */
return (0);
}
- if (byte & 128)
+ if (byte == 128)
+ {
+ /*
+ * Clear to end of line...
+ */
+
+ switch (r->header.cupsColorSpace)
+ {
+ case CUPS_CSPACE_W :
+ case CUPS_CSPACE_RGB :
+ case CUPS_CSPACE_SW :
+ case CUPS_CSPACE_SRGB :
+ case CUPS_CSPACE_RGBW :
+ case CUPS_CSPACE_ADOBERGB :
+ memset(temp, 0xff, (size_t)bytes);
+ break;
+ default :
+ memset(temp, 0x00, (size_t)bytes);
+ break;
+ }
+
+ temp += bytes;
+ bytes = 0;
+ }
+ else if (byte & 128)
{
/*
* Copy N literal pixels...
@@ -891,6 +945,60 @@ cupsRasterWriteHeader(
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 */
+
+ 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)(r->header.cupsHeight >> 24);
+ appleheader[17] = (unsigned char)(r->header.cupsHeight >> 16);
+ appleheader[18] = (unsigned char)(r->header.cupsHeight >> 8);
+ appleheader[19] = (unsigned char)(r->header.cupsHeight);
+ 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));
@@ -901,7 +1009,7 @@ cupsRasterWriteHeader(
* 'cupsRasterWriteHeader2()' - Write a raster page header from a version 2
* page header structure.
*
- * The page header can be initialized using @link cupsRasterInterpretPPD@.
+ * The page header can be initialized using @link cupsRasterInitPWGHeader@.
*
* @since CUPS 1.2/macOS 10.5@
*/
@@ -924,6 +1032,16 @@ cupsRasterWriteHeader2(
if (!cups_raster_update(r))
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...
*/
@@ -985,6 +1103,62 @@ cupsRasterWriteHeader2(
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));
@@ -1116,7 +1290,7 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */
* Increase the repeat count...
*/
- r->count ++;
+ r->count += r->rowheight;
r->pcurrent = r->pixels;
/*
@@ -1132,7 +1306,7 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */
else
return (len);
}
- else if (r->count == 256)
+ else if (r->count > (256 - r->rowheight))
{
if (cups_raster_write(r, r->pixels) <= 0)
return (0);
@@ -1161,7 +1335,7 @@ cupsRasterWritePixels(cups_raster_t *r, /* I - Raster stream */
* Increase the repeat count...
*/
- r->count ++;
+ r->count += r->rowheight;
r->pcurrent = r->pixels;
/*
@@ -1201,53 +1375,118 @@ cups_raster_read_header(
DEBUG_printf(("4cups_raster_read_header: r->iocount=" CUPS_LLFMT, CUPS_LLCAST r->iocount));
+ memset(&(r->header), 0, sizeof(r->header));
+
/*
- * Get the length of the raster header...
+ * Read the 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);
+ switch (r->sync)
+ {
+ default :
+ /*
+ * Get the length of the raster header...
+ */
- DEBUG_printf(("4cups_raster_read_header: len=%d", (int)len));
+ if (r->sync == CUPS_RASTER_SYNCv1 || r->sync == CUPS_RASTER_REVSYNCv1)
+ len = sizeof(cups_page_header_t);
+ else
+ len = sizeof(cups_page_header2_t);
- /*
- * Read the header...
- */
+ DEBUG_printf(("4cups_raster_read_header: len=%d", (int)len));
- memset(&(r->header), 0, sizeof(r->header));
+ /*
+ * 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);
- }
+ 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...
- */
+ /*
+ * Swap bytes as needed...
+ */
- if (r->swapped)
- {
- unsigned *s, /* Current word */
- temp; /* Temporary copy */
+ if (r->swapped)
+ {
+ unsigned *s, /* Current word */
+ temp; /* Temporary copy */
- DEBUG_puts("4cups_raster_read_header: Swapping header bytes.");
+ 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);
+ 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));
- }
+ 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;
}
/*
diff --git a/filter/rasterbench.c b/filter/rasterbench.c
index 010fd9dd..8746f31e 100644
--- a/filter/rasterbench.c
+++ b/filter/rasterbench.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/rastertoepson.c b/filter/rastertoepson.c
index 74dc61c5..4efe6692 100644
--- a/filter/rastertoepson.c
+++ b/filter/rastertoepson.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/rastertohp.c b/filter/rastertohp.c
index 2994b803..eb11c8c1 100644
--- a/filter/rastertohp.c
+++ b/filter/rastertohp.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
diff --git a/filter/rastertolabel.c b/filter/rastertolabel.c
index a082831a..4e491811 100644
--- a/filter/rastertolabel.c
+++ b/filter/rastertolabel.c
@@ -1,14 +1,14 @@
/*
* Label printer filter for CUPS.
*
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -438,7 +438,7 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
*/
void
-EndPage(ppd_file_t *ppd, /* I - PPD file */
+EndPage(ppd_file_t *ppd, /* I - PPD file */
cups_page_header2_t *header) /* I - Page header */
{
int val; /* Option value */
@@ -496,6 +496,19 @@ EndPage(ppd_file_t *ppd, /* I - PPD file */
puts("^XA");
/*
+ * Rotate 180 degrees so that the top of the label/page is at the
+ * leading edge...
+ */
+
+ puts("^POI");
+
+ /*
+ * Set print width...
+ */
+
+ printf("^PW%u\n", header->cupsWidth);
+
+ /*
* Set print rate...
*/
@@ -605,8 +618,8 @@ EndPage(ppd_file_t *ppd, /* I - PPD file */
* End the label and eject...
*/
- puts("^IDR:CUPS.GRF^FS");
puts("^XZ");
+ puts("^IDR:CUPS.GRF^FS");
/*
* Cut the label as needed...
diff --git a/filter/rastertopwg.c b/filter/rastertopwg.c
index f478ac58..5413df04 100644
--- a/filter/rastertopwg.c
+++ b/filter/rastertopwg.c
@@ -1,13 +1,13 @@
/*
* CUPS raster to PWG raster format filter for CUPS.
*
- * Copyright 2011, 2014-2016 Apple Inc.
+ * Copyright 2011, 2014-2017 Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright law.
* Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -31,6 +31,8 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
+ const char *final_content_type;
+ /* FINAL_CONTENT_TYPE env var */
int fd; /* Raster file */
cups_raster_t *inras, /* Input raster stream */
*outras; /* Output raster stream */
@@ -48,7 +50,7 @@ main(int argc, /* I - Number of command-line args */
lineoffset; /* Offset into line */
unsigned char white; /* White pixel */
ppd_file_t *ppd; /* PPD file */
- ppd_attr_t *back; /* cupsBackSize attribute */
+ ppd_attr_t *back; /* cupsBackSide attribute */
_ppd_cache_t *cache; /* PPD cache */
pwg_size_t *pwg_size; /* PWG media size */
pwg_media_t *pwg_media; /* PWG media name */
@@ -73,8 +75,11 @@ main(int argc, /* I - Number of command-line args */
else
fd = 0;
+ if ((final_content_type = getenv("FINAL_CONTENT_TYPE")) == NULL)
+ final_content_type = "image/pwg-raster";
+
inras = cupsRasterOpen(fd, CUPS_RASTER_READ);
- outras = cupsRasterOpen(1, CUPS_RASTER_WRITE_PWG);
+ outras = cupsRasterOpen(1, !strcmp(final_content_type, "image/pwg-raster") ? CUPS_RASTER_WRITE_PWG : CUPS_RASTER_WRITE_APPLE);
ppd = ppdOpenFile(getenv("PPD"));
back = ppdFindAttr(ppd, "cupsBackSide", NULL);
@@ -430,6 +435,9 @@ main(int argc, /* I - Number of command-line args */
if (linesize < inheader.cupsBytesPerLine)
linesize = inheader.cupsBytesPerLine;
+ if ((lineoffset + inheader.cupsBytesPerLine) > linesize)
+ lineoffset = linesize - inheader.cupsBytesPerLine;
+
line = malloc(linesize);
memset(line, white, linesize);
diff --git a/filter/testraster.c b/filter/testraster.c
index 9c3f7650..d5d63de2 100644
--- a/filter/testraster.c
+++ b/filter/testraster.c
@@ -8,7 +8,7 @@
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -208,6 +208,7 @@ main(int argc, /* I - Number of command-line args */
errors += do_raster_tests(CUPS_RASTER_WRITE);
errors += do_raster_tests(CUPS_RASTER_WRITE_COMPRESSED);
errors += do_raster_tests(CUPS_RASTER_WRITE_PWG);
+ errors += do_raster_tests(CUPS_RASTER_WRITE_APPLE);
}
else
{
@@ -526,8 +527,9 @@ do_raster_tests(cups_mode_t mode) /* O - Write mode */
printf("cupsRasterOpen(%s): ",
mode == CUPS_RASTER_WRITE ? "CUPS_RASTER_WRITE" :
- mode == CUPS_RASTER_WRITE ? "CUPS_RASTER_WRITE_COMPRESSED" :
- "CUPS_RASTER_WRITE_PWG");
+ mode == CUPS_RASTER_WRITE_COMPRESSED ? "CUPS_RASTER_WRITE_COMPRESSED" :
+ mode == CUPS_RASTER_WRITE_PWG ? "CUPS_RASTER_WRITE_PWG" :
+ "CUPS_RASTER_WRITE_APPLE");
fflush(stdout);
if ((fp = fopen("test.raster", "wb")) == NULL)
@@ -551,18 +553,24 @@ do_raster_tests(cups_mode_t mode) /* O - Write mode */
header.cupsWidth = 256;
header.cupsHeight = 256;
header.cupsBytesPerLine = 256;
+ header.HWResolution[0] = 64;
+ header.HWResolution[1] = 64;
+ header.PageSize[0] = 288;
+ header.PageSize[1] = 288;
+ header.cupsPageSize[0] = 288.0f;
+ header.cupsPageSize[1] = 288.0f;
if (page & 1)
{
- header.cupsBytesPerLine *= 2;
+ header.cupsBytesPerLine *= 4;
header.cupsColorSpace = CUPS_CSPACE_CMYK;
header.cupsColorOrder = CUPS_ORDER_CHUNKED;
header.cupsNumColors = 4;
}
else
{
- header.cupsColorSpace = CUPS_CSPACE_K;
- header.cupsColorOrder = CUPS_ORDER_BANDED;
+ header.cupsColorSpace = CUPS_CSPACE_W;
+ header.cupsColorOrder = CUPS_ORDER_CHUNKED;
header.cupsNumColors = 1;
}
@@ -677,8 +685,18 @@ do_raster_tests(cups_mode_t mode) /* O - Write mode */
expected.cupsWidth = 256;
expected.cupsHeight = 256;
expected.cupsBytesPerLine = 256;
+ expected.HWResolution[0] = 64;
+ expected.HWResolution[1] = 64;
+ expected.PageSize[0] = 288;
+ expected.PageSize[1] = 288;
- if (mode == CUPS_RASTER_WRITE_PWG)
+ if (mode != CUPS_RASTER_WRITE_PWG)
+ {
+ expected.cupsPageSize[0] = 288.0f;
+ expected.cupsPageSize[1] = 288.0f;
+ }
+
+ if (mode >= CUPS_RASTER_WRITE_PWG)
{
strlcpy(expected.MediaClass, "PwgRaster", sizeof(expected.MediaClass));
expected.cupsInteger[7] = 0xffffff;
@@ -686,15 +704,15 @@ do_raster_tests(cups_mode_t mode) /* O - Write mode */
if (page & 1)
{
- expected.cupsBytesPerLine *= 2;
+ expected.cupsBytesPerLine *= 4;
expected.cupsColorSpace = CUPS_CSPACE_CMYK;
expected.cupsColorOrder = CUPS_ORDER_CHUNKED;
expected.cupsNumColors = 4;
}
else
{
- expected.cupsColorSpace = CUPS_CSPACE_K;
- expected.cupsColorOrder = CUPS_ORDER_BANDED;
+ expected.cupsColorSpace = CUPS_CSPACE_W;
+ expected.cupsColorOrder = CUPS_ORDER_CHUNKED;
expected.cupsNumColors = 1;
}
diff --git a/libcups_version b/libcups_version
new file mode 100644
index 00000000..0b1f88b8
--- /dev/null
+++ b/libcups_version
@@ -0,0 +1 @@
+v2.2.3
diff --git a/update_libcups.sh b/update_libcups.sh
index 8afbdce7..34592d6b 100755
--- a/update_libcups.sh
+++ b/update_libcups.sh
@@ -14,7 +14,7 @@ echo
echo "== get current rev =="
cd $TARGET_DIR
-CURRENT_REV=$(git tag -l | grep -v "release" | grep -v "b" | grep -v "rc" | sort | tail -n1)
+CURRENT_REV=$(cat libcups_version)
echo "Current rev is $CURRENT_REV"
echo
@@ -56,16 +56,15 @@ else
sed -i -e "s/^\(#.*CUPS_SVERSION\).*/\1 \"CUPS $NEW_REV\"/g" config.h
sed -i -e "s:^\(#.*CUPS_MINIMAL\).*:\1 \"CUPS/${NEW_REV#v}\":g" config.h
- git add -A
- git commit -m "Update libcups to $NEW_REV"
-
- git tag $NEW_REV
-
echo
echo ">>> Updated license"
cp LICENSE.txt NOTICE
+ echo $NEW_REV > libcups_version
+ git add -A
+ git commit -m "Update libcups to $NEW_REV"
+
echo
echo ">>> Updated libcups from $CURRENT_REV to $NEW_REV"
fi