]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Allow media-size values to match within +/-1mm (Issue #487)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 17 Jan 2023 20:44:01 +0000 (15:44 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 17 Jan 2023 20:44:01 +0000 (15:44 -0500)
CHANGES.md
tools/ippeveprinter.c

index 6cbf7230e04041388419f15c083a5ce634ecfc44..b0aa9e260f25868a9eefe947b4ba33e77b9959ec 100644 (file)
@@ -18,6 +18,7 @@ Changes in CUPS v2.4.3 (TBA)
 - Fixed invalid memory access during generating IPP Everywhere queue
   (Issue #466)
 - Fixed memory leaks in `create_local_bg_thread()` (Issue #466)
+- Fixed media size tolerance in `ippeveprinter` (Issue #487)
 - Fixed `cupsd` default keychain location when building with OpenSSL
   (Issue #529)
 - Fixed TLS certificate generation bugs.
index a03da8968177b891eebb9f91ee252306451af369..9fb410585037bb369693ac04918b6f17658eb648 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IPP Everywhere printer application for CUPS.
  *
- * Copyright © 2021-2022 by OpenPrinting.
+ * Copyright © 2021-2023 by OpenPrinting.
  * Copyright © 2020 by the IEEE-ISTO Printer Working Group.
  * Copyright © 2010-2021 by Apple Inc.
  *
@@ -8778,11 +8778,34 @@ valid_job_attributes(
 
          for (i = 0; i < count ; i ++)
          {
+           int x_min, x_max;           // Min/max width
+           int y_min, y_max;           // Min/max length
+
            size  = ippGetCollection(supported, i);
            x_dim = ippFindAttribute(size, "x-dimension", IPP_TAG_ZERO);
            y_dim = ippFindAttribute(size, "y-dimension", IPP_TAG_ZERO);
 
-           if (ippContainsInteger(x_dim, x_value) && ippContainsInteger(y_dim, y_value))
+            if (ippGetValueTag(x_dim) == IPP_TAG_INTEGER)
+            {
+              x_min = ippGetInteger(x_dim, 0) - 100;
+              x_max = ippGetInteger(x_dim, 0) + 100;
+            }
+            else
+            {
+              x_min = ippGetRange(x_dim, 0, &x_max);
+            }
+
+            if (ippGetValueTag(y_dim) == IPP_TAG_INTEGER)
+            {
+              y_min = ippGetInteger(y_dim, 0) - 100;
+              y_max = ippGetInteger(y_dim, 0) + 100;
+            }
+            else
+            {
+              y_min = ippGetRange(y_dim, 0, &x_max);
+            }
+
+           if ((x_value < x_min || x_value > x_max) && (y_value < y_min || y_value > y_max))
              break;
          }