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;
ANONYMOUS_NAMESPACE_END
// Doxygen cannot handle initialization
#if CRYPTOPP_DOXYGEN_PROCESSING
//! \brief Default channel for BufferedTransformation
//! \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
//! placing the definition in the source file. As an external definition the string AAD_CHANNEL
//! 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
//! \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
//! was subject to static initialization order fiasco problems.
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
static const std::string DEFAULT_CHANNEL;
static const std::string AAD_CHANNEL("AAD");

View File

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