From 37e27ba5d801a30c45964316854ba92ee54a4146 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Sat, 8 Oct 2022 08:34:42 +0200 Subject: [PATCH] libcupsfilters: Moved IPP-attribute-related functions to ipp.c There were some non-Raster-related but IPP-attribute-related functions in raster.c. With this commit they are moved to ipp.c now. The functions are: - cfGetBackSideOrientation() - cfGetPrintRenderIntent() - cfJoinJobOptionsAndAttrs() --- cupsfilters/colord.c | 2 +- cupsfilters/colormanager.c | 2 +- cupsfilters/ghostscript.c | 1 + cupsfilters/ipp.c | 273 +++++++++++++++++++++++++++++++++++++ cupsfilters/ipp.h | 125 ++++++++++------- cupsfilters/mupdftopwg.c | 1 + cupsfilters/pwgtopdf.cxx | 2 +- cupsfilters/raster.c | 272 ------------------------------------ cupsfilters/raster.h | 22 +-- ppd/pdftops.c | 3 +- 10 files changed, 355 insertions(+), 348 deletions(-) diff --git a/cupsfilters/colord.c b/cupsfilters/colord.c index e58df8341..641a83157 100644 --- a/cupsfilters/colord.c +++ b/cupsfilters/colord.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #ifdef HAVE_DBUS #include #endif diff --git a/cupsfilters/colormanager.c b/cupsfilters/colormanager.c index 3d9f244dc..bce18f63f 100644 --- a/cupsfilters/colormanager.c +++ b/cupsfilters/colormanager.c @@ -28,7 +28,7 @@ #include "colormanager.h" #include #include -#include +#include #define CM_MAX_FILE_LENGTH 1024 diff --git a/cupsfilters/ghostscript.c b/cupsfilters/ghostscript.c index bd0209542..6ce9cccbb 100644 --- a/cupsfilters/ghostscript.c +++ b/cupsfilters/ghostscript.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/cupsfilters/ipp.c b/cupsfilters/ipp.c index 116eb0dbc..6956408b5 100644 --- a/cupsfilters/ipp.c +++ b/cupsfilters/ipp.c @@ -16,6 +16,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 // USA. // +// Contents: +// +// cfGetBackSideOrientation() - Return backside orientation for duplex +// printing +// cfGetPrintRenderIntent() - Return rendering intent for a job +// cfJoinJobOptionsAndAttrs() - Join job IPP attributes and job options in +// one option list +// // // Include necessary headers. @@ -990,6 +998,271 @@ cfIPPReverseOutput(ipp_t *printer_attrs, } +// +// 'cfGetBackSideOrientation()' - This functions returns the back +// side orientation using printer +// attributes. Meaning and reason for +// backside orientation: It only makes +// sense if printer supports duplex, +// so, if printer reports that it +// supports duplex printing via +// sides-supported IPP attribute, then +// it also reports back-side +// orientation for each PDL in PDL +// specific IPP attributes. Backside +// orientation is specially needed for +// raster PDLs as raster PDLs are +// specially made for raster printers +// which do not have sufficient memory +// to hold a full page bitmap(raster +// page). So they cannot build the +// whole page in memory before +// starting to print it. For one-sided +// printing it is easy to manage. The +// printer's mechanism pulls the page +// in on its upper edge and starts to +// print, from top to bottom, after +// that it ejects the page. For +// double-sided printing it does the +// same for the front side, but for +// the back side the mechanics of the +// printer has to turn over the sheet, +// and now, depending on how the sheet +// is turned over it happens that the +// edge arriving in the printing +// mechanism is the lower edge of the +// back side. And if the printer +// simply prints then, the back side +// is the wrong way around. The +// printer reports its need via back +// side orientation in such a case, so +// that the client knows to send the +// back side upside down for example. +// In vector PDLs, PDF and PostScript, +// always the full page's raster image +// is completely generated in the +// printer before the page is started, +// and therefore the printer can start +// to take the pixels from the lower +// edge of the raster image if needed, +// so back side orientation is always +// "normal" for these PDLs. And if a +// printer does not support duplex, +// back side orientation is not +// needed. +// + +int // O - Backside orientation (bit 0-2) + // Requires flipped margin? + // Yes: bit 4 set; No: bit 3 set +cfGetBackSideOrientation(cf_filter_data_t *data) // I - Filter data +{ + ipp_t *printer_attrs = data->printer_attrs; + int num_options = data->num_options; + cups_option_t *options = data->options; + char *final_content_type = data->final_content_type; + ipp_attribute_t *ipp_attr = NULL; // IPP attribute + int i, // Looping variable + count; + const char *keyword; + int backside = -1; // backside obtained using printer attributes + + + // also check options + if ((ipp_attr = ippFindAttribute(printer_attrs, "sides-supported", + IPP_TAG_ZERO)) != NULL) + { + if (ippContainsString(ipp_attr, "two-sided-long-edge")) + { + if (final_content_type && + strcasestr(final_content_type, "/urf") && + (ipp_attr = ippFindAttribute(printer_attrs, "urf-supported", + IPP_TAG_ZERO)) != NULL) + { + for (i = 0, count = ippGetCount(ipp_attr); i < count; i ++) + { + const char *dm = ippGetString(ipp_attr, i, NULL); // DM value + if (!strcasecmp(dm, "DM1")) + { + backside = CF_BACKSIDE_NORMAL; + break; + } + if (!strcasecmp(dm, "DM2")) + { + backside = CF_BACKSIDE_FLIPPED; + break; + } + if (!strcasecmp(dm, "DM3")) + { + backside = CF_BACKSIDE_ROTATED; + break; + } + if (!strcasecmp(dm, "DM4")) + { + backside = CF_BACKSIDE_MANUAL_TUMBLE; + break; + } + } + } + else if ((final_content_type && + strcasestr(final_content_type, "/vnd.pwg-raster") && + (ipp_attr = ippFindAttribute(printer_attrs, + "pwg-raster-document-sheet-back", + IPP_TAG_ZERO)) != NULL) || + (final_content_type && + strcasestr(final_content_type, "/pclm") && + (ipp_attr = ippFindAttribute(printer_attrs, + "pclm-raster-back-side", + IPP_TAG_ZERO)) != NULL) || + ((ipp_attr = NULL) || + (keyword = cupsGetOption("back-side-orientation", + num_options, options)) != NULL)) + { + if (ipp_attr) + keyword = ippGetString(ipp_attr, 0, NULL); + if (!strcasecmp(keyword, "flipped")) + backside = CF_BACKSIDE_FLIPPED; + else if (!strncasecmp(keyword, "manual", 6)) + backside = CF_BACKSIDE_MANUAL_TUMBLE; + else if (!strcasecmp(keyword, "normal")) + backside = CF_BACKSIDE_NORMAL; + else if (!strcasecmp(keyword, "rotated")) + backside = CF_BACKSIDE_ROTATED; + } + + if (backside == -1) + backside = CF_BACKSIDE_NORMAL; + else if ((keyword = cupsGetOption("duplex-requires-flipped-margin", + num_options, options)) != NULL) + { + if (strcasecmp(keyword, "true") == 0) + backside |= 16; + else + backside |= 8; + } + } + } + + return (backside); +} + + +const char * +cfGetPrintRenderIntent(cf_filter_data_t *data, + char *ri, + int ri_len) +{ + const char *val; + int num_options = 0; + cups_option_t *options = NULL; + ipp_t *printer_attrs = data->printer_attrs; + ipp_attribute_t *ipp_attr; + cf_logfunc_t log = data->logfunc; + void *ld = data->logdata; + int i; + + + num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options); + + if ((val = cupsGetOption("print-rendering-intent", num_options, + options)) != NULL || + (val = cupsGetOption("PrintRenderingIntent", num_options, + options)) != NULL || + (val = cupsGetOption("RenderingIntent", num_options, + options)) != NULL) + { + if (!strcasecmp(val, "absolute")) + snprintf(ri, ri_len, "%s", "Absolute"); + else if (!strcasecmp(val, "auto") || !strcasecmp(val, "automatic")) + snprintf(ri, ri_len, "%s", "Automatic"); + else if (!strcasecmp(val, "perceptual")) + snprintf(ri, ri_len, "%s", "Perceptual"); + else if (!strcasecmp(val, "relative")) + snprintf(ri, ri_len, "%s", "Relative"); + else if (!strcasecmp(val, "relative-bpc") || + !strcasecmp(val, "relativebpc")) + snprintf(ri, ri_len, "%s", "RelativeBpc"); + else if (!strcasecmp(val, "saturation")) + snprintf(ri, ri_len, "%s", "Saturation"); + } + + if ((ipp_attr = ippFindAttribute(printer_attrs, + "print-rendering-intent-supported", + IPP_TAG_ZERO)) != NULL) + { + int autoRender = 0; + int count; + + if ((count = ippGetCount(ipp_attr)) > 0) + { + for (i = 0; i < count; i ++) + { + const char *temp = ippGetString(ipp_attr, i, NULL); + if (!strcasecmp(temp, "auto")) autoRender = 1; + if (ri[0] != '\0') + // User has supplied a setting + if (!strcasecmp(ri, temp)) + break; + } + if (ri[0] != '\0' && i == count) + { + if (log) log(ld, CF_LOGLEVEL_DEBUG, + "User specified print-rendering-intent not supported " + "by printer, using default print rendering intent."); + ri[0] = '\0'; + } + if (ri[0] == '\0') + { // Either user has not supplied any setting + // or user supplied value is not supported by printer + if ((ipp_attr = ippFindAttribute(printer_attrs, + "print-rendering-intent-default", + IPP_TAG_ZERO)) != NULL) + snprintf(ri, ri_len, "%s", ippGetString(ipp_attr, 0, NULL)); + else if (autoRender == 1) + snprintf(ri, ri_len, "%s", "auto"); + } + } + } + + cupsFreeOptions(num_options, options); + return (ri); +} + + +// +// 'cfJoinJobOptionsAndAttrs()' - Function for storing job IPP attribute in +// option list, together with the options +// + +int // O - New number of options + // in new option list +cfJoinJobOptionsAndAttrs(cf_filter_data_t* data, // I - Filter data + int num_options, // I - Current mumber of + // options in new option + // list + cups_option_t **options) // IO - New option lsit +{ + ipp_t *job_attrs = data->job_attrs; // Job attributes + ipp_attribute_t *ipp_attr; // IPP attribute + int i = 0; // Looping variable + char buf[2048]; // Buffer for storing value of ipp attr + cups_option_t *opt; + + for (i = 0, opt = data->options; i < data->num_options; i ++, opt ++) + num_options = cupsAddOption(opt->name, opt->value, num_options, options); + + for (ipp_attr = ippFirstAttribute(job_attrs); ipp_attr; + ipp_attr = ippNextAttribute(job_attrs)) + { + ippAttributeString(ipp_attr, buf, sizeof(buf)); + num_options = cupsAddOption(ippGetName(ipp_attr), buf, + num_options, options); + } + + return (num_options); +} + + #ifndef HAVE_STRLCPY // // 'strlcpy()' - Safely copy two strings. diff --git a/cupsfilters/ipp.h b/cupsfilters/ipp.h index cd88ac976..a5f0abd19 100644 --- a/cupsfilters/ipp.h +++ b/cupsfilters/ipp.h @@ -30,6 +30,7 @@ extern "C" { #include +#include "filter.h" #include #include #include @@ -69,6 +70,16 @@ enum cf_driverless_support_modes_e // attribute }; +// Backside orientations for duplex printing +typedef enum cf_backside_orient_e +{ + CF_BACKSIDE_MANUAL_TUMBLE, + CF_BACKSIDE_ROTATED, + CF_BACKSIDE_FLIPPED, + CF_BACKSIDE_NORMAL +} cf_backside_orient_t; + + // Data structure for resolution (X x Y dpi) typedef struct cf_res_s { @@ -87,60 +98,70 @@ typedef enum cf_gen_sizes_mode_e // Prototypes... // -char *cfResolveURI(const char *raw_uri); -char *cfippfindBasedURIConverter(const char *uri ,int is_fax); -int cfCheckDriverlessSupport(const char* uri); -ipp_t *cfGetPrinterAttributes(const char* raw_uri, - const char* const pattrs[], - int pattrs_size, - const char* const req_attrs[], - int req_attrs_size, - int debug); -ipp_t *cfGetPrinterAttributes2(http_t *http_printer, - const char* raw_uri, - const char* const pattrs[], - int pattrs_size, - const char* const req_attrs[], - int req_attrs_size, - int debug); -ipp_t *cfGetPrinterAttributes3(http_t *http_printer, - const char* raw_uri, - const char* const pattrs[], - int pattrs_size, - const char* const req_attrs[], - int req_attrs_size, - int debug, - int* driverless_support); -ipp_t *cfGetPrinterAttributes4(const char* raw_uri, - const char* const pattrs[], - int pattrs_size, - const char* const req_attrs[], - int req_attrs_size, - int debug, - int isFax); -ipp_t *cfGetPrinterAttributes5(http_t *http_printer, - const char* raw_uri, - const char* const pattrs[], - int pattrs_size, - const char* const req_attrs[], - int req_attrs_size, - int debug, - int* driverless_support, - int resolve_uri_type); - -const char* cfIPPAttrEnumValForPrinter(ipp_t *printer_attrs, - ipp_t *job_attrs, - const char *attr_name); -int cfIPPAttrIntValForPrinter(ipp_t *printer_attrs, - ipp_t *job_attrs, - const char *attr_name, - int *value); -int cfIPPAttrResolutionForPrinter(ipp_t *printer_attrs, ipp_t *job_attrs, - const char *attr_name, int *xres, int *yres); -int cfIPPReverseOutput(ipp_t *printer_attrs, ipp_t *job_attrs); - +char *cfResolveURI(const char *raw_uri); +char *cfippfindBasedURIConverter(const char *uri ,int is_fax); +int cfCheckDriverlessSupport(const char* uri); +ipp_t *cfGetPrinterAttributes(const char* raw_uri, + const char* const pattrs[], + int pattrs_size, + const char* const req_attrs[], + int req_attrs_size, + int debug); +ipp_t *cfGetPrinterAttributes2(http_t *http_printer, + const char* raw_uri, + const char* const pattrs[], + int pattrs_size, + const char* const req_attrs[], + int req_attrs_size, + int debug); +ipp_t *cfGetPrinterAttributes3(http_t *http_printer, + const char* raw_uri, + const char* const pattrs[], + int pattrs_size, + const char* const req_attrs[], + int req_attrs_size, + int debug, + int* driverless_support); +ipp_t *cfGetPrinterAttributes4(const char* raw_uri, + const char* const pattrs[], + int pattrs_size, + const char* const req_attrs[], + int req_attrs_size, + int debug, + int isFax); +ipp_t *cfGetPrinterAttributes5(http_t *http_printer, + const char* raw_uri, + const char* const pattrs[], + int pattrs_size, + const char* const req_attrs[], + int req_attrs_size, + int debug, + int* driverless_support, + int resolve_uri_type); + +const char *cfIPPAttrEnumValForPrinter(ipp_t *printer_attrs, + ipp_t *job_attrs, + const char *attr_name); +int cfIPPAttrIntValForPrinter(ipp_t *printer_attrs, + ipp_t *job_attrs, + const char *attr_name, + int *value); +int cfIPPAttrResolutionForPrinter(ipp_t *printer_attrs, + ipp_t *job_attrs, + const char *attr_name, + int *xres, int *yres); +int cfIPPReverseOutput(ipp_t *printer_attrs, ipp_t *job_attrs); +int cfGetBackSideOrientation(cf_filter_data_t *data); +const char *cfGetPrintRenderIntent(cf_filter_data_t *data, + char *ri, int ri_len); + +int cfJoinJobOptionsAndAttrs(cf_filter_data_t *data, + int num_options, + cups_option_t **options); + char *cfStrFormatd(char *buf, char *bufend, double number, struct lconv *loc); + int cfCompareResolutions(void *resolution_a, void *resolution_b, void *user_data); void *cfCopyResolution(void *resolution, void *user_data); diff --git a/cupsfilters/mupdftopwg.c b/cupsfilters/mupdftopwg.c index b4e14a70e..10369d386 100644 --- a/cupsfilters/mupdftopwg.c +++ b/cupsfilters/mupdftopwg.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/cupsfilters/pwgtopdf.cxx b/cupsfilters/pwgtopdf.cxx index 9b8d92269..5d81ceb93 100644 --- a/cupsfilters/pwgtopdf.cxx +++ b/cupsfilters/pwgtopdf.cxx @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include // ntohl diff --git a/cupsfilters/raster.c b/cupsfilters/raster.c index bd54ff27e..8e5fed4c0 100644 --- a/cupsfilters/raster.c +++ b/cupsfilters/raster.c @@ -6,17 +6,10 @@ // Distribution and use rights are outlined in the file "COPYING" // which should have been included with this file. // -// Contents: -// // cfRasterColorSpaceString() - Return strings for CUPS color spaces -// cfGetBackSideOrientation() - Return backside orientation for duplex -// printing -// cfGetPrintRenderIntent() - Return rendering intent for a job // cfRasterPrepareHeader() - Prepare a Raster header for a job // cfRasterSetColorSpace() - Find best color space for print-color-mode // and print-quality setting -// cfJoinJobOptionsAndAttrs() - Join job IPP attributes and job options in -// one option list // // @@ -156,237 +149,6 @@ cfRasterColorSpaceString(cups_cspace_t cspace) // I - cupsColorSpace value } -// -// 'cfGetBackSideOrientation()' - This functions returns the back -// side orientation using printer -// attributes. Meaning and reason for -// backside orientation: It only makes -// sense if printer supports duplex, -// so, if printer reports that it -// supports duplex printing via -// sides-supported IPP attribute, then -// it also reports back-side -// orientation for each PDL in PDL -// specific IPP attributes. Backside -// orientation is specially needed for -// raster PDLs as raster PDLs are -// specially made for raster printers -// which do not have sufficient memory -// to hold a full page bitmap(raster -// page). So they cannot build the -// whole page in memory before -// starting to print it. For one sided -// printing it is easy to manage. The -// printer's mechanism pulls the page -// in on its upper edge and starts to -// print, from top to bottom, after -// that it ejects the page. For -// double-sided printing it does the -// same for the front side, but for -// the back side the mechanics of the -// printer has to turn over the sheet, -// and now, depending on how the sheet -// is turned over it happens that the -// edge arriving in the printing -// mechanism is the lower edge of the -// back side. And if the printer -// simply prints then, the back side -// is the wrong way around. The -// printer reports its need via back -// side orientation in such a case, so -// that the client knows to send the -// back side upside down for example. -// In vector PDL, PDF and PostScript, -// always the full page's raster image -// is completely generated in the -// printer before the page is started, -// and therefore the printer can start -// to take the pixels from the lower -// edge of the raster image if needed, -// so back side orientation is always -// "normal" for these PDLs. And if a -// printer does not support duplex, -// back side orientation is not -// needed. -// - -int // O - Backside orientation (bit 0-2) - // Requires flipped margin? - // Yes: bit 4 set; No: bit 3 set -cfGetBackSideOrientation(cf_filter_data_t *data) // I - Filter data -{ - ipp_t *printer_attrs = data->printer_attrs; - int num_options = data->num_options; - cups_option_t *options = data->options; - char *final_content_type = data->final_content_type; - ipp_attribute_t *ipp_attr = NULL; // IPP attribute - int i, // Looping variable - count; - const char *keyword; - int backside = -1; // backside obtained using printer attributes - - - // also check options - if ((ipp_attr = ippFindAttribute(printer_attrs, "sides-supported", - IPP_TAG_ZERO)) != NULL) - { - if (ippContainsString(ipp_attr, "two-sided-long-edge")) - { - if (final_content_type && - strcasestr(final_content_type, "/urf") && - (ipp_attr = ippFindAttribute(printer_attrs, "urf-supported", - IPP_TAG_ZERO)) != NULL) - { - for (i = 0, count = ippGetCount(ipp_attr); i < count; i ++) - { - const char *dm = ippGetString(ipp_attr, i, NULL); // DM value - if (!strcasecmp(dm, "DM1")) - { - backside = CF_BACKSIDE_NORMAL; - break; - } - if (!strcasecmp(dm, "DM2")) - { - backside = CF_BACKSIDE_FLIPPED; - break; - } - if (!strcasecmp(dm, "DM3")) - { - backside = CF_BACKSIDE_ROTATED; - break; - } - if (!strcasecmp(dm, "DM4")) - { - backside = CF_BACKSIDE_MANUAL_TUMBLE; - break; - } - } - } - else if ((final_content_type && - strcasestr(final_content_type, "/vnd.pwg-raster") && - (ipp_attr = ippFindAttribute(printer_attrs, - "pwg-raster-document-sheet-back", - IPP_TAG_ZERO)) != NULL) || - (final_content_type && - strcasestr(final_content_type, "/pclm") && - (ipp_attr = ippFindAttribute(printer_attrs, - "pclm-raster-back-side", - IPP_TAG_ZERO)) != NULL) || - ((ipp_attr = NULL) || - (keyword = cupsGetOption("back-side-orientation", - num_options, options)) != NULL)) - { - if (ipp_attr) - keyword = ippGetString(ipp_attr, 0, NULL); - if (!strcasecmp(keyword, "flipped")) - backside = CF_BACKSIDE_FLIPPED; - else if (!strncasecmp(keyword, "manual", 6)) - backside = CF_BACKSIDE_MANUAL_TUMBLE; - else if (!strcasecmp(keyword, "normal")) - backside = CF_BACKSIDE_NORMAL; - else if (!strcasecmp(keyword, "rotated")) - backside = CF_BACKSIDE_ROTATED; - } - - if (backside == -1) - backside = CF_BACKSIDE_NORMAL; - else if ((keyword = cupsGetOption("duplex-requires-flipped-margin", - num_options, options)) != NULL) - { - if (strcasecmp(keyword, "true") == 0) - backside |= 16; - else - backside |= 8; - } - } - } - - return (backside); -} - - -const char * -cfGetPrintRenderIntent(cf_filter_data_t *data, - char *ri, - int ri_len) -{ - const char *val; - int num_options = 0; - cups_option_t *options = NULL; - ipp_t *printer_attrs = data->printer_attrs; - ipp_attribute_t *ipp_attr; - cf_logfunc_t log = data->logfunc; - void *ld = data->logdata; - int i; - - - num_options = cfJoinJobOptionsAndAttrs(data, num_options, &options); - - if ((val = cupsGetOption("print-rendering-intent", num_options, - options)) != NULL || - (val = cupsGetOption("PrintRenderingIntent", num_options, - options)) != NULL || - (val = cupsGetOption("RenderingIntent", num_options, - options)) != NULL) - { - if (!strcasecmp(val, "absolute")) - snprintf(ri, ri_len, "%s", "Absolute"); - else if (!strcasecmp(val, "auto") || !strcasecmp(val, "automatic")) - snprintf(ri, ri_len, "%s", "Automatic"); - else if (!strcasecmp(val, "perceptual")) - snprintf(ri, ri_len, "%s", "Perceptual"); - else if (!strcasecmp(val, "relative")) - snprintf(ri, ri_len, "%s", "Relative"); - else if (!strcasecmp(val, "relative-bpc") || - !strcasecmp(val, "relativebpc")) - snprintf(ri, ri_len, "%s", "RelativeBpc"); - else if (!strcasecmp(val, "saturation")) - snprintf(ri, ri_len, "%s", "Saturation"); - } - - if ((ipp_attr = ippFindAttribute(printer_attrs, - "print-rendering-intent-supported", - IPP_TAG_ZERO)) != NULL) - { - int autoRender = 0; - int count; - - if ((count = ippGetCount(ipp_attr)) > 0) - { - for (i = 0; i < count; i ++) - { - const char *temp = ippGetString(ipp_attr, i, NULL); - if (!strcasecmp(temp, "auto")) autoRender = 1; - if (ri[0] != '\0') - // User has supplied a setting - if (!strcasecmp(ri, temp)) - break; - } - if (ri[0] != '\0' && i == count) - { - if (log) log(ld, CF_LOGLEVEL_DEBUG, - "User specified print-rendering-intent not supported " - "by printer, using default print rendering intent."); - ri[0] = '\0'; - } - if (ri[0] == '\0') - { // Either user has not supplied any setting - // or user supplied value is not supported by printer - if ((ipp_attr = ippFindAttribute(printer_attrs, - "print-rendering-intent-default", - IPP_TAG_ZERO)) != NULL) - snprintf(ri, ri_len, "%s", ippGetString(ipp_attr, 0, NULL)); - else if (autoRender == 1) - snprintf(ri, ri_len, "%s", "auto"); - } - } - } - - cupsFreeOptions(num_options, options); - return (ri); -} - - // // 'cfRasterPrepareHeader() - This function creates a CUPS/PWG Raster // header for Raster output based on the @@ -2075,37 +1837,3 @@ raster_base_header(cups_page_header2_t *h, // O - Raster header return (0); } - - -// -// 'cfJoinJobOptionsAndAttrs()' - Function for storing job IPP attribute in -// option list, together with the options -// - -int // O - New number of options - // in new option list -cfJoinJobOptionsAndAttrs(cf_filter_data_t* data, // I - Filter data - int num_options, // I - Current mumber of - // options in new option - // list - cups_option_t **options) // IO - New option lsit -{ - ipp_t *job_attrs = data->job_attrs; // Job attributes - ipp_attribute_t *ipp_attr; // IPP attribute - int i = 0; // Looping variable - char buf[2048]; // Buffer for storing value of ipp attr - cups_option_t *opt; - - for (i = 0, opt = data->options; i < data->num_options; i ++, opt ++) - num_options = cupsAddOption(opt->name, opt->value, num_options, options); - - for (ipp_attr = ippFirstAttribute(job_attrs); ipp_attr; - ipp_attr = ippNextAttribute(job_attrs)) - { - ippAttributeString(ipp_attr, buf, sizeof(buf)); - num_options = cupsAddOption(ippGetName(ipp_attr), buf, - num_options, options); - } - - return (num_options); -} diff --git a/cupsfilters/raster.h b/cupsfilters/raster.h index 78717b3eb..80b4eb4ee 100644 --- a/cupsfilters/raster.h +++ b/cupsfilters/raster.h @@ -14,6 +14,7 @@ extern "C" { # endif // __cplusplus + // // Include necessary headers... // @@ -35,24 +36,11 @@ extern "C" { # include -// -// Types -// - -typedef enum cf_backside_orient_e -{ - CF_BACKSIDE_MANUAL_TUMBLE, - CF_BACKSIDE_ROTATED, - CF_BACKSIDE_FLIPPED, - CF_BACKSIDE_NORMAL -} cf_backside_orient_t; - - // // Prototypes... // -extern const char * cfRasterColorSpaceString(cups_cspace_t cspace); +extern const char *cfRasterColorSpaceString(cups_cspace_t cspace); extern int cfRasterPrepareHeader(cups_page_header2_t *h, cf_filter_data_t *data, cf_filter_out_format_t @@ -66,12 +54,6 @@ extern int cfRasterSetColorSpace(cups_page_header2_t *h, const char *color_mode, cups_cspace_t *cspace, int *high_depth); -extern int cfJoinJobOptionsAndAttrs(cf_filter_data_t *data, - int num_options, - cups_option_t **options); -extern int cfGetBackSideOrientation(cf_filter_data_t *data); -extern const char *cfGetPrintRenderIntent(cf_filter_data_t *data, - char *ri, int ri_len); # ifdef __cplusplus } diff --git a/ppd/pdftops.c b/ppd/pdftops.c index e7e9321da..08f67bf6f 100644 --- a/ppd/pdftops.c +++ b/ppd/pdftops.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include "ppd.h" @@ -286,7 +287,7 @@ ppdFilterPDFToPS(int inputfd, /* I - File descriptor input stream */ mres, res, maxres = CUPS_PDFTOPS_MAX_RESOLUTION, /* Maximum image rendering resolution */ - numvalues; /* Number of values actually read */ + numvalues = 0; /* Number of values actually read */ ppd_choice_t *choice; ppd_attr_t *attr; cups_page_header2_t header; -- 2.47.3