From d9d117d8dd56322fed12f8e12c574cf08fe22500 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 8 Apr 2019 21:14:19 +0100 Subject: Fix previous and add unit test for Key::hex. --- src/key.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/key.cc') diff --git a/src/key.cc b/src/key.cc index 58cc6d54..6fc075cb 100644 --- a/src/key.cc +++ b/src/key.cc @@ -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; } -- cgit v1.2.3