diff --git a/backend/gs1.c b/backend/gs1.c index 3445cf6a..755e6817 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -129,6 +129,39 @@ static int cset39(const unsigned char *data, int data_len, int offset, int min, return 1; } +/* Validate of character set 64 (GSCN 21-307 Figure 7.11-3) */ +static int cset64(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, + int *p_err_posn, char err_msg[50]) { + + data_len -= offset; + + if (data_len < min) { + return 0; + } + + if (data_len) { + const unsigned char *d = data + offset; + const unsigned char *const de = d + (data_len > max ? max : data_len); + + for (; d < de; d++) { + /* 0-9, A-Z, a-z and "-", "_" */ + if ((*d < '0' && *d != '-') || (*d > '9' && *d < 'A') || (*d > 'Z' && *d < 'a' && *d != '_') + || *d > 'z') { + /* One or two "="s can be used as padding to mod 3 length */ + if (*d == '=' && (d + 1 == de || (d + 2 == de && *(d + 1) == '=')) && data_len % 3 == 0) { + break; + } + *p_err_no = 3; + *p_err_posn = d - data + 1; + sprintf(err_msg, "Invalid CSET 64 character '%c'", *d); + return 0; + } + } + } + + return 1; +} + /* Check a check digit (GS1 General Specifications 7.9.1) */ static int csum(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, int *p_err_posn, char err_msg[50], const int length_only) { @@ -167,7 +200,6 @@ static int csum(const unsigned char *data, int data_len, int offset, int min, in /* Check alphanumeric check characters (GS1 General Specifications 7.9.5) */ static int csumalpha(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, int *p_err_posn, char err_msg[50], const int length_only) { - (void)max; data_len -= offset; @@ -1179,35 +1211,89 @@ static int couponposoffer(const unsigned char *data, int data_len, int offset, i return 1; } -/* Check WSG 84 latitude, longitude */ -static int latlong(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +/* Check WSG 84 latitude */ +static int latitude(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, int *p_err_posn, char err_msg[50], const int length_only) { - (void)max; data_len -= offset; - if (data_len < min || (data_len && data_len < 20)) { + if (data_len < min || (data_len && data_len < 10)) { return 0; } if (!length_only && data_len) { const unsigned char *d = data + offset; const unsigned char *const de = d + (data_len > max ? max : data_len); - uint64_t lat = 0, lng = 0; + uint64_t lat = 0; for (; d < de; d++) { - if (de - d > 10) { - lat *= 10; - lat += *d - '0'; - } else { - lng *= 10; - lng += *d - '0'; - } + lat *= 10; + lat += *d - '0'; } - if (lat > 1800000000 || lng > 3600000000) { + if (lat > 1800000000) { *p_err_no = 3; - *p_err_posn = d - 1 - data + 1 - 10 * (lat > 1800000000); - sprintf(err_msg, "Invalid %s", lat > 1800000000 ? "latitude" : "longitude"); + *p_err_posn = d - 1 - data + 1; + strcpy(err_msg, "Invalid latitude"); + return 0; + } + } + + return 1; +} + +/* Check WSG 84 longitude */ +static int longitude(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, + int *p_err_posn, char err_msg[50], const int length_only) { + + data_len -= offset; + + if (data_len < min || (data_len && data_len < 10)) { + return 0; + } + + if (!length_only && data_len) { + const unsigned char *d = data + offset; + const unsigned char *const de = d + (data_len > max ? max : data_len); + uint64_t lng = 0; + + for (; d < de; d++) { + lng *= 10; + lng += *d - '0'; + } + if (lng > 3600000000) { + *p_err_no = 3; + *p_err_posn = d - 1 - data + 1; + strcpy(err_msg, "Invalid longitude"); + return 0; + } + } + + return 1; +} + +/* Check AIDC media type (GSCN-22-345 Figure 3.8.22-2) */ +static int mediatype(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, + int *p_err_posn, char err_msg[50], const int length_only) { + + data_len -= offset; + + if (data_len < min || (data_len && data_len < 2)) { + return 0; + } + + if (!length_only && data_len) { + const unsigned char *d = data + offset; + const unsigned char *const de = d + (data_len > max ? max : data_len); + unsigned int val = 0; + + for (; d < de; d++) { + val *= 10; + val += *d - '0'; + } + if (val == 0 || (val > 10 && val < 80)) { + *p_err_no = 3; + *p_err_posn = d - data + 1; + strcpy(err_msg, "Invalid AIDC media type"); return 0; } } diff --git a/backend/gs1_lint.h b/backend/gs1_lint.h index b0a72a09..07471fdc 100644 --- a/backend/gs1_lint.h +++ b/backend/gs1_lint.h @@ -1,10 +1,10 @@ /* * GS1 AI checker generated by "backend/tools/gen_gs1_lint.php" from - * https://ref.gs1.org/tools/gs1-barcode-syntax-resource/syntax-dictionary/ + * https://raw.githubusercontent.com/gs1/gs1-syntax-dictionary/main/gs1-syntax-dictionary.txt */ /* libzint - the open source barcode library - Copyright (C) 2021-2022 Robin Stuart + Copyright (C) 2021-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -36,7 +36,7 @@ #ifndef Z_GS1_LINT_H #define Z_GS1_LINT_H -/* N18,csum,key (Used by SSCC) */ +/* N18,csum,key (Used by SSCC, GSRN - PROVIDER, GSRN - RECIPIENT) */ static int n18_csum_key(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 18 @@ -88,7 +88,7 @@ static int x__28(const unsigned char *data, const int data_len, && cset82(data, data_len, 0, 1, 28, p_err_no, p_err_posn, err_msg); } -/* X..30 (Used by ADDITIONAL ID, CUST. PART NO., SECONDARY SERIAL, REF. TO SOURCE...) */ +/* X..30 (Used by ADDITIONAL ID, CUST. PART No., SECONDARY SERIAL, REF. TO SOURCE...) */ static int x__30(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 30 @@ -257,13 +257,16 @@ static int x2_iso3166alpha2(const unsigned char *data, const int data_len, && iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0); } -/* N20,latlong (Used by SHIP TO GEO) */ -static int n20_latlong(const unsigned char *data, const int data_len, +/* N10,latitude N10,longitude (Used by SHIP TO GEO) */ +static int n10_latitude_n10_longitude(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 20 - && latlong(data, data_len, 0, 20, 20, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 20, 20, p_err_no, p_err_posn, err_msg) - && latlong(data, data_len, 0, 20, 20, p_err_no, p_err_posn, err_msg, 0); + && latitude(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && longitude(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && numeric(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg) + && latitude(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg, 0) + && numeric(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg) + && longitude(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg, 0); } /* N1,yesno (Used by DANGEROUS GOODS, AUTH TO LEAVE, SIG REQUIRED) */ @@ -397,6 +400,22 @@ static int x2_x__28(const unsigned char *data, const int data_len, && cset82(data, data_len, 2, 1, 28, p_err_no, p_err_posn, err_msg); } +/* N2,mediatype (Used by AIDC MEDIA TYPE) */ +static int n2_mediatype(const unsigned char *data, const int data_len, + int *p_err_no, int *p_err_posn, char err_msg[50]) { + return data_len == 2 + && mediatype(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && numeric(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg) + && mediatype(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0); +} + +/* X..25 (Used by VCN, REF No.) */ +static int x__25(const unsigned char *data, const int data_len, + int *p_err_no, int *p_err_posn, char err_msg[50]) { + return data_len >= 1 && data_len <= 25 + && cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg); +} + /* N4,nonzero N5,nonzero N3,nonzero N1,winding N1 (Used by DIMENSIONS) */ static int n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { @@ -500,15 +519,6 @@ static int x__25_csumalpha_key(const unsigned char *data, const int data_len, && key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0); } -/* N18,csum (Used by GSRN - PROVIDER, GSRN - RECIPIENT) */ -static int n18_csum(const unsigned char *data, const int data_len, - int *p_err_no, int *p_err_posn, char err_msg[50]) { - return data_len == 18 - && csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0); -} - /* N..10 (Used by SRIN) */ static int n__10(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { @@ -516,11 +526,11 @@ static int n__10(const unsigned char *data, const int data_len, && numeric(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg); } -/* X..25 (Used by REF NO.) */ -static int x__25(const unsigned char *data, const int data_len, +/* Z..90 (Used by DIGSIG) */ +static int z__90(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { - return data_len >= 1 && data_len <= 25 - && cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg); + return data_len >= 1 && data_len <= 90 + && cset64(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg); } /* X..70,couponcode */ @@ -724,7 +734,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, return x__30(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 4309) { - return n20_latlong(data, data_len, p_err_no, p_err_posn, err_msg); + return n10_latitude_n10_longitude(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 4318) { return x__20(data, data_len, p_err_no, p_err_posn, err_msg); @@ -795,6 +805,12 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if (ai == 7240) { return x__20(data, data_len, p_err_no, p_err_posn, err_msg); } + if (ai == 7241) { + return n2_mediatype(data, data_len, p_err_no, p_err_posn, err_msg); + } + if (ai == 7242) { + return x__25(data, data_len, p_err_no, p_err_posn, err_msg); + } } else if (ai < 8100) { @@ -835,7 +851,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, return x__25_csumalpha_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8017 || ai == 8018) { - return n18_csum(data, data_len, p_err_no, p_err_posn, err_msg); + return n18_csum_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8019) { return n__10(data, data_len, p_err_no, p_err_posn, err_msg); @@ -843,6 +859,9 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if (ai == 8020) { return x__25(data, data_len, p_err_no, p_err_posn, err_msg); } + if (ai == 8030) { + return z__90(data, data_len, p_err_no, p_err_posn, err_msg); + } } else if (ai < 8200) { diff --git a/backend/tests/test_gs1.c b/backend/tests/test_gs1.c index 43400d68..172e8376 100644 --- a/backend/tests/test_gs1.c +++ b/backend/tests/test_gs1.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -1169,182 +1169,188 @@ static void test_gs1_verify(const testCtx *const p_ctx) { /*809*/ { "[7239]E", ZINT_ERROR_INVALID_DATA, "" }, /*810*/ { "[7240]abcdefghijklmnopqrst", 0, "7240abcdefghijklmnopqrst" }, /*811*/ { "[7240]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*812*/ { "[7241]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*813*/ { "[7249]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*814*/ { "[7250]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*815*/ { "[7299]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*816*/ { "[73]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*817*/ { "[7300]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*818*/ { "[74]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*819*/ { "[7400]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*820*/ { "[79]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*821*/ { "[7900]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*822*/ { "[7999]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*823*/ { "[80]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*824*/ { "[800]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*825*/ { "[8000]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*826*/ { "[8001]12345678901234", ZINT_WARN_NONCOMPLIANT, "800112345678901234" }, - /*827*/ { "[8001]12345678901204", 0, "800112345678901204" }, - /*828*/ { "[8001]1234123456789012345", ZINT_ERROR_INVALID_DATA, "" }, - /*829*/ { "[8002]abcdefghijklmnopqrst", 0, "8002abcdefghijklmnopqrst" }, - /*830*/ { "[8002]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, - /*831*/ { "[8003]01234567890123abcdefghijklmnop", ZINT_WARN_NONCOMPLIANT, "800301234567890123abcdefghijklmnop" }, - /*832*/ { "[8003]01234567890128abcdefghijklmnop", 0, "800301234567890128abcdefghijklmnop" }, - /*833*/ { "[8003]01234567890128abcdefghijklmnopq", ZINT_ERROR_INVALID_DATA, "" }, - /*834*/ { "[8004]abcdefghijklmnopqrstuvwxyz1234", ZINT_WARN_NONCOMPLIANT, "8004abcdefghijklmnopqrstuvwxyz1234" }, - /*835*/ { "[8004]12cdefghijklmnopqrstuvwxyz1234", 0, "800412cdefghijklmnopqrstuvwxyz1234" }, - /*836*/ { "[8004]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /*837*/ { "[8005]123456", 0, "8005123456" }, - /*838*/ { "[8005]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*839*/ { "[8005]1234567", ZINT_ERROR_INVALID_DATA, "" }, - /*840*/ { "[8006]123456789012341212", ZINT_WARN_NONCOMPLIANT, "8006123456789012341212" }, - /*841*/ { "[8006]123456789012311212", 0, "8006123456789012311212" }, - /*842*/ { "[8006]12345678901234121", ZINT_ERROR_INVALID_DATA, "" }, - /*843*/ { "[8006]1234567890123412123", ZINT_ERROR_INVALID_DATA, "" }, - /*844*/ { "[8007]abcdefghijklmnopqrstuvwxyz12345678", ZINT_WARN_NONCOMPLIANT, "8007abcdefghijklmnopqrstuvwxyz12345678" }, - /*845*/ { "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", 0, "8007AD95EFGHIJKLMNOPQRSTUVWXYZ12345678" }, - /*846*/ { "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ123456789", ZINT_ERROR_INVALID_DATA, "" }, - /*847*/ { "[8008]123456121212", ZINT_WARN_NONCOMPLIANT, "8008123456121212" }, - /*848*/ { "[8008]121256121212", ZINT_WARN_NONCOMPLIANT, "8008121256121212" }, - /*849*/ { "[8008]121231121212", 0, "8008121231121212" }, - /*850*/ { "[8008]1234561212", ZINT_WARN_NONCOMPLIANT, "80081234561212" }, - /*851*/ { "[8008]1212311212", 0, "80081212311212" }, - /*852*/ { "[8008]12345612", ZINT_WARN_NONCOMPLIANT, "800812345612" }, - /*853*/ { "[8008]12010112", 0, "800812010112" }, - /*854*/ { "[8008]1234561", ZINT_ERROR_INVALID_DATA, "" }, - /*855*/ { "[8008]123456121", ZINT_ERROR_INVALID_DATA, "" }, - /*856*/ { "[8008]12345612121", ZINT_ERROR_INVALID_DATA, "" }, - /*857*/ { "[8008]1234561212123", ZINT_ERROR_INVALID_DATA, "" }, - /*858*/ { "[8009]12345678901234567890123456789012345678901234567890", 0, "800912345678901234567890123456789012345678901234567890" }, - /*859*/ { "[8009]123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*860*/ { "[8010]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "" }, - /*861*/ { "[8011]123456789012", 0, "8011123456789012" }, - /*862*/ { "[8011]1234567890123", ZINT_ERROR_INVALID_DATA, "" }, - /*863*/ { "[8012]abcdefghijklmnopqrst", 0, "8012abcdefghijklmnopqrst" }, - /*864*/ { "[8012]abcdefghijklmnopqrstuv", ZINT_ERROR_INVALID_DATA, "" }, - /*865*/ { "[8013]1234abcdefghijklmnopqrsQP", 0, "80131234abcdefghijklmnopqrsQP" }, - /*866*/ { "[8013]1234abcdefghijklmnopqrsQPv", ZINT_ERROR_INVALID_DATA, "" }, - /*867*/ { "[8014]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*868*/ { "[8016]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*869*/ { "[8017]313131313131313139", ZINT_WARN_NONCOMPLIANT, "8017313131313131313139" }, - /*870*/ { "[8017]313131313131313131", 0, "8017313131313131313131" }, - /*871*/ { "[8017]31313131313131313", ZINT_ERROR_INVALID_DATA, "" }, - /*872*/ { "[8017]3131313131313131390", ZINT_ERROR_INVALID_DATA, "" }, - /*873*/ { "[8018]313131313131313139", ZINT_WARN_NONCOMPLIANT, "8018313131313131313139" }, - /*874*/ { "[8018]313131313131313131", 0, "8018313131313131313131" }, - /*875*/ { "[8018]31313131313131313", ZINT_ERROR_INVALID_DATA, "" }, - /*876*/ { "[8018]3131313131313131390", ZINT_ERROR_INVALID_DATA, "" }, - /*877*/ { "[8019]1234567890", 0, "80191234567890" }, - /*878*/ { "[8019]12345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*879*/ { "[8020]abcdefghijklmnopqrstuvwxy", 0, "8020abcdefghijklmnopqrstuvwxy" }, - /*880*/ { "[8020]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "" }, - /*881*/ { "[8021]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*882*/ { "[8025]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*883*/ { "[8026]123456789012341212", ZINT_WARN_NONCOMPLIANT, "8026123456789012341212" }, - /*884*/ { "[8026]123456789012311212", 0, "8026123456789012311212" }, - /*885*/ { "[8026]1234567890123451212", ZINT_ERROR_INVALID_DATA, "" }, - /*886*/ { "[8026]12345678901234512", ZINT_ERROR_INVALID_DATA, "" }, - /*887*/ { "[8027]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*888*/ { "[8030]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*889*/ { "[8040]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*890*/ { "[8050]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*891*/ { "[8060]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*892*/ { "[8070]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*893*/ { "[8080]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*894*/ { "[8090]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*895*/ { "[8099]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*896*/ { "[81]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*897*/ { "[8100]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*898*/ { "[8109]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*899*/ { "[8110]5123456789011234565123455123450123105123450123512345678901320123190000", 0, "81105123456789011234565123455123450123105123450123512345678901320123190000" }, - /*900*/ { "[8110]51234567890112345651234551234501231051234501235123456789013201231900001", ZINT_ERROR_INVALID_DATA, "" }, - /*901*/ { "[8111]1234", 0, "81111234" }, - /*902*/ { "[8111]12345", ZINT_ERROR_INVALID_DATA, "" }, - /*903*/ { "[8111]123", ZINT_ERROR_INVALID_DATA, "" }, - /*904*/ { "[8112]1234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, "81121234567890123456789012345678901234567890123456789012345678901234567890" }, - /*905*/ { "[8112]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*906*/ { "[8112]061234567890121234569123456789012345", 0, "8112061234567890121234569123456789012345" }, - /*907*/ { "[8113]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*908*/ { "[8120]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*909*/ { "[8130]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*910*/ { "[8140]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*911*/ { "[8150]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*912*/ { "[8190]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*913*/ { "[8199]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*914*/ { "[82]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*915*/ { "[8200]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "82001234567890123456789012345678901234567890123456789012345678901234567890" }, - /*916*/ { "[8201]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*917*/ { "[8210]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*918*/ { "[8220]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*919*/ { "[8230]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*920*/ { "[8240]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*921*/ { "[8250]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*922*/ { "[8290]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*923*/ { "[8299]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*924*/ { "[83]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*925*/ { "[830]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*926*/ { "[8300]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*927*/ { "[84]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*928*/ { "[840]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*929*/ { "[8400]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*930*/ { "[85]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*931*/ { "[850]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*932*/ { "[8500]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*933*/ { "[89]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*934*/ { "[890]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*935*/ { "[8900]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*936*/ { "[90]abcdefghijklmnopqrstuvwxyz1234", 0, "90abcdefghijklmnopqrstuvwxyz1234" }, - /*937*/ { "[90]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, - /*938*/ { "[900]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*939*/ { "[9000]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*940*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*941*/ { "[91]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*942*/ { "[910]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*943*/ { "[9100]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*944*/ { "[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*945*/ { "[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*946*/ { "[920]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*947*/ { "[9200]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*948*/ { "[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "93123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*949*/ { "[93]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*950*/ { "[930]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*951*/ { "[9300]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*952*/ { "[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "94123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*953*/ { "[94]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*954*/ { "[940]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*955*/ { "[9400]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*956*/ { "[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "95123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*957*/ { "[95]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*958*/ { "[950]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*959*/ { "[9500]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*960*/ { "[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "96123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*961*/ { "[96]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*962*/ { "[960]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*963*/ { "[9600]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*964*/ { "[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "97123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*965*/ { "[97]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*966*/ { "[970]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*967*/ { "[9700]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*968*/ { "[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "98123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*969*/ { "[98]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*970*/ { "[980]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*971*/ { "[9800]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*972*/ { "[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "99123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, - /*973*/ { "[99]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, - /*974*/ { "[990]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*975*/ { "[9900]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*976*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "" }, - /*977*/ { "[01]12345678901234[7006]200101", ZINT_WARN_NONCOMPLIANT, "01123456789012347006200101" }, - /*978*/ { "[01]12345678901231[7006]200101", 0, "01123456789012317006200101" }, - /*979*/ { "[3900]1234567890[01]12345678901234", ZINT_WARN_NONCOMPLIANT, "39001234567890[0112345678901234" }, - /*980*/ { "[3900]1234567890[01]12345678901231", 0, "39001234567890[0112345678901231" }, - /*981*/ { "[253]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234[390112345678901234[2012" }, - /*982*/ { "[253]12345678901284[3901]12345678901234[20]12", 0, "25312345678901284[390112345678901234[2012" }, - /*983*/ { "[253]12345678901234[01]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234[0112345678901234390112345678901234[2012" }, - /*984*/ { "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", 0, "25312345678901284[0112345678901231390112345678901234[2012" }, - /*985*/ { "[01]12345678901231[0A]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "" }, - /*986*/ { "[01]12345678901231[0]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "" }, - /*987*/ { "[01]12345678901231[]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "" }, + /*812*/ { "[7241]99", 0, "724199" }, + /*813*/ { "[7241]100", ZINT_ERROR_INVALID_DATA, "" }, + /*814*/ { "[7242]abcdefghijklmnopqrstuvwxy", 0, "7242abcdefghijklmnopqrstuvwxy" }, + /*815*/ { "[7242]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "" }, + /*816*/ { "[7243]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*817*/ { "[7249]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*818*/ { "[7250]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*819*/ { "[7299]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*820*/ { "[73]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*821*/ { "[7300]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*822*/ { "[74]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*823*/ { "[7400]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*824*/ { "[79]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*825*/ { "[7900]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*826*/ { "[7999]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*827*/ { "[80]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*828*/ { "[800]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*829*/ { "[8000]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*830*/ { "[8001]12345678901234", ZINT_WARN_NONCOMPLIANT, "800112345678901234" }, + /*831*/ { "[8001]12345678901204", 0, "800112345678901204" }, + /*832*/ { "[8001]1234123456789012345", ZINT_ERROR_INVALID_DATA, "" }, + /*833*/ { "[8002]abcdefghijklmnopqrst", 0, "8002abcdefghijklmnopqrst" }, + /*834*/ { "[8002]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "" }, + /*835*/ { "[8003]01234567890123abcdefghijklmnop", ZINT_WARN_NONCOMPLIANT, "800301234567890123abcdefghijklmnop" }, + /*836*/ { "[8003]01234567890128abcdefghijklmnop", 0, "800301234567890128abcdefghijklmnop" }, + /*837*/ { "[8003]01234567890128abcdefghijklmnopq", ZINT_ERROR_INVALID_DATA, "" }, + /*838*/ { "[8004]abcdefghijklmnopqrstuvwxyz1234", ZINT_WARN_NONCOMPLIANT, "8004abcdefghijklmnopqrstuvwxyz1234" }, + /*839*/ { "[8004]12cdefghijklmnopqrstuvwxyz1234", 0, "800412cdefghijklmnopqrstuvwxyz1234" }, + /*840*/ { "[8004]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /*841*/ { "[8005]123456", 0, "8005123456" }, + /*842*/ { "[8005]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*843*/ { "[8005]1234567", ZINT_ERROR_INVALID_DATA, "" }, + /*844*/ { "[8006]123456789012341212", ZINT_WARN_NONCOMPLIANT, "8006123456789012341212" }, + /*845*/ { "[8006]123456789012311212", 0, "8006123456789012311212" }, + /*846*/ { "[8006]12345678901234121", ZINT_ERROR_INVALID_DATA, "" }, + /*847*/ { "[8006]1234567890123412123", ZINT_ERROR_INVALID_DATA, "" }, + /*848*/ { "[8007]abcdefghijklmnopqrstuvwxyz12345678", ZINT_WARN_NONCOMPLIANT, "8007abcdefghijklmnopqrstuvwxyz12345678" }, + /*849*/ { "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", 0, "8007AD95EFGHIJKLMNOPQRSTUVWXYZ12345678" }, + /*850*/ { "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ123456789", ZINT_ERROR_INVALID_DATA, "" }, + /*851*/ { "[8008]123456121212", ZINT_WARN_NONCOMPLIANT, "8008123456121212" }, + /*852*/ { "[8008]121256121212", ZINT_WARN_NONCOMPLIANT, "8008121256121212" }, + /*853*/ { "[8008]121231121212", 0, "8008121231121212" }, + /*854*/ { "[8008]1234561212", ZINT_WARN_NONCOMPLIANT, "80081234561212" }, + /*855*/ { "[8008]1212311212", 0, "80081212311212" }, + /*856*/ { "[8008]12345612", ZINT_WARN_NONCOMPLIANT, "800812345612" }, + /*857*/ { "[8008]12010112", 0, "800812010112" }, + /*858*/ { "[8008]1234561", ZINT_ERROR_INVALID_DATA, "" }, + /*859*/ { "[8008]123456121", ZINT_ERROR_INVALID_DATA, "" }, + /*860*/ { "[8008]12345612121", ZINT_ERROR_INVALID_DATA, "" }, + /*861*/ { "[8008]1234561212123", ZINT_ERROR_INVALID_DATA, "" }, + /*862*/ { "[8009]12345678901234567890123456789012345678901234567890", 0, "800912345678901234567890123456789012345678901234567890" }, + /*863*/ { "[8009]123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*864*/ { "[8010]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "" }, + /*865*/ { "[8011]123456789012", 0, "8011123456789012" }, + /*866*/ { "[8011]1234567890123", ZINT_ERROR_INVALID_DATA, "" }, + /*867*/ { "[8012]abcdefghijklmnopqrst", 0, "8012abcdefghijklmnopqrst" }, + /*868*/ { "[8012]abcdefghijklmnopqrstuv", ZINT_ERROR_INVALID_DATA, "" }, + /*869*/ { "[8013]1234abcdefghijklmnopqrsQP", 0, "80131234abcdefghijklmnopqrsQP" }, + /*870*/ { "[8013]1234abcdefghijklmnopqrsQPv", ZINT_ERROR_INVALID_DATA, "" }, + /*871*/ { "[8014]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*872*/ { "[8016]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*873*/ { "[8017]313131313131313139", ZINT_WARN_NONCOMPLIANT, "8017313131313131313139" }, + /*874*/ { "[8017]313131313131313131", 0, "8017313131313131313131" }, + /*875*/ { "[8017]31313131313131313", ZINT_ERROR_INVALID_DATA, "" }, + /*876*/ { "[8017]3131313131313131390", ZINT_ERROR_INVALID_DATA, "" }, + /*877*/ { "[8018]313131313131313139", ZINT_WARN_NONCOMPLIANT, "8018313131313131313139" }, + /*878*/ { "[8018]313131313131313131", 0, "8018313131313131313131" }, + /*879*/ { "[8018]31313131313131313", ZINT_ERROR_INVALID_DATA, "" }, + /*880*/ { "[8018]3131313131313131390", ZINT_ERROR_INVALID_DATA, "" }, + /*881*/ { "[8019]1234567890", 0, "80191234567890" }, + /*882*/ { "[8019]12345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*883*/ { "[8020]abcdefghijklmnopqrstuvwxy", 0, "8020abcdefghijklmnopqrstuvwxy" }, + /*884*/ { "[8020]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "" }, + /*885*/ { "[8021]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*886*/ { "[8025]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*887*/ { "[8026]123456789012341212", ZINT_WARN_NONCOMPLIANT, "8026123456789012341212" }, + /*888*/ { "[8026]123456789012311212", 0, "8026123456789012311212" }, + /*889*/ { "[8026]1234567890123451212", ZINT_ERROR_INVALID_DATA, "" }, + /*890*/ { "[8026]12345678901234512", ZINT_ERROR_INVALID_DATA, "" }, + /*891*/ { "[8027]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*892*/ { "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, "8030-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, + /*893*/ { "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ1", ZINT_ERROR_INVALID_DATA, "" }, + /*894*/ { "[8031]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*895*/ { "[8040]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*896*/ { "[8050]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*897*/ { "[8060]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*898*/ { "[8070]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*899*/ { "[8080]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*900*/ { "[8090]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*901*/ { "[8099]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*902*/ { "[81]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*903*/ { "[8100]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*904*/ { "[8109]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*905*/ { "[8110]5123456789011234565123455123450123105123450123512345678901320123190000", 0, "81105123456789011234565123455123450123105123450123512345678901320123190000" }, + /*906*/ { "[8110]51234567890112345651234551234501231051234501235123456789013201231900001", ZINT_ERROR_INVALID_DATA, "" }, + /*907*/ { "[8111]1234", 0, "81111234" }, + /*908*/ { "[8111]12345", ZINT_ERROR_INVALID_DATA, "" }, + /*909*/ { "[8111]123", ZINT_ERROR_INVALID_DATA, "" }, + /*910*/ { "[8112]1234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, "81121234567890123456789012345678901234567890123456789012345678901234567890" }, + /*911*/ { "[8112]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*912*/ { "[8112]061234567890121234569123456789012345", 0, "8112061234567890121234569123456789012345" }, + /*913*/ { "[8113]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*914*/ { "[8120]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*915*/ { "[8130]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*916*/ { "[8140]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*917*/ { "[8150]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*918*/ { "[8190]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*919*/ { "[8199]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*920*/ { "[82]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*921*/ { "[8200]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "82001234567890123456789012345678901234567890123456789012345678901234567890" }, + /*922*/ { "[8201]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*923*/ { "[8210]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*924*/ { "[8220]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*925*/ { "[8230]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*926*/ { "[8240]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*927*/ { "[8250]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*928*/ { "[8290]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*929*/ { "[8299]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*930*/ { "[83]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*931*/ { "[830]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*932*/ { "[8300]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*933*/ { "[84]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*934*/ { "[840]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*935*/ { "[8400]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*936*/ { "[85]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*937*/ { "[850]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*938*/ { "[8500]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*939*/ { "[89]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*940*/ { "[890]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*941*/ { "[8900]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*942*/ { "[90]abcdefghijklmnopqrstuvwxyz1234", 0, "90abcdefghijklmnopqrstuvwxyz1234" }, + /*943*/ { "[90]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "" }, + /*944*/ { "[900]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*945*/ { "[9000]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*946*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*947*/ { "[91]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*948*/ { "[910]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*949*/ { "[9100]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*950*/ { "[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*951*/ { "[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*952*/ { "[920]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*953*/ { "[9200]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*954*/ { "[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "93123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*955*/ { "[93]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*956*/ { "[930]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*957*/ { "[9300]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*958*/ { "[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "94123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*959*/ { "[94]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*960*/ { "[940]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*961*/ { "[9400]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*962*/ { "[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "95123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*963*/ { "[95]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*964*/ { "[950]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*965*/ { "[9500]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*966*/ { "[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "96123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*967*/ { "[96]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*968*/ { "[960]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*969*/ { "[9600]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*970*/ { "[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "97123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*971*/ { "[97]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*972*/ { "[970]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*973*/ { "[9700]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*974*/ { "[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "98123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*975*/ { "[98]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*976*/ { "[980]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*977*/ { "[9800]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*978*/ { "[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "99123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" }, + /*979*/ { "[99]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "" }, + /*980*/ { "[990]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*981*/ { "[9900]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*982*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "" }, + /*983*/ { "[01]12345678901234[7006]200101", ZINT_WARN_NONCOMPLIANT, "01123456789012347006200101" }, + /*984*/ { "[01]12345678901231[7006]200101", 0, "01123456789012317006200101" }, + /*985*/ { "[3900]1234567890[01]12345678901234", ZINT_WARN_NONCOMPLIANT, "39001234567890[0112345678901234" }, + /*986*/ { "[3900]1234567890[01]12345678901231", 0, "39001234567890[0112345678901231" }, + /*987*/ { "[253]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234[390112345678901234[2012" }, + /*988*/ { "[253]12345678901284[3901]12345678901234[20]12", 0, "25312345678901284[390112345678901234[2012" }, + /*989*/ { "[253]12345678901234[01]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234[0112345678901234390112345678901234[2012" }, + /*990*/ { "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", 0, "25312345678901284[0112345678901231390112345678901234[2012" }, + /*991*/ { "[01]12345678901231[0A]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "" }, + /*992*/ { "[01]12345678901231[0]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "" }, + /*993*/ { "[01]12345678901231[]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1402,366 +1408,380 @@ static void test_gs1_lint(const testCtx *const p_ctx) { /* 13*/ { "[8010]01!", ZINT_WARN_NONCOMPLIANT, "801001!", "261: AI (8010) position 3: Invalid CSET 39 character '!'" }, /* cset39 */ /* 14*/ { "[8010]01a", ZINT_WARN_NONCOMPLIANT, "801001a", "261: AI (8010) position 3: Invalid CSET 39 character 'a'" }, /* cset39 */ /* 15*/ { "[8010]6789ABCDEFGHIJKLMNOPQRSTUVWXY}", ZINT_WARN_NONCOMPLIANT, "80106789ABCDEFGHIJKLMNOPQRSTUVWXY}", "261: AI (8010) position 30: Invalid CSET 39 character '}'" }, /* cset39 */ - /* 16*/ { "[8010]#-/0123456789ABCDEFGHIJKLMNOPQ", ZINT_WARN_NONCOMPLIANT, "8010#-/0123456789ABCDEFGHIJKLMNOPQ", "261: AI (8010) position 1: Non-numeric company prefix '#'" }, /* key */ - /* 17*/ { "[8010]0#-/123456789ABCDEFGHIJKLMNOPQ", ZINT_WARN_NONCOMPLIANT, "80100#-/123456789ABCDEFGHIJKLMNOPQ", "261: AI (8010) position 2: Non-numeric company prefix '#'" }, /* key */ - /* 18*/ { "[401]0", ZINT_WARN_NONCOMPLIANT, "4010", "259: Invalid data length for AI (401)" }, /* key */ - /* 19*/ { "[8013]1987654Ad4X4bL5ttr2310c2K", 0, "80131987654Ad4X4bL5ttr2310c2K", "" }, /* csumalpha */ - /* 20*/ { "[8013]12345678901234567890123NT", 0, "801312345678901234567890123NT", "" }, /* csumalpha */ - /* 21*/ { "[8013]12345_ABCDEFGHIJKLMCP", 0, "801312345_ABCDEFGHIJKLMCP", "" }, /* csumalpha */ - /* 22*/ { "[8013]12345_NOPQRSTUVWXYZDN", 0, "801312345_NOPQRSTUVWXYZDN", "" }, /* csumalpha */ - /* 23*/ { "[8013]12345_abcdefghijklmN3", 0, "801312345_abcdefghijklmN3", "" }, /* csumalpha */ - /* 24*/ { "[8013]12345_nopqrstuvwxyzP2", 0, "801312345_nopqrstuvwxyzP2", "" }, /* csumalpha */ - /* 25*/ { "[8013]12345_!\"%&'()*+,-./LC", 0, "801312345_!\"%&'()*+,-./LC", "" }, /* csumalpha */ - /* 26*/ { "[8013]12345_0123456789:;<=>?62", 0, "801312345_0123456789:;<=>?62", "" }, /* csumalpha */ - /* 27*/ { "[8013]7907665Bm8v2AB", 0, "80137907665Bm8v2AB", "" }, /* csumalpha */ - /* 28*/ { "[8013]97850l6KZm0yCD", 0, "801397850l6KZm0yCD", "" }, /* csumalpha */ - /* 29*/ { "[8013]225803106GSpEF", 0, "8013225803106GSpEF", "" }, /* csumalpha */ - /* 30*/ { "[8013]149512464PM+GH", 0, "8013149512464PM+GH", "" }, /* csumalpha */ - /* 31*/ { "[8013]62577B8fRG7HJK", 0, "801362577B8fRG7HJK", "" }, /* csumalpha */ - /* 32*/ { "[8013]515942070CYxLM", 0, "8013515942070CYxLM", "" }, /* csumalpha */ - /* 33*/ { "[8013]390800494sP6NP", 0, "8013390800494sP6NP", "" }, /* csumalpha */ - /* 34*/ { "[8013]386830132uO+QR", 0, "8013386830132uO+QR", "" }, /* csumalpha */ - /* 35*/ { "[8013]53395376X1:nST", 0, "801353395376X1:nST", "" }, /* csumalpha */ - /* 36*/ { "[8013]957813138Sb6UV", 0, "8013957813138Sb6UV", "" }, /* csumalpha */ - /* 37*/ { "[8013]530790no0qOgWX", 0, "8013530790no0qOgWX", "" }, /* csumalpha */ - /* 38*/ { "[8013]62185314IvwmYZ", 0, "801362185314IvwmYZ", "" }, /* csumalpha */ - /* 39*/ { "[8013]23956qk1&dB!23", 0, "801323956qk1&dB!23", "" }, /* csumalpha */ - /* 40*/ { "[8013]794394895ic045", 0, "8013794394895ic045", "" }, /* csumalpha */ - /* 41*/ { "[8013]57453Uq3qA?62", 0, "801312345_0123456789:;<=>?62", "" }, /* csumalpha */ + /* 34*/ { "[8013]7907665Bm8v2AB", 0, "80137907665Bm8v2AB", "" }, /* csumalpha */ + /* 35*/ { "[8013]97850l6KZm0yCD", 0, "801397850l6KZm0yCD", "" }, /* csumalpha */ + /* 36*/ { "[8013]225803106GSpEF", 0, "8013225803106GSpEF", "" }, /* csumalpha */ + /* 37*/ { "[8013]149512464PM+GH", 0, "8013149512464PM+GH", "" }, /* csumalpha */ + /* 38*/ { "[8013]62577B8fRG7HJK", 0, "801362577B8fRG7HJK", "" }, /* csumalpha */ + /* 39*/ { "[8013]515942070CYxLM", 0, "8013515942070CYxLM", "" }, /* csumalpha */ + /* 40*/ { "[8013]390800494sP6NP", 0, "8013390800494sP6NP", "" }, /* csumalpha */ + /* 41*/ { "[8013]386830132uO+QR", 0, "8013386830132uO+QR", "" }, /* csumalpha */ + /* 42*/ { "[8013]53395376X1:nST", 0, "801353395376X1:nST", "" }, /* csumalpha */ + /* 43*/ { "[8013]957813138Sb6UV", 0, "8013957813138Sb6UV", "" }, /* csumalpha */ + /* 44*/ { "[8013]530790no0qOgWX", 0, "8013530790no0qOgWX", "" }, /* csumalpha */ + /* 45*/ { "[8013]62185314IvwmYZ", 0, "801362185314IvwmYZ", "" }, /* csumalpha */ + /* 46*/ { "[8013]23956qk1&dB!23", 0, "801323956qk1&dB!23", "" }, /* csumalpha */ + /* 47*/ { "[8013]794394895ic045", 0, "8013794394895ic045", "" }, /* csumalpha */ + /* 48*/ { "[8013]57453Uq3qA + Copyright (C) 2021-2023 */ /* SPDX-License-Identifier: BSD-3-Clause */ @@ -15,7 +15,7 @@ * php backend/tools/gen_gs1_lint.php -f /gs1-syntax-dictionary.txt backend/gs1_lint.h * ************************************************************************************************* - * NOTE: up-to-update version requires syntax dictionary available from + * NOTE: up-to-date version requires syntax dictionary available from * https://ref.gs1.org/tools/gs1-barcode-syntax-resource/syntax-dictionary/ ************************************************************************************************* */ @@ -27,7 +27,7 @@ $dirdirname = basename(dirname($dirname)) . '/' . basename($dirname); $opts = getopt('c:f:h:l:t:'); $print_copyright = isset($opts['c']) ? (bool) $opts['c'] : true; -$file = isset($opts['f']) ? $opts['f'] : 'https://ref.gs1.org/tools/gs1-barcode-syntax-resource/syntax-dictionary/'; +$file = isset($opts['f']) ? $opts['f'] : 'https://raw.githubusercontent.com/gs1/gs1-syntax-dictionary/main/gs1-syntax-dictionary.txt'; $print_h_guard = isset($opts['h']) ? (bool) $opts['h'] : true; $use_length_only = isset($opts['l']) ? (bool) $opts['l'] : true; $tab = isset($opts['t']) ? $opts['t'] : ' '; @@ -55,7 +55,8 @@ foreach ($lines as $line) { if ($line === '' || $line[0] === '#') { continue; } - if (!preg_match('/^([0-9]+(?:-[0-9]+)?) +([ *] )([NXYC][0-9.][ NXYC0-9.,a-z=|\[\]]*)(?:# (.+))?$/', $line, $matches)) { + if (!preg_match('/^([0-9]+(?:-[0-9]+)?) +([ *] )([NXYZ][0-9.][ NXYZ0-9.,a-z=|\[\]]*)(?:# (.+))?$/', $line, $matches)) { + print $line . PHP_EOL; exit("$basename:" . __LINE__ . " ERROR: Could not parse line $line_no" . PHP_EOL); } $ai = $matches[1]; @@ -121,7 +122,7 @@ foreach ($lines as $line) { foreach ($parts as $part) { $checkers = explode(',', $part); $validator = array_shift($checkers); - if (preg_match('/^([NXYC])([0-9]+)?(\.\.[0-9|]+)?$/', $validator, $matches)) { + if (preg_match('/^([NXYZ])([0-9]+)?(\.\.[0-9|]+)?$/', $validator, $matches)) { if (count($matches) === 3) { $min = $max = (int) $matches[2]; } else { @@ -132,10 +133,12 @@ foreach ($lines as $line) { $validator = "numeric"; } elseif ($matches[1] === 'X') { $validator = "cset82"; - } else { + } elseif ($matches[1] === 'Y') { $validator = "cset39"; + } else { // 'Z' + $validator = "cset64"; } - } else if (preg_match('/^\[([NXYC])([1-9]+)?(\.\.[0-9|]+)?\]$/', $validator, $matches)) { + } else if (preg_match('/^\[([NXYZ])([1-9]+)?(\.\.[0-9|]+)?\]$/', $validator, $matches)) { if (count($matches) === 3) { $min = 0; $max = (int) $matches[2]; @@ -147,8 +150,10 @@ foreach ($lines as $line) { $validator = "numeric"; } elseif ($matches[1] === 'X') { $validator = "cset82"; - } else { + } elseif ($matches[1] === 'Y') { $validator = "cset39"; + } else { // 'Z' + $validator = "cset64"; } } else { exit("$basename:" . __LINE__ . " ERROR: Could not parse validator \"$validator\" line $line_no" . PHP_EOL); @@ -234,7 +239,7 @@ if ($print_copyright) { print <<<'EOD' /* libzint - the open source barcode library - Copyright (C) 2021-2022 Robin Stuart + Copyright (C) 2021-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/docs/README b/docs/README index 8744c1f2..fcdbe7d9 100644 --- a/docs/README +++ b/docs/README @@ -2,8 +2,8 @@ For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" usin On Ubuntu/Debian (tested on Ubuntu 22.04) - wget https://github.com/jgm/pandoc/releases/download/3.1.3/pandoc-3.1.3-1-amd64.deb - sudo dpkg -i pandoc-3.1.3-1-amd64.deb + wget https://github.com/jgm/pandoc/releases/download/3.1.4/pandoc-3.1.4-1-amd64.deb + sudo dpkg -i pandoc-3.1.4-1-amd64.deb sudo apt install python3-pip pip install pandoc-tablenos --user export PATH=~/.local/bin:"$PATH" @@ -18,9 +18,9 @@ On Ubuntu/Debian (tested on Ubuntu 22.04) On Fedora (tested on Fedora Linux 38 (Workstation Edition)) - wget https://github.com/jgm/pandoc/releases/download/3.1.3/pandoc-3.1.3-linux-amd64.tar.gz - tar xf pandoc-3.1.3-linux-amd64.tar.gz - sudo mv -i pandoc-3.1.3/bin/pandoc /usr/local/bin + wget https://github.com/jgm/pandoc/releases/download/3.1.4/pandoc-3.1.4-linux-amd64.tar.gz + tar xf pandoc-3.1.4-linux-amd64.tar.gz + sudo mv -i pandoc-3.1.4/bin/pandoc /usr/local/bin sudo dnf install python3-pip pip install pandoc-tablenos --user export PATH=~/.local/bin:"$PATH" diff --git a/docs/manual.pmd b/docs/manual.pmd index f3a58d2e..13cbe34b 100644 --- a/docs/manual.pmd +++ b/docs/manual.pmd @@ -1,6 +1,6 @@ % Zint Barcode Generator and Zint Barcode Studio User Manual % Version 2.12.0.9 -% June 2023 +% July 2023 # 1. Introduction diff --git a/docs/manual.txt b/docs/manual.txt index 8739d583..2ce5ecba 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -1,6 +1,6 @@ Zint Barcode Generator and Zint Barcode Studio User Manual Version 2.12.0.9 -June 2023 +July 2023 ******************************************************************************* * For reference the following is a text-only version of the Zint manual, * @@ -4494,7 +4494,7 @@ defined. Annex B. Man Page ZINT(1) -% ZINT(1) Version 2.12.0.9 % % June 2023 +% ZINT(1) Version 2.12.0.9 % % July 2023 NAME diff --git a/docs/zint.1 b/docs/zint.1 index 8a0b92ab..2de885fd 100644 --- a/docs/zint.1 +++ b/docs/zint.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 3.1.3 +.\" Automatically generated by Pandoc 3.1.4 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. @@ -14,7 +14,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "ZINT" "1" "June 2023" "Version 2.12.0.9" "" +.TH "ZINT" "1" "July 2023" "Version 2.12.0.9" "" .hy .SH NAME .PP diff --git a/docs/zint.1.pmd b/docs/zint.1.pmd index 7cb977ab..a08a0a22 100644 --- a/docs/zint.1.pmd +++ b/docs/zint.1.pmd @@ -1,6 +1,6 @@ % ZINT(1) Version 2.12.0.9 % -% June 2023 +% July 2023 # NAME