Switch to std::copy due to MinGW issues with memcpy_s
Also see http://github.com/weidai11/cryptopp/issues/28 and http://groups.google.com/d/msg/cryptopp-users/PRTVKTh0gRk/euPM_TzdBAAJpull/326/head
parent
54d17c7361
commit
51d3cc945f
14
validat1.cpp
14
validat1.cpp
|
|
@ -173,17 +173,19 @@ bool ValidateAll(bool thorough)
|
||||||
|
|
||||||
bool TestSettings()
|
bool TestSettings()
|
||||||
{
|
{
|
||||||
// Thanks to IlyaBizyaev and Zireael, http://github.com/weidai11/cryptopp/issues/28
|
|
||||||
#if defined(__MINGW32__)
|
|
||||||
using CryptoPP::memcpy_s;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool pass = true;
|
bool pass = true;
|
||||||
|
|
||||||
cout << "\nTesting Settings...\n\n";
|
cout << "\nTesting Settings...\n\n";
|
||||||
|
|
||||||
word32 w;
|
word32 w;
|
||||||
memcpy_s(&w, sizeof(w), "\x01\x02\x03\x04", 4);
|
const byte s[] = "\x01\x02\x03\x04";
|
||||||
|
|
||||||
|
#if (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
|
std::copy(s, s+4,
|
||||||
|
stdext::make_checked_array_iterator(reinterpret_cast<byte*>(&w), sizeof(w)));
|
||||||
|
#else
|
||||||
|
std::copy(s, s+4, reinterpret_cast<byte*>(&w));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (w == 0x04030201L)
|
if (w == 0x04030201L)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue