mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Avoid possible confusion with Windows error code
Bugfix by Oxy Genic Ref: https://sourceforge.net/p/zint/mailman/message/34857131/
This commit is contained in:
parent
7ae95b2b42
commit
2e59058615
@ -63,10 +63,10 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l
|
||||
|
||||
if(length > 80) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -96,10 +96,10 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i
|
||||
|
||||
if(length > 45) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid character in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -128,10 +128,10 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len
|
||||
|
||||
if(length > 45) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -161,10 +161,10 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le
|
||||
|
||||
if(length > 80) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -199,10 +199,10 @@ int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[],
|
||||
|
||||
if(length > 89) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if (error_number == ERROR_INVALID_DATA) {
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -260,11 +260,11 @@ int itf14(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 13) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid character in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -303,10 +303,10 @@ int dpleit(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
count = 0;
|
||||
if(length > 13) {
|
||||
strcpy(symbol->errtxt, "Input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -340,10 +340,10 @@ int dpident(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
count = 0;
|
||||
if(length > 11) {
|
||||
strcpy(symbol->errtxt, "Input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
|
@ -140,16 +140,16 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "Auspost input is wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
} else {
|
||||
if (length > 8) {
|
||||
strcpy(symbol->errtxt, "Auspost input is too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
switch(symbol->symbology) {
|
||||
case BARCODE_AUSREPLY: strcpy(fcc, "45"); break;
|
||||
@ -166,7 +166,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
concat(localstr, (char*)source);
|
||||
h = strlen(localstr);
|
||||
error_number = is_sane(GDSET, (unsigned char *)localstr, h);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -175,7 +175,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
memcpy(dpid, localstr, 8);
|
||||
dpid[8] = '\0';
|
||||
error_number = is_sane(NEON, (unsigned char *)dpid, strlen(dpid));
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in DPID");
|
||||
return error_number;
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
bytes--;
|
||||
|
||||
if(bytes > 2079) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if(bytes > 31) { /* Put 00000 followed by 11-bit number of bytes less 31 */
|
||||
@ -660,7 +660,7 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
||||
if(debug) printf("\n");
|
||||
|
||||
if(strlen(binary_string) > 14970) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -847,7 +847,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
if(symbol->output_options & READER_INIT) { reader = 1; comp_loop = 1; }
|
||||
if((gs1 == 1) && (reader == 1)) {
|
||||
strcpy(symbol->errtxt, "Cannot encode in GS1 and Reader Initialisation mode at the same time");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
switch(symbol->input_mode) {
|
||||
@ -872,7 +872,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(!((symbol->option_1 >= -1) && (symbol->option_1 <= 4))) {
|
||||
strcpy(symbol->errtxt, "Invalid error correction level - using default instead");
|
||||
err_code = WARN_INVALID_OPTION;
|
||||
err_code = ZINT_WARN_INVALID_OPTION;
|
||||
symbol->option_1 = -1;
|
||||
}
|
||||
|
||||
@ -960,7 +960,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(layers == 0) { /* Couldn't find a symbol which fits the data */
|
||||
strcpy(symbol->errtxt, "Input too long (too many bits for selected ECC)");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* Determine codeword bitlength - Table 3 */
|
||||
@ -1053,7 +1053,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
if((symbol->option_2 < 0) || (symbol->option_2 > 36)) {
|
||||
strcpy(symbol->errtxt, "Invalid Aztec Code size");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
/* Determine codeword bitlength - Table 3 */
|
||||
@ -1124,7 +1124,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(adjusted_length > data_maxsize) {
|
||||
strcpy(symbol->errtxt, "Data too long for specified Aztec Code symbol size");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if(debug) {
|
||||
@ -1141,7 +1141,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(reader && (layers > 22)) {
|
||||
strcpy(symbol->errtxt, "Data too long for reader initialisation symbol");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
data_blocks = adjusted_length / codeword_size;
|
||||
@ -1437,12 +1437,12 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
input_value = 0;
|
||||
if(length > 3) {
|
||||
strcpy(symbol->errtxt, "Input too large");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number != 0) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
switch(length) {
|
||||
case 3: input_value = 100 * ctoi(source[0]);
|
||||
@ -1458,7 +1458,7 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(input_value > 255) {
|
||||
strcpy(symbol->errtxt, "Input too large");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
strcpy(binary_string, "");
|
||||
|
@ -109,10 +109,10 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 121) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(SODIUM, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -193,14 +193,14 @@ int c39(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if((symbol->symbology == BARCODE_LOGMARS) && (length > 59)) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
} else if(length > 74) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
to_upper(source);
|
||||
error_number = is_sane(SILVER , source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -284,10 +284,10 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
|
||||
count = 0;
|
||||
if(length > 6) {
|
||||
strcpy(symbol->errtxt, "Input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -308,7 +308,7 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
|
||||
localstr[8] = '\0';
|
||||
if(localstr[7] == 'A') {
|
||||
strcpy(symbol->errtxt, "Invalid PZN Data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
error_number = c39(symbol, (unsigned char *)localstr, strlen(localstr));
|
||||
ustrcpy(symbol->text, (unsigned char *)"PZN");
|
||||
@ -330,7 +330,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 74) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* Creates a buffer string and places control characters into it */
|
||||
@ -338,7 +338,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
if(source[i] > 127) {
|
||||
/* Cannot encode extended ASCII */
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
concat((char*)buffer, EC39Ctrl[source[i]]);
|
||||
}
|
||||
@ -373,7 +373,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 107) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* Message Content */
|
||||
@ -381,7 +381,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
if (source[i] > 127) {
|
||||
/* Cannot encode extended ASCII */
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
concat(buffer, C93Ctrl[source[i]]);
|
||||
symbol->text[i] = source[i] ? source[i] : ' ';
|
||||
@ -391,7 +391,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
h = strlen(buffer);
|
||||
if (h > 107) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
@ -506,10 +506,10 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 7) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -533,7 +533,7 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
if(range) {
|
||||
strcpy(symbol->errtxt, "Value out of range");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
for(i = 0; i < 11; i++) { B[i] = 0; S[i] = 0; }
|
||||
|
@ -1031,7 +1031,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if((symbol->option_2 < 0) || (symbol->option_2 > 10)) {
|
||||
strcpy(symbol->errtxt, "Invalid symbol size");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if(symbol->option_2 == 9) {
|
||||
@ -1044,11 +1044,11 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 18) {
|
||||
strcpy(symbol->errtxt, "Input data too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
if(is_sane(NEON, source, length) == ERROR_INVALID_DATA) {
|
||||
if(is_sane(NEON, source, length) == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid input data (Version S encodes numeric input only)");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sub_version = 3; codewords = 12; block_width = 6; /* Version S-30 */
|
||||
@ -1120,12 +1120,12 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
data_length = c1_encode(symbol, source, data, length);
|
||||
|
||||
if(data_length == 0) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if(data_length > 38) {
|
||||
strcpy(symbol->errtxt, "Input data too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
size = 10;
|
||||
@ -1187,7 +1187,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) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
for(i = 7; i >= 0; i--) {
|
||||
|
@ -236,7 +236,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
/* 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");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* Detect extended ASCII characters */
|
||||
@ -403,7 +403,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
if(glyph_count > 80.0) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* So now we know what start character to use - we can get on with it! */
|
||||
@ -635,13 +635,13 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
/* 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");
|
||||
return ERROR_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");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
if(glyph_count > 80.0) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* So now we know what start character to use - we can get on with it! */
|
||||
@ -939,11 +939,11 @@ int nve_18(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(sourcelen > 17) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -980,11 +980,11 @@ int ean_14(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 13) {
|
||||
strcpy(symbol->errtxt, "Input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid character in data");
|
||||
return error_number;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(input_length > 157) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
bar_characters = 0;
|
||||
@ -390,7 +390,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(glyph_count > 77.0) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* Calculate how tall the symbol will be */
|
||||
@ -415,7 +415,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
if(m == 2) { m = 5; }
|
||||
if(gs1) {
|
||||
strcpy(symbol->errtxt, "Cannot use both GS1 mode and Reader Initialisation");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
} else {
|
||||
if((set[0] == 'B') && (set[1] == 'C')) { m = 6; }
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 81) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
if(symbol->input_mode == GS1_MODE) { gs1 = 1; } else { gs1 = 0; }
|
||||
|
||||
@ -60,7 +60,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
for(i = 0; i < length; i++) {
|
||||
if(source[i] > 127) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
if(gs1 && (source[i] == '['))
|
||||
concat(intermediate, "*"); /* FNC1 */
|
||||
@ -206,7 +206,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(codeword_count > 49) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* Place codewords in code character array (c grid) */
|
||||
|
@ -112,7 +112,7 @@ int is_sane(char test_string[], unsigned char source[], int length)
|
||||
}
|
||||
}
|
||||
if (!(latch)) {
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@ int latin1_process(struct zint_symbol *symbol, unsigned char source[], unsigned
|
||||
}
|
||||
if(next == -1) {
|
||||
strcpy(symbol->errtxt, "error: Invalid character in input string (only Latin-1 characters supported)");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
i = next;
|
||||
} while(i < *length);
|
||||
@ -350,11 +350,11 @@ int utf8toutf16(struct zint_symbol *symbol, unsigned char source[], int vals[],
|
||||
} else {
|
||||
if((source[bpos] >= 0x80) && (source[bpos] <= 0xbf)) {
|
||||
strcpy(symbol->errtxt, "Corrupt Unicode data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
if((source[bpos] >= 0xc0) && (source[bpos] <= 0xc1)) {
|
||||
strcpy(symbol->errtxt, "Overlong encoding not supported");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if((source[bpos] >= 0xc2) && (source[bpos] <= 0xdf)) {
|
||||
@ -371,7 +371,7 @@ int utf8toutf16(struct zint_symbol *symbol, unsigned char source[], int vals[],
|
||||
} else
|
||||
if(source[bpos] >= 0xf0) {
|
||||
strcpy(symbol->errtxt, "Unicode sequences of more than 3 bytes not supported");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -863,7 +863,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if((ninety[i] != '*') && (ninety[i] != ',') && (ninety[i] != '-') && (ninety[i] != '.') && (ninety[i] != '/')) {
|
||||
/* An Invalid AI 90 character */
|
||||
strcpy(symbol->errtxt, "Invalid AI 90 data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1186,7 +1186,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(latch == 1) {
|
||||
/* Invalid characters in input data */
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
for(i = 0; i < strlen(general_field); i++) {
|
||||
@ -1382,7 +1382,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
/* CC-A 2D component - calculate remaining space */
|
||||
switch(*(cc_width)) {
|
||||
case 2:
|
||||
if(binary_length > 167) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 167) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 167) { target_bitsize = 167; }
|
||||
if(binary_length <= 138) { target_bitsize = 138; }
|
||||
if(binary_length <= 118) { target_bitsize = 118; }
|
||||
@ -1392,7 +1392,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(binary_length <= 59) { target_bitsize = 59; }
|
||||
break;
|
||||
case 3:
|
||||
if(binary_length > 167) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 167) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 167) { target_bitsize = 167; }
|
||||
if(binary_length <= 138) { target_bitsize = 138; }
|
||||
if(binary_length <= 118) { target_bitsize = 118; }
|
||||
@ -1400,7 +1400,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(binary_length <= 78) { target_bitsize = 78; }
|
||||
break;
|
||||
case 4:
|
||||
if(binary_length > 197) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 197) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 197) { target_bitsize = 197; }
|
||||
if(binary_length <= 167) { target_bitsize = 167; }
|
||||
if(binary_length <= 138) { target_bitsize = 138; }
|
||||
@ -1414,7 +1414,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
/* CC-B 2D component - calculated from ISO/IEC 24728 Table 1 */
|
||||
switch(*(cc_width)) {
|
||||
case 2:
|
||||
if(binary_length > 336) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 336) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 336) { target_bitsize = 336; }
|
||||
if(binary_length <= 296) { target_bitsize = 296; }
|
||||
if(binary_length <= 256) { target_bitsize = 256; }
|
||||
@ -1424,7 +1424,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(binary_length <= 56) { target_bitsize = 56; }
|
||||
break;
|
||||
case 3:
|
||||
if(binary_length > 768) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 768) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 768) { target_bitsize = 768; }
|
||||
if(binary_length <= 648) { target_bitsize = 648; }
|
||||
if(binary_length <= 536) { target_bitsize = 536; }
|
||||
@ -1437,7 +1437,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(binary_length <= 32) { target_bitsize = 32; }
|
||||
break;
|
||||
case 4:
|
||||
if(binary_length > 1184) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 1184) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 1184) { target_bitsize = 1184; }
|
||||
if(binary_length <= 1016) { target_bitsize = 1016; }
|
||||
if(binary_length <= 840) { target_bitsize = 840; }
|
||||
@ -1480,7 +1480,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
codewords_used += 3;
|
||||
|
||||
if(codewords_used > symbol->option_3) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
/* *(cc_width) = 0.5 + sqrt((codewords_used) / 3); */
|
||||
*(cc_width) = (lin_width - 62) / 17;
|
||||
@ -1545,7 +1545,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
|
||||
if(strlen(binary_string) > 11805) { /* (2361 * 5) */
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* all the code below is repeated from above - it needs to be calculated again because the
|
||||
@ -1556,7 +1556,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
/* CC-A 2D component - calculate padding required */
|
||||
switch(*(cc_width)) {
|
||||
case 2:
|
||||
if(binary_length > 167) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 167) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 167) { target_bitsize = 167; }
|
||||
if(binary_length <= 138) { target_bitsize = 138; }
|
||||
if(binary_length <= 118) { target_bitsize = 118; }
|
||||
@ -1566,7 +1566,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(binary_length <= 59) { target_bitsize = 59; }
|
||||
break;
|
||||
case 3:
|
||||
if(binary_length > 167) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 167) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 167) { target_bitsize = 167; }
|
||||
if(binary_length <= 138) { target_bitsize = 138; }
|
||||
if(binary_length <= 118) { target_bitsize = 118; }
|
||||
@ -1574,7 +1574,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(binary_length <= 78) { target_bitsize = 78; }
|
||||
break;
|
||||
case 4:
|
||||
if(binary_length > 197) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 197) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 197) { target_bitsize = 197; }
|
||||
if(binary_length <= 167) { target_bitsize = 167; }
|
||||
if(binary_length <= 138) { target_bitsize = 138; }
|
||||
@ -1588,7 +1588,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
/* CC-B 2D component */
|
||||
switch(*(cc_width)) {
|
||||
case 2:
|
||||
if(binary_length > 336) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 336) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 336) { target_bitsize = 336; }
|
||||
if(binary_length <= 296) { target_bitsize = 296; }
|
||||
if(binary_length <= 256) { target_bitsize = 256; }
|
||||
@ -1598,7 +1598,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(binary_length <= 56) { target_bitsize = 56; }
|
||||
break;
|
||||
case 3:
|
||||
if(binary_length > 768) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 768) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 768) { target_bitsize = 768; }
|
||||
if(binary_length <= 648) { target_bitsize = 648; }
|
||||
if(binary_length <= 536) { target_bitsize = 536; }
|
||||
@ -1611,7 +1611,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if(binary_length <= 32) { target_bitsize = 32; }
|
||||
break;
|
||||
case 4:
|
||||
if(binary_length > 1184) { return ERROR_TOO_LONG; }
|
||||
if(binary_length > 1184) { return ZINT_ERROR_TOO_LONG; }
|
||||
if(binary_length <= 1184) { target_bitsize = 1184; }
|
||||
if(binary_length <= 1016) { target_bitsize = 1016; }
|
||||
if(binary_length <= 840) { target_bitsize = 840; }
|
||||
@ -1654,7 +1654,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
codewords_used += 3;
|
||||
|
||||
if(codewords_used > symbol->option_3) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
/* *(cc_width) = 0.5 + sqrt((codewords_used) / 3); */
|
||||
*(cc_width) = (lin_width - 62) / 17;
|
||||
@ -1766,12 +1766,12 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
pri_len = strlen(symbol->primary);
|
||||
if(pri_len == 0) {
|
||||
strcpy(symbol->errtxt, "No primary (linear) message in 2D composite");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if(length > 2990) {
|
||||
strcpy(symbol->errtxt, "2D component input data too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
linear = ZBarcode_Create(); /* Symbol contains the 2D component and Linear contains the rest */
|
||||
@ -1784,7 +1784,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
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)");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
linear->symbology = symbol->symbology;
|
||||
@ -1849,16 +1849,16 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(cc_mode == 1) {
|
||||
i = cc_binary_string(symbol, reduced, binary_string, cc_mode, &cc_width, &ecc_level, linear->width);
|
||||
if (i == ERROR_TOO_LONG) {
|
||||
if (i == ZINT_ERROR_TOO_LONG) {
|
||||
cc_mode = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(cc_mode == 2) { /* If the data didn't fit into CC-A it is recalculated for CC-B */
|
||||
i = cc_binary_string(symbol, reduced, binary_string, cc_mode, &cc_width, &ecc_level, linear->width);
|
||||
if (i == ERROR_TOO_LONG) {
|
||||
if (i == ZINT_ERROR_TOO_LONG) {
|
||||
if(symbol->symbology != BARCODE_EAN128_CC) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
} else {
|
||||
cc_mode = 3;
|
||||
}
|
||||
@ -1868,8 +1868,8 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
if(cc_mode == 3) { /* If the data didn't fit in CC-B (and linear part is GS1-128) it is recalculated
|
||||
for CC-C */
|
||||
i = cc_binary_string(symbol, reduced, binary_string, cc_mode, &cc_width, &ecc_level, linear->width);
|
||||
if (i == ERROR_TOO_LONG) {
|
||||
return ERROR_TOO_LONG;
|
||||
if (i == ZINT_ERROR_TOO_LONG) {
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1880,7 +1880,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
|
||||
if(error_number != 0) {
|
||||
return ERROR_ENCODING_PROBLEM;
|
||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||
}
|
||||
|
||||
/* Merge the linear component with the 2D component */
|
||||
|
@ -553,7 +553,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
||||
if(symbol->output_options & READER_INIT) {
|
||||
if(gs1) {
|
||||
strcpy(symbol->errtxt, "Cannot encode in GS1 mode and Reader Initialisation at the same time");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
} else {
|
||||
target[tp] = 234; tp++; /* Reader Programming */
|
||||
concat(binary, " ");
|
||||
@ -1075,7 +1075,7 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
|
||||
if(binlen == 0) {
|
||||
strcpy(symbol->errtxt, "Data too long to fit in symbol");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if((symbol->option_2 >= 1) && (symbol->option_2 <= DMSIZESCOUNT)) {
|
||||
@ -1102,7 +1102,7 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
symbolsize = calcsize;
|
||||
if(optionsize != -1) {
|
||||
/* flag an error */
|
||||
error_number = WARN_INVALID_OPTION;
|
||||
error_number = ZINT_WARN_INVALID_OPTION;
|
||||
strcpy(symbol->errtxt, "Data does not fit in selected symbol size");
|
||||
}
|
||||
}
|
||||
@ -1212,7 +1212,7 @@ int dmatrix(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
} else {
|
||||
/* ECC 000 - 140 */
|
||||
strcpy(symbol->errtxt, "Older Data Matrix standards are no longer supported");
|
||||
error_number = ERROR_INVALID_OPTION;
|
||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
return error_number;
|
||||
|
@ -699,7 +699,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader)
|
||||
break;
|
||||
}
|
||||
if(strlen(binary) > 9191) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
} while(sp < length);
|
||||
@ -736,7 +736,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader)
|
||||
}
|
||||
|
||||
if(strlen(binary) > 9191) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -961,7 +961,7 @@ int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
} while ((j < 7445) && (glyph == 0));
|
||||
if(glyph == 0) {
|
||||
strcpy(symbol->errtxt, "Invalid character in input data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
gbdata[i] = glyph;
|
||||
}
|
||||
@ -1041,7 +1041,7 @@ int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(data_cw > data_max) {
|
||||
strcpy(symbol->errtxt, "Input data too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
gm_add_ecc(binary, data_cw, layers, ecc_level, word);
|
||||
|
@ -76,17 +76,17 @@ int gs1_verify(struct zint_symbol *symbol, unsigned char source[], const unsigne
|
||||
for(i = 0; i < src_len; i++) {
|
||||
if(source[i] >=128) {
|
||||
strcpy(symbol->errtxt, "Extended ASCII characters are not supported by GS1");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
if(source[i] < 32) {
|
||||
strcpy(symbol->errtxt, "Control characters are not supported by GS1");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
if(source[0] != '[') {
|
||||
strcpy(symbol->errtxt, "Data does not start with an AI");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
/* Check the position of the brackets */
|
||||
@ -115,31 +115,31 @@ int gs1_verify(struct zint_symbol *symbol, unsigned char source[], const unsigne
|
||||
if(bracket_level != 0) {
|
||||
/* Not all brackets are closed */
|
||||
strcpy(symbol->errtxt, "Malformed AI in input data (brackets don\'t match)");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if(max_bracket_level > 1) {
|
||||
/* Nested brackets */
|
||||
strcpy(symbol->errtxt, "Found nested brackets in input data");
|
||||
return ERROR_INVALID_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)");
|
||||
return ERROR_INVALID_DATA;
|
||||
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)");
|
||||
return ERROR_INVALID_DATA;
|
||||
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)");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
ai_count = 0;
|
||||
@ -172,7 +172,7 @@ int gs1_verify(struct zint_symbol *symbol, unsigned char source[], const unsigne
|
||||
if(data_length[i] == 0) {
|
||||
/* No data for given AI */
|
||||
strcpy(symbol->errtxt, "Empty data field in input data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,13 +253,13 @@ int gs1_verify(struct zint_symbol *symbol, unsigned char source[], const unsigne
|
||||
if(error_latch == 5) {
|
||||
strcpy(symbol->errtxt, "Invalid data length for AI ");
|
||||
concat(symbol->errtxt, ai_string);
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if(error_latch == 6) {
|
||||
strcpy(symbol->errtxt, "Invalid AI value ");
|
||||
concat(symbol->errtxt, ai_string);
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
/* Resolve AI data - put resulting string in 'reduced' */
|
||||
@ -318,5 +318,5 @@ int ugs1_verify(struct zint_symbol *symbol, unsigned char source[], const unsign
|
||||
return 0;
|
||||
}
|
||||
strcpy(symbol->errtxt, "ugs1_verify overflow");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
@ -334,10 +334,10 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 32) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(SODIUM, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -374,11 +374,11 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(strlen(tracker) != 20) {
|
||||
strcpy(symbol->errtxt, "Invalid length tracking code");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
if(strlen(zip) > 11) {
|
||||
strcpy(symbol->errtxt, "Invalid ZIP code");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
/* *** Step 1 - Conversion of Data Fields into Binary Data *** */
|
||||
|
@ -224,7 +224,7 @@ int dump_plot(struct zint_symbol *symbol)
|
||||
f = fopen(symbol->outfile, "w");
|
||||
if(!f) {
|
||||
strcpy(symbol->errtxt, "Could not open output file");
|
||||
return ERROR_FILE_ACCESS;
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,11 +254,11 @@ int hibc(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 36) {
|
||||
strcpy(symbol->errtxt, "Data too long for HIBC LIC");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
to_upper(source);
|
||||
error_number = is_sane(TECHNETIUM , source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -606,8 +606,8 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
||||
}
|
||||
if(length == 0) {
|
||||
strcpy(symbol->errtxt, "No input data");
|
||||
error_tag(symbol->errtxt, ERROR_INVALID_DATA);
|
||||
return ERROR_INVALID_DATA;
|
||||
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA);
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if(strcmp(symbol->outfile, "") == 0) {
|
||||
@ -620,32 +620,32 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
||||
#endif
|
||||
|
||||
/* First check the symbology field */
|
||||
if(symbol->symbology < 1) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
|
||||
if(symbol->symbology < 1) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; }
|
||||
|
||||
/* symbol->symbologys 1 to 86 are defined by tbarcode */
|
||||
if(symbol->symbology == 5) { symbol->symbology = BARCODE_C25MATRIX; }
|
||||
if((symbol->symbology >= 10) && (symbol->symbology <= 12)) { symbol->symbology = BARCODE_EANX; }
|
||||
if((symbol->symbology == 14) || (symbol->symbology == 15)) { symbol->symbology = BARCODE_EANX; }
|
||||
if(symbol->symbology == 17) { symbol->symbology = BARCODE_UPCA; }
|
||||
if(symbol->symbology == 19) { strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar"); symbol->symbology = BARCODE_CODABAR; error_number = WARN_INVALID_OPTION; }
|
||||
if(symbol->symbology == 19) { strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar"); symbol->symbology = BARCODE_CODABAR; error_number = ZINT_WARN_INVALID_OPTION; }
|
||||
if(symbol->symbology == 26) { symbol->symbology = BARCODE_UPCA; }
|
||||
if(symbol->symbology == 27) { strcpy(symbol->errtxt, "UPCD1 not supported"); error_number = ERROR_INVALID_OPTION; }
|
||||
if(symbol->symbology == 27) { strcpy(symbol->errtxt, "UPCD1 not supported"); error_number = ZINT_ERROR_INVALID_OPTION; }
|
||||
if(symbol->symbology == 33) { symbol->symbology = BARCODE_EAN128; }
|
||||
if((symbol->symbology == 35) || (symbol->symbology == 36)) { symbol->symbology = BARCODE_UPCA; }
|
||||
if((symbol->symbology == 38) || (symbol->symbology == 39)) { symbol->symbology = BARCODE_UPCE; }
|
||||
if((symbol->symbology >= 41) && (symbol->symbology <= 45)) { symbol->symbology = BARCODE_POSTNET; }
|
||||
if(symbol->symbology == 46) { symbol->symbology = BARCODE_PLESSEY; }
|
||||
if(symbol->symbology == 48) { symbol->symbology = BARCODE_NVE18; }
|
||||
if(symbol->symbology == 54) { strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
|
||||
if(symbol->symbology == 54) { strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; }
|
||||
if((symbol->symbology == 59) || (symbol->symbology == 61)) { symbol->symbology = BARCODE_CODE128; }
|
||||
if(symbol->symbology == 62) { symbol->symbology = BARCODE_CODE93; }
|
||||
if((symbol->symbology == 64) || (symbol->symbology == 65)) { symbol->symbology = BARCODE_AUSPOST; }
|
||||
if(symbol->symbology == 73) { strcpy(symbol->errtxt, "Codablock E not supported"); error_number = ERROR_INVALID_OPTION; }
|
||||
if(symbol->symbology == 73) { strcpy(symbol->errtxt, "Codablock E not supported"); error_number = ZINT_ERROR_INVALID_OPTION; }
|
||||
if(symbol->symbology == 78) { symbol->symbology = BARCODE_RSS14; }
|
||||
if(symbol->symbology == 83) { symbol->symbology = BARCODE_PLANET; }
|
||||
if(symbol->symbology == 88) { symbol->symbology = BARCODE_EAN128; }
|
||||
if(symbol->symbology == 91) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
|
||||
if((symbol->symbology >= 94) && (symbol->symbology <= 96)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
|
||||
if(symbol->symbology == 91) { strcpy(symbol->errtxt, "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"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; }
|
||||
if(symbol->symbology == 100) { symbol->symbology = BARCODE_HIBC_128; }
|
||||
if(symbol->symbology == 101) { symbol->symbology = BARCODE_HIBC_39; }
|
||||
if(symbol->symbology == 103) { symbol->symbology = BARCODE_HIBC_DM; }
|
||||
@ -653,10 +653,10 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
||||
if(symbol->symbology == 107) { symbol->symbology = BARCODE_HIBC_PDF; }
|
||||
if(symbol->symbology == 109) { symbol->symbology = BARCODE_HIBC_MICPDF; }
|
||||
if(symbol->symbology == 111) { symbol->symbology = BARCODE_HIBC_BLOCKF; }
|
||||
if((symbol->symbology >= 113) && (symbol->symbology <= 127)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
|
||||
if((symbol->symbology >= 113) && (symbol->symbology <= 127)) { strcpy(symbol->errtxt, "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 >= 143) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
|
||||
if((symbol->symbology == BARCODE_CODABLOCKF) || (symbol->symbology == BARCODE_HIBC_BLOCKF)) { strcpy(symbol->errtxt, "Codablock F not supported"); error_number = ERROR_INVALID_OPTION; }
|
||||
if(symbol->symbology >= 143) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = ZINT_WARN_INVALID_OPTION; }
|
||||
if((symbol->symbology == BARCODE_CODABLOCKF) || (symbol->symbology == BARCODE_HIBC_BLOCKF)) { strcpy(symbol->errtxt, "Codablock F not supported"); error_number = ZINT_ERROR_INVALID_OPTION; }
|
||||
|
||||
if(error_number > 4) {
|
||||
error_tag(symbol->errtxt, error_number);
|
||||
@ -671,7 +671,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
||||
for(i = 0; i < length; i++) {
|
||||
if(source[i] == '\0') {
|
||||
strcpy(symbol->errtxt, "NULL characters not permitted in GS1 mode");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
if(gs1_compliant(symbol->symbology) == 1) {
|
||||
@ -680,7 +680,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
||||
length = ustrlen(local_source);
|
||||
} else {
|
||||
strcpy(symbol->errtxt, "Selected symbology does not support GS1 mode");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
} else {
|
||||
memcpy(local_source, source, length);
|
||||
@ -729,7 +729,7 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle)
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "Invalid rotation angle");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if(strlen(symbol->outfile) > 3) {
|
||||
@ -756,13 +756,13 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle)
|
||||
} else
|
||||
{
|
||||
strcpy(symbol->errtxt, "Unknown output format");
|
||||
error_tag(symbol->errtxt, ERROR_INVALID_OPTION);
|
||||
return ERROR_INVALID_OPTION;
|
||||
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
} else {
|
||||
strcpy(symbol->errtxt, "Unknown output format");
|
||||
error_tag(symbol->errtxt, ERROR_INVALID_OPTION);
|
||||
return ERROR_INVALID_OPTION;
|
||||
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
error_tag(symbol->errtxt, error_number);
|
||||
@ -781,7 +781,7 @@ int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle)
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "Invalid rotation angle");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
error_number = bmp_handle(symbol, rotate_angle);
|
||||
@ -834,7 +834,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename)
|
||||
file = fopen(filename, "rb");
|
||||
if (!file) {
|
||||
strcpy(symbol->errtxt, "Unable to read input file");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
/* Get file length */
|
||||
@ -846,7 +846,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename)
|
||||
/* The largest amount of data that can be encoded is 7089 numeric digits in QR Code */
|
||||
strcpy(symbol->errtxt, "Input file too long");
|
||||
fclose(file);
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@ -856,7 +856,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename)
|
||||
strcpy(symbol->errtxt, "Internal memory error");
|
||||
if (strcmp(filename, "-"))
|
||||
fclose(file);
|
||||
return ERROR_MEMORY;
|
||||
return ZINT_ERROR_MEMORY;
|
||||
}
|
||||
|
||||
/* Read file contents into buffer */
|
||||
@ -868,7 +868,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename)
|
||||
{
|
||||
strcpy(symbol->errtxt, strerror(errno));
|
||||
nRead = 0;
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
nRead += n;
|
||||
} while (!feof(file) && (0 < n) && (nRead < fileLen));
|
||||
|
@ -139,7 +139,7 @@ int maxi_text_process(int mode, unsigned char source[], int length)
|
||||
int set[144], character[144], i, j, done, count, current_set;
|
||||
|
||||
if(length > 138) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
for(i = 0; i < 144; i++) {
|
||||
@ -459,15 +459,15 @@ int maxi_text_process(int mode, unsigned char source[], int length)
|
||||
} while (i <= 143);
|
||||
|
||||
if(((mode ==2) || (mode == 3)) && (length > 84)) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if(((mode == 4) || (mode == 6)) && (length > 93)) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if((mode == 5) && (length > 77)) {
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
|
||||
@ -605,7 +605,7 @@ int maxicode(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if((mode < 2) || (mode > 6)) { /* Only codes 2 to 6 supported */
|
||||
strcpy(symbol->errtxt, "Invalid Maxicode Mode");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if((mode == 2) || (mode == 3)) { /* Modes 2 and 3 need data in symbol->primary */
|
||||
@ -614,13 +614,13 @@ int maxicode(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
if(lp != 15) {
|
||||
strcpy(symbol->errtxt, "Invalid Primary String");
|
||||
return ERROR_INVALID_DATA;
|
||||
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");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@ -656,7 +656,7 @@ int maxicode(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
|
||||
i = maxi_text_process(mode, local_source, length);
|
||||
if(i == ERROR_TOO_LONG ) {
|
||||
if(i == ZINT_ERROR_TOO_LONG ) {
|
||||
strcpy(symbol->errtxt, "Input data too long");
|
||||
return i;
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 6) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -79,7 +79,7 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if((tester < 3) || (tester > 131070)) {
|
||||
strcpy(symbol->errtxt, "Data out of range");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
do
|
||||
@ -126,7 +126,7 @@ int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char des
|
||||
if((tester < 4) || (tester > 64570080))
|
||||
{
|
||||
strcpy(symbol->errtxt, "Data out of range");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
error_number = 0;
|
||||
strcpy(inter, "");
|
||||
@ -170,10 +170,10 @@ int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 8) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -214,11 +214,11 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 60) { /* No stack smashing please */
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
to_upper(source);
|
||||
error_number = is_sane(CALCIUM, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -226,14 +226,14 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
if((source[0] != 'A') && (source[0] != 'B') && (source[0] != 'C') && (source[0] != 'D'))
|
||||
{
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return ERROR_INVALID_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");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
for(i = 0; i < length; i++)
|
||||
@ -257,10 +257,10 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
/* Validate the input */
|
||||
if(length > 8) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
|
@ -707,12 +707,12 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
if((symbol->option_1 < -1) || (symbol->option_1 > 8)) {
|
||||
strcpy(symbol->errtxt, "Security value out of range");
|
||||
symbol->option_1 = -1;
|
||||
error_number = WARN_INVALID_OPTION;
|
||||
error_number = ZINT_WARN_INVALID_OPTION;
|
||||
}
|
||||
if((symbol->option_2 < 0) || (symbol->option_2 > 30)) {
|
||||
strcpy(symbol->errtxt, "Number of columns out of range");
|
||||
symbol->option_2 = 0;
|
||||
error_number = WARN_INVALID_OPTION;
|
||||
error_number = ZINT_WARN_INVALID_OPTION;
|
||||
}
|
||||
|
||||
/* 349 */
|
||||
@ -723,23 +723,23 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
switch(codeerr) {
|
||||
case 1:
|
||||
strcpy(symbol->errtxt, "No such file or file unreadable");
|
||||
error_number = ERROR_INVALID_OPTION;
|
||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||
break;
|
||||
case 2:
|
||||
strcpy(symbol->errtxt, "Input string too long");
|
||||
error_number = ERROR_TOO_LONG;
|
||||
error_number = ZINT_ERROR_TOO_LONG;
|
||||
break;
|
||||
case 3:
|
||||
strcpy(symbol->errtxt, "Number of codewords per row too small");
|
||||
error_number = WARN_INVALID_OPTION;
|
||||
error_number = ZINT_WARN_INVALID_OPTION;
|
||||
break;
|
||||
case 4:
|
||||
strcpy(symbol->errtxt, "Data too long for specified number of columns");
|
||||
error_number = ERROR_TOO_LONG;
|
||||
error_number = ZINT_ERROR_TOO_LONG;
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "Something strange happened");
|
||||
error_number = ERROR_ENCODING_PROBLEM;
|
||||
error_number = ZINT_ERROR_ENCODING_PROBLEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -825,12 +825,12 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length)
|
||||
|
||||
if(mclength > 126) {
|
||||
strcpy(symbol->errtxt, "Input data too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
if(symbol->option_2 > 4) {
|
||||
strcpy(symbol->errtxt, "Specified width out of range");
|
||||
symbol->option_2 = 0;
|
||||
codeerr = WARN_INVALID_OPTION;
|
||||
codeerr = ZINT_WARN_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if(debug) {
|
||||
@ -849,21 +849,21 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length)
|
||||
/* 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");
|
||||
codeerr = WARN_INVALID_OPTION;
|
||||
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");
|
||||
codeerr = WARN_INVALID_OPTION;
|
||||
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");
|
||||
codeerr = WARN_INVALID_OPTION;
|
||||
codeerr = ZINT_WARN_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if(symbol->option_2 == 1) {
|
||||
|
@ -58,10 +58,10 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 65) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(SSET, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -116,7 +116,7 @@ int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 55) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* start character */
|
||||
@ -148,7 +148,7 @@ int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int le
|
||||
|
||||
if(length > 18) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* start character */
|
||||
@ -219,7 +219,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");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* start character */
|
||||
@ -332,7 +332,7 @@ int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const
|
||||
|
||||
if(src_len > 55) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* start character */
|
||||
@ -397,7 +397,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
|
||||
|
||||
if(src_len > 18) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* start character */
|
||||
@ -488,7 +488,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");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
|
||||
|
2322
backend/png.c
2322
backend/png.c
File diff suppressed because it is too large
Load Diff
@ -79,10 +79,10 @@ int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
||||
|
||||
if(length > 38) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -150,10 +150,10 @@ int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
||||
|
||||
if(length > 38) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -219,10 +219,10 @@ int korea_post(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
error_number = 0;
|
||||
if(length > 6) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -257,7 +257,7 @@ int fim(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 1) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
switch((char)source[0]) {
|
||||
@ -279,7 +279,7 @@ int fim(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -334,11 +334,11 @@ int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 120) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
to_upper(source);
|
||||
error_number = is_sane(KRSET, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -384,11 +384,11 @@ int kix_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
if(length > 18) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
to_upper(source);
|
||||
error_number = is_sane(KRSET, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -441,12 +441,12 @@ int daft_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
error_number = 0;
|
||||
if(length > 50) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
to_upper((unsigned char*)source);
|
||||
error_number = is_sane(DAFTSET, (unsigned char*)source, length);
|
||||
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -493,10 +493,10 @@ int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length
|
||||
|
||||
if(length > 90) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -533,7 +533,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
to_upper((unsigned char*)local_source);
|
||||
error_number = is_sane(SHKASUTSET, (unsigned char*)local_source, length);
|
||||
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
|
14
backend/ps.c
14
backend/ps.c
@ -73,7 +73,7 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
}
|
||||
if(feps == NULL) {
|
||||
strcpy(symbol->errtxt, "Could not open output file");
|
||||
return ERROR_FILE_ACCESS;
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
|
||||
/* sort out colour options */
|
||||
@ -82,21 +82,21 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
|
||||
if(strlen(symbol->fgcolour) != 6) {
|
||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
if(strlen(symbol->bgcolour) != 6) {
|
||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
error_number = is_sane(SSET, (unsigned char*)symbol->fgcolour, strlen(symbol->fgcolour));
|
||||
if (error_number == ERROR_INVALID_DATA) {
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
error_number = is_sane(SSET, (unsigned char*)symbol->bgcolour, strlen(symbol->bgcolour));
|
||||
if (error_number == ERROR_INVALID_DATA) {
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
locale = setlocale(LC_ALL, "C");
|
||||
|
||||
|
4888
backend/qr.c
4888
backend/qr.c
File diff suppressed because it is too large
Load Diff
@ -168,10 +168,10 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
|
||||
if(src_len > 13) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, src_len);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -674,17 +674,17 @@ int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
|
||||
if(src_len > 13) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, src_len);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "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");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1254,7 +1254,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
||||
if((source[i] != '[') && (source[i] != ']')) {
|
||||
/* Something is wrong */
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1580,7 +1580,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");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
for(i = 0; i < strlen(general_field); i++) {
|
||||
@ -1821,7 +1821,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");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
/* Now add padding to binary string (7.2.5.5.4) */
|
||||
|
@ -67,7 +67,7 @@ int svg_plot(struct zint_symbol *symbol)
|
||||
}
|
||||
if(fsvg == NULL) {
|
||||
strcpy(symbol->errtxt, "Could not open output file");
|
||||
return ERROR_FILE_ACCESS;
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
|
||||
/* sort out colour options */
|
||||
@ -76,21 +76,21 @@ int svg_plot(struct zint_symbol *symbol)
|
||||
|
||||
if(strlen(symbol->fgcolour) != 6) {
|
||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
if(strlen(symbol->bgcolour) != 6) {
|
||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
error_number = is_sane(SSET, (unsigned char*)symbol->fgcolour, strlen(symbol->fgcolour));
|
||||
if (error_number == ERROR_INVALID_DATA) {
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
error_number = is_sane(SSET, (unsigned char*)symbol->bgcolour, strlen(symbol->bgcolour));
|
||||
if (error_number == ERROR_INVALID_DATA) {
|
||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
locale = setlocale(LC_ALL, "C");
|
||||
|
||||
|
@ -68,7 +68,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
|
||||
if(src_len > 30) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
/* Start character */
|
||||
strcpy(dest, TeleTable['_']);
|
||||
@ -77,7 +77,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
if(source[i] > 126) {
|
||||
/* Cannot encode extended ASCII */
|
||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
concat(dest, TeleTable[source[i]]);
|
||||
count += source[i];
|
||||
@ -114,12 +114,12 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
|
||||
if(temp_length > 60) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
ustrcpy(temp, source);
|
||||
to_upper(temp);
|
||||
error_number = is_sane(NEON, temp, temp_length);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
@ -140,7 +140,7 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
{
|
||||
if(temp[i] == 'X') {
|
||||
strcpy(symbol->errtxt, "Invalid position of X in Telepen data");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if(temp[i + 1] == 'X') {
|
||||
|
@ -421,7 +421,7 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int
|
||||
|
||||
to_upper(source);
|
||||
error_number = is_sane("0123456789X", source, src_len);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input");
|
||||
return error_number;
|
||||
}
|
||||
@ -430,7 +430,7 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int
|
||||
if(((src_len < 9) || (src_len > 13)) || ((src_len > 10) && (src_len < 13)))
|
||||
{
|
||||
strcpy(symbol->errtxt, "Input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if(src_len == 13) /* Using 13 character ISBN */
|
||||
@ -439,14 +439,14 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int
|
||||
((source[2] == '8') || (source[2] == '9'))))
|
||||
{
|
||||
strcpy(symbol->errtxt, "Invalid ISBN");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
check_digit = isbn13_check(source);
|
||||
if (source[src_len - 1] != check_digit)
|
||||
{
|
||||
strcpy(symbol->errtxt, "Incorrect ISBN check");
|
||||
return ERROR_INVALID_CHECK;
|
||||
return ZINT_ERROR_INVALID_CHECK;
|
||||
}
|
||||
source[12] = '\0';
|
||||
|
||||
@ -459,7 +459,7 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int
|
||||
if(check_digit != source[src_len - 1])
|
||||
{
|
||||
strcpy(symbol->errtxt, "Incorrect ISBN check");
|
||||
return ERROR_INVALID_CHECK;
|
||||
return ZINT_ERROR_INVALID_CHECK;
|
||||
}
|
||||
for(i = 13; i > 0; i--)
|
||||
{
|
||||
@ -487,7 +487,7 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int
|
||||
if(check_digit != source[ustrlen(source) - 1])
|
||||
{
|
||||
strcpy(symbol->errtxt, "Incorrect SBN check");
|
||||
return ERROR_INVALID_CHECK;
|
||||
return ZINT_ERROR_INVALID_CHECK;
|
||||
}
|
||||
|
||||
/* Convert to EAN-13 number */
|
||||
@ -603,18 +603,18 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
|
||||
if(src_len > 19) {
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ERROR_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 == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
} else {
|
||||
error_number = is_sane("0123456789Xx", source, src_len);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input");
|
||||
return error_number;
|
||||
}
|
||||
@ -668,7 +668,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
case 5: add_on(first_part, (char*)dest, 0); ustrcpy(symbol->text, first_part); break;
|
||||
case 7: ean8(symbol, first_part, (char*)dest); break;
|
||||
case 12: ean13(symbol, first_part, (char*)dest); break;
|
||||
default: strcpy(symbol->errtxt, "Invalid length input"); return ERROR_TOO_LONG;
|
||||
default: strcpy(symbol->errtxt, "Invalid length input"); return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_EANX_CC:
|
||||
@ -696,7 +696,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
symbol->row_height[symbol->rows + 2] = 2;
|
||||
symbol->rows += 3;
|
||||
ean13(symbol, first_part, (char*)dest); break;
|
||||
default: strcpy(symbol->errtxt, "Invalid length EAN input"); return ERROR_TOO_LONG;
|
||||
default: strcpy(symbol->errtxt, "Invalid length EAN input"); return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCA:
|
||||
@ -704,7 +704,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
upca(symbol, first_part, (char*)dest);
|
||||
} else {
|
||||
strcpy(symbol->errtxt, "Input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCA_CC:
|
||||
@ -722,7 +722,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
upca(symbol, first_part, (char*)dest);
|
||||
} else {
|
||||
strcpy(symbol->errtxt, "UPCA input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCE:
|
||||
@ -730,7 +730,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
upce(symbol, first_part, (char*)dest);
|
||||
} else {
|
||||
strcpy(symbol->errtxt, "Input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCE_CC:
|
||||
@ -748,7 +748,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
upce(symbol, first_part, (char*)dest);
|
||||
} else {
|
||||
strcpy(symbol->errtxt, "UPCE input wrong length");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_ISBNX:
|
||||
@ -773,7 +773,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "Invalid length input");
|
||||
return ERROR_TOO_LONG;
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
expand(symbol, (char*)dest);
|
||||
|
@ -203,14 +203,14 @@ struct zint_symbol {
|
||||
|
||||
#define DM_SQUARE 100
|
||||
|
||||
#define WARN_INVALID_OPTION 2
|
||||
#define ERROR_TOO_LONG 5
|
||||
#define ERROR_INVALID_DATA 6
|
||||
#define ERROR_INVALID_CHECK 7
|
||||
#define ERROR_INVALID_OPTION 8
|
||||
#define ERROR_ENCODING_PROBLEM 9
|
||||
#define ERROR_FILE_ACCESS 10
|
||||
#define ERROR_MEMORY 11
|
||||
#define ZINT_WARN_INVALID_OPTION 2
|
||||
#define ZINT_ERROR_TOO_LONG 5
|
||||
#define ZINT_ERROR_INVALID_DATA 6
|
||||
#define ZINT_ERROR_INVALID_CHECK 7
|
||||
#define ZINT_ERROR_INVALID_OPTION 8
|
||||
#define ZINT_ERROR_ENCODING_PROBLEM 9
|
||||
#define ZINT_ERROR_FILE_ACCESS 10
|
||||
#define ZINT_ERROR_MEMORY 11
|
||||
|
||||
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(_MSC_VER)
|
||||
# if defined (DLL_EXPORT) || defined(PIC) || defined(_USRDLL)
|
||||
|
@ -79,7 +79,7 @@ void QZint::encode()
|
||||
QByteArray pstr=m_primaryMessage.left(99).toAscii();
|
||||
strcpy(m_zintSymbol->primary,pstr.data());
|
||||
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data(), bstr.length());
|
||||
if (error > WARN_INVALID_OPTION)
|
||||
if (error > ZINT_WARN_INVALID_OPTION)
|
||||
m_lastError=m_zintSymbol->errtxt;
|
||||
|
||||
if (m_zintSymbol->symbology == BARCODE_MAXICODE)
|
||||
@ -282,10 +282,10 @@ bool QZint::save_to_file(QString filename)
|
||||
strcpy(m_zintSymbol->fgcolour,fgcol.data());
|
||||
strcpy(m_zintSymbol->bgcolour,bgcol.data());
|
||||
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data(), bstr.length());
|
||||
if (error > WARN_INVALID_OPTION)
|
||||
if (error > ZINT_WARN_INVALID_OPTION)
|
||||
m_lastError=m_zintSymbol->errtxt;
|
||||
error = ZBarcode_Print(m_zintSymbol, 0);
|
||||
if (error > WARN_INVALID_OPTION)
|
||||
if (error > ZINT_WARN_INVALID_OPTION)
|
||||
m_lastError=m_zintSymbol->errtxt;
|
||||
if(error == 0) { return true; } else { return false; }
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ int validator(char test_string[], char source[])
|
||||
for(j = 0; j < strlen(test_string); j++) {
|
||||
if (source[i] == test_string[j]) { latch = 1; } }
|
||||
if (!(latch)) {
|
||||
return ERROR_INVALID_DATA; }
|
||||
return ZINT_ERROR_INVALID_DATA; }
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -207,7 +207,7 @@ int batch_process(struct zint_symbol *symbol, char *filename)
|
||||
strcpy(format_string, symbol->outfile);
|
||||
} else {
|
||||
strcpy(symbol->errtxt, "Format string too long");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
memset(adjusted, 0, sizeof(char) * 2);
|
||||
@ -218,7 +218,7 @@ int batch_process(struct zint_symbol *symbol, char *filename)
|
||||
file = fopen(filename, "rb");
|
||||
if (!file) {
|
||||
strcpy(symbol->errtxt, "Unable to read input file");
|
||||
return ERROR_INVALID_DATA;
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if(!strcmp(long_options[option_index].name, "border")) {
|
||||
error_number = validator(NESET, optarg);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
fprintf(stderr, "Invalid border width\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -465,7 +465,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if(!strcmp(long_options[option_index].name, "height")) {
|
||||
error_number = validator(NESET, optarg);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
fprintf(stderr, "Invalid symbol height\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -520,7 +520,7 @@ int main(int argc, char **argv)
|
||||
if(!strcmp(long_options[option_index].name, "rotate")) {
|
||||
/* Only certain inputs allowed */
|
||||
error_number = validator(NESET, optarg);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
fprintf(stderr, "Invalid rotation parameter\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -547,7 +547,7 @@ int main(int argc, char **argv)
|
||||
|
||||
case 'b':
|
||||
error_number = validator(NESET, optarg);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
fprintf(stderr, "Invalid barcode type\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -556,7 +556,7 @@ int main(int argc, char **argv)
|
||||
|
||||
case 'w':
|
||||
error_number = validator(NESET, optarg);
|
||||
if(error_number == ERROR_INVALID_DATA) {
|
||||
if(error_number == ZINT_ERROR_INVALID_DATA) {
|
||||
fprintf(stderr, "Invalid whitespace value\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -187,10 +187,8 @@ void SequenceWindow::import()
|
||||
|
||||
void SequenceWindow::generate_sequence()
|
||||
{
|
||||
int returnval;
|
||||
|
||||
ExportWindow dlg;
|
||||
dlg.barcode = barcode;
|
||||
dlg.output_data = txtPreview->toPlainText();
|
||||
returnval = dlg.exec();
|
||||
dlg.exec();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user