From b9e5e5f5a831c2fcf3758f93f624c089c655423d Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Fri, 3 Jul 2015 16:07:54 -0500 Subject: [PATCH] [libpng16] Replaced arbitrary use of 'extern' with #define PNG_LINKAGE_*. To preserve API compatibility, the new defines all default to "extern" (requested by Jan Nijtmans). --- ANNOUNCE | 7 +++++-- CHANGES | 5 ++++- pngconf.h | 10 +++++----- pngpriv.h | 7 ++++--- scripts/pnglibconf.dfa | 11 +++++++++++ scripts/pnglibconf.h.prebuilt | 6 +++++- 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 929c285d7..392543587 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.18beta09 - July 1, 2015 +Libpng 1.6.18beta09 - July 3, 2015 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -95,9 +95,12 @@ Version 1.6.18beta08 [June 30, 2015] be used. Removed some unused WEIGHTED_FILTER macros from png.h and pngstruct.h -Version 1.6.18beta09 [July 1, 2015] +Version 1.6.18beta09 [July 3, 2015] Removed some useless typecasts from contrib/tools/png-fix-itxt.c Fixed a new signed-unsigned comparison in pngrtran.c (Max Stepin). + Replaced arbitrary use of 'extern' with #define PNG_LINKAGE_*. To + preserve API compatibility, the new defines all default to "extern" + (requested by Jan Nijtmans). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index f1ae6243e..afda0ed15 100644 --- a/CHANGES +++ b/CHANGES @@ -5280,9 +5280,12 @@ Version 1.6.18beta08 [June 30, 2015] be used. Removed some unused WEIGHTED_FILTER macros from png.h and pngstruct.h -Version 1.6.18beta09 [July 1, 2015] +Version 1.6.18beta09 [July 3, 2015] Removed some useless typecasts from contrib/tools/png-fix-itxt.c Fixed a new signed-unsigned comparison in pngrtran.c (Max Stepin). + Replaced arbitrary use of 'extern' with #define PNG_LINKAGE_*. To + preserve API compatibility, the new defines all default to "extern" + (requested by Jan Nijtmans). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngconf.h b/pngconf.h index 6ebc81035..bc7e07847 100644 --- a/pngconf.h +++ b/pngconf.h @@ -295,11 +295,11 @@ * table entries, so we discard it here. See the .dfn files in the * scripts directory. */ -#ifndef PNG_EXPORTA -# define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \ - extern attributes) +#ifndef PNG_EXPORTA +# define PNG_EXPORTA(ordinal, type, name, args, attributes) \ + PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \ + PNG_LINKAGE_API attributes) #endif /* ANSI-C (C90) does not permit a macro to be invoked with an empty argument, @@ -307,7 +307,7 @@ */ #define PNG_EMPTY /*empty list*/ -#define PNG_EXPORT(ordinal, type, name, args)\ +#define PNG_EXPORT(ordinal, type, name, args) \ PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY) /* Use PNG_REMOVED to comment out a removed interface. */ diff --git a/pngpriv.h b/pngpriv.h index d9bb34061..cefb6267b 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -252,17 +252,18 @@ * always be used to declare an extern data or function object in this file. */ #ifndef PNG_INTERNAL_DATA -# define PNG_INTERNAL_DATA(type, name, array) extern type name array +# define PNG_INTERNAL_DATA(type, name, array) PNG_LINKAGE_DATA type name array #endif #ifndef PNG_INTERNAL_FUNCTION # define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\ - extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes) + PNG_LINKAGE_FUNCTION PNG_FUNCTION(type, name, args, PNG_EMPTY attributes) #endif #ifndef PNG_INTERNAL_CALLBACK # define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\ - extern PNG_FUNCTION(type, (PNGCBAPI name), args, PNG_EMPTY attributes) + PNG_LINKAGE_CALLBACK PNG_FUNCTION(type, (PNGCBAPI name), args,\ + PNG_EMPTY attributes) #endif /* If floating or fixed point APIs are disabled they may still be compiled diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index 47701dd95..07293ae64 100644 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -249,6 +249,17 @@ setting Z_DEFAULT_STRATEGY default @Z_FILTERED setting Z_DEFAULT_NOFILTER_STRATEGY default @Z_DEFAULT_STRATEGY setting ZLIB_VERNUM default @ZLIB_VERNUM +# Linkage of: +# +# API: libpng API functions +# CALLBACK: internal non-file-local callbacks +# FUNCTION: internal non-file-local functions +# DATA: internal non-file-local (const) data +setting LINKAGE_API default extern +setting LINKAGE_CALLBACK default extern +setting LINKAGE_FUNCTION default extern +setting LINKAGE_DATA default extern + setting TEXT_Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION setting TEXT_Z_DEFAULT_STRATEGY default @Z_DEFAULT_STRATEGY diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt index 3f4ab251d..db60d2a1f 100644 --- a/scripts/pnglibconf.h.prebuilt +++ b/scripts/pnglibconf.h.prebuilt @@ -2,7 +2,7 @@ /* pnglibconf.h - library build configuration */ -/* Libpng version 1.6.18beta09 - June 30, 2015 */ +/* Libpng version 1.6.18beta09 - July 3, 2015 */ /* Copyright (c) 1998-2014 Glenn Randers-Pehrson */ @@ -190,6 +190,10 @@ #define PNG_GAMMA_THRESHOLD_FIXED 5000 #define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE #define PNG_INFLATE_BUF_SIZE 1024 +#define PNG_LINKAGE_API extern +#define PNG_LINKAGE_CALLBACK extern +#define PNG_LINKAGE_DATA extern +#define PNG_LINKAGE_FUNCTION extern #define PNG_MAX_GAMMA_8 11 #define PNG_QUANTIZE_BLUE_BITS 5 #define PNG_QUANTIZE_GREEN_BITS 5