Merge "Pre-initialize more by moving bad fields"
diff --git a/NativeCode.mk b/NativeCode.mk
index 7bdac5a..1449e30 100644
--- a/NativeCode.mk
+++ b/NativeCode.mk
@@ -67,7 +67,7 @@
core_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
core_static_libraries := $(LOCAL_STATIC_LIBRARIES)
core_cflags := $(LOCAL_CFLAGS) -Wall -Wextra -Werror
-core_cppflags += -std=gnu++11
+core_cppflags += -std=gnu++11 -DU_USING_ICU_NAMESPACE=0
core_test_files := \
luni/src/test/native/dalvik_system_JniTest.cpp \
diff --git a/dalvik/src/main/java/dalvik/system/CloseGuard.java b/dalvik/src/main/java/dalvik/system/CloseGuard.java
index df36867..0301e50 100644
--- a/dalvik/src/main/java/dalvik/system/CloseGuard.java
+++ b/dalvik/src/main/java/dalvik/system/CloseGuard.java
@@ -40,9 +40,7 @@
*
* protected void finalize() throws Throwable {
* try {
- * if (guard != null) {
- * guard.warnIfOpen();
- * }
+ * guard.warnIfOpen();
* cleanup();
* } finally {
* super.finalize();
@@ -76,9 +74,7 @@
*
* protected void finalize() throws Throwable {
* try {
- * if (guard != null) {
- * guard.warnIfOpen();
- * }
+ * guard.warnIfOpen();
* cleanup();
* } finally {
* super.finalize();
diff --git a/include/ScopedIcuLocale.h b/include/ScopedIcuLocale.h
index 2109e03..64186e3 100644
--- a/include/ScopedIcuLocale.h
+++ b/include/ScopedIcuLocale.h
@@ -36,7 +36,7 @@
return;
}
- mLocale = Locale::createFromName(localeName.c_str());
+ mLocale = icu::Locale::createFromName(localeName.c_str());
}
~ScopedIcuLocale() {
@@ -46,13 +46,13 @@
return !mLocale.isBogus();
}
- Locale& locale() {
+ icu::Locale& locale() {
return mLocale;
}
private:
JNIEnv* const mEnv;
- Locale mLocale;
+ icu::Locale mLocale;
// Disallow copy and assignment.
ScopedIcuLocale(const ScopedIcuLocale&);
diff --git a/include/ScopedJavaUnicodeString.h b/include/ScopedJavaUnicodeString.h
index f6ed7ad..c1f487e 100644
--- a/include/ScopedJavaUnicodeString.h
+++ b/include/ScopedJavaUnicodeString.h
@@ -45,11 +45,11 @@
return (mString != NULL);
}
- const UnicodeString& unicodeString() const {
+ const icu::UnicodeString& unicodeString() const {
return mUnicodeString;
}
- UnicodeString& unicodeString() {
+ icu::UnicodeString& unicodeString() {
return mUnicodeString;
}
@@ -57,7 +57,7 @@
JNIEnv* mEnv;
jstring mString;
const UChar* mChars;
- UnicodeString mUnicodeString;
+ icu::UnicodeString mUnicodeString;
// Disallow copy and assignment.
ScopedJavaUnicodeString(const ScopedJavaUnicodeString&);
diff --git a/libart/src/main/java/java/lang/Daemons.java b/libart/src/main/java/java/lang/Daemons.java
index 76f4ea9..43066e1 100644
--- a/libart/src/main/java/java/lang/Daemons.java
+++ b/libart/src/main/java/java/lang/Daemons.java
@@ -57,12 +57,17 @@
*/
private static abstract class Daemon implements Runnable {
private Thread thread;
+ private String name;
+
+ protected Daemon(String name) {
+ this.name = name;
+ }
public synchronized void start() {
if (thread != null) {
throw new IllegalStateException("already running");
}
- thread = new Thread(ThreadGroup.systemThreadGroup, this, getClass().getSimpleName());
+ thread = new Thread(ThreadGroup.systemThreadGroup, this, name);
thread.setDaemon(true);
thread.start();
}
@@ -127,6 +132,10 @@
private static class ReferenceQueueDaemon extends Daemon {
private static final ReferenceQueueDaemon INSTANCE = new ReferenceQueueDaemon();
+ ReferenceQueueDaemon() {
+ super("ReferenceQueueDaemon");
+ }
+
@Override public void run() {
while (isRunning()) {
Reference<?> list;
@@ -163,6 +172,10 @@
private volatile Object finalizingObject;
private volatile long finalizingStartedNanos;
+ FinalizerDaemon() {
+ super("FinalizerDaemon");
+ }
+
@Override public void run() {
while (isRunning()) {
// Take a reference, blocking until one is ready or the thread should stop
@@ -203,6 +216,10 @@
private static class FinalizerWatchdogDaemon extends Daemon {
private static final FinalizerWatchdogDaemon INSTANCE = new FinalizerWatchdogDaemon();
+ FinalizerWatchdogDaemon() {
+ super("FinalizerWatchdogDaemon");
+ }
+
@Override public void run() {
while (isRunning()) {
boolean waitSuccessful = waitForObject();
@@ -305,6 +322,10 @@
private static class HeapTaskDaemon extends Daemon {
private static final HeapTaskDaemon INSTANCE = new HeapTaskDaemon();
+ HeapTaskDaemon() {
+ super("HeapTaskDaemon");
+ }
+
// Overrides the Daemon.interupt method which is called from Daemons.stop.
public synchronized void interrupt(Thread thread) {
VMRuntime.getRuntime().stopHeapTaskProcessor();
diff --git a/luni/src/main/native/IcuUtilities.cpp b/luni/src/main/native/IcuUtilities.cpp
index b740719..98648a5 100644
--- a/luni/src/main/native/IcuUtilities.cpp
+++ b/luni/src/main/native/IcuUtilities.cpp
@@ -27,7 +27,7 @@
#include "unicode/uloc.h"
#include "unicode/ustring.h"
-jobjectArray fromStringEnumeration(JNIEnv* env, UErrorCode& status, const char* provider, StringEnumeration* se) {
+jobjectArray fromStringEnumeration(JNIEnv* env, UErrorCode& status, const char* provider, icu::StringEnumeration* se) {
if (maybeThrowIcuException(env, provider, status)) {
return NULL;
}
@@ -39,7 +39,7 @@
jobjectArray result = env->NewObjectArray(count, JniConstants::stringClass, NULL);
for (int32_t i = 0; i < count; ++i) {
- const UnicodeString* string = se->snext(status);
+ const icu::UnicodeString* string = se->snext(status);
if (maybeThrowIcuException(env, "StringEnumeration::snext", status)) {
return NULL;
}
diff --git a/luni/src/main/native/IcuUtilities.h b/luni/src/main/native/IcuUtilities.h
index bf6a8ee..c64de30 100644
--- a/luni/src/main/native/IcuUtilities.h
+++ b/luni/src/main/native/IcuUtilities.h
@@ -21,7 +21,7 @@
#include "ustrenum.h" // For UStringEnumeration.
#include "unicode/utypes.h" // For UErrorCode.
-extern jobjectArray fromStringEnumeration(JNIEnv* env, UErrorCode& status, const char* provider, StringEnumeration*);
+extern jobjectArray fromStringEnumeration(JNIEnv* env, UErrorCode& status, const char* provider, icu::StringEnumeration*);
bool maybeThrowIcuException(JNIEnv* env, const char* function, UErrorCode error);
#endif // ICU_UTILITIES_H_included
diff --git a/luni/src/main/native/java_util_regex_Matcher.cpp b/luni/src/main/native/java_util_regex_Matcher.cpp
index f2f1bf3..35d014c 100644
--- a/luni/src/main/native/java_util_regex_Matcher.cpp
+++ b/luni/src/main/native/java_util_regex_Matcher.cpp
@@ -29,8 +29,8 @@
// ICU documentation: http://icu-project.org/apiref/icu4c/classRegexMatcher.html
-static RegexMatcher* toRegexMatcher(jlong address) {
- return reinterpret_cast<RegexMatcher*>(static_cast<uintptr_t>(address));
+static icu::RegexMatcher* toRegexMatcher(jlong address) {
+ return reinterpret_cast<icu::RegexMatcher*>(static_cast<uintptr_t>(address));
}
/**
@@ -74,7 +74,7 @@
maybeThrowIcuException(mEnv, "utext_close", mStatus);
}
- RegexMatcher* operator->() {
+ icu::RegexMatcher* operator->() {
return mMatcher;
}
@@ -106,7 +106,7 @@
JNIEnv* mEnv;
jstring mJavaInput;
- RegexMatcher* mMatcher;
+ icu::RegexMatcher* mMatcher;
const jchar* mChars;
UErrorCode mStatus;
UText* mUText;
@@ -170,9 +170,9 @@
}
static jlong Matcher_openImpl(JNIEnv* env, jclass, jlong patternAddr) {
- RegexPattern* pattern = reinterpret_cast<RegexPattern*>(static_cast<uintptr_t>(patternAddr));
+ icu::RegexPattern* pattern = reinterpret_cast<icu::RegexPattern*>(static_cast<uintptr_t>(patternAddr));
UErrorCode status = U_ZERO_ERROR;
- RegexMatcher* result = pattern->matcher(status);
+ icu::RegexMatcher* result = pattern->matcher(status);
maybeThrowIcuException(env, "RegexPattern::matcher", status);
return reinterpret_cast<uintptr_t>(result);
}
diff --git a/luni/src/main/native/java_util_regex_Pattern.cpp b/luni/src/main/native/java_util_regex_Pattern.cpp
index 1a99d0a..f2c07dc 100644
--- a/luni/src/main/native/java_util_regex_Pattern.cpp
+++ b/luni/src/main/native/java_util_regex_Pattern.cpp
@@ -27,8 +27,8 @@
// ICU documentation: http://icu-project.org/apiref/icu4c/classRegexPattern.html
-static RegexPattern* toRegexPattern(jlong addr) {
- return reinterpret_cast<RegexPattern*>(static_cast<uintptr_t>(addr));
+static icu::RegexPattern* toRegexPattern(jlong addr) {
+ return reinterpret_cast<icu::RegexPattern*>(static_cast<uintptr_t>(addr));
}
static const char* regexDetailMessage(UErrorCode status) {
@@ -86,8 +86,8 @@
if (!regex.valid()) {
return 0;
}
- UnicodeString& regexString(regex.unicodeString());
- RegexPattern* result = RegexPattern::compile(regexString, flags, error, status);
+ icu::UnicodeString& regexString(regex.unicodeString());
+ icu::RegexPattern* result = icu::RegexPattern::compile(regexString, flags, error, status);
if (!U_SUCCESS(status)) {
throwPatternSyntaxException(env, status, javaRegex, error);
}
diff --git a/luni/src/main/native/libcore_icu_AlphabeticIndex.cpp b/luni/src/main/native/libcore_icu_AlphabeticIndex.cpp
index e0638bd..acc247b 100644
--- a/luni/src/main/native/libcore_icu_AlphabeticIndex.cpp
+++ b/luni/src/main/native/libcore_icu_AlphabeticIndex.cpp
@@ -25,8 +25,8 @@
#include "unicode/alphaindex.h"
#include "unicode/uniset.h"
-static AlphabeticIndex* fromPeer(jlong peer) {
- return reinterpret_cast<AlphabeticIndex*>(static_cast<uintptr_t>(peer));
+static icu::AlphabeticIndex* fromPeer(jlong peer) {
+ return reinterpret_cast<icu::AlphabeticIndex*>(static_cast<uintptr_t>(peer));
}
static jlong AlphabeticIndex_create(JNIEnv* env, jclass, jstring javaLocaleName) {
@@ -35,7 +35,7 @@
if (!icuLocale.valid()) {
return 0;
}
- AlphabeticIndex* ai = new AlphabeticIndex(icuLocale.locale(), status);
+ icu::AlphabeticIndex* ai = new icu::AlphabeticIndex(icuLocale.locale(), status);
if (maybeThrowIcuException(env, "AlphabeticIndex", status)) {
return 0;
}
@@ -47,19 +47,19 @@
}
static jint AlphabeticIndex_getMaxLabelCount(JNIEnv*, jclass, jlong peer) {
- AlphabeticIndex* ai = fromPeer(peer);
+ icu::AlphabeticIndex* ai = fromPeer(peer);
return ai->getMaxLabelCount();
}
static void AlphabeticIndex_setMaxLabelCount(JNIEnv* env, jclass, jlong peer, jint count) {
- AlphabeticIndex* ai = fromPeer(peer);
+ icu::AlphabeticIndex* ai = fromPeer(peer);
UErrorCode status = U_ZERO_ERROR;
ai->setMaxLabelCount(count, status);
maybeThrowIcuException(env, "AlphabeticIndex::setMaxLabelCount", status);
}
static void AlphabeticIndex_addLabels(JNIEnv* env, jclass, jlong peer, jstring javaLocaleName) {
- AlphabeticIndex* ai = fromPeer(peer);
+ icu::AlphabeticIndex* ai = fromPeer(peer);
ScopedIcuLocale icuLocale(env, javaLocaleName);
if (!icuLocale.valid()) {
return;
@@ -71,14 +71,14 @@
static void AlphabeticIndex_addLabelRange(JNIEnv* env, jclass, jlong peer,
jint codePointStart, jint codePointEnd) {
- AlphabeticIndex* ai = fromPeer(peer);
+ icu::AlphabeticIndex* ai = fromPeer(peer);
UErrorCode status = U_ZERO_ERROR;
- ai->addLabels(UnicodeSet(codePointStart, codePointEnd), status);
+ ai->addLabels(icu::UnicodeSet(codePointStart, codePointEnd), status);
maybeThrowIcuException(env, "AlphabeticIndex::addLabels", status);
}
static jint AlphabeticIndex_getBucketCount(JNIEnv* env, jclass, jlong peer) {
- AlphabeticIndex* ai = fromPeer(peer);
+ icu::AlphabeticIndex* ai = fromPeer(peer);
UErrorCode status = U_ZERO_ERROR;
jint result = ai->getBucketCount(status);
if (maybeThrowIcuException(env, "AlphabeticIndex::getBucketCount", status)) {
@@ -88,7 +88,7 @@
}
static jint AlphabeticIndex_getBucketIndex(JNIEnv* env, jclass, jlong peer, jstring javaString) {
- AlphabeticIndex* ai = fromPeer(peer);
+ icu::AlphabeticIndex* ai = fromPeer(peer);
ScopedJavaUnicodeString string(env, javaString);
if (!string.valid()) {
return -1;
@@ -108,7 +108,7 @@
}
// Iterate to the nth bucket.
- AlphabeticIndex* ai = fromPeer(peer);
+ icu::AlphabeticIndex* ai = fromPeer(peer);
UErrorCode status = U_ZERO_ERROR;
ai->resetBucketIterator(status);
if (maybeThrowIcuException(env, "AlphabeticIndex::resetBucketIterator", status)) {
@@ -129,31 +129,31 @@
return env->NewStringUTF("");
}
- const UnicodeString& label(ai->getBucketLabel());
+ const icu::UnicodeString& label(ai->getBucketLabel());
return env->NewString(label.getBuffer(), label.length());
}
static jlong AlphabeticIndex_buildImmutableIndex(JNIEnv* env, jclass, jlong peer) {
- AlphabeticIndex* ai = fromPeer(peer);
+ icu::AlphabeticIndex* ai = fromPeer(peer);
UErrorCode status = U_ZERO_ERROR;
- AlphabeticIndex::ImmutableIndex* ii = ai->buildImmutableIndex(status);
+ icu::AlphabeticIndex::ImmutableIndex* ii = ai->buildImmutableIndex(status);
if (maybeThrowIcuException(env, "AlphabeticIndex::buildImmutableIndex", status)) {
return 0;
}
return reinterpret_cast<uintptr_t>(ii);
}
-static AlphabeticIndex::ImmutableIndex* immutableIndexFromPeer(jlong peer) {
- return reinterpret_cast<AlphabeticIndex::ImmutableIndex*>(static_cast<uintptr_t>(peer));
+static icu::AlphabeticIndex::ImmutableIndex* immutableIndexFromPeer(jlong peer) {
+ return reinterpret_cast<icu::AlphabeticIndex::ImmutableIndex*>(static_cast<uintptr_t>(peer));
}
static jint ImmutableIndex_getBucketCount(JNIEnv*, jclass, jlong peer) {
- AlphabeticIndex::ImmutableIndex* ii = immutableIndexFromPeer(peer);
+ icu::AlphabeticIndex::ImmutableIndex* ii = immutableIndexFromPeer(peer);
return ii->getBucketCount();
}
static jint ImmutableIndex_getBucketIndex(JNIEnv* env, jclass, jlong peer, jstring javaString) {
- AlphabeticIndex::ImmutableIndex* ii = immutableIndexFromPeer(peer);
+ icu::AlphabeticIndex::ImmutableIndex* ii = immutableIndexFromPeer(peer);
ScopedJavaUnicodeString string(env, javaString);
if (!string.valid()) {
return -1;
@@ -167,8 +167,8 @@
}
static jstring ImmutableIndex_getBucketLabel(JNIEnv* env, jclass, jlong peer, jint index) {
- AlphabeticIndex::ImmutableIndex* ii = immutableIndexFromPeer(peer);
- const AlphabeticIndex::Bucket* bucket = ii->getBucket(index);
+ icu::AlphabeticIndex::ImmutableIndex* ii = immutableIndexFromPeer(peer);
+ const icu::AlphabeticIndex::Bucket* bucket = ii->getBucket(index);
if (bucket == NULL) {
jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException", "Invalid index: %d", index);
return NULL;
@@ -179,7 +179,7 @@
return env->NewStringUTF("");
}
- const UnicodeString& label(bucket->getLabel());
+ const icu::UnicodeString& label(bucket->getLabel());
return env->NewString(label.getBuffer(), label.length());
}
diff --git a/luni/src/main/native/libcore_icu_DateIntervalFormat.cpp b/luni/src/main/native/libcore_icu_DateIntervalFormat.cpp
index 5221baa..f369a09 100644
--- a/luni/src/main/native/libcore_icu_DateIntervalFormat.cpp
+++ b/luni/src/main/native/libcore_icu_DateIntervalFormat.cpp
@@ -35,7 +35,7 @@
}
UErrorCode status = U_ZERO_ERROR;
- DateIntervalFormat* formatter(DateIntervalFormat::createInstance(skeletonHolder.unicodeString(), icuLocale.locale(), status));
+ icu::DateIntervalFormat* formatter(icu::DateIntervalFormat::createInstance(skeletonHolder.unicodeString(), icuLocale.locale(), status));
if (maybeThrowIcuException(env, "DateIntervalFormat::createInstance", status)) {
return 0;
}
@@ -44,21 +44,21 @@
if (!tzNameHolder.valid()) {
return 0;
}
- formatter->adoptTimeZone(TimeZone::createTimeZone(tzNameHolder.unicodeString()));
+ formatter->adoptTimeZone(icu::TimeZone::createTimeZone(tzNameHolder.unicodeString()));
return reinterpret_cast<uintptr_t>(formatter);
}
static void DateIntervalFormat_destroyDateIntervalFormat(JNIEnv*, jclass, jlong address) {
- delete reinterpret_cast<DateIntervalFormat*>(address);
+ delete reinterpret_cast<icu::DateIntervalFormat*>(address);
}
static jstring DateIntervalFormat_formatDateInterval(JNIEnv* env, jclass, jlong address, jlong fromDate, jlong toDate) {
- DateIntervalFormat* formatter(reinterpret_cast<DateIntervalFormat*>(address));
- DateInterval date_interval(fromDate, toDate);
+ icu::DateIntervalFormat* formatter(reinterpret_cast<icu::DateIntervalFormat*>(address));
+ icu::DateInterval date_interval(fromDate, toDate);
- UnicodeString s;
- FieldPosition pos = 0;
+ icu::UnicodeString s;
+ icu::FieldPosition pos = 0;
UErrorCode status = U_ZERO_ERROR;
formatter->format(&date_interval, s, pos, status);
if (maybeThrowIcuException(env, "DateIntervalFormat::format", status)) {
diff --git a/luni/src/main/native/libcore_icu_ICU.cpp b/luni/src/main/native/libcore_icu_ICU.cpp
index 34b8ee0..ee4fe6e 100644
--- a/luni/src/main/native/libcore_icu_ICU.cpp
+++ b/luni/src/main/native/libcore_icu_ICU.cpp
@@ -114,7 +114,7 @@
if (!currencyCode.valid()) {
return 0;
}
- UnicodeString icuCurrencyCode(currencyCode.unicodeString());
+ icu::UnicodeString icuCurrencyCode(currencyCode.unicodeString());
UErrorCode status = U_ZERO_ERROR;
return ucurr_getDefaultFractionDigits(icuCurrencyCode.getTerminatedBuffer(), &status);
}
@@ -124,7 +124,7 @@
if (!currencyCode.valid()) {
return 0;
}
- UnicodeString icuCurrencyCode(currencyCode.unicodeString());
+ icu::UnicodeString icuCurrencyCode(currencyCode.unicodeString());
return ucurr_getNumericCode(icuCurrencyCode.getTerminatedBuffer());
}
@@ -180,7 +180,7 @@
if (!currencyCode.valid()) {
return NULL;
}
- UnicodeString icuCurrencyCode(currencyCode.unicodeString());
+ icu::UnicodeString icuCurrencyCode(currencyCode.unicodeString());
UErrorCode status = U_ZERO_ERROR;
UBool isChoiceFormat = false;
int32_t charCount;
@@ -221,7 +221,7 @@
return NULL;
}
- UnicodeString str;
+ icu::UnicodeString str;
icuTargetLocale.locale().getDisplayCountry(icuLocale.locale(), str);
return env->NewString(str.getBuffer(), str.length());
}
@@ -236,7 +236,7 @@
return NULL;
}
- UnicodeString str;
+ icu::UnicodeString str;
icuTargetLocale.locale().getDisplayLanguage(icuLocale.locale(), str);
return env->NewString(str.getBuffer(), str.length());
}
@@ -251,7 +251,7 @@
return NULL;
}
- UnicodeString str;
+ icu::UnicodeString str;
icuTargetLocale.locale().getDisplayScript(icuLocale.locale(), str);
return env->NewString(str.getBuffer(), str.length());
}
@@ -266,7 +266,7 @@
return NULL;
}
- UnicodeString str;
+ icu::UnicodeString str;
icuTargetLocale.locale().getDisplayVariant(icuLocale.locale(), str);
return env->NewString(str.getBuffer(), str.length());
}
@@ -288,11 +288,11 @@
}
static jobjectArray ICU_getISOCountriesNative(JNIEnv* env, jclass) {
- return toStringArray(env, Locale::getISOCountries());
+ return toStringArray(env, icu::Locale::getISOCountries());
}
static jobjectArray ICU_getISOLanguagesNative(JNIEnv* env, jclass) {
- return toStringArray(env, Locale::getISOLanguages());
+ return toStringArray(env, icu::Locale::getISOLanguages());
}
static jobjectArray ICU_getAvailableLocalesNative(JNIEnv* env, jclass) {
@@ -336,7 +336,7 @@
env->SetObjectField(obj, fid, value);
}
-static void setStringArrayField(JNIEnv* env, jobject obj, const char* fieldName, const UnicodeString* valueArray, int32_t size) {
+static void setStringArrayField(JNIEnv* env, jobject obj, const char* fieldName, const icu::UnicodeString* valueArray, int32_t size) {
ScopedLocalRef<jobjectArray> result(env, env->NewObjectArray(size, JniConstants::stringClass, NULL));
for (int32_t i = 0; i < size ; i++) {
ScopedLocalRef<jstring> s(env, env->NewString(valueArray[i].getBuffer(),valueArray[i].length()));
@@ -362,7 +362,7 @@
}
}
-static void setCharField(JNIEnv* env, jobject obj, const char* fieldName, const UnicodeString& value) {
+static void setCharField(JNIEnv* env, jobject obj, const char* fieldName, const icu::UnicodeString& value) {
if (value.length() == 0) {
return;
}
@@ -370,43 +370,43 @@
env->SetCharField(obj, fid, value.charAt(0));
}
-static void setStringField(JNIEnv* env, jobject obj, const char* fieldName, const UnicodeString& value) {
+static void setStringField(JNIEnv* env, jobject obj, const char* fieldName, const icu::UnicodeString& value) {
const UChar* chars = value.getBuffer();
setStringField(env, obj, fieldName, env->NewString(chars, value.length()));
}
-static void setNumberPatterns(JNIEnv* env, jobject obj, Locale& locale) {
+static void setNumberPatterns(JNIEnv* env, jobject obj, icu::Locale& locale) {
UErrorCode status = U_ZERO_ERROR;
- UnicodeString pattern;
- std::unique_ptr<DecimalFormat> fmt(static_cast<DecimalFormat*>(NumberFormat::createInstance(locale, UNUM_CURRENCY, status)));
+ icu::UnicodeString pattern;
+ std::unique_ptr<icu::DecimalFormat> fmt(static_cast<icu::DecimalFormat*>(icu::NumberFormat::createInstance(locale, UNUM_CURRENCY, status)));
pattern = fmt->toPattern(pattern.remove());
setStringField(env, obj, "currencyPattern", pattern);
- fmt.reset(static_cast<DecimalFormat*>(NumberFormat::createInstance(locale, UNUM_DECIMAL, status)));
+ fmt.reset(static_cast<icu::DecimalFormat*>(icu::NumberFormat::createInstance(locale, UNUM_DECIMAL, status)));
pattern = fmt->toPattern(pattern.remove());
setStringField(env, obj, "numberPattern", pattern);
- fmt.reset(static_cast<DecimalFormat*>(NumberFormat::createInstance(locale, UNUM_PERCENT, status)));
+ fmt.reset(static_cast<icu::DecimalFormat*>(icu::NumberFormat::createInstance(locale, UNUM_PERCENT, status)));
pattern = fmt->toPattern(pattern.remove());
setStringField(env, obj, "percentPattern", pattern);
}
-static void setDecimalFormatSymbolsData(JNIEnv* env, jobject obj, Locale& locale) {
+static void setDecimalFormatSymbolsData(JNIEnv* env, jobject obj, icu::Locale& locale) {
UErrorCode status = U_ZERO_ERROR;
- DecimalFormatSymbols dfs(locale, status);
+ icu::DecimalFormatSymbols dfs(locale, status);
- setCharField(env, obj, "decimalSeparator", dfs.getSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol));
- setCharField(env, obj, "groupingSeparator", dfs.getSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol));
- setCharField(env, obj, "patternSeparator", dfs.getSymbol(DecimalFormatSymbols::kPatternSeparatorSymbol));
- setStringField(env, obj, "percent", dfs.getSymbol(DecimalFormatSymbols::kPercentSymbol));
- setCharField(env, obj, "perMill", dfs.getSymbol(DecimalFormatSymbols::kPerMillSymbol));
- setCharField(env, obj, "monetarySeparator", dfs.getSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol));
- setStringField(env, obj, "minusSign", dfs.getSymbol(DecimalFormatSymbols:: kMinusSignSymbol));
- setStringField(env, obj, "exponentSeparator", dfs.getSymbol(DecimalFormatSymbols::kExponentialSymbol));
- setStringField(env, obj, "infinity", dfs.getSymbol(DecimalFormatSymbols::kInfinitySymbol));
- setStringField(env, obj, "NaN", dfs.getSymbol(DecimalFormatSymbols::kNaNSymbol));
- setCharField(env, obj, "zeroDigit", dfs.getSymbol(DecimalFormatSymbols::kZeroDigitSymbol));
+ setCharField(env, obj, "decimalSeparator", dfs.getSymbol(icu::DecimalFormatSymbols::kDecimalSeparatorSymbol));
+ setCharField(env, obj, "groupingSeparator", dfs.getSymbol(icu::DecimalFormatSymbols::kGroupingSeparatorSymbol));
+ setCharField(env, obj, "patternSeparator", dfs.getSymbol(icu::DecimalFormatSymbols::kPatternSeparatorSymbol));
+ setStringField(env, obj, "percent", dfs.getSymbol(icu::DecimalFormatSymbols::kPercentSymbol));
+ setCharField(env, obj, "perMill", dfs.getSymbol(icu::DecimalFormatSymbols::kPerMillSymbol));
+ setCharField(env, obj, "monetarySeparator", dfs.getSymbol(icu::DecimalFormatSymbols::kMonetarySeparatorSymbol));
+ setStringField(env, obj, "minusSign", dfs.getSymbol(icu::DecimalFormatSymbols:: kMinusSignSymbol));
+ setStringField(env, obj, "exponentSeparator", dfs.getSymbol(icu::DecimalFormatSymbols::kExponentialSymbol));
+ setStringField(env, obj, "infinity", dfs.getSymbol(icu::DecimalFormatSymbols::kInfinitySymbol));
+ setStringField(env, obj, "NaN", dfs.getSymbol(icu::DecimalFormatSymbols::kNaNSymbol));
+ setCharField(env, obj, "zeroDigit", dfs.getSymbol(icu::DecimalFormatSymbols::kZeroDigitSymbol));
}
@@ -495,7 +495,7 @@
return true;
}
-static bool getYesterdayTodayAndTomorrow(JNIEnv* env, jobject localeData, const Locale& locale, const char* locale_name) {
+static bool getYesterdayTodayAndTomorrow(JNIEnv* env, jobject localeData, const icu::Locale& locale, const char* locale_name) {
UErrorCode status = U_ZERO_ERROR;
ScopedResourceBundle root(ures_open(NULL, locale_name, &status));
ScopedResourceBundle fields(ures_getByKey(root.get(), "fields", NULL, &status));
@@ -505,16 +505,16 @@
return false;
}
- UnicodeString yesterday(ures_getUnicodeStringByKey(relative.get(), "-1", &status));
- UnicodeString today(ures_getUnicodeStringByKey(relative.get(), "0", &status));
- UnicodeString tomorrow(ures_getUnicodeStringByKey(relative.get(), "1", &status));
+ icu::UnicodeString yesterday(icu::ures_getUnicodeStringByKey(relative.get(), "-1", &status));
+ icu::UnicodeString today(icu::ures_getUnicodeStringByKey(relative.get(), "0", &status));
+ icu::UnicodeString tomorrow(icu::ures_getUnicodeStringByKey(relative.get(), "1", &status));
if (U_FAILURE(status)) {
ALOGE("Error getting yesterday/today/tomorrow for %s: %s", locale_name, u_errorName(status));
return false;
}
// We title-case the strings so they have consistent capitalization (http://b/14493853).
- std::unique_ptr<BreakIterator> brk(BreakIterator::createSentenceInstance(locale, status));
+ std::unique_ptr<icu::BreakIterator> brk(icu::BreakIterator::createSentenceInstance(locale, status));
if (U_FAILURE(status)) {
ALOGE("Error getting yesterday/today/tomorrow break iterator for %s: %s", locale_name, u_errorName(status));
return false;
@@ -584,7 +584,7 @@
}
status = U_ZERO_ERROR;
- std::unique_ptr<Calendar> cal(Calendar::createInstance(icuLocale.locale(), status));
+ std::unique_ptr<icu::Calendar> cal(icu::Calendar::createInstance(icuLocale.locale(), status));
if (U_FAILURE(status)) {
return JNI_FALSE;
}
@@ -594,54 +594,54 @@
// Get DateFormatSymbols.
status = U_ZERO_ERROR;
- DateFormatSymbols dateFormatSym(icuLocale.locale(), status);
+ icu::DateFormatSymbols dateFormatSym(icuLocale.locale(), status);
if (U_FAILURE(status)) {
return JNI_FALSE;
}
// Get AM/PM and BC/AD.
int32_t count = 0;
- const UnicodeString* amPmStrs = dateFormatSym.getAmPmStrings(count);
+ const icu::UnicodeString* amPmStrs = dateFormatSym.getAmPmStrings(count);
setStringArrayField(env, localeData, "amPm", amPmStrs, count);
- const UnicodeString* erasStrs = dateFormatSym.getEras(count);
+ const icu::UnicodeString* erasStrs = dateFormatSym.getEras(count);
setStringArrayField(env, localeData, "eras", erasStrs, count);
- const UnicodeString* longMonthNames =
- dateFormatSym.getMonths(count, DateFormatSymbols::FORMAT, DateFormatSymbols::WIDE);
+ const icu::UnicodeString* longMonthNames =
+ dateFormatSym.getMonths(count, icu::DateFormatSymbols::FORMAT, icu::DateFormatSymbols::WIDE);
setStringArrayField(env, localeData, "longMonthNames", longMonthNames, count);
- const UnicodeString* shortMonthNames =
- dateFormatSym.getMonths(count, DateFormatSymbols::FORMAT, DateFormatSymbols::ABBREVIATED);
+ const icu::UnicodeString* shortMonthNames =
+ dateFormatSym.getMonths(count, icu::DateFormatSymbols::FORMAT, icu::DateFormatSymbols::ABBREVIATED);
setStringArrayField(env, localeData, "shortMonthNames", shortMonthNames, count);
- const UnicodeString* tinyMonthNames =
- dateFormatSym.getMonths(count, DateFormatSymbols::FORMAT, DateFormatSymbols::NARROW);
+ const icu::UnicodeString* tinyMonthNames =
+ dateFormatSym.getMonths(count, icu::DateFormatSymbols::FORMAT, icu::DateFormatSymbols::NARROW);
setStringArrayField(env, localeData, "tinyMonthNames", tinyMonthNames, count);
- const UnicodeString* longWeekdayNames =
- dateFormatSym.getWeekdays(count, DateFormatSymbols::FORMAT, DateFormatSymbols::WIDE);
+ const icu::UnicodeString* longWeekdayNames =
+ dateFormatSym.getWeekdays(count, icu::DateFormatSymbols::FORMAT, icu::DateFormatSymbols::WIDE);
setStringArrayField(env, localeData, "longWeekdayNames", longWeekdayNames, count);
- const UnicodeString* shortWeekdayNames =
- dateFormatSym.getWeekdays(count, DateFormatSymbols::FORMAT, DateFormatSymbols::ABBREVIATED);
+ const icu::UnicodeString* shortWeekdayNames =
+ dateFormatSym.getWeekdays(count, icu::DateFormatSymbols::FORMAT, icu::DateFormatSymbols::ABBREVIATED);
setStringArrayField(env, localeData, "shortWeekdayNames", shortWeekdayNames, count);
- const UnicodeString* tinyWeekdayNames =
- dateFormatSym.getWeekdays(count, DateFormatSymbols::FORMAT, DateFormatSymbols::NARROW);
+ const icu::UnicodeString* tinyWeekdayNames =
+ dateFormatSym.getWeekdays(count, icu::DateFormatSymbols::FORMAT, icu::DateFormatSymbols::NARROW);
setStringArrayField(env, localeData, "tinyWeekdayNames", tinyWeekdayNames, count);
- const UnicodeString* longStandAloneMonthNames =
- dateFormatSym.getMonths(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::WIDE);
+ const icu::UnicodeString* longStandAloneMonthNames =
+ dateFormatSym.getMonths(count, icu::DateFormatSymbols::STANDALONE, icu::DateFormatSymbols::WIDE);
setStringArrayField(env, localeData, "longStandAloneMonthNames", longStandAloneMonthNames, count);
- const UnicodeString* shortStandAloneMonthNames =
- dateFormatSym.getMonths(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::ABBREVIATED);
+ const icu::UnicodeString* shortStandAloneMonthNames =
+ dateFormatSym.getMonths(count, icu::DateFormatSymbols::STANDALONE, icu::DateFormatSymbols::ABBREVIATED);
setStringArrayField(env, localeData, "shortStandAloneMonthNames", shortStandAloneMonthNames, count);
- const UnicodeString* tinyStandAloneMonthNames =
- dateFormatSym.getMonths(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::NARROW);
+ const icu::UnicodeString* tinyStandAloneMonthNames =
+ dateFormatSym.getMonths(count, icu::DateFormatSymbols::STANDALONE, icu::DateFormatSymbols::NARROW);
setStringArrayField(env, localeData, "tinyStandAloneMonthNames", tinyStandAloneMonthNames, count);
- const UnicodeString* longStandAloneWeekdayNames =
- dateFormatSym.getWeekdays(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::WIDE);
+ const icu::UnicodeString* longStandAloneWeekdayNames =
+ dateFormatSym.getWeekdays(count, icu::DateFormatSymbols::STANDALONE, icu::DateFormatSymbols::WIDE);
setStringArrayField(env, localeData, "longStandAloneWeekdayNames", longStandAloneWeekdayNames, count);
- const UnicodeString* shortStandAloneWeekdayNames =
- dateFormatSym.getWeekdays(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::ABBREVIATED);
+ const icu::UnicodeString* shortStandAloneWeekdayNames =
+ dateFormatSym.getWeekdays(count, icu::DateFormatSymbols::STANDALONE, icu::DateFormatSymbols::ABBREVIATED);
setStringArrayField(env, localeData, "shortStandAloneWeekdayNames", shortStandAloneWeekdayNames, count);
- const UnicodeString* tinyStandAloneWeekdayNames =
- dateFormatSym.getWeekdays(count, DateFormatSymbols::STANDALONE, DateFormatSymbols::NARROW);
+ const icu::UnicodeString* tinyStandAloneWeekdayNames =
+ dateFormatSym.getWeekdays(count, icu::DateFormatSymbols::STANDALONE, icu::DateFormatSymbols::NARROW);
setStringArrayField(env, localeData, "tinyStandAloneWeekdayNames", tinyStandAloneWeekdayNames, count);
status = U_ZERO_ERROR;
@@ -680,8 +680,8 @@
if (!icuLocale.valid()) {
return NULL;
}
- UnicodeString& s(scopedString.unicodeString());
- UnicodeString original(s);
+ icu::UnicodeString& s(scopedString.unicodeString());
+ icu::UnicodeString original(s);
s.toLower(icuLocale.locale());
return s == original ? javaString : env->NewString(s.getBuffer(), s.length());
}
@@ -695,8 +695,8 @@
if (!icuLocale.valid()) {
return NULL;
}
- UnicodeString& s(scopedString.unicodeString());
- UnicodeString original(s);
+ icu::UnicodeString& s(scopedString.unicodeString());
+ icu::UnicodeString original(s);
s.toUpper(icuLocale.locale());
return s == original ? javaString : env->NewString(s.getBuffer(), s.length());
}
@@ -728,7 +728,7 @@
static jobject ICU_getAvailableCurrencyCodes(JNIEnv* env, jclass) {
UErrorCode status = U_ZERO_ERROR;
- UStringEnumeration e(ucurr_openISOCurrencies(UCURR_COMMON|UCURR_NON_DEPRECATED, &status));
+ icu::UStringEnumeration e(ucurr_openISOCurrencies(UCURR_COMMON|UCURR_NON_DEPRECATED, &status));
return fromStringEnumeration(env, status, "ucurr_openISOCurrencies", &e);
}
@@ -739,7 +739,7 @@
}
UErrorCode status = U_ZERO_ERROR;
- std::unique_ptr<DateTimePatternGenerator> generator(DateTimePatternGenerator::createInstance(icuLocale.locale(), status));
+ std::unique_ptr<icu::DateTimePatternGenerator> generator(icu::DateTimePatternGenerator::createInstance(icuLocale.locale(), status));
if (maybeThrowIcuException(env, "DateTimePatternGenerator::createInstance", status)) {
return NULL;
}
@@ -748,7 +748,7 @@
if (!skeletonHolder.valid()) {
return NULL;
}
- UnicodeString result(generator->getBestPattern(skeletonHolder.unicodeString(), status));
+ icu::UnicodeString result(generator->getBestPattern(skeletonHolder.unicodeString(), status));
if (maybeThrowIcuException(env, "DateTimePatternGenerator::getBestPattern", status)) {
return NULL;
}
@@ -763,12 +763,12 @@
}
UErrorCode status = U_ZERO_ERROR;
- Locale::setDefault(icuLocale.locale(), status);
+ icu::Locale::setDefault(icuLocale.locale(), status);
maybeThrowIcuException(env, "Locale::setDefault", status);
}
static jstring ICU_getDefaultLocale(JNIEnv* env, jclass) {
- return env->NewStringUTF(Locale::getDefault().getName());
+ return env->NewStringUTF(icu::Locale::getDefault().getName());
}
static JNINativeMethod gMethods[] = {
diff --git a/luni/src/main/native/libcore_icu_NativeBreakIterator.cpp b/luni/src/main/native/libcore_icu_NativeBreakIterator.cpp
index ef0c2a9..c855963 100644
--- a/luni/src/main/native/libcore_icu_NativeBreakIterator.cpp
+++ b/luni/src/main/native/libcore_icu_NativeBreakIterator.cpp
@@ -28,8 +28,8 @@
// ICU documentation: http://icu-project.org/apiref/icu4c/classBreakIterator.html
-static BreakIterator* toBreakIterator(jlong address) {
- return reinterpret_cast<BreakIterator*>(static_cast<uintptr_t>(address));
+static icu::BreakIterator* toBreakIterator(jlong address) {
+ return reinterpret_cast<icu::BreakIterator*>(static_cast<uintptr_t>(address));
}
/**
@@ -77,7 +77,7 @@
maybeThrowIcuException(mEnv, "utext_close", mStatus);
}
- BreakIterator* operator->() {
+ icu::BreakIterator* operator->() {
return mBreakIterator;
}
@@ -97,7 +97,7 @@
JNIEnv* mEnv;
jstring mJavaInput;
- BreakIterator* mBreakIterator;
+ icu::BreakIterator* mBreakIterator;
const jchar* mChars;
UErrorCode mStatus;
UText* mUText;
@@ -113,7 +113,7 @@
return 0; \
} \
UErrorCode status = U_ZERO_ERROR; \
- BreakIterator* it = F(icuLocale.locale(), status); \
+ icu::BreakIterator* it = F(icuLocale.locale(), status); \
if (maybeThrowIcuException(env, "ubrk_open", status)) { \
return 0; \
} \
@@ -144,19 +144,19 @@
}
static jlong NativeBreakIterator_getCharacterInstanceImpl(JNIEnv* env, jclass, jstring javaLocaleName) {
- MAKE_BREAK_ITERATOR_INSTANCE(BreakIterator::createCharacterInstance);
+ MAKE_BREAK_ITERATOR_INSTANCE(icu::BreakIterator::createCharacterInstance);
}
static jlong NativeBreakIterator_getLineInstanceImpl(JNIEnv* env, jclass, jstring javaLocaleName) {
- MAKE_BREAK_ITERATOR_INSTANCE(BreakIterator::createLineInstance);
+ MAKE_BREAK_ITERATOR_INSTANCE(icu::BreakIterator::createLineInstance);
}
static jlong NativeBreakIterator_getSentenceInstanceImpl(JNIEnv* env, jclass, jstring javaLocaleName) {
- MAKE_BREAK_ITERATOR_INSTANCE(BreakIterator::createSentenceInstance);
+ MAKE_BREAK_ITERATOR_INSTANCE(icu::BreakIterator::createSentenceInstance);
}
static jlong NativeBreakIterator_getWordInstanceImpl(JNIEnv* env, jclass, jstring javaLocaleName) {
- MAKE_BREAK_ITERATOR_INSTANCE(BreakIterator::createWordInstance);
+ MAKE_BREAK_ITERATOR_INSTANCE(icu::BreakIterator::createWordInstance);
}
static jboolean NativeBreakIterator_isBoundaryImpl(JNIEnv* env, jclass, jlong address, jstring javaInput, jint offset) {
diff --git a/luni/src/main/native/libcore_icu_NativeConverter.cpp b/luni/src/main/native/libcore_icu_NativeConverter.cpp
index 717bfc3..355cc78 100644
--- a/luni/src/main/native/libcore_icu_NativeConverter.cpp
+++ b/luni/src/main/native/libcore_icu_NativeConverter.cpp
@@ -64,7 +64,7 @@
static bool collectStandardNames(JNIEnv* env, const char* canonicalName, const char* standard,
std::vector<std::string>& result) {
UErrorCode status = U_ZERO_ERROR;
- UStringEnumeration e(ucnv_openStandardNames(canonicalName, standard, &status));
+ icu::UStringEnumeration e(ucnv_openStandardNames(canonicalName, standard, &status));
if (maybeThrowIcuException(env, "ucnv_openStandardNames", status)) {
return false;
}
@@ -75,7 +75,7 @@
}
for (int32_t i = 0; i < count; ++i) {
- const UnicodeString* string = e.snext(status);
+ const icu::UnicodeString* string = e.snext(status);
if (maybeThrowIcuException(env, "StringEnumeration::snext", status)) {
return false;
}
@@ -104,7 +104,7 @@
} else if (strstr(name, "x-") == name) {
// Check if the converter can be opened with the name given.
error = U_ZERO_ERROR;
- LocalUConverterPointer cnv(ucnv_open(name + 2, &error));
+ icu::LocalUConverterPointer cnv(ucnv_open(name + 2, &error));
if (U_SUCCESS(error)) {
return name + 2;
}
@@ -537,12 +537,12 @@
}
UErrorCode errorCode = U_ZERO_ERROR;
- LocalUConverterPointer converter1(ucnv_open(name1Chars.c_str(), &errorCode));
- UnicodeSet set1;
+ icu::LocalUConverterPointer converter1(ucnv_open(name1Chars.c_str(), &errorCode));
+ icu::UnicodeSet set1;
ucnv_getUnicodeSet(&*converter1, set1.toUSet(), UCNV_ROUNDTRIP_SET, &errorCode);
- LocalUConverterPointer converter2(ucnv_open(name2Chars.c_str(), &errorCode));
- UnicodeSet set2;
+ icu::LocalUConverterPointer converter2(ucnv_open(name2Chars.c_str(), &errorCode));
+ icu::UnicodeSet set2;
ucnv_getUnicodeSet(&*converter2, set2.toUSet(), UCNV_ROUNDTRIP_SET, &errorCode);
return U_SUCCESS(errorCode) && set1.containsAll(set2);
@@ -570,7 +570,7 @@
{
// ICU doesn't offer any "isSupported", so we just open and immediately close.
UErrorCode error = U_ZERO_ERROR;
- LocalUConverterPointer cnv(ucnv_open(icuCanonicalName, &error));
+ icu::LocalUConverterPointer cnv(ucnv_open(icuCanonicalName, &error));
if (!U_SUCCESS(error)) {
return NULL;
}
diff --git a/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp b/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp
index 0527213..2811c37 100644
--- a/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp
+++ b/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp
@@ -39,15 +39,15 @@
#include "unicode/ustring.h"
#include "valueOf.h"
-static DecimalFormat* toDecimalFormat(jlong addr) {
- return reinterpret_cast<DecimalFormat*>(static_cast<uintptr_t>(addr));
+static icu::DecimalFormat* toDecimalFormat(jlong addr) {
+ return reinterpret_cast<icu::DecimalFormat*>(static_cast<uintptr_t>(addr));
}
static UNumberFormat* toUNumberFormat(jlong addr) {
return reinterpret_cast<UNumberFormat*>(static_cast<uintptr_t>(addr));
}
-static DecimalFormatSymbols* makeDecimalFormatSymbols(JNIEnv* env,
+static icu::DecimalFormatSymbols* makeDecimalFormatSymbols(JNIEnv* env,
jstring currencySymbol0, jchar decimalSeparator, jchar digit, jstring exponentSeparator0,
jchar groupingSeparator0, jstring infinity0,
jstring internationalCurrencySymbol0, jstring minusSign0,
@@ -60,35 +60,35 @@
ScopedJavaUnicodeString nan(env, nan0);
ScopedJavaUnicodeString minusSign(env, minusSign0);
ScopedJavaUnicodeString percent(env, percent0);
- UnicodeString groupingSeparator(groupingSeparator0);
+ icu::UnicodeString groupingSeparator(groupingSeparator0);
- DecimalFormatSymbols* result = new DecimalFormatSymbols;
- result->setSymbol(DecimalFormatSymbols::kCurrencySymbol, currencySymbol.unicodeString());
- result->setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, UnicodeString(decimalSeparator));
- result->setSymbol(DecimalFormatSymbols::kDigitSymbol, UnicodeString(digit));
- result->setSymbol(DecimalFormatSymbols::kExponentialSymbol, exponentSeparator.unicodeString());
- result->setSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol, groupingSeparator);
- result->setSymbol(DecimalFormatSymbols::kMonetaryGroupingSeparatorSymbol, groupingSeparator);
- result->setSymbol(DecimalFormatSymbols::kInfinitySymbol, infinity.unicodeString());
- result->setSymbol(DecimalFormatSymbols::kIntlCurrencySymbol, internationalCurrencySymbol.unicodeString());
- result->setSymbol(DecimalFormatSymbols::kMinusSignSymbol, minusSign.unicodeString());
- result->setSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol, UnicodeString(monetaryDecimalSeparator));
- result->setSymbol(DecimalFormatSymbols::kNaNSymbol, nan.unicodeString());
- result->setSymbol(DecimalFormatSymbols::kPatternSeparatorSymbol, UnicodeString(patternSeparator));
- result->setSymbol(DecimalFormatSymbols::kPercentSymbol, percent.unicodeString());
- result->setSymbol(DecimalFormatSymbols::kPerMillSymbol, UnicodeString(perMill));
+ icu::DecimalFormatSymbols* result = new icu::DecimalFormatSymbols;
+ result->setSymbol(icu::DecimalFormatSymbols::kCurrencySymbol, currencySymbol.unicodeString());
+ result->setSymbol(icu::DecimalFormatSymbols::kDecimalSeparatorSymbol, icu::UnicodeString(decimalSeparator));
+ result->setSymbol(icu::DecimalFormatSymbols::kDigitSymbol, icu::UnicodeString(digit));
+ result->setSymbol(icu::DecimalFormatSymbols::kExponentialSymbol, exponentSeparator.unicodeString());
+ result->setSymbol(icu::DecimalFormatSymbols::kGroupingSeparatorSymbol, groupingSeparator);
+ result->setSymbol(icu::DecimalFormatSymbols::kMonetaryGroupingSeparatorSymbol, groupingSeparator);
+ result->setSymbol(icu::DecimalFormatSymbols::kInfinitySymbol, infinity.unicodeString());
+ result->setSymbol(icu::DecimalFormatSymbols::kIntlCurrencySymbol, internationalCurrencySymbol.unicodeString());
+ result->setSymbol(icu::DecimalFormatSymbols::kMinusSignSymbol, minusSign.unicodeString());
+ result->setSymbol(icu::DecimalFormatSymbols::kMonetarySeparatorSymbol, icu::UnicodeString(monetaryDecimalSeparator));
+ result->setSymbol(icu::DecimalFormatSymbols::kNaNSymbol, nan.unicodeString());
+ result->setSymbol(icu::DecimalFormatSymbols::kPatternSeparatorSymbol, icu::UnicodeString(patternSeparator));
+ result->setSymbol(icu::DecimalFormatSymbols::kPercentSymbol, percent.unicodeString());
+ result->setSymbol(icu::DecimalFormatSymbols::kPerMillSymbol, icu::UnicodeString(perMill));
// java.text.DecimalFormatSymbols just uses a zero digit,
// but ICU >= 4.6 has a field for each decimal digit.
- result->setSymbol(DecimalFormatSymbols::kZeroDigitSymbol, UnicodeString(zeroDigit + 0));
- result->setSymbol(DecimalFormatSymbols::kOneDigitSymbol, UnicodeString(zeroDigit + 1));
- result->setSymbol(DecimalFormatSymbols::kTwoDigitSymbol, UnicodeString(zeroDigit + 2));
- result->setSymbol(DecimalFormatSymbols::kThreeDigitSymbol, UnicodeString(zeroDigit + 3));
- result->setSymbol(DecimalFormatSymbols::kFourDigitSymbol, UnicodeString(zeroDigit + 4));
- result->setSymbol(DecimalFormatSymbols::kFiveDigitSymbol, UnicodeString(zeroDigit + 5));
- result->setSymbol(DecimalFormatSymbols::kSixDigitSymbol, UnicodeString(zeroDigit + 6));
- result->setSymbol(DecimalFormatSymbols::kSevenDigitSymbol, UnicodeString(zeroDigit + 7));
- result->setSymbol(DecimalFormatSymbols::kEightDigitSymbol, UnicodeString(zeroDigit + 8));
- result->setSymbol(DecimalFormatSymbols::kNineDigitSymbol, UnicodeString(zeroDigit + 9));
+ result->setSymbol(icu::DecimalFormatSymbols::kZeroDigitSymbol, icu::UnicodeString(zeroDigit + 0));
+ result->setSymbol(icu::DecimalFormatSymbols::kOneDigitSymbol, icu::UnicodeString(zeroDigit + 1));
+ result->setSymbol(icu::DecimalFormatSymbols::kTwoDigitSymbol, icu::UnicodeString(zeroDigit + 2));
+ result->setSymbol(icu::DecimalFormatSymbols::kThreeDigitSymbol, icu::UnicodeString(zeroDigit + 3));
+ result->setSymbol(icu::DecimalFormatSymbols::kFourDigitSymbol, icu::UnicodeString(zeroDigit + 4));
+ result->setSymbol(icu::DecimalFormatSymbols::kFiveDigitSymbol, icu::UnicodeString(zeroDigit + 5));
+ result->setSymbol(icu::DecimalFormatSymbols::kSixDigitSymbol, icu::UnicodeString(zeroDigit + 6));
+ result->setSymbol(icu::DecimalFormatSymbols::kSevenDigitSymbol, icu::UnicodeString(zeroDigit + 7));
+ result->setSymbol(icu::DecimalFormatSymbols::kEightDigitSymbol, icu::UnicodeString(zeroDigit + 8));
+ result->setSymbol(icu::DecimalFormatSymbols::kNineDigitSymbol, icu::UnicodeString(zeroDigit + 9));
return result;
}
@@ -98,7 +98,7 @@
jstring internationalCurrencySymbol, jstring minusSign,
jchar monetaryDecimalSeparator, jstring nan, jchar patternSeparator,
jstring percent, jchar perMill, jchar zeroDigit) {
- DecimalFormatSymbols* symbols = makeDecimalFormatSymbols(env,
+ icu::DecimalFormatSymbols* symbols = makeDecimalFormatSymbols(env,
currencySymbol, decimalSeparator, digit, exponentSeparator, groupingSeparator,
infinity, internationalCurrencySymbol, minusSign,
monetaryDecimalSeparator, nan, patternSeparator, percent, perMill,
@@ -118,12 +118,12 @@
if (!pattern.valid()) {
return 0;
}
- DecimalFormatSymbols* symbols = makeDecimalFormatSymbols(env,
+ icu::DecimalFormatSymbols* symbols = makeDecimalFormatSymbols(env,
currencySymbol, decimalSeparator, digit, exponentSeparator, groupingSeparator,
infinity, internationalCurrencySymbol, minusSign,
monetaryDecimalSeparator, nan, patternSeparator, percent, perMill,
zeroDigit);
- DecimalFormat* fmt = new DecimalFormat(pattern.unicodeString(), symbols, parseError, status);
+ icu::DecimalFormat* fmt = new icu::DecimalFormat(pattern.unicodeString(), symbols, parseError, status);
if (fmt == NULL) {
delete symbols;
}
@@ -136,8 +136,8 @@
}
static void NativeDecimalFormat_setRoundingMode(JNIEnv*, jclass, jlong addr, jint mode, jdouble increment) {
- DecimalFormat* fmt = toDecimalFormat(addr);
- fmt->setRoundingMode(static_cast<DecimalFormat::ERoundingMode>(mode));
+ icu::DecimalFormat* fmt = toDecimalFormat(addr);
+ fmt->setRoundingMode(static_cast<icu::DecimalFormat::ERoundingMode>(mode));
fmt->setRoundingIncrement(increment);
}
@@ -197,7 +197,7 @@
if (!pattern.valid()) {
return;
}
- DecimalFormat* fmt = toDecimalFormat(addr);
+ icu::DecimalFormat* fmt = toDecimalFormat(addr);
UErrorCode status = U_ZERO_ERROR;
const char* function;
if (localized) {
@@ -211,8 +211,8 @@
}
static jstring NativeDecimalFormat_toPatternImpl(JNIEnv* env, jclass, jlong addr, jboolean localized) {
- DecimalFormat* fmt = toDecimalFormat(addr);
- UnicodeString pattern;
+ icu::DecimalFormat* fmt = toDecimalFormat(addr);
+ icu::UnicodeString pattern;
if (localized) {
fmt->toLocalizedPattern(pattern);
} else {
@@ -221,12 +221,12 @@
return env->NewString(pattern.getBuffer(), pattern.length());
}
-static jcharArray formatResult(JNIEnv* env, const UnicodeString& s, FieldPositionIterator* fpi, jobject javaFieldPositionIterator) {
+static jcharArray formatResult(JNIEnv* env, const icu::UnicodeString& s, icu::FieldPositionIterator* fpi, jobject javaFieldPositionIterator) {
static jmethodID gFPI_setData = env->GetMethodID(JniConstants::fieldPositionIteratorClass, "setData", "([I)V");
if (fpi != NULL) {
std::vector<int32_t> data;
- FieldPosition fp;
+ icu::FieldPosition fp;
while (fpi->next(fp)) {
data.push_back(fp.getField());
data.push_back(fp.getBeginIndex());
@@ -258,10 +258,10 @@
template <typename T>
static jcharArray format(JNIEnv* env, jlong addr, jobject javaFieldPositionIterator, T value) {
UErrorCode status = U_ZERO_ERROR;
- UnicodeString s;
- DecimalFormat* fmt = toDecimalFormat(addr);
- FieldPositionIterator nativeFieldPositionIterator;
- FieldPositionIterator* fpi = javaFieldPositionIterator ? &nativeFieldPositionIterator : NULL;
+ icu::UnicodeString s;
+ icu::DecimalFormat* fmt = toDecimalFormat(addr);
+ icu::FieldPositionIterator nativeFieldPositionIterator;
+ icu::FieldPositionIterator* fpi = javaFieldPositionIterator ? &nativeFieldPositionIterator : NULL;
fmt->format(value, s, fpi, status);
if (maybeThrowIcuException(env, "DecimalFormat::format", status)) {
return NULL;
@@ -282,7 +282,7 @@
if (chars.c_str() == NULL) {
return NULL;
}
- StringPiece sp(chars.c_str());
+ icu::StringPiece sp(chars.c_str());
return format(env, addr, javaFieldPositionIterator, sp);
}
@@ -293,7 +293,7 @@
// value is a UTF-8 string of invariant characters, but isn't guaranteed to be
// null-terminated. NewStringUTF requires a terminated UTF-8 string. So we copy the
// data to jchars using UnicodeString, and call NewString instead.
- UnicodeString tmp(value, len, UnicodeString::kInvariant);
+ icu::UnicodeString tmp(value, len, icu::UnicodeString::kInvariant);
jobject str = env->NewString(tmp.getBuffer(), tmp.length());
return env->NewObject(JniConstants::bigDecimalClass, gBigDecimal_init, str);
}
@@ -318,9 +318,9 @@
return NULL;
}
- Formattable res;
- ParsePosition pp(parsePos);
- DecimalFormat* fmt = toDecimalFormat(addr);
+ icu::Formattable res;
+ icu::ParsePosition pp(parsePos);
+ icu::DecimalFormat* fmt = toDecimalFormat(addr);
fmt->parse(src.unicodeString(), res, pp);
if (pp.getErrorIndex() == -1) {
@@ -332,7 +332,7 @@
if (parseBigDecimal) {
UErrorCode status = U_ZERO_ERROR;
- StringPiece str = res.getDecimalNumber(status);
+ icu::StringPiece str = res.getDecimalNumber(status);
if (U_SUCCESS(status)) {
int len = str.length();
const char* data = str.data();
@@ -348,15 +348,15 @@
}
switch (res.getType()) {
- case Formattable::kDouble: return doubleValueOf(env, res.getDouble());
- case Formattable::kLong: return longValueOf(env, res.getLong());
- case Formattable::kInt64: return longValueOf(env, res.getInt64());
+ case icu::Formattable::kDouble: return doubleValueOf(env, res.getDouble());
+ case icu::Formattable::kLong: return longValueOf(env, res.getLong());
+ case icu::Formattable::kInt64: return longValueOf(env, res.getInt64());
default: return NULL;
}
}
static jlong NativeDecimalFormat_cloneImpl(JNIEnv*, jclass, jlong addr) {
- DecimalFormat* fmt = toDecimalFormat(addr);
+ icu::DecimalFormat* fmt = toDecimalFormat(addr);
return reinterpret_cast<uintptr_t>(fmt->clone());
}
diff --git a/luni/src/main/native/libcore_icu_NativeNormalizer.cpp b/luni/src/main/native/libcore_icu_NativeNormalizer.cpp
index 8ae42d9..2d5e282 100644
--- a/luni/src/main/native/libcore_icu_NativeNormalizer.cpp
+++ b/luni/src/main/native/libcore_icu_NativeNormalizer.cpp
@@ -30,8 +30,8 @@
}
UNormalizationMode mode = static_cast<UNormalizationMode>(intMode);
UErrorCode status = U_ZERO_ERROR;
- UnicodeString dst;
- Normalizer::normalize(src.unicodeString(), mode, 0, dst, status);
+ icu::UnicodeString dst;
+ icu::Normalizer::normalize(src.unicodeString(), mode, 0, dst, status);
maybeThrowIcuException(env, "Normalizer::normalize", status);
return dst.isBogus() ? NULL : env->NewString(dst.getBuffer(), dst.length());
}
@@ -43,7 +43,7 @@
}
UNormalizationMode mode = static_cast<UNormalizationMode>(intMode);
UErrorCode status = U_ZERO_ERROR;
- UBool result = Normalizer::isNormalized(src.unicodeString(), mode, status);
+ UBool result = icu::Normalizer::isNormalized(src.unicodeString(), mode, status);
maybeThrowIcuException(env, "Normalizer::isNormalized", status);
return result;
}
diff --git a/luni/src/main/native/libcore_icu_NativePluralRules.cpp b/luni/src/main/native/libcore_icu_NativePluralRules.cpp
index 8910a8c..f278485 100644
--- a/luni/src/main/native/libcore_icu_NativePluralRules.cpp
+++ b/luni/src/main/native/libcore_icu_NativePluralRules.cpp
@@ -25,8 +25,8 @@
#include <string>
-static PluralRules* toPluralRules(jlong address) {
- return reinterpret_cast<PluralRules*>(static_cast<uintptr_t>(address));
+static icu::PluralRules* toPluralRules(jlong address) {
+ return reinterpret_cast<icu::PluralRules*>(static_cast<uintptr_t>(address));
}
static void NativePluralRules_finalizeImpl(JNIEnv*, jclass, jlong address) {
@@ -48,15 +48,15 @@
localeName[1] = 'i';
}
- Locale locale = Locale::createFromName(localeName.c_str());
+ icu::Locale locale = icu::Locale::createFromName(localeName.c_str());
UErrorCode status = U_ZERO_ERROR;
- PluralRules* result = PluralRules::forLocale(locale, status);
+ icu::PluralRules* result = icu::PluralRules::forLocale(locale, status);
maybeThrowIcuException(env, "PluralRules::forLocale", status);
return reinterpret_cast<uintptr_t>(result);
}
static jint NativePluralRules_quantityForIntImpl(JNIEnv*, jclass, jlong address, jint value) {
- UnicodeString keyword = toPluralRules(address)->select(value);
+ icu::UnicodeString keyword = toPluralRules(address)->select(value);
if (keyword == "zero") {
return 0;
} else if (keyword == "one") {
diff --git a/luni/src/main/native/libcore_icu_RelativeDateTimeFormatter.cpp b/luni/src/main/native/libcore_icu_RelativeDateTimeFormatter.cpp
index bba2b0e..6215d5f 100644
--- a/luni/src/main/native/libcore_icu_RelativeDateTimeFormatter.cpp
+++ b/luni/src/main/native/libcore_icu_RelativeDateTimeFormatter.cpp
@@ -31,7 +31,7 @@
}
UErrorCode status = U_ZERO_ERROR;
- RelativeDateTimeFormatter* formatter = new RelativeDateTimeFormatter(
+ icu::RelativeDateTimeFormatter* formatter = new icu::RelativeDateTimeFormatter(
icuLocale.locale(), nullptr, static_cast<UDateRelativeDateTimeFormatterStyle>(style),
static_cast<UDisplayContext>(capitalizationContext), status);
if (maybeThrowIcuException(env, "RelativeDateTimeFormatter::RelativeDateTimeFormatter", status)) {
@@ -43,13 +43,13 @@
static void RelativeDateTimeFormatter_destroyRelativeDateTimeFormatter(JNIEnv*, jclass,
jlong formatterAddress) {
- delete reinterpret_cast<RelativeDateTimeFormatter*>(static_cast<uintptr_t>(formatterAddress));
+ delete reinterpret_cast<icu::RelativeDateTimeFormatter*>(static_cast<uintptr_t>(formatterAddress));
}
static jstring RelativeDateTimeFormatter_formatWithRelativeUnit(JNIEnv* env, jclass,
jlong formatterAddress, jint quantity, jint direction, jint unit) {
- RelativeDateTimeFormatter* formatter(reinterpret_cast<RelativeDateTimeFormatter*>(formatterAddress));
- UnicodeString s;
+ icu::RelativeDateTimeFormatter* formatter(reinterpret_cast<icu::RelativeDateTimeFormatter*>(formatterAddress));
+ icu::UnicodeString s;
UErrorCode status = U_ZERO_ERROR;
// RelativeDateTimeFormatter::format() takes a double-type quantity.
formatter->format(static_cast<double>(quantity), static_cast<UDateDirection>(direction),
@@ -63,8 +63,8 @@
static jstring RelativeDateTimeFormatter_formatWithAbsoluteUnit(JNIEnv* env, jclass,
jlong formatterAddress, jint direction, jint unit) {
- RelativeDateTimeFormatter* formatter(reinterpret_cast<RelativeDateTimeFormatter*>(formatterAddress));
- UnicodeString s;
+ icu::RelativeDateTimeFormatter* formatter(reinterpret_cast<icu::RelativeDateTimeFormatter*>(formatterAddress));
+ icu::UnicodeString s;
UErrorCode status = U_ZERO_ERROR;
formatter->format(static_cast<UDateDirection>(direction), static_cast<UDateAbsoluteUnit>(unit), s, status);
if (maybeThrowIcuException(env, "RelativeDateTimeFormatter::format", status)) {
@@ -76,7 +76,7 @@
static jstring RelativeDateTimeFormatter_combineDateAndTime(JNIEnv* env, jclass,
jlong formatterAddress, jstring relativeDateString0, jstring timeString0) {
- RelativeDateTimeFormatter* formatter(reinterpret_cast<RelativeDateTimeFormatter*>(formatterAddress));
+ icu::RelativeDateTimeFormatter* formatter(reinterpret_cast<icu::RelativeDateTimeFormatter*>(formatterAddress));
ScopedJavaUnicodeString relativeDateString(env, relativeDateString0);
if (!relativeDateString.valid()) {
return 0;
@@ -86,7 +86,7 @@
if (!timeString.valid()) {
return 0;
}
- UnicodeString s;
+ icu::UnicodeString s;
UErrorCode status = U_ZERO_ERROR;
formatter->combineDateAndTime(relativeDateString.unicodeString(), timeString.unicodeString(), s, status);
if (maybeThrowIcuException(env, "RelativeDateTimeFormatter::combineDateAndTime", status)) {
diff --git a/luni/src/main/native/libcore_icu_TimeZoneNames.cpp b/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
index 2fa06c7..d30e7a3 100644
--- a/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
+++ b/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
@@ -30,27 +30,27 @@
#include "unicode/timezone.h"
#include "unicode/tznames.h"
-static bool isUtc(const UnicodeString& id) {
- static const UnicodeString kEtcUct("Etc/UCT", 7, US_INV);
- static const UnicodeString kEtcUtc("Etc/UTC", 7, US_INV);
- static const UnicodeString kEtcUniversal("Etc/Universal", 13, US_INV);
- static const UnicodeString kEtcZulu("Etc/Zulu", 8, US_INV);
+static bool isUtc(const icu::UnicodeString& id) {
+ static const icu::UnicodeString kEtcUct("Etc/UCT", 7, US_INV);
+ static const icu::UnicodeString kEtcUtc("Etc/UTC", 7, US_INV);
+ static const icu::UnicodeString kEtcUniversal("Etc/Universal", 13, US_INV);
+ static const icu::UnicodeString kEtcZulu("Etc/Zulu", 8, US_INV);
- static const UnicodeString kUct("UCT", 3, US_INV);
- static const UnicodeString kUtc("UTC", 3, US_INV);
- static const UnicodeString kUniversal("Universal", 9, US_INV);
- static const UnicodeString kZulu("Zulu", 4, US_INV);
+ static const icu::UnicodeString kUct("UCT", 3, US_INV);
+ static const icu::UnicodeString kUtc("UTC", 3, US_INV);
+ static const icu::UnicodeString kUniversal("Universal", 9, US_INV);
+ static const icu::UnicodeString kZulu("Zulu", 4, US_INV);
return id == kEtcUct || id == kEtcUtc || id == kEtcUniversal || id == kEtcZulu ||
id == kUct || id == kUtc || id == kUniversal || id == kZulu;
}
-static bool setStringArrayElement(JNIEnv* env, jobjectArray array, int i, const UnicodeString& s) {
+static bool setStringArrayElement(JNIEnv* env, jobjectArray array, int i, const icu::UnicodeString& s) {
// Fill in whatever we got. We don't use the display names if they're "GMT[+-]xx:xx"
// because icu4c doesn't use the up-to-date time zone transition data, so it gets these
// wrong. TimeZone.getDisplayName creates accurate names on demand.
// TODO: investigate whether it's worth doing that work once in the Java wrapper instead of on-demand.
- static const UnicodeString kGmt("GMT", 3, US_INV);
+ static const icu::UnicodeString kGmt("GMT", 3, US_INV);
if (!s.isBogus() && !s.startsWith(kGmt)) {
ScopedLocalRef<jstring> javaString(env, env->NewString(s.getBuffer(), s.length()));
if (javaString.get() == NULL) {
@@ -68,14 +68,14 @@
}
UErrorCode status = U_ZERO_ERROR;
- std::unique_ptr<TimeZoneNames> names(TimeZoneNames::createInstance(icuLocale.locale(), status));
+ std::unique_ptr<icu::TimeZoneNames> names(icu::TimeZoneNames::createInstance(icuLocale.locale(), status));
if (maybeThrowIcuException(env, "TimeZoneNames::createInstance", status)) {
return;
}
- const UDate now(Calendar::getNow());
+ const UDate now(icu::Calendar::getNow());
- static const UnicodeString kUtc("UTC", 3, US_INV);
+ static const icu::UnicodeString kUtc("UTC", 3, US_INV);
size_t id_count = env->GetArrayLength(result);
for (size_t i = 0; i < id_count; ++i) {
@@ -88,13 +88,13 @@
return;
}
- UnicodeString long_std;
+ icu::UnicodeString long_std;
names->getDisplayName(zone_id.unicodeString(), UTZNM_LONG_STANDARD, now, long_std);
- UnicodeString short_std;
+ icu::UnicodeString short_std;
names->getDisplayName(zone_id.unicodeString(), UTZNM_SHORT_STANDARD, now, short_std);
- UnicodeString long_dst;
+ icu::UnicodeString long_dst;
names->getDisplayName(zone_id.unicodeString(), UTZNM_LONG_DAYLIGHT, now, long_dst);
- UnicodeString short_dst;
+ icu::UnicodeString short_dst;
names->getDisplayName(zone_id.unicodeString(), UTZNM_SHORT_DAYLIGHT, now, short_dst);
if (isUtc(zone_id.unicodeString())) {
@@ -124,7 +124,7 @@
}
UErrorCode status = U_ZERO_ERROR;
- std::unique_ptr<TimeZoneNames> names(TimeZoneNames::createInstance(icuLocale.locale(), status));
+ std::unique_ptr<icu::TimeZoneNames> names(icu::TimeZoneNames::createInstance(icuLocale.locale(), status));
if (maybeThrowIcuException(env, "TimeZoneNames::createInstance", status)) {
return NULL;
}
@@ -134,8 +134,8 @@
return NULL;
}
- UnicodeString s;
- const UDate now(Calendar::getNow());
+ icu::UnicodeString s;
+ const UDate now(icu::Calendar::getNow());
names->getDisplayName(tz.unicodeString(), UTZNM_EXEMPLAR_LOCATION, now, s);
return env->NewString(s.getBuffer(), s.length());
}
diff --git a/luni/src/main/native/libcore_icu_Transliterator.cpp b/luni/src/main/native/libcore_icu_Transliterator.cpp
index 0c52053..ae21565 100644
--- a/luni/src/main/native/libcore_icu_Transliterator.cpp
+++ b/luni/src/main/native/libcore_icu_Transliterator.cpp
@@ -23,8 +23,8 @@
#include "ScopedJavaUnicodeString.h"
#include "unicode/translit.h"
-static Transliterator* fromPeer(jlong peer) {
- return reinterpret_cast<Transliterator*>(static_cast<uintptr_t>(peer));
+static icu::Transliterator* fromPeer(jlong peer) {
+ return reinterpret_cast<icu::Transliterator*>(static_cast<uintptr_t>(peer));
}
static jlong Transliterator_create(JNIEnv* env, jclass, jstring javaId) {
@@ -33,7 +33,7 @@
return 0;
}
UErrorCode status = U_ZERO_ERROR;
- Transliterator* t = Transliterator::createInstance(id.unicodeString(), UTRANS_FORWARD, status);
+ icu::Transliterator* t = icu::Transliterator::createInstance(id.unicodeString(), UTRANS_FORWARD, status);
if (maybeThrowIcuException(env, "Transliterator::createInstance", status)) {
return 0;
}
@@ -46,18 +46,18 @@
static jobjectArray Transliterator_getAvailableIDs(JNIEnv* env, jclass) {
UErrorCode status = U_ZERO_ERROR;
- StringEnumeration* e = Transliterator::getAvailableIDs(status);
+ icu::StringEnumeration* e = icu::Transliterator::getAvailableIDs(status);
return fromStringEnumeration(env, status, "Transliterator::getAvailableIDs", e);
}
static jstring Transliterator_transliterate(JNIEnv* env, jclass, jlong peer, jstring javaString) {
- Transliterator* t = fromPeer(peer);
+ icu::Transliterator* t = fromPeer(peer);
ScopedJavaUnicodeString string(env, javaString);
if (!string.valid()) {
return NULL;
}
- UnicodeString& s(string.unicodeString());
+ icu::UnicodeString& s(string.unicodeString());
t->transliterate(s);
return env->NewString(s.getBuffer(), s.length());
}
diff --git a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index ed0ee8b..48defc1 100644
--- a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -440,7 +440,7 @@
return -1;
}
UErrorCode status = U_ZERO_ERROR;
- UnicodeString utf16(UnicodeString::fromUTF8(StringPiece(utf8, byteCount)));
+ icu::UnicodeString utf16(icu::UnicodeString::fromUTF8(icu::StringPiece(utf8, byteCount)));
return utf16.extract(chars.get(), byteCount, status);
}