diff --git a/src/common/intlobj_new.h b/src/common/intlobj_new.h index 395d725e26..dfaa8d9d16 100644 --- a/src/common/intlobj_new.h +++ b/src/common/intlobj_new.h @@ -275,8 +275,9 @@ typedef void (*pfn_INTL_cs_destroy) ( #define CHARSET_VERSION_1 1 /* charset flag values */ -#define CHARSET_LEGACY_SEMANTICS 1 /* MBCS strings may overflow declared lengths - in characters (but not in bytes) */ + +/* MBCS strings may overflow declared lengths in characters (but not in bytes) */ +/* Removed from FB 4 - #define CHARSET_LEGACY_SEMANTICS 1 */ #define CHARSET_ASCII_BASED 2 /* Value of ASCII characters is equal to the ASCII character set */ diff --git a/src/intl/cs_big5.cpp b/src/intl/cs_big5.cpp index 4d5f2d3a00..c115aa7053 100644 --- a/src/intl/cs_big5.cpp +++ b/src/intl/cs_big5.cpp @@ -33,7 +33,7 @@ CHARSET_ENTRY(CS_big_5) csptr->charset_version = CHARSET_VERSION_1; csptr->charset_name = POSIX; - csptr->charset_flags |= CHARSET_LEGACY_SEMANTICS | CHARSET_ASCII_BASED; + csptr->charset_flags |= CHARSET_ASCII_BASED; csptr->charset_min_bytes_per_char = 1; csptr->charset_max_bytes_per_char = 2; csptr->charset_space_length = 1; diff --git a/src/intl/cs_gb2312.cpp b/src/intl/cs_gb2312.cpp index eb150dcfd8..09aafad3df 100644 --- a/src/intl/cs_gb2312.cpp +++ b/src/intl/cs_gb2312.cpp @@ -33,7 +33,7 @@ CHARSET_ENTRY(CS_gb_2312) csptr->charset_version = CHARSET_VERSION_1; csptr->charset_name = POSIX; - csptr->charset_flags |= CHARSET_LEGACY_SEMANTICS | CHARSET_ASCII_BASED; + csptr->charset_flags |= CHARSET_ASCII_BASED; csptr->charset_min_bytes_per_char = 1; csptr->charset_max_bytes_per_char = 2; csptr->charset_space_length = 1; diff --git a/src/intl/cs_jis.cpp b/src/intl/cs_jis.cpp index e45358a201..b1f6846c00 100644 --- a/src/intl/cs_jis.cpp +++ b/src/intl/cs_jis.cpp @@ -56,7 +56,6 @@ CHARSET_ENTRY(CS_sjis) { CS_jis_0208_1990(csptr, NULL); //, cs_name); Second param is unused csptr->charset_name = "SJIS"; - csptr->charset_flags |= CHARSET_LEGACY_SEMANTICS; csptr->charset_min_bytes_per_char = 1; csptr->charset_space_length = 1; csptr->charset_space_character = (const BYTE*) " "; // 0x20 @@ -71,7 +70,6 @@ CHARSET_ENTRY(CS_euc_j) { CS_jis_0208_1990(csptr, NULL); //cs_name); Second param is unused csptr->charset_name = "EUC-J"; - csptr->charset_flags |= CHARSET_LEGACY_SEMANTICS; csptr->charset_min_bytes_per_char = 1; csptr->charset_space_length = 1; csptr->charset_space_character = (const BYTE*) " "; // 0x20 diff --git a/src/intl/cs_ksc.cpp b/src/intl/cs_ksc.cpp index ad8ed7fd85..9bbfe823da 100644 --- a/src/intl/cs_ksc.cpp +++ b/src/intl/cs_ksc.cpp @@ -34,7 +34,7 @@ CHARSET_ENTRY(CS_ksc_5601) csptr->charset_version = CHARSET_VERSION_1; csptr->charset_name = "KSC_5601"; - csptr->charset_flags |= CHARSET_LEGACY_SEMANTICS | CHARSET_ASCII_BASED; + csptr->charset_flags |= CHARSET_ASCII_BASED; csptr->charset_min_bytes_per_char = 1; csptr->charset_max_bytes_per_char = 2; csptr->charset_space_length = 1; diff --git a/src/intl/cs_unicode_fss.cpp b/src/intl/cs_unicode_fss.cpp index 7102d4c3ca..49dbd674b9 100644 --- a/src/intl/cs_unicode_fss.cpp +++ b/src/intl/cs_unicode_fss.cpp @@ -32,7 +32,7 @@ CHARSET_ENTRY(CS_unicode_fss) { csptr->charset_version = CHARSET_VERSION_1; csptr->charset_name = "UNICODE_FSS"; - csptr->charset_flags |= CHARSET_LEGACY_SEMANTICS | CHARSET_ASCII_BASED; + csptr->charset_flags |= CHARSET_ASCII_BASED; csptr->charset_min_bytes_per_char = 1; csptr->charset_max_bytes_per_char = 3; csptr->charset_space_length = 1; diff --git a/src/jrd/cvt.cpp b/src/jrd/cvt.cpp index 9648618160..c0ffb2e122 100644 --- a/src/jrd/cvt.cpp +++ b/src/jrd/cvt.cpp @@ -419,9 +419,7 @@ void EngineCallbacks::validateData(CharSet* toCharSet, SLONG length, const UCHAR void EngineCallbacks::validateLength(CharSet* toCharSet, SLONG toLength, const UCHAR* start, const USHORT to_size) { - if (toCharSet && - toCharSet->isMultiByte() && - !(toCharSet->getFlags() & CHARSET_LEGACY_SEMANTICS)) + if (toCharSet && toCharSet->isMultiByte()) { Jrd::thread_db* tdbb = NULL; SET_TDBB(tdbb); diff --git a/src/jrd/intl.cpp b/src/jrd/intl.cpp index 6b5fcf9f0a..b5e181a99f 100644 --- a/src/jrd/intl.cpp +++ b/src/jrd/intl.cpp @@ -547,32 +547,9 @@ void INTL_adjust_text_descriptor(thread_db* tdbb, dsc* desc) { Firebird::HalfStaticArray buffer; - if (charSet->getFlags() & CHARSET_LEGACY_SEMANTICS) - { - desc->dsc_length = charSet->substring(TEXT_LEN(desc), desc->dsc_address, TEXT_LEN(desc), - buffer.getBuffer(TEXT_LEN(desc) * charSet->maxBytesPerChar()), 0, - TEXT_LEN(desc)); - - const ULONG maxLength = TEXT_LEN(desc) / charSet->maxBytesPerChar(); - ULONG charLength = charSet->length(desc->dsc_length, desc->dsc_address, true); - - while (charLength > maxLength) - { - if (desc->dsc_address[desc->dsc_length - 1] == *charSet->getSpace()) - { - --desc->dsc_length; - --charLength; - } - else - break; - } - } - else - { - desc->dsc_length = charSet->substring(TEXT_LEN(desc), desc->dsc_address, - TEXT_LEN(desc), buffer.getBuffer(TEXT_LEN(desc)), 0, - TEXT_LEN(desc) / charSet->maxBytesPerChar()); - } + desc->dsc_length = charSet->substring(TEXT_LEN(desc), desc->dsc_address, + TEXT_LEN(desc), buffer.getBuffer(TEXT_LEN(desc)), 0, + TEXT_LEN(desc) / charSet->maxBytesPerChar()); } } } @@ -951,9 +928,7 @@ int INTL_convert_string(dsc* to, const dsc* from, ErrorFunction err) const ULONG src_len = toCharSet->length(toLength, start, false); const ULONG dest_len = (ULONG) to_size / toCharSet->maxBytesPerChar(); - if (toCharSet->isMultiByte() && - !(toCharSet->getFlags() & CHARSET_LEGACY_SEMANTICS) && - src_len > dest_len) + if (toCharSet->isMultiByte() && src_len > dest_len) { err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_string_truncation) << Arg::Gds(isc_trunc_limits) << Arg::Num(dest_len) << Arg::Num(src_len)); diff --git a/src/jrd/intl_builtin.cpp b/src/jrd/intl_builtin.cpp index 30c958a588..36664c5ac6 100644 --- a/src/jrd/intl_builtin.cpp +++ b/src/jrd/intl_builtin.cpp @@ -1459,7 +1459,6 @@ static INTL_BOOL cs_unicode_fss_init(charset* csptr, IntlUtil::initNarrowCharset(csptr, "UNICODE_FSS"); csptr->charset_max_bytes_per_char = 3; - csptr->charset_flags |= CHARSET_LEGACY_SEMANTICS; IntlUtil::initConvert(&csptr->charset_to_unicode, internal_fss_to_unicode); IntlUtil::initConvert(&csptr->charset_from_unicode, internal_unicode_to_fss);