1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-01-10 13:36:02 +00:00

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

@@ -56,14 +56,14 @@ struct mainprog_info_type {
static void writepng_error_handler(png_structp png_ptr, png_const_charp msg) {
struct mainprog_info_type *graphic;
fprintf(stderr, "writepng libpng error: %s\n", msg);
fprintf(stderr, "writepng libpng error: %s (F30)\n", msg);
fflush(stderr);
graphic = (struct mainprog_info_type*) png_get_error_ptr(png_ptr);
if (graphic == NULL) {
/* we are completely hosed now */
fprintf(stderr,
"writepng severe error: jmpbuf not recoverable; terminating.\n");
"writepng severe error: jmpbuf not recoverable; terminating. (F31)\n");
fflush(stderr);
return;
}
@@ -108,7 +108,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
graphic->outfile = stdout;
} else {
if (!(graphic->outfile = fopen(symbol->outfile, "wb"))) {
strcpy(symbol->errtxt, "Can't open output file");
strcpy(symbol->errtxt, "Can't open output file (F32)");
return ZINT_ERROR_FILE_ACCESS;
}
}
@@ -116,21 +116,21 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
/* Set up error handling routine as proc() above */
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, graphic, writepng_error_handler, NULL);
if (!png_ptr) {
strcpy(symbol->errtxt, "Out of memory");
strcpy(symbol->errtxt, "Out of memory (F33)");
return ZINT_ERROR_MEMORY;
}
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
png_destroy_write_struct(&png_ptr, NULL);
strcpy(symbol->errtxt, "Out of memory");
strcpy(symbol->errtxt, "Out of memory (F34)");
return ZINT_ERROR_MEMORY;
}
/* catch jumping here */
if (setjmp(graphic->jmpbuf)) {
png_destroy_write_struct(&png_ptr, &info_ptr);
strcpy(symbol->errtxt, "libpng error occurred");
strcpy(symbol->errtxt, "libpng error occurred (F35)");
return ZINT_ERROR_MEMORY;
}