mirror of
https://git.code.sf.net/p/zint/code
synced 2026-01-09 13:05:58 +00:00
Audit of error codes
This commit is contained in:
@@ -102,14 +102,14 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
if (symbol->output_options & BARCODE_STDOUT) {
|
||||
#ifdef _MSC_VER
|
||||
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
|
||||
strcpy(symbol->errtxt, "Can't open output file");
|
||||
strcpy(symbol->errtxt, "631: Can't open output file");
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
#endif
|
||||
graphic->outfile = stdout;
|
||||
} else {
|
||||
if (!(graphic->outfile = fopen(symbol->outfile, "wb"))) {
|
||||
strcpy(symbol->errtxt, "Can't open output file (F32)");
|
||||
strcpy(symbol->errtxt, "632: Can't open output file");
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
}
|
||||
@@ -117,21 +117,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 (F33)");
|
||||
strcpy(symbol->errtxt, "633: Out of memory");
|
||||
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 (F34)");
|
||||
strcpy(symbol->errtxt, "634: Out of memory");
|
||||
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 (F35)");
|
||||
strcpy(symbol->errtxt, "635: libpng error occurred");
|
||||
return ZINT_ERROR_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user