From bd60a93cd6fdaa10fc0a3e67bffaac8492c206b2 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Mon, 7 Apr 2014 14:49:42 -0700 Subject: [PATCH] Fix conversion of binary data to hexadecimal strings in some cases. --- src/ripple_data/protocol/Serializer.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ripple_data/protocol/Serializer.h b/src/ripple_data/protocol/Serializer.h index 15f6386b0..4f6cb09c9 100644 --- a/src/ripple_data/protocol/Serializer.h +++ b/src/ripple_data/protocol/Serializer.h @@ -224,9 +224,15 @@ public: std::string getHex () const { std::stringstream h; - h << std::hex << std::setfill ('0'); + for (unsigned char const& element : mData) - h << std::setw (2) << element; + { + h << + std::setw (2) << + std::hex << + std::setfill ('0') << + static_cast(element); + } return h.str (); }