diff --git a/src/apng.c b/src/apng.c index 2109c0a0..694b3d1e 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 +png_uint_32 apng_set_acTL_dummy (png_structp, png_infop, + png_uint_32, png_uint_32); +#endif/* PNG_WRITE_APNG_SUPPORTED */ apng_infop apng_create_info_struct (png_structp pngp) @@ -145,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 )) @@ -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 +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)frames; + (void)plays; + return 0; +} +#endif/* PNG_WRITE_APNG_SUPPORTED */ + /* Dynamic runtime linking capable! (Hopefully.) */ void apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, @@ -260,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; } 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;