From 4561a6606761903841b7909a9000e5a6c0e0c671 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Fri, 28 Oct 2016 22:40:40 +0100 Subject: [PATCH] Add identifiers to error messages To ease the debug process --- backend/2of5.c | 32 +++++++++++------------ backend/auspost.c | 10 ++++---- backend/aztec.c | 18 ++++++------- backend/bmp.c | 2 +- backend/codablock.c | 8 +++--- backend/code.c | 32 +++++++++++------------ backend/code1.c | 12 ++++----- backend/code128.c | 18 ++++++------- backend/code16k.c | 6 ++--- backend/code49.c | 6 ++--- backend/common.c | 6 ++--- backend/composite.c | 20 +++++++-------- backend/dmatrix.c | 16 ++++++------ backend/dotcode.c | 4 +-- backend/gif.c | 2 +- backend/gridmtx.c | 6 ++--- backend/gs1.c | 24 +++++++++--------- backend/hanxin.c | 4 +-- backend/imail.c | 8 +++--- backend/library.c | 62 ++++++++++++++++++++++----------------------- backend/maxicode.c | 8 +++--- backend/medical.c | 24 +++++++++--------- backend/pcx.c | 2 +- backend/pdf417.c | 24 +++++++++--------- backend/plessey.c | 16 ++++++------ backend/png.c | 12 ++++----- backend/postal.c | 36 +++++++++++++------------- backend/ps.c | 10 ++++---- backend/qr.c | 18 ++++++------- backend/raster.c | 20 +++++++-------- backend/rss.c | 14 +++++----- backend/svg.c | 10 ++++---- backend/telepen.c | 10 ++++---- backend/upcean.c | 46 ++++++++++++++++----------------- frontend/main.c | 48 +++++++++++++++++------------------ 35 files changed, 296 insertions(+), 298 deletions(-) diff --git a/backend/2of5.c b/backend/2of5.c index 1f336a97..bf1805d5 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -67,12 +67,12 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l error_number = 0; if (length > 80) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C01)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C02)"); return error_number; } @@ -100,12 +100,12 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i error_number = 0; if (length > 45) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C03)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid character in data"); + strcpy(symbol->errtxt, "Invalid character in data (C04)"); return error_number; } @@ -132,12 +132,12 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len error_number = 0; if (length > 45) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C05)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C06)"); return error_number; } @@ -165,12 +165,12 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le error_number = 0; if (length > 80) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C07)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C08)"); return error_number; } @@ -203,12 +203,12 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour error_number = 0; if (length > 89) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C09)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C0A)"); return error_number; } @@ -263,13 +263,13 @@ int itf14(struct zint_symbol *symbol, unsigned char source[], int length) { count = 0; if (length > 13) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C0B)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid character in data"); + strcpy(symbol->errtxt, "Invalid character in data (C0D)"); return error_number; } @@ -305,12 +305,12 @@ int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; count = 0; if (length > 13) { - strcpy(symbol->errtxt, "Input wrong length"); + strcpy(symbol->errtxt, "Input wrong length (C0E)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C0D)"); return error_number; } @@ -341,12 +341,12 @@ int dpident(struct zint_symbol *symbol, unsigned char source[], int length) { count = 0; if (length > 11) { - strcpy(symbol->errtxt, "Input wrong length"); + strcpy(symbol->errtxt, "Input wrong length (C0E)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C0F)"); return error_number; } diff --git a/backend/auspost.c b/backend/auspost.c index c1808b68..d757bfa8 100644 --- a/backend/auspost.c +++ b/backend/auspost.c @@ -138,16 +138,16 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt error_number = is_sane(NEON, source, length); break; default: - strcpy(symbol->errtxt, "Auspost input is wrong length"); + strcpy(symbol->errtxt, "Auspost input is wrong length (D01)"); return ZINT_ERROR_TOO_LONG; } if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D02)"); return error_number; } } else { if (length > 8) { - strcpy(symbol->errtxt, "Auspost input is too long"); + strcpy(symbol->errtxt, "Auspost input is too long (D03)"); return ZINT_ERROR_TOO_LONG; } switch (symbol->symbology) { @@ -169,7 +169,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt h = strlen(localstr); error_number = is_sane(GDSET, (unsigned char *) localstr, h); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D04)"); return error_number; } @@ -178,7 +178,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt dpid[8] = '\0'; error_number = is_sane(NEON, (unsigned char *) dpid, strlen(dpid)); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in DPID"); + strcpy(symbol->errtxt, "Invalid characters in DPID (D05)"); return error_number; } diff --git a/backend/aztec.c b/backend/aztec.c index 46dc9c21..c59836ac 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -907,7 +907,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { comp_loop = 1; } if (gs1 && reader) { - strcpy(symbol->errtxt, "Cannot encode in GS1 and Reader Initialisation mode at the same time"); + strcpy(symbol->errtxt, "Cannot encode in GS1 and Reader Initialisation mode at the same time (E01)"); return ZINT_ERROR_INVALID_OPTION; } @@ -916,12 +916,12 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { err_code = aztec_text_process(source, length, binary_string, gs1, symbol->eci); if (err_code != 0) { - strcpy(symbol->errtxt, "Input too long or too many extended ASCII characters"); + strcpy(symbol->errtxt, "Input too long or too many extended ASCII characters (E02)"); return err_code; } if (!((symbol->option_1 >= -1) && (symbol->option_1 <= 4))) { - strcpy(symbol->errtxt, "Invalid error correction level - using default instead"); + strcpy(symbol->errtxt, "Invalid error correction level - using default instead (E03)"); err_code = ZINT_WARN_INVALID_OPTION; symbol->option_1 = -1; } @@ -1009,7 +1009,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { } if (layers == 0) { /* Couldn't find a symbol which fits the data */ - strcpy(symbol->errtxt, "Input too long (too many bits for selected ECC)"); + strcpy(symbol->errtxt, "Input too long (too many bits for selected ECC) (E04)"); return ZINT_ERROR_TOO_LONG; } @@ -1201,7 +1201,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { } if (adjusted_length > data_maxsize) { - strcpy(symbol->errtxt, "Data too long for specified Aztec Code symbol size"); + strcpy(symbol->errtxt, "Data too long for specified Aztec Code symbol size (E05)"); return ZINT_ERROR_TOO_LONG; } @@ -1218,7 +1218,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { } if (reader && (layers > 22)) { - strcpy(symbol->errtxt, "Data too long for reader initialisation symbol"); + strcpy(symbol->errtxt, "Data too long for reader initialisation symbol (E06)"); return ZINT_ERROR_TOO_LONG; } @@ -1558,12 +1558,12 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length) error_number = 0; input_value = 0; if (length > 3) { - strcpy(symbol->errtxt, "Input too large"); + strcpy(symbol->errtxt, "Input too large (E07)"); return ZINT_ERROR_INVALID_DATA; } error_number = is_sane(NEON, source, length); if (error_number != 0) { - strcpy(symbol->errtxt, "Invalid characters in input"); + strcpy(symbol->errtxt, "Invalid characters in input (E08)"); return ZINT_ERROR_INVALID_DATA; } switch (length) { @@ -1579,7 +1579,7 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length) } if (input_value > 255) { - strcpy(symbol->errtxt, "Input too large"); + strcpy(symbol->errtxt, "Input too large (E09)"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/bmp.c b/backend/bmp.c index f816488d..a5308e2e 100644 --- a/backend/bmp.c +++ b/backend/bmp.c @@ -129,7 +129,7 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { bmp_file = stdout; } else { if (!(bmp_file = fopen(symbol->outfile, "wb"))) { - strcpy(symbol->errtxt, "Can't open output file"); + strcpy(symbol->errtxt, "Can't open output file (F00)"); return ZINT_ERROR_FILE_ACCESS; } } diff --git a/backend/codablock.c b/backend/codablock.c index 771d84a4..8c47c1ea 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -641,18 +641,18 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) { /* option1: rows 0: automatic, 1..44 */ rows = symbol->option_1; if (rows > 44) { - strcpy(symbol->errtxt, "Row parameter not in 0..44"); + strcpy(symbol->errtxt, "Row parameter not in 0..44 (D10)"); return ZINT_ERROR_INVALID_OPTION; } /* option_2: (usable data) columns: 0: automatic, 6..66 */ columns = symbol->option_2; if ( ! (columns <= 0 || (columns >= 6 && columns <=66)) ) { - strcpy(symbol->errtxt, "Columns parameter not in 0,6..66"); + strcpy(symbol->errtxt, "Columns parameter not in 0,6..66 (D11)"); return ZINT_ERROR_INVALID_OPTION; } /* GS1 not implemented */ if (symbol->input_mode == GS1_MODE) { - strcpy(symbol->errtxt, "GS1 mode not supported"); + strcpy(symbol->errtxt, "GS1 mode not supported (D12)"); return ZINT_ERROR_INVALID_OPTION; } #ifndef _MSC_VER @@ -714,7 +714,7 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) { Error=Columns2Rows(T,data,dataLength,&rows,&useColumns,pSet,&fillings); } if (Error != 0) { - strcpy(symbol->errtxt, "data string to long"); + strcpy(symbol->errtxt, "data string to long (D13)"); return Error; } /* Checksum */ diff --git a/backend/code.c b/backend/code.c index 26cd37ae..f83f2ed5 100644 --- a/backend/code.c +++ b/backend/code.c @@ -115,12 +115,12 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /* error_number = 0; if (length > 121) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C20)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(SODIUM, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C21)"); return error_number; } c_weight = 1; @@ -203,16 +203,16 @@ int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length) } if ((symbol->symbology == BARCODE_LOGMARS) && (length > 59)) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C22)"); return ZINT_ERROR_TOO_LONG; } else if (length > 74) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C23)"); return ZINT_ERROR_TOO_LONG; } to_upper(source); error_number = is_sane(SILVER, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C24)"); return error_number; } @@ -302,12 +302,12 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length count = 0; if (length > 6) { - strcpy(symbol->errtxt, "Input wrong length"); + strcpy(symbol->errtxt, "Input wrong length (C25)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C26)"); return error_number; } @@ -328,7 +328,7 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length localstr[7] = itoc(check_digit); localstr[8] = '\0'; if (localstr[7] == 'A') { - strcpy(symbol->errtxt, "Invalid PZN Data"); + strcpy(symbol->errtxt, "Invalid PZN Data (C27)"); return ZINT_ERROR_INVALID_DATA; } error_number = c39(symbol, (unsigned char *) localstr, strlen(localstr)); @@ -347,7 +347,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if (length > 74) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C28)"); return ZINT_ERROR_TOO_LONG; } @@ -355,7 +355,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length) { for (i = 0; i < (unsigned int) length; i++) { if (source[i] > 127) { /* Cannot encode extended ASCII */ - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (C29)"); return ZINT_ERROR_INVALID_DATA; } strcat((char*) buffer, EC39Ctrl[source[i]]); @@ -388,7 +388,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) { strcpy(buffer, ""); if (length > 107) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C2A)"); return ZINT_ERROR_TOO_LONG; } @@ -396,7 +396,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) { for (i = 0; i < length; i++) { if (source[i] > 127) { /* Cannot encode extended ASCII */ - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (C2B)"); return ZINT_ERROR_INVALID_DATA; } strcat(buffer, C93Ctrl[source[i]]); @@ -406,7 +406,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) { /* Now we can check the true length of the barcode */ h = (int) strlen(buffer); if (h > 107) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C2C)"); return ZINT_ERROR_TOO_LONG; } @@ -521,12 +521,12 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length) target_value = 0; if (length > 7) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C2D)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C2E)"); return error_number; } @@ -574,7 +574,7 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length) break; } if (range) { - strcpy(symbol->errtxt, "Value out of range"); + strcpy(symbol->errtxt, "Value out of range (C2F)"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/code1.c b/backend/code1.c index a6d9e4e8..c48bb71f 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -1026,7 +1026,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t if (tp > 1480) { /* Data is too large for symbol */ - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E10)"); return 0; } } while (sp < length); @@ -1171,7 +1171,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t /* Re-check length of data */ if (tp > 1480) { /* Data is too large for symbol */ - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E11)"); return 0; } /* @@ -1204,7 +1204,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) { int sub_version = 0; if ((symbol->option_2 < 0) || (symbol->option_2 > 10)) { - strcpy(symbol->errtxt, "Invalid symbol size"); + strcpy(symbol->errtxt, "Invalid symbol size (E12)"); return ZINT_ERROR_INVALID_OPTION; } @@ -1217,11 +1217,11 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) { int block_width; if (length > 18) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E13)"); return ZINT_ERROR_TOO_LONG; } if (is_sane(NEON, source, length) == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid input data (Version S encodes numeric input only)"); + strcpy(symbol->errtxt, "Invalid input data (Version S encodes numeric input only) (E14)"); return ZINT_ERROR_INVALID_DATA; } @@ -1331,7 +1331,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) { } if (data_length > 38) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E15)"); return ZINT_ERROR_TOO_LONG; } diff --git a/backend/code128.c b/backend/code128.c index 1f81af9e..db2b784a 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -310,7 +310,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) { if (sourcelen > 160) { /* This only blocks rediculously long input - the actual length of the resulting barcode depends on the type of data, so this is trapped later */ - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C40)"); return ZINT_ERROR_TOO_LONG; } @@ -482,7 +482,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) { } } if (glyph_count > 60.0) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C41)"); return ZINT_ERROR_TOO_LONG; } @@ -707,13 +707,13 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t len if (length > 160) { /* This only blocks rediculously long input - the actual length of the resulting barcode depends on the type of data, so this is trapped later */ - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C42)"); return ZINT_ERROR_TOO_LONG; } for (i = 0; i < length; i++) { if (source[i] == '\0') { /* Null characters not allowed! */ - strcpy(symbol->errtxt, "NULL character in input data"); + strcpy(symbol->errtxt, "NULL character in input data (C43)"); return ZINT_ERROR_INVALID_DATA; } } @@ -843,7 +843,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t len } } if (glyph_count > 60.0) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C44)"); return ZINT_ERROR_TOO_LONG; } @@ -1010,13 +1010,13 @@ int nve_18(struct zint_symbol *symbol, unsigned char source[], int length) { sourcelen = length; if (sourcelen > 17) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C45)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C46)"); return error_number; } zeroes = 17 - sourcelen; @@ -1051,13 +1051,13 @@ int ean_14(struct zint_symbol *symbol, unsigned char source[], int length) { unsigned char ean128_equiv[20]; if (length > 13) { - strcpy(symbol->errtxt, "Input wrong length"); + strcpy(symbol->errtxt, "Input wrong length (C47)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid character in data"); + strcpy(symbol->errtxt, "Invalid character in data (C48)"); return error_number; } diff --git a/backend/code16k.c b/backend/code16k.c index 1db0cb54..cbef7153 100644 --- a/backend/code16k.c +++ b/backend/code16k.c @@ -278,7 +278,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length) { } if (input_length > 157) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D20)"); return ZINT_ERROR_TOO_LONG; } @@ -477,7 +477,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length) { } if (glyph_count > 77.0) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D21)"); return ZINT_ERROR_TOO_LONG; } @@ -509,7 +509,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length) { m = 5; } if (gs1) { - strcpy(symbol->errtxt, "Cannot use both GS1 mode and Reader Initialisation"); + strcpy(symbol->errtxt, "Cannot use both GS1 mode and Reader Initialisation (D22)"); return ZINT_ERROR_INVALID_OPTION; } else { if ((set[0] == 'B') && (set[1] == 'C')) { diff --git a/backend/code49.c b/backend/code49.c index 9caa0484..2a8784ef 100644 --- a/backend/code49.c +++ b/backend/code49.c @@ -52,7 +52,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length size_t h; if (length > 81) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D30)"); return ZINT_ERROR_TOO_LONG; } if (symbol->input_mode == GS1_MODE) { @@ -64,7 +64,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length for (i = 0; i < length; i++) { if (source[i] > 127) { - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (D31)"); return ZINT_ERROR_INVALID_DATA; } if (gs1 && (source[i] == '[')) @@ -215,7 +215,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length } if (codeword_count > 49) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D32)"); return ZINT_ERROR_TOO_LONG; } diff --git a/backend/common.c b/backend/common.c index ad597a5f..b3c7eabe 100644 --- a/backend/common.c +++ b/backend/common.c @@ -238,11 +238,11 @@ int utf8toutf16(struct zint_symbol *symbol, const unsigned char source[], int va jpos++; } else { if ((source[bpos] >= 0x80) && (source[bpos] <= 0xbf)) { - strcpy(symbol->errtxt, "Corrupt Unicode data"); + strcpy(symbol->errtxt, "Corrupt Unicode data (B40)"); return ZINT_ERROR_INVALID_DATA; } if ((source[bpos] >= 0xc0) && (source[bpos] <= 0xc1)) { - strcpy(symbol->errtxt, "Overlong encoding not supported"); + strcpy(symbol->errtxt, "Overlong encoding not supported (B41)"); return ZINT_ERROR_INVALID_DATA; } @@ -259,7 +259,7 @@ int utf8toutf16(struct zint_symbol *symbol, const unsigned char source[], int va jpos++; } else if (source[bpos] >= 0xf0) { - strcpy(symbol->errtxt, "Unicode sequences of more than 3 bytes not supported"); + strcpy(symbol->errtxt, "Unicode sequences of more than 3 bytes not supported (B42)"); return ZINT_ERROR_INVALID_DATA; } } diff --git a/backend/composite.c b/backend/composite.c index e75df18f..5751e463 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -1170,7 +1170,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar if (!(((ninety[i] >= '0') && (ninety[i] <= '9')) || ((ninety[i] >= 'A') && (ninety[i] <= 'Z')))) { if ((ninety[i] != '*') && (ninety[i] != ',') && (ninety[i] != '-') && (ninety[i] != '.') && (ninety[i] != '/')) { /* An Invalid AI 90 character */ - strcpy(symbol->errtxt, "Invalid AI 90 data"); + strcpy(symbol->errtxt, "Invalid AI 90 data (D40)"); return ZINT_ERROR_INVALID_DATA; } } @@ -1529,7 +1529,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar if (latch == 1) { /* Invalid characters in input data */ - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (D41)"); return ZINT_ERROR_INVALID_DATA; } @@ -1735,7 +1735,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar } if (target_bitsize == 0) { - strcpy(symbol->errtxt, "Input too long for selected 2d component"); + strcpy(symbol->errtxt, "Input too long for selected 2d component (D42)"); return ZINT_ERROR_TOO_LONG; } @@ -1778,7 +1778,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar } if (strlen(binary_string) > 11805) { /* (2361 * 5) */ - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D43)"); return ZINT_ERROR_TOO_LONG; } @@ -1797,7 +1797,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar } if (target_bitsize == 0) { - strcpy(symbol->errtxt, "Input too long for selected 2d component"); + strcpy(symbol->errtxt, "Input too long for selected 2d component (D44)"); return ZINT_ERROR_TOO_LONG; } @@ -1914,19 +1914,19 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; pri_len = strlen(symbol->primary); if (pri_len == 0) { - strcpy(symbol->errtxt, "No primary (linear) message in 2D composite"); + strcpy(symbol->errtxt, "No primary (linear) message in 2D composite (D45)"); return ZINT_ERROR_INVALID_OPTION; } if (length > 2990) { - strcpy(symbol->errtxt, "2D component input data too long"); + strcpy(symbol->errtxt, "2D component input data too long (D46)"); return ZINT_ERROR_TOO_LONG; } cc_mode = symbol->option_1; if ((cc_mode == 3) && (symbol->symbology != BARCODE_EAN128_CC)) { /* CC-C can only be used with a GS1-128 linear part */ - strcpy(symbol->errtxt, "Invalid mode (CC-C only valid with GS1-128 linear component)"); + strcpy(symbol->errtxt, "Invalid mode (CC-C only valid with GS1-128 linear component) (D47)"); return ZINT_ERROR_INVALID_OPTION; } @@ -1939,7 +1939,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { /* Do a test run of encoding the linear component to establish its width */ linear_width = linear_dummy_run((unsigned char *) symbol->primary, pri_len); if (linear_width == 0) { - strcpy(symbol->errtxt, "Invalid data"); + strcpy(symbol->errtxt, "Invalid data (D48)"); return ZINT_ERROR_INVALID_DATA; } } @@ -2065,7 +2065,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { if (error_number != 0) { strcpy(symbol->errtxt, linear->errtxt); - strcat(symbol->errtxt, " in linear component"); + strcat(symbol->errtxt, " in linear component "); ZBarcode_Delete(linear); return error_number; } diff --git a/backend/dmatrix.c b/backend/dmatrix.c index d4b08039..283ef947 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -45,10 +45,10 @@ #include #include #ifdef _MSC_VER -#include -/* ceilf (C99) not before MSVC++2013 (C++ 12.0) */ -#if _MSC_VER < 1800 -#define ceilf ceil +#include +/* ceilf (C99) not before MSVC++2013 (C++ 12.0) */ +#if _MSC_VER < 1800 +#define ceilf ceil #endif #endif #include "reedsol.h" @@ -563,7 +563,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], if (symbol->output_options & READER_INIT) { if (gs1) { - strcpy(symbol->errtxt, "Cannot encode in GS1 mode and Reader Initialisation at the same time"); + strcpy(symbol->errtxt, "Cannot encode in GS1 mode and Reader Initialisation at the same time (E10)"); return ZINT_ERROR_INVALID_OPTION; } else { target[tp] = 234; @@ -1157,7 +1157,7 @@ int data_matrix_200(struct zint_symbol *symbol, const unsigned char source[], co binlen = dm200encode(symbol, source, binary, &last_mode, &inputlen, process_buffer, &process_p); if (binlen == 0) { - strcpy(symbol->errtxt, "Data too long to fit in symbol"); + strcpy(symbol->errtxt, "Data too long to fit in symbol (E11)"); return ZINT_ERROR_TOO_LONG; } @@ -1193,7 +1193,7 @@ int data_matrix_200(struct zint_symbol *symbol, const unsigned char source[], co if (optionsize != -1) { /* flag an error */ error_number = ZINT_WARN_INVALID_OPTION; - strcpy(symbol->errtxt, "Data does not fit in selected symbol size"); + strcpy(symbol->errtxt, "Data does not fit in selected symbol size (E12)"); } } @@ -1302,7 +1302,7 @@ int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const int error_number = data_matrix_200(symbol, source, in_length); } else { /* ECC 000 - 140 */ - strcpy(symbol->errtxt, "Older Data Matrix standards are no longer supported"); + strcpy(symbol->errtxt, "Older Data Matrix standards are no longer supported (E13)"); error_number = ZINT_ERROR_INVALID_OPTION; } diff --git a/backend/dotcode.c b/backend/dotcode.c index 289e548e..2d294d86 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -1090,7 +1090,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length } if ((height > 200) || (width > 200)) { - strcpy(symbol->errtxt, "Specified symbol size is too large"); + strcpy(symbol->errtxt, "Specified symbol size is too large (E20)"); return ZINT_ERROR_INVALID_OPTION; } @@ -1124,7 +1124,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length if (data_length > 450) { // Larger data sets than this cause rsencode() to throw SIGSEGV // This should probably be fixed by somebody who understands what rsencode() does... - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (E21)"); return ZINT_ERROR_TOO_LONG; } diff --git a/backend/gif.c b/backend/gif.c index 0883620f..089b0a89 100644 --- a/backend/gif.c +++ b/backend/gif.c @@ -286,7 +286,7 @@ int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { gif_file = stdout; } else { if (!(gif_file = fopen(symbol->outfile, "wb"))) { - strcpy(symbol->errtxt, "Can't open output file"); + strcpy(symbol->errtxt, "Can't open output file (F10)"); return ZINT_ERROR_FILE_ACCESS; } } diff --git a/backend/gridmtx.c b/backend/gridmtx.c index 19e694ca..0dd394c1 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -1088,7 +1088,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int le j++; } while ((j < 7445) && (glyph == 0)); if (glyph == 0) { - strcpy(symbol->errtxt, "Invalid character in input data"); + strcpy(symbol->errtxt, "Invalid character in input data (E30)"); return ZINT_ERROR_INVALID_DATA; } gbdata[i] = glyph; @@ -1100,7 +1100,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int le error_number = gm_encode(gbdata, length, binary, reader, symbol->eci); if (error_number != 0) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E31)"); return error_number; } @@ -1187,7 +1187,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int le } if (data_cw > data_max) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E32)"); return ZINT_ERROR_TOO_LONG; } diff --git a/backend/gs1.c b/backend/gs1.c index 6102584a..785bfc08 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -79,17 +79,17 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const s /* Detect extended ASCII characters */ for (i = 0; i < src_len; i++) { if (source[i] >= 128) { - strcpy(symbol->errtxt, "Extended ASCII characters are not supported by GS1"); + strcpy(symbol->errtxt, "Extended ASCII characters are not supported by GS1 (B50)"); return ZINT_ERROR_INVALID_DATA; } if (source[i] < 32) { - strcpy(symbol->errtxt, "Control characters are not supported by GS1"); + strcpy(symbol->errtxt, "Control characters are not supported by GS1 (B51)"); return ZINT_ERROR_INVALID_DATA; } } if (source[0] != '[') { - strcpy(symbol->errtxt, "Data does not start with an AI"); + strcpy(symbol->errtxt, "Data does not start with an AI (B52)"); return ZINT_ERROR_INVALID_DATA; } @@ -129,31 +129,31 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const s if (bracket_level != 0) { /* Not all brackets are closed */ - strcpy(symbol->errtxt, "Malformed AI in input data (brackets don\'t match)"); + strcpy(symbol->errtxt, "Malformed AI in input data (brackets don\'t match) (B53)"); return ZINT_ERROR_INVALID_DATA; } if (max_bracket_level > 1) { /* Nested brackets */ - strcpy(symbol->errtxt, "Found nested brackets in input data"); + strcpy(symbol->errtxt, "Found nested brackets in input data (B54)"); return ZINT_ERROR_INVALID_DATA; } if (max_ai_length > 4) { /* AI is too long */ - strcpy(symbol->errtxt, "Invalid AI in input data (AI too long)"); + strcpy(symbol->errtxt, "Invalid AI in input data (AI too long) (B55)"); return ZINT_ERROR_INVALID_DATA; } if (min_ai_length <= 1) { /* AI is too short */ - strcpy(symbol->errtxt, "Invalid AI in input data (AI too short)"); + strcpy(symbol->errtxt, "Invalid AI in input data (AI too short) (B56)"); return ZINT_ERROR_INVALID_DATA; } if (ai_latch == 1) { /* Non-numeric data in AI */ - strcpy(symbol->errtxt, "Invalid AI in input data (non-numeric characters in AI)"); + strcpy(symbol->errtxt, "Invalid AI in input data (non-numeric characters in AI) (B57)"); return ZINT_ERROR_INVALID_DATA; } @@ -190,7 +190,7 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const s for (i = 0; i < ai_count; i++) { if (data_length[i] == 0) { /* No data for given AI */ - strcpy(symbol->errtxt, "Empty data field in input data"); + strcpy(symbol->errtxt, "Empty data field in input data (B58)"); return ZINT_ERROR_INVALID_DATA; } } @@ -286,13 +286,13 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const s } if (error_latch == 5) { - strcpy(symbol->errtxt, "Invalid data length for AI "); + strcpy(symbol->errtxt, "Invalid data length for AI (B59)"); strcat(symbol->errtxt, ai_string); return ZINT_ERROR_INVALID_DATA; } if (error_latch == 6) { - strcpy(symbol->errtxt, "Invalid AI value "); + strcpy(symbol->errtxt, "Invalid AI value (B60)"); strcat(symbol->errtxt, ai_string); return ZINT_ERROR_INVALID_DATA; } @@ -353,6 +353,6 @@ int ugs1_verify(struct zint_symbol *symbol, const unsigned char source[], const ustrcpy(reduced, (unsigned char*) temp); return 0; } - strcpy(symbol->errtxt, "ugs1_verify overflow"); + strcpy(symbol->errtxt, "ugs1_verify overflow (B61)"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/hanxin.c b/backend/hanxin.c index 342aa4a2..cc393030 100644 --- a/backend/hanxin.c +++ b/backend/hanxin.c @@ -1363,7 +1363,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length j++; } while ((j < 6793) && (glyph == 0)); if (glyph == 0) { - strcpy(symbol->errtxt, "Unknown character in input data"); + strcpy(symbol->errtxt, "Unknown character in input data (E40)"); return ZINT_ERROR_INVALID_DATA; } else { gbdata[posn] = glyph; @@ -1434,7 +1434,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length } if (version == 85) { - strcpy(symbol->errtxt, "Input too long for selected error correction level"); + strcpy(symbol->errtxt, "Input too long for selected error correction level (E41)"); return ZINT_ERROR_TOO_LONG; } diff --git a/backend/imail.c b/backend/imail.c index b0c94cba..3753cefd 100644 --- a/backend/imail.c +++ b/backend/imail.c @@ -271,12 +271,12 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if (length > 32) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D50)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(SODIUM, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D51)"); return error_number; } @@ -311,11 +311,11 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { } if (strlen(tracker) != 20) { - strcpy(symbol->errtxt, "Invalid length tracking code"); + strcpy(symbol->errtxt, "Invalid length tracking code (D52)"); return ZINT_ERROR_INVALID_DATA; } if (strlen(zip) > 11) { - strcpy(symbol->errtxt, "Invalid ZIP code"); + strcpy(symbol->errtxt, "Invalid ZIP code (D53)"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/library.c b/backend/library.c index fb688784..d5fe747a 100644 --- a/backend/library.c +++ b/backend/library.c @@ -243,7 +243,7 @@ int dump_plot(struct zint_symbol *symbol) { } else { f = fopen(symbol->outfile, "w"); if (!f) { - strcpy(symbol->errtxt, "Could not open output file"); + strcpy(symbol->errtxt, "Could not open output file (B01)"); return ZINT_ERROR_FILE_ACCESS; } } @@ -290,13 +290,13 @@ static int hibc(struct zint_symbol *symbol, unsigned char source[], size_t lengt /* without "+" and check: max 110 characters in HIBC 2.6 */ if (length > 110) { - strcpy(symbol->errtxt, "Data too long for HIBC LIC"); + strcpy(symbol->errtxt, "Data too long for HIBC LIC (B02)"); return ZINT_ERROR_TOO_LONG; } to_upper(source); error_number = is_sane(TECHNETIUM, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (B03)"); return error_number; } @@ -543,7 +543,6 @@ int ZBarcode_ValidID(int symbol_id) { case BARCODE_RM4SCC: case BARCODE_DATAMATRIX: case BARCODE_EAN14: - case BARCODE_EAN14_CHK: case BARCODE_NVE18: case BARCODE_JAPANPOST: case BARCODE_KOREAPOST: @@ -646,7 +645,7 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour case UNICODE_MODE: error_number = utf_to_eci(symbol->eci, source, preprocessed, &in_length); if (error_number != 0) { - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (B04)"); return error_number; } break; @@ -763,7 +762,6 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour case BARCODE_DAFT: error_number = daft_code(symbol, preprocessed, in_length); break; case BARCODE_EAN14: - case BARCODE_EAN14_CHK: error_number = ean_14(symbol, preprocessed, in_length); break; case BARCODE_AZRUNE: error_number = aztec_runes(symbol, preprocessed, in_length); @@ -820,7 +818,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt length = (int) ustrlen(source); } if (length == 0) { - strcpy(symbol->errtxt, "No input data"); + strcpy(symbol->errtxt, "No input data (B05)"); error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA); return ZINT_ERROR_INVALID_DATA; } @@ -840,7 +838,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt /* First check the symbology field */ if (symbol->symbology < 1) { - strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); + strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B06)"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; } @@ -859,7 +857,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt symbol->symbology = BARCODE_UPCA; } if (symbol->symbology == 19) { - strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar"); + strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar (B07)"); symbol->symbology = BARCODE_CODABAR; error_number = ZINT_WARN_INVALID_OPTION; } @@ -867,7 +865,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt symbol->symbology = BARCODE_UPCA; } if (symbol->symbology == 27) { - strcpy(symbol->errtxt, "UPCD1 not supported"); + strcpy(symbol->errtxt, "UPCD1 not supported (B08)"); error_number = ZINT_ERROR_INVALID_OPTION; } if (symbol->symbology == 33) { @@ -889,7 +887,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt symbol->symbology = BARCODE_NVE18; } if (symbol->symbology == 54) { - strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128"); + strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128 (B10)"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; } @@ -903,7 +901,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt symbol->symbology = BARCODE_AUSPOST; } if (symbol->symbology == 73) { - strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); + strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B11)"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; } @@ -917,12 +915,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt symbol->symbology = BARCODE_EAN128; } if (symbol->symbology == 91) { - strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); + strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B12)"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; } if ((symbol->symbology >= 94) && (symbol->symbology <= 96)) { - strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); + strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B13)"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; } @@ -948,7 +946,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt symbol->symbology = BARCODE_HIBC_BLOCKF; } if ((symbol->symbology == 113) || (symbol->symbology == 114)) { - strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); + strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B14)"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; } @@ -956,13 +954,13 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt symbol->symbology = BARCODE_DOTCODE; } if ((symbol->symbology >= 117) && (symbol->symbology <= 127)) { - strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); + strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B15)"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; } /* Everything from 128 up is Zint-specific */ if (symbol->symbology >= 143) { - strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); + strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B16)"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; } @@ -975,12 +973,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt } if ((!(supports_eci(symbol->symbology))) && (symbol->eci != 3)) { - strcpy(symbol->errtxt, "Symbology does not support ECI switching"); + strcpy(symbol->errtxt, "Symbology does not support ECI switching (B17)"); error_number = ZINT_ERROR_INVALID_OPTION; } if ((symbol->eci < 3) || (symbol->eci > 26) || (symbol->eci == 14) || (symbol->eci == 19) || (symbol->eci == 25)) { - strcpy(symbol->errtxt, "Invalid or unsupported ECI mode"); + strcpy(symbol->errtxt, "Invalid or unsupported ECI mode (B18)"); error_number = ZINT_ERROR_INVALID_OPTION; } @@ -991,7 +989,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt if (symbol->input_mode == GS1_MODE) { for (i = 0; i < length; i++) { if (source[i] == '\0') { - strcpy(symbol->errtxt, "NULL characters not permitted in GS1 mode"); + strcpy(symbol->errtxt, "NULL characters not permitted in GS1 mode (B19)"); return ZINT_ERROR_INVALID_DATA; } } @@ -1002,7 +1000,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt } length = ustrlen(local_source); } else { - strcpy(symbol->errtxt, "Selected symbology does not support GS1 mode"); + strcpy(symbol->errtxt, "Selected symbology does not support GS1 mode (B20)"); return ZINT_ERROR_INVALID_OPTION; } } else { @@ -1011,7 +1009,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt } if ((symbol->dot_size < 0.01) || (symbol->dot_size > 20.0)) { - strcpy(symbol->errtxt, "Invalid dot size"); + strcpy(symbol->errtxt, "Invalid dot size (B21)"); return ZINT_ERROR_INVALID_OPTION; } @@ -1033,7 +1031,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt symbol->eci = get_best_eci(local_source, length); error_number = ZINT_WARN_USES_ECI; - strcpy(symbol->errtxt, "Encoded data includes ECI codes"); + strcpy(symbol->errtxt, "Encoded data includes ECI codes (B22)"); //printf("Data will encode with ECI %d\n", symbol->eci); switch (symbol->symbology) { @@ -1085,13 +1083,13 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) { case 270: break; default: - strcpy(symbol->errtxt, "Invalid rotation angle"); + strcpy(symbol->errtxt, "Invalid rotation angle (B23)"); return ZINT_ERROR_INVALID_OPTION; } if (symbol->output_options & BARCODE_DOTTY_MODE) { if (!(is_matrix(symbol->symbology))) { - strcpy(symbol->errtxt, "Selected symbology cannot be rendered as dots"); + strcpy(symbol->errtxt, "Selected symbology cannot be rendered as dots (B24)"); return ZINT_ERROR_INVALID_OPTION; } } @@ -1136,19 +1134,19 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) { if (!(strcmp(output, "SVG"))) { error_number = svg_plot(symbol); } else { - strcpy(symbol->errtxt, "Unknown output format"); + strcpy(symbol->errtxt, "Unknown output format (B25)"); error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION); return ZINT_ERROR_INVALID_OPTION; } } else { - strcpy(symbol->errtxt, "Unknown output format"); + strcpy(symbol->errtxt, "Unknown output format (B26)"); error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION); return ZINT_ERROR_INVALID_OPTION; } if (error_number == ZINT_ERROR_INVALID_OPTION) { /* If libpng is not installed */ - strcpy(symbol->errtxt, "Unknown output format"); + strcpy(symbol->errtxt, "Unknown output format (B27)"); } error_tag(symbol->errtxt, error_number); @@ -1165,7 +1163,7 @@ int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle) { case 270: break; default: - strcpy(symbol->errtxt, "Invalid rotation angle"); + strcpy(symbol->errtxt, "Invalid rotation angle (B28)"); return ZINT_ERROR_INVALID_OPTION; } @@ -1215,7 +1213,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) { } else { file = fopen(filename, "rb"); if (!file) { - strcpy(symbol->errtxt, "Unable to read input file"); + strcpy(symbol->errtxt, "Unable to read input file (B29)"); return ZINT_ERROR_INVALID_DATA; } @@ -1226,7 +1224,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) { if (fileLen > 7100) { /* The largest amount of data that can be encoded is 7089 numeric digits in QR Code */ - strcpy(symbol->errtxt, "Input file too long"); + strcpy(symbol->errtxt, "Input file too long (B30)"); fclose(file); return ZINT_ERROR_INVALID_DATA; } @@ -1235,7 +1233,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) { /* Allocate memory */ buffer = (unsigned char *) malloc(fileLen * sizeof (unsigned char)); if (!buffer) { - strcpy(symbol->errtxt, "Internal memory error"); + strcpy(symbol->errtxt, "Internal memory error (B31)"); if (strcmp(filename, "-")) fclose(file); return ZINT_ERROR_MEMORY; diff --git a/backend/maxicode.c b/backend/maxicode.c index 3e885bd3..a7687170 100644 --- a/backend/maxicode.c +++ b/backend/maxicode.c @@ -585,7 +585,7 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], int lengt } if ((mode < 2) || (mode > 6)) { /* Only codes 2 to 6 supported */ - strcpy(symbol->errtxt, "Invalid Maxicode Mode"); + strcpy(symbol->errtxt, "Invalid Maxicode Mode (E50)"); return ZINT_ERROR_INVALID_OPTION; } @@ -594,13 +594,13 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], int lengt lp = strlen(symbol->primary); } if (lp != 15) { - strcpy(symbol->errtxt, "Invalid Primary String"); + strcpy(symbol->errtxt, "Invalid Primary String (E51)"); return ZINT_ERROR_INVALID_DATA; } for (i = 9; i < 15; i++) { /* check that country code and service are numeric */ if ((symbol->primary[i] < '0') || (symbol->primary[i] > '9')) { - strcpy(symbol->errtxt, "Invalid Primary String"); + strcpy(symbol->errtxt, "Invalid Primary String (E52)"); return ZINT_ERROR_INVALID_DATA; } } @@ -643,7 +643,7 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], int lengt i = maxi_text_process(mode, local_source, length, symbol->eci); if (i == ZINT_ERROR_TOO_LONG) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E53)"); return i; } diff --git a/backend/medical.c b/backend/medical.c index 50aa432b..c6e4e62c 100644 --- a/backend/medical.c +++ b/backend/medical.c @@ -67,19 +67,19 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if (length > 6) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C50)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C51)"); return error_number; } tester = atoi((char*) source); if ((tester < 3) || (tester > 131070)) { - strcpy(symbol->errtxt, "Data out of range"); + strcpy(symbol->errtxt, "Data out of range (C52)"); return ZINT_ERROR_INVALID_DATA; } @@ -122,7 +122,7 @@ int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char des tester = atoi((char*) source); if ((tester < 4) || (tester > 64570080)) { - strcpy(symbol->errtxt, "Data out of range"); + strcpy(symbol->errtxt, "Data out of range (C53)"); return ZINT_ERROR_INVALID_DATA; } error_number = 0; @@ -162,12 +162,12 @@ int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length) { strcpy(height_pattern, ""); if (length > 8) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C54)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C55)"); return error_number; } error_number = pharma_two_calc(symbol, source, height_pattern); @@ -203,25 +203,25 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length) { strcpy(dest, ""); if (length > 60) { /* No stack smashing please */ - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C56)"); return ZINT_ERROR_TOO_LONG; } to_upper(source); error_number = is_sane(CALCIUM, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C57)"); return error_number; } /* Codabar must begin and end with the characters A, B, C or D */ if ((source[0] != 'A') && (source[0] != 'B') && (source[0] != 'C') && (source[0] != 'D')) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C58)"); return ZINT_ERROR_INVALID_DATA; } if ((source[length - 1] != 'A') && (source[length - 1] != 'B') && (source[length - 1] != 'C') && (source[length - 1] != 'D')) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C59)"); return ZINT_ERROR_INVALID_DATA; } @@ -244,12 +244,12 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) { /* Validate the input */ if (length > 8) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C5A)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C5B)"); return error_number; } diff --git a/backend/pcx.c b/backend/pcx.c index 2537ebf3..7694568c 100644 --- a/backend/pcx.c +++ b/backend/pcx.c @@ -111,7 +111,7 @@ int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { pcx_file = stdout; } else { if (!(pcx_file = fopen(symbol->outfile, "wb"))) { - strcpy(symbol->errtxt, "Can't open output file"); + strcpy(symbol->errtxt, "Can't open output file (F20)"); return ZINT_ERROR_FILE_ACCESS; } } diff --git a/backend/pdf417.c b/backend/pdf417.c index 2e4fe065..62ea50a8 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -833,12 +833,12 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if ((symbol->option_1 < -1) || (symbol->option_1 > 8)) { - strcpy(symbol->errtxt, "Security value out of range"); + strcpy(symbol->errtxt, "Security value out of range (D60)"); symbol->option_1 = -1; error_number = ZINT_WARN_INVALID_OPTION; } if ((symbol->option_2 < 0) || (symbol->option_2 > 30)) { - strcpy(symbol->errtxt, "Number of columns out of range"); + strcpy(symbol->errtxt, "Number of columns out of range (D61)"); symbol->option_2 = 0; error_number = ZINT_WARN_INVALID_OPTION; } @@ -850,23 +850,23 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length) { if (codeerr != 0) { switch (codeerr) { case 1: - strcpy(symbol->errtxt, "No such file or file unreadable"); + strcpy(symbol->errtxt, "No such file or file unreadable (D62)"); error_number = ZINT_ERROR_INVALID_OPTION; break; case 2: - strcpy(symbol->errtxt, "Input string too long"); + strcpy(symbol->errtxt, "Input string too long (D63)"); error_number = ZINT_ERROR_TOO_LONG; break; case 3: - strcpy(symbol->errtxt, "Number of codewords per row too small"); + strcpy(symbol->errtxt, "Number of codewords per row too small (D64)"); error_number = ZINT_WARN_INVALID_OPTION; break; case 4: - strcpy(symbol->errtxt, "Data too long for specified number of columns"); + strcpy(symbol->errtxt, "Data too long for specified number of columns (D65)"); error_number = ZINT_ERROR_TOO_LONG; break; default: - strcpy(symbol->errtxt, "Something strange happened"); + strcpy(symbol->errtxt, "Something strange happened (D66)"); error_number = ZINT_ERROR_ENCODING_PROBLEM; break; } @@ -963,11 +963,11 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) /* This is where it all changes! */ if (mclength > 126) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (D67)"); return ZINT_ERROR_TOO_LONG; } if (symbol->option_2 > 4) { - strcpy(symbol->errtxt, "Specified width out of range"); + strcpy(symbol->errtxt, "Specified width out of range (D68)"); symbol->option_2 = 0; codeerr = ZINT_WARN_INVALID_OPTION; } @@ -987,21 +987,21 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) if ((symbol->option_2 == 1) && (mclength > 20)) { /* the user specified 1 column but the data doesn't fit - go to automatic */ symbol->option_2 = 0; - strcpy(symbol->errtxt, "Specified symbol size too small for data"); + strcpy(symbol->errtxt, "Specified symbol size too small for data (D69)"); codeerr = ZINT_WARN_INVALID_OPTION; } if ((symbol->option_2 == 2) && (mclength > 37)) { /* the user specified 2 columns but the data doesn't fit - go to automatic */ symbol->option_2 = 0; - strcpy(symbol->errtxt, "Specified symbol size too small for data"); + strcpy(symbol->errtxt, "Specified symbol size too small for data (D6A)"); codeerr = ZINT_WARN_INVALID_OPTION; } if ((symbol->option_2 == 3) && (mclength > 82)) { /* the user specified 3 columns but the data doesn't fit - go to automatic */ symbol->option_2 = 0; - strcpy(symbol->errtxt, "Specified symbol size too small for data"); + strcpy(symbol->errtxt, "Specified symbol size too small for data (D6B)"); codeerr = ZINT_WARN_INVALID_OPTION; } diff --git a/backend/plessey.c b/backend/plessey.c index 20610d7d..cfb3ac45 100644 --- a/backend/plessey.c +++ b/backend/plessey.c @@ -60,12 +60,12 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if (length > 65) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C70)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(SSET, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C71)"); return error_number; } checkptr = (unsigned char *) calloc(1, length * 4 + 8); @@ -118,7 +118,7 @@ int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */ if (length > 55) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C72)"); return ZINT_ERROR_TOO_LONG; } @@ -150,7 +150,7 @@ int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int le error_number = 0; if (length > 18) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C73)"); return ZINT_ERROR_TOO_LONG; } @@ -218,7 +218,7 @@ int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], cons if (src_len > 18) { /* No Entry Stack Smashers! limit because of str->number conversion*/ - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C74)"); return ZINT_ERROR_TOO_LONG; } @@ -319,7 +319,7 @@ int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const error_number = 0; if (src_len > 55) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C75)"); return ZINT_ERROR_TOO_LONG; } @@ -381,7 +381,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons error_number = 0; if (src_len > 18) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C76)"); return ZINT_ERROR_TOO_LONG; } @@ -467,7 +467,7 @@ int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = is_sane(NEON, source, length); if (error_number != 0) { - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (C77)"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/png.c b/backend/png.c index ac00af31..f5584630 100644 --- a/backend/png.c +++ b/backend/png.c @@ -56,14 +56,14 @@ struct mainprog_info_type { static void writepng_error_handler(png_structp png_ptr, png_const_charp msg) { struct mainprog_info_type *graphic; - fprintf(stderr, "writepng libpng error: %s\n", msg); + fprintf(stderr, "writepng libpng error: %s (F30)\n", msg); fflush(stderr); graphic = (struct mainprog_info_type*) png_get_error_ptr(png_ptr); if (graphic == NULL) { /* we are completely hosed now */ fprintf(stderr, - "writepng severe error: jmpbuf not recoverable; terminating.\n"); + "writepng severe error: jmpbuf not recoverable; terminating. (F31)\n"); fflush(stderr); return; } @@ -108,7 +108,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { graphic->outfile = stdout; } else { if (!(graphic->outfile = fopen(symbol->outfile, "wb"))) { - strcpy(symbol->errtxt, "Can't open output file"); + strcpy(symbol->errtxt, "Can't open output file (F32)"); return ZINT_ERROR_FILE_ACCESS; } } @@ -116,21 +116,21 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { /* Set up error handling routine as proc() above */ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, graphic, writepng_error_handler, NULL); if (!png_ptr) { - strcpy(symbol->errtxt, "Out of memory"); + strcpy(symbol->errtxt, "Out of memory (F33)"); return ZINT_ERROR_MEMORY; } info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { png_destroy_write_struct(&png_ptr, NULL); - strcpy(symbol->errtxt, "Out of memory"); + strcpy(symbol->errtxt, "Out of memory (F34)"); return ZINT_ERROR_MEMORY; } /* catch jumping here */ if (setjmp(graphic->jmpbuf)) { png_destroy_write_struct(&png_ptr, &info_ptr); - strcpy(symbol->errtxt, "libpng error occurred"); + strcpy(symbol->errtxt, "libpng error occurred (F35)"); return ZINT_ERROR_MEMORY; } diff --git a/backend/postal.c b/backend/postal.c index dcd0ce4c..d83bcd79 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -92,12 +92,12 @@ int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int error_number = 0; if (length > 38) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D80)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D81)"); return error_number; } sum = 0; @@ -158,12 +158,12 @@ int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int error_number = 0; if (length > 38) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D82)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D83)"); return error_number; } sum = 0; @@ -222,12 +222,12 @@ int korea_post(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if (length > 6) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D84)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D85)"); return error_number; } zeroes = 6 - length; @@ -262,7 +262,7 @@ int fim(struct zint_symbol *symbol, unsigned char source[], int length) { char dest[16] = {0}; if (length > 1) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D86)"); return ZINT_ERROR_TOO_LONG; } @@ -284,7 +284,7 @@ int fim(struct zint_symbol *symbol, unsigned char source[], int length) { strcpy(dest, "1111131311111"); break; default: - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D87)"); return ZINT_ERROR_INVALID_DATA; break; } @@ -341,13 +341,13 @@ int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if (length > 50) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D88)"); return ZINT_ERROR_TOO_LONG; } to_upper(source); error_number = is_sane(KRSET, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D89)"); return error_number; } /*check = */rm4scc((char*) source, (unsigned char*) height_pattern, length); @@ -387,13 +387,13 @@ int kix_code(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if (length > 18) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D8A)"); return ZINT_ERROR_TOO_LONG; } to_upper(source); error_number = is_sane(KRSET, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D8B)"); return error_number; } @@ -435,14 +435,14 @@ int daft_code(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = 0; if (length > 50) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D8C)"); return ZINT_ERROR_TOO_LONG; } to_upper((unsigned char*) source); error_number = is_sane(DAFTSET, (unsigned char*) source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D8D)"); return error_number; } @@ -491,12 +491,12 @@ int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length error_number = 0; if (length > 90) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D8E)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D8F)"); return error_number; } *dest = '\0'; @@ -523,7 +523,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) { #endif if (length > 20) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (D8G)"); return ZINT_ERROR_TOO_LONG; } @@ -538,7 +538,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) { error_number = is_sane(SHKASUTSET, (unsigned char*) local_source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (D8H)"); return error_number; } memset(inter, 'd', 20); /* Pad character CC4 */ diff --git a/backend/ps.c b/backend/ps.c index 707771d1..75132b34 100644 --- a/backend/ps.c +++ b/backend/ps.c @@ -105,7 +105,7 @@ int ps_plot(struct zint_symbol *symbol) { feps = fopen(symbol->outfile, "w"); } if (feps == NULL) { - strcpy(symbol->errtxt, "Could not open output file"); + strcpy(symbol->errtxt, "Could not open output file (F40)"); #ifdef _MSC_VER free(local_text); #endif @@ -117,7 +117,7 @@ int ps_plot(struct zint_symbol *symbol) { to_upper((unsigned char*) symbol->bgcolour); if (strlen(symbol->fgcolour) != 6) { - strcpy(symbol->errtxt, "Malformed foreground colour target"); + strcpy(symbol->errtxt, "Malformed foreground colour target (F41)"); fclose(feps); #ifdef _MSC_VER free(local_text); @@ -125,7 +125,7 @@ int ps_plot(struct zint_symbol *symbol) { return ZINT_ERROR_INVALID_OPTION; } if (strlen(symbol->bgcolour) != 6) { - strcpy(symbol->errtxt, "Malformed background colour target"); + strcpy(symbol->errtxt, "Malformed background colour target (F42)"); fclose(feps); #ifdef _MSC_VER free(local_text); @@ -134,7 +134,7 @@ int ps_plot(struct zint_symbol *symbol) { } error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour)); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Malformed foreground colour target"); + strcpy(symbol->errtxt, "Malformed foreground colour target (F43)"); fclose(feps); #ifdef _MSC_VER free(local_text); @@ -143,7 +143,7 @@ int ps_plot(struct zint_symbol *symbol) { } error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->bgcolour)); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Malformed background colour target"); + strcpy(symbol->errtxt, "Malformed background colour target (F44)"); fclose(feps); #ifdef _MSC_VER free(local_text); diff --git a/backend/qr.c b/backend/qr.c index 9c77751a..f9017649 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -1513,7 +1513,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], int length j++; } while ((j < 6843) && (glyph == 0)); if (glyph == 0) { - strcpy(symbol->errtxt, "Invalid character in input data"); + strcpy(symbol->errtxt, "Invalid character in input data (E60)"); return ZINT_ERROR_INVALID_DATA; } jisdata[i] = glyph; @@ -1544,7 +1544,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], int length } if (est_binlen > (8 * max_cw)) { - strcpy(symbol->errtxt, "Input too long for selected error correction level"); + strcpy(symbol->errtxt, "Input too long for selected error correction level (E61)"); return ZINT_ERROR_TOO_LONG; } @@ -2649,7 +2649,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length #endif if (length > 35) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E62)"); return ZINT_ERROR_TOO_LONG; } @@ -2681,7 +2681,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length j++; } while ((j < 6843) && (glyph == 0)); if (glyph == 0) { - strcpy(symbol->errtxt, "Invalid character in input data"); + strcpy(symbol->errtxt, "Invalid character in input data (E63)"); return ZINT_ERROR_INVALID_DATA; } jisdata[i] = glyph; @@ -2718,7 +2718,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length error_number = micro_qr_intermediate(binary_stream, jisdata, mode, length, &kanji_used, &alphanum_used, &byte_used); if (error_number != 0) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E64)"); return error_number; } @@ -2750,7 +2750,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length version_valid[2] = 0; } if (binary_count[3] > 128) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E65)"); return ZINT_ERROR_TOO_LONG; } @@ -2761,7 +2761,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length } if (ecc_level == LEVEL_H) { - strcpy(symbol->errtxt, "Error correction level H not available"); + strcpy(symbol->errtxt, "Error correction level H not available (E66)"); return ZINT_ERROR_INVALID_OPTION; } @@ -2770,7 +2770,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length version_valid[1] = 0; version_valid[2] = 0; if (binary_count[3] > 80) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E67)"); return ZINT_ERROR_TOO_LONG; } } @@ -2784,7 +2784,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length version_valid[2] = 0; } if (binary_count[3] > 112) { - strcpy(symbol->errtxt, "Input data too long"); + strcpy(symbol->errtxt, "Input data too long (E68)"); return ZINT_ERROR_TOO_LONG; } } diff --git a/backend/raster.c b/backend/raster.c index c0ed81fa..16ba7617 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -95,7 +95,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int char *rotated_pixbuf; if (!(rotated_pixbuf = (char *) malloc(image_width * image_height))) { - printf("Insufficient memory for pixel buffer"); + printf("Insufficient memory for pixel buffer (F50)"); return ZINT_ERROR_ENCODING_PROBLEM; } @@ -117,21 +117,21 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int to_upper((unsigned char*) symbol->bgcolour); if (strlen(symbol->fgcolour) != 6) { - strcpy(symbol->errtxt, "Malformed foreground colour target"); + strcpy(symbol->errtxt, "Malformed foreground colour target (F51)"); return ZINT_ERROR_INVALID_OPTION; } if (strlen(symbol->bgcolour) != 6) { - strcpy(symbol->errtxt, "Malformed background colour target"); + strcpy(symbol->errtxt, "Malformed background colour target (F52)"); return ZINT_ERROR_INVALID_OPTION; } error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour)); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Malformed foreground colour target"); + strcpy(symbol->errtxt, "Malformed foreground colour target (F53)"); return ZINT_ERROR_INVALID_OPTION; } error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->fgcolour)); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Malformed background colour target"); + strcpy(symbol->errtxt, "Malformed background colour target (F54)"); return ZINT_ERROR_INVALID_OPTION; } @@ -486,7 +486,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_ image_height = (300 + (2 * yoffset * 2)) * scaler; if (!(pixelbuf = (char *) malloc(image_width * image_height))) { - printf("Insufficient memory for pixel buffer"); + printf("Insufficient memory for pixel buffer (F55)"); return ZINT_ERROR_ENCODING_PROBLEM; } else { for (i = 0; i < (image_width * image_height); i++) { @@ -497,7 +497,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_ hexagon_size = (int)scaler * 10; if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) { - printf("Insufficient memory for pixel buffer"); + printf("Insufficient memory for pixel buffer (F56)"); free(scaled_hexagon); return ZINT_ERROR_ENCODING_PROBLEM; } else { @@ -607,7 +607,7 @@ int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_typ /* Apply scale options by creating another pixel buffer */ if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) { - printf("Insufficient memory for pixel buffer"); + printf("Insufficient memory for pixel buffer (F57)"); return ZINT_ERROR_ENCODING_PROBLEM; } else { for (i = 0; i < (scale_width * scale_height); i++) { @@ -782,7 +782,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t image_height = 2 * (symbol->height + textoffset + yoffset + yoffset); if (!(pixelbuf = (char *) malloc(image_width * image_height))) { - printf("Insufficient memory for pixel buffer"); + printf("Insufficient memory for pixel buffer (F58)"); return ZINT_ERROR_ENCODING_PROBLEM; } else { for (i = 0; i < (image_width * image_height); i++) { @@ -1085,7 +1085,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t /* Apply scale options by creating another pixel buffer */ if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) { free(pixelbuf); - printf("Insufficient memory for pixel buffer"); + printf("Insufficient memory for pixel buffer (F59)"); return ZINT_ERROR_ENCODING_PROBLEM; } else { for (i = 0; i < (scale_width * scale_height); i++) { diff --git a/backend/rss.c b/backend/rss.c index 69de4b10..688854c7 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -170,12 +170,12 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) { separator_row = 0; if (src_len > 13) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C80)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, src_len); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C81)"); return error_number; } @@ -739,17 +739,17 @@ int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len) separator_row = 0; if (src_len > 13) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C82)"); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, src_len); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C83)"); return error_number; } if (src_len == 13) { if ((source[0] != '0') && (source[0] != '1')) { - strcpy(symbol->errtxt, "Input out of range"); + strcpy(symbol->errtxt, "Input out of range (C84)"); return ZINT_ERROR_INVALID_DATA; } } @@ -1386,7 +1386,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str if ((source[i] < '0') || (source[i] > '9')) { if ((source[i] != '[') && (source[i] != ']')) { /* Something is wrong */ - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (C85)"); return ZINT_ERROR_INVALID_DATA; } } @@ -1718,7 +1718,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str if (latch == 1) { /* Invalid characters in input data */ - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (C86)"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/svg.c b/backend/svg.c index e2e688ac..a3000ec5 100644 --- a/backend/svg.c +++ b/backend/svg.c @@ -102,7 +102,7 @@ int svg_plot(struct zint_symbol *symbol) { fsvg = fopen(symbol->outfile, "w"); } if (fsvg == NULL) { - strcpy(symbol->errtxt, "Could not open output file"); + strcpy(symbol->errtxt, "Could not open output file (F60)"); return ZINT_ERROR_FILE_ACCESS; } @@ -111,24 +111,24 @@ int svg_plot(struct zint_symbol *symbol) { to_upper((unsigned char*) symbol->bgcolour); if (strlen(symbol->fgcolour) != 6) { - strcpy(symbol->errtxt, "Malformed foreground colour target"); + strcpy(symbol->errtxt, "Malformed foreground colour target (F61)"); fclose(fsvg); return ZINT_ERROR_INVALID_OPTION; } if (strlen(symbol->bgcolour) != 6) { - strcpy(symbol->errtxt, "Malformed background colour target"); + strcpy(symbol->errtxt, "Malformed background colour target (F62)"); fclose(fsvg); return ZINT_ERROR_INVALID_OPTION; } error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour)); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Malformed foreground colour target"); + strcpy(symbol->errtxt, "Malformed foreground colour target (F63)"); fclose(fsvg); return ZINT_ERROR_INVALID_OPTION; } error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->bgcolour)); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Malformed background colour target"); + strcpy(symbol->errtxt, "Malformed background colour target (F64)"); fclose(fsvg); return ZINT_ERROR_INVALID_OPTION; } diff --git a/backend/telepen.c b/backend/telepen.c index 8a5b375f..79aff4a5 100644 --- a/backend/telepen.c +++ b/backend/telepen.c @@ -66,7 +66,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) { count = 0; if (src_len > 30) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C90)"); return ZINT_ERROR_TOO_LONG; } /* Start character */ @@ -75,7 +75,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) { for (i = 0; i < src_len; i++) { if (source[i] > 126) { /* Cannot encode extended ASCII */ - strcpy(symbol->errtxt, "Invalid characters in input data"); + strcpy(symbol->errtxt, "Invalid characters in input data (C91)"); return ZINT_ERROR_INVALID_DATA; } strcat(dest, TeleTable[source[i]]); @@ -113,14 +113,14 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len) count = 0; if (temp_length > 60) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C92)"); return ZINT_ERROR_TOO_LONG; } ustrcpy(temp, source); to_upper(temp); error_number = is_sane(NEON, temp, temp_length); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C93)"); return error_number; } @@ -137,7 +137,7 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len) for (i = 0; i < temp_length; i += 2) { if (temp[i] == 'X') { - strcpy(symbol->errtxt, "Invalid position of X in Telepen data"); + strcpy(symbol->errtxt, "Invalid position of X in Telepen data (C94)"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/upcean.c b/backend/upcean.c index 91cb4d7f..f599173a 100644 --- a/backend/upcean.c +++ b/backend/upcean.c @@ -137,7 +137,7 @@ int upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) { } else { gtin[length - 1] = '\0'; if (source[length - 1] != upc_check(gtin)) { - strcpy(symbol->errtxt, "Invalid check digit"); + strcpy(symbol->errtxt, "Invalid check digit (C60)"); return ZINT_ERROR_INVALID_DATA; } gtin[length - 1] = upc_check(gtin); @@ -229,7 +229,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) { equivalent[10] = source[4]; if (((source[2] == '0') || (source[2] == '1')) || (source[2] == '2')) { /* Note 1 - "X3 shall not be equal to 0, 1 or 2" */ - strcpy(symbol->errtxt, "Invalid UPC-E data"); + strcpy(symbol->errtxt, "Invalid UPC-E data (C61)"); return ZINT_ERROR_INVALID_DATA; } break; @@ -239,7 +239,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) { equivalent[10] = source[4]; if (source[3] == '0') { /* Note 2 - "X4 shall not be equal to 0" */ - strcpy(symbol->errtxt, "Invalid UPC-E data"); + strcpy(symbol->errtxt, "Invalid UPC-E data (C62)"); return ZINT_ERROR_INVALID_DATA; } break; @@ -254,7 +254,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) { equivalent[10] = emode; if (source[4] == '0') { /* Note 3 - "X5 shall not be equal to 0" */ - strcpy(symbol->errtxt, "Invalid UPC-E data"); + strcpy(symbol->errtxt, "Invalid UPC-E data (C63)"); return ZINT_ERROR_INVALID_DATA; } break; @@ -293,7 +293,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) { hrt[8] = '\0'; } else { if (hrt[7] != check_digit) { - strcpy(symbol->errtxt, "Invalid check digit"); + strcpy(symbol->errtxt, "Invalid check digit (C64)"); return ZINT_ERROR_INVALID_DATA; } } @@ -400,7 +400,7 @@ int ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) { } else { gtin[length - 1] = '\0'; if (source[length - 1] != ean_check(gtin)) { - strcpy(symbol->errtxt, "Invalid check digit"); + strcpy(symbol->errtxt, "Invalid check digit (C65)"); return ZINT_ERROR_INVALID_DATA; } gtin[length - 1] = ean_check(gtin); @@ -451,7 +451,7 @@ int ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) { } else { gtin[length - 1] = '\0'; if (source[length - 1] != upc_check(gtin)) { - strcpy(symbol->errtxt, "Invalid check digit"); + strcpy(symbol->errtxt, "Invalid check digit (C66)"); return ZINT_ERROR_INVALID_DATA; } gtin[length - 1] = upc_check(gtin); @@ -512,26 +512,26 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int to_upper(source); error_number = is_sane("0123456789X", source, src_len); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in input"); + strcpy(symbol->errtxt, "Invalid characters in input (C67)"); return error_number; } /* Input must be 9, 10 or 13 characters */ if (((src_len < 9) || (src_len > 13)) || ((src_len > 10) && (src_len < 13))) { - strcpy(symbol->errtxt, "Input wrong length"); + strcpy(symbol->errtxt, "Input wrong length (C68)"); return ZINT_ERROR_TOO_LONG; } if (src_len == 13) /* Using 13 character ISBN */ { if (!(((source[0] == '9') && (source[1] == '7')) && ((source[2] == '8') || (source[2] == '9')))) { - strcpy(symbol->errtxt, "Invalid ISBN"); + strcpy(symbol->errtxt, "Invalid ISBN (C69)"); return ZINT_ERROR_INVALID_DATA; } check_digit = isbn13_check(source); if (source[src_len - 1] != check_digit) { - strcpy(symbol->errtxt, "Incorrect ISBN check"); + strcpy(symbol->errtxt, "Incorrect ISBN check (C6A)"); return ZINT_ERROR_INVALID_CHECK; } source[12] = '\0'; @@ -542,7 +542,7 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int if (src_len == 10) /* Using 10 digit ISBN */ { check_digit = isbn_check(source); if (check_digit != source[src_len - 1]) { - strcpy(symbol->errtxt, "Incorrect ISBN check"); + strcpy(symbol->errtxt, "Incorrect ISBN check (C6B)"); return ZINT_ERROR_INVALID_CHECK; } for (i = 13; i > 0; i--) { @@ -566,7 +566,7 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int /* Verify check digit */ check_digit = isbn_check(source); if (check_digit != source[ustrlen(source) - 1]) { - strcpy(symbol->errtxt, "Incorrect SBN check"); + strcpy(symbol->errtxt, "Incorrect SBN check (C6C)"); return ZINT_ERROR_INVALID_CHECK; } @@ -727,20 +727,20 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { writer = 0; if (src_len > 19) { - strcpy(symbol->errtxt, "Input too long"); + strcpy(symbol->errtxt, "Input too long (C6D)"); return ZINT_ERROR_TOO_LONG; } if (symbol->symbology != BARCODE_ISBNX) { /* ISBN has it's own checking routine */ error_number = is_sane("0123456789+", source, src_len); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in data"); + strcpy(symbol->errtxt, "Invalid characters in data (C6E)"); return error_number; } } else { error_number = is_sane("0123456789Xx", source, src_len); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "Invalid characters in input"); + strcpy(symbol->errtxt, "Invalid characters in input (C6F)"); return error_number; } } @@ -799,7 +799,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { case 12: case 13: error_number = ean13(symbol, first_part, (char*) dest); break; - default: strcpy(symbol->errtxt, "Invalid length input"); + default: strcpy(symbol->errtxt, "Invalid length input (C6G)"); return ZINT_ERROR_TOO_LONG; } break; @@ -829,7 +829,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { symbol->rows += 3; error_number = ean13(symbol, first_part, (char*) dest); break; - default: strcpy(symbol->errtxt, "Invalid length EAN input"); + default: strcpy(symbol->errtxt, "Invalid length EAN input (C6H)"); return ZINT_ERROR_TOO_LONG; } break; @@ -838,7 +838,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { if ((ustrlen(first_part) == 11) || (ustrlen(first_part) == 12)) { error_number = upca(symbol, first_part, (char*) dest); } else { - strcpy(symbol->errtxt, "Input wrong length"); + strcpy(symbol->errtxt, "Input wrong length (C6I)"); return ZINT_ERROR_TOO_LONG; } break; @@ -856,7 +856,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { symbol->rows += 3; error_number = upca(symbol, first_part, (char*) dest); } else { - strcpy(symbol->errtxt, "UPCA input wrong length"); + strcpy(symbol->errtxt, "UPCA input wrong length (C6J)"); return ZINT_ERROR_TOO_LONG; } break; @@ -865,7 +865,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { if ((ustrlen(first_part) >= 6) && (ustrlen(first_part) <= 8)) { error_number = upce(symbol, first_part, (char*) dest); } else { - strcpy(symbol->errtxt, "Input wrong length"); + strcpy(symbol->errtxt, "Input wrong length (C6K)"); return ZINT_ERROR_TOO_LONG; } break; @@ -883,7 +883,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { symbol->rows += 3; error_number = upce(symbol, first_part, (char*) dest); } else { - strcpy(symbol->errtxt, "UPCE input wrong length"); + strcpy(symbol->errtxt, "UPCE input wrong length (C6L)"); return ZINT_ERROR_TOO_LONG; } break; @@ -909,7 +909,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { strcat((char*) symbol->text, (char*) second_part); break; default: - strcpy(symbol->errtxt, "Invalid length input"); + strcpy(symbol->errtxt, "Invalid length input (C6M)"); return ZINT_ERROR_TOO_LONG; } diff --git a/frontend/main.c b/frontend/main.c index 4a26fa34..204097fb 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -273,7 +273,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c if (strlen(format_string) < 127) { strcpy(format_string, symbol->outfile); } else { - strcpy(symbol->errtxt, "Format string too long"); + strcpy(symbol->errtxt, "Format string too long (A01)"); return ZINT_ERROR_INVALID_DATA; } } @@ -284,7 +284,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c } else { file = fopen(filename, "rb"); if (!file) { - strcpy(symbol->errtxt, "Unable to read input file"); + strcpy(symbol->errtxt, "Unable to read input file (A02)"); return ZINT_ERROR_INVALID_DATA; } } @@ -407,7 +407,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c posn++; } if (posn > 7090) { - fprintf(stderr, "On line %d: Input data too long\n", line_count); + fprintf(stderr, "On line %d: Input data too long (A03)\n", line_count); fflush(stderr); do { character = fgetc(file); @@ -416,7 +416,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c } while ((!feof(file)) && (line_count < 2000000000)); if (character != '\n') { - fprintf(stderr, "Warning: No newline at end of file\n"); + fprintf(stderr, "Warning: No newline at end of file (A04)\n"); fflush(stderr); } @@ -561,7 +561,7 @@ int main(int argc, char **argv) { my_symbol->scale = (float) (atof(optarg)); if (my_symbol->scale < 0.01) { /* Zero and negative values are not permitted */ - fprintf(stderr, "Invalid scale value\n"); + fprintf(stderr, "Invalid scale value (A05)\n"); fflush(stderr); my_symbol->scale = 1.0; } @@ -570,7 +570,7 @@ int main(int argc, char **argv) { my_symbol->dot_size = (float) (atof(optarg)); if (my_symbol->dot_size < 0.01) { /* Zero and negative values are not permitted */ - fprintf(stderr, "Invalid dot radius value\n"); + fprintf(stderr, "Invalid dot radius value (A06)\n"); fflush(stderr); my_symbol->dot_size = 4.0 / 5.0; } @@ -578,26 +578,26 @@ int main(int argc, char **argv) { if (!strcmp(long_options[option_index].name, "border")) { error_number = validator(NESET, optarg); if (error_number == ZINT_ERROR_INVALID_DATA) { - fprintf(stderr, "Invalid border width\n"); + fprintf(stderr, "Invalid border width (A07)\n"); exit(1); } if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) { my_symbol->border_width = atoi(optarg); } else { - fprintf(stderr, "Border width out of range\n"); + fprintf(stderr, "Border width out of range (A08)\n"); fflush(stderr); } } if (!strcmp(long_options[option_index].name, "height")) { error_number = validator(NESET, optarg); if (error_number == ZINT_ERROR_INVALID_DATA) { - fprintf(stderr, "Invalid symbol height\n"); + fprintf(stderr, "Invalid symbol height (A09)\n"); exit(1); } if ((atoi(optarg) >= 1) && (atoi(optarg) <= 1000)) { my_symbol->height = atoi(optarg); } else { - fprintf(stderr, "Symbol height out of range\n"); + fprintf(stderr, "Symbol height out of range (A10)\n"); fflush(stderr); } } @@ -606,7 +606,7 @@ int main(int argc, char **argv) { if ((atoi(optarg) >= 1) && (atoi(optarg) <= 66)) { my_symbol->option_2 = atoi(optarg); } else { - fprintf(stderr, "Number of columns out of range\n"); + fprintf(stderr, "Number of columns out of range (A11)\n"); fflush(stderr); } } @@ -614,7 +614,7 @@ int main(int argc, char **argv) { if ((atoi(optarg) >= 1) && (atoi(optarg) <= 44)) { my_symbol->option_1 = atoi(optarg); } else { - fprintf(stderr, "Number of rows out of range\n"); + fprintf(stderr, "Number of rows out of range (A12)\n"); fflush(stderr); } } @@ -622,7 +622,7 @@ int main(int argc, char **argv) { if ((atoi(optarg) >= 1) && (atoi(optarg) <= 84)) { my_symbol->option_2 = atoi(optarg); } else { - fprintf(stderr, "Invalid Version\n"); + fprintf(stderr, "Invalid Version (A13)\n"); fflush(stderr); } } @@ -630,7 +630,7 @@ int main(int argc, char **argv) { if ((atoi(optarg) >= 1) && (atoi(optarg) <= 8)) { my_symbol->option_1 = atoi(optarg); } else { - fprintf(stderr, "ECC level out of range\n"); + fprintf(stderr, "ECC level out of range (A14)\n"); fflush(stderr); } } @@ -638,7 +638,7 @@ int main(int argc, char **argv) { if (strlen(optarg) <= 90) { strcpy(my_symbol->primary, optarg); } else { - fprintf(stderr, "Primary data string too long"); + fprintf(stderr, "Primary data string too long (A15)"); fflush(stderr); } } @@ -646,7 +646,7 @@ int main(int argc, char **argv) { if ((optarg[0] >= '0') && (optarg[0] <= '6')) { my_symbol->option_1 = optarg[0] - '0'; } else { - fprintf(stderr, "Invalid mode\n"); + fprintf(stderr, "Invalid mode (A16)\n"); fflush(stderr); } } @@ -654,7 +654,7 @@ int main(int argc, char **argv) { /* Only certain inputs allowed */ error_number = validator(NESET, optarg); if (error_number == ZINT_ERROR_INVALID_DATA) { - fprintf(stderr, "Invalid rotation parameter\n"); + fprintf(stderr, "Invalid rotation parameter (A17)\n"); exit(1); } switch (atoi(optarg)) { @@ -684,7 +684,7 @@ int main(int argc, char **argv) { if ((atoi(optarg) >= 0) && (atoi(optarg) <= 30)) { my_symbol->eci = atoi(optarg); } else { - fprintf(stderr, "Invalid ECI code\n"); + fprintf(stderr, "Invalid ECI code (A18)\n"); fflush(stderr); } } @@ -705,7 +705,7 @@ int main(int argc, char **argv) { case 'b': error_number = validator(NESET, optarg); if (error_number == ZINT_ERROR_INVALID_DATA) { - fprintf(stderr, "Invalid barcode type\n"); + fprintf(stderr, "Invalid barcode type (A19)\n"); exit(1); } my_symbol->symbology = atoi(optarg); @@ -714,13 +714,13 @@ int main(int argc, char **argv) { case 'w': error_number = validator(NESET, optarg); if (error_number == ZINT_ERROR_INVALID_DATA) { - fprintf(stderr, "Invalid whitespace value\n"); + fprintf(stderr, "Invalid whitespace value (A20)\n"); exit(1); } if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) { my_symbol->whitespace_width = atoi(optarg); } else { - fprintf(stderr, "Whitespace value out of range"); + fprintf(stderr, "Whitespace value out of range (A21)"); fflush(stderr); } break; @@ -739,7 +739,7 @@ int main(int argc, char **argv) { return 1; } } else { - fprintf(stderr, "Cannot define data in batch mode"); + fprintf(stderr, "Cannot define data in batch mode (A22)"); fflush(stderr); } break; @@ -783,7 +783,7 @@ int main(int argc, char **argv) { break; default: - fprintf(stderr, "?? getopt error 0%o\n", c); + fprintf(stderr, "?? getopt error 0%o (A23)\n", c); fflush(stderr); } } @@ -797,7 +797,7 @@ int main(int argc, char **argv) { } if (generated == 0) { - fprintf(stderr, "error: No data received, no symbol generated\n"); + fprintf(stderr, "error: No data received, no symbol generated (A24)\n"); fflush(stderr); }