Fix bug 207634 bustage - checked in wrong version of mac changes

This commit is contained in:
neil%parkwaycc.co.uk 2003-07-24 21:56:54 +00:00
Родитель 995c801fa9
Коммит a8d52f6aae
2 изменённых файлов: 21 добавлений и 25 удалений

Просмотреть файл

@ -213,7 +213,7 @@ nsresult nsCollationMac::CompareString(const nsCollationStrength strength,
if (NS_SUCCEEDED(res)) {
res = AllocateRawSortKey(strength, string2, &aKey2, &aLength2);
if (NS_SUCCEEDED(res))
*result = strcmp((const char *)key1, (const char *)key2); // compare keys
*result = strcmp((const char *)aKey1, (const char *)aKey2); // compare keys
}
// delete keys
@ -243,7 +243,7 @@ nsresult nsCollationMac::AllocateRawSortKey(const nsCollationStrength strength,
res = mCollation->UnicodeToChar(stringNormalized, &str);
if (NS_SUCCEEDED(res) && str != NULL) {
str_len = strlen(str);
*key = str;
*key = (PRUint8 *)str;
*outLen = str_len + 1;
// If no CJK then generate a collation key
@ -254,28 +254,23 @@ nsresult nsCollationMac::AllocateRawSortKey(const nsCollationStrength strength,
++str;
}
}
else {
// No CJK support, just copy the row string.
// Collation key is not a string, use memcpy instead of strcpy.
// No CJK support, just copy the row string.
// ShiftJIS specific, shift hankaku kana in front of zenkaku.
else if (smJapanese == m_scriptcode) {
while (*str) {
if ((unsigned char) *str >= 128) {
// ShiftJIS specific, shift hankaku kana in front of zenkaku.
if (smJapanese == m_scriptcode) {
if (*str >= 0xA0 && *str < 0xE0) {
*str -= (0xA0 - 0x81);
}
else if (*str >= 0x81 && *str < 0xA0) {
*str += (0xE0 - 0xA0);
}
}
// advance 2 bytes if the API says so and not passing the end of the string
if (CharacterByteType((Ptr) str, 0, m_scriptcode) == smFirstByte) {
++str;
if (!*str)
break;
}
if ((unsigned char) *str >= 0xA0 && (unsigned char) *str < 0xE0) {
*str -= (0xA0 - 0x81);
}
++str;
else if ((unsigned char) *str >= 0x81 && (unsigned char) *str < 0xA0) {
*str += (0xE0 - 0xA0);
}
// advance 2 bytes if the API says so and not passing the end of the string
if (CharacterByteType((Ptr) str, 0, m_scriptcode) == smFirstByte) {
++str;
if (!*str)
break;
}
++str;
}
}
}

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsCollationMacUC.h"
#include "nsILocaleService.h"
#include "nsIServiceManager.h"
#include "prmem.h"
////////////////////////////////////////////////////////////////////////////////
@ -77,7 +78,7 @@ nsresult nsCollationMacUC::StrengthToOptions(
UCCollateOptions options = kUCCollateStandardOptions | kUCCollatePunctuationSignificantMask;
if (aStrength & kCollationCaseInsensitiveAscii)
options |= kUCCollateCaseInsensitiveMask;
if (aStrength & kCollationAccentInsensitive)
if (aStrength & kCollationAccentInsenstive)
options |= kUCCollateDiacritInsensitiveMask;
*aOptions = options;
return NS_OK;
@ -222,7 +223,7 @@ NS_IMETHODIMP nsCollationMacUC::CompareString(
err = ::UCCompareText(mCollator,
(const UniChar *) PromiseFlatString(string1).get(), (UniCharCount) string1.Length(),
(const UniChar *) PromiseFlatString(string2).get(), (UniCharCount) string2.Length(),
NULL, &result);
NULL, result);
NS_ENSURE_TRUE((err == noErr), NS_ERROR_FAILURE);
return NS_OK;
@ -243,7 +244,7 @@ NS_IMETHODIMP nsCollationMacUC::CompareRawSortKey(
OSStatus err;
err = ::UCCompareCollationKeys((const UCCollationValue*) key1, (ItemCount) len1,
(const UCCollationValue*) key2, (ItemCount) len2,
NULL, &result);
NULL, result);
NS_ENSURE_TRUE((err == noErr), NS_ERROR_FAILURE);
return NS_OK;