]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Let cfFilterUniversal() not se unnecessary parameters
authorTill Kamppeter <till.kamppeter@gmail.com>
Sat, 3 Sep 2022 18:00:30 +0000 (20:00 +0200)
committerTill Kamppeter <till.kamppeter@gmail.com>
Sat, 3 Sep 2022 18:00:30 +0000 (20:00 +0200)
With the new fields content_type and final_content_type in the filter
data structure the output format does not need to get supplied as
parameter any more for most filter functions. So let
cfFilterUniversal() not supply any parameters any more to filter
functions which do not use them any more.

cupsfilters/universal.c

index df62375e9371d6ba680665e4c883d1256eb6aad0..5f2b42bfc85a52371c26829e9af9a4b4fe20cfeb 100644 (file)
@@ -82,23 +82,9 @@ cfFilterUniversal(int inputfd,         /* I - File descriptor input stream */
        !strcasecmp(output_type, "pwg-raster") ||
        !strcasecmp(output_type, "PCLm"))
     {
-      outformat = malloc(sizeof(cf_filter_out_format_t));
-      *outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
-      if (!strcasecmp(output_type, "pwg-raster") ||
-         (!strcasecmp(output_type, "vnd.cups-raster") &&
-          !strcasecmp(final_output, "image/pwg-raster")))
-       *outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
-      else if (!strcasecmp(output_type, "urf") ||
-              (!strcasecmp(output_type, "vnd.cups-raster") &&
-               !strcasecmp(final_output, "image/urf")))
-       *outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
-      else if (!strcasecmp(output_type, "PCLm") ||
-              (!strcasecmp(output_type, "vnd.cups-raster") &&
-               !strcasecmp(final_output, "applicationn/PCLm")))
-       *outformat = CF_FILTER_OUT_FORMAT_PCLM;
       filter = malloc(sizeof(cf_filter_filter_in_chain_t));
       filter->function = cfFilterImageToRaster;
-      filter->parameters = outformat;
+      filter->parameters = NULL;
       filter->name = "imagetoraster";
       cupsArrayAdd(filter_chain, filter);
       if (log) log(ld, CF_LOGLEVEL_DEBUG,
@@ -108,10 +94,8 @@ cfFilterUniversal(int inputfd,         /* I - File descriptor input stream */
          !strcasecmp(output, "application/PCLm"))
       {
        filter = malloc(sizeof(cf_filter_filter_in_chain_t));
-       outformat = malloc(sizeof(cf_filter_out_format_t));
-       *outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
        filter->function = cfFilterRasterToPWG;
-       filter->parameters = outformat;
+       filter->parameters = NULL;
        filter->name = "rastertopwg";
        cupsArrayAdd(filter_chain, filter);
        if (log) log(ld, CF_LOGLEVEL_DEBUG,
@@ -133,10 +117,8 @@ cfFilterUniversal(int inputfd,         /* I - File descriptor input stream */
       else if (!strcasecmp(output, "image/urf"))
       {
        filter = malloc(sizeof(cf_filter_filter_in_chain_t));
-       outformat = malloc(sizeof(cf_filter_out_format_t));
-       *outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
        filter->function = cfFilterRasterToPWG;
-       filter->parameters = outformat;
+       filter->parameters = NULL;
        filter->name = "rastertopwg";
        cupsArrayAdd(filter_chain, filter);
        if (log) log(ld, CF_LOGLEVEL_DEBUG,
@@ -253,7 +235,7 @@ cfFilterUniversal(int inputfd,         /* I - File descriptor input stream */
       {
        filter = malloc(sizeof(cf_filter_filter_in_chain_t));
        filter->function = cfFilterPDFToPDF;
-       filter->parameters = strdup(output);
+       filter->parameters = NULL;
        filter->name = "pdftopdf";
        cupsArrayAdd(filter_chain, filter);
        if (log) log(ld, CF_LOGLEVEL_DEBUG,