8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Cleanup: moved INTL objects, defined in common, from namespace Jrd to namespace Firebird

This commit is contained in:
AlexPeshkoff 2024-01-11 20:00:14 +03:00
parent 3912346e6f
commit 8aacea411b
30 changed files with 140 additions and 131 deletions

View File

@ -156,7 +156,7 @@ bool get_sql_roles(BurpGlobals* tdgbl);
bool get_mapping(BurpGlobals* tdgbl);
bool get_db_creator(BurpGlobals* tdgbl);
bool get_security_class(BurpGlobals* tdgbl);
void get_source_blob(BurpGlobals* tdgbl, ISC_QUAD&, bool);
void get_source_blob(BurpGlobals* tdgbl, ISC_QUAD&, bool, void (*postProcess) (BlobBuffer& segment) = nullptr);
USHORT get_text(BurpGlobals* tdgbl, TEXT*, ULONG);
USHORT get_text2(BurpGlobals* tdgbl, TEXT* text, ULONG length);
bool get_trigger(BurpGlobals* tdgbl);
@ -2721,6 +2721,11 @@ bool get_chk_constraint(BurpGlobals* tdgbl)
return true;
}
void clearAttributes(BlobBuffer& attr)
{
}
bool get_collation(BurpGlobals* tdgbl)
{
/**************************************
@ -8831,7 +8836,7 @@ bool get_security_class(BurpGlobals* tdgbl)
return true;
}
void get_source_blob(BurpGlobals* tdgbl, ISC_QUAD& blob_id, bool glb_trans)
void get_source_blob(BurpGlobals* tdgbl, ISC_QUAD& blob_id, bool glb_trans, void (*postProcess) (BlobBuffer& segment))
{
/**************************************
*
@ -8895,7 +8900,7 @@ void get_source_blob(BurpGlobals* tdgbl, ISC_QUAD& blob_id, bool glb_trans)
// Allocate blob buffer if static buffer is too short
BlobBuffer static_buffer;
UCHAR* const buffer = static_buffer.getBuffer(length);
UCHAR* buffer = static_buffer.getBuffer(length);
while (length > 0)
{
@ -8906,6 +8911,12 @@ void get_source_blob(BurpGlobals* tdgbl, ISC_QUAD& blob_id, bool glb_trans)
--length; // -- or ++ ??? p is decremented, will have to test.
const USHORT seg_len = p - buffer;
if (postProcess)
{
postProcess(static_buffer);
buffer = static_buffer.begin();
}
if (!blob.putSegment(seg_len, buffer))
{
BURP_error_redirect(&status_vector, 38);

View File

@ -239,7 +239,7 @@ ULONG MultiByteCharSet::substring(const ULONG srcLen, const UCHAR* src, const UL
//-------------
namespace Jrd {
namespace Firebird {
CharSet* CharSet::createInstance(MemoryPool& pool, USHORT id, charset* cs)
@ -300,4 +300,4 @@ ULONG CharSet::removeTrailingSpaces(ULONG srcLen, const UCHAR* src) const
}
} // namespace Jrd
} // namespace Firebird

View File

@ -27,8 +27,8 @@
*
*/
#ifndef JRD_CHARSET_H
#define JRD_CHARSET_H
#ifndef COMMON_CHARSET_H
#define COMMON_CHARSET_H
#include "CsConvert.h"
#include "IntlUtil.h"
@ -45,11 +45,6 @@ namespace Firebird {
}
}
}
namespace Jrd {
class CharSet
{
public:
@ -146,7 +141,7 @@ private:
BYTE sqlMatchOneLength;
};
} // namespace Jrd
} // namespace Firebird
#endif // JRD_CHARSET_H
#endif // COMMON_CHARSET_H

View File

@ -27,15 +27,15 @@
*
*/
#ifndef JRD_CSCONVERT_H
#define JRD_CSCONVERT_H
#ifndef COMMON_CSCONVERT_H
#define COMMON_CSCONVERT_H
#include "iberror.h"
#include "../common/classes/array.h"
#include "../common/StatusArg.h"
namespace Jrd {
namespace Firebird {
class CsConvert
{
@ -286,7 +286,7 @@ private:
};
} // namespace Jrd
} // namespace Firebird
#endif // JRD_CSCONVERT_H
#endif // COMMON_CSCONVERT_H

View File

