From b3867f7af0044ec980ae6b5f402b3f6d378aa93e Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 18 Oct 2019 14:17:51 -0400 Subject: [PATCH] misc: When there is more than once copy count source, use the largest. --- backend_hiti.c | 6 +++++- backend_kodak605.c | 2 +- backend_kodak6800.c | 4 ++-- backend_mitsu9550.c | 9 +++++---- backend_mitsup95d.c | 5 +++-- backend_shinkos1245.c | 5 +++-- backend_shinkos2145.c | 5 +++-- backend_shinkos6145.c | 5 +++-- backend_shinkos6245.c | 5 +++-- 9 files changed, 28 insertions(+), 18 deletions(-) diff --git a/backend_hiti.c b/backend_hiti.c index 8c259e0..f7ffd49 100644 --- a/backend_hiti.c +++ b/backend_hiti.c @@ -1253,6 +1253,10 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie return CUPS_BACKEND_CANCEL; } + /* Use whicever copy count is larger */ + if (job->copies < (int)job->hdr.copies) + job->copies = job->hdr.copies; + // XXX check hdr.model // XXX check hdr.format @@ -2040,7 +2044,7 @@ static const char *hiti_prefixes[] = { struct dyesub_backend hiti_backend = { .name = "HiTi Photo Printers", - .version = "0.10", + .version = "0.11", .uri_prefixes = hiti_prefixes, .cmdline_usage = hiti_cmdline, .cmdline_arg = hiti_cmdline_arg, diff --git a/backend_kodak605.c b/backend_kodak605.c index 25b1590..0fb9e4e 100644 --- a/backend_kodak605.c +++ b/backend_kodak605.c @@ -424,7 +424,7 @@ static int kodak605_read_parse(void *vctx, const void **vjob, int data_fd, int c return ret; } - /* Printer handles generating copies.. */ + /* Printer handles generating copies. Use larger of our options */ if (le16_to_cpu(job->jp.copies) < (uint16_t)copies) job->jp.copies = cpu_to_le16(copies); diff --git a/backend_kodak6800.c b/backend_kodak6800.c index 8895891..dbc4835 100644 --- a/backend_kodak6800.c +++ b/backend_kodak6800.c @@ -857,7 +857,7 @@ static int kodak6800_read_parse(void *vctx, const void **vjob, int data_fd, int hdr.copies = be16_to_cpu(hdr.copies); hdr.copies = packed_bcd_to_uint32((char*)&hdr.copies, 2); - if (hdr.copies > 1) + if (hdr.copies > copies) copies = hdr.copies; /* Fill out job structure */ @@ -1039,7 +1039,7 @@ static const char *kodak6800_prefixes[] = { /* Exported */ struct dyesub_backend kodak6800_backend = { .name = "Kodak 6800/6850", - .version = "0.77" " (lib " LIBSINFONIA_VER ")", + .version = "0.78" " (lib " LIBSINFONIA_VER ")", .uri_prefixes = kodak6800_prefixes, .cmdline_usage = kodak6800_cmdline, .cmdline_arg = kodak6800_cmdline_arg, diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c index 7f652d1..97b6926 100644 --- a/backend_mitsu9550.c +++ b/backend_mitsu9550.c @@ -852,7 +852,8 @@ hdr_done: /* Update printjob header to reflect number of requested copies */ if (job->hdr2_present) { copies = 1; - job->hdr2.copies = cpu_to_be16(copies); + if (be16_to_cpu(job->hdr2.copies) < copies) + job->hdr2.copies = cpu_to_be16(copies); } job->copies = copies; @@ -1133,7 +1134,7 @@ static int mitsu9550_main_loop(void *vctx, const void *vjob) { int ret; #if 0 - int copies; + int copies = 1; #endif // const struct mitsu9550_printjob *job = vjob; @@ -1149,7 +1150,7 @@ static int mitsu9550_main_loop(void *vctx, const void *vjob) { #if 0 /* If hdr2 is not present, we have to generate copies ourselves! */ - if (job->hdr2_present) + if (!job->hdr2_present) copies = job->copies; // XXX.. #endif @@ -1704,7 +1705,7 @@ static const char *mitsu9550_prefixes[] = { /* Exported */ struct dyesub_backend mitsu9550_backend = { .name = "Mitsubishi CP9xxx family", - .version = "0.48", + .version = "0.49", .uri_prefixes = mitsu9550_prefixes, .cmdline_usage = mitsu9550_cmdline, .cmdline_arg = mitsu9550_cmdline_arg, diff --git a/backend_mitsup95d.c b/backend_mitsup95d.c index e0586b3..5ac38bf 100644 --- a/backend_mitsup95d.c +++ b/backend_mitsup95d.c @@ -328,7 +328,8 @@ top: /* Update printjob header to reflect number of requested copies */ if (job->hdr2[13] != 0xff) - job->hdr2[13] = copies; + if (copies > job->hdr2[13]) + job->hdr2[13] = copies; *vjob = job; return CUPS_BACKEND_OK; @@ -591,7 +592,7 @@ static const char *mitsup95d_prefixes[] = { /* Exported */ struct dyesub_backend mitsup95d_backend = { .name = "Mitsubishi P93D/P95D", - .version = "0.12", + .version = "0.13", .uri_prefixes = mitsup95d_prefixes, .cmdline_arg = mitsup95d_cmdline_arg, .cmdline_usage = mitsup95d_cmdline, diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c index 5103549..136cba0 100644 --- a/backend_shinkos1245.c +++ b/backend_shinkos1245.c @@ -1003,7 +1003,8 @@ static int shinkos1245_read_parse(void *vctx, const void **vjob, int data_fd, in return ret; } - if (job->jp.copies > 1) + /* Use larger of our copy counts */ + if (job->jp.copies > copies) job->copies = job->jp.copies; else job->copies = copies; @@ -1262,7 +1263,7 @@ static const char *shinkos1245_prefixes[] = { struct dyesub_backend shinkos1245_backend = { .name = "Shinko/Sinfonia CHC-S1245/E1", - .version = "0.31" " (lib " LIBSINFONIA_VER ")", + .version = "0.32" " (lib " LIBSINFONIA_VER ")", .uri_prefixes = shinkos1245_prefixes, .cmdline_usage = shinkos1245_cmdline, .cmdline_arg = shinkos1245_cmdline_arg, diff --git a/backend_shinkos2145.c b/backend_shinkos2145.c index 3839b91..a6b215d 100644 --- a/backend_shinkos2145.c +++ b/backend_shinkos2145.c @@ -916,7 +916,8 @@ static int shinkos2145_read_parse(void *vctx, const void **vjob, int data_fd, in return ret; } - if (job->jp.copies > 1) + /* Use whicever copy count is larger */ + if (job->jp.copies > copies) job->copies = job->jp.copies; else job->copies = copies; @@ -1170,7 +1171,7 @@ static const char *shinkos2145_prefixes[] = { struct dyesub_backend shinkos2145_backend = { .name = "Shinko/Sinfonia CHC-S2145/S2", - .version = "0.63" " (lib " LIBSINFONIA_VER ")", + .version = "0.64" " (lib " LIBSINFONIA_VER ")", .uri_prefixes = shinkos2145_prefixes, .cmdline_usage = shinkos2145_cmdline, .cmdline_arg = shinkos2145_cmdline_arg, diff --git a/backend_shinkos6145.c b/backend_shinkos6145.c index 0e59a6a..adb38b7 100644 --- a/backend_shinkos6145.c +++ b/backend_shinkos6145.c @@ -1197,7 +1197,8 @@ static int shinkos6145_read_parse(void *vctx, const void **vjob, int data_fd, in return ret; } - if (job->jp.copies > 1) + /* Use whicever copy count is larger */ + if (job->jp.copies > copies) job->copies = job->jp.copies; else job->copies = copies; @@ -1560,7 +1561,7 @@ static const char *shinkos6145_prefixes[] = { struct dyesub_backend shinkos6145_backend = { .name = "Shinko/Sinfonia CHC-S6145/CS2/S2245/S3", - .version = "0.44" " (lib " LIBSINFONIA_VER ")", + .version = "0.45" " (lib " LIBSINFONIA_VER ")", .uri_prefixes = shinkos6145_prefixes, .cmdline_usage = shinkos6145_cmdline, .cmdline_arg = shinkos6145_cmdline_arg, diff --git a/backend_shinkos6245.c b/backend_shinkos6245.c index f8f86de..2e351b2 100644 --- a/backend_shinkos6245.c +++ b/backend_shinkos6245.c @@ -1045,7 +1045,8 @@ static int shinkos6245_read_parse(void *vctx, const void **vjob, int data_fd, in return ret; } - if (job->jp.copies > 1) + /* Use whicever copy count is larger */ + if ((int)job->jp.copies > copies) job->copies = job->jp.copies; else job->copies = copies; @@ -1433,7 +1434,7 @@ static const char *shinkos6245_prefixes[] = { struct dyesub_backend shinkos6245_backend = { .name = "Sinfonia CHC-S6245 / Kodak 8810", - .version = "0.30" " (lib " LIBSINFONIA_VER ")", + .version = "0.31" " (lib " LIBSINFONIA_VER ")", .uri_prefixes = shinkos6245_prefixes, .cmdline_usage = shinkos6245_cmdline, .cmdline_arg = shinkos6245_cmdline_arg,