Audit of error codes

This commit is contained in:
Robin Stuart 2017-07-27 16:01:53 +01:00
parent 58e80a9ff7
commit 608b4b9134
38 changed files with 345 additions and 345 deletions

View File

@ -65,12 +65,12 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l
char dest[512]; /* 6 + 80 * 6 + 6 + 1 ~ 512*/
if (length > 80) {
strcpy(symbol->errtxt, "Input too long (C01)");
strcpy(symbol->errtxt, "301: Input too long");
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 (C02)");
strcpy(symbol->errtxt, "302: Invalid characters in data");
return error_number;
}
@ -96,12 +96,12 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i
char dest[512]; /* 6 + 40 * 10 + 6 + 1 */
if (length > 45) {
strcpy(symbol->errtxt, "Input too long (C03)");
strcpy(symbol->errtxt, "303: Input too long");
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 (C04)");
strcpy(symbol->errtxt, "304: Invalid character in data");
return error_number;
}
@ -126,12 +126,12 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len
char dest[512]; /* 4 + 45 * 10 + 3 + 1 */
if (length > 45) {
strcpy(symbol->errtxt, "Input too long (C05)");
strcpy(symbol->errtxt, "305: Input too long");
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 (C06)");
strcpy(symbol->errtxt, "306: Invalid characters in data");
return error_number;
}
@ -157,12 +157,12 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le
char dest[512]; /* 4 + 80 * 6 + 3 + 1 */
if (length > 80) {
strcpy(symbol->errtxt, "Input too long (C07)");
strcpy(symbol->errtxt, "307: Input too long");
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 (C08)");
strcpy(symbol->errtxt, "308: Invalid characters in data");
return error_number;
}
@ -193,12 +193,12 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour
#endif
if (length > 89) {
strcpy(symbol->errtxt, "Input too long (C09)");
strcpy(symbol->errtxt, "309: Input too long");
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 (C0A)");
strcpy(symbol->errtxt, "310: Invalid characters in data");
return error_number;
}
@ -251,13 +251,13 @@ int itf14(struct zint_symbol *symbol, unsigned char source[], int length) {
count = 0;
if (length > 13) {
strcpy(symbol->errtxt, "Input too long (C0B)");
strcpy(symbol->errtxt, "311: Input too long");
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 (C0D)");
strcpy(symbol->errtxt, "312: Invalid character in data");
return error_number;
}
@ -292,12 +292,12 @@ int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) {
count = 0;
if (length > 13) {
strcpy(symbol->errtxt, "Input wrong length (C0E)");
strcpy(symbol->errtxt, "313: Input wrong length");
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 (C0D)");
strcpy(symbol->errtxt, "314: Invalid characters in data");
return error_number;
}
@ -328,12 +328,12 @@ int dpident(struct zint_symbol *symbol, unsigned char source[], int length) {
count = 0;
if (length > 11) {
strcpy(symbol->errtxt, "Input wrong length (C0E)");
strcpy(symbol->errtxt, "315: Input wrong length");
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 (C0F)");
strcpy(symbol->errtxt, "316: Invalid characters in data");
return error_number;
}

View File

@ -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 (D01)");
strcpy(symbol->errtxt, "401: Auspost input is wrong length");
return ZINT_ERROR_TOO_LONG;
}
if (error_number == ZINT_ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "Invalid characters in data (D02)");
strcpy(symbol->errtxt, "402: Invalid characters in data");
return error_number;
}
} else {
if (length > 8) {
strcpy(symbol->errtxt, "Auspost input is too long (D03)");
strcpy(symbol->errtxt, "403: Auspost input is too long");
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 (D04)");
strcpy(symbol->errtxt, "404: Invalid characters in data");
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 (D05)");
strcpy(symbol->errtxt, "405: Invalid characters in DPID");
return error_number;
}

View File

@ -987,7 +987,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt
comp_loop = 1;
}
if (gs1 && reader) {
strcpy(symbol->errtxt, "Cannot encode in GS1 and Reader Initialisation mode at the same time (E01)");
strcpy(symbol->errtxt, "501: Cannot encode in GS1 and Reader Initialisation mode at the same time");
return ZINT_ERROR_INVALID_OPTION;
}
@ -996,12 +996,12 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt
err_code = aztec_text_process(source, length, binary_string, gs1, symbol->eci, symbol->debug);
if (err_code != 0) {
strcpy(symbol->errtxt, "Input too long or too many extended ASCII characters (E02)");
strcpy(symbol->errtxt, "502: Input too long or too many extended ASCII characters");
return err_code;
}
if (!((symbol->option_1 >= -1) && (symbol->option_1 <= 4))) {
strcpy(symbol->errtxt, "Invalid error correction level - using default instead (E03)");
strcpy(symbol->errtxt, "503: Invalid error correction level - using default instead");
err_code = ZINT_WARN_INVALID_OPTION;
symbol->option_1 = -1;
}
@ -1089,7 +1089,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt
}
if (layers == 0) { /* Couldn't find a symbol which fits the data */
strcpy(symbol->errtxt, "Input too long (too many bits for selected ECC) (E04)");
strcpy(symbol->errtxt, "504: Input too long (too many bits for selected ECC)");
return ZINT_ERROR_TOO_LONG;
}
@ -1195,7 +1195,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt
layers = symbol->option_2 - 4;
}
if ((symbol->option_2 < 0) || (symbol->option_2 > 36)) {
strcpy(symbol->errtxt, "Invalid Aztec Code size");
strcpy(symbol->errtxt, "510: Invalid Aztec Code size");
return ZINT_ERROR_INVALID_OPTION;
}
@ -1281,7 +1281,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt
}
if (adjusted_length > data_maxsize) {
strcpy(symbol->errtxt, "Data too long for specified Aztec Code symbol size (E05)");
strcpy(symbol->errtxt, "505: Data too long for specified Aztec Code symbol size");
return ZINT_ERROR_TOO_LONG;
}
@ -1298,7 +1298,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt
}
if (reader && (layers > 22)) {
strcpy(symbol->errtxt, "Data too long for reader initialisation symbol (E06)");
strcpy(symbol->errtxt, "506: Data too long for reader initialisation symbol");
return ZINT_ERROR_TOO_LONG;
}
@ -1638,12 +1638,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 (E07)");
strcpy(symbol->errtxt, "507: Input too large");
return ZINT_ERROR_INVALID_DATA;
}
error_number = is_sane(NEON, source, length);
if (error_number != 0) {
strcpy(symbol->errtxt, "Invalid characters in input (E08)");
strcpy(symbol->errtxt, "508: Invalid characters in input");
return ZINT_ERROR_INVALID_DATA;
}
switch (length) {
@ -1659,7 +1659,7 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
}
if (input_value > 255) {
strcpy(symbol->errtxt, "Input too large (E09)");
strcpy(symbol->errtxt, "509: Input too large");
return ZINT_ERROR_INVALID_DATA;
}

View File

