Update documentation

master
Jeffrey Walton 2019-08-31 07:46:19 -04:00
parent 033f204a86
commit 0c82df181c
1 changed files with 174 additions and 155 deletions

View File

@ -74,7 +74,7 @@ public:
#if defined(__SUNPRO_CC) #if defined(__SUNPRO_CC)
// https://github.com/weidai11/cryptopp/issues/770 // https://github.com/weidai11/cryptopp/issues/770
// and https://stackoverflow.com/q/53999461/608639 // and https://stackoverflow.com/q/53999461/608639
CRYPTOPP_CONSTEXPR size_type max_size(size_type n) const {return (~(size_type)0)/n;} CRYPTOPP_CONSTEXPR size_type max_size(size_type n) const {return SIZE_MAX/n;}
#endif #endif
#if defined(CRYPTOPP_CXX11_VARIADIC_TEMPLATES) || defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_CXX11_VARIADIC_TEMPLATES) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
@ -753,16 +753,28 @@ public:
{m_alloc.deallocate(m_ptr, STDMIN(m_size, m_mark));} {m_alloc.deallocate(m_ptr, STDMIN(m_size, m_mark));}
#ifdef __BORLANDC__ #ifdef __BORLANDC__
/// \brief Cast operator
/// \returns block pointer cast to non-const <tt>T *</tt>
operator T *() const operator T *() const
{return (T*)m_ptr;} {return (T*)m_ptr;}
#else #else
/// \brief Cast operator
/// \returns block pointer cast to <tt>const void *</tt>
operator const void *() const operator const void *() const
{return m_ptr;} {return m_ptr;}
/// \brief Cast operator
/// \returns block pointer cast to non-const <tt>void *</tt>
operator void *() operator void *()
{return m_ptr;} {return m_ptr;}
/// \brief Cast operator
/// \returns block pointer cast to <tt>const T *</tt>
operator const T *() const operator const T *() const
{return m_ptr;} {return m_ptr;}
/// \brief Cast operator
/// \returns block pointer cast to non-const <tt>T *</tt>
operator T *() operator T *()
{return m_ptr;} {return m_ptr;}
#endif #endif
@ -938,8 +950,9 @@ public:
/// \sa operator!=() /// \sa operator!=()
bool operator==(const SecBlock<T, A> &t) const bool operator==(const SecBlock<T, A> &t) const
{ {
return m_size == t.m_size && return m_size == t.m_size && VerifyBufsEqual(
VerifyBufsEqual(reinterpret_cast<const byte*>(m_ptr), reinterpret_cast<const byte*>(t.m_ptr), m_size*sizeof(T)); reinterpret_cast<const byte*>(m_ptr),
reinterpret_cast<const byte*>(t.m_ptr), m_size*sizeof(T));
} }
/// \brief Bitwise compare two SecBlocks /// \brief Bitwise compare two SecBlocks
@ -1110,6 +1123,12 @@ inline bool operator!=(const CryptoPP::AllocatorWithCleanup<T, A>&, const Crypto
NAMESPACE_END NAMESPACE_END
NAMESPACE_BEGIN(std) NAMESPACE_BEGIN(std)
/// \brief Swap two SecBlocks
/// \tparam T class or type
/// \tparam A AllocatorBase derived class for allocation and cleanup
/// \param a the first SecBlock
/// \param b the second SecBlock
template <class T, class A> template <class T, class A>
inline void swap(CryptoPP::SecBlock<T, A> &a, CryptoPP::SecBlock<T, A> &b) inline void swap(CryptoPP::SecBlock<T, A> &a, CryptoPP::SecBlock<T, A> &b)
{ {