From f5018b6cd1bd970dff47e4f1bbd3edaea4aee566 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 26 Nov 2012 11:19:24 -0800 Subject: [PATCH] Cleanup and log, no semantic changes. SerializedType::operator=(const SerializedType &) --- src/cpp/ripple/SerializedTypes.cpp | 9 +++++++++ src/cpp/ripple/SerializedTypes.h | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/SerializedTypes.cpp b/src/cpp/ripple/SerializedTypes.cpp index b9daae2fe..d56dd43d6 100644 --- a/src/cpp/ripple/SerializedTypes.cpp +++ b/src/cpp/ripple/SerializedTypes.cpp @@ -19,6 +19,15 @@ DECLARE_INSTANCE(SerializedValue); STAmount saZero(CURRENCY_ONE, ACCOUNT_ONE, 0); STAmount saOne(CURRENCY_ONE, ACCOUNT_ONE, 1); +SerializedType& SerializedType::operator=(const SerializedType& t) +{ + if ((t.fName != fName) && fName->isUseful() && t.fName->isUseful()) + Log(lsWARNING) << "Caution: " << t.fName->getName() << " not replacing " << fName->getName(); + if (!fName->isUseful()) fName = t.fName; + return *this; +} + + void STPathSet::printDebug() { for (int i = 0; i < value.size(); i++) { std::cout << i << ": "; diff --git a/src/cpp/ripple/SerializedTypes.h b/src/cpp/ripple/SerializedTypes.h index 7f892bc04..d60393e0d 100644 --- a/src/cpp/ripple/SerializedTypes.h +++ b/src/cpp/ripple/SerializedTypes.h @@ -10,6 +10,7 @@ #include "Serializer.h" #include "FieldNames.h" #include "InstanceCounter.h" +#include "Log.h" enum PathFlags { @@ -68,8 +69,8 @@ public: void addFieldID(Serializer& s) const { s.addFieldID(fName->fieldType, fName->fieldValue); } - SerializedType& operator=(const SerializedType& t) - { if (!fName->fieldCode) fName = t.fName; return *this; } + SerializedType& operator=(const SerializedType& t); + bool operator==(const SerializedType& t) const { return (getSType() == t.getSType()) && isEquivalent(t); } bool operator!=(const SerializedType& t) const