8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 20:03:03 +01:00
This commit is contained in:
asfernandes 2010-01-01 20:23:52 +00:00
parent e61dad78e7
commit e13a0e3865
7 changed files with 19 additions and 15 deletions

View File

@ -135,6 +135,7 @@ ClumpletReader::ClumpletReader(const KindList* kl, const UCHAR* buffer, size_t b
} }
++kl; ++kl;
} }
if (kl->kind == EndOfList) if (kl->kind == EndOfList)
{ {
if (raise) 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"); invalid_structure("Unknown tag value - missing in the list of possible");
} }
} }
rewind(); // this will set cur_offset and spbState rewind(); // this will set cur_offset and spbState
} }
@ -714,4 +716,3 @@ const ClumpletReader::KindList ClumpletReader::dpbList[] = {
}; };
} // namespace } // namespace

View File

@ -46,11 +46,13 @@ class ClumpletReader : protected AutoStorage
{ {
public: public:
enum Kind {EndOfList, Tagged, UnTagged, SpbAttach, SpbStart, Tpb/*, SpbInfo*/, WideTagged, WideUnTagged, SpbItems}; enum Kind {EndOfList, Tagged, UnTagged, SpbAttach, SpbStart, Tpb/*, SpbInfo*/, WideTagged, WideUnTagged, SpbItems};
struct KindList struct KindList
{ {
Kind kind; Kind kind;
UCHAR tag; UCHAR tag;
}; };
struct SingleClumplet struct SingleClumplet
{ {
UCHAR tag; UCHAR tag;
@ -151,12 +153,10 @@ private:
static SINT64 fromVaxInteger(const UCHAR* ptr, size_t length); static SINT64 fromVaxInteger(const UCHAR* ptr, size_t length);
// Some frequently used kind lists
public: public:
static const KindList dpbList[]; static const KindList dpbList[]; // Some frequently used kind lists
}; };
} // namespace Firebird } // namespace Firebird
#endif // CLUMPLETREADER_H #endif // CLUMPLETREADER_H

View File

@ -118,7 +118,8 @@ ClumpletWriter::ClumpletWriter(MemoryPool& given_pool, Kind k, size_t limit,
} }
rewind(); rewind();
} }
*/ */
void ClumpletWriter::reset(UCHAR tag) void ClumpletWriter::reset(UCHAR tag)
{ {
if (kindList) if (kindList)
@ -138,7 +139,7 @@ void ClumpletWriter::reset(UCHAR tag)
invalid_structure("Unknown tag value - missing in the list of possible"); invalid_structure("Unknown tag value - missing in the list of possible");
} }
dynamic_buffer.shrink(0); dynamic_buffer.shrink(0);
initNewBuffer(tag); initNewBuffer(tag);
rewind(); rewind();
@ -435,6 +436,7 @@ bool ClumpletWriter::upgradeVersion()
newest = itr; newest = itr;
} }
} }
if (getBufferLength() && newest->tag <= getBufferTag()) if (getBufferLength() && newest->tag <= getBufferTag())
{ {
return false; return false;

View File

@ -49,7 +49,7 @@ public:
// Create writer from a given buffer // Create writer from a given buffer
ClumpletWriter(Kind k, size_t limit, const UCHAR* buffer, size_t buffLen, UCHAR tag); 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 // 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); ClumpletWriter(const KindList* kl, size_t limit, const UCHAR* buffer = NULL, size_t buffLen = 0);
@ -81,12 +81,13 @@ public:
bool deleteWithTag(UCHAR tag); bool deleteWithTag(UCHAR tag);
virtual const UCHAR* getBuffer() const; virtual const UCHAR* getBuffer() const;
protected: protected:
virtual const UCHAR* getBufferEnd() const; virtual const UCHAR* getBufferEnd() const;
virtual void size_overflow(); virtual void size_overflow();
void insertBytesLengthCheck(UCHAR tag, const UCHAR* bytes, const size_t length); void insertBytesLengthCheck(UCHAR tag, const UCHAR* bytes, const size_t length);
// upgrade clumplet version - obtain newest from kindList bool upgradeVersion(); // upgrade clumplet version - obtain newest from kindList
bool upgradeVersion();
private: private:
size_t sizeLimit; size_t sizeLimit;
const KindList* kindList; const KindList* kindList;
@ -104,4 +105,3 @@ private:
} // namespace Firebird } // namespace Firebird
#endif // CLUMPLETWRITER_H #endif // CLUMPLETWRITER_H

View File

@ -65,7 +65,7 @@ public:
}; };
template <typename T> // Generic clear for TriState template <typename T> // Generic TriStateClear
class TriStateClear class TriStateClear
{ {
public: public:
@ -76,7 +76,7 @@ public:
}; };
template <> template <>
class TriStateClear<Firebird::string> // string especialization to clear TriState class TriStateClear<Firebird::string> // string especialization for TriStateClear
{ {
public: public:
static void clear(Firebird::string& v) static void clear(Firebird::string& v)
@ -86,7 +86,7 @@ public:
}; };
template <> template <>
class TriStateClear<Firebird::MetaName> // MetaName especialization to clear TriState class TriStateClear<Firebird::MetaName> // MetaName especialization for TriStateClear
{ {
public: public:
static void clear(Firebird::MetaName& v) static void clear(Firebird::MetaName& v)

View File

@ -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 // 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()) if (parameter.collateSpecified && parameter.typeOfName.hasData())
{ {

View File

@ -4752,7 +4752,8 @@ static void find_intl_charset(thread_db* tdbb, Jrd::Attachment* attachment, cons
} }
} }
namespace { namespace
{
void dpbErrorRaise() void dpbErrorRaise()
{ {
ERR_post(Arg::Gds(isc_bad_dpb_form) << ERR_post(Arg::Gds(isc_bad_dpb_form) <<