10 changes: 6 additions & 4 deletions cupsfilters/ipp.c
Expand Up @@ -666,12 +666,13 @@ ippAttrEnumValForPrinter(ipp_t *printer_attrs, /* I - Printer attributes, same
printer_attr_name[256];
int i;

if (job_attrs == NULL || attr_name == NULL)
if ((printer_attrs == NULL && job_attrs == NULL) || attr_name == NULL)
return NULL;

/* Check whether job got supplied the named attribute and read out its value
as string */
if ((attr = ippFindAttribute(job_attrs, attr_name, IPP_TAG_ZERO)) == NULL)
if (job_attrs == NULL ||
(attr = ippFindAttribute(job_attrs, attr_name, IPP_TAG_ZERO)) == NULL)
valuebuffer[0] = '\0';
else
ippAttributeString(attr, valuebuffer, sizeof(valuebuffer));
Expand Down Expand Up @@ -722,12 +723,13 @@ ippAttrIntValForPrinter(ipp_t *printer_attrs, /* I - Printer attributes, same
char printer_attr_name[256];
int retval, val, min, max;

if (job_attrs == NULL || attr_name == NULL)
if ((printer_attrs == NULL && job_attrs == NULL) || attr_name == NULL)
return 0;

/* Check whether job got supplied the named attribute and read out its value
as integer */
if ((attr = ippFindAttribute(job_attrs, attr_name, IPP_TAG_ZERO)) == NULL)
if (job_attrs == NULL ||
(attr = ippFindAttribute(job_attrs, attr_name, IPP_TAG_ZERO)) == NULL)
retval = 0;
else {
retval = 1;
Expand Down
2 changes: 1 addition & 1 deletion cupsfilters/ipp.h
Expand Up @@ -41,7 +41,7 @@ extern "C" {
#define MAX_OUTPUT_LEN 8192
#define MAX_URI_LEN 2048

char get_printer_attributes_log[LOGSIZE];
static char get_printer_attributes_log[LOGSIZE];

char *resolve_uri(const char *raw_uri);
char *ippfind_based_uri_converter(const char *uri ,int is_fax);
Expand Down
316 changes: 112 additions & 204 deletions cupsfilters/ppdgenerator.c

Large diffs are not rendered by default.

469 changes: 469 additions & 0 deletions cupsfilters/raster.c

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions cupsfilters/raster.h
Expand Up @@ -18,6 +18,7 @@ extern "C" {
* Include necessary headers...
*/

# include "filter.h"
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
Expand All @@ -37,6 +38,16 @@ extern "C" {
* Prototypes...
*/

extern int cupsRasterPrepareHeader(cups_page_header2_t *h,
filter_data_t *data,
filter_out_format_t
final_content_type,
cups_cspace_t *cspace);
extern int cupsRasterSetColorSpace(cups_page_header2_t *h,
const char *available,
const char *color_mode,
cups_cspace_t *cspace,
int *high_depth);
extern int cupsRasterParseIPPOptions(cups_page_header2_t *h,
int num_options,
cups_option_t *options,
Expand Down
8 changes: 6 additions & 2 deletions filter/gstoraster.c
Expand Up @@ -59,8 +59,12 @@ main(int argc, /* I - Number of command-line args */

filter_out_format_t outformat = OUTPUT_FORMAT_CUPS_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
if (t && strcasestr(t, "pwg"))
outformat = OUTPUT_FORMAT_PWG_RASTER;
if (t) {
if (strcasestr(t, "pwg"))
outformat = OUTPUT_FORMAT_PWG_RASTER;
else if (strcasestr(t, "urf"))
outformat = OUTPUT_FORMAT_APPLE_RASTER;
}

ret = filterCUPSWrapper(argc, argv, ghostscript, &outformat, &JobCanceled);

Expand Down