Avoid possible confusion with Windows error code

Bugfix by Oxy Genic
Ref: 34857131/
This commit is contained in:
Robin Stuart 2016-02-17 10:37:20 +00:00
parent 7ae95b2b42
commit 2e59058615
31 changed files with 3878 additions and 3878 deletions

View file

@ -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 */