@ -122,7 +122,7 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
if ((symbol->output_options & BARCODE_STDOUT) != 0) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
strcpy(symbol->errtxt, "Can't open output file");
strcpy(symbol->errtxt, "600: Can't open output file");
free(bitmap_file_start);
free(bitmap);
return ZINT_ERROR_FILE_ACCESS;
@ -133,7 +133,7 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
if (!(bmp_file = fopen(symbol->outfile, "wb"))) {
free(bitmap_file_start);
free(bitmap);
strcpy(symbol->errtxt, "Can't open output file (F00)");
strcpy(symbol->errtxt, "601: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
}

View File

@ -652,18 +652,18 @@ int codablock(struct zint_symbol *symbol,const unsigned char source[], const siz
/* option1: rows 0: automatic, 1..44 */
rows = symbol->option_1;
if (rows > 44) {
strcpy(symbol->errtxt, "Row parameter not in 0..44 (D10)");
strcpy(symbol->errtxt, "410: Row parameter not in 0..44");
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 (D11)");
strcpy(symbol->errtxt, "411: Columns parameter not in 0,6..66");
return ZINT_ERROR_INVALID_OPTION;
}
/* GS1 not implemented */
if (symbol->input_mode == GS1_MODE) {
strcpy(symbol->errtxt, "GS1 mode not supported (D12)");
strcpy(symbol->errtxt, "412: GS1 mode not supported");
return ZINT_ERROR_INVALID_OPTION;
}
#ifndef _MSC_VER
@ -725,7 +725,7 @@ int codablock(struct zint_symbol *symbol,const unsigned char source[], const siz
Error=Columns2Rows(T,data,dataLength,&rows,&useColumns,pSet,&fillings);
}
if (Error != 0) {
strcpy(symbol->errtxt, "data string to long (D13)");
strcpy(symbol->errtxt, "413: Data string to long");
return Error;
}
/* Checksum */

View File

@ -113,12 +113,12 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /*
char checkstr[3];
if (length > 121) {
strcpy(symbol->errtxt, "Input too long (C20)");
strcpy(symbol->errtxt, "320: Input too long");
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 (C21)");
strcpy(symbol->errtxt, "321: Invalid characters in data");
return error_number;
}
c_weight = 1;
@ -200,16 +200,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 (C22)");
strcpy(symbol->errtxt, "322: Input too long");
return ZINT_ERROR_TOO_LONG;
} else if (length > 74) {
strcpy(symbol->errtxt, "Input too long (C23)");
strcpy(symbol->errtxt, "323: Input too long");
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 (C24)");
strcpy(symbol->errtxt, "324: Invalid characters in data");
return error_number;
}
@ -297,12 +297,12 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
count = 0;
if (length > 7) {
strcpy(symbol->errtxt, "Input wrong length (C25)");
strcpy(symbol->errtxt, "325: Input wrong length");
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 (C26)");
strcpy(symbol->errtxt, "326: Invalid characters in data");
return error_number;
}
@ -323,7 +323,7 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
localstr[8] = itoc(check_digit);
localstr[9] = '\0';
if (localstr[8] == 'A') {
strcpy(symbol->errtxt, "Invalid PZN Data (C27)");
strcpy(symbol->errtxt, "327: Invalid PZN Data");
return ZINT_ERROR_INVALID_DATA;
}
error_number = c39(symbol, (unsigned char *) localstr, strlen(localstr));
@ -340,7 +340,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length) {
int error_number;
if (length > 74) {
strcpy(symbol->errtxt, "Input too long (C28)");
strcpy(symbol->errtxt, "328: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -348,7 +348,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 (C29)");
strcpy(symbol->errtxt, "329: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
}
strcat((char*) buffer, EC39Ctrl[source[i]]);
@ -381,7 +381,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
strcpy(buffer, "");
if (length > 107) {
strcpy(symbol->errtxt, "Input too long (C2A)");
strcpy(symbol->errtxt, "330: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -389,7 +389,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 (C2B)");
strcpy(symbol->errtxt, "331: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
}
strcat(buffer, C93Ctrl[source[i]]);
@ -399,7 +399,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 (C2C)");
strcpy(symbol->errtxt, "332: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -514,12 +514,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 (C2D)");
strcpy(symbol->errtxt, "333: Input too long");
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 (C2E)");
strcpy(symbol->errtxt, "334: Invalid characters in data");
return error_number;
}
@ -567,7 +567,7 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length)
break;
}
if (range) {
strcpy(symbol->errtxt, "Value out of range (C2F)");
strcpy(symbol->errtxt, "335: Value out of range");
return ZINT_ERROR_INVALID_DATA;
}

View File

@ -1008,7 +1008,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 (E10)");
strcpy(symbol->errtxt, "511: Input data too long");
return 0;
}
} while (sp < length);
@ -1153,7 +1153,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 (E11)");
strcpy(symbol->errtxt, "512: Input data too long");
return 0;
}
/*
@ -1186,7 +1186,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 (E12)");
strcpy(symbol->errtxt, "513: Invalid symbol size");
return ZINT_ERROR_INVALID_OPTION;
}
@ -1199,11 +1199,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 (E13)");
strcpy(symbol->errtxt, "514: Input data too long");
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) (E14)");
strcpy(symbol->errtxt, "515: Invalid input data (Version S encodes numeric input only)");
return ZINT_ERROR_INVALID_DATA;
}
@ -1313,7 +1313,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
}
if (data_length > 38) {
strcpy(symbol->errtxt, "Input data too long (E15)");
strcpy(symbol->errtxt, "516: Input data too long");
return ZINT_ERROR_TOO_LONG;
}
@ -1407,7 +1407,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
data_length = c1_encode(symbol, source, data, length);
if (data_length == 0) {
strcpy(symbol->errtxt, "Input data is too long");
strcpy(symbol->errtxt, "517: Input data is too long");
return ZINT_ERROR_TOO_LONG;
}
@ -1422,7 +1422,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
}
if ((symbol-> option_2 != 0) && (symbol->option_2 < size)) {
strcpy(symbol->errtxt, "Input too long for selected symbol size");
strcpy(symbol->errtxt, "518: Input too long for selected symbol size");
return ZINT_ERROR_TOO_LONG;
}

View File

@ -311,7 +311,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t le
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 (C40)");
strcpy(symbol->errtxt, "340: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -483,7 +483,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t le
}
}
if (glyph_count > 60.0) {
strcpy(symbol->errtxt, "Input too long (C41)");
strcpy(symbol->errtxt, "341: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -708,13 +708,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 (C42)");
strcpy(symbol->errtxt, "342: Input too long");
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 (C43)");
strcpy(symbol->errtxt, "343: NULL character in input data");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -844,7 +844,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 (C44)");
strcpy(symbol->errtxt, "344: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -1011,13 +1011,13 @@ int nve_18(struct zint_symbol *symbol, unsigned char source[], int length) {
sourcelen = length;
if (sourcelen > 17) {
strcpy(symbol->errtxt, "Input too long (C45)");
strcpy(symbol->errtxt, "345: Input too long");
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 (C46)");
strcpy(symbol->errtxt, "346: Invalid characters in data");
return error_number;
}
zeroes = 17 - sourcelen;
@ -1052,13 +1052,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 (C47)");
strcpy(symbol->errtxt, "347: Input wrong length");
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 (C48)");
strcpy(symbol->errtxt, "348: Invalid character in data");
return error_number;
}

View File

@ -280,7 +280,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len
}
if (input_length > 157) {
strcpy(symbol->errtxt, "Input too long (D20)");
strcpy(symbol->errtxt, "420: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -479,7 +479,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len
}
if (glyph_count > 77.0) {
strcpy(symbol->errtxt, "Input too long (D21)");
strcpy(symbol->errtxt, "421: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -511,7 +511,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len
m = 5;
}
if (gs1) {
strcpy(symbol->errtxt, "Cannot use both GS1 mode and Reader Initialisation (D22)");
strcpy(symbol->errtxt, "422: Cannot use both GS1 mode and Reader Initialisation");
return ZINT_ERROR_INVALID_OPTION;
} else {
if ((set[0] == 'B') && (set[1] == 'C')) {

View File

@ -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 (D30)");
strcpy(symbol->errtxt, "430: Input too long");
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 (D31)");
strcpy(symbol->errtxt, "431: Invalid characters in input data");
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 (D32)");
strcpy(symbol->errtxt, "432: Input too long");
return ZINT_ERROR_TOO_LONG;
}

View File

@ -256,11 +256,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 (B40)");
strcpy(symbol->errtxt, "240: Corrupt Unicode data");
return ZINT_ERROR_INVALID_DATA;
}
if ((source[bpos] >= 0xc0) && (source[bpos] <= 0xc1)) {
strcpy(symbol->errtxt, "Overlong encoding not supported (B41)");
strcpy(symbol->errtxt, "241: Overlong encoding not supported");
return ZINT_ERROR_INVALID_DATA;
}
@ -277,7 +277,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 (B42)");
strcpy(symbol->errtxt, "242: Unicode sequences of more than 3 bytes not supported");
return ZINT_ERROR_INVALID_DATA;
}
}

View File

@ -1103,7 +1103,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
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 (D40)");
strcpy(symbol->errtxt, "440: Invalid AI 90 data");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -1462,7 +1462,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
if (latch == 1) {
/* Invalid characters in input data */
strcpy(symbol->errtxt, "Invalid characters in input data (D41)");
strcpy(symbol->errtxt, "441: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
}
@ -1668,7 +1668,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
}
if (target_bitsize == 0) {
strcpy(symbol->errtxt, "Input too long for selected 2d component (D42)");
strcpy(symbol->errtxt, "442: Input too long for selected 2d component");
return ZINT_ERROR_TOO_LONG;
}
@ -1711,7 +1711,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
}
if (strlen(binary_string) > 11805) { /* (2361 * 5) */
strcpy(symbol->errtxt, "Input too long (D43)");
strcpy(symbol->errtxt, "443: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -1730,7 +1730,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
}
if (target_bitsize == 0) {
strcpy(symbol->errtxt, "Input too long for selected 2d component (D44)");
strcpy(symbol->errtxt, "444: Input too long for selected 2d component");
return ZINT_ERROR_TOO_LONG;
}
@ -1798,19 +1798,19 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
error_number = 0;
pri_len = (int)strlen(symbol->primary);
if (pri_len == 0) {
strcpy(symbol->errtxt, "No primary (linear) message in 2D composite (D45)");
strcpy(symbol->errtxt, "445: No primary (linear) message in 2D composite");
return ZINT_ERROR_INVALID_OPTION;
}
if (length > 2990) {
strcpy(symbol->errtxt, "2D component input data too long (D46)");
strcpy(symbol->errtxt, "446: 2D component input data too long");
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) (D47)");
strcpy(symbol->errtxt, "447: Invalid mode (CC-C only valid with GS1-128 linear component)");
return ZINT_ERROR_INVALID_OPTION;
}
@ -1823,7 +1823,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 (D48)");
strcpy(symbol->errtxt, "448: Invalid data");
return ZINT_ERROR_INVALID_DATA;
}
}

