From 7e77e0c4293af4f2be55757f84664f51dc14f02f Mon Sep 17 00:00:00 2001 From: james Date: Sat, 16 Feb 2019 14:20:55 -0800 Subject: [PATCH 1/4] Support libpng without the apng patch and fix mingw (?) compiler errors --- src/apng.c | 23 +++++++++++++++++++++-- src/apng.h | 16 ++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/apng.c b/src/apng.c index 2109c0a0..da8140e0 100644 --- a/src/apng.c +++ b/src/apng.c @@ -25,6 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "apng.h" +#define APNG_INFO_acTL 0x20000U + #define APNG_WROTE_acTL 0x10000U struct apng_info_def @@ -59,6 +61,10 @@ size_t apng_default_tell (png_structp); #endif/* PNG_STDIO_SUPPORTED */ void apng_write_IEND (png_structp); void apng_write_acTL (png_structp, png_uint_32, png_uint_32); +#ifndef PNG_WRITE_APNG_SUPPORTED +void apng_set_acTL_dummy (png_structp, png_infop, apng_infop, + png_uint_32, png_uint_32); +#endif/* PNG_WRITE_APNG_SUPPORTED */ apng_infop apng_create_info_struct (png_structp pngp) @@ -204,7 +210,7 @@ apng_set_acTL (png_structp pngp, png_infop infop, apng_infop ainfop, ainfop->num_frames = frames; ainfop->num_plays = plays; - ainfop->valid |= PNG_INFO_acTL; + ainfop->valid |= APNG_INFO_acTL; return 1; } @@ -218,7 +224,7 @@ apng_write_info_before_PLTE (png_structp pngp, png_infop infop, png_write_info_before_PLTE(pngp, infop); - if (( ainfop->valid & PNG_INFO_acTL ) &&!( ainfop->mode & APNG_WROTE_acTL )) + if (( ainfop->valid & APNG_INFO_acTL )&&!( ainfop->mode & APNG_WROTE_acTL )) { ainfop->start_acTL = apng_tell(pngp, ainfop); @@ -253,6 +259,19 @@ apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop) #endif/* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED */ } +#ifndef PNG_WRITE_APNG_SUPPORTED +void +apng_set_acTL_dummy (png_structp pngp, png_infop infop, apng_infop ainfop, + png_uint_32 frames, png_uint_32 plays) +{ + (void)pngp; + (void)infop; + (void)ainfop; + (void)frames; + (void)plays; +} +#endif/* PNG_WRITE_APNG_SUPPORTED */ + /* Dynamic runtime linking capable! (Hopefully.) */ void apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, diff --git a/src/apng.h b/src/apng.h index eefd6aaa..aa7fac3d 100644 --- a/src/apng.h +++ b/src/apng.h @@ -23,6 +23,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef APNG_H #define APNG_H +#ifndef _MSC_VER +#ifndef _WII +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif +#endif +#endif + +#ifndef _LFS64_LARGEFILE +#define _LFS64_LARGEFILE +#endif + +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 0 +#endif + #include typedef struct apng_info_def apng_info; From 9d85c2e064c354d01819921f0d553c818eb86b52 Mon Sep 17 00:00:00 2001 From: james Date: Sat, 16 Feb 2019 14:39:33 -0800 Subject: [PATCH 2/4] Actually support no apng patch --- src/apng.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/apng.c b/src/apng.c index da8140e0..89cd300a 100644 --- a/src/apng.c +++ b/src/apng.c @@ -279,7 +279,11 @@ apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, { (void)pngp; if (!ainfop->set_acTL_fn) +#ifndef PNG_WRITE_APNG_SUPPORTED + ainfop->set_acTL_fn = &apng_set_acTL_dummy; +#else ainfop->set_acTL_fn = &png_set_acTL; +#endif/* PNG_WRITE_APNG_SUPPORTED */ else ainfop->set_acTL_fn = set_acTL_f; } From 46edc1e33013e641c015d5eb9781800fba4cc48a Mon Sep 17 00:00:00 2001 From: james Date: Sun, 17 Feb 2019 15:50:42 -0800 Subject: [PATCH 3/4] Create the correct dummy function --- src/apng.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apng.c b/src/apng.c index 89cd300a..bcfccd33 100644 --- a/src/apng.c +++ b/src/apng.c @@ -62,7 +62,7 @@ size_t apng_default_tell (png_structp); void apng_write_IEND (png_structp); void apng_write_acTL (png_structp, png_uint_32, png_uint_32); #ifndef PNG_WRITE_APNG_SUPPORTED -void apng_set_acTL_dummy (png_structp, png_infop, apng_infop, +png_uint_32 apng_set_acTL_dummy (png_structp, png_infop, png_uint_32, png_uint_32); #endif/* PNG_WRITE_APNG_SUPPORTED */ @@ -260,15 +260,15 @@ apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop) } #ifndef PNG_WRITE_APNG_SUPPORTED -void -apng_set_acTL_dummy (png_structp pngp, png_infop infop, apng_infop ainfop, +png_uint_32 +apng_set_acTL_dummy (png_structp pngp, png_infop infop, png_uint_32 frames, png_uint_32 plays) { (void)pngp; (void)infop; - (void)ainfop; (void)frames; (void)plays; + return 0; } #endif/* PNG_WRITE_APNG_SUPPORTED */ From c74b05eadc81d9a96fc5b96fbe4a560366aafe89 Mon Sep 17 00:00:00 2001 From: james Date: Sun, 17 Feb 2019 23:09:52 -0800 Subject: [PATCH 4/4] Remove extra whitespace --- src/apng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apng.c b/src/apng.c index bcfccd33..694b3d1e 100644 --- a/src/apng.c +++ b/src/apng.c @@ -151,7 +151,7 @@ apng_default_tell (png_structp pngp) void apng_set_write_fn (png_structp pngp, apng_infop ainfop, png_voidp iop, - png_rw_ptr write_f, png_flush_ptr flush_f, + png_rw_ptr write_f, png_flush_ptr flush_f, apng_seek_ptr seek_f, apng_tell_ptr tell_f) { if (!( pngp && ainfop ))