mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-22 20:37:08 +00:00
ERROR_* renamed to ZERROR_*
updated form master
This commit is contained in:
@@ -49,12 +49,10 @@ char upc_check(char source[])
|
||||
|
||||
count = 0;
|
||||
|
||||
for (i = 0; i < strlen(source); i++)
|
||||
{
|
||||
for (i = 0; i < strlen(source); i++) {
|
||||
count += ctoi(source[i]);
|
||||
|
||||
if ((i%2) == 0)
|
||||
{
|
||||
if (!(i & 1)) {
|
||||
count += 2 * (ctoi(source[i]));
|
||||
}
|
||||
}
|
||||
@@ -290,12 +288,10 @@ char ean_check(char source[])
|
||||
count = 0;
|
||||
|
||||
h = strlen(source);
|
||||
for (i = h - 1; i >= 0; i--)
|
||||
{
|
||||
for (i = h - 1; i >= 0; i--) {
|
||||
count += ctoi(source[i]);
|
||||
|
||||
if (!((i%2) == 0))
|
||||
{
|
||||
if (i & 1) {
|
||||
count += 2 * ctoi(source[i]);
|
||||
}
|
||||
}
|
||||
@@ -413,7 +409,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 == ZERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input");
|
||||
return error_number;
|
||||
}
|
||||
@@ -422,7 +418,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 ZERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if(src_len == 13) /* Using 13 character ISBN */
|
||||
@@ -431,14 +427,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 ZERROR_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 ZERROR_INVALID_CHECK;
|
||||
}
|
||||
source[12] = '\0';
|
||||
|
||||
@@ -451,7 +447,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 ZERROR_INVALID_CHECK;
|
||||
}
|
||||
for(i = 13; i > 0; i--)
|
||||
{
|
||||
@@ -479,7 +475,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 ZERROR_INVALID_CHECK;
|
||||
}
|
||||
|
||||
/* Convert to EAN-13 number */
|
||||
@@ -595,18 +591,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 ZERROR_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 == ZERROR_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 == ZERROR_INVALID_DATA) {
|
||||
strcpy(symbol->errtxt, "Invalid characters in input");
|
||||
return error_number;
|
||||
}
|
||||
@@ -660,7 +656,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; break;
|
||||
default: strcpy(symbol->errtxt, "Invalid length input"); return ZERROR_TOO_LONG; break;
|
||||
}
|
||||
break;
|
||||
case BARCODE_EANX_CC:
|
||||
@@ -688,7 +684,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; break;
|
||||
default: strcpy(symbol->errtxt, "Invalid length EAN input"); return ZERROR_TOO_LONG; break;
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCA:
|
||||
@@ -696,7 +692,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 ZERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCA_CC:
|
||||
@@ -714,7 +710,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 ZERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCE:
|
||||
@@ -722,7 +718,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 ZERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_UPCE_CC:
|
||||
@@ -740,7 +736,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 ZERROR_TOO_LONG;
|
||||
}
|
||||
break;
|
||||
case BARCODE_ISBNX:
|
||||
@@ -765,7 +761,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 ZERROR_TOO_LONG;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user