View File

@ -567,7 +567,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 (E10)");
strcpy(symbol->errtxt, "519: Cannot encode in GS1 mode and Reader Initialisation at the same time");
return ZINT_ERROR_INVALID_OPTION;
} else {
target[tp] = 234;
@ -1158,7 +1158,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
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 (E11)");
strcpy(symbol->errtxt, "520: Data too long to fit in symbol");
return ZINT_ERROR_TOO_LONG;
}
@ -1182,7 +1182,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
calcsize++;
}
if (optionsize != -1) {
strcpy(symbol->errtxt, "Can not force square symbols when symbol size is selected");
strcpy(symbol->errtxt, "521: Can not force square symbols when symbol size is selected");
error_number = ZINT_WARN_INVALID_OPTION;
}
} else if (symbol->option_3 != DM_DMRE) {
@ -1196,7 +1196,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
if (calcsize > optionsize) {
symbolsize = calcsize;
if (optionsize != -1) {
strcpy(symbol->errtxt, "Input too long for selected symbol size");
strcpy(symbol->errtxt, "522: Input too long for selected symbol size");
return ZINT_ERROR_TOO_LONG;
}
}
@ -1206,7 +1206,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
binlen = dm200encode_remainder(binary, binlen, source, inputlen, last_mode, process_buffer, process_p, symbols_left);
if (binlen > matrixbytes[symbolsize]) {
strcpy(symbol->errtxt, "Data too long to fit in symbol (E12A)");
strcpy(symbol->errtxt, "523: Data too long to fit in symbol");
return ZINT_ERROR_TOO_LONG;
}
@ -1313,7 +1313,7 @@ int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size
error_number = data_matrix_200(symbol, source, in_length);
} else {
/* ECC 000 - 140 */
strcpy(symbol->errtxt, "Older Data Matrix standards are no longer supported (E13)");
strcpy(symbol->errtxt, "524: Older Data Matrix standards are no longer supported");
error_number = ZINT_ERROR_INVALID_OPTION;
}

View File

@ -1216,7 +1216,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
#endif /* _MSC_VER */
if (symbol->eci > 811799) {
strcpy(symbol->errtxt, "Invalid ECI");
strcpy(symbol->errtxt, "525: Invalid ECI");
return ZINT_ERROR_INVALID_OPTION;
}
@ -1282,7 +1282,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 (E20)");
strcpy(symbol->errtxt, "526: Specified symbol size is too large (E20)");
return ZINT_ERROR_INVALID_OPTION;
}

View File

@ -174,28 +174,28 @@ int emf_plot(struct zint_symbol *symbol) {
box_t box;
#ifndef _MSC_VER
unsigned char local_text[bump_up(ustrlen(symbol->text) + 1)];
unsigned char string_buffer[2 * bump_up(ustrlen(symbol->text) + 1)];
#else
unsigned char* local_text;
unsigned char* string_buffer;
emr_rectangle_t *rectangle, *row_binding;
emr_ellipse_t* circle;
emr_polygon_t* hexagon;
local_text = (unsigned char*) _alloca(bump_up(ustrlen(symbol->text) + 1) * sizeof (unsigned char));
string_buffer = (unsigned char*) _alloca(2 * bump_up(ustrlen(symbol->text) + 1) * sizeof (unsigned char));
#endif
row_height = 0;
textdone = 0;
comp_offset = 0;
this_rectangle = 0;
this_circle = 0;
this_hexagon = 0;
dx = 0;
latch = 0;
#ifndef _MSC_VER
unsigned char local_text[bump_up(ustrlen(symbol->text) + 1)];
unsigned char string_buffer[2 * bump_up(ustrlen(symbol->text) + 1)];
#else
unsigned char* local_text;
unsigned char* string_buffer;
emr_rectangle_t *rectangle, *row_binding;
emr_ellipse_t* circle;
emr_polygon_t* hexagon;
local_text = (unsigned char*) _alloca(bump_up(ustrlen(symbol->text) + 1) * sizeof (unsigned char));
string_buffer = (unsigned char*) _alloca(2 * bump_up(ustrlen(symbol->text) + 1) * sizeof (unsigned char));
#endif
row_height = 0;
textdone = 0;
comp_offset = 0;
this_rectangle = 0;
this_circle = 0;
this_hexagon = 0;
dx = 0;
latch = 0;
for(i = 0; i < 6; i++) {
regw[i] = '\0';
regx[i] = '\0';
@ -239,12 +239,12 @@ int emf_plot(struct zint_symbol *symbol) {
to_upper((unsigned char*) symbol->bgcolour);
if (strlen(symbol->fgcolour) != 6) {
strcpy(symbol->errtxt, "Malformed foreground colour target (F41)");
strcpy(symbol->errtxt, "641: Malformed foreground colour target");
return ZINT_ERROR_INVALID_OPTION;
}
if (strlen(symbol->bgcolour) != 6) {
strcpy(symbol->errtxt, "Malformed background colour target (F42)");
strcpy(symbol->errtxt, "642: Malformed background colour target");
return ZINT_ERROR_INVALID_OPTION;
}
@ -1016,7 +1016,7 @@ int emf_plot(struct zint_symbol *symbol) {
emf_file = fopen(symbol->outfile, "w");
}
if (emf_file == NULL) {
strcpy(symbol->errtxt, "Could not open output file (F40)");
strcpy(symbol->errtxt, "640: Could not open output file");
return ZINT_ERROR_FILE_ACCESS;
}

View File

@ -279,14 +279,14 @@ int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
if ((symbol->output_options & BARCODE_STDOUT) != 0) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
strcpy(symbol->errtxt, "Can't open output file");
strcpy(symbol->errtxt, "610: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
#endif
gif_file = stdout;
} else {
if (!(gif_file = fopen(symbol->outfile, "wb"))) {
strcpy(symbol->errtxt, "Can't open output file (F10)");
strcpy(symbol->errtxt, "611: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
}

View File

@ -1044,7 +1044,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
j++;
} while ((j < 7445) && (glyph == 0));
if (glyph == 0) {
strcpy(symbol->errtxt, "Invalid character in input data (E30)");
strcpy(symbol->errtxt, "530: Invalid character in input data");
return ZINT_ERROR_INVALID_DATA;
}
gbdata[i] = glyph;
@ -1055,13 +1055,13 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
if (symbol->output_options & READER_INIT) reader = 1;
if (symbol->eci > 811799) {
strcpy(symbol->errtxt, "Invalid ECI");
strcpy(symbol->errtxt, "533: Invalid ECI");
return ZINT_ERROR_INVALID_OPTION;
}
error_number = gm_encode(gbdata, length, binary, reader, symbol->eci, symbol->debug);
if (error_number != 0) {
strcpy(symbol->errtxt, "Input data too long (E31)");
strcpy(symbol->errtxt, "531: Input data too long");
return error_number;
}
@ -1102,7 +1102,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
if (symbol->option_2 > min_layers) {
layers = symbol->option_2;
} else {
strcpy(symbol->errtxt, "Input data too long for selected symbol size");
strcpy(symbol->errtxt, "534: Input data too long for selected symbol size");
return ZINT_ERROR_TOO_LONG;
}
}
@ -1149,7 +1149,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
}
if (data_cw > data_max) {
strcpy(symbol->errtxt, "Input data too long (E32)");
strcpy(symbol->errtxt, "532: Input data too long");
return ZINT_ERROR_TOO_LONG;
}

View File

@ -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 (B50)");
strcpy(symbol->errtxt, "250: Extended ASCII characters are not supported by GS1");
return ZINT_ERROR_INVALID_DATA;
}
if (source[i] < 32) {
strcpy(symbol->errtxt, "Control characters are not supported by GS1 (B51)");
strcpy(symbol->errtxt, "251: Control characters are not supported by GS1 ");
return ZINT_ERROR_INVALID_DATA;
}
}
if (source[0] != '[') {
strcpy(symbol->errtxt, "Data does not start with an AI (B52)");
strcpy(symbol->errtxt, "252: Data does not start with an AI");
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) (B53)");
strcpy(symbol->errtxt, "253: Malformed AI in input data (brackets don\'t match)");
return ZINT_ERROR_INVALID_DATA;
}
if (max_bracket_level > 1) {
/* Nested brackets */
strcpy(symbol->errtxt, "Found nested brackets in input data (B54)");
strcpy(symbol->errtxt, "254: Found nested brackets in input data");
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) (B55)");
strcpy(symbol->errtxt, "255: Invalid AI in input data (AI too long)");
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) (B56)");
strcpy(symbol->errtxt, "256: Invalid AI in input data (AI too short)");
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) (B57)");
strcpy(symbol->errtxt, "257: Invalid AI in input data (non-numeric characters in AI)");
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 (B58)");
strcpy(symbol->errtxt, "258: Empty data field in input data");
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 (B59)");
strcpy(symbol->errtxt, "259: Invalid data length for AI ");
strcat(symbol->errtxt, ai_string);
return ZINT_ERROR_INVALID_DATA;
}
if (error_latch == 6) {
strcpy(symbol->errtxt, "Invalid AI value (B60)");
strcpy(symbol->errtxt, "260: Invalid AI value");
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 (B61)");
strcpy(symbol->errtxt, "261: ugs1_verify overflow");
return ZINT_ERROR_INVALID_DATA;
}

