all: Add some print quantity range checks where we can.

Most backends don't verify against remaining media though.
This commit is contained in:
Solomon Peachy 2015-08-20 23:22:35 -04:00
parent 175f6a52d8
commit cc87cd1cc3
8 changed files with 19 additions and 2 deletions

View File

@ -445,7 +445,8 @@ top:
free(resp);
resp = NULL;
/* Set print quantity */
/* Set print quantity */ // XXX check against remaining print count
cw01_build_cmd(&cmd, "CNTRL", "QTY", 8);
snprintf(buf, sizeof(buf), "%07d\r", copies);
ret = cw01_do_cmd(ctx, &cmd, (uint8_t*) buf, 8);

View File

@ -795,6 +795,8 @@ static int dnpds40_main_loop(void *vctx, int copies) {
return CUPS_BACKEND_FAILED;
/* Update quantity offset with count */
// XXX this breaks if ctx->manual_copies is set, but the job
// has a CNTRL QTY != 1
if (!ctx->manual_copies && copies > 1) {
snprintf(buf, sizeof(buf), "%07d\r", copies);
if (ctx->qty_offset) {

View File

@ -299,6 +299,8 @@ static int kodak605_main_loop(void *vctx, int copies) {
return CUPS_BACKEND_FAILED;
/* Printer handles generating copies.. */
if (copies > 255)
copies = 255;
if (ctx->hdr.copies < copies)
ctx->hdr.copies = copies;

View File

@ -757,6 +757,8 @@ static int kodak6800_main_loop(void *vctx, int copies) {
return CUPS_BACKEND_FAILED;
/* Printer handles generating copies.. */
if (copies > 255) // XXX test against remaining media?
copies = 255;
if (ctx->hdr.copies < copies)
ctx->hdr.copies = copies;

View File

@ -1436,6 +1436,10 @@ static int shinkos1245_main_loop(void *vctx, int copies) {
return CUPS_BACKEND_HOLD;
}
/* Fix max print count. */
if (copies > 9999) // XXX test against remaining media
copies = 9999;
top:
if (state != last_state) {
if (dyesub_debug)

View File

@ -1573,6 +1573,8 @@ static int shinkos2145_main_loop(void *vctx, int copies) {
return CUPS_BACKEND_HOLD;
}
// XXX check copies against remaining media!
top:
if (state != last_state) {
if (dyesub_debug)

View File

@ -1762,6 +1762,8 @@ static int shinkos6145_main_loop(void *vctx, int copies) {
return CUPS_BACKEND_HOLD;
}
// XXX check copies against remaining media!
top:
if (state != last_state) {
if (dyesub_debug)

View File

@ -1679,6 +1679,8 @@ static int shinkos6245_main_loop(void *vctx, int copies) {
goto printer_error;
}
// XXX check copies against remaining media!
top:
if (state != last_state) {
if (dyesub_debug)