all: MEDIA_CODE argument is in _hex_ not decimal, so use strtol instead of atoi

This commit is contained in:
Solomon Peachy 2024-01-20 17:59:48 -05:00
parent 008e16ec0a
commit b6f7513d52
13 changed files with 23 additions and 23 deletions

View File

@ -1,7 +1,7 @@
/*
* Canon SELPHY CPneo series CUPS backend
*
* (c) 2016-2022 Solomon Peachy <pizza@shaftnet.org>
* (c) 2016-2024 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@ -229,7 +229,7 @@ static int selphyneo_attach(void *vctx, struct dyesub_connection *conn, uint8_t
rdback.data[2] = 0;
rdback.data[6] = 0x01;
if (getenv("MEDIA_CODE"))
rdback.data[6] = atoi(getenv("MEDIA_CODE"));
rdback.data[6] = strtol(getenv("MEDIA_CODE"), NULL, 16);
}
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";

View File

@ -1752,7 +1752,7 @@ static int dnpds40_attach(void *vctx, struct dyesub_connection *conn, uint8_t jo
}
if (getenv("MEDIA_CODE"))
ctx->media = atoi(getenv("MEDIA_CODE"));
ctx->media = strtol(getenv("MEDIA_CODE"), NULL, 16);
}
ctx->last_matte = -1;

View File

@ -1,7 +1,7 @@
/*
* HiTi Photo Printer CUPS backend
*
* (c) 2019-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2019-2024 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@ -1416,7 +1416,7 @@ static int hiti_attach(void *vctx, struct dyesub_connection *conn, uint8_t jobid
ctx->ribbonvendor = 0x1005; /* CHC, type 2 */
if (getenv("MEDIA_CODE") && strlen(getenv("MEDIA_CODE"))) {
// set fake fw version?
ctx->ribbon.type = atoi(getenv("MEDIA_CODE"));
ctx->ribbon.type = strtol(getenv("MEDIA_CODE"), NULL, 16);
if (ctx->ribbon.type == RIBBON_TYPE_5x7)
ctx->paper.type = PAPER_TYPE_5INCH;
}

View File