View File

@ -1364,7 +1364,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
/* Character not found */
if (done == 0) {
strcpy(symbol->errtxt, "Unknown character in input data (E40)");
strcpy(symbol->errtxt, "540: Unknown character in input data");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -1427,7 +1427,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
}
if (version == 85) {
strcpy(symbol->errtxt, "Input too long for selected error correction level (E41)");
strcpy(symbol->errtxt, "541: Input too long for selected error correction level");
return ZINT_ERROR_TOO_LONG;
}
@ -1440,7 +1440,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
}
if ((symbol->option_2 != 0) && (symbol->option_2 < version)) {
strcpy(symbol->errtxt, "Input too long for selected symbol size");
strcpy(symbol->errtxt, "542: Input too long for selected symbol size");
return ZINT_ERROR_TOO_LONG;
}

View File

@ -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 (D50)");
strcpy(symbol->errtxt, "450: Input too long");
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 (D51)");
strcpy(symbol->errtxt, "451: Invalid characters in data");
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 (D52)");
strcpy(symbol->errtxt, "452: Invalid length tracking code");
return ZINT_ERROR_INVALID_DATA;
}
if (strlen(zip) > 11) {
strcpy(symbol->errtxt, "Invalid ZIP code (D53)");
strcpy(symbol->errtxt, "453: Invalid ZIP code");
return ZINT_ERROR_INVALID_DATA;
}

View File

@ -221,9 +221,9 @@ void error_tag(char error_string[], int error_number) {
strcpy(error_buffer, error_string);
if (error_number > 4) {
strcpy(error_string, "error: ");
strcpy(error_string, "Error ");
} else {
strcpy(error_string, "warning: ");
strcpy(error_string, "Warning ");
}
strcat(error_string, error_buffer);
@ -244,7 +244,7 @@ int dump_plot(struct zint_symbol *symbol) {
} else {
f = fopen(symbol->outfile, "w");
if (!f) {
strcpy(symbol->errtxt, "Could not open output file (B01)");
strcpy(symbol->errtxt, "201: Could not open output file");
return ZINT_ERROR_FILE_ACCESS;
}
}
@ -292,13 +292,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 (B02)");
strcpy(symbol->errtxt, "202: Data too long for HIBC LIC");
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 (B03)");
strcpy(symbol->errtxt, "203: Invalid characters in data");
return error_number;
}
@ -651,7 +651,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 (B04)");
strcpy(symbol->errtxt, "204: Invalid characters in input data");
return error_number;
}
break;
@ -824,7 +824,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
in_length = (int)ustrlen(source);
}
if (in_length == 0) {
strcpy(symbol->errtxt, "No input data (B05)");
strcpy(symbol->errtxt, "205: No input data");
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA);
return ZINT_ERROR_INVALID_DATA;
}
@ -844,7 +844,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
/* First check the symbology field */
if (symbol->symbology < 1) {
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B06)");
strcpy(symbol->errtxt, "206: Symbology out of range, using Code 128");
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
}
@ -863,7 +863,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
symbol->symbology = BARCODE_UPCA;
}
if (symbol->symbology == 19) {
strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar (B07)");
strcpy(symbol->errtxt, "207: Codabar 18 not supported, using Codabar");
symbol->symbology = BARCODE_CODABAR;
error_number = ZINT_WARN_INVALID_OPTION;
}
@ -871,7 +871,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
symbol->symbology = BARCODE_UPCA;
}
if (symbol->symbology == 27) {
strcpy(symbol->errtxt, "UPCD1 not supported (B08)");
strcpy(symbol->errtxt, "208: UPCD1 not supported");
error_number = ZINT_ERROR_INVALID_OPTION;
}
if (symbol->symbology == 33) {
@ -893,7 +893,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
symbol->symbology = BARCODE_NVE18;
}
if (symbol->symbology == 54) {
strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128 (B10)");
strcpy(symbol->errtxt, "210: General Parcel Code not supported, using Code 128");
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
}
@ -907,7 +907,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
symbol->symbology = BARCODE_AUSPOST;
}
if (symbol->symbology == 73) {
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B11)");
strcpy(symbol->errtxt, "211: Symbology out of range, using Code 128");
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
}
@ -921,12 +921,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
symbol->symbology = BARCODE_EAN128;
}
if (symbol->symbology == 91) {
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B12)");
strcpy(symbol->errtxt, "212: Symbology out of range, using Code 128");
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 (B13)");
strcpy(symbol->errtxt, "213: Symbology out of range, using Code 128");
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
}
@ -952,7 +952,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
symbol->symbology = BARCODE_HIBC_BLOCKF;
}
if ((symbol->symbology == 113) || (symbol->symbology == 114)) {
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B14)");
strcpy(symbol->errtxt, "214: Symbology out of range, using Code 128");
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
}
@ -960,13 +960,13 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
symbol->symbology = BARCODE_DOTCODE;
}
if ((symbol->symbology >= 117) && (symbol->symbology <= 127)) {
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B15)");
strcpy(symbol->errtxt, "215: Symbology out of range, using Code 128");
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
}
/* Everything from 128 up is Zint-specific */
if (symbol->symbology >= 144) {
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B16)");
strcpy(symbol->errtxt, "216: Symbology out of range, using Code 128");
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
}
@ -979,12 +979,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
}
if ((!(supports_eci(symbol->symbology))) && (symbol->eci != 3)) {
strcpy(symbol->errtxt, "Symbology does not support ECI switching (B17)");
strcpy(symbol->errtxt, "217: Symbology does not support ECI switching");
error_number = ZINT_ERROR_INVALID_OPTION;
}
if ((symbol->eci < 3) || (symbol->eci > 999999)) {
strcpy(symbol->errtxt, "Invalid ECI mode (B18)");
strcpy(symbol->errtxt, "218: Invalid ECI mode");
error_number = ZINT_ERROR_INVALID_OPTION;
}
@ -999,7 +999,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
if (symbol->input_mode == GS1_MODE) {
for (i = 0; i < in_length; i++) {
if (source[i] == '\0') {
strcpy(symbol->errtxt, "NULL characters not permitted in GS1 mode (B19)");
strcpy(symbol->errtxt, "219: NULL characters not permitted in GS1 mode");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -1010,7 +1010,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
}
in_length =(int)ustrlen(local_source);
} else {
strcpy(symbol->errtxt, "Selected symbology does not support GS1 mode (B20)");
strcpy(symbol->errtxt, "220: Selected symbology does not support GS1 mode");
return ZINT_ERROR_INVALID_OPTION;
}
} else {
@ -1019,7 +1019,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
}
if ((symbol->dot_size < 0.01) || (symbol->dot_size > 20.0)) {
strcpy(symbol->errtxt, "Invalid dot size (B21)");
strcpy(symbol->errtxt, "221: Invalid dot size");
return ZINT_ERROR_INVALID_OPTION;
}
@ -1042,7 +1042,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
symbol->eci = get_best_eci(local_source, in_length);
error_number = ZINT_WARN_USES_ECI;
strcpy(symbol->errtxt, "Encoded data includes ECI codes (B22)");
strcpy(symbol->errtxt, "222: Encoded data includes ECI codes");
//printf("Data will encode with ECI %d\n", symbol->eci);
switch (symbol->symbology) {
@ -1092,13 +1092,13 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
case 270:
break;
default:
strcpy(symbol->errtxt, "Invalid rotation angle (B23)");
strcpy(symbol->errtxt, "223: Invalid rotation angle");
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 (B24)");
strcpy(symbol->errtxt, "224: Selected symbology cannot be rendered as dots");
return ZINT_ERROR_INVALID_OPTION;
}
}
@ -1152,19 +1152,19 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
if (!(strcmp(output, "EMF"))) {
error_number = emf_plot(symbol);
} else {
strcpy(symbol->errtxt, "Unknown output format (B25)");
strcpy(symbol->errtxt, "225: Unknown output format");
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
return ZINT_ERROR_INVALID_OPTION;
}
} else {
strcpy(symbol->errtxt, "Unknown output format (B26)");
strcpy(symbol->errtxt, "226: Unknown output format");
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 (B27)");
strcpy(symbol->errtxt, "227: Unknown output format");
}
error_tag(symbol->errtxt, error_number);
@ -1181,7 +1181,7 @@ int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle) {
case 270:
break;
default:
strcpy(symbol->errtxt, "Invalid rotation angle (B28)");
strcpy(symbol->errtxt, "228: Invalid rotation angle");
return ZINT_ERROR_INVALID_OPTION;
}
@ -1227,7 +1227,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 (B29)");
strcpy(symbol->errtxt, "229: Unable to read input file");
return ZINT_ERROR_INVALID_DATA;
}
@ -1238,7 +1238,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 (B30)");
strcpy(symbol->errtxt, "230: Input file too long");
fclose(file);
return ZINT_ERROR_INVALID_DATA;
}
@ -1247,7 +1247,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 (B31)");
strcpy(symbol->errtxt, "231: Internal memory error");
if (strcmp(filename, "-"))
fclose(file);
return ZINT_ERROR_MEMORY;

