Add identifiers to error messages

To ease the debug process
This commit is contained in:
Robin Stuart 2016-10-28 22:40:40 +01:00
parent 5405035df1
commit 4561a66067
35 changed files with 296 additions and 298 deletions

View file

@ -95,7 +95,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int
char *rotated_pixbuf;
if (!(rotated_pixbuf = (char *) malloc(image_width * image_height))) {
printf("Insufficient memory for pixel buffer");
printf("Insufficient memory for pixel buffer (F50)");
return ZINT_ERROR_ENCODING_PROBLEM;
}
@ -117,21 +117,21 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int
to_upper((unsigned char*) symbol->bgcolour);
if (strlen(symbol->fgcolour) != 6) {
strcpy(symbol->errtxt, "Malformed foreground colour target");
strcpy(symbol->errtxt, "Malformed foreground colour target (F51)");
return ZINT_ERROR_INVALID_OPTION;
}
if (strlen(symbol->bgcolour) != 6) {
strcpy(symbol->errtxt, "Malformed background colour target");
strcpy(symbol->errtxt, "Malformed background colour target (F52)");
return ZINT_ERROR_INVALID_OPTION;
}
error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
if (error_number == ZINT_ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "Malformed foreground colour target");
strcpy(symbol->errtxt, "Malformed foreground colour target (F53)");
return ZINT_ERROR_INVALID_OPTION;
}
error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->fgcolour));
if (error_number == ZINT_ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "Malformed background colour target");
strcpy(symbol->errtxt, "Malformed background colour target (F54)");
return ZINT_ERROR_INVALID_OPTION;
}
@ -486,7 +486,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
image_height = (300 + (2 * yoffset * 2)) * scaler;
if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
printf("Insufficient memory for pixel buffer");
printf("Insufficient memory for pixel buffer (F55)");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (image_width * image_height); i++) {
@ -497,7 +497,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
hexagon_size = (int)scaler * 10;
if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) {
printf("Insufficient memory for pixel buffer");
printf("Insufficient memory for pixel buffer (F56)");
free(scaled_hexagon);
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
@ -607,7 +607,7 @@ int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_typ
/* Apply scale options by creating another pixel buffer */
if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) {
printf("Insufficient memory for pixel buffer");
printf("Insufficient memory for pixel buffer (F57)");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (scale_width * scale_height); i++) {
@ -782,7 +782,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
image_height = 2 * (symbol->height + textoffset + yoffset + yoffset);
if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
printf("Insufficient memory for pixel buffer");
printf("Insufficient memory for pixel buffer (F58)");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (image_width * image_height); i++) {
@ -1085,7 +1085,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
/* Apply scale options by creating another pixel buffer */
if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) {
free(pixelbuf);
printf("Insufficient memory for pixel buffer");
printf("Insufficient memory for pixel buffer (F59)");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (scale_width * scale_height); i++) {