diff --git a/doc/README.intl b/doc/README.intl index 6df55b9a7b..11e27dcae0 100644 --- a/doc/README.intl +++ b/doc/README.intl @@ -277,18 +277,18 @@ Format: SPECIALS-FIRST={0 | 1} Example: SPECIALS-FIRST=1 -NUMERIC: Specify how numbers are sorted. +NUMERIC-SORT: Specify how numbers are sorted. Valid for: UNICODE collations. -Format: NUMERIC={0 | 1} (0 is the default) +Format: NUMERIC-SORT={0 | 1} (0 is the default) -NUMERIC=0 sorts number in alphabetic order. Example: +NUMERIC-SORT=0 sorts number in alphabetic order. Example: 1 10 100 2 20 -NUMERIC=1 sorts number in numeric order. Example: +NUMERIC-SORT=1 sorts number in numeric order. Example: 1 2 10 diff --git a/src/common/classes/ClumpletWriter.cpp b/src/common/classes/ClumpletWriter.cpp index fedcce78bb..043bf19a46 100644 --- a/src/common/classes/ClumpletWriter.cpp +++ b/src/common/classes/ClumpletWriter.cpp @@ -125,7 +125,7 @@ void ClumpletWriter::toVaxInteger(UCHAR* ptr, size_t length, SINT64 value) { int shift = 0; while (length--) { - *ptr++ = (UCHAR)(value >> shift); + *ptr++ = (UCHAR) (value >> shift); shift += 8; } } diff --git a/src/jrd/isc_sync.cpp b/src/jrd/isc_sync.cpp index 3d1b7d1b6c..17adfb962b 100644 --- a/src/jrd/isc_sync.cpp +++ b/src/jrd/isc_sync.cpp @@ -1855,16 +1855,18 @@ UCHAR* ISC_map_file( return NULL; } else + { if (!init_flag && GetLastError() != ERROR_ALREADY_EXISTS) { - /* We have made header_obj but we are not initializing - Previous owner is closed and clear all header_data. - One need to retry */ + // We have made header_obj but we are not initializing. + // Previous owner is closed and clear all header_data. + // One need to retry. CloseHandle(header_obj); CloseHandle(event_handle); CloseHandle(file_handle); goto retry; } + } SLONG* header_address = (SLONG*) MapViewOfFile(header_obj, FILE_MAP_WRITE, 0, 0, 0); diff --git a/src/jrd/unicode_util.cpp b/src/jrd/unicode_util.cpp index b07d7da337..5401b5df71 100644 --- a/src/jrd/unicode_util.cpp +++ b/src/jrd/unicode_util.cpp @@ -954,13 +954,13 @@ UnicodeUtil::Utf16Collation* UnicodeUtil::Utf16Collation::create( return NULL; } - string numeric; - if (specificAttributes.get(IntlUtil::convertAsciiToUtf16("NUMERIC"), numeric)) + string numericSort; + if (specificAttributes.get(IntlUtil::convertAsciiToUtf16("NUMERIC-SORT"), numericSort)) { ++attributeCount; - numeric = IntlUtil::convertUtf16ToAscii(numeric, &error); - if (error || !(numeric == "0" || numeric == "1")) + numericSort = IntlUtil::convertUtf16ToAscii(numericSort, &error); + if (error || !(numericSort == "0" || numericSort == "1")) return NULL; } @@ -1025,8 +1025,8 @@ UnicodeUtil::Utf16Collation* UnicodeUtil::Utf16Collation::create( else tt->texttype_flags = TEXTTYPE_DIRECT_MATCH; - const bool isNumeric = numeric == "1"; - if (isNumeric) + const bool isNumericSort = numericSort == "1"; + if (isNumericSort) { icu->ucolSetAttribute(compareCollator, UCOL_NUMERIC_COLLATION, UCOL_ON, &status); icu->ucolSetAttribute(partialCollator, UCOL_NUMERIC_COLLATION, UCOL_ON, &status); @@ -1046,7 +1046,7 @@ UnicodeUtil::Utf16Collation* UnicodeUtil::Utf16Collation::create( obj->sortCollator = sortCollator; obj->contractions = contractions; obj->contractionsCount = icu->usetGetItemCount(contractions); - obj->numeric = isNumeric; + obj->numericSort = isNumericSort; return obj; } @@ -1127,8 +1127,10 @@ USHORT UnicodeUtil::Utf16Collation::stringToKey(USHORT srcLen, const USHORT* src } } - if (numeric) + if (numericSort) { + // ASF: Wee need to remove trailing numbers to return sub key that + // matches full key. Example: "abc1" becomes "abc" to match "abc10". const USHORT* p = src + srcLen - 1; for (; p >= src; --p) diff --git a/src/jrd/unicode_util.h b/src/jrd/unicode_util.h index c35c639e18..05f84e18df 100644 --- a/src/jrd/unicode_util.h +++ b/src/jrd/unicode_util.h @@ -103,7 +103,7 @@ public: UCollator* sortCollator; USet* contractions; int contractionsCount; - bool numeric; + bool numericSort; }; friend class Utf16Collation;