From: Michael R Sweet Date: Tue, 17 Jan 2023 20:44:01 +0000 (-0500) Subject: Allow media-size values to match within +/-1mm (Issue #487) X-Git-Tag: v2.4.3~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2fb1f4a2f213fa591911d2bf02920377ae07e84;p=thirdparty%2Fcups.git Allow media-size values to match within +/-1mm (Issue #487) --- diff --git a/CHANGES.md b/CHANGES.md index 6cbf7230e0..b0aa9e260f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. diff --git a/tools/ippeveprinter.c b/tools/ippeveprinter.c index a03da89681..9fb4105850 100644 --- a/tools/ippeveprinter.c +++ b/tools/ippeveprinter.c @@ -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; }