From: Vadim Zeitlin Date: Fri, 30 Mar 2012 12:16:58 +0000 (+0000) Subject: Return run-time zlib version from wxGetZlibVersionInfo(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d02a916ba156ab1ba9839a9e13662b2a28bc0e54 Return run-time zlib version from wxGetZlibVersionInfo(). Return the version really used instead of the version the code was compiled against. Incidentally, this avoids the use of ZLIB_VERNUM not available in old (1.1) versions of zlib, thus fixing compilation under Solaris 10. Closes #14158. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71056 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index 031dbb29e8..ce63c07dc9 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -47,10 +47,18 @@ enum { wxVersionInfo wxGetZlibVersionInfo() { - return wxVersionInfo("zlib", - ZLIB_VERNUM >> 12, - (ZLIB_VERNUM >> 8) & 0x0F, - (ZLIB_VERNUM & 0xFF) / 0x10); + int major, + minor, + build; + + if ( sscanf(zlibVersion(), "%d.%d.%d", &major, &minor, &build) != 3 ) + { + major = + minor = + build = 0; + } + + return wxVersionInfo("zlib", major, minor, build); } /////////////////////////////////////////////////////////////////////////////