api: Introduce the PNG_LIBPNG_VER_SHAREDLIB macro; update pngwin.rc

The version macros `PNG_LIBPNG_VER_SONUM` and `PNG_LIBPNG_VER_DLLNUM`
weren't always in sync, but they should be, going forward.

Or, better yet, we should keep them in, deprecated, and introduce
`PNG_LIBPNG_VER_SHAREDLIB` for all shared library builds of all kinds
on all platforms.

It is unknown how many user applications have been using these macros.
We have been using `PNG_LIBPNG_VER_DLLNUM` for pngwin.rc, for example.
Which, by the way, was last updated in 2009.
This commit is contained in:
Cosmin Truta 2024-02-05 21:54:19 +02:00
parent cc8006c48d
commit 920db2ecc0
3 changed files with 11 additions and 12 deletions

9
png.h
View File

@ -255,9 +255,6 @@
* to the info_ptr or png_ptr members through png.h, and the compiled * to the info_ptr or png_ptr members through png.h, and the compiled
* application is loaded with a different version of the library. * application is loaded with a different version of the library.
* *
* DLLNUM will change each time there are forward or backward changes
* in binary compatibility (e.g., when a new feature is added).
*
* See libpng.txt or libpng.3 for more information. The PNG specification * See libpng.txt or libpng.3 for more information. The PNG specification
* is available as a W3C Recommendation and as an ISO/IEC Standard; see * is available as a W3C Recommendation and as an ISO/IEC Standard; see
* <https://www.w3.org/TR/2003/REC-PNG-20031110/> * <https://www.w3.org/TR/2003/REC-PNG-20031110/>
@ -281,8 +278,10 @@
#define PNG_LIBPNG_VER_STRING "1.6.43.git" #define PNG_LIBPNG_VER_STRING "1.6.43.git"
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
#define PNG_LIBPNG_VER_SONUM 16 /* The versions of shared library builds should stay in sync, going forward */
#define PNG_LIBPNG_VER_DLLNUM 16 #define PNG_LIBPNG_VER_SHAREDLIB 16
#define PNG_LIBPNG_VER_SONUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
#define PNG_LIBPNG_VER_DLLNUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1

View File

@ -52,10 +52,10 @@ typedef png_libpng_version_1_6_43_git Your_png_h_is_not_version_1_6_43_git;
#if (PNG_LIBPNG_VER != PNG_LIBPNG_VER_MAJOR * 10000 + \ #if (PNG_LIBPNG_VER != PNG_LIBPNG_VER_MAJOR * 10000 + \
PNG_LIBPNG_VER_MINOR * 100 + \ PNG_LIBPNG_VER_MINOR * 100 + \
PNG_LIBPNG_VER_RELEASE) || \ PNG_LIBPNG_VER_RELEASE) || \
(PNG_LIBPNG_VER_SONUM != PNG_LIBPNG_VER_MAJOR * 10 + \ (PNG_LIBPNG_VER_SHAREDLIB != PNG_LIBPNG_VER_MAJOR * 10 + \
PNG_LIBPNG_VER_MINOR) || \ PNG_LIBPNG_VER_MINOR) || \
(PNG_LIBPNG_VER_DLLNUM != PNG_LIBPNG_VER_MAJOR * 10 + \ (PNG_LIBPNG_VER_SHAREDLIB != PNG_LIBPNG_VER_SONUM) || \
PNG_LIBPNG_VER_MINOR) (PNG_LIBPNG_VER_SHAREDLIB != PNG_LIBPNG_VER_DLLNUM)
# error "Inconsistent version numbers in png.h" # error "Inconsistent version numbers in png.h"
#endif #endif

View File

@ -89,12 +89,12 @@ BEGIN
#endif /* PNG_USER_VERSIONINFO_COMPANYNAME */ #endif /* PNG_USER_VERSIONINFO_COMPANYNAME */
VALUE "FileDescription", "PNG image compression library\000" VALUE "FileDescription", "PNG image compression library\000"
VALUE "FileVersion", PNG_LIBPNG_VER_STRING "\000" VALUE "FileVersion", PNG_LIBPNG_VER_STRING "\000"
VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_DLLNUM) PNG_LIBPNG_DLLFNAME_POSTFIX " (Windows 32 bit)\000" VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_SHAREDLIB) PNG_LIBPNG_DLLFNAME_POSTFIX " (Windows)\000"
VALUE "LegalCopyright", "\251 1998-2009 Glenn Randers-Pehrson et al.\000" VALUE "LegalCopyright", "\251 1998-2024 PNG Reference Library Authors\000"
#ifdef PNG_USER_VERSIONINFO_LEGALTRADEMARKS #ifdef PNG_USER_VERSIONINFO_LEGALTRADEMARKS
VALUE "LegalTrademarks", PNG_USER_VERSIONINFO_LEGALTRADEMARKS "\000" VALUE "LegalTrademarks", PNG_USER_VERSIONINFO_LEGALTRADEMARKS "\000"
#endif /* PNG_USER_VERSIONINFO_LEGALTRADEMARKS */ #endif /* PNG_USER_VERSIONINFO_LEGALTRADEMARKS */
VALUE "OriginalFilename", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_DLLNUM) PNG_LIBPNG_DLLFNAME_POSTFIX ".DLL\000" VALUE "OriginalFilename", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_SHAREDLIB) PNG_LIBPNG_DLLFNAME_POSTFIX ".DLL\000"
#ifdef PNG_USER_PRIVATEBUILD #ifdef PNG_USER_PRIVATEBUILD
VALUE "PrivateBuild", PNG_USER_PRIVATEBUILD "\000" VALUE "PrivateBuild", PNG_USER_PRIVATEBUILD "\000"
#endif /* PNG_USER_PRIVATEBUILD */ #endif /* PNG_USER_PRIVATEBUILD */