From 682ab78b019a06fca5dc0b3ba53ca126df6ddbd6 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 19 Aug 2017 02:32:44 -0400 Subject: Update documentation --- secblock.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'secblock.h') diff --git a/secblock.h b/secblock.h index 4e17bb7d..f1177196 100644 --- a/secblock.h +++ b/secblock.h @@ -44,7 +44,9 @@ public: //! \brief Returns the maximum number of elements the allocator can provide //! \details ELEMS_MAX is the maximum number of elements the - //! Allocator can provide. + //! Allocator can provide. The value of ELEMS_MAX is + //! SIZE_MAX/sizeof(T). std::numeric_limits was avoided + //! due to lack of constexpr-ness in C++03 and below. //! \note In C++03 and below ELEMS_MAX is a static data member of type //! size_type. In C++11 and above ELEMS_MAX is an enum //! inheriting from size_type. In both cases ELEMS_MAX can be @@ -52,7 +54,9 @@ public: //! limitations of class methods like max_size. //! \sa Issue 346/CVE-2016-9939 //! \since Crypto++ 6.0 -#if defined(CRYPTOPP_CXX11) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) +#if defined(CRYPTOPP_DOXYGEN_PROCESSING) + static const size_type ELEMS_MAX = ...; +#elif defined(CRYPTOPP_CXX11) enum : size_type {ELEMS_MAX = SIZE_MAX/sizeof(T)}; #else static const size_type ELEMS_MAX = SIZE_MAX/sizeof(T); @@ -510,7 +514,9 @@ public: //! \brief Returns the maximum number of elements the block can hold //! \details ELEMS_MAX is the maximum number of elements the - //! SecBlock can hold. + //! SecBlock can hold. The value of ELEMS_MAX is + //! SIZE_MAX/sizeof(T). std::numeric_limits was avoided + //! due to lack of constexpr-ness in C++03 and below. //! \note In C++03 and below ELEMS_MAX is a static data member of type //! size_type. In C++11 and above ELEMS_MAX is an enum //! inheriting from size_type. In both cases ELEMS_MAX can be @@ -518,8 +524,10 @@ public: //! limitations of class methods like max_size. //! \sa Issue 346/CVE-2016-9939 //! \since Crypto++ 6.0 -#if defined(CRYPTOPP_CXX11) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) - enum : size_type { ELEMS_MAX = A::ELEMS_MAX }; +#if defined(CRYPTOPP_DOXYGEN_PROCESSING) + static const size_type ELEMS_MAX = ...; +#elif defined(CRYPTOPP_CXX11) + enum : size_type {ELEMS_MAX = A::ELEMS_MAX}; #else static const size_type ELEMS_MAX = SIZE_MAX/sizeof(T); #endif -- cgit v1.2.1