diff --git a/backend/code128.c b/backend/code128.c index c82ac2d6..422a77df 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -1180,8 +1180,6 @@ INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length) return error_number; } -INTERNAL int iso3166_alpha2(const char *cc); /* In "iso3166.h" which is included by "gs1.c" */ - /* Universal Postal Union S10 */ /* https://www.upu.int/UPU/media/upu/files/postalSolutions/programmesAndServices/standards/S10-12.pdf */ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int length) { @@ -1247,7 +1245,7 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len } else if (strchr("FHIOXY", local_source[0]) != NULL) { /* These aren't allocated as of spec Oct 2017 */ strcpy(symbol->errtxt, "840: Non-standard Service Indicator (first 2 characters)"); error_number = ZINT_WARN_NONCOMPLIANT; - } else if (!iso3166_alpha2((const char *) (local_source + 11))) { + } else if (!gs1_iso3166_alpha2(local_source + 11)) { strcpy(symbol->errtxt, "841: Country code (last two characters) is not ISO 3166-1"); error_number = ZINT_WARN_NONCOMPLIANT; } diff --git a/backend/gs1.c b/backend/gs1.c index ac12c181..0de6c79c 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -1428,4 +1428,9 @@ INTERNAL char gs1_check_digit(const unsigned char source[], const int length) { return itoc((10 - (count % 10)) % 10); } +/* Helper to expose `iso3166_alpha2()` */ +INTERNAL int gs1_iso3166_alpha2(const unsigned char *cc) { + return iso3166_alpha2((const char *) cc); +} + /* vim: set ts=4 sw=4 et : */ diff --git a/backend/gs1.h b/backend/gs1.h index 9e3857f7..d895d3d0 100644 --- a/backend/gs1.h +++ b/backend/gs1.h @@ -40,6 +40,7 @@ extern "C" { INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const int src_len, unsigned char reduced[]); INTERNAL char gs1_check_digit(const unsigned char source[], const int src_len); +INTERNAL int gs1_iso3166_alpha2(const unsigned char *cc); #ifdef __cplusplus } diff --git a/backend/iso3166.h b/backend/iso3166.h index a37525d2..fda673b3 100644 --- a/backend/iso3166.h +++ b/backend/iso3166.h @@ -62,7 +62,7 @@ static int iso3166_numeric(int cc) { } /* Whether ISO 3166-1 alpha2 */ -INTERNAL int iso3166_alpha2(const char *cc) { +static int iso3166_alpha2(const char *cc) { static const unsigned char codes[85] = { 0x78, 0x59, 0xDF, 0xEE, 0xEF, 0xBD, 0xDD, 0xDE, 0x27, 0x3F, 0x84, 0x15, 0x80, 0xD4, 0x00, 0x0E, diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index b2f75afa..5b52a7ae 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -162,6 +162,8 @@ - Added MAILMARK_2D - Renamed MAILMARK to MAILMARK_4S *** Potential incompatibility *** +2022-12-09 GL +- Added UPU_S10 */ #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) @@ -308,6 +310,7 @@ static const char *s_code_list[] = { "DotCode", "HanXin", "MailMark-2D", + "UPU-S10", "MailMark-4S", "AztecRunes", "Code32", @@ -409,6 +412,7 @@ static const int s_code_number[] = { BARCODE_DOTCODE, BARCODE_HANXIN, BARCODE_MAILMARK_2D, + BARCODE_UPU_S10, BARCODE_MAILMARK_4S, BARCODE_AZRUNE, BARCODE_CODE32,