8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:43:04 +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;
while (big5_len--) {
while (big5_len--)
{
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 (offending_position)
*offending_position = big5_str - big5_str_start;
return (false);
}
big5_str += 2;
big5_len -= 1;
}
else { /* it is a ASCII */
else // it is a ASCII
big5_str++;
}
}
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;
if (SJIS1(c1)) { /* It is a KANJI */
if (sjis_len == 0) { /* truncated KANJI */
return (1);
return 1;
}
sjis_str += 2;
sjis_len -= 1;
}

View File

@ -189,6 +189,7 @@ INTL_BOOL CVKSC_check_ksc(charset* cs,
*offending_position = ksc_str - ksc_str_start;
return (false);
}
ksc_str += 2;
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 */
return (1);
}
euc_str += 2;
euc_len -= 1;
}
@ -103,6 +104,7 @@ USHORT KANJI_check_sjis(const UCHAR* sjis_str, USHORT sjis_len)
if (sjis_len == 0) { /* truncated KANJI */
return (1);
}
sjis_str += 2;
sjis_len -= 1;
}

View File

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

View File

@ -78,7 +78,7 @@ TEXTTYPE_ENTRY(ksc_5601_dict_init)
cache->texttype_fn_compare = LCKSC_compare;
return true;
}
return false;
}
@ -269,13 +269,13 @@ static SSHORT LCKSC_compare(texttype* obj, ULONG l1, const BYTE* s1, ULONG l2, c
continue;
if (key1[i] < key2[i])
return -1;
return 1;
}
if (len1 < len2)
return -1;
if (len1 > len2)
return 1;
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;
continue;
}
if (!((col->IsExpand && !(obj->texttype_impl->texttype_flags & TEXTTYPE_disable_expansions)) ||
(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)++;
return col;
}
if (col->IsExpand) {
const ExpandChar* exp = &((const ExpandChar*) obj->texttype_impl->texttype_expand_table)[0];
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;
return col;
}
/* (col->IsCompress) */
if (*l > 1) {
const CompressPair* cmp =
@ -694,6 +694,7 @@ static SSHORT old_fam2_compare(texttype* obj, ULONG l1, const BYTE* s1,
return (1);
}
if (len1 < len2)
return (-1);
if (len1 > len2)
@ -1017,7 +1018,7 @@ bool LC_NARROW_family3(
return true;
}
return false;
}

View File

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

View File

@ -1749,9 +1749,7 @@ UCHAR* ISC_map_file(
initialized shared memory. */
make_object_name(expanded_filename, sizeof(expanded_filename), filename, "_event");
event_handle =
CreateEvent(ISC_get_security_desc(), TRUE, FALSE,
expanded_filename);
event_handle = CreateEvent(ISC_get_security_desc(), TRUE, FALSE, expanded_filename);
if (!event_handle) {
error(status_vector, "CreateEvent", GetLastError());
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);
for (int i = 0; i < MAX_FILE_IO; i++)
{
if (!file->fil_io_events[i]) {
file->fil_io_events[i] = overlapped->hEvent;
overlapped->hEvent = NULL;
break;
}
}
if (overlapped->hEvent)
CloseHandle(overlapped->hEvent);

View File

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