View File

@ -616,7 +616,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 (E50)");
strcpy(symbol->errtxt, "550: Invalid Maxicode Mode");
return ZINT_ERROR_INVALID_OPTION;
}
@ -625,13 +625,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 (E51)");
strcpy(symbol->errtxt, "551: Invalid Primary String");
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 (E52)");
strcpy(symbol->errtxt, "552: Invalid Primary String");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -674,7 +674,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 (E53)");
strcpy(symbol->errtxt, "553: Input data too long");
return i;
}

View File

@ -65,19 +65,19 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
char dest[64]; /* 17 * 2 + 1 */
if (length > 6) {
strcpy(symbol->errtxt, "Input too long (C50)");
strcpy(symbol->errtxt, "350: Input too long");
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 (C51)");
strcpy(symbol->errtxt, "351: Invalid characters in data");
return error_number;
}
tester = atoi((char*) source);
if ((tester < 3) || (tester > 131070)) {
strcpy(symbol->errtxt, "Data out of range (C52)");
strcpy(symbol->errtxt, "352: Data out of range");
return ZINT_ERROR_INVALID_DATA;
}
@ -120,7 +120,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 (C53)");
strcpy(symbol->errtxt, "353: Data out of range");
return ZINT_ERROR_INVALID_DATA;
}
error_number = 0;
@ -160,12 +160,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 (C54)");
strcpy(symbol->errtxt, "354: Input too long");
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 (C55)");
strcpy(symbol->errtxt, "355: Invalid characters in data");
return error_number;
}
error_number = pharma_two_calc(symbol, source, height_pattern);
@ -200,25 +200,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 (C56)");
strcpy(symbol->errtxt, "356: Input too long");
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 (C57)");
strcpy(symbol->errtxt, "357: Invalid characters in data");
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 (C58)");
strcpy(symbol->errtxt, "358: Invalid characters in data");
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 (C59)");
strcpy(symbol->errtxt, "359: Invalid characters in data");
return ZINT_ERROR_INVALID_DATA;
}
@ -241,12 +241,12 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
/* Validate the input */
if (length > 8) {
strcpy(symbol->errtxt, "Input too long (C5A)");
strcpy(symbol->errtxt, "360: Input too long");
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 (C5B)");
strcpy(symbol->errtxt, "361: Invalid characters in data");
return error_number;
}

View File

@ -104,14 +104,14 @@ int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
if (symbol->output_options & BARCODE_STDOUT) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
strcpy(symbol->errtxt, "Can't open output file");
strcpy(symbol->errtxt, "620: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
#endif
pcx_file = stdout;
} else {
if (!(pcx_file = fopen(symbol->outfile, "wb"))) {
strcpy(symbol->errtxt, "Can't open output file (F20)");
strcpy(symbol->errtxt, "621: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
}

View File

@ -638,7 +638,7 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size
}
if (symbol->eci > 811799) {
strcpy(symbol->errtxt, "Invalid ECI");
strcpy(symbol->errtxt, "472: Invalid ECI");
return ZINT_ERROR_INVALID_OPTION;
}
@ -834,12 +834,12 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], const size_t l
error_number = 0;
if ((symbol->option_1 < -1) || (symbol->option_1 > 8)) {
strcpy(symbol->errtxt, "Security value out of range (D60)");
strcpy(symbol->errtxt, "460: Security value out of range");
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 (D61)");
strcpy(symbol->errtxt, "461: Number of columns out of range");
symbol->option_2 = 0;
error_number = ZINT_WARN_INVALID_OPTION;
}
@ -851,26 +851,26 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], const size_t l
if (codeerr != 0) {
switch (codeerr) {
case 1:
strcpy(symbol->errtxt, "No such file or file unreadable (D62)");
strcpy(symbol->errtxt, "462: No such file or file unreadable");
error_number = ZINT_ERROR_INVALID_OPTION;
break;
case 2:
strcpy(symbol->errtxt, "Input string too long (D63)");
strcpy(symbol->errtxt, "463: Input string too long");
error_number = ZINT_ERROR_TOO_LONG;
break;
case 3:
strcpy(symbol->errtxt, "Number of codewords per row too small (D64)");
strcpy(symbol->errtxt, "464: Number of codewords per row too small");
error_number = ZINT_WARN_INVALID_OPTION;
break;
case 4:
strcpy(symbol->errtxt, "Data too long for specified number of columns (D65)");
strcpy(symbol->errtxt, "465: Data too long for specified number of columns");
error_number = ZINT_ERROR_TOO_LONG;
break;
case ZINT_ERROR_INVALID_OPTION:
error_number = codeerr;
break;
default:
strcpy(symbol->errtxt, "Something strange happened (D66)");
strcpy(symbol->errtxt, "466: Something strange happened");
error_number = ZINT_ERROR_ENCODING_PROBLEM;
break;
}
@ -943,7 +943,7 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
}
if (symbol->eci > 811799) {
strcpy(symbol->errtxt, "Invalid ECI");
strcpy(symbol->errtxt, "473: Invalid ECI");
return ZINT_ERROR_INVALID_OPTION;
}
@ -989,11 +989,11 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
/* This is where it all changes! */
if (mclength > 126) {
strcpy(symbol->errtxt, "Input data too long (D67)");
strcpy(symbol->errtxt, "467: Input data too long");
return ZINT_ERROR_TOO_LONG;
}
if (symbol->option_2 > 4) {
strcpy(symbol->errtxt, "Specified width out of range (D68)");
strcpy(symbol->errtxt, "468: Specified width out of range");
symbol->option_2 = 0;
codeerr = ZINT_WARN_INVALID_OPTION;
}
@ -1013,21 +1013,21 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
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 (D69)");
strcpy(symbol->errtxt, "469: Specified symbol size too small for data");
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 (D6A)");
strcpy(symbol->errtxt, "470: Specified symbol size too small for data");
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 (D6B)");
strcpy(symbol->errtxt, "471: Specified symbol size too small for data");
codeerr = ZINT_WARN_INVALID_OPTION;
}

