8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 02:03:03 +01:00
This commit is contained in:
asfernandes 2008-02-28 02:43:23 +00:00
parent 20a874aae4
commit 1305691003
11 changed files with 28 additions and 24 deletions

View File

@ -188,22 +188,23 @@ INTL_BOOL CVBIG5_check_big5(charset* cs,
**************************************/ **************************************/
const UCHAR* big5_str_start = big5_str; const UCHAR* big5_str_start = big5_str;
while (big5_len--) { while (big5_len--)
{
const UCHAR c1 = *big5_str; const UCHAR c1 = *big5_str;
if (BIG51(c1)) { /* Is it BIG-5 */ if (BIG51(c1)) // Is it BIG-5
{
if (big5_len == 0) /* truncated BIG-5 */ if (big5_len == 0) /* truncated BIG-5 */
{ {
if (offending_position) if (offending_position)
*offending_position = big5_str - big5_str_start; *offending_position = big5_str - big5_str_start;
return (false); return (false);
} }
big5_str += 2; big5_str += 2;
big5_len -= 1; big5_len -= 1;
} }
else { /* it is a ASCII */ else // it is a ASCII
big5_str++; big5_str++;
}
} }
return (true); return (true);
} }

View File

@ -591,8 +591,9 @@ static USHORT CVJIS_check_sjis(const UCHAR* sjis_str, USHORT sjis_len)
const UCHAR c1 = *sjis_str; const UCHAR c1 = *sjis_str;
if (SJIS1(c1)) { /* It is a KANJI */ if (SJIS1(c1)) { /* It is a KANJI */
if (sjis_len == 0) { /* truncated KANJI */ if (sjis_len == 0) { /* truncated KANJI */
return (1); return 1;
} }
sjis_str += 2; sjis_str += 2;
sjis_len -= 1; sjis_len -= 1;
} }

View File

@ -189,6 +189,7 @@ INTL_BOOL CVKSC_check_ksc(charset* cs,
*offending_position = ksc_str - ksc_str_start; *offending_position = ksc_str - ksc_str_start;
return (false); return (false);
} }
ksc_str += 2; ksc_str += 2;
ksc_len -= 1; ksc_len -= 1;
} }

View File

@ -71,6 +71,7 @@ USHORT KANJI_check_euc(const UCHAR* euc_str, USHORT euc_len)
if (euc_len == 0) { /* truncated kanji */ if (euc_len == 0) { /* truncated kanji */
return (1); return (1);
} }
euc_str += 2; euc_str += 2;
euc_len -= 1; euc_len -= 1;
} }
@ -103,6 +104,7 @@ USHORT KANJI_check_sjis(const UCHAR* sjis_str, USHORT sjis_len)
if (sjis_len == 0) { /* truncated KANJI */ if (sjis_len == 0) { /* truncated KANJI */
return (1); return (1);
} }
sjis_str += 2; sjis_str += 2;
sjis_len -= 1; sjis_len -= 1;
} }

View File

@ -150,12 +150,13 @@ bool LCICU_texttype_init(texttype* tt,
tt, name, charSetName, attributes, tt, name, charSetName, attributes,
specificAttributes, specificAttributesLength, configInfo); specificAttributes, specificAttributesLength, configInfo);
} }
if (len > 8 && strcmp(name + len - 8, "_UNICODE") == 0) if (len > 8 && strcmp(name + len - 8, "_UNICODE") == 0)
{ {
return texttype_unicode_init( return texttype_unicode_init(
tt, name, charSetName, attributes, tt, name, charSetName, attributes,
specificAttributes, specificAttributesLength, configInfo); specificAttributes, specificAttributesLength, configInfo);
} }
return false; return false;
} }

View File

@ -78,7 +78,7 @@ TEXTTYPE_ENTRY(ksc_5601_dict_init)
cache->texttype_fn_compare = LCKSC_compare; cache->texttype_fn_compare = LCKSC_compare;
return true; return true;
} }
return false; return false;
} }
@ -269,13 +269,13 @@ static SSHORT LCKSC_compare(texttype* obj, ULONG l1, const BYTE* s1, ULONG l2, c
continue; continue;
if (key1[i] < key2[i]) if (key1[i] < key2[i])
return -1; return -1;
return 1; return 1;
} }
if (len1 < len2) if (len1 < len2)
return -1; return -1;
if (len1 > len2) if (len1 > len2)
return 1; return 1;
return 0; return 0;
} }

View File

@ -502,7 +502,7 @@ static const SortOrderTblEntry* get_coltab_entry(texttype* obj, const UCHAR** p,
stat->stat_flags |= LC_HAVE_SPECIAL; stat->stat_flags |= LC_HAVE_SPECIAL;
continue; continue;
} }
if (!((col->IsExpand && !(obj->texttype_impl->texttype_flags & TEXTTYPE_disable_expansions)) || if (!((col->IsExpand && !(obj->texttype_impl->texttype_flags & TEXTTYPE_disable_expansions)) ||
(col->IsCompress && !(obj->texttype_impl->texttype_flags & TEXTTYPE_disable_compressions)))) (col->IsCompress && !(obj->texttype_impl->texttype_flags & TEXTTYPE_disable_compressions))))
{ {
@ -511,7 +511,7 @@ static const SortOrderTblEntry* get_coltab_entry(texttype* obj, const UCHAR** p,
(*p)++; (*p)++;
return col; return col;
} }
if (col->IsExpand) { if (col->IsExpand) {
const ExpandChar* exp = &((const ExpandChar*) obj->texttype_impl->texttype_expand_table)[0]; const ExpandChar* exp = &((const ExpandChar*) obj->texttype_impl->texttype_expand_table)[0];
while (exp->Ch && exp->Ch != **p) while (exp->Ch && exp->Ch != **p)
@ -526,7 +526,7 @@ static const SortOrderTblEntry* get_coltab_entry(texttype* obj, const UCHAR** p,
stat->stat_flags |= LC_HAVE_WAITING; stat->stat_flags |= LC_HAVE_WAITING;
return col; return col;
} }
/* (col->IsCompress) */ /* (col->IsCompress) */
if (*l > 1) { if (*l > 1) {
const CompressPair* cmp = const CompressPair* cmp =
@ -694,6 +694,7 @@ static SSHORT old_fam2_compare(texttype* obj, ULONG l1, const BYTE* s1,
return (1); return (1);
} }
if (len1 < len2) if (len1 < len2)
return (-1); return (-1);
if (len1 > len2) if (len1 > len2)
@ -1017,7 +1018,7 @@ bool LC_NARROW_family3(
return true; return true;
} }
return false; return false;
} }

View File

@ -572,13 +572,13 @@ ULONG FB_DLL_EXPORT LD_setup_attributes(
if (dstLen == 0) if (dstLen == 0)
return newSpecificAttributes.length(); return newSpecificAttributes.length();
if (newSpecificAttributes.length() <= dstLen) if (newSpecificAttributes.length() <= dstLen)
{ {
memcpy(dst, newSpecificAttributes.begin(), newSpecificAttributes.length()); memcpy(dst, newSpecificAttributes.begin(), newSpecificAttributes.length());
return newSpecificAttributes.length(); return newSpecificAttributes.length();
} }
return INTL_BAD_STR_LENGTH; return INTL_BAD_STR_LENGTH;
} }

View File

@ -1749,9 +1749,7 @@ UCHAR* ISC_map_file(
initialized shared memory. */ initialized shared memory. */
make_object_name(expanded_filename, sizeof(expanded_filename), filename, "_event"); make_object_name(expanded_filename, sizeof(expanded_filename), filename, "_event");
event_handle = event_handle = CreateEvent(ISC_get_security_desc(), TRUE, FALSE, expanded_filename);
CreateEvent(ISC_get_security_desc(), TRUE, FALSE,
expanded_filename);
if (!event_handle) { if (!event_handle) {
error(status_vector, "CreateEvent", GetLastError()); error(status_vector, "CreateEvent", GetLastError());
CloseHandle(file_handle); CloseHandle(file_handle);

View File

@ -982,11 +982,13 @@ static void release_io_event(jrd_file* file, OVERLAPPED* overlapped)
Firebird::MutexLockGuard guard(file->fil_mutex); Firebird::MutexLockGuard guard(file->fil_mutex);
for (int i = 0; i < MAX_FILE_IO; i++) for (int i = 0; i < MAX_FILE_IO; i++)
{
if (!file->fil_io_events[i]) { if (!file->fil_io_events[i]) {
file->fil_io_events[i] = overlapped->hEvent; file->fil_io_events[i] = overlapped->hEvent;
overlapped->hEvent = NULL; overlapped->hEvent = NULL;
break; break;
} }
}
if (overlapped->hEvent) if (overlapped->hEvent)
CloseHandle(overlapped->hEvent); CloseHandle(overlapped->hEvent);

View File

@ -1079,7 +1079,7 @@ USHORT UnicodeUtil::Utf16Collation::stringToKey(USHORT srcLen, const USHORT* src
srcLen = pad - src + 1; srcLen = pad - src + 1;
} }
const UCollator* coll = 0; const UCollator* coll = NULL;
switch (key_type) switch (key_type)
{ {
@ -1093,8 +1093,7 @@ USHORT UnicodeUtil::Utf16Collation::stringToKey(USHORT srcLen, const USHORT* src
{ {
UChar str[10]; UChar str[10];
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
int len = icu->usetGetItem(contractions, int len = icu->usetGetItem(contractions, i, NULL, NULL, str, sizeof(str), &status);
i, NULL, NULL, str, sizeof(str), &status);
if (len > srcLen) if (len > srcLen)
len = srcLen; len = srcLen;
@ -1237,8 +1236,6 @@ UnicodeUtil::ICU* UnicodeUtil::Utf16Collation::loadICU(
if (!icu) if (!icu)
continue; continue;
//UErrorCode status = U_ZERO_ERROR;
if (locale.hasData()) if (locale.hasData())
{ {
int avail = icu->ulocCountAvailable(); int avail = icu->ulocCountAvailable();