]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The cupsfilter program did not set the FINAL_CONTENT_TYPE environment variable
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 3 Apr 2013 16:16:46 +0000 (16:16 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 3 Apr 2013 16:16:46 +0000 (16:16 +0000)
for filters.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10937 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
scheduler/cupsfilter.c

index fe7c686ef16ac35d21afab6fe93904a11f7c23d6..5d1b8c38f8e8e5de605fca8dab0c6e21fa50377e 100644 (file)
@@ -1,8 +1,10 @@
-CHANGES.txt - 1.7b1 - 2013-03-11
+CHANGES.txt - 1.7b1 - 2013-04-03
 --------------------------------
 
 CHANGES IN CUPS V1.7b1
 
+       - The cupsfilter program did not set the FINAL_CONTENT_TYPE
+         environment variable for filters.
        - Added a new "-x" option to the cancel command (STR #4103)
        - Made the PWG media handling APIs public (STR #4267)
        - Implemented ready media support for the cupsGetDestMediaXxx APIs
index 7851967b1d441b3c359a4811ddc17203d43dc6ca..177766e5344a36a4fe15f8d64c0bf41626609aa2 100644 (file)
@@ -917,7 +917,7 @@ exec_filters(mime_type_t   *srctype,        /* I - Source type */
 {
   int          i;                      /* Looping var */
   const char   *argv[8],               /* Command-line arguments */
-               *envp[16],              /* Environment variables */
+               *envp[17],              /* Environment variables */
                *temp;                  /* Temporary string */
   char         *optstr,                /* Filter options */
                content_type[1024],     /* CONTENT_TYPE */
@@ -925,6 +925,8 @@ exec_filters(mime_type_t   *srctype,        /* I - Source type */
                cups_fontpath[1024],    /* CUPS_FONTPATH */
                cups_serverbin[1024],   /* CUPS_SERVERBIN */
                cups_serverroot[1024],  /* CUPS_SERVERROOT */
+               final_content_type[1024] = "",
+                                       /* FINAL_CONTENT_TYPE */
                lang[1024],             /* LANG */
                path[1024],             /* PATH */
                ppd[1024],              /* PPD */
@@ -947,6 +949,39 @@ exec_filters(mime_type_t   *srctype,       /* I - Source type */
   cups_dest_t  *dest;                  /* Destination information */
 
 
+ /*
+  * Figure out the final content type...
+  */
+
+  for (filter = (mime_filter_t *)cupsArrayLast(filters);
+       filter && filter->dst;
+       filter = (mime_filter_t *)cupsArrayPrev(filters))
+    if (strcmp(filter->dst->super, "printer"))
+      break;
+
+  if (filter && filter->dst)
+  {
+    const char *ptr;                   /* Pointer in type name */
+
+    if ((ptr = strchr(filter->dst->type, '/')) != NULL)
+      snprintf(final_content_type, sizeof(final_content_type),
+              "FINAL_CONTENT_TYPE=%s", ptr + 1);
+    else
+      snprintf(final_content_type, sizeof(final_content_type),
+              "FINAL_CONTENT_TYPE=%s/%s", filter->dst->super,
+              filter->dst->type);
+  }
+
+ /*
+  * Remove NULL ("-") filters...
+  */
+
+  for (filter = (mime_filter_t *)cupsArrayFirst(filters);
+       filter;
+       filter = (mime_filter_t *)cupsArrayNext(filters))
+    if (!strcmp(filter->filter, "-"))
+      cupsArrayRemove(filters, filter);
+
  /*
   * Setup the filter environment and command-line...
   */
@@ -1041,7 +1076,13 @@ exec_filters(mime_type_t   *srctype,     /* I - Source type */
   envp[12] = rip_max_cache;
   envp[13] = userenv;
   envp[14] = "CHARSET=utf-8";
-  envp[15] = NULL;
+  if (final_content_type[0])
+  {
+    envp[15] = final_content_type;
+    envp[16] = NULL;
+  }
+  else
+    envp[15] = NULL;
 
   for (i = 0; argv[i]; i ++)
     fprintf(stderr, "DEBUG: argv[%d]=\"%s\"\n", i, argv[i]);