Resolve further error message and warning idiosyncrasies

This commit is contained in:
Robin Stuart 2018-01-21 18:10:42 +00:00
parent baf56daa17
commit 0d4af7a462
2 changed files with 33 additions and 8 deletions

View File

@ -1282,25 +1282,36 @@ int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle) {
int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle) {
int error_number;
int first_err;
error_number = ZBarcode_Encode(symbol, input, length);
if (error_number != 0) {
if (error_number >= 5) {
return error_number;
}
first_err = error_number;
error_number = ZBarcode_Print(symbol, rotate_angle);
if (error_number == 0) {
error_number = first_err;
}
return error_number;
}
int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle) {
int error_number;
int first_err;
error_number = ZBarcode_Encode(symbol, input, length);
if (error_number != 0) {
if (error_number >= 5) {
return error_number;
}
first_err = error_number;
error_number = ZBarcode_Buffer(symbol, rotate_angle);
if (error_number == 0) {
error_number = first_err;
}
return error_number;
}
@ -1365,24 +1376,38 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) {
int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, char *filename, int rotate_angle) {
int error_number;
int first_err;
error_number = ZBarcode_Encode_File(symbol, filename);
if (error_number != 0) {
if (error_number >= 5) {
return error_number;
}
return ZBarcode_Print(symbol, rotate_angle);
first_err = error_number;
error_number = ZBarcode_Print(symbol, rotate_angle);
if (error_number == 0) {
error_number = first_err;
}
return error_number;
}
int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, int rotate_angle) {
int error_number;
int first_err;
error_number = ZBarcode_Encode_File(symbol, filename);
if (error_number != 0) {
if (error_number >= 5) {
return error_number;
}
first_err = error_number;
error_number = ZBarcode_Buffer(symbol, rotate_angle);
if (error_number == 0) {
error_number = first_err;
}
return ZBarcode_Buffer(symbol, rotate_angle);
return error_number;
}
/*

View File

@ -279,7 +279,7 @@ namespace Zint {
strcpy(m_zintSymbol->fgcolour, fgcol.data());
strcpy(m_zintSymbol->bgcolour, bgcol.data());
m_error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char*) bstr.data(), bstr.length(), 0);
if (m_error != 0) {
if (m_error >= 5) {
m_lastError = m_zintSymbol->errtxt;
return false;
} else {