Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
deps: update ChakraCore to chakra-core/ChakraCore@7f1ab68f0a
Browse files Browse the repository at this point in the history
[MERGE #4952 @kfarnung] Set `U_USING_ICU_NAMESPACE` to 0 by default

Merge pull request #4952 from kfarnung:icu61

ICU61 updated the value of `U_USING_ICU_NAMESPACE` to 0 by default. In
order to maintain compatibility this change updates our ICU includes to
match and adds the `icu::` namespace explicitly when needed.

Refs: nodejs/node#18667
Refs: https://ssl.icu-project.org/trac/ticket/13460

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
kfarnung authored and chakrabot committed Apr 9, 2018
1 parent b3e69f3 commit 29d44c2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
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
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
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
Expand Up @@ -34,6 +34,7 @@
#define FALSE 0
#endif
#else
#define U_USING_ICU_NAMESPACE 0
#include <unicode/umachine.h>
#endif

Expand Down

0 comments on commit 29d44c2

Please sign in to comment.