Bug 1284406 part 2 - Avoid including ICU header when Intl API is disabled. r=Waldo

MozReview-Commit-ID: IirLcgh8s89

--HG--
extra : source : 5385c9f8d274ae0625fe2ed5ae11be3016639ea2
This commit is contained in:
Xidorn Quan 2016-07-20 15:00:13 +10:00
parent 17ee95ed83
commit 173dc1aa41
2 changed files with 31 additions and 0 deletions

View File

@ -77,6 +77,33 @@ using icu::NumberingSystem;
* directory for license.
*/
typedef bool UBool;
typedef char16_t UChar;
typedef double UDate;
enum UErrorCode {
U_ZERO_ERROR,
U_BUFFER_OVERFLOW_ERROR,
};
static inline UBool
U_FAILURE(UErrorCode code)
{
MOZ_CRASH("U_FAILURE: Intl API disabled");
}
inline const UChar*
Char16ToUChar(const char16_t* chars)
{
MOZ_CRASH("Char16ToUChar: Intl API disabled");
}
inline UChar*
Char16ToUChar(char16_t* chars)
{
MOZ_CRASH("Char16ToUChar: Intl API disabled");
}
static int32_t
u_strlen(const UChar* s)
{

View File

@ -8,7 +8,9 @@
#define builtin_Intl_h
#include "NamespaceImports.h"
#if ENABLE_INTL_API
#include "unicode/utypes.h"
#endif
/*
* The Intl module specified by standard ECMA-402,
@ -179,6 +181,7 @@ intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
intl_FormatDateTime(JSContext* cx, unsigned argc, Value* vp);
#if ENABLE_INTL_API
/**
* Cast char16_t* strings to UChar* strings used by ICU.
*/
@ -193,6 +196,7 @@ Char16ToUChar(char16_t* chars)
{
return reinterpret_cast<UChar*>(chars);
}
#endif // ENABLE_INTL_API
} // namespace js