@ -35,7 +35,7 @@
#include <unicode/utf8.h>
using Jrd::UnicodeUtil;
using Firebird::UnicodeUtil;
namespace
@ -80,11 +80,11 @@ GlobalPtr<IntlUtil::Utf8CharSet> IntlUtil::utf8CharSet;
IntlUtil::Utf8CharSet::Utf8CharSet(MemoryPool& pool)
{
IntlUtil::initUtf8Charset(&obj);
charSet = Jrd::CharSet::createInstance(pool, CS_UTF8, &obj);
charSet = Firebird::CharSet::createInstance(pool, CS_UTF8, &obj);
}
string IntlUtil::generateSpecificAttributes(Jrd::CharSet* cs, SpecificAttributesMap& map)
string IntlUtil::generateSpecificAttributes(Firebird::CharSet* cs, SpecificAttributesMap& map)
{
SpecificAttributesMap::Accessor accessor(&map);
@ -125,7 +125,7 @@ string IntlUtil::generateSpecificAttributes(Jrd::CharSet* cs, SpecificAttributes
}
bool IntlUtil::parseSpecificAttributes(Jrd::CharSet* cs, ULONG len, const UCHAR* s,
bool IntlUtil::parseSpecificAttributes(Firebird::CharSet* cs, ULONG len, const UCHAR* s,
SpecificAttributesMap* map)
{
// Note that the map isn't cleared.
@ -523,11 +523,11 @@ bool IntlUtil::initUnicodeCollation(texttype* tt, charset* cs, const ASCII* name
IntlUtil::SpecificAttributesMap map;
Jrd::CharSet* charSet = NULL;
Firebird::CharSet* charSet = NULL;
try
{
charSet = Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs);
charSet = Firebird::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs);
IntlUtil::parseSpecificAttributes(charSet, specificAttributes.getCount(),
specificAttributes.begin(), &map);
delete charSet;
@ -594,7 +594,7 @@ void IntlUtil::finiCharset(charset* cs)
}
ULONG IntlUtil::toLower(Jrd::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst,
ULONG IntlUtil::toLower(Firebird::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst,
const ULONG* exceptions)
{
const ULONG utf16_length = cs->getConvToUnicode().convertLength(srcLen);
@ -620,7 +620,7 @@ ULONG IntlUtil::toLower(Jrd::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG
}
ULONG IntlUtil::toUpper(Jrd::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst,
ULONG IntlUtil::toUpper(Firebird::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst,
const ULONG* exceptions)
{
const ULONG utf16_length = cs->getConvToUnicode().convertLength(srcLen);
@ -646,7 +646,7 @@ ULONG IntlUtil::toUpper(Jrd::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG
}
bool IntlUtil::readOneChar(Jrd::CharSet* cs, const UCHAR** s, const UCHAR* end, ULONG* size)
bool IntlUtil::readOneChar(Firebird::CharSet* cs, const UCHAR** s, const UCHAR* end, ULONG* size)
{
(*s) += *size;
@ -668,7 +668,7 @@ bool IntlUtil::readOneChar(Jrd::CharSet* cs, const UCHAR** s, const UCHAR* end,
bool IntlUtil::setupIcuAttributes(charset* cs, const string& specificAttributes,
const string& configInfo, string& newSpecificAttributes)
{
AutoPtr<Jrd::CharSet> charSet(Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs));
AutoPtr<Firebird::CharSet> charSet(Firebird::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs));
IntlUtil::SpecificAttributesMap map;
if (!IntlUtil::parseSpecificAttributes(charSet, specificAttributes.length(),
@ -704,7 +704,7 @@ bool IntlUtil::setupIcuAttributes(charset* cs, const string& specificAttributes,
}
string IntlUtil::escapeAttribute(Jrd::CharSet* cs, const string& s)
string IntlUtil::escapeAttribute(Firebird::CharSet* cs, const string& s)
{
string ret;
const UCHAR* p = (const UCHAR*)s.begin();
@ -739,7 +739,7 @@ string IntlUtil::escapeAttribute(Jrd::CharSet* cs, const string& s)
}
string IntlUtil::unescapeAttribute(Jrd::CharSet* cs, const string& s)
string IntlUtil::unescapeAttribute(Firebird::CharSet* cs, const string& s)
{
string ret;
const UCHAR* p = (const UCHAR*)s.begin();
@ -753,7 +753,7 @@ string IntlUtil::unescapeAttribute(Jrd::CharSet* cs, const string& s)
}
bool IntlUtil::isAttributeEscape(Jrd::CharSet* cs, const UCHAR* s, ULONG size)
bool IntlUtil::isAttributeEscape(Firebird::CharSet* cs, const UCHAR* s, ULONG size)
{
UCHAR uc[sizeof(ULONG)];
const ULONG uSize = cs->getConvToUnicode().convert(size, s, sizeof(uc), uc);
@ -762,7 +762,7 @@ bool IntlUtil::isAttributeEscape(Jrd::CharSet* cs, const UCHAR* s, ULONG size)
}
bool IntlUtil::readAttributeChar(Jrd::CharSet* cs, const UCHAR** s, const UCHAR* end, ULONG* size, bool returnEscape)
bool IntlUtil::readAttributeChar(Firebird::CharSet* cs, const UCHAR** s, const UCHAR* end, ULONG* size, bool returnEscape)
{
if (readOneChar(cs, s, end, size))
{

View File

@ -24,8 +24,8 @@
* Contributor(s): ______________________________________.
*/
#ifndef JRD_INTLUTIL_H
#define JRD_INTLUTIL_H
#ifndef COMMON_INTLUTIL_H
#define COMMON_INTLUTIL_H
#include "../common/classes/array.h"
#include "../common/classes/auto.h"
@ -34,12 +34,9 @@
#include "../common/classes/init.h"
#include "../common/intlobj_new.h"
namespace Jrd
namespace Firebird
{
class CharSet;
}
namespace Firebird {
class CharSet;
class IntlUtil
{
@ -48,13 +45,13 @@ public:
typedef GenericMap<SpecificAttribute> SpecificAttributesMap;
public:
static Jrd::CharSet* getUtf8CharSet()
static CharSet* getUtf8CharSet()
{
return utf8CharSet->charSet;
}
static string generateSpecificAttributes(Jrd::CharSet* cs, SpecificAttributesMap& map);
static bool parseSpecificAttributes(Jrd::CharSet* cs, ULONG len, const UCHAR* s,
static string generateSpecificAttributes(CharSet* cs, SpecificAttributesMap& map);
static bool parseSpecificAttributes(CharSet* cs, ULONG len, const UCHAR* s,
SpecificAttributesMap* map);
static string convertAsciiToUtf16(const string& ascii);
@ -85,23 +82,23 @@ public:
static void finiCharset(charset* cs);
static ULONG toLower(Jrd::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst,
static ULONG toLower(CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst,
const ULONG* exceptions);
static ULONG toUpper(Jrd::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst,
static ULONG toUpper(CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, UCHAR* dst,
const ULONG* exceptions);
static bool readOneChar(Jrd::CharSet* cs, const UCHAR** s, const UCHAR* end, ULONG* size);
static bool readOneChar(CharSet* cs, const UCHAR** s, const UCHAR* end, ULONG* size);
static bool setupIcuAttributes(charset* cs, const string& specificAttributes,
const string& configInfo, string& newSpecificAttributes);
private:
static string escapeAttribute(Jrd::CharSet* cs, const string& s);
static string unescapeAttribute(Jrd::CharSet* cs, const string& s);
static string escapeAttribute(CharSet* cs, const string& s);
static string unescapeAttribute(CharSet* cs, const string& s);
static bool isAttributeEscape(Jrd::CharSet* cs, const UCHAR* s, ULONG size);
static bool isAttributeEscape(CharSet* cs, const UCHAR* s, ULONG size);
static bool readAttributeChar(Jrd::CharSet* cs, const UCHAR** s, const UCHAR* end, ULONG* size,
static bool readAttributeChar(CharSet* cs, const UCHAR** s, const UCHAR* end, ULONG* size,
bool returnEscape);
private:
@ -112,7 +109,7 @@ private:
public:
charset obj;
AutoPtr<Jrd::CharSet> charSet;
AutoPtr<CharSet> charSet;
};
static GlobalPtr<Utf8CharSet> utf8CharSet;
@ -120,4 +117,4 @@ private:
} // namespace Firebird
#endif // JRD_INTLUTIL_H
#endif // COMMON_INTLUTIL_H

View File

@ -74,7 +74,7 @@ namespace
{
if (!(flags & COMP_FLAG_LATIN) && !(flags & COMP_FLAG_WELLFORMED))
{
if (!Jrd::UnicodeUtil::utf8WellFormed(patternLen, reinterpret_cast<const UCHAR*>(patternStr), nullptr))
if (!UnicodeUtil::utf8WellFormed(patternLen, reinterpret_cast<const UCHAR*>(patternStr), nullptr))
status_exception::raise(Arg::Gds(isc_malformed_string));
}
@ -82,7 +82,7 @@ namespace
{
if (!(flags & COMP_FLAG_LATIN) && !(flags & COMP_FLAG_WELLFORMED))
{
if (!Jrd::UnicodeUtil::utf8WellFormed(escapeLen, reinterpret_cast<const UCHAR*>(escapeStr), nullptr))
if (!UnicodeUtil::utf8WellFormed(escapeLen, reinterpret_cast<const UCHAR*>(escapeStr), nullptr))
status_exception::raise(Arg::Gds(isc_malformed_string));
}

View File

@ -98,7 +98,7 @@
#include "../common/classes/Aligner.h"
namespace Jrd {
namespace Firebird {
TextType::TextType(TTYPE_ID _type, texttype *_tt, USHORT _attributes, CharSet* _cs)

View File

@ -27,14 +27,14 @@
*
*/
#ifndef JRD_TEXTTYPE_H
#define JRD_TEXTTYPE_H
#ifndef COMMON_TEXTTYPE_H
#define COMMON_TEXTTYPE_H
#include "../common/classes/MetaString.h"
struct texttype;
namespace Jrd {
namespace Firebird {
class CharSet;
@ -148,7 +148,7 @@ private:
ULONG canonicalChars[CHAR_COUNT];
};
} // namespace Jrd
} // namespace Firebird
#endif // JRD_TEXTTYPE_H
#endif // COMMON_TEXTTYPE_H

View File

@ -54,7 +54,7 @@ namespace
{
if (const auto calendar = icuCachedCalendar.exchange(nullptr))
{
auto& icuLib = Jrd::UnicodeUtil::getConversionICU();
auto& icuLib = UnicodeUtil::getConversionICU();
icuLib.ucalClose(calendar);
}
}
@ -80,7 +80,7 @@ namespace
return unicodeName.begin();
}
IcuCalendarWrapper getCalendar(const Jrd::UnicodeUtil::ConversionICU& icuLib, UErrorCode* err = nullptr) const
IcuCalendarWrapper getCalendar(const UnicodeUtil::ConversionICU& icuLib, UErrorCode* err = nullptr) const
{
auto calendar = icuCachedCalendar.exchange(nullptr);
UErrorCode internalErr = U_ZERO_ERROR;
@ -336,7 +336,7 @@ USHORT TimeZoneUtil::getSystemTimeZone()
return cachedTimeZoneId;
UErrorCode icuErrorCode = U_ZERO_ERROR;
Jrd::UnicodeUtil::ConversionICU& icuLib = Jrd::UnicodeUtil::getConversionICU();
UnicodeUtil::ConversionICU& icuLib = UnicodeUtil::getConversionICU();
char buffer[TimeZoneUtil::MAX_SIZE];
const char* str = buffer;
@ -435,7 +435,7 @@ USHORT TimeZoneUtil::getSystemTimeZone()
void TimeZoneUtil::getDatabaseVersion(Firebird::string& str)
{
Jrd::UnicodeUtil::ConversionICU& icuLib = Jrd::UnicodeUtil::getConversionICU();
UnicodeUtil::ConversionICU& icuLib = UnicodeUtil::getConversionICU();
UErrorCode icuErrorCode = U_ZERO_ERROR;
const char* version = icuLib.ucalGetTZDataVersion(&icuErrorCode);
@ -615,7 +615,7 @@ void TimeZoneUtil::extractOffset(const ISC_TIMESTAMP_TZ& timeStampTz, SSHORT* of
{
UErrorCode icuErrorCode = U_ZERO_ERROR;
Jrd::UnicodeUtil::ConversionICU& icuLib = Jrd::UnicodeUtil::getConversionICU();
UnicodeUtil::ConversionICU& icuLib = UnicodeUtil::getConversionICU();
auto icuCalendar = getDesc(timeStampTz.time_zone)->getCalendar(icuLib, &icuErrorCode);
@ -715,7 +715,7 @@ void TimeZoneUtil::localTimeStampToUtc(ISC_TIMESTAMP_TZ& timeStampTz)
UErrorCode icuErrorCode = U_ZERO_ERROR;
Jrd::UnicodeUtil::ConversionICU& icuLib = Jrd::UnicodeUtil::getConversionICU();
UnicodeUtil::ConversionICU& icuLib = UnicodeUtil::getConversionICU();
auto icuCalendar = getDesc(timeStampTz.time_zone)->getCalendar(icuLib, &icuErrorCode);
@ -775,7 +775,7 @@ bool TimeZoneUtil::decodeTimeStamp(const ISC_TIMESTAMP_TZ& timeStampTz, bool gmt
if (gmtFallback && getenv("MISSING_ICU_EMULATION"))
(Arg::Gds(isc_random) << "Emulating missing ICU").raise();
#endif
Jrd::UnicodeUtil::ConversionICU& icuLib = Jrd::UnicodeUtil::getConversionICU();
UnicodeUtil::ConversionICU& icuLib = UnicodeUtil::getConversionICU();
auto icuCalendar = getDesc(timeStampTz.time_zone)->getCalendar(icuLib, &icuErrorCode);
@ -1059,7 +1059,7 @@ ISC_TIMESTAMP_TZ TimeZoneUtil::dateToTimeStampTz(const ISC_DATE& date, Callbacks
TimeZoneRuleIterator::TimeZoneRuleIterator(USHORT aId, const ISC_TIMESTAMP_TZ& aFrom, const ISC_TIMESTAMP_TZ& aTo)
: id(aId),
icuLib(Jrd::UnicodeUtil::getConversionICU()),
icuLib(UnicodeUtil::getConversionICU()),
toTicks(TimeStamp::timeStampToTicks(aTo.utc_timestamp)),
icuCalendar(getDesc(aId)->getCalendar(icuLib))
{

View File

@ -166,7 +166,7 @@ public:
if (newCached)
{
auto& icuLib = Jrd::UnicodeUtil::getConversionICU();
auto& icuLib = UnicodeUtil::getConversionICU();
icuLib.ucalClose(newCached);
}
}
@ -212,7 +212,7 @@ public:
private:
const USHORT id;
Jrd::UnicodeUtil::ConversionICU& icuLib;
UnicodeUtil::ConversionICU& icuLib;
SINT64 startTicks;
SINT64 toTicks;
IcuCalendarWrapper icuCalendar;

View File

@ -2932,7 +2932,7 @@ void CVT_move_common(const dsc* from, dsc* to, DecimalStatus decSt, Callbacks* c
if (to->dsc_dtype == dtype_varying)
ptr += sizeof(USHORT);
Jrd::CharSet* charSet = cb->getToCharset(to->getCharSet());
CharSet* charSet = cb->getToCharset(to->getCharSet());
UCHAR maxBytesPerChar = charSet ? charSet->maxBytesPerChar() : 1;
if (len / maxBytesPerChar < from->dsc_length)
@ -3009,7 +3009,7 @@ void CVT_move_common(const dsc* from, dsc* to, DecimalStatus decSt, Callbacks* c
} // end scope
const USHORT to_size = TEXT_LEN(to);
Jrd::CharSet* toCharset = cb->getToCharset(charset2);
CharSet* toCharset = cb->getToCharset(charset2);
cb->validateData(toCharset, length, q);
ULONG toLength = cb->validateLength(toCharset, charset2, length, q, to_size);
@ -4801,9 +4801,9 @@ namespace
public:
virtual bool transliterate(const dsc* from, dsc* to, CHARSET_ID&);
virtual CHARSET_ID getChid(const dsc* d);
virtual Jrd::CharSet* getToCharset(CHARSET_ID charset2);
virtual void validateData(Jrd::CharSet* toCharset, SLONG length, const UCHAR* q);
virtual ULONG validateLength(Jrd::CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
virtual CharSet* getToCharset(CHARSET_ID charset2);
virtual void validateData(CharSet* toCharset, SLONG length, const UCHAR* q);
virtual ULONG validateLength(CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
const USHORT size);
virtual SLONG getLocalDate();
virtual ISC_TIMESTAMP getCurrentGmtTimeStamp();
@ -4817,16 +4817,16 @@ namespace
return false;
}
Jrd::CharSet* CommonCallbacks::getToCharset(CHARSET_ID)
CharSet* CommonCallbacks::getToCharset(CHARSET_ID)
{
return NULL;
}
void CommonCallbacks::validateData(Jrd::CharSet*, SLONG, const UCHAR*)
void CommonCallbacks::validateData(CharSet*, SLONG, const UCHAR*)
{
}
ULONG CommonCallbacks::validateLength(Jrd::CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
ULONG CommonCallbacks::validateLength(CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
const USHORT size)
{
if (length > size)

View File

@ -31,7 +31,7 @@
#include "../common/DecFloat.h"
namespace Jrd {
namespace Firebird {
class CharSet;
@ -56,9 +56,9 @@ public:
public:
virtual bool transliterate(const dsc* from, dsc* to, CHARSET_ID&) = 0;
virtual CHARSET_ID getChid(const dsc* d) = 0;
virtual Jrd::CharSet* getToCharset(CHARSET_ID charset2) = 0;
virtual void validateData(Jrd::CharSet* toCharset, SLONG length, const UCHAR* q) = 0;
virtual ULONG validateLength(Jrd::CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
virtual CharSet* getToCharset(CHARSET_ID charset2) = 0;
virtual void validateData(CharSet* toCharset, SLONG length, const UCHAR* q) = 0;
virtual ULONG validateLength(CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
const USHORT size) = 0;
virtual SLONG getLocalDate() = 0;
virtual ISC_TIMESTAMP getCurrentGmtTimeStamp() = 0;

View File

@ -93,9 +93,9 @@ public:
public:
bool transliterate(const dsc* from, dsc* to, CHARSET_ID&) override { return true; }
CHARSET_ID getChid(const dsc* d) override { return 0; }
Jrd::CharSet* getToCharset(CHARSET_ID charset2) override { return nullptr; }
void validateData(Jrd::CharSet* toCharset, SLONG length, const UCHAR* q) override { }
ULONG validateLength(Jrd::CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
Firebird::CharSet* getToCharset(CHARSET_ID charset2) override { return nullptr; }
void validateData(Firebird::CharSet* toCharset, SLONG length, const UCHAR* q) override { }
ULONG validateLength(Firebird::CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
const USHORT size) override { return 0; }
SLONG getLocalDate() override { return 0; }
ISC_TIMESTAMP getCurrentGmtTimeStamp() override { ISC_TIMESTAMP ts; return ts; }

View File

@ -284,7 +284,7 @@ void BaseICU::initialize(ModuleLoader::Module* module)
}
namespace Jrd {
namespace Firebird {
// encapsulate ICU collations libraries
struct UnicodeUtil::ICU : public BaseICU
@ -519,7 +519,7 @@ static void getVersions(const string& configInfo, ObjectsArray<string>& versions
charset cs;
IntlUtil::initAsciiCharset(&cs);
AutoPtr<CharSet> ascii(Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, &cs));
AutoPtr<CharSet> ascii(Firebird::CharSet::createInstance(*getDefaultMemoryPool(), 0, &cs));
IntlUtil::SpecificAttributesMap config;
IntlUtil::parseSpecificAttributes(ascii, configInfo.length(),
@ -2111,4 +2111,4 @@ void UnicodeUtil::Utf16Collation::normalize(ULONG* strLen, const USHORT** str, b
}
} // namespace Jrd
} // namespace Firebird

View File

@ -24,8 +24,8 @@
* Contributor(s): ______________________________________.
*/
#ifndef JRD_UNICODE_UTIL_H
#define JRD_UNICODE_UTIL_H
#ifndef COMMON_UNICODE_UTIL_H
#define COMMON_UNICODE_UTIL_H
#include "intlobj_new.h"
#include "../common/IntlUtil.h"
@ -40,7 +40,7 @@
struct UCollator;
struct USet;
namespace Jrd {
namespace Firebird {
class UnicodeUtil
{
@ -262,6 +262,6 @@ public:
friend class Utf16Collation;
};
} // namespace Jrd
} // namespace Firebird
#endif // JRD_UNICODE_UTIL_H
#endif // COMMON_UNICODE_UTIL_H

View File

@ -39,6 +39,8 @@
#include "gen/parse.h"
namespace Firebird {
class CharSet;
namespace Arg {
class StatusVector;
} // namespace
@ -46,8 +48,6 @@ namespace Arg {
namespace Jrd {
class CharSet;
class Parser : public Firebird::PermanentStorage
{
private:
@ -371,9 +371,9 @@ private:
USHORT db_dialect;
const bool requireSemicolon;
USHORT parser_version;
CharSet* charSet;
Firebird::CharSet* charSet;
CharSet* metadataCharSet;
Firebird::CharSet* metadataCharSet;
Firebird::string transformedString;
Firebird::GenericMap<Firebird::NonPooled<IntlString*, StrMark> > strMarks;
bool stmt_ambiguous;

View File

@ -43,7 +43,7 @@ bool CSICU_charset_init(charset* cs,
const ASCII* charSetName)
{
UErrorCode status = U_ZERO_ERROR;
Jrd::UnicodeUtil::ConversionICU& cIcu(Jrd::UnicodeUtil::getConversionICU());
Firebird::UnicodeUtil::ConversionICU& cIcu(Firebird::UnicodeUtil::getConversionICU());
UConverter* conv = cIcu.ucnv_open(charSetName, &status);
if (U_SUCCESS(status))

View File

@ -34,7 +34,7 @@
static UConverter* create_converter(csconvert* cv, UErrorCode* status)
{
Jrd::UnicodeUtil::ConversionICU& cIcu(Jrd::UnicodeUtil::getConversionICU());
Firebird::UnicodeUtil::ConversionICU& cIcu(Firebird::UnicodeUtil::getConversionICU());
UConverter* conv = cIcu.ucnv_open(cv->csconvert_impl->cs->charset_name, status);
const void* oldContext;
@ -90,7 +90,7 @@ static ULONG unicode_to_icu(csconvert* cv,
Firebird::Aligner<UChar> alignedSource(src, srcLen);
const UChar* source = alignedSource;
char* target = reinterpret_cast<char*>(dst);
Jrd::UnicodeUtil::ConversionICU& cIcu(Jrd::UnicodeUtil::getConversionICU());
Firebird::UnicodeUtil::ConversionICU& cIcu(Firebird::UnicodeUtil::getConversionICU());
cIcu.ucnv_fromUnicode(conv, &target, target + dstLen, &source,
source + srcLen / sizeof(UChar), NULL, TRUE, &status);
@ -146,7 +146,7 @@ static ULONG icu_to_unicode(csconvert* cv,
const char* source = reinterpret_cast<const char*>(src);
Firebird::OutAligner<UChar> alignedTarget(dst, dstLen);
UChar* target = alignedTarget;
Jrd::UnicodeUtil::ConversionICU& cIcu(Jrd::UnicodeUtil::getConversionICU());
Firebird::UnicodeUtil::ConversionICU& cIcu(Firebird::UnicodeUtil::getConversionICU());
cIcu.ucnv_toUnicode(conv, &target, target + dstLen / sizeof(UChar), &source,
source + srcLen, NULL, TRUE, &status);

View File

@ -49,7 +49,7 @@ namespace {
struct TextTypeImpl
{
Jrd::CharSet* charSet;
Firebird::CharSet* charSet;
charset cs;
const ULONG* lower_exceptions;
const ULONG* upper_exceptions;
@ -136,7 +136,7 @@ static inline bool FAMILY_ASCII(texttype* cache,
memset(&impl->cs, 0, sizeof(impl->cs));
LD_lookup_charset(&impl->cs, cs_name, config_info);
impl->charSet = Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, &impl->cs);
impl->charSet = Firebird::CharSet::createInstance(*getDefaultMemoryPool(), 0, &impl->cs);
impl->lower_exceptions = lower_exceptions;
impl->upper_exceptions = upper_exceptions;

View File

@ -831,11 +831,11 @@ bool LC_NARROW_family2(
impl->texttype_bytes_per_key = 0;
IntlUtil::SpecificAttributesMap map;
Jrd::CharSet* charSet = NULL;
Firebird::CharSet* charSet = NULL;
try
{
charSet = Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs);
charSet = Firebird::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs);
if (!IntlUtil::parseSpecificAttributes(charSet, specificAttributesLength, specificAttributes, &map))
{
@ -953,12 +953,12 @@ bool LC_NARROW_family3(
bool multiLevel = false;
IntlUtil::SpecificAttributesMap map;
Jrd::CharSet* charSet = NULL;
Firebird::CharSet* charSet = NULL;
string newSpecificAttributes;
try
{
charSet = Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs);
charSet = Firebird::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs);
if (!IntlUtil::parseSpecificAttributes(charSet, specificAttributesLength, specificAttributes, &map))
{

View File

@ -62,6 +62,10 @@ namespace Replication
class TableMatcher;
}
namespace Firebird {
class TextType;
}
class CharSetContainer;
namespace Jrd
@ -84,7 +88,6 @@ namespace Jrd
class ArrayField;
struct sort_context;
class vcl;
class TextType;
class Parameter;
class jrd_fld;
class dsql_dbb;

View File

@ -603,7 +603,7 @@ private:
//
// Matches is not a case-sensitive operation, thus it has no
// 8-bit international impact.
static bool matches(MemoryPool& pool, Jrd::TextType* obj, const CharType* p1,
static bool matches(MemoryPool& pool, TextType* obj, const CharType* p1,
SLONG l1_bytes, const CharType* p2, SLONG l2_bytes)
{
fb_assert(p1 != NULL);
@ -687,7 +687,7 @@ public:
private:
// Evaluate the "sleuth" search operator.
static bool aux(Jrd::TextType* obj, USHORT flags,
static bool aux(TextType* obj, USHORT flags,
const CharType* search, const CharType* end_search,
const CharType* match, const CharType* end_match)
{
@ -817,7 +817,7 @@ private:
// See if a character is a member of a class.
// Japanese version operates on short-based buffer,
// instead of SCHAR-based.
static bool className(Jrd::TextType* obj, // USHORT flags,
static bool className(TextType* obj, // USHORT flags,
const CharType* char_class, const CharType* const end_class, CharType character)
{
fb_assert(char_class != NULL);
@ -867,7 +867,7 @@ private:
// The silly loop setting *v++ to zero initializes the array up to the
// highest character defined (also max_op). Believe it or not, that part
// is not a bug.
static ULONG actualMerge(/*MemoryPool& pool,*/ Jrd::TextType* obj,
static ULONG actualMerge(/*MemoryPool& pool,*/ TextType* obj,
const CharType* match, SLONG match_bytes,
const CharType* control, SLONG control_bytes,
CharType* combined) //, SLONG combined_bytes)

View File

@ -38,14 +38,14 @@ namespace Jrd {
class Lock;
class BaseSubstringSimilarMatcher;
class Collation : public TextType
class Collation : public Firebird::TextType
{
public:
static Collation* createInstance(MemoryPool& pool, TTYPE_ID id, texttype* tt, USHORT attributes, CharSet* cs);
static Collation* createInstance(MemoryPool& pool, TTYPE_ID id, texttype* tt, USHORT attributes, Firebird::CharSet* cs);
protected:
Collation(TTYPE_ID id, texttype *a_tt, USHORT a_attributes, CharSet* a_cs)
: TextType(id, a_tt, a_attributes, a_cs),
Collation(TTYPE_ID id, texttype *a_tt, USHORT a_attributes, Firebird::CharSet* a_cs)
: Firebird::TextType(id, a_tt, a_attributes, a_cs),
useCount(0),
existenceLock(NULL),
obsolete(false)

View File

@ -55,9 +55,9 @@ namespace Jrd
public:
virtual bool transliterate(const dsc* from, dsc* to, CHARSET_ID&);
virtual CHARSET_ID getChid(const dsc* d);
virtual CharSet* getToCharset(CHARSET_ID charset2);
virtual void validateData(CharSet* toCharset, SLONG length, const UCHAR* q);
virtual ULONG validateLength(CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
virtual Firebird::CharSet* getToCharset(CHARSET_ID charset2);
virtual void validateData(Firebird::CharSet* toCharset, SLONG length, const UCHAR* q);
virtual ULONG validateLength(Firebird::CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
const USHORT size);
virtual SLONG getLocalDate();
virtual ISC_TIMESTAMP getCurrentGmtTimeStamp();
@ -76,7 +76,7 @@ namespace Jrd
{
}
virtual ULONG validateLength(CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
virtual ULONG validateLength(Firebird::CharSet* charSet, CHARSET_ID charSetId, ULONG length, const UCHAR* start,
const USHORT size);
private:

View File

@ -4044,7 +4044,7 @@ static string remove_icu_info_from_attributes(const string& charsetName, const s
{
DbgRebuildIntl::out("Remove_icu_info_from_attributes for charset '%s'\n", charsetName.c_str());
AutoPtr<Jrd::CharSet> charSet(Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs));
AutoPtr<Firebird::CharSet> charSet(Firebird::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs));
IntlUtil::SpecificAttributesMap map;
if (IntlUtil::parseSpecificAttributes(charSet, specificAttributes.length(),
(const UCHAR*) specificAttributes.begin(), &map))

View File

@ -15,7 +15,7 @@
#include "../common/classes/Aligner.h"
using Firebird::IntlUtil;
using Jrd::UnicodeUtil;
using Firebird::UnicodeUtil;
static USHORT internal_keylength(texttype*, USHORT);

View File

@ -42,7 +42,7 @@ namespace Jrd {
class PatternMatcher
{
public:
PatternMatcher(MemoryPool& aPool, TextType* aTextType)
PatternMatcher(MemoryPool& aPool, Firebird::TextType* aTextType)
: pool(aPool),
textType(aTextType)
{
@ -58,13 +58,13 @@ public:
protected:
MemoryPool& pool;
TextType* textType;
Firebird::TextType* textType;
};
class BaseSubstringSimilarMatcher : public PatternMatcher
{
public:
BaseSubstringSimilarMatcher(MemoryPool& pool, TextType* ttype)
BaseSubstringSimilarMatcher(MemoryPool& pool, Firebird::TextType* ttype)
: PatternMatcher(pool, ttype)
{
}
@ -75,7 +75,7 @@ public:
class NullStrConverter
{
public:
NullStrConverter(MemoryPool& /*pool*/, const TextType* /*obj*/, const UCHAR* /*str*/, SLONG /*len*/)
NullStrConverter(MemoryPool& /*pool*/, const Firebird::TextType* /*obj*/, const UCHAR* /*str*/, SLONG /*len*/)
{
}
};
@ -84,7 +84,7 @@ template <typename PrevConverter = NullStrConverter>
class UpcaseConverter : public PrevConverter
{
public:
UpcaseConverter(MemoryPool& pool, TextType* obj, const UCHAR*& str, SLONG& len)
UpcaseConverter(MemoryPool& pool, Firebird::TextType* obj, const UCHAR*& str, SLONG& len)
: PrevConverter(pool, obj, str, len)
{
const auto charSet = obj->getCharSet();
@ -102,7 +102,7 @@ template <typename PrevConverter = NullStrConverter>
class CanonicalConverter : public PrevConverter
{
public:
CanonicalConverter(MemoryPool& pool, TextType* obj, const UCHAR*& str, SLONG& len)
CanonicalConverter(MemoryPool& pool, Firebird::TextType* obj, const UCHAR*& str, SLONG& len)
: PrevConverter(pool, obj, str, len)
{
const SLONG out_len = len / obj->getCharSet()->minBytesPerChar() * obj->getCanonicalWidth();

View File

@ -41,13 +41,13 @@ CHARSET_ID INTL_charset(Jrd::thread_db*, USHORT);
int INTL_compare(Jrd::thread_db*, const dsc*, const dsc*, ErrorFunction);
ULONG INTL_convert_bytes(Jrd::thread_db*, CHARSET_ID, UCHAR*, const ULONG, CHARSET_ID,
const BYTE*, const ULONG, ErrorFunction);
Jrd::CsConvert INTL_convert_lookup(Jrd::thread_db*, CHARSET_ID, CHARSET_ID);
Firebird::CsConvert INTL_convert_lookup(Jrd::thread_db*, CHARSET_ID, CHARSET_ID);
void INTL_convert_string(dsc*, const dsc*, Firebird::Callbacks* cb);
bool INTL_data(const dsc*);
bool INTL_data_or_binary(const dsc*);
bool INTL_defined_type(Jrd::thread_db*, USHORT);
USHORT INTL_key_length(Jrd::thread_db*, USHORT, USHORT);
Jrd::CharSet* INTL_charset_lookup(Jrd::thread_db* tdbb, USHORT parm1);
Firebird::CharSet* INTL_charset_lookup(Jrd::thread_db* tdbb, USHORT parm1);
Jrd::Collation* INTL_texttype_lookup(Jrd::thread_db* tdbb, USHORT parm1);
void INTL_texttype_unload(Jrd::thread_db*, USHORT);
bool INTL_texttype_validate(Jrd::thread_db*, const SubtypeInfo*);

View File

@ -99,6 +99,10 @@ namespace EDS {
class Connection;
}
namespace Firebird {
class TextType;
}
namespace Jrd {
const unsigned MAX_CALLBACKS = 50;
@ -121,7 +125,6 @@ class IndexLock;
class ArrayField;
struct sort_context;
class vcl;
class TextType;
class Parameter;
class jrd_fld;
class dsql_dbb;