From 42af35fd2bcf00e983772dbb6e409f8ba5f49fc6 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 28 Jan 2017 07:09:27 -0500 Subject: [PATCH] Change to more intuitive names LibraryVersion and HeaderVersion (Issue 371) --- cryptlib.cpp | 2 +- cryptlib.h | 50 +++++++++++++++++++++++++------------------------- validat1.cpp | 8 ++++---- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/cryptlib.cpp b/cryptlib.cpp index cdb8fdcc..da639eed 100644 --- a/cryptlib.cpp +++ b/cryptlib.cpp @@ -950,7 +950,7 @@ void AuthenticatedKeyAgreementDomain::GenerateEphemeralKeyPair(RandomNumberGener #ifndef CRYPTOPP_BUILD_VERSION # define CRYPTOPP_BUILD_VERSION CRYPTOPP_VERSION #endif -int BuildVersion() +int LibraryVersion() { return CRYPTOPP_BUILD_VERSION; } diff --git a/cryptlib.h b/cryptlib.h index dcb3ac3a..87698bb4 100644 --- a/cryptlib.h +++ b/cryptlib.h @@ -2916,69 +2916,69 @@ public: //! \brief Specifies the build-time version of the library //! \returns integer representing the build-time version -//! \details BuildVersion can help detect inadvertent mixing and matching of library -//! versions. When using Crypto++ distributed by a third party, BuildVersion() +//! \details LibraryVersion can help detect inadvertent mixing and matching of library +//! versions. When using Crypto++ distributed by a third party, LibraryVersion() //! records the version of the shared object that was built by the third party. -//! The BuildVersion() record resides in cryptlib.o on Unix compatibles +//! The LibraryVersion() record resides in cryptlib.o on Unix compatibles //! and cryptlib.obj on Windows. It does not change when an app links //! to the library. -//! \details BuildVersion() is declared with C linkage (extern "C") within the +//! \details LibraryVersion() is declared with C linkage (extern "C") within the //! CryptoPP namespace to help programs locate the symbol. If the symbol is present, then //! the library version is 5.7 or above. If it is missing, then the library version is //! 5.6.5 or below. //! \details The function could be used as shown below. //!
-//!     if (BuildVersion() != RuntimeVersion())
+//!     if (LibraryVersion() != HeaderVersion())
 //!     {
 //!         cout << "Potential version mismatch" << endl;
 //!
-//!         const int bmaj = (BuildVersion() / 100U) % 10;
-//!         const int bmin = (BuildVersion() / 10U) % 10;
-//!         const int rmaj = (RuntimeVersion() / 100U) % 10;
-//!         const int rmin = (RuntimeVersion() / 10U) % 10;
+//!         const int lmaj = (LibraryVersion() / 100U) % 10;
+//!         const int lmin = (LibraryVersion() / 10U) % 10;
+//!         const int hmaj = (HeaderVersion() / 100U) % 10;
+//!         const int hmin = (HeaderVersion() / 10U) % 10;
 //!
-//!         if(bmaj != rmaj)
+//!         if(lmaj != hmaj)
 //!             cout << "Major version mismatch" << endl;
-//!         else if(bmin != rmin)
+//!         else if(lmin != hmin)
 //!             cout << "Minor version mismatch" << endl;
 //!      }
 //! 
-//! \sa RuntimeVersion(), GitHub Issue 371. +//! \sa HeaderVersion(), GitHub Issue 371. //! \since Crypto++ 5.7 extern "C" { - int BuildVersion(); + int LibraryVersion(); } // C linkage //! \brief Specifies the runtime version of the library //! \returns integer representing the runtime version -//! \details RuntimeVersion() can help detect inadvertent mixing and matching of library -//! versions. When using Crypto++ distributed by a third party, RuntimeVersion() +//! \details HeaderVersion() can help detect inadvertent mixing and matching of library +//! versions. When using Crypto++ distributed by a third party, HeaderVersion() //! records the version of the headers used by the app when the app is compiled. -//! \details RuntimeVersion() is declared with C linkage (extern "C") within the +//! \details HeaderVersion() is declared with C linkage (extern "C") within the //! CryptoPP namespace to help programs locate the symbol. If the symbol is present, then //! the library version is 5.7 or above. If it is missing, then the library version is //! 5.6.5 or below. //! \details The function could be used as shown below. //!
-//!     if (BuildVersion() != RuntimeVersion())
+//!     if (LibraryVersion() != HeaderVersion())
 //!     {
 //!         cout << "Potential version mismatch" << endl;
 //!
-//!         const int bmaj = (BuildVersion() / 100U) % 10;
-//!         const int bmin = (BuildVersion() / 10U) % 10;
-//!         const int rmaj = (RuntimeVersion() / 100U) % 10;
-//!         const int rmin = (RuntimeVersion() / 10U) % 10;
+//!         const int lmaj = (LibraryVersion() / 100U) % 10;
+//!         const int lmin = (LibraryVersion() / 10U) % 10;
+//!         const int hmaj = (HeaderVersion() / 100U) % 10;
+//!         const int hmin = (HeaderVersion() / 10U) % 10;
 //!
-//!         if(bmaj != rmaj)
+//!         if(lmaj != hmaj)
 //!             cout << "Major version mismatch" << endl;
-//!         else if(bmin != rmin)
+//!         else if(lmin != hmin)
 //!             cout << "Minor version mismatch" << endl;
 //!      }
 //! 
-//! \sa BuildVersion(), GitHub Issue 371. +//! \sa LibraryVersion(), GitHub Issue 371. //! \since Crypto++ 5.7 extern "C" { -inline int RuntimeVersion() +inline int HeaderVersion() { return CRYPTOPP_VERSION; } diff --git a/validat1.cpp b/validat1.cpp index 91259ae7..724c5df9 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -226,16 +226,16 @@ bool TestSettings() } // App and library versions, http://github.com/weidai11/cryptopp/issues/371 - const int bver = BuildVersion(); - const int rver = RuntimeVersion(); - if(bver/10 == rver/10) + const int v1 = LibraryVersion(); + const int v2 = HeaderVersion(); + if(v1/10 == v2/10) cout << "passed: "; else { cout << "FAILED: "; pass = false; } - cout << "Build version (library): " << bver << ", runtime version (app): " << rver << "\n"; + cout << "Library version (library): " << v1 << ", header version (app): " << v2 << "\n"; #ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS // Don't assert the alignment of testvals. That's what this test is for.