diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-04-08 21:14:19 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-04-08 21:14:19 +0100 |
| commit | d9d117d8dd56322fed12f8e12c574cf08fe22500 (patch) | |
| tree | a10caad60c43a8adb58b56a694681306f1236919 /src | |
| parent | b785a1a76e0863fc98d0acc98a098d328929d493 (diff) | |
Fix previous and add unit test for Key::hex.
Diffstat (limited to 'src')
| -rw-r--r-- | src/key.cc | 5 | ||||
| -rw-r--r-- | src/key.h | 6 |
2 files changed, 6 insertions, 5 deletions
@@ -90,6 +90,7 @@ Key::operator= (Key const & other) return *this; } + _length = other._length; memcpy (_value, other._value, _length); return *this; } @@ -102,9 +103,9 @@ Key::hex () const char* p = buffer; for (int i = 0; i < _length; ++i) { #ifdef LIBDCP_WINDOWS - __mingw_snprintf (p, 3, "%02hhx", buffer[i]); + __mingw_snprintf (p, 3, "%02hhx", _value[i]); #else - snprintf (p, 3, "%02hhx", buffer[i]); + snprintf (p, 3, "%02hhx", _value[i]); #endif p += 2; } @@ -51,7 +51,7 @@ class Key { public: /** Create a new, random key */ - Key (int length = ASDCP::KeyLen); + explicit Key (int length = ASDCP::KeyLen); /** Create a Key from a raw key value */ explicit Key (uint8_t const *, int length = ASDCP::KeyLen); @@ -60,10 +60,10 @@ public: explicit Key (std::string); Key (Key const &); - ~Key (); - Key& operator= (Key const &); + ~Key (); + /** @return Raw key value */ uint8_t const * value () const { return _value; |
