mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
unit_tests: don't take the address of an unwrapped secret key
This commit is contained in:
parent
8534f71eed
commit
80be2dca2b
1 changed files with 4 additions and 1 deletions
|
@ -47,6 +47,9 @@ namespace
|
||||||
"8b655970153799af2aeadc9ff1add0ea6c7251d54154cfa92c173a0dd39c1f94"
|
"8b655970153799af2aeadc9ff1add0ea6c7251d54154cfa92c173a0dd39c1f94"
|
||||||
"6c7251d54154cfa92c173a0dd39c1f948b655970153799af2aeadc9ff1add0ea";
|
"6c7251d54154cfa92c173a0dd39c1f948b655970153799af2aeadc9ff1add0ea";
|
||||||
|
|
||||||
|
template<typename T> void *addressof(T &t) { return &t; }
|
||||||
|
template<> void *addressof(crypto::secret_key &k) { return addressof(unwrap(unwrap(k))); }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool is_formatted()
|
bool is_formatted()
|
||||||
{
|
{
|
||||||
|
@ -55,7 +58,7 @@ namespace
|
||||||
static_assert(alignof(T) == 1, "T must have 1 byte alignment");
|
static_assert(alignof(T) == 1, "T must have 1 byte alignment");
|
||||||
static_assert(sizeof(T) <= sizeof(source), "T is too large for source");
|
static_assert(sizeof(T) <= sizeof(source), "T is too large for source");
|
||||||
static_assert(sizeof(T) * 2 <= sizeof(expected), "T is too large for destination");
|
static_assert(sizeof(T) * 2 <= sizeof(expected), "T is too large for destination");
|
||||||
std::memcpy(std::addressof(value), source, sizeof(T));
|
std::memcpy(addressof(value), source, sizeof(T));
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
out << "BEGIN" << value << "END";
|
out << "BEGIN" << value << "END";
|
||||||
|
|
Loading…
Reference in a new issue