@ -1,7 +1,7 @@
/*
* Kodak 605 Photo Printer CUPS backend
*
* (c) 2013-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2013-2024 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@ -437,7 +437,7 @@ static int kodak605_attach(void *vctx, struct dyesub_connection *conn, uint8_t j
} else {
int media_code = KODAK6_MEDIA_6TR2;
if (getenv("MEDIA_CODE"))
media_code = atoi(getenv("MEDIA_CODE"));
media_code = strtol(getenv("MEDIA_CODE"), NULL, 16);
ctx->media->type = media_code;
}

View File

@ -1,7 +1,7 @@
/*
* Kodak 6800/6850 Photo Printer CUPS backend
*
* (c) 2013-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2013-2024 Solomon Peachy <pizza@shaftnet.org>
*
* Development of this backend was sponsored by:
*
@ -711,7 +711,7 @@ static int kodak6800_attach(void *vctx, struct dyesub_connection *conn, uint8_t
} else {
int media_code = KODAK6_MEDIA_6TR2;
if (getenv("MEDIA_CODE"))
media_code = atoi(getenv("MEDIA_CODE"));
media_code = strtol(getenv("MEDIA_CODE"), NULL, 16);
ctx->media_type = media_code;
ctx->supports_sub4x6 = 1;

View File

@ -1,7 +1,7 @@
/*
* Mitsubishi CP-D70/D707 Photo Printer CUPS backend
*
* (c) 2013-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2013-2024 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@ -619,7 +619,7 @@ static int mitsu70x_attach(void *vctx, struct dyesub_connection *conn, uint8_t j
} else {
int media_code = 0xf;
if (getenv("MEDIA_CODE"))
media_code = atoi(getenv("MEDIA_CODE")) & 0xf;
media_code = strtol(getenv("MEDIA_CODE"), NULL, 16) & 0xf;
resp.upper.mecha_status[0] = MECHA_STATUS_INIT;
resp.lower.mecha_status[0] = MECHA_STATUS_INIT;

View File

@ -1,7 +1,7 @@
/*
* Mitsubishi CP-9xxx Photo Printer Family CUPS backend
*
* (c) 2014-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2014-2024 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@ -401,7 +401,7 @@ static int mitsu9550_attach(void *vctx, struct dyesub_connection *conn, uint8_t
} else {
int media_code = 0x2;
if (getenv("MEDIA_CODE"))
media_code = atoi(getenv("MEDIA_CODE")) & 0xf;
media_code = strtol(getenv("MEDIA_CODE"), NULL, 16) & 0xf;
media.max = cpu_to_be16(400);
media.remain = cpu_to_be16(330);

View File

@ -1,7 +1,7 @@
/*
* Shinko/Sinfonia CHC-S1245 CUPS backend
*
* (c) 2015-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2015-2024 Solomon Peachy <pizza@shaftnet.org>
*
* Low-level documentation was provided by Sinfonia, Inc. Thank you!
*
@ -959,7 +959,7 @@ static int shinkos1245_attach(void *vctx, struct dyesub_connection *conn, uint8_
} else {
int media_code = 1;
if (getenv("MEDIA_CODE"))
media_code = atoi(getenv("MEDIA_CODE"));
media_code = strtol(getenv("MEDIA_CODE"), NULL, 16);
ctx->media_8x12 = media_code;
ctx->num_medias = 0;

View File

@ -1,7 +1,7 @@
/*
* Shinko/Sinfonia CHC-S2145 CUPS backend
*
* (c) 2013-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2013-2024 Solomon Peachy <pizza@shaftnet.org>
*
* Development of this backend was sponsored by:
*
@ -875,7 +875,7 @@ static int shinkos2145_attach(void *vctx, struct dyesub_connection *conn, uint8_
} else {
int media_code = CODE_6x9;
if (getenv("MEDIA_CODE"))
media_code = atoi(getenv("MEDIA_CODE"));
media_code = strtol(getenv("MEDIA_CODE"), NULL, 16);
media_prints = 680;
ctx->media_code = media_code;

View File

@ -1273,7 +1273,7 @@ static int shinkos6145_attach(void *vctx, struct dyesub_connection *conn, uint8_
} else {
int media_code = RIBBON_6x8;
if (getenv("MEDIA_CODE"))
media_code = atoi(getenv("MEDIA_CODE"));
media_code = strtol(getenv("MEDIA_CODE"), NULL, 16);
ctx->media.ribbon_code = media_code;
}

View File

@ -936,7 +936,7 @@ static int shinkos6245_attach(void *vctx, struct dyesub_connection *conn, uint8_
} else {
int media_code = RIBBON_8x12;
if (getenv("MEDIA_CODE"))
media_code = atoi(getenv("MEDIA_CODE"));
media_code = strtol(getenv("MEDIA_CODE"),NULL,16);
ctx->media.ribbon_code = media_code;
}

View File

@ -1,7 +1,7 @@
/*
* Sony UP-D series Photo Printer CUPS backend
*
* (c) 2013-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2013-2024 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@ -318,7 +318,7 @@ static int upd_attach(void *vctx, struct dyesub_connection *conn, uint8_t jobid)
}
if (test_mode >= TEST_MODE_NOATTACH && getenv("MEDIA_CODE")) {
ctx->marker.numtype = atoi(getenv("MEDIA_CODE"));
ctx->marker.numtype = strtol(getenv("MEDIA_CODE"), NULL, 16);
} else {
ctx->marker.numtype = ctx->stsbuf.ribbon;
}

View File

@ -1,7 +1,7 @@
/*
* Sony UP-D series (new) Photo Printer CUPS backend
*
* (c) 2019-2023 Solomon Peachy <pizza@shaftnet.org>
* (c) 2019-2024 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@ -161,7 +161,7 @@ static int updneo_attach(void *vctx, struct dyesub_connection *conn, uint8_t job
}
if (test_mode >= TEST_MODE_NOATTACH && getenv("MEDIA_CODE"))
ctx->marker.numtype = atoi(getenv("MEDIA_CODE"));
ctx->marker.numtype = strtol(getenv("MEDIA_CODE"), NULL, 16);
else
ctx->marker.numtype = (ctx->sts.scmdi >> 12) & 0xfff;