From fbd9e60e33ff976b634df6762cb19326a97b67e1 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Fri, 11 May 2012 14:58:34 -0700 Subject: [PATCH] Use strHex in place of custom function. --- src/SerializedTypes.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/SerializedTypes.cpp b/src/SerializedTypes.cpp index 647b22c8a..92ebe4c06 100644 --- a/src/SerializedTypes.cpp +++ b/src/SerializedTypes.cpp @@ -5,6 +5,7 @@ #include "SerializedObject.h" #include "TransactionFormats.h" #include "NewcoinAddress.h" +#include "utils.h" std::string SerializedType::getFullText() const { @@ -133,15 +134,6 @@ bool STHash256::isEquivalent(const SerializedType& t) const return v && (value == v->value); } -static std::string hex(const std::vector& value) -{ - int dlen=value.size(), i=0; - char psz[dlen*2 + 1]; - for(std::vector::const_iterator it=value.begin(), end=value.end(); it!=end; ++it) - sprintf(psz + 2*(i++), "%02X", *it); - return std::string(psz, psz + value.size()*2); -} - STVariableLength::STVariableLength(SerializerIterator& st, const char *name) : SerializedType(name) { value = st.getVL(); @@ -149,7 +141,7 @@ STVariableLength::STVariableLength(SerializerIterator& st, const char *name) : S std::string STVariableLength::getText() const { - return hex(value); + return strHex(value); } STVariableLength* STVariableLength::construct(SerializerIterator& u, const char *name) @@ -230,7 +222,7 @@ std::string STTaggedList::getText() const { ret += boost::lexical_cast(it->first); ret += ","; - ret += hex(it->second); + ret += strHex(it->second); } return ret; }