]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fixed an issue with mapping finishing options (rdar://34250727)
authorMichael R Sweet <michaelrsweet@gmail.com>
Wed, 17 Jan 2018 19:58:25 +0000 (14:58 -0500)
committerMichael R Sweet <michaelrsweet@gmail.com>
Wed, 17 Jan 2018 19:58:25 +0000 (14:58 -0500)
cups/ppd-cache:
- Change _ppdCacheGetFinishingValues to take a ppd_file_t * so we can check
  marked choices.
- Update _cupsConvertOptions to send the ppd_file_t * to
  _ppdCacheGetFinishingValues.

cups/testcache.c:
- Update unit test.

CHANGES.md
cups/ppd-cache.c
cups/ppd-private.h
cups/testcache.c

index 0e5086647ad3dbbf0cebeeb2ab1a367b44567140..656a31dc09b6959cc0a6e9c94383c7484f9603f2 100644 (file)
@@ -19,6 +19,7 @@ Changes in CUPS v2.3b2
 - Added a USB quirk rule for Canon MP280 series printers (Issue #5221)
 - The `cupsRasterWritePixels` function did not correctly swap bytes for some
   formats (Issue #5225)
+- Fixed an issue with mapping finishing options (rdar://34250727)
 - The `ppdLocalizeIPPReason` function incorrectly returned a localized version
   of "none" (rdar://36566269)
 - The scheduler did not add ".local" to the default DNS-SD host name when
index 177db7b082a78b0173b0f2bbc01aa48d7180e420..c6708de276c45d9ff53965a8e5cbed763c6331e7 100644 (file)
@@ -385,7 +385,7 @@ _cupsConvertOptions(
   }
   else
   {
-    num_finishings = _ppdCacheGetFinishingValues(pc, num_options, options, (int)(sizeof(finishings) / sizeof(finishings[0])), finishings);
+    num_finishings = _ppdCacheGetFinishingValues(ppd, pc, (int)(sizeof(finishings) / sizeof(finishings[0])), finishings);
     if (num_finishings > 0)
     {
       ippAddIntegers(request, IPP_TAG_JOB, IPP_TAG_ENUM, "finishings", num_finishings, finishings);
@@ -2150,9 +2150,8 @@ _ppdCacheGetFinishingOptions(
 
 int                                    /* O - Number of finishings values */
 _ppdCacheGetFinishingValues(
+    ppd_file_t    *ppd,                        /* I - Marked PPD file */
     _ppd_cache_t  *pc,                 /* I - PPD cache and mapping data */
-    int           num_options,         /* I - Number of options */
-    cups_option_t *options,            /* I - Options */
     int           max_values,          /* I - Maximum number of finishings values */
     int           *values)             /* O - Finishings values */
 {
@@ -2160,16 +2159,16 @@ _ppdCacheGetFinishingValues(
                        num_values = 0; /* Number of values */
   _pwg_finishings_t    *f;             /* Current finishings option */
   cups_option_t                *option;        /* Current option */
-  const char           *val;           /* Value for option */
+  ppd_choice_t         *choice;        /* Marked PPD choice */
 
 
  /*
   * Range check input...
   */
 
-  DEBUG_printf(("_ppdCacheGetFinishingValues(pc=%p, num_options=%d, options=%p, max_values=%d, values=%p)", pc, num_options, options, max_values, values));
+  DEBUG_printf(("_ppdCacheGetFinishingValues(ppd=%p, pc=%p, max_values=%d, values=%p)", ppd, pc, max_values, values));
 
-  if (!pc || max_values < 1 || !values)
+  if (!ppd || !pc || max_values < 1 || !values)
   {
     DEBUG_puts("_ppdCacheGetFinishingValues: Bad arguments, returning 0.");
     return (0);
@@ -2194,8 +2193,7 @@ _ppdCacheGetFinishingValues(
     {
       DEBUG_printf(("_ppdCacheGetFinishingValues: %s=%s?", option->name, option->value));
 
-      if ((val = cupsGetOption(option->name, num_options, options)) == NULL ||
-          _cups_strcasecmp(option->value, val))
+      if ((choice = ppdFindMarkedChoice(ppd, option->name)) == NULL || _cups_strcasecmp(option->value, choice->choice))
       {
         DEBUG_puts("_ppdCacheGetFinishingValues: NO");
         break;
index 21e519ebd14c923f5c5d39d057d7247df9ffce83..2b2bd5d9af8ce1e7663ec872817f65f5b75f38e9 100644 (file)
@@ -167,11 +167,7 @@ extern int         _ppdCacheGetFinishingOptions(_ppd_cache_t *pc,
                                                     ipp_finishings_t value,
                                                     int num_options,
                                                     cups_option_t **options);
-extern int             _ppdCacheGetFinishingValues(_ppd_cache_t *pc,
-                                                   int num_options,
-                                                   cups_option_t *options,
-                                                   int max_values,
-                                                   int *values);
+extern int             _ppdCacheGetFinishingValues(ppd_file_t *ppd, _ppd_cache_t *pc, int max_values, int *values);
 extern const char      *_ppdCacheGetInputSlot(_ppd_cache_t *pc, ipp_t *job,
                                               const char *keyword);
 extern const char      *_ppdCacheGetMediaType(_ppd_cache_t *pc, ipp_t *job,
index a0fcb4a31217b2fad2a9aaee6b57299816c192ed..3638a3324578d4775a14fe9add0a97136c53a872 100644 (file)
@@ -64,7 +64,7 @@ main(int  argc,                               /* I - Number of command-line args */
   ppdMarkDefaults(ppd);
   cupsMarkOptions(ppd, num_options, options);
 
-  num_finishings = _ppdCacheGetFinishingValues(pc, num_options, options, (int)sizeof(finishings) / sizeof(finishings[0]), finishings);
+  num_finishings = _ppdCacheGetFinishingValues(ppd, pc, (int)sizeof(finishings) / sizeof(finishings[0]), finishings);
 
   if (num_finishings > 0)
   {