]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Send media-col for media-source and media-type, even if the size isn't specified
authorMichael Sweet <michael.r.sweet@gmail.com>
Thu, 9 Mar 2017 19:31:35 +0000 (14:31 -0500)
committerMichael Sweet <michael.r.sweet@gmail.com>
Thu, 9 Mar 2017 19:31:35 +0000 (14:31 -0500)
(Issue #4963)

CHANGES.txt
cups/ppd-cache.c

index 999dcf269f5c0ac32b8c1dfbb3db2308b0500369..e0edab68dac052b69cae09a3c71d3b62b2afbf87 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES.txt - 2.2.3 - 2017-03-08
+CHANGES.txt - 2.2.3 - 2017-03-09
 --------------------------------
 
 CHANGES IN CUPS V2.2.3
@@ -9,6 +9,8 @@ CHANGES IN CUPS V2.2.3
          save state changes to disk (<rdar://problem/28690656>)
        - Added support for PPD finishing keywords (Issue #4960, Issue #4961,
          Issue #4962)
+       - The IPP backend did not send a media-col attribute for just the source
+         or type (Issue #4963)
        - Fixed some localization issues on macOS (<rdar://problem/27245567>)
 
 
index 163e18c9377cb5ca16862f2706479594ccddce0c..fa0b04cd541fc11512f842acb552c954884d0cf2 100644 (file)
@@ -199,41 +199,42 @@ _cupsConvertOptions(ipp_t           *request,     /* I - IPP request */
   if ((keyword = cupsGetOption("PageSize", num_options, options)) == NULL)
     keyword = cupsGetOption("media", num_options, options);
 
-  if ((size = _ppdCacheGetSize(pc, keyword)) != NULL)
+  media_source = _ppdCacheGetSource(pc, cupsGetOption("InputSlot", num_options, options));
+  media_type   = _ppdCacheGetType(pc, cupsGetOption("MediaType", num_options, options));
+  size         = _ppdCacheGetSize(pc, keyword);
+
+  if (size || media_source || media_type)
   {
    /*
     * Add a media-col value...
     */
 
-    media_size = ippNew();
-    ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER,
-                 "x-dimension", size->width);
-    ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER,
-                 "y-dimension", size->length);
-
     media_col = ippNew();
-    ippAddCollection(media_col, IPP_TAG_ZERO, "media-size", media_size);
 
-    media_source = _ppdCacheGetSource(pc, cupsGetOption("InputSlot",
-                                                       num_options,
-                                                       options));
-    media_type   = _ppdCacheGetType(pc, cupsGetOption("MediaType",
-                                                     num_options,
-                                                     options));
+    if (size)
+    {
+      media_size = ippNew();
+      ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER,
+                    "x-dimension", size->width);
+      ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER,
+                    "y-dimension", size->length);
+
+      ippAddCollection(media_col, IPP_TAG_ZERO, "media-size", media_size);
+    }
 
     for (i = 0; i < media_col_sup->num_values; i ++)
     {
-      if (!strcmp(media_col_sup->values[i].string.text, "media-left-margin"))
+      if (size && !strcmp(media_col_sup->values[i].string.text, "media-left-margin"))
        ippAddInteger(media_col, IPP_TAG_ZERO, IPP_TAG_INTEGER, "media-left-margin", size->left);
-      else if (!strcmp(media_col_sup->values[i].string.text, "media-bottom-margin"))
+      else if (size && !strcmp(media_col_sup->values[i].string.text, "media-bottom-margin"))
        ippAddInteger(media_col, IPP_TAG_ZERO, IPP_TAG_INTEGER, "media-bottom-margin", size->bottom);
-      else if (!strcmp(media_col_sup->values[i].string.text, "media-right-margin"))
+      else if (size && !strcmp(media_col_sup->values[i].string.text, "media-right-margin"))
        ippAddInteger(media_col, IPP_TAG_ZERO, IPP_TAG_INTEGER, "media-right-margin", size->right);
-      else if (!strcmp(media_col_sup->values[i].string.text, "media-top-margin"))
+      else if (size && !strcmp(media_col_sup->values[i].string.text, "media-top-margin"))
        ippAddInteger(media_col, IPP_TAG_ZERO, IPP_TAG_INTEGER, "media-top-margin", size->top);
-      else if (!strcmp(media_col_sup->values[i].string.text, "media-source") && media_source)
+      else if (media_source && !strcmp(media_col_sup->values[i].string.text, "media-source"))
        ippAddString(media_col, IPP_TAG_ZERO, IPP_TAG_KEYWORD, "media-source", NULL, media_source);
-      else if (!strcmp(media_col_sup->values[i].string.text, "media-type") && media_type)
+      else if (media_type && !strcmp(media_col_sup->values[i].string.text, "media-type"))
        ippAddString(media_col, IPP_TAG_ZERO, IPP_TAG_KEYWORD, "media-type", NULL, media_type);
     }