[Webkit-unassigned] [Bug 147604] [INTL] Implement Collator Compare Functions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 17 04:16:08 PST 2015


https://bugs.webkit.org/show_bug.cgi?id=147604

--- Comment #28 from Sukolsak Sakshuwong <sukolsak at gmail.com> ---
Three new changes:

1. Include <unicode/uiter.h> in Collator.h to fix the build issue on Windows.

I tried using WTF_EXPORT_PRIVATE on UCharIterator createIterator(StringView) in Collator.h but I got the same error message, except that there was "__declspec(dllimport)" at the beginning of the declaration (https://webkit-queues.webkit.org/results/567993). It looks like we need to include the definition of UCharIterator.

2. Only check for U_FAILURE(status) after the last ucol_setAttribute.

ucol_setAttribute returns immediately if U_FAILURE(status) is true. (See the source code at http://source.icu-project.org/repos/icu/icu/trunk/source/i18n/ucol.cpp) So, there's no harm in calling ucol_setAttribute consecutively. The ICU coding guidelines also state that "It is not necessary to check for U_FAILURE() immediately before calling a function that takes a UErrorCode parameter, because that function is supposed to check for failure." (http://userguide.icu-project.org/dev/codingguidelines)

It's super unlikely that ucol_setAttribute will ever throw an error. From the source code, ucol_setAttribute is just setting flags. The only error that it will ever throw is U_ILLEGAL_ARGUMENT_ERROR. (http://source.icu-project.org/repos/icu/icu/trunk/source/i18n/collationsettings.cpp) But I still do a run-time check instead of ASSERT just in case.

3. Use jsNontrivialString to create strings for usage and sensitivity.

It's obvious from the source code that these strings are longer than one character.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20151217/cc57911d/attachment.html>


More information about the webkit-unassigned mailing list