From d1d257dea150d79bedcf691d4aaac429b621de46 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 15 Sep 2013 13:34:50 +0200 Subject: More png experiments... --- plugingui/image.cc | 47 +++++++++++++++------------ plugingui/png/png.c | 18 +++++------ plugingui/png/png.h | 38 +++++++++++----------- plugingui/png/pngerror.c | 12 +++---- plugingui/png/pngget.c | 6 ++-- plugingui/png/pngmem.c | 18 +++++------ plugingui/png/pngread.c | 52 +++++++++++++++--------------- plugingui/png/pngrio.c | 8 ++--- plugingui/png/pngrtran.c | 22 ++++++------- plugingui/png/pngrutil.c | 82 ++++++++++++++++++++++++------------------------ plugingui/png/pngset.c | 16 +++++----- plugingui/png/pngtrans.c | 2 +- 12 files changed, 164 insertions(+), 157 deletions(-) diff --git a/plugingui/image.cc b/plugingui/image.cc index 62234f3..817fe05 100644 --- a/plugingui/image.cc +++ b/plugingui/image.cc @@ -37,6 +37,9 @@ #include "resource.h" // http://blog.hammerian.net/2009/reading-png-images-from-memory/ +#define PNG_PREFIX(x) dg_##x +//#define PNG_PREFIX(x) x + typedef struct { size_t p; size_t size; @@ -45,9 +48,11 @@ typedef struct { static void dio_reader(png_structp png_ptr, png_bytep buf, png_size_t size) { - data_io_t *dio = (data_io_t *)png_get_io_ptr(png_ptr); + data_io_t *dio = (data_io_t *)PNG_PREFIX(png_get_io_ptr(png_ptr)); - if(size > dio->size - dio->p) png_error(png_ptr, "Could not read bytes."); + if(size > dio->size - dio->p) { + PNG_PREFIX(png_error(png_ptr, "Could not read bytes.")); + } memcpy(buf, (dio->data + dio->p), size); dio->p += size; @@ -113,14 +118,15 @@ void GUI::Image::load(const char* data, size_t size) const char *header = data; // test for it being a png: - if(png_sig_cmp((png_byte*)header, 0, 8)) { + if(PNG_PREFIX(png_sig_cmp((png_byte*)header, 0, 8))) { ERR(image, "[read_png_file] File is not recognized as a PNG file"); setError(0); return; } // initialize stuff - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = + PNG_PREFIX(png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)); if(!png_ptr) { ERR(image, "[read_png_file] png_create_read_struct failed"); @@ -128,18 +134,18 @@ void GUI::Image::load(const char* data, size_t size) return; } - info_ptr = png_create_info_struct(png_ptr); + info_ptr = PNG_PREFIX(png_create_info_struct(png_ptr)); if(!info_ptr) { ERR(image, "[read_png_file] png_create_info_struct failed"); setError(2); - png_destroy_read_struct(&png_ptr, NULL, NULL); + PNG_PREFIX(png_destroy_read_struct(&png_ptr, NULL, NULL)); return; } - if(setjmp(png_jmpbuf(png_ptr))) { + if(setjmp(PNG_PREFIX(png_jmpbuf(png_ptr)))) { ERR(image, "[read_png_file] Error during init_io"); setError(3); - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + PNG_PREFIX(png_destroy_read_struct(&png_ptr, &info_ptr, NULL)); return; } @@ -148,36 +154,37 @@ void GUI::Image::load(const char* data, size_t size) dio.data = data; dio.size = size; dio.p = 8; // skip header - png_set_read_fn(png_ptr, &dio, dio_reader); + PNG_PREFIX(png_set_read_fn(png_ptr, &dio, dio_reader)); - png_set_sig_bytes(png_ptr, 8); + PNG_PREFIX(png_set_sig_bytes(png_ptr, 8)); - png_read_info(png_ptr, info_ptr); + PNG_PREFIX(png_read_info(png_ptr, info_ptr)); - w = png_get_image_width(png_ptr, info_ptr); - h = png_get_image_height(png_ptr, info_ptr); + w = PNG_PREFIX(png_get_image_width(png_ptr, info_ptr)); + h = PNG_PREFIX(png_get_image_height(png_ptr, info_ptr)); //color_type = png_get_color_type(png_ptr, info_ptr); //bit_depth = png_get_bit_depth(png_ptr, info_ptr); - number_of_passes = png_set_interlace_handling(png_ptr); - png_read_update_info(png_ptr, info_ptr); + number_of_passes = PNG_PREFIX(png_set_interlace_handling(png_ptr)); + PNG_PREFIX(png_read_update_info(png_ptr, info_ptr)); // read file - if(setjmp(png_jmpbuf(png_ptr))) { + if(setjmp(PNG_PREFIX(png_jmpbuf(png_ptr)))) { ERR(image, "[read_png_file] Error during read_image"); setError(4); - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + PNG_PREFIX(png_destroy_read_struct(&png_ptr, &info_ptr, NULL)); return; } row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * h); for(size_t y = 0; y < h; y++) { - row_pointers[y] = (png_byte*) malloc(png_get_rowbytes(png_ptr, info_ptr)); + row_pointers[y] = + (png_byte*) malloc(PNG_PREFIX(png_get_rowbytes(png_ptr, info_ptr))); } - png_read_image(png_ptr, row_pointers); + PNG_PREFIX(png_read_image(png_ptr, row_pointers)); - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + PNG_PREFIX(png_destroy_read_struct(&png_ptr, &info_ptr, NULL)); } size_t GUI::Image::width() diff --git a/plugingui/png/png.c b/plugingui/png/png.c index 6e42c79..02c3044 100644 --- a/plugingui/png/png.c +++ b/plugingui/png/png.c @@ -24,7 +24,7 @@ typedef png_libpng_version_1_5_13 Your_png_h_is_not_version_1_5_13; #ifdef PNG_READ_SUPPORTED void PNGAPI -png_set_sig_bytes(png_structp png_ptr, int num_bytes) +dg_png_set_sig_bytes(png_structp png_ptr, int num_bytes) { png_debug(1, "in png_set_sig_bytes"); @@ -32,7 +32,7 @@ png_set_sig_bytes(png_structp png_ptr, int num_bytes) return; if (num_bytes > 8) - png_error(png_ptr, "Too many bytes for PNG signature"); + dg_png_error(png_ptr, "Too many bytes for PNG signature"); png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes); } @@ -46,7 +46,7 @@ png_set_sig_bytes(png_structp png_ptr, int num_bytes) * PNG signature (this is the same behavior as strcmp, memcmp, etc). */ int PNGAPI -png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check) +dg_png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check) { png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; @@ -227,7 +227,7 @@ png_user_version_check(png_structp png_ptr, png_const_charp user_png_ver) * libpng don't have to be recompiled if png_info changes size. */ PNG_FUNCTION(png_infop,PNGAPI -png_create_info_struct,(png_structp png_ptr),PNG_ALLOCATED) +dg_png_create_info_struct,(png_structp png_ptr),PNG_ALLOCATED) { png_infop info_ptr; @@ -557,7 +557,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr) * pointer before png_write_destroy() or png_read_destroy() are called. */ png_voidp PNGAPI -png_get_io_ptr(png_structp png_ptr) +dg_png_get_io_ptr(png_structp png_ptr) { if (png_ptr == NULL) return (NULL); @@ -1156,7 +1156,7 @@ int png_XYZ_from_xy_checked(png_structp png_ptr, png_XYZ *XYZ, png_xy xy) /* libpng is broken; this should be a warning but if it happens we * want error reports so for the moment it is an error. */ - png_error(png_ptr, "internal error in png_XYZ_from_xy"); + dg_png_error(png_ptr, "internal error in png_XYZ_from_xy"); break; } @@ -1305,7 +1305,7 @@ png_check_IHDR(png_structp png_ptr, # endif if (error == 1) - png_error(png_ptr, "Invalid IHDR data"); + dg_png_error(png_ptr, "Invalid IHDR data"); } #if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED) @@ -1810,7 +1810,7 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size, } /* Here on buffer too small. */ - png_error(png_ptr, "ASCII conversion buffer too small"); + dg_png_error(png_ptr, "ASCII conversion buffer too small"); } # endif /* FLOATING_POINT */ @@ -1884,7 +1884,7 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size, } /* Here on buffer too small. */ - png_error(png_ptr, "ASCII conversion buffer too small"); + dg_png_error(png_ptr, "ASCII conversion buffer too small"); } # endif /* FIXED_POINT */ #endif /* READ_SCAL */ diff --git a/plugingui/png/png.h b/plugingui/png/png.h index 7b74433..5b95fe8 100644 --- a/plugingui/png/png.h +++ b/plugingui/png/png.h @@ -996,14 +996,14 @@ PNG_EXPORT(1, png_uint_32, png_access_version_number, (void)); /* Tell lib we have already handled the first magic bytes. * Handling more than 8 bytes from the beginning of the file is an error. */ -PNG_EXPORT(2, void, png_set_sig_bytes, (png_structp png_ptr, int num_bytes)); +PNG_EXPORT(2, void, dg_png_set_sig_bytes, (png_structp png_ptr, int num_bytes)); /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a * PNG file. Returns zero if the supplied bytes match the 8-byte PNG * signature, and non-zero otherwise. Having num_to_check == 0 or * start > 7 will always fail (ie return non-zero). */ -PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start, +PNG_EXPORT(3, int, dg_png_sig_cmp, (png_const_bytep sig, png_size_t start, png_size_t num_to_check)); /* Simple signature checking function. This is the same as calling @@ -1012,7 +1012,7 @@ PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start, #define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n)) /* Allocate and initialize png_ptr struct for reading, and any other memory. */ -PNG_EXPORTA(4, png_structp, png_create_read_struct, +PNG_EXPORTA(4, png_structp, dg_png_create_read_struct, (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn), PNG_ALLOCATED); @@ -1040,12 +1040,12 @@ PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structp png_ptr, * allocated by the library - the call will return NULL on a mismatch * indicating an ABI mismatch. */ -PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr, +PNG_EXPORT(8, jmp_buf*, dg_png_set_longjmp_fn, (png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size)); -# define png_jmpbuf(png_ptr) \ - (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf))) +# define dg_png_jmpbuf(png_ptr) \ + (*dg_png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf))) #else -# define png_jmpbuf(png_ptr) \ +# define dg_png_jmpbuf(png_ptr) \ (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) #endif /* This function should be used by libpng applications in place of @@ -1094,7 +1094,7 @@ PNG_EXPORT(16, void, png_write_chunk_data, (png_structp png_ptr, PNG_EXPORT(17, void, png_write_chunk_end, (png_structp png_ptr)); /* Allocate and initialize the info structure */ -PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_structp png_ptr), +PNG_EXPORTA(18, png_infop, dg_png_create_info_struct, (png_structp png_ptr), PNG_ALLOCATED); PNG_EXPORT(19, void, png_info_init_3, (png_infopp info_ptr, @@ -1108,7 +1108,7 @@ PNG_EXPORT(21, void, png_write_info, #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the information before the actual image data. */ -PNG_EXPORT(22, void, png_read_info, +PNG_EXPORT(22, void, dg_png_read_info, (png_structp png_ptr, png_infop info_ptr)); #endif @@ -1440,7 +1440,7 @@ PNG_EXPORT(44, void, png_set_shift, (png_structp png_ptr, png_const_color_8p * necessary to call png_read_row or png_read_rows png_get_image_height * times for each pass. */ -PNG_EXPORT(45, int, png_set_interlace_handling, (png_structp png_ptr)); +PNG_EXPORT(45, int, dg_png_set_interlace_handling, (png_structp png_ptr)); #endif #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) @@ -1524,7 +1524,7 @@ PNG_EXPORT(52, void, png_write_flush, (png_structp png_ptr)); PNG_EXPORT(53, void, png_start_read_image, (png_structp png_ptr)); /* Optional call to update the users info structure */ -PNG_EXPORT(54, void, png_read_update_info, +PNG_EXPORT(54, void, dg_png_read_update_info, (png_structp png_ptr, png_infop info_ptr)); #ifdef PNG_SEQUENTIAL_READ_SUPPORTED @@ -1541,7 +1541,7 @@ PNG_EXPORT(56, void, png_read_row, (png_structp png_ptr, png_bytep row, #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the whole image into memory at once. */ -PNG_EXPORT(57, void, png_read_image, (png_structp png_ptr, png_bytepp image)); +PNG_EXPORT(57, void, dg_png_read_image, (png_structp png_ptr, png_bytepp image)); #endif /* Write a row of image data */ @@ -1574,7 +1574,7 @@ PNG_EXPORT(63, void, png_destroy_info_struct, (png_structp png_ptr, png_infopp info_ptr_ptr)); /* Free any memory associated with the png_struct and the png_info_structs */ -PNG_EXPORT(64, void, png_destroy_read_struct, (png_structpp png_ptr_ptr, +PNG_EXPORT(64, void, dg_png_destroy_read_struct, (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); /* Free any memory associated with the png_struct and the png_info_structs */ @@ -1776,11 +1776,11 @@ PNG_EXPORT(77, void, png_set_write_fn, (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); /* Replace the default data input function with a user supplied one. */ -PNG_EXPORT(78, void, png_set_read_fn, (png_structp png_ptr, png_voidp io_ptr, +PNG_EXPORT(78, void, dg_png_set_read_fn, (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn)); /* Return the user pointer associated with the I/O functions */ -PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_structp png_ptr)); +PNG_EXPORT(79, png_voidp, dg_png_get_io_ptr, (png_structp png_ptr)); PNG_EXPORT(80, void, png_set_read_status_fn, (png_structp png_ptr, png_read_status_ptr read_row_fn)); @@ -1932,7 +1932,7 @@ PNG_EXPORT(101, void, png_free_default, (png_structp png_ptr, png_voidp ptr)); #ifdef PNG_ERROR_TEXT_SUPPORTED /* Fatal error in PNG image of libpng - can't continue */ -PNG_EXPORTA(102, void, png_error, +PNG_EXPORTA(102, void, dg_png_error, (png_structp png_ptr, png_const_charp error_message), PNG_NORETURN); @@ -1997,7 +1997,7 @@ PNG_EXPORT(110, png_uint_32, png_get_valid, png_uint_32 flag)); /* Returns number of bytes needed to hold a transformed row. */ -PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structp png_ptr, +PNG_EXPORT(111, png_size_t, dg_png_get_rowbytes, (png_const_structp png_ptr, png_const_infop info_ptr)); #ifdef PNG_INFO_IMAGE_SUPPORTED @@ -2019,11 +2019,11 @@ PNG_EXPORT(114, png_byte, png_get_channels, #ifdef PNG_EASY_ACCESS_SUPPORTED /* Returns image width in pixels. */ -PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structp png_ptr, +PNG_EXPORT(115, png_uint_32, dg_png_get_image_width, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image height in pixels. */ -PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structp png_ptr, +PNG_EXPORT(116, png_uint_32, dg_png_get_image_height, (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image bit_depth. */ diff --git a/plugingui/png/pngerror.c b/plugingui/png/pngerror.c index e0585a8..1c64a7f 100644 --- a/plugingui/png/pngerror.c +++ b/plugingui/png/pngerror.c @@ -36,7 +36,7 @@ png_default_warning PNGARG((png_structp png_ptr, */ #ifdef PNG_ERROR_TEXT_SUPPORTED PNG_FUNCTION(void,PNGAPI -png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN) +dg_png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN) { #ifdef PNG_ERROR_NUMBERS_SUPPORTED char msg[16]; @@ -361,7 +361,7 @@ png_benign_error(png_structp png_ptr, png_const_charp error_message) if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) png_warning(png_ptr, error_message); else - png_error(png_ptr, error_message); + dg_png_error(png_ptr, error_message); } #endif @@ -431,12 +431,12 @@ png_chunk_error,(png_structp png_ptr, png_const_charp error_message), { char msg[18+PNG_MAX_ERROR_TEXT]; if (png_ptr == NULL) - png_error(png_ptr, error_message); + dg_png_error(png_ptr, error_message); else { png_format_buffer(png_ptr, msg, error_message); - png_error(png_ptr, msg); + dg_png_error(png_ptr, msg); } } #endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */ @@ -488,7 +488,7 @@ png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN) ++iin; } msg[fixed_message_ln + iin] = 0; - png_error(png_ptr, msg); + dg_png_error(png_ptr, msg); } #endif #endif @@ -498,7 +498,7 @@ png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN) * otherwise it is necessary for png_default_error to be overridden. */ jmp_buf* PNGAPI -png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn, +dg_png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size) { if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf)) diff --git a/plugingui/png/pngget.c b/plugingui/png/pngget.c index 43400cd..65d8487 100644 --- a/plugingui/png/pngget.c +++ b/plugingui/png/pngget.c @@ -27,7 +27,7 @@ png_get_valid(png_const_structp png_ptr, png_const_infop info_ptr, } png_size_t PNGAPI -png_get_rowbytes(png_const_structp png_ptr, png_const_infop info_ptr) +dg_png_get_rowbytes(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->rowbytes); @@ -49,7 +49,7 @@ png_get_rows(png_const_structp png_ptr, png_const_infop info_ptr) #ifdef PNG_EASY_ACCESS_SUPPORTED /* Easy access to info, added in libpng-0.99 */ png_uint_32 PNGAPI -png_get_image_width(png_const_structp png_ptr, png_const_infop info_ptr) +dg_png_get_image_width(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->width; @@ -58,7 +58,7 @@ png_get_image_width(png_const_structp png_ptr, png_const_infop info_ptr) } png_uint_32 PNGAPI -png_get_image_height(png_const_structp png_ptr, png_const_infop info_ptr) +dg_png_get_image_height(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->height; diff --git a/plugingui/png/pngmem.c b/plugingui/png/pngmem.c index f885533..ca258d0 100644 --- a/plugingui/png/pngmem.c +++ b/plugingui/png/pngmem.c @@ -149,7 +149,7 @@ png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) ret = (png_malloc_default(png_ptr, size)); if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of memory"); + dg_png_error(png_ptr, "Out of memory"); return (ret); } @@ -225,7 +225,7 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) { # ifndef PNG_USER_MEM_SUPPORTED if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */ + dg_png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */ else png_warning(png_ptr, "Out Of Memory"); @@ -237,7 +237,7 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) { # ifndef PNG_USER_MEM_SUPPORTED if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, + dg_png_error(png_ptr, "Farmalloc didn't return normalized pointer"); else @@ -255,7 +255,7 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) { # ifndef PNG_USER_MEM_SUPPORTED if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */ + dg_png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */ else png_warning(png_ptr, "Out Of memory"); @@ -286,7 +286,7 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) { # ifndef PNG_USER_MEM_SUPPORTED if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of Memory"); /* Note "O" and "M" */ + dg_png_error(png_ptr, "Out of Memory"); /* Note "O" and "M" */ else png_warning(png_ptr, "Out of Memory"); @@ -304,7 +304,7 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) if (ret == NULL) { if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */ + dg_png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */ else png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */ @@ -510,7 +510,7 @@ png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) ret = (png_malloc_default(png_ptr, size)); if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of Memory"); + dg_png_error(png_ptr, "Out of Memory"); return (ret); } @@ -529,7 +529,7 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) { # ifndef PNG_USER_MEM_SUPPORTED if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Cannot Allocate > 64K"); + dg_png_error(png_ptr, "Cannot Allocate > 64K"); else # endif @@ -565,7 +565,7 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) # ifndef PNG_USER_MEM_SUPPORTED if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of Memory"); + dg_png_error(png_ptr, "Out of Memory"); # endif return (ret); diff --git a/plugingui/png/pngread.c b/plugingui/png/pngread.c index 1d8c6b3..ecb138d 100644 --- a/plugingui/png/pngread.c +++ b/plugingui/png/pngread.c @@ -20,7 +20,7 @@ /* Create a PNG structure for reading, and allocate any memory needed. */ PNG_FUNCTION(png_structp,PNGAPI -png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr, +dg_png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED) { @@ -82,7 +82,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, #ifdef USE_FAR_KEYWORD if (setjmp(tmp_jmpbuf)) #else - if (setjmp(png_jmpbuf(png_ptr))) /* Sets longjmp to match setjmp */ + if (setjmp(dg_png_jmpbuf(png_ptr))) /* Sets longjmp to match setjmp */ #endif PNG_ABORT(); #ifdef USE_FAR_KEYWORD @@ -158,7 +158,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - png_set_read_fn(png_ptr, NULL, NULL); + dg_png_set_read_fn(png_ptr, NULL, NULL); return (png_ptr); @@ -175,7 +175,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, * read if it is determined that this isn't a valid PNG file. */ void PNGAPI -png_read_info(png_structp png_ptr, png_infop info_ptr) +dg_png_read_info(png_structp png_ptr, png_infop info_ptr) { png_debug(1, "in png_read_info"); @@ -218,11 +218,11 @@ png_read_info(png_structp png_ptr, png_infop info_ptr) else if (chunk_name == png_IDAT) { if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before IDAT"); + dg_png_error(png_ptr, "Missing IHDR before IDAT"); else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && !(png_ptr->mode & PNG_HAVE_PLTE)) - png_error(png_ptr, "Missing PLTE before IDAT"); + dg_png_error(png_ptr, "Missing PLTE before IDAT"); break; } @@ -234,11 +234,11 @@ png_read_info(png_structp png_ptr, png_infop info_ptr) else if (chunk_name == png_IDAT) { if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before IDAT"); + dg_png_error(png_ptr, "Missing IHDR before IDAT"); else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && !(png_ptr->mode & PNG_HAVE_PLTE)) - png_error(png_ptr, "Missing PLTE before IDAT"); + dg_png_error(png_ptr, "Missing PLTE before IDAT"); png_ptr->idat_size = length; png_ptr->mode |= PNG_HAVE_IDAT; @@ -338,7 +338,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr) /* Optional call to update the users info_ptr structure */ void PNGAPI -png_read_update_info(png_structp png_ptr, png_infop info_ptr) +dg_png_read_update_info(png_structp png_ptr, png_infop info_ptr) { png_debug(1, "in png_read_update_info"); @@ -526,7 +526,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) #endif if (!(png_ptr->mode & PNG_HAVE_IDAT)) - png_error(png_ptr, "Invalid attempt to read row data"); + dg_png_error(png_ptr, "Invalid attempt to read row data"); png_ptr->zstream.next_out = png_ptr->row_buf; png_ptr->zstream.avail_out = @@ -543,7 +543,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) png_ptr->idat_size = png_read_chunk_header(png_ptr); if (png_ptr->chunk_name != png_IDAT) - png_error(png_ptr, "Not enough image data"); + dg_png_error(png_ptr, "Not enough image data"); } png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; png_ptr->zstream.next_in = png_ptr->zbuf; @@ -567,7 +567,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) } if (ret != Z_OK) - png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : + dg_png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : "Decompression error"); } while (png_ptr->zstream.avail_out); @@ -578,7 +578,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1, png_ptr->prev_row + 1, png_ptr->row_buf[0]); else - png_error(png_ptr, "bad adaptive filter value"); + dg_png_error(png_ptr, "bad adaptive filter value"); } /* libpng 1.5.6: the following line was copying png_ptr->rowbytes before @@ -608,11 +608,11 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) { png_ptr->transformed_pixel_depth = row_info.pixel_depth; if (row_info.pixel_depth > png_ptr->maximum_pixel_depth) - png_error(png_ptr, "sequential row overflow"); + dg_png_error(png_ptr, "sequential row overflow"); } else if (png_ptr->transformed_pixel_depth != row_info.pixel_depth) - png_error(png_ptr, "internal sequential row size calculation error"); + dg_png_error(png_ptr, "internal sequential row size calculation error"); #ifdef PNG_READ_INTERLACING_SUPPORTED /* Blow up interlaced rows to full size */ @@ -727,7 +727,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row, * [*] png_handle_alpha() does not exist yet, as of this version of libpng */ void PNGAPI -png_read_image(png_structp png_ptr, png_bytepp image) +dg_png_read_image(png_structp png_ptr, png_bytepp image) { png_uint_32 i, image_height; int pass, j; @@ -741,7 +741,7 @@ png_read_image(png_structp png_ptr, png_bytepp image) #ifdef PNG_READ_INTERLACING_SUPPORTED if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) { - pass = png_set_interlace_handling(png_ptr); + pass = dg_png_set_interlace_handling(png_ptr); /* And make sure transforms are initialized. */ png_start_read_image(png_ptr); } @@ -762,11 +762,11 @@ png_read_image(png_structp png_ptr, png_bytepp image) /* Obtain the pass number, which also turns on the PNG_INTERLACE flag in * the above error case. */ - pass = png_set_interlace_handling(png_ptr); + pass = dg_png_set_interlace_handling(png_ptr); } #else if (png_ptr->interlaced) - png_error(png_ptr, + dg_png_error(png_ptr, "Cannot read interlaced image -- interlace handler disabled"); pass = 1; @@ -940,7 +940,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr) /* Free all memory used by the read */ void PNGAPI -png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, +dg_png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr) { png_structp png_ptr = NULL; @@ -1131,9 +1131,9 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, /* png_read_info() gives us all of the information from the * PNG file before the first IDAT (image data chunk). */ - png_read_info(png_ptr, info_ptr); + dg_png_read_info(png_ptr, info_ptr); if (info_ptr->height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) - png_error(png_ptr, "Image is too high to process with png_read_png()"); + dg_png_error(png_ptr, "Image is too high to process with png_read_png()"); /* -------------- image transformations start here ------------------- */ @@ -1263,13 +1263,13 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, /* We use png_read_image and rely on that for interlace handling, but we also * call png_read_update_info therefore must turn on interlace handling now: */ - (void)png_set_interlace_handling(png_ptr); + (void)dg_png_set_interlace_handling(png_ptr); /* Optional call to gamma correct and add the background to the palette * and update info structure. REQUIRED if you are expecting libpng to * update the palette for you (i.e., you selected such a transform above). */ - png_read_update_info(png_ptr, info_ptr); + dg_png_read_update_info(png_ptr, info_ptr); /* -------------- image transformations end here ------------------- */ @@ -1287,10 +1287,10 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, for (row = 0; row < (int)info_ptr->height; row++) info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, - png_get_rowbytes(png_ptr, info_ptr)); + dg_png_get_rowbytes(png_ptr, info_ptr)); } - png_read_image(png_ptr, info_ptr->row_pointers); + dg_png_read_image(png_ptr, info_ptr->row_pointers); info_ptr->valid |= PNG_INFO_IDAT; /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ diff --git a/plugingui/png/pngrio.c b/plugingui/png/pngrio.c index e9c381c..e45df21 100644 --- a/plugingui/png/pngrio.c +++ b/plugingui/png/pngrio.c @@ -37,7 +37,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) (*(png_ptr->read_data_fn))(png_ptr, data, length); else - png_error(png_ptr, "Call to NULL read function"); + dg_png_error(png_ptr, "Call to NULL read function"); } #ifdef PNG_STDIO_SUPPORTED @@ -61,7 +61,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr); if (check != length) - png_error(png_ptr, "Read Error"); + dg_png_error(png_ptr, "Read Error"); } # else /* This is the model-independent version. Since the standard I/O library @@ -117,7 +117,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) } if ((png_uint_32)check != (png_uint_32)length) - png_error(png_ptr, "read Error"); + dg_png_error(png_ptr, "read Error"); } # endif #endif @@ -142,7 +142,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) * be used. */ void PNGAPI -png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, +dg_png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn) { if (png_ptr == NULL) diff --git a/plugingui/png/pngrtran.c b/plugingui/png/pngrtran.c index 1e31c75..33e0d30 100644 --- a/plugingui/png/pngrtran.c +++ b/plugingui/png/pngrtran.c @@ -260,7 +260,7 @@ png_set_alpha_mode_fixed(png_structp png_ptr, int mode, * values are reasonable this may have to be changed. */ if (output_gamma < 70000 || output_gamma > 300000) - png_error(png_ptr, "output gamma out of expected range"); + dg_png_error(png_ptr, "output gamma out of expected range"); /* The default file gamma is the inverse of the output gamma; the output * gamma may be changed below so get the file value first: @@ -313,7 +313,7 @@ png_set_alpha_mode_fixed(png_structp png_ptr, int mode, break; default: - png_error(png_ptr, "invalid alpha mode"); + dg_png_error(png_ptr, "invalid alpha mode"); } /* Only set the default gamma if the file gamma has not been set (this has @@ -338,7 +338,7 @@ png_set_alpha_mode_fixed(png_structp png_ptr, int mode, png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND; if (png_ptr->transformations & PNG_COMPOSE) - png_error(png_ptr, + dg_png_error(png_ptr, "conflicting calls to set alpha mode and background"); png_ptr->transformations |= PNG_COMPOSE; @@ -790,10 +790,10 @@ png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma, * undocumented API feature) it will not be made until libpng-1.6.0. */ if (file_gamma <= 0) - png_error(png_ptr, "invalid file gamma in png_set_gamma"); + dg_png_error(png_ptr, "invalid file gamma in png_set_gamma"); if (scrn_gamma <= 0) - png_error(png_ptr, "invalid screen gamma in png_set_gamma"); + dg_png_error(png_ptr, "invalid screen gamma in png_set_gamma"); #endif /* Set the gamma values unconditionally - this overrides the value in the PNG @@ -949,7 +949,7 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, break; default: - png_error(png_ptr, "invalid error action to rgb_to_gray"); + dg_png_error(png_ptr, "invalid error action to rgb_to_gray"); break; } if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) @@ -1696,7 +1696,7 @@ png_init_read_transformations(png_structp png_ptr) break; default: - png_error(png_ptr, "invalid background gamma type"); + dg_png_error(png_ptr, "invalid background gamma type"); } g_sig = png_gamma_significant(g); @@ -2087,7 +2087,7 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info) * error is incredibly rare and incredibly easy to debug without this * information. */ - png_error(png_ptr, "NULL row buffer"); + dg_png_error(png_ptr, "NULL row buffer"); } /* The following is debugging; prior to 1.5.4 the code was never compiled in; @@ -2102,7 +2102,7 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info) * png_read_update_info() after setting transforms that expand pixels. * This check added to libpng-1.2.19 (but not enabled until 1.5.4). */ - png_error(png_ptr, "Uninitialized row"); + dg_png_error(png_ptr, "Uninitialized row"); } #ifdef PNG_READ_EXPAND_SUPPORTED @@ -2153,7 +2153,7 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info) if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == PNG_RGB_TO_GRAY_ERR) - png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel"); + dg_png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel"); } } #endif @@ -2262,7 +2262,7 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info) png_ptr->palette_lookup, png_ptr->quantize_index); if (row_info->rowbytes == 0) - png_error(png_ptr, "png_do_quantize returned rowbytes=0"); + dg_png_error(png_ptr, "png_do_quantize returned rowbytes=0"); } #endif /* PNG_READ_QUANTIZE_SUPPORTED */ diff --git a/plugingui/png/pngrutil.c b/plugingui/png/pngrutil.c index 4ef05fe..bc79d5c 100644 --- a/plugingui/png/pngrutil.c +++ b/plugingui/png/pngrutil.c @@ -26,7 +26,7 @@ png_get_uint_31(png_structp png_ptr, png_const_bytep buf) png_uint_32 uval = png_get_uint_32(buf); if (uval > PNG_UINT_31_MAX) - png_error(png_ptr, "PNG unsigned integer out of range"); + dg_png_error(png_ptr, "PNG unsigned integer out of range"); return (uval); } @@ -133,13 +133,13 @@ png_read_sig(png_structp png_ptr, png_infop info_ptr) png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check); png_ptr->sig_bytes = 8; - if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) + if (dg_png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) { if (num_checked < 4 && - png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) - png_error(png_ptr, "Not a PNG file"); + dg_png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) + dg_png_error(png_ptr, "Not a PNG file"); else - png_error(png_ptr, "PNG file corrupted by ASCII conversion"); + dg_png_error(png_ptr, "PNG file corrupted by ASCII conversion"); } if (num_checked < 3) png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE; @@ -528,11 +528,11 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_IHDR"); if (png_ptr->mode & PNG_HAVE_IHDR) - png_error(png_ptr, "Out of place IHDR"); + dg_png_error(png_ptr, "Out of place IHDR"); /* Check the length */ if (length != 13) - png_error(png_ptr, "Invalid IHDR chunk"); + dg_png_error(png_ptr, "Invalid IHDR chunk"); png_ptr->mode |= PNG_HAVE_IHDR; @@ -604,7 +604,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_PLTE"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before PLTE"); + dg_png_error(png_ptr, "Missing IHDR before PLTE"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -614,7 +614,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) } else if (png_ptr->mode & PNG_HAVE_PLTE) - png_error(png_ptr, "Duplicate PLTE chunk"); + dg_png_error(png_ptr, "Duplicate PLTE chunk"); png_ptr->mode |= PNG_HAVE_PLTE; @@ -645,7 +645,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) else { - png_error(png_ptr, "Invalid palette chunk"); + dg_png_error(png_ptr, "Invalid palette chunk"); } } @@ -747,7 +747,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) if (!(png_ptr->mode & PNG_HAVE_IHDR) || !(png_ptr->mode & PNG_HAVE_IDAT)) { - png_error(png_ptr, "No image in file"); + dg_png_error(png_ptr, "No image in file"); } png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND); @@ -772,7 +772,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_gAMA"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before gAMA"); + dg_png_error(png_ptr, "Missing IHDR before gAMA"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -854,7 +854,7 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) buf[0] = buf[1] = buf[2] = buf[3] = 0; if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before sBIT"); + dg_png_error(png_ptr, "Missing IHDR before sBIT"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -926,7 +926,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_cHRM"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before cHRM"); + dg_png_error(png_ptr, "Missing IHDR before cHRM"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1077,7 +1077,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) /* Check for an internal error. */ if (r+g+b != 32768) - png_error(png_ptr, + dg_png_error(png_ptr, "internal error handling cHRM coefficients"); png_ptr->rgb_to_gray_red_coeff = (png_uint_16)r; @@ -1089,7 +1089,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) * bug is fixed. */ else - png_error(png_ptr, "internal error handling cHRM->XYZ"); + dg_png_error(png_ptr, "internal error handling cHRM->XYZ"); } } } @@ -1110,7 +1110,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_sRGB"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before sRGB"); + dg_png_error(png_ptr, "Missing IHDR before sRGB"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1244,7 +1244,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_iCCP"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before iCCP"); + dg_png_error(png_ptr, "Missing IHDR before iCCP"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1403,7 +1403,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #endif if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before sPLT"); + dg_png_error(png_ptr, "Missing IHDR before sPLT"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1562,7 +1562,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_tRNS"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before tRNS"); + dg_png_error(png_ptr, "Missing IHDR before tRNS"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1668,7 +1668,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_bKGD"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before bKGD"); + dg_png_error(png_ptr, "Missing IHDR before bKGD"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1773,7 +1773,7 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_hIST"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before hIST"); + dg_png_error(png_ptr, "Missing IHDR before hIST"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1832,7 +1832,7 @@ png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_pHYs"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before pHYs"); + dg_png_error(png_ptr, "Missing IHDR before pHYs"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1878,7 +1878,7 @@ png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_oFFs"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before oFFs"); + dg_png_error(png_ptr, "Missing IHDR before oFFs"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1928,7 +1928,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_pCAL"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before pCAL"); + dg_png_error(png_ptr, "Missing IHDR before pCAL"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -2068,7 +2068,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_sCAL"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before sCAL"); + dg_png_error(png_ptr, "Missing IHDR before sCAL"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -2172,7 +2172,7 @@ png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_debug(1, "in png_handle_tIME"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Out of place tIME chunk"); + dg_png_error(png_ptr, "Out of place tIME chunk"); else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)) { @@ -2240,7 +2240,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #endif if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before tEXt"); + dg_png_error(png_ptr, "Missing IHDR before tEXt"); if (png_ptr->mode & PNG_HAVE_IDAT) png_ptr->mode |= PNG_AFTER_IDAT; @@ -2346,7 +2346,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #endif if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before zTXt"); + dg_png_error(png_ptr, "Missing IHDR before zTXt"); if (png_ptr->mode & PNG_HAVE_IDAT) png_ptr->mode |= PNG_AFTER_IDAT; @@ -2440,7 +2440,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_ptr->chunkdata = NULL; if (ret) - png_error(png_ptr, "Insufficient memory to store zTXt chunk"); + dg_png_error(png_ptr, "Insufficient memory to store zTXt chunk"); } #endif @@ -2477,7 +2477,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #endif if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before iTXt"); + dg_png_error(png_ptr, "Missing IHDR before iTXt"); if (png_ptr->mode & PNG_HAVE_IDAT) png_ptr->mode |= PNG_AFTER_IDAT; @@ -2610,7 +2610,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_ptr->chunkdata = NULL; if (ret) - png_error(png_ptr, "Insufficient memory to store iTXt chunk"); + dg_png_error(png_ptr, "Insufficient memory to store iTXt chunk"); } #endif @@ -2798,7 +2798,7 @@ png_combine_row(png_structp png_ptr, png_bytep dp, int display) * least one row has been read from the PNG data and transformed. */ if (pixel_depth == 0) - png_error(png_ptr, "internal row logic error"); + dg_png_error(png_ptr, "internal row logic error"); /* Added in 1.5.4: the pixel depth should match the information returned by * any call to png_read_update_info at this point. Do not continue if we got @@ -2806,11 +2806,11 @@ png_combine_row(png_structp png_ptr, png_bytep dp, int display) */ if (png_ptr->info_rowbytes != 0 && png_ptr->info_rowbytes != PNG_ROWBYTES(pixel_depth, row_width)) - png_error(png_ptr, "internal row size calculation error"); + dg_png_error(png_ptr, "internal row size calculation error"); /* Don't expect this to ever happen: */ if (row_width == 0) - png_error(png_ptr, "internal row width error"); + dg_png_error(png_ptr, "internal row width error"); /* Preserve the last byte in cases where only part of it will be overwritten, * the multiply below may overflow, we don't care because ANSI-C guarantees @@ -3031,7 +3031,7 @@ png_combine_row(png_structp png_ptr, png_bytep dp, int display) /* Validate the depth - it must be a multiple of 8 */ if (pixel_depth & 7) - png_error(png_ptr, "invalid user transform pixel depth"); + dg_png_error(png_ptr, "invalid user transform pixel depth"); pixel_depth >>= 3; /* now in bytes */ row_width *= pixel_depth; @@ -3832,7 +3832,7 @@ png_read_finish_row(png_structp png_ptr) png_crc_finish(png_ptr, 0); png_ptr->idat_size = png_read_chunk_header(png_ptr); if (png_ptr->chunk_name != png_IDAT) - png_error(png_ptr, "Not enough image data"); + dg_png_error(png_ptr, "Not enough image data"); } png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; @@ -3859,7 +3859,7 @@ png_read_finish_row(png_structp png_ptr) } if (ret != Z_OK) - png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : + dg_png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : "Decompression Error"); if (!(png_ptr->zstream.avail_out)) @@ -4093,7 +4093,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) #ifdef PNG_MAX_MALLOC_64K if (row_bytes > (png_uint_32)65536L) - png_error(png_ptr, "This image requires a row greater than 64KB"); + dg_png_error(png_ptr, "This image requires a row greater than 64KB"); #endif if (row_bytes + 48 > png_ptr->old_big_row_buf_size) @@ -4138,11 +4138,11 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) #ifdef PNG_MAX_MALLOC_64K if (png_ptr->rowbytes > 65535) - png_error(png_ptr, "This image requires a row greater than 64KB"); + dg_png_error(png_ptr, "This image requires a row greater than 64KB"); #endif if (png_ptr->rowbytes > (PNG_SIZE_MAX - 1)) - png_error(png_ptr, "Row has too many bytes to allocate in memory"); + dg_png_error(png_ptr, "Row has too many bytes to allocate in memory"); png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1); diff --git a/plugingui/png/pngset.c b/plugingui/png/pngset.c index 8c07eec..6395471 100644 --- a/plugingui/png/pngset.c +++ b/plugingui/png/pngset.c @@ -91,7 +91,7 @@ png_set_cHRM_XYZ_fixed(png_structp png_ptr, png_infop info_ptr, XYZ.blueZ = int_blue_Z; if (png_xy_from_XYZ(&xy, XYZ)) - png_error(png_ptr, "XYZ values out of representable range"); + dg_png_error(png_ptr, "XYZ values out of representable range"); png_set_cHRM_fixed(png_ptr, info_ptr, xy.whitex, xy.whitey, xy.redx, xy.redy, xy.greenx, xy.greeny, xy.bluex, xy.bluey); @@ -303,12 +303,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, /* Check that the type matches the specification. */ if (type < 0 || type > 3) - png_error(png_ptr, "Invalid pCAL equation type"); + dg_png_error(png_ptr, "Invalid pCAL equation type"); /* Validate params[nparams] */ for (i=0; ipcal_purpose = (png_charp)png_malloc_warn(png_ptr, length); @@ -389,15 +389,15 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, * unit unless this is an API call.) */ if (unit != 1 && unit != 2) - png_error(png_ptr, "Invalid sCAL unit"); + dg_png_error(png_ptr, "Invalid sCAL unit"); if (swidth == NULL || (lengthw = png_strlen(swidth)) == 0 || swidth[0] == 45 /* '-' */ || !png_check_fp_string(swidth, lengthw)) - png_error(png_ptr, "Invalid sCAL width"); + dg_png_error(png_ptr, "Invalid sCAL width"); if (sheight == NULL || (lengthh = png_strlen(sheight)) == 0 || sheight[0] == 45 /* '-' */ || !png_check_fp_string(sheight, lengthh)) - png_error(png_ptr, "Invalid sCAL height"); + dg_png_error(png_ptr, "Invalid sCAL height"); info_ptr->scal_unit = (png_byte)unit; @@ -525,7 +525,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr, if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH) { if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - png_error(png_ptr, "Invalid palette length"); + dg_png_error(png_ptr, "Invalid palette length"); else { @@ -672,7 +672,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_const_textp text_ptr, ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text); if (ret) - png_error(png_ptr, "Insufficient memory to store text"); + dg_png_error(png_ptr, "Insufficient memory to store text"); } int /* PRIVATE */ diff --git a/plugingui/png/pngtrans.c b/plugingui/png/pngtrans.c index ee60957..087d4bc 100644 --- a/plugingui/png/pngtrans.c +++ b/plugingui/png/pngtrans.c @@ -94,7 +94,7 @@ png_set_shift(png_structp png_ptr, png_const_color_8p true_bits) #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ defined(PNG_WRITE_INTERLACING_SUPPORTED) int PNGAPI -png_set_interlace_handling(png_structp png_ptr) +dg_png_set_interlace_handling(png_structp png_ptr) { png_debug(1, "in png_set_interlace handling"); -- cgit v1.2.3