[devel] Fix gcc -pendantic warnings, handle Cygwin longjmp fix png_read_png
This commit is contained in:
parent
6a6d79fc00
commit
9c69360e97
38
png.h
38
png.h
@ -797,35 +797,33 @@ typedef struct png_struct_def png_struct;
|
||||
typedef PNG_CONST png_struct FAR * png_const_structp;
|
||||
typedef png_struct FAR * png_structp;
|
||||
|
||||
typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp), );
|
||||
typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t), );
|
||||
typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp), );
|
||||
typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32,
|
||||
int), );
|
||||
typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32,
|
||||
int), );
|
||||
typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp));
|
||||
typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t));
|
||||
typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp));
|
||||
typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32,
|
||||
int));
|
||||
typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32,
|
||||
int));
|
||||
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
typedef PNG_CALLBACK(void, *png_progressive_info_ptr,
|
||||
(png_structp, png_infop), );
|
||||
typedef PNG_CALLBACK(void, *png_progressive_end_ptr,
|
||||
(png_structp, png_infop), );
|
||||
typedef PNG_CALLBACK(void, *png_progressive_row_ptr,
|
||||
(png_structp, png_bytep, png_uint_32, int), );
|
||||
typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
|
||||
typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
|
||||
typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep,
|
||||
png_uint_32, int));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
typedef PNG_CALLBACK(void, *png_user_transform_ptr,
|
||||
(png_structp, png_row_infop, png_bytep), );
|
||||
typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop,
|
||||
png_bytep));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
||||
typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp,
|
||||
png_unknown_chunkp), );
|
||||
typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp,
|
||||
png_unknown_chunkp));
|
||||
#endif
|
||||
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp), );
|
||||
typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
@ -882,8 +880,8 @@ typedef PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)),
|
||||
* following.
|
||||
*/
|
||||
typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp,
|
||||
png_alloc_size_t), );
|
||||
typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp), );
|
||||
png_alloc_size_t));
|
||||
typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
|
59
pngconf.h
59
pngconf.h
@ -282,23 +282,15 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* THe following complexity is concerned with getting the 'attributes' of the
|
||||
* declared function in the correct place. This potentially requires a separate
|
||||
* PNG_EXPORT function for every compiler.
|
||||
/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat
|
||||
* 'attributes' as a storage class - the attributes go at the start of the
|
||||
* function definition, and attributes are always appended regardless of the
|
||||
* compiler. This considerably simplifies these macros but may cause problems
|
||||
* if any compilers both need function attributes and fail to handle them as
|
||||
* a storage class (this is unlikely.)
|
||||
*/
|
||||
#ifndef PNG_FUNCTION
|
||||
# if defined(__GNUC__)
|
||||
# define PNG_FUNCTION(type, name, args, attributes)\
|
||||
attributes type name args
|
||||
# else /* !GNUC */
|
||||
# ifdef _MSC_VER
|
||||
# define PNG_FUNCTION(type, name, args, attributes)\
|
||||
attributes type name args
|
||||
# else /* !MSC */
|
||||
# define PNG_FUNCTION(type, name, args, attributes)\
|
||||
type name args
|
||||
# endif
|
||||
# endif
|
||||
# define PNG_FUNCTION(type, name, args, attributes) attributes type name args
|
||||
#endif
|
||||
|
||||
#ifndef PNG_EXPORT_TYPE
|
||||
@ -311,12 +303,17 @@
|
||||
*/
|
||||
#ifndef PNG_EXPORTA
|
||||
# define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
||||
extern PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args),\
|
||||
PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), extern\
|
||||
attributes)
|
||||
#endif
|
||||
|
||||
/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
|
||||
* so make something non-empty to satisfy the requirement:
|
||||
*/
|
||||
#define PNG_EMPTY /*empty list*/
|
||||
|
||||
#define PNG_EXPORT(ordinal, type, name, args)\
|
||||
PNG_EXPORTA(ordinal, type, name, args, )
|
||||
PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
|
||||
|
||||
/* Use PNG_REMOVED to comment out a removed interface. */
|
||||
#ifndef PNG_REMOVED
|
||||
@ -324,8 +321,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef PNG_CALLBACK
|
||||
# define PNG_CALLBACK(type, name, args, attributes)\
|
||||
type (PNGCBAPI name) PNGARG(args) attributes
|
||||
# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
|
||||
#endif
|
||||
|
||||
/* Support for compiler specific function attributes. These are used
|
||||
@ -355,7 +351,21 @@
|
||||
# define PNG_NORETURN __attribute__((__noreturn__))
|
||||
# endif
|
||||
# ifndef PNG_PTR_NORETURN
|
||||
# define PNG_PTR_NORETURN __attribute__((__noreturn__))
|
||||
/* It's not enough to have the compiler be the correct compiler at
|
||||
* this point - it's necessary for the library (which defines
|
||||
* the type of the library longjmp) to also be the GNU library.
|
||||
* This is because many systems use the GNU compiler with a
|
||||
* non-GNU libc implementation. Min/GW headers are also compatible
|
||||
* with GCC as well as uclibc, so it seems best to exclude known
|
||||
* problem libcs here rather than just including known libcs.
|
||||
*
|
||||
* NOTE: this relies on the only use of PNG_PTR_NORETURN being with
|
||||
* the system longjmp. If the same type is used elsewhere then this
|
||||
* will need to be changed.
|
||||
*/
|
||||
# if !defined(__CYGWIN__)
|
||||
# define PNG_PTR_NORETURN __attribute__((__noreturn__))
|
||||
# endif
|
||||
# endif
|
||||
# ifndef PNG_ALLOCATED
|
||||
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||
@ -380,7 +390,7 @@
|
||||
# define PNG_PRIVATE \
|
||||
__attribute__((__deprecated__))
|
||||
# endif
|
||||
# endif /* PNG_PRIVATE */
|
||||
# endif
|
||||
# endif /* PNGLIB_BUILD */
|
||||
# endif /* __GNUC__ */
|
||||
# ifdef _MSC_VER /* may need to check value */
|
||||
@ -410,9 +420,9 @@
|
||||
# endif
|
||||
# ifndef PNG_PRIVATE
|
||||
# define PNG_PRIVATE __declspec(deprecated)
|
||||
# endif /* PNG_PRIVATE */
|
||||
# endif
|
||||
# endif /* PNGLIB_BUILD */
|
||||
# endif /* __GNUC__ */
|
||||
# endif /* _MSC_VER */
|
||||
#endif /* PNG_PEDANTIC_WARNINGS */
|
||||
|
||||
#ifndef PNG_DEPRECATED
|
||||
@ -424,6 +434,9 @@
|
||||
#ifndef PNG_NORETURN
|
||||
# define PNG_NORETURN /* This function does not return */
|
||||
#endif
|
||||
#ifndef PNG_PTR_NORETURN
|
||||
# define PNG_PTR_NORETURN /* This function does not return */
|
||||
#endif
|
||||
#ifndef PNG_ALLOCATED
|
||||
# define PNG_ALLOCATED /* The result of the function is new memory */
|
||||
#endif
|
||||
|
@ -979,7 +979,7 @@ store_pool_delete(png_store *ps, store_pool *pool)
|
||||
next->next = NULL;
|
||||
|
||||
fprintf(stderr, "\t%lu bytes @ %p\n",
|
||||
(unsigned long)next->size, next+1);
|
||||
(unsigned long)next->size, (PNG_CONST void*)(next+1));
|
||||
/* The NULL means this will always return, even if the memory is
|
||||
* corrupted.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user