Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
JoelKatz
2012-05-11 16:20:41 -07:00

View File

@@ -5,6 +5,7 @@
#include "SerializedObject.h" #include "SerializedObject.h"
#include "TransactionFormats.h" #include "TransactionFormats.h"
#include "NewcoinAddress.h" #include "NewcoinAddress.h"
#include "utils.h"
std::string SerializedType::getFullText() const std::string SerializedType::getFullText() const
{ {
@@ -133,15 +134,6 @@ bool STHash256::isEquivalent(const SerializedType& t) const
return v && (value == v->value); return v && (value == v->value);
} }
static std::string hex(const std::vector<unsigned char>& value)
{
int dlen=value.size(), i=0;
char psz[dlen*2 + 1];
for(std::vector<unsigned char>::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) STVariableLength::STVariableLength(SerializerIterator& st, const char *name) : SerializedType(name)
{ {
value = st.getVL(); value = st.getVL();
@@ -149,7 +141,7 @@ STVariableLength::STVariableLength(SerializerIterator& st, const char *name) : S
std::string STVariableLength::getText() const std::string STVariableLength::getText() const
{ {
return hex(value); return strHex(value);
} }
STVariableLength* STVariableLength::construct(SerializerIterator& u, const char *name) STVariableLength* STVariableLength::construct(SerializerIterator& u, const char *name)
@@ -230,7 +222,7 @@ std::string STTaggedList::getText() const
{ {
ret += boost::lexical_cast<std::string>(it->first); ret += boost::lexical_cast<std::string>(it->first);
ret += ","; ret += ",";
ret += hex(it->second); ret += strHex(it->second);
} }
return ret; return ret;
} }