Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xplat-intl: default to non intl compare for localeCompare #4625

Merged
merged 1 commit into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1380,10 +1380,6 @@ namespace Js
#ifdef _WIN32
// xplat-todo: Need to replace this with platform-agnostic API
compareResult = CompareStringEx(givenLocale != nullptr ? givenLocale : defaultLocale, compareFlags, aLeft, size1, aRight, size2, NULL, NULL, 0);
#else
// FIXME (doilij): when CompareStringEx is implemented in PlatformAgnostic, call that function here
compareResult = 2; // 2 means strings are equal (reasonable default)
#endif

// Get the last error code so that it won't be affected by END_TEMP_ALLOCATOR.
if (compareResult == 0)
Expand All @@ -1400,6 +1396,16 @@ namespace Js
}

JavascriptError::MapAndThrowError(scriptContext, HRESULT_FROM_WIN32(lastError));
#else // _WIN32 (once ICU interface supports this, keep the implementation below for non-icu!)
compareResult = wcsncmp(aLeft, aRight, min(size1, size2));
if (compareResult == 0 && size1 != size2)
{
compareResult = size1 > size2 ? 1 : -1;
}
return JavascriptNumber::ToVar(compareResult, scriptContext);
}
END_TEMP_ALLOCATOR(tempAllocator, scriptContext);
#endif
}

Var IntlEngineInterfaceExtensionObject::EntryIntl_CurrencyDigits(RecyclableObject* function, CallInfo callInfo, ...)
Expand Down
3 changes: 1 addition & 2 deletions test/Strings/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
<default>
<files>compare.js</files>
<baseline>compare.baseline</baseline>
<compile-flags>-Intl-</compile-flags>
</default>
</test>
<test>
Expand Down Expand Up @@ -248,7 +247,7 @@
<tags>exclude_win7</tags>
</default>
</test>
<!-- This test is disabled as this is going to throw out of memory. Since this test takes time to reach the memory boundary,
<!-- This test is disabled as this is going to throw out of memory. Since this test takes time to reach the memory boundary,
it does not seem to be a good test to keep it enabled with -EnableFatalErrorOnOOM-
<test>
<default>
Expand Down