View File

@ -58,12 +58,12 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t len
int error_number;
if (length > 65) {
strcpy(symbol->errtxt, "Input too long (C70)");
strcpy(symbol->errtxt, "370: Input too long");
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 (C71)");
strcpy(symbol->errtxt, "371: Invalid characters in data");
return error_number;
}
checkptr = (unsigned char *) calloc(1, length * 4 + 8);
@ -116,7 +116,7 @@ int msi_plessey(struct zint_symbol *symbol, unsigned char source[], const size_t
char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */
if (length > 55) {
strcpy(symbol->errtxt, "Input too long (C72)");
strcpy(symbol->errtxt, "372: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -148,7 +148,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 (C73)");
strcpy(symbol->errtxt, "373: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -216,7 +216,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 (C74)");
strcpy(symbol->errtxt, "374: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -317,7 +317,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 (C75)");
strcpy(symbol->errtxt, "375: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -380,7 +380,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 (C76)");
strcpy(symbol->errtxt, "376: Input too long");
return ZINT_ERROR_TOO_LONG;
}
@ -466,7 +466,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 (C77)");
strcpy(symbol->errtxt, "377: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
}

View File

@ -102,14 +102,14 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
if (symbol->output_options & BARCODE_STDOUT) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
strcpy(symbol->errtxt, "Can't open output file");
strcpy(symbol->errtxt, "631: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
#endif
graphic->outfile = stdout;
} else {
if (!(graphic->outfile = fopen(symbol->outfile, "wb"))) {
strcpy(symbol->errtxt, "Can't open output file (F32)");
strcpy(symbol->errtxt, "632: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
}
@ -117,21 +117,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 (F33)");
strcpy(symbol->errtxt, "633: Out of memory");
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 (F34)");
strcpy(symbol->errtxt, "634: Out of memory");
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 (F35)");
strcpy(symbol->errtxt, "635: libpng error occurred");
return ZINT_ERROR_MEMORY;
}

View File

@ -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 (D80)");
strcpy(symbol->errtxt, "480: Input too long");
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 (D81)");
strcpy(symbol->errtxt, "481: Invalid characters in data");
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 (D82)");
strcpy(symbol->errtxt, "482: Input too long");
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 (D83)");
strcpy(symbol->errtxt, "483: Invalid characters in data");
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 (D84)");
strcpy(symbol->errtxt, "484: Input too long");
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 (D85)");
strcpy(symbol->errtxt, "485: Invalid characters in data");
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 (D86)");
strcpy(symbol->errtxt, "486: Input too long");
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 (D87)");
strcpy(symbol->errtxt, "487: Invalid characters in data");
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 (D88)");
strcpy(symbol->errtxt, "488: Input too long");
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 (D89)");
strcpy(symbol->errtxt, "489: Invalid characters in data");
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 (D8A)");
strcpy(symbol->errtxt, "490: Input too long");
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 (D8B)");
strcpy(symbol->errtxt, "491: Invalid characters in data");
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 (D8C)");
strcpy(symbol->errtxt, "492: Input too long");
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 (D8D)");
strcpy(symbol->errtxt, "493: Invalid characters in data");
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 (D8E)");
strcpy(symbol->errtxt, "494: Input too long");
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 (D8F)");
strcpy(symbol->errtxt, "495: Invalid characters in data");
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 (D8G)");
strcpy(symbol->errtxt, "496: Input too long");
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 (D8H)");
strcpy(symbol->errtxt, "497: Invalid characters in data");
return error_number;
}
memset(inter, 'd', 20); /* Pad character CC4 */

View File

@ -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 (F40)");
strcpy(symbol->errtxt, "645: Could not open output file");
#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 (F41)");
strcpy(symbol->errtxt, "646: Malformed foreground colour target");
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 (F42)");
strcpy(symbol->errtxt, "647: Malformed background colour target");
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 (F43)");
strcpy(symbol->errtxt, "648: Malformed foreground colour target");
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 (F44)");
strcpy(symbol->errtxt, "649: Malformed background colour target");
fclose(feps);
#ifdef _MSC_VER
free(local_text);

View File

@ -1448,7 +1448,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
j++;
} while ((j < 6843) && (glyph == 0));
if (glyph == 0) {
strcpy(symbol->errtxt, "Invalid character in input data (E60)");
strcpy(symbol->errtxt, "560: Invalid character in input data");
return ZINT_ERROR_INVALID_DATA;
}
jisdata[i] = glyph;
@ -1479,7 +1479,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
}
if (est_binlen > (8 * max_cw)) {
strcpy(symbol->errtxt, "Input too long for selected error correction level (E61)");
strcpy(symbol->errtxt, "561: Input too long for selected error correction level");
return ZINT_ERROR_TOO_LONG;
}
@ -1564,7 +1564,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
}
if (symbol->option_2 < version) {
strcpy(symbol->errtxt, "Input too long for selected symbol size");
strcpy(symbol->errtxt, "569: Input too long for selected symbol size");
return ZINT_ERROR_TOO_LONG;
}
}
@ -2581,7 +2581,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
#endif
if (length > 35) {
strcpy(symbol->errtxt, "Input data too long (E62)");
strcpy(symbol->errtxt, "562: Input data too long");
return ZINT_ERROR_TOO_LONG;
}
@ -2613,7 +2613,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
j++;
} while ((j < 6843) && (glyph == 0));
if (glyph == 0) {
strcpy(symbol->errtxt, "Invalid character in input data (E63)");
strcpy(symbol->errtxt, "563: Invalid character in input data");
return ZINT_ERROR_INVALID_DATA;
}
jisdata[i] = glyph;
@ -2650,7 +2650,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
error_number = micro_qr_intermediate(binary_stream, jisdata, mode, length, &kanji_used, &alphanum_used, &byte_used, symbol->debug);
if (error_number != 0) {
strcpy(symbol->errtxt, "Input data too long (E64)");
strcpy(symbol->errtxt, "564: Input data too long");
return error_number;
}
@ -2682,7 +2682,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
version_valid[2] = 0;
}
if (binary_count[3] > 128) {
strcpy(symbol->errtxt, "Input data too long (E65)");
strcpy(symbol->errtxt, "565: Input data too long");
return ZINT_ERROR_TOO_LONG;
}
@ -2693,7 +2693,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
}
if (ecc_level == LEVEL_H) {
strcpy(symbol->errtxt, "Error correction level H not available (E66)");
strcpy(symbol->errtxt, "566: Error correction level H not available");
return ZINT_ERROR_INVALID_OPTION;
}
@ -2702,7 +2702,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
version_valid[1] = 0;
version_valid[2] = 0;
if (binary_count[3] > 80) {
strcpy(symbol->errtxt, "Input data too long (E67)");
strcpy(symbol->errtxt, "567: Input data too long");
return ZINT_ERROR_TOO_LONG;
}
}
@ -2716,7 +2716,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
version_valid[2] = 0;
}
if (binary_count[3] > 112) {
strcpy(symbol->errtxt, "Input data too long (E68)");
strcpy(symbol->errtxt, "568: Input data too long");
return ZINT_ERROR_TOO_LONG;
}
}
@ -2738,7 +2738,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
if (symbol->option_2 >= autoversion) {
version = symbol->option_2;
} else {
strcpy(symbol->errtxt, "Input too long for selected symbol size");
strcpy(symbol->errtxt, "570: Input too long for selected symbol size");
return ZINT_ERROR_TOO_LONG;
}
}
@ -2919,13 +2919,13 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt
}
break;
case GS1_MODE:
strcpy(symbol->errtxt, "UPNQR does not support GS-1 encoding");
strcpy(symbol->errtxt, "571: UPNQR does not support GS-1 encoding");
return ZINT_ERROR_INVALID_OPTION;
break;
case UNICODE_MODE:
error_number = utf_to_eci(4, source, preprocessed, &length);
if (error_number != 0) {
strcpy(symbol->errtxt, "Invalid characters in input data (B04)");
strcpy(symbol->errtxt, "572: Invalid characters in input data");
return error_number;
}
for (i = 0; i < length; i++) {
@ -2941,7 +2941,7 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt
ecc_level = LEVEL_M;
if (est_binlen > 3320) {
strcpy(symbol->errtxt, "Input too long for selected symbol");
strcpy(symbol->errtxt, "573: Input too long for selected symbol");
return ZINT_ERROR_TOO_LONG;
}

View File

@ -96,7 +96,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))) {
strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F50)");
strcpy(symbol->errtxt, "650: Insufficient memory for pixel buffer");
return ZINT_ERROR_ENCODING_PROBLEM;
}
@ -118,24 +118,24 @@ 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 (F51)");
strcpy(symbol->errtxt, "651: Malformed foreground colour target");
free(rotated_pixbuf);
return ZINT_ERROR_INVALID_OPTION;
}
if (strlen(symbol->bgcolour) != 6) {
strcpy(symbol->errtxt, "Malformed background colour target (F52)");
strcpy(symbol->errtxt, "652: Malformed background colour target");
free(rotated_pixbuf);
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 (F53)");
strcpy(symbol->errtxt, "653: Malformed foreground colour target");
free(rotated_pixbuf);
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 (F54)");
strcpy(symbol->errtxt, "654: Malformed background colour target");
free(rotated_pixbuf);
return ZINT_ERROR_INVALID_OPTION;
}
@ -495,7 +495,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))) {
strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F55)");
strcpy(symbol->errtxt, "655: Insufficient memory for pixel buffer");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (image_width * image_height); i++) {
@ -506,7 +506,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))) {
strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F56)");
strcpy(symbol->errtxt, "656: Insufficient memory for pixel buffer");
free(scaled_hexagon);
free(pixelbuf);
return ZINT_ERROR_ENCODING_PROBLEM;
@ -617,7 +617,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))) {
strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F57)");
strcpy(symbol->errtxt, "657: Insufficient memory for pixel buffer");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (scale_width * scale_height); i++) {
@ -792,7 +792,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))) {
strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F58)");
strcpy(symbol->errtxt, "658: Insufficient memory for pixel buffer");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (image_width * image_height); i++) {
@ -1095,7 +1095,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);
strcpy(symbol->errtxt, "Insufficient memory for pixel buffer (F59)");
strcpy(symbol->errtxt, "659: Insufficient memory for pixel buffer");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (scale_width * scale_height); i++) {

View File

@ -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 (C80)");
strcpy(symbol->errtxt, "380: Input too long");
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 (C81)");
strcpy(symbol->errtxt, "381: Invalid characters in data");
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 (C82)");
strcpy(symbol->errtxt, "382: Input too long");
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 (C83)");
strcpy(symbol->errtxt, "383: Invalid characters in data");
return error_number;
}
if (src_len == 13) {
if ((source[0] != '0') && (source[0] != '1')) {
strcpy(symbol->errtxt, "Input out of range (C84)");
strcpy(symbol->errtxt, "384: Input out of range");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -1361,7 +1361,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 (C85)");
strcpy(symbol->errtxt, "385: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -1576,7 +1576,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 (C86)");
strcpy(symbol->errtxt, "386: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
}
@ -1812,7 +1812,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
}
if (strlen(binary_string) > 252) {
strcpy(symbol->errtxt, "Input too long");
strcpy(symbol->errtxt, "387: Input too long");
return ZINT_ERROR_TOO_LONG;
}

View File

@ -105,7 +105,7 @@ int svg_plot(struct zint_symbol *symbol) {
fsvg = fopen(symbol->outfile, "w");
}
if (fsvg == NULL) {
strcpy(symbol->errtxt, "Could not open output file (F60)");
strcpy(symbol->errtxt, "660: Could not open output file");
return ZINT_ERROR_FILE_ACCESS;
}
@ -114,24 +114,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 (F61)");
strcpy(symbol->errtxt, "661: Malformed foreground colour target");
fclose(fsvg);
return ZINT_ERROR_INVALID_OPTION;
}
if (strlen(symbol->bgcolour) != 6) {
strcpy(symbol->errtxt, "Malformed background colour target (F62)");
strcpy(symbol->errtxt, "662: Malformed background colour target");
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 (F63)");
strcpy(symbol->errtxt, "663: Malformed foreground colour target");
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 (F64)");
strcpy(symbol->errtxt, "664: Malformed background colour target");
fclose(fsvg);
return ZINT_ERROR_INVALID_OPTION;
}

View File

@ -66,7 +66,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], const size_t src
count = 0;
if (src_len > 30) {
strcpy(symbol->errtxt, "Input too long (C90)");
strcpy(symbol->errtxt, "390: Input too long");
return ZINT_ERROR_TOO_LONG;
}
/* Start character */
@ -75,7 +75,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], const size_t src
for (i = 0; i < src_len; i++) {
if (source[i] > 126) {
/* Cannot encode extended ASCII */
strcpy(symbol->errtxt, "Invalid characters in input data (C91)");
strcpy(symbol->errtxt, "391: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
}
strcat(dest, TeleTable[source[i]]);
@ -113,14 +113,14 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t
count = 0;
if (temp_length > 60) {
strcpy(symbol->errtxt, "Input too long (C92)");
strcpy(symbol->errtxt, "392: Input too long");
return ZINT_ERROR_TOO_LONG;
}
ustrcpy(temp, source);
to_upper(temp);
error_number = is_sane(SODIUM, temp, temp_length);
if (error_number == ZINT_ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "Invalid characters in data (C93)");
strcpy(symbol->errtxt, "393: Invalid characters in data");
return error_number;
}
@ -137,7 +137,7 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t
for (i = 0; i < temp_length; i += 2) {
if (temp[i] == 'X') {
strcpy(symbol->errtxt, "Invalid position of X in Telepen data (C94)");
strcpy(symbol->errtxt, "394: Invalid position of X in Telepen data");
return ZINT_ERROR_INVALID_DATA;
}

View File

@ -57,10 +57,10 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
int free_memory;
int row, column;
FILE *tif_file;
#ifdef _MSC_VER
uint32_t* strip_offset;
uint32_t* strip_bytes;
#endif
#ifdef _MSC_VER
uint32_t* strip_offset;
uint32_t* strip_bytes;
#endif
tiff_header_t header;
tiff_ifd_t ifd;
@ -115,7 +115,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
free(strip_offset);
free(strip_bytes);
#endif
strcpy(symbol->errtxt, "Output file size too big (T00)");
strcpy(symbol->errtxt, "670: Output file size too big");
return ZINT_ERROR_MEMORY;
}
@ -123,14 +123,14 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
if (symbol->output_options & BARCODE_STDOUT) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
strcpy(symbol->errtxt, "Can't open output file");
strcpy(symbol->errtxt, "671: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
#endif
tif_file = stdout;
} else {
if (!(tif_file = fopen(symbol->outfile, "wb"))) {
strcpy(symbol->errtxt, "Can't open output file (T01)");
strcpy(symbol->errtxt, "672: Can't open output file");
return ZINT_ERROR_FILE_ACCESS;
}
}

View File

@ -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 (C60)");
strcpy(symbol->errtxt, "270: Invalid check digit");
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 (C61)");
strcpy(symbol->errtxt, "271: Invalid UPC-E data");
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 (C62)");
strcpy(symbol->errtxt, "272: Invalid UPC-E data");
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 (C63)");
strcpy(symbol->errtxt, "273: Invalid UPC-E data");
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 (C64)");
strcpy(symbol->errtxt, "274: Invalid check digit");
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 (C65)");
strcpy(symbol->errtxt, "275: Invalid check digit");
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 (C66)");
strcpy(symbol->errtxt, "276: Invalid check digit");
return ZINT_ERROR_INVALID_DATA;
}
gtin[length - 1] = upc_check(gtin);
@ -512,26 +512,26 @@ static int isbn(struct zint_symbol *symbol, unsigned char source[], const size_t
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 (C67)");
strcpy(symbol->errtxt, "277: Invalid characters in input");
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 (C68)");
strcpy(symbol->errtxt, "278: Input wrong length");
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 (C69)");
strcpy(symbol->errtxt, "279: Invalid ISBN");
return ZINT_ERROR_INVALID_DATA;
}
check_digit = isbn13_check(source);
if (source[src_len - 1] != check_digit) {
strcpy(symbol->errtxt, "Incorrect ISBN check (C6A)");
strcpy(symbol->errtxt, "280: Incorrect ISBN check");
return ZINT_ERROR_INVALID_CHECK;
}
source[12] = '\0';
@ -542,7 +542,7 @@ static int isbn(struct zint_symbol *symbol, unsigned char source[], const size_t
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 (C6B)");
strcpy(symbol->errtxt, "281: Incorrect ISBN check");
return ZINT_ERROR_INVALID_CHECK;
}
for (i = 13; i > 0; i--) {
@ -566,7 +566,7 @@ static int isbn(struct zint_symbol *symbol, unsigned char source[], const size_t
/* Verify check digit */
check_digit = isbn_check(source);
if (check_digit != source[ustrlen(source) - 1]) {
strcpy(symbol->errtxt, "Incorrect SBN check (C6C)");
strcpy(symbol->errtxt, "282: Incorrect SBN check");
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 (C6D)");
strcpy(symbol->errtxt, "283: Input too long");
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 (C6E)");
strcpy(symbol->errtxt, "284: Invalid characters in data");
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 (C6F)");
strcpy(symbol->errtxt, "285: Invalid characters in input");
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 (C6G)");
default: strcpy(symbol->errtxt, "286: Invalid length input");
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 (C6H)");
default: strcpy(symbol->errtxt, "287: Invalid length EAN input");
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 (C6I)");
strcpy(symbol->errtxt, "288: 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 (C6J)");
strcpy(symbol->errtxt, "289: UPCA input wrong length");
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 (C6K)");
strcpy(symbol->errtxt, "290: Input wrong length");
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 (C6L)");
strcpy(symbol->errtxt, "291: UPCE input wrong length");
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 (C6M)");
strcpy(symbol->errtxt, "292: Invalid length input");
return ZINT_ERROR_TOO_LONG;
}

View File

@ -281,7 +281,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 (A01)");
strcpy(symbol->errtxt, "101: Format string too long");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -292,7 +292,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 (A02)");
strcpy(symbol->errtxt, "102: Unable to read input file");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -415,7 +415,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 (A03)\n", line_count);
fprintf(stderr, "103 on line %d: Input data too long\n", line_count);
fflush(stderr);
do {
character = fgetc(file);
@ -424,7 +424,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 (A04)\n");
fprintf(stderr, "warning 104: No newline at end of file\n");
fflush(stderr);
}
@ -570,7 +570,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 (A05)\n");
fprintf(stderr, "105: Invalid scale value\n");
fflush(stderr);
my_symbol->scale = 1.0;
}
@ -579,7 +579,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 (A06)\n");
fprintf(stderr, "106: Invalid dot radius value\n");
fflush(stderr);
my_symbol->dot_size = 4.0F / 5.0F;
}
@ -587,26 +587,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 (A07)\n");
fprintf(stderr, "107: Invalid border width\n");
exit(1);
}
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
my_symbol->border_width = atoi(optarg);
} else {
fprintf(stderr, "Border width out of range (A08)\n");
fprintf(stderr, "108: Border width out of range\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 (A09)\n");
fprintf(stderr, "109: Invalid symbol height\n");
exit(1);
}
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 1000)) {
my_symbol->height = atoi(optarg);
} else {
fprintf(stderr, "Symbol height out of range (A10)\n");
fprintf(stderr, "110: Symbol height out of range\n");
fflush(stderr);
}
}
@ -615,7 +615,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 (A11)\n");
fprintf(stderr, "111: Number of columns out of range\n");
fflush(stderr);
}
}
@ -623,7 +623,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 (A12)\n");
fprintf(stderr, "112: Number of rows out of range\n");
fflush(stderr);
}
}
@ -631,7 +631,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 (A13)\n");
fprintf(stderr, "113: Invalid Version\n");
fflush(stderr);
}
}
@ -639,7 +639,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 (A14)\n");
fprintf(stderr, "114: ECC level out of range\n");
fflush(stderr);
}
}
@ -647,7 +647,7 @@ int main(int argc, char **argv) {
if (strlen(optarg) <= 90) {
strcpy(my_symbol->primary, optarg);
} else {
fprintf(stderr, "Primary data string too long (A15)");
fprintf(stderr, "115: Primary data string too long");
fflush(stderr);
}
}
@ -655,7 +655,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 (A16)\n");
fprintf(stderr, "116: Invalid mode\n");
fflush(stderr);
}
}
@ -663,7 +663,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 (A17)\n");
fprintf(stderr, "117: Invalid rotation parameter\n");
exit(1);
}
switch (atoi(optarg)) {
@ -693,7 +693,7 @@ int main(int argc, char **argv) {
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 999999)) {
my_symbol->eci = atoi(optarg);
} else {
fprintf(stderr, "Invalid ECI code (A18)\n");
fprintf(stderr, "118: Invalid ECI code\n");
fflush(stderr);
}
}
@ -717,7 +717,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 (A19)\n");
fprintf(stderr, "119: Invalid barcode type\n");
exit(1);
}
my_symbol->symbology = atoi(optarg);
@ -726,13 +726,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 (A20)\n");
fprintf(stderr, "120: Invalid whitespace value\n");
exit(1);
}
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
my_symbol->whitespace_width = atoi(optarg);
} else {
fprintf(stderr, "Whitespace value out of range (A21)");
fprintf(stderr, "121: Whitespace value out of range");
fflush(stderr);
}
break;
@ -759,7 +759,7 @@ int main(int argc, char **argv) {
return 1;
}
} else {
fprintf(stderr, "Cannot define data in batch mode (A22)");
fprintf(stderr, "122: Cannot define data in batch mode");
fflush(stderr);
}
break;
@ -810,13 +810,13 @@ int main(int argc, char **argv) {
break;
default:
fprintf(stderr, "?? getopt error 0%o (A23)\n", c);
fprintf(stderr, "123: ?? getopt error 0%o\n", c);
fflush(stderr);
}
}
if (optind < argc) {
fprintf(stderr, "Invalid option ");
fprintf(stderr, "125: Invalid option\n");
while (optind < argc)
fprintf(stderr, "%s", argv[optind++]);
fprintf(stderr, "\n");
@ -824,7 +824,7 @@ int main(int argc, char **argv) {
}
if (generated == 0) {
fprintf(stderr, "error: No data received, no symbol generated (A24)\n");
fprintf(stderr, "124: No data received, no symbol generated\n");
fflush(stderr);
}

View File

@ -37,7 +37,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
: QWidget(parent, fl),m_optionWidget(0)
{
QCoreApplication::setOrganizationName("Zint");
QCoreApplication::setOrganizationName("zint");
QCoreApplication::setOrganizationDomain("zint.org.uk");
QCoreApplication::setApplicationName("Barcode Studio");