From e6e72a7b9ada0086120b2816ff12654d10546ff1 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 28 May 2012 03:35:52 -0700 Subject: [PATCH] Cleanups. --- src/SerializedLedger.h | 4 ++-- src/SerializedObject.cpp | 11 ++++++----- src/SerializedObject.h | 10 +++++----- src/TransactionEngine.h | 1 - src/bignum.h | 4 ++++ 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/SerializedLedger.h b/src/SerializedLedger.h index 0f5c666f86..9e5ccc2475 100644 --- a/src/SerializedLedger.h +++ b/src/SerializedLedger.h @@ -15,7 +15,7 @@ protected: LedgerEntryType mType; STUInt16 mVersion; STObject mObject; - LedgerEntryFormat* mFormat; + const LedgerEntryFormat* mFormat; SerializedLedgerEntry* duplicate() const { return new SerializedLedgerEntry(*this); } @@ -41,7 +41,7 @@ public: LedgerEntryType getType() const { return mType; } uint16 getVersion() const { return mVersion.getValue(); } - LedgerEntryFormat* getFormat() { return mFormat; } + const LedgerEntryFormat* getFormat() { return mFormat; } int getIFieldIndex(SOE_Field field) const { return mObject.getFieldIndex(field); } int getIFieldCount() const { return mObject.getCount(); } diff --git a/src/SerializedObject.cpp b/src/SerializedObject.cpp index bf1a873f05..937d286190 100644 --- a/src/SerializedObject.cpp +++ b/src/SerializedObject.cpp @@ -102,7 +102,7 @@ std::auto_ptr STObject::makeDeserializedObject(SerializedTypeID } } -void STObject::set(SOElement* elem) +void STObject::set(const SOElement* elem) { mData.empty(); mType.empty(); @@ -120,12 +120,12 @@ void STObject::set(SOElement* elem) } } -STObject::STObject(SOElement* elem, const char *name) : SerializedType(name) +STObject::STObject(const SOElement* elem, const char *name) : SerializedType(name) { set(elem); } -void STObject::set(SOElement* elem, SerializerIterator& sit) +void STObject::set(const SOElement* elem, SerializerIterator& sit) { mData.empty(); mType.empty(); @@ -167,7 +167,8 @@ void STObject::set(SOElement* elem, SerializerIterator& sit) } } -STObject::STObject(SOElement* elem, SerializerIterator& sit, const char *name) : SerializedType(name), mFlagIdx(-1) +STObject::STObject(const SOElement* elem, SerializerIterator& sit, const char *name) + : SerializedType(name), mFlagIdx(-1) { set(elem, sit); } @@ -244,7 +245,7 @@ bool STObject::isEquivalent(const SerializedType& t) const int STObject::getFieldIndex(SOE_Field field) const { int i = 0; - for (std::vector::const_iterator it = mType.begin(), end = mType.end(); it != end; ++it, ++i) + for (std::vector::const_iterator it = mType.begin(), end = mType.end(); it != end; ++it, ++i) if ((*it)->e_field == field) return i; return -1; } diff --git a/src/SerializedObject.h b/src/SerializedObject.h index da778fe8e0..d1d61a6425 100644 --- a/src/SerializedObject.h +++ b/src/SerializedObject.h @@ -103,18 +103,18 @@ class STObject : public SerializedType protected: int mFlagIdx; // the offset to the flags object, -1 if none boost::ptr_vector mData; - std::vector mType; + std::vector mType; STObject* duplicate() const { return new STObject(*this); } public: STObject(const char *n = NULL) : SerializedType(n), mFlagIdx(-1) { ; } - STObject(SOElement *t, const char *n = NULL); - STObject(SOElement *t, SerializerIterator& u, const char *n = NULL); + STObject(const SOElement *t, const char *n = NULL); + STObject(const SOElement *t, SerializerIterator& u, const char *n = NULL); virtual ~STObject() { ; } - void set(SOElement *t); - void set(SOElement *t, SerializerIterator& u); + void set(const SOElement* t); + void set(const SOElement* t, SerializerIterator& u); int getLength() const; virtual SerializedTypeID getSType() const { return STI_OBJECT; } diff --git a/src/TransactionEngine.h b/src/TransactionEngine.h index 2679b9dbfe..7709561226 100644 --- a/src/TransactionEngine.h +++ b/src/TransactionEngine.h @@ -3,7 +3,6 @@ #include "Ledger.h" #include "Ledger.h" -#include "Currency.h" #include "SerializedTransaction.h" #include "SerializedLedger.h" diff --git a/src/bignum.h b/src/bignum.h index 0023861897..01e614a79c 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -21,6 +21,10 @@ public: class CAutoBN_CTX { +private: + CAutoBN_CTX(const CAutoBN_CTX&); // no implementation + CAutoBN_CTX& operator=(const CAutoBN_CTX&); // no implementation + protected: BN_CTX* pctx; BN_CTX* operator=(BN_CTX* pnew) { return pctx = pnew; }