Index: filter/gziptoany.c =================================================================== --- filter/gziptoany.c (revision 6373) +++ filter/gziptoany.c (working copy) @@ -1,9 +1,9 @@ /* * "$Id$" * - * GZIP pre-filter for the Common UNIX Printing System (CUPS). + * GZIP/raw pre-filter for the Common UNIX Printing System (CUPS). * - * Copyright 1993-2005 by Easy Software Products. + * Copyright 1993-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -25,32 +25,28 @@ * * Contents: * - * main() - Uncompress gzip'd files and send them to stdout... + * main() - Copy (and uncompress) files to stdout. */ /* * Include necessary headers... */ +#include #include #include #include -#ifdef HAVE_LIBZ -# include -#endif /* HAVE_LIBZ */ - /* - * 'main()' - Uncompress gzip'd files and send them to stdout... + * 'main()' - Copy (and uncompress) files to stdout. */ int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { -#ifdef HAVE_LIBZ - gzFile fp; /* GZIP'd file */ + cups_file_t *fp; /* File */ char buffer[8192]; /* Data buffer */ int bytes; /* Number of bytes read/written */ int copies; /* Number of copies */ @@ -68,42 +64,43 @@ } /* - * Get the copy count; if the MIME type is "application/vnd.cups-raw" then - * make copies since the file is going straight to a backend... + * Get the copy count; if we have no final content type, this is a + * raw queue or raw print file, so we need to make copies... */ - if ((content_type = getenv("CONTENT_TYPE")) != NULL && - !strcasecmp(content_type, "application/vnd.cups-raw")) + if (!getenv("FINAL_CONTENT_TYPE")) copies = atoi(argv[4]); else copies = 1; /* - * Open the gzip file... + * Open the file... */ - if ((fp = gzopen(argv[6], "rb")) == NULL) + if ((fp = cupsFileOpen(argv[6], "r")) == NULL) { - fprintf(stderr, "ERROR: Unable to open GZIP file: %s\n", strerror(errno)); + fprintf(stderr, "ERROR: Unable to open file \"%s\": %s\n", argv[6], + strerror(errno)); return (1); } /* - * Copy the gzip file to stdout... + * Copy the file to stdout... */ setbuf(stdout, NULL); while (copies > 0) { - gzrewind(fp); + cupsFileRewind(fp); - while ((bytes = gzread(fp, buffer, sizeof(buffer))) > 0) + while ((bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0) if (fwrite(buffer, 1, bytes, stdout) < bytes) { - fprintf(stderr, "ERROR: Unable to write uncompressed document data: %s\n", + fprintf(stderr, + "ERROR: Unable to write uncompressed document data: %s\n", strerror(ferror(stdout))); - gzclose(fp); + cupsFileClose(fp); return (1); } @@ -115,14 +112,9 @@ * Close the file and return... */ - gzclose(fp); + cupsFileClose(fp); return (0); -#else - fputs("INFO: Hint: recompile CUPS with ZLIB.\n", stderr); - fputs("ERROR: GZIP compression support not compiled in!\n", stderr); - return (1); -#endif /* HAVE_LIBZ */ } Index: scheduler/job.c =================================================================== --- scheduler/job.c (revision 6373) +++ scheduler/job.c (working copy) @@ -1720,6 +1720,8 @@ cupsdCancelJob(job, 1, IPP_JOB_CANCELED); return; } +#else + (void)q; #endif /* __APPLE__ */ } } @@ -2527,20 +2529,6 @@ return; } - if (printer->raw && !strncmp(printer->device_uri, "file:", 5)) - { - cupsdLogMessage(CUPSD_LOG_ERROR, - "Job ID %d cannot be printed to raw queue pointing to " - "a file!", - job->id); - - strlcpy(printer->state_message, "Raw printers cannot use file: devices!", - sizeof(printer->state_message)); - cupsdStopPrinter(printer, 1); - cupsdAddPrinterHistory(printer); - return; - } - /* * Figure out what filters are required to convert from * the source to the destination type... @@ -2670,10 +2658,12 @@ FilterLevel += job->cost; /* - * Add decompression filters, if any... + * Add decompression/raw filter as needed... */ - if (!printer->raw && job->compressions[job->current_file]) + if ((!printer->raw && job->compressions[job->current_file]) || + (!filters && !printer->remote && + (job->num_files > 1 || !strncmp(printer->device_uri, "file:", 5)))) { /* * Add gziptoany filter to the front of the list... @@ -2737,9 +2727,11 @@ job->state->values[0].integer = IPP_JOB_PROCESSING; job->state_value = IPP_JOB_PROCESSING; + job->status = 0; job->printer = printer; printer->job = job; + cupsdSetPrinterState(printer, IPP_PRINTER_PROCESSING, 0); if (job->current_file == 0) @@ -3117,7 +3109,7 @@ envp[envc ++] = device_uri; envp[envc ++] = printer_name; - if (!printer->remote && + if (!printer->remote && !printer->raw && (filter = (mime_filter_t *)cupsArrayLast(filters)) != NULL) { snprintf(final_content_type, sizeof(final_content_type),