CODABAR: better error messages; win32/README, zint_cmdline_vc6/readme.txt: fixes

This commit is contained in:
gitlost 2021-06-10 18:04:27 +01:00
parent ede1234b8f
commit 69c1b4cbf0
4 changed files with 15 additions and 11 deletions

View File

@ -67,7 +67,7 @@ INTERNAL int pharma_one(struct zint_symbol *symbol, unsigned char source[], int
char dest[64]; /* 17 * 2 + 1 */ char dest[64]; /* 17 * 2 + 1 */
if (length > 6) { if (length > 6) {
strcpy(symbol->errtxt, "350: Input too long"); strcpy(symbol->errtxt, "350: Input too long (6 character maximum");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
error_number = is_sane(NEON, source, length); error_number = is_sane(NEON, source, length);
@ -79,7 +79,7 @@ INTERNAL int pharma_one(struct zint_symbol *symbol, unsigned char source[], int
tester = atoi((char*) source); tester = atoi((char*) source);
if ((tester < 3) || (tester > 131070)) { if ((tester < 3) || (tester > 131070)) {
strcpy(symbol->errtxt, "352: Data out of range"); strcpy(symbol->errtxt, "352: Data out of range (3 to 131070)");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
@ -122,7 +122,7 @@ static int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], c
tester = atoi((char*) source); tester = atoi((char*) source);
if ((tester < 4) || (tester > 64570080)) { if ((tester < 4) || (tester > 64570080)) {
strcpy(symbol->errtxt, "353: Data out of range"); strcpy(symbol->errtxt, "353: Data out of range (4 to 64570080)");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
error_number = 0; error_number = 0;
@ -162,7 +162,7 @@ INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int
strcpy(height_pattern, ""); strcpy(height_pattern, "");
if (length > 8) { if (length > 8) {
strcpy(symbol->errtxt, "354: Input too long"); strcpy(symbol->errtxt, "354: Input too long (8 character maximum");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
error_number = is_sane(NEON, source, length); error_number = is_sane(NEON, source, length);
@ -203,13 +203,13 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len
strcpy(dest, ""); strcpy(dest, "");
if (length > 60) { /* No stack smashing please */ if (length > 60) { /* No stack smashing please */
strcpy(symbol->errtxt, "356: Input too long"); strcpy(symbol->errtxt, "356: Input too long (60 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
/* BS EN 798:1995 4.2 "'Codabar' symbols shall consist of ... b) start character; /* BS EN 798:1995 4.2 "'Codabar' symbols shall consist of ... b) start character;
* c) one or more symbol characters representing data ... d) stop character ..." */ * c) one or more symbol characters representing data ... d) stop character ..." */
if (length < 3) { if (length < 3) {
strcpy(symbol->errtxt, "362: Input too short"); strcpy(symbol->errtxt, "362: Input too short (3 character minimum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
to_upper(source); to_upper(source);
@ -229,7 +229,11 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len
/* And must not use A, B, C or D otherwise (BS EN 798:1995 4.3.2) */ /* And must not use A, B, C or D otherwise (BS EN 798:1995 4.3.2) */
error_number = is_sane(CALCIUM_INNER, source + 1, length - 2); error_number = is_sane(CALCIUM_INNER, source + 1, length - 2);
if (error_number) { if (error_number) {
strcpy(symbol->errtxt, "363: Cannot contain \"A\", \"B\", \"C\" or \"D\""); if (is_sane(CALCIUM, source + 1, length - 2) == 0) {
strcpy(symbol->errtxt, "363: Cannot contain \"A\", \"B\", \"C\" or \"D\"");
} else {
strcpy(symbol->errtxt, "357: Invalid characters in data");
}
return error_number; return error_number;
} }
@ -268,7 +272,7 @@ INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int leng
/* Validate the input */ /* Validate the input */
if (length > 8) { if (length > 8) {
strcpy(symbol->errtxt, "360: Input too long"); strcpy(symbol->errtxt, "360: Input too long (8 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
error_number = is_sane(NEON, source, length); error_number = is_sane(NEON, source, length);

View File

@ -79,7 +79,7 @@ static void test_checks(int index, int debug) {
/* 19*/ { 5, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_C25STANDARD }, /* 19*/ { 5, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_C25STANDARD },
/* 20*/ { 12, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_EANX }, /* 20*/ { 12, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_EANX },
/* 21*/ { 12, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, /* 21*/ { 12, "1", -1, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 22*/ { 19, "1", -1, -1, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short", BARCODE_CODABAR }, /* 22*/ { 19, "1", -1, -1, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short (3 character minimum)", BARCODE_CODABAR },
/* 23*/ { 19, "A1B", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR }, /* 23*/ { 19, "A1B", -1, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR },
/* 24*/ { 19, "A1B", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 }, /* 24*/ { 19, "A1B", -1, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 },
/* 25*/ { 26, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_UPCA }, /* 25*/ { 26, "1", -1, -1, -1, -1, -1, 0, "", BARCODE_UPCA },

View File

@ -158,7 +158,7 @@ Administration privileges) is to create two sub-directories in
"zlib\zlib.lib" and "lpng\build\Release\libpng16_static.lib" into "lib". "zlib\zlib.lib" and "lpng\build\Release\libpng16_static.lib" into "lib".
This example uses Qt 5.15.2 and component "MSVC 2017 32-bit" so install them and This example uses Qt 5.15.2 and component "MSVC 2019 32-bit" so install them and
add to path (your path may differ): add to path (your path may differ):
set "PATH=C:\Qt\5.15.2\msvc2019\bin;%PATH%" set "PATH=C:\Qt\5.15.2\msvc2019\bin;%PATH%"

View File

@ -25,4 +25,4 @@ cd $ZR\..\lpng
nmake -f scripts\makefile.vcwin32 nmake -f scripts\makefile.vcwin32
-> generates $ZR\..\lpng\libpng.lib -> generates $ZR\..\lpng\libpng.lib
c) open zint_cmdline_vc6.dsp in this folder with the msvc6 gui and compile c) open zint_cmdline_vc6.dsw in this folder with the msvc6 gui and compile