Fix SunCC 12.2 compile

pull/548/head
Jeffrey Walton 2017-11-13 12:30:46 -05:00
parent 51eca5dd87
commit 660681a884
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 15 additions and 6 deletions

View File

@ -471,6 +471,7 @@ ANONYMOUS_NAMESPACE_BEGIN
const NullNameValuePairs s_nullNameValuePairs; const NullNameValuePairs s_nullNameValuePairs;
ANONYMOUS_NAMESPACE_END ANONYMOUS_NAMESPACE_END
// Doxygen cannot handle initialization
#if CRYPTOPP_DOXYGEN_PROCESSING #if CRYPTOPP_DOXYGEN_PROCESSING
//! \brief Default channel for BufferedTransformation //! \brief Default channel for BufferedTransformation
//! \details DEFAULT_CHANNEL is equal to an empty string //! \details DEFAULT_CHANNEL is equal to an empty string
@ -484,13 +485,20 @@ const std::string DEFAULT_CHANNEL;
//! \details Crypto++ 6.0 placed AAD_CHANNEL in the header, rather than declaring it as extern and //! \details Crypto++ 6.0 placed AAD_CHANNEL in the header, rather than declaring it as extern and
//! placing the definition in the source file. As an external definition the string AAD_CHANNEL //! placing the definition in the source file. As an external definition the string AAD_CHANNEL
//! was subject to static initialization order fiasco problems. //! was subject to static initialization order fiasco problems.
const std::string AAD_CHANNEL = "AAD"; const std::string AAD_CHANNEL;
//! \brief An empty set of name-value pairs //! \brief An empty set of name-value pairs
//! \details Crypto++ 6.0 placed g_nullNameValuePairs in the header, rather than declaring it as extern //! \details Crypto++ 6.0 placed g_nullNameValuePairs in the header, rather than declaring it as extern
//! and placing the definition in the source file. As an external definition the g_nullNameValuePairs //! and placing the definition in the source file. As an external definition the g_nullNameValuePairs
//! was subject to static initialization order fiasco problems. //! was subject to static initialization order fiasco problems.
const NameValuePairs g_nullNameValuePairs; const NameValuePairs g_nullNameValuePairs;
// Sun Studio 12.3 and earlier can't handle NameValuePairs initialization
#elif defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130)
static const std::string DEFAULT_CHANNEL;
static const std::string AAD_CHANNEL("AAD");
static const NameValuePairs& g_nullNameValuePairs = s_nullNameValuePairs;
#else #else
static const std::string DEFAULT_CHANNEL; static const std::string DEFAULT_CHANNEL;
static const std::string AAD_CHANNEL("AAD"); static const std::string AAD_CHANNEL("AAD");

View File

@ -256,16 +256,17 @@ class DWord
{ {
public: public:
#if defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE) #if defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE)
DWord() : m_whole() { } DWord() {std::memset(&m_whole, 0x00, sizeof(m_whole));}
#else #else
DWord() : m_halfs() { } DWord() {std::memset(&m_halfs, 0x00, sizeof(m_halfs));}
#endif #endif
#ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE
explicit DWord(word low) : m_whole(low) { } explicit DWord(word low) : m_whole(low) { }
#else #else
explicit DWord(word low) : m_halfs() explicit DWord(word low)
{ {
m_halfs.high = 0;
m_halfs.low = low; m_halfs.low = low;
} }
#endif #endif
@ -279,10 +280,10 @@ public:
#if defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE) #if defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE)
# if defined(CRYPTOPP_LITTLE_ENDIAN) # if defined(CRYPTOPP_LITTLE_ENDIAN)
const word t[2] = {low,high}; const word t[2] = {low,high};
memcpy(&m_whole, &t, sizeof(m_whole)); memcpy(&m_whole, t, sizeof(m_whole));
# else # else
const word t[2] = {high,low}; const word t[2] = {high,low};
memcpy(&m_whole, &t, sizeof(m_whole)); memcpy(&m_whole, t, sizeof(m_whole));
# endif # endif
#else #else
m_halfs.low = low; m_halfs.low = low;