diff --git a/src/common/classes/ClumpletReader.cpp b/src/common/classes/ClumpletReader.cpp index bc69603fc7..3993464bb8 100644 --- a/src/common/classes/ClumpletReader.cpp +++ b/src/common/classes/ClumpletReader.cpp @@ -135,6 +135,7 @@ ClumpletReader::ClumpletReader(const KindList* kl, const UCHAR* buffer, size_t b } ++kl; } + if (kl->kind == EndOfList) { if (raise) @@ -144,6 +145,7 @@ ClumpletReader::ClumpletReader(const KindList* kl, const UCHAR* buffer, size_t b invalid_structure("Unknown tag value - missing in the list of possible"); } } + rewind(); // this will set cur_offset and spbState } @@ -714,4 +716,3 @@ const ClumpletReader::KindList ClumpletReader::dpbList[] = { }; } // namespace - diff --git a/src/common/classes/ClumpletReader.h b/src/common/classes/ClumpletReader.h index 06cf72133a..b9548a954d 100644 --- a/src/common/classes/ClumpletReader.h +++ b/src/common/classes/ClumpletReader.h @@ -46,11 +46,13 @@ class ClumpletReader : protected AutoStorage { public: enum Kind {EndOfList, Tagged, UnTagged, SpbAttach, SpbStart, Tpb/*, SpbInfo*/, WideTagged, WideUnTagged, SpbItems}; + struct KindList { Kind kind; UCHAR tag; }; + struct SingleClumplet { UCHAR tag; @@ -151,12 +153,10 @@ private: static SINT64 fromVaxInteger(const UCHAR* ptr, size_t length); - // Some frequently used kind lists public: - static const KindList dpbList[]; + static const KindList dpbList[]; // Some frequently used kind lists }; } // namespace Firebird #endif // CLUMPLETREADER_H - diff --git a/src/common/classes/ClumpletWriter.cpp b/src/common/classes/ClumpletWriter.cpp index 7ae9234450..673b9cf9e3 100644 --- a/src/common/classes/ClumpletWriter.cpp +++ b/src/common/classes/ClumpletWriter.cpp @@ -118,7 +118,8 @@ ClumpletWriter::ClumpletWriter(MemoryPool& given_pool, Kind k, size_t limit, } rewind(); } - */ +*/ + void ClumpletWriter::reset(UCHAR tag) { if (kindList) @@ -138,7 +139,7 @@ void ClumpletWriter::reset(UCHAR tag) invalid_structure("Unknown tag value - missing in the list of possible"); } - + dynamic_buffer.shrink(0); initNewBuffer(tag); rewind(); @@ -435,6 +436,7 @@ bool ClumpletWriter::upgradeVersion() newest = itr; } } + if (getBufferLength() && newest->tag <= getBufferTag()) { return false; diff --git a/src/common/classes/ClumpletWriter.h b/src/common/classes/ClumpletWriter.h index be307606d2..ea89428e1a 100644 --- a/src/common/classes/ClumpletWriter.h +++ b/src/common/classes/ClumpletWriter.h @@ -49,7 +49,7 @@ public: // Create writer from a given buffer ClumpletWriter(Kind k, size_t limit, const UCHAR* buffer, size_t buffLen, UCHAR tag); -// ClumpletWriter(MemoryPool& pool, Kind k, size_t limit, const UCHAR* buffer, size_t buffLen, UCHAR tag); + //ClumpletWriter(MemoryPool& pool, Kind k, size_t limit, const UCHAR* buffer, size_t buffLen, UCHAR tag); // Create writer from a given buffer with possibly different clumplet version ClumpletWriter(const KindList* kl, size_t limit, const UCHAR* buffer = NULL, size_t buffLen = 0); @@ -81,12 +81,13 @@ public: bool deleteWithTag(UCHAR tag); virtual const UCHAR* getBuffer() const; + protected: virtual const UCHAR* getBufferEnd() const; virtual void size_overflow(); void insertBytesLengthCheck(UCHAR tag, const UCHAR* bytes, const size_t length); - // upgrade clumplet version - obtain newest from kindList - bool upgradeVersion(); + bool upgradeVersion(); // upgrade clumplet version - obtain newest from kindList + private: size_t sizeLimit; const KindList* kindList; @@ -104,4 +105,3 @@ private: } // namespace Firebird #endif // CLUMPLETWRITER_H - diff --git a/src/common/classes/TriState.h b/src/common/classes/TriState.h index 5bf62d9ade..11a5ef256d 100644 --- a/src/common/classes/TriState.h +++ b/src/common/classes/TriState.h @@ -65,7 +65,7 @@ public: }; -template // Generic clear for TriState +template // Generic TriStateClear class TriStateClear { public: @@ -76,7 +76,7 @@ public: }; template <> -class TriStateClear // string especialization to clear TriState +class TriStateClear // string especialization for TriStateClear { public: static void clear(Firebird::string& v) @@ -86,7 +86,7 @@ public: }; template <> -class TriStateClear // MetaName especialization to clear TriState +class TriStateClear // MetaName especialization for TriStateClear { public: static void clear(Firebird::MetaName& v) diff --git a/src/dsql/DdlNodes.epp b/src/dsql/DdlNodes.epp index 96fb5dc1c8..9e731f81a6 100644 --- a/src/dsql/DdlNodes.epp +++ b/src/dsql/DdlNodes.epp @@ -1083,7 +1083,7 @@ void CreateAlterFunctionNode::storeArgument(thread_db* tdbb, jrd_tra* transactio } // ASF: If we used a collate with a domain or table.column type, write it - // into RDB$FUNCTION_ARGUMENTS. + // into RDB$FUNCTION_ARGUMENTS. if (parameter.collateSpecified && parameter.typeOfName.hasData()) { diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 57fda86a7a..48a1218427 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -4752,7 +4752,8 @@ static void find_intl_charset(thread_db* tdbb, Jrd::Attachment* attachment, cons } } -namespace { +namespace +{ void dpbErrorRaise() { ERR_post(Arg::Gds(isc_bad_dpb_form) <<