mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-09 13:41:59 -04:00
UPU_S10: fix Service Indicator warning re "H" (ticket #331, props
Milton Neal), which is valid; quote invalid Service Indicator, Country Code in warnings
This commit is contained in:
parent
e12c5ed3ba
commit
de8a62ca2a
3 changed files with 25 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
Version 2.15.0.9 (dev) not released yet (2025-03-09)
|
||||
Version 2.15.0.9 (dev) not released yet (2025-03-18)
|
||||
====================================================
|
||||
|
||||
**Incompatible changes**
|
||||
|
@ -26,6 +26,7 @@ Bugs
|
|||
----
|
||||
- AZTEC: fix GS1 mode with Structured Append (wasn't outputting initial FNC1)
|
||||
- set_height: fix non-compliance false positives by using epsilon in checks
|
||||
- UPU_S10: fix Service Indicator warning re "H" (ticket #331, props Milton Neal)
|
||||
- manual/man page: fix DATAMATRIX Sizes tables "28 12x26" -> "27 12x26"
|
||||
|
||||
|
||||
|
|
|
@ -273,14 +273,15 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len
|
|||
|
||||
/* Do some checks on the Service Indicator (first char only) and Country Code */
|
||||
if (strchr("JKSTW", local_source[0]) != NULL) { /* These are reserved & cannot be assigned */
|
||||
error_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 839,
|
||||
"Invalid Service Indicator (first character should not be any of \"JKSTW\")");
|
||||
} else if (strchr("FHIOXY", local_source[0]) != NULL) { /* These aren't allocated as of spec Oct 2017 */
|
||||
error_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 840,
|
||||
"Non-standard Service Indicator (first 2 characters)");
|
||||
error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 839,
|
||||
"Invalid Service Indicator '%.2s' (first character should not be any of \"JKSTW\")",
|
||||
local_source);
|
||||
} else if (strchr("FIOXY", local_source[0]) != NULL) { /* These aren't allocated as of spec Oct 2017 */
|
||||
error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 840,
|
||||
"Non-standard Service Indicator '%.2s' (first 2 characters)", local_source);
|
||||
} else if (!gs1_iso3166_alpha2(local_source + 11)) {
|
||||
error_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 841,
|
||||
"Country code (last two characters) is not ISO 3166-1");
|
||||
error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 841,
|
||||
"Country Code '%.2s' (last two characters) is not ISO 3166-1", local_source + 11);
|
||||
}
|
||||
|
||||
(void) code128(symbol, local_source, 13); /* Only error returned is for large text which can't happen */
|
||||
|
|
|
@ -1132,11 +1132,21 @@ static void test_upu_s10_input(const testCtx *const p_ctx) {
|
|||
/* 12*/ { "AB123456789A2", ZINT_ERROR_INVALID_DATA, 0, "Error 837: Invalid character in Country Code (last 2 characters) (alphabetic only)", "" },
|
||||
/* 13*/ { "AB12345678A2", ZINT_ERROR_INVALID_DATA, 0, "Error 837: Invalid character in Country Code (last 2 characters) (alphabetic only)", "" },
|
||||
/* 14*/ { "AB123456789AB", ZINT_ERROR_INVALID_CHECK, 0, "Error 838: Invalid check digit '9', expecting '5'", "" },
|
||||
/* 15*/ { "JB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 839: Invalid Service Indicator (first character should not be any of \"JKSTW\")", "" },
|
||||
/* 16*/ { "FB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 840: Non-standard Service Indicator (first 2 characters)", "" },
|
||||
/* 17*/ { "AB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 841: Country code (last two characters) is not ISO 3166-1", "" },
|
||||
/* 18*/ { "AB123100000IE", 0, 156, "", "Check digit 10 -> 0" },
|
||||
/* 19*/ { "AB000000005IE", 0, 156, "", "Check digit 11 -> 5" },
|
||||
/* 15*/ { "JB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 839: Invalid Service Indicator 'JB' (first character should not be any of \"JKSTW\")", "" },
|
||||
/* 16*/ { "KB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 839: Invalid Service Indicator 'KB' (first character should not be any of \"JKSTW\")", "" },
|
||||
/* 17*/ { "LB123456785AD", 0, 156, "", "" },
|
||||
/* 18*/ { "SB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 839: Invalid Service Indicator 'SB' (first character should not be any of \"JKSTW\")", "" },
|
||||
/* 19*/ { "TB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 839: Invalid Service Indicator 'TB' (first character should not be any of \"JKSTW\")", "" },
|
||||
/* 20*/ { "WB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 839: Invalid Service Indicator 'WB' (first character should not be any of \"JKSTW\")", "" },
|
||||
/* 21*/ { "FB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 840: Non-standard Service Indicator 'FB' (first 2 characters)", "" },
|
||||
/* 22*/ { "HB123456785AD", 0, 156, "", "" },
|
||||
/* 23*/ { "IB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 840: Non-standard Service Indicator 'IB' (first 2 characters)", "" },
|
||||
/* 24*/ { "OB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 840: Non-standard Service Indicator 'OB' (first 2 characters)", "" },
|
||||
/* 25*/ { "XB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 840: Non-standard Service Indicator 'XB' (first 2 characters)", "" },
|
||||
/* 26*/ { "YB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 840: Non-standard Service Indicator 'YB' (first 2 characters)", "" },
|
||||
/* 27*/ { "AB123456785AB", ZINT_WARN_NONCOMPLIANT, 156, "Warning 841: Country Code 'AB' (last two characters) is not ISO 3166-1", "" },
|
||||
/* 28*/ { "AB123100000IE", 0, 156, "", "Check digit 10 -> 0" },
|
||||
/* 29*/ { "AB000000005IE", 0, 156, "", "Check digit 11 -> 5" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue