From 109981f3b1faa929654814f42df2e31b7c0cf8b1 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Mon, 9 Jan 2023 19:24:47 -0300 Subject: [PATCH] libcupsfilters: In generate_sizes() consider all margin alternatives generate_sizes() reads the available margin sizes from the media-{left,right,top,bottom}-margin-supported printer IPP attributes to use the minimum value as default for each margin. In the case that there is more than one margin value, the first value in the list did not get considered, often making borderless printing support (zero margin as first in the list) staying undiscovered. This commit fixes that and makes sure that always the minimum value is ysed. --- cupsfilters/ppdgenerator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cupsfilters/ppdgenerator.c b/cupsfilters/ppdgenerator.c index 23d519d1b..77defec08 100644 --- a/cupsfilters/ppdgenerator.c +++ b/cupsfilters/ppdgenerator.c @@ -1190,7 +1190,7 @@ cups_array_t* generate_sizes(ipp_t *response, IPP_TAG_INTEGER)) != NULL) { for (i = 1, *bottom = ippGetInteger(attr, 0), count = ippGetCount(attr); i < count; i ++) - if (i == 1 || ippGetInteger(attr, i) < *bottom) + if (ippGetInteger(attr, i) < *bottom) *bottom = ippGetInteger(attr, i); } else *bottom = 1270; @@ -1199,7 +1199,7 @@ cups_array_t* generate_sizes(ipp_t *response, IPP_TAG_INTEGER)) != NULL) { for (i = 1, *left = ippGetInteger(attr, 0), count = ippGetCount(attr); i < count; i ++) - if (i == 1 || ippGetInteger(attr, i) < *left) + if (ippGetInteger(attr, i) < *left) *left = ippGetInteger(attr, i); } else *left = 635; @@ -1208,7 +1208,7 @@ cups_array_t* generate_sizes(ipp_t *response, IPP_TAG_INTEGER)) != NULL) { for (i = 1, *right = ippGetInteger(attr, 0), count = ippGetCount(attr); i < count; i ++) - if (i == 1 || ippGetInteger(attr, i) < *right) + if (ippGetInteger(attr, i) < *right) *right = ippGetInteger(attr, i); } else *right = 635; @@ -1217,7 +1217,7 @@ cups_array_t* generate_sizes(ipp_t *response, IPP_TAG_INTEGER)) != NULL) { for (i = 1, *top = ippGetInteger(attr, 0), count = ippGetCount(attr); i < count; i ++) - if (i == 1 || ippGetInteger(attr, i) < *top) + if (ippGetInteger(attr, i) < *top) *top = ippGetInteger(attr, i); } else *top = 1270; -- 2.47.3