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

Set U_USING_ICU_NAMESPACE to 0 by default #4952

Merged
merged 1 commit into from
Apr 9, 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
1 change: 1 addition & 0 deletions lib/Runtime/Library/RuntimeLibraryPch.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
#ifdef INTL_ICU
#define U_STATIC_IMPLEMENTATION
#define U_SHOW_CPLUSPLUS_API 0
#define U_USING_ICU_NAMESPACE 0
#pragma warning(push)
#pragma warning(disable:4995)
#include <unicode/uloc.h>
Expand Down
1 change: 1 addition & 0 deletions lib/Runtime/PlatformAgnostic/Platform/Common/Intl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ typedef uint64_t uint64;

#define U_STATIC_IMPLEMENTATION
#define U_SHOW_CPLUSPLUS_API 1
#define U_USING_ICU_NAMESPACE 0
#pragma warning(push)
#pragma warning(disable:4995) // deprecation warning
#include <unicode/uloc.h>
Expand Down
23 changes: 12 additions & 11 deletions lib/Runtime/PlatformAgnostic/Platform/Linux/UnicodeText.ICU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "RuntimePlatformAgnosticPch.h"
#include "UnicodeText.h"
#ifdef HAS_REAL_ICU
#define U_USING_ICU_NAMESPACE 0
#include <unicode/uchar.h>
#include <unicode/ustring.h>
#include <unicode/normalizer2.h>
Expand All @@ -31,24 +32,24 @@ namespace PlatformAgnostic

#ifdef HAS_REAL_ICU
// Helper ICU conversion facilities
static const Normalizer2* TranslateToICUNormalizer(NormalizationForm normalizationForm)
static const icu::Normalizer2* TranslateToICUNormalizer(NormalizationForm normalizationForm)
{
UErrorCode errorCode = U_ZERO_ERROR;
const Normalizer2* normalizer;
const icu::Normalizer2* normalizer;

switch (normalizationForm)
{
case NormalizationForm::C:
normalizer = Normalizer2::getNFCInstance(errorCode);
normalizer = icu::Normalizer2::getNFCInstance(errorCode);
break;
case NormalizationForm::D:
normalizer = Normalizer2::getNFDInstance(errorCode);
normalizer = icu::Normalizer2::getNFDInstance(errorCode);
break;
case NormalizationForm::KC:
normalizer = Normalizer2::getNFKCInstance(errorCode);
normalizer = icu::Normalizer2::getNFKCInstance(errorCode);
break;
case NormalizationForm::KD:
normalizer = Normalizer2::getNFKDInstance(errorCode);
normalizer = icu::Normalizer2::getNFKDInstance(errorCode);
break;
default:
AssertMsg(false, "Unsupported normalization form");
Expand Down Expand Up @@ -157,13 +158,13 @@ namespace PlatformAgnostic
return -1 * invalidIndex; // mimicking the behavior of Win32 NormalizeString
}

const Normalizer2* normalizer = TranslateToICUNormalizer(normalizationForm);
const icu::Normalizer2* normalizer = TranslateToICUNormalizer(normalizationForm);
Assert(normalizer != nullptr);

const UnicodeString sourceUniStr((const UChar*) sourceString, sourceLength);
const icu::UnicodeString sourceUniStr((const UChar*) sourceString, sourceLength);

UErrorCode errorCode = U_ZERO_ERROR;
const UnicodeString destUniStr = normalizer->normalize(sourceUniStr, errorCode);
const icu::UnicodeString destUniStr = normalizer->normalize(sourceUniStr, errorCode);

if (U_FAILURE(errorCode))
{
Expand Down Expand Up @@ -208,10 +209,10 @@ namespace PlatformAgnostic
return false;
}

const Normalizer2* normalizer = TranslateToICUNormalizer(normalizationForm);
const icu::Normalizer2* normalizer = TranslateToICUNormalizer(normalizationForm);
Assert(normalizer != nullptr);

const UnicodeString testUniStr((const UChar*) testString, length);
const icu::UnicodeString testUniStr((const UChar*) testString, length);
bool isNormalized = normalizer->isNormalized(testUniStr, errorCode);

Assert(U_SUCCESS(errorCode));
Expand Down
1 change: 1 addition & 0 deletions lib/Runtime/PlatformAgnostic/RuntimePlatformAgnosticPch.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define FALSE 0
#endif
#else
#define U_USING_ICU_NAMESPACE 0
#include <unicode/umachine.h>
#endif

Expand Down