summaryrefslogtreecommitdiffstats
path: root/icu/src/main/native
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-04-16 14:14:28 -0700
committerElliott Hughes <enh@google.com>2010-04-16 14:48:27 -0700
commit757a7942eed2b0aa457f8517a0259d2ac82c5b18 (patch)
tree00f74b34ca4edeac65d9cb38d8291ee249f5a806 /icu/src/main/native
parentb988f4652e9325f77c60c5aa4d71a703a0793ec3 (diff)
downloadlibcore-757a7942eed2b0aa457f8517a0259d2ac82c5b18.zip
libcore-757a7942eed2b0aa457f8517a0259d2ac82c5b18.tar.gz
libcore-757a7942eed2b0aa457f8517a0259d2ac82c5b18.tar.bz2
Merge LocaleData and Resources, rename Resources to ICU.
Also move our ICU tests into our little tree of tests. Bug: 2596471 Change-Id: I73b53d74c26ef9bf670f12cac58b51ba61eefead
Diffstat (limited to 'icu/src/main/native')
-rw-r--r--icu/src/main/native/BidiWrapper.cpp1
-rw-r--r--icu/src/main/native/ICU.cpp (renamed from icu/src/main/native/Resources.cpp)60
-rw-r--r--icu/src/main/native/NativeBreakIterator.cpp2
-rw-r--r--icu/src/main/native/NativeCollation.cpp2
-rw-r--r--icu/src/main/native/NativeConverter.cpp2
-rw-r--r--icu/src/main/native/NativeDecimalFormat.cpp1
-rw-r--r--icu/src/main/native/NativeIDN.cpp2
-rw-r--r--icu/src/main/native/NativeNormalizer.cpp2
-rw-r--r--icu/src/main/native/NativeRegEx.cpp2
-rw-r--r--icu/src/main/native/UCharacter.cpp1
-rw-r--r--icu/src/main/native/sub.mk2
11 files changed, 37 insertions, 40 deletions
diff --git a/icu/src/main/native/BidiWrapper.cpp b/icu/src/main/native/BidiWrapper.cpp
index 68419c0..7a25ff1 100644
--- a/icu/src/main/native/BidiWrapper.cpp
+++ b/icu/src/main/native/BidiWrapper.cpp
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#define LOG_TAG "BidiWrapper"
#include "AndroidSystemNatives.h"
#include <JNIHelp.h>
#include "ErrorCode.h"
diff --git a/icu/src/main/native/Resources.cpp b/icu/src/main/native/ICU.cpp
index fb53f87..3066edb 100644
--- a/icu/src/main/native/Resources.cpp
+++ b/icu/src/main/native/ICU.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#define LOG_TAG "Resources"
+#define LOG_TAG "ICU"
#include "JNIHelp.h"
#include "AndroidSystemNatives.h"
#include "ScopedUtfChars.h"
+#include "UniquePtr.h"
#include "cutils/log.h"
#include "unicode/numfmt.h"
#include "unicode/locid.h"
@@ -72,28 +73,23 @@ static Locale getLocale(JNIEnv* env, jstring localeName) {
return Locale::createFromName(ScopedUtfChars(env, localeName).data());
}
-static jint getCurrencyFractionDigitsNative(JNIEnv* env, jclass clazz, jstring currencyCode) {
+static jint getCurrencyFractionDigitsNative(JNIEnv* env, jclass, jstring currencyCode) {
UErrorCode status = U_ZERO_ERROR;
-
- NumberFormat* fmt = NumberFormat::createCurrencyInstance(status);
+ UniquePtr<NumberFormat> fmt(NumberFormat::createCurrencyInstance(status));
if (U_FAILURE(status)) {
return -1;
}
-
const jchar* cCode = env->GetStringChars(currencyCode, NULL);
fmt->setCurrency(cCode, status);
env->ReleaseStringChars(currencyCode, cCode);
if (U_FAILURE(status)) {
return -1;
}
-
// for CurrencyFormats the minimum and maximum fraction digits are the same.
- int result = fmt->getMinimumFractionDigits();
- delete fmt;
- return result;
+ return fmt->getMinimumFractionDigits();
}
-static jstring getCurrencyCodeNative(JNIEnv* env, jclass clazz, jstring key) {
+static jstring getCurrencyCodeNative(JNIEnv* env, jclass, jstring key) {
UErrorCode status = U_ZERO_ERROR;
ScopedResourceBundle supplData(ures_openDirect(NULL, "supplementalData", &status));
if (U_FAILURE(status)) {
@@ -142,8 +138,7 @@ static jstring getCurrencyCodeNative(JNIEnv* env, jclass clazz, jstring key) {
return env->NewString(id, length);
}
-static jstring getCurrencySymbolNative(JNIEnv* env, jclass clazz,
- jstring locale, jstring currencyCode) {
+static jstring getCurrencySymbolNative(JNIEnv* env, jclass, jstring locale, jstring currencyCode) {
// LOGI("ENTER getCurrencySymbolNative");
const char* locName = env->GetStringUTFChars(locale, NULL);
@@ -175,8 +170,7 @@ static jstring getCurrencySymbolNative(JNIEnv* env, jclass clazz,
return (currSymbL == 0) ? NULL : env->NewString(currSymbU, currSymbL);
}
-static jstring getDisplayCountryNative(JNIEnv* env, jclass clazz,
- jstring targetLocale, jstring locale) {
+static jstring getDisplayCountryNative(JNIEnv* env, jclass, jstring targetLocale, jstring locale) {
Locale loc = getLocale(env, locale);
Locale targetLoc = getLocale(env, targetLocale);
@@ -186,8 +180,7 @@ static jstring getDisplayCountryNative(JNIEnv* env, jclass clazz,
return env->NewString(str.getBuffer(), str.length());
}
-static jstring getDisplayLanguageNative(JNIEnv* env, jclass clazz,
- jstring targetLocale, jstring locale) {
+static jstring getDisplayLanguageNative(JNIEnv* env, jclass, jstring targetLocale, jstring locale) {
Locale loc = getLocale(env, locale);
Locale targetLoc = getLocale(env, targetLocale);
@@ -197,23 +190,20 @@ static jstring getDisplayLanguageNative(JNIEnv* env, jclass clazz,
return env->NewString(str.getBuffer(), str.length());
}
-static jstring getDisplayVariantNative(JNIEnv* env, jclass clazz,
- jstring targetLocale, jstring locale) {
-
+static jstring getDisplayVariantNative(JNIEnv* env, jclass, jstring targetLocale, jstring locale) {
Locale loc = getLocale(env, locale);
Locale targetLoc = getLocale(env, targetLocale);
-
UnicodeString str;
targetLoc.getDisplayVariant(loc, str);
return env->NewString(str.getBuffer(), str.length());
}
-static jstring getISO3CountryNative(JNIEnv* env, jclass clazz, jstring locale) {
+static jstring getISO3CountryNative(JNIEnv* env, jclass, jstring locale) {
Locale loc = getLocale(env, locale);
return env->NewStringUTF(loc.getISO3Country());
}
-static jstring getISO3LanguageNative(JNIEnv* env, jclass clazz, jstring locale) {
+static jstring getISO3LanguageNative(JNIEnv* env, jclass, jstring locale) {
Locale loc = getLocale(env, locale);
return env->NewStringUTF(loc.getISO3Language());
}
@@ -232,11 +222,11 @@ static jobjectArray toStringArray(JNIEnv* env, const char* const* strings) {
return result;
}
-static jobjectArray getISOCountriesNative(JNIEnv* env, jclass clazz) {
+static jobjectArray getISOCountriesNative(JNIEnv* env, jclass) {
return toStringArray(env, Locale::getISOCountries());
}
-static jobjectArray getISOLanguagesNative(JNIEnv* env, jclass clazz) {
+static jobjectArray getISOLanguagesNative(JNIEnv* env, jclass) {
return toStringArray(env, Locale::getISOLanguages());
}
@@ -289,9 +279,7 @@ static jstring formatDate(JNIEnv* env, const SimpleDateFormat& fmt, const UDate&
return env->NewString(str.getBuffer(), str.length());
}
-static void getTimeZonesNative(JNIEnv* env, jclass clazz,
- jobjectArray outerArray, jstring locale) {
-
+static void getTimeZonesNative(JNIEnv* env, jclass, jobjectArray outerArray, jstring locale) {
// get all timezone objects
jobjectArray zoneIdArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 0);
int count = env->GetArrayLength(zoneIdArray);
@@ -361,18 +349,13 @@ static void getTimeZonesNative(JNIEnv* env, jclass clazz,
}
}
-static jstring getDisplayTimeZoneNative(JNIEnv* env, jclass clazz,
- jstring zoneId, jboolean isDST, jint style, jstring localeId) {
-
- TimeZone* zone = timeZoneFromId(env, zoneId);
+static jstring getDisplayTimeZoneNative(JNIEnv* env, jclass, jstring zoneId, jboolean isDST, jint style, jstring localeId) {
+ UniquePtr<TimeZone> zone(timeZoneFromId(env, zoneId));
Locale locale = getLocale(env, localeId);
-
// Try to get the display name of the TimeZone according to the Locale
UnicodeString displayName;
zone->getDisplayName((UBool)isDST, (style == 0 ? TimeZone::SHORT : TimeZone::LONG), locale, displayName);
- jstring result = env->NewString(displayName.getBuffer(), displayName.length());
- delete zone;
- return result;
+ return env->NewString(displayName.getBuffer(), displayName.length());
}
static bool getDayIntVector(JNIEnv* env, UResourceBundle* gregorian, int* values) {
@@ -604,7 +587,7 @@ static void setCharField(JNIEnv* env, jobject obj, const char* fieldName, UResou
}
}
-static jboolean initLocaleDataImpl(JNIEnv* env, jclass clazz, jstring locale, jobject localeData) {
+static jboolean initLocaleDataImpl(JNIEnv* env, jclass, jstring locale, jobject localeData) {
const char* loc = env->GetStringUTFChars(locale, NULL);
UErrorCode status = U_ZERO_ERROR;
ScopedResourceBundle root(ures_openU(NULL, loc, &status));
@@ -674,7 +657,7 @@ static jboolean initLocaleDataImpl(JNIEnv* env, jclass clazz, jstring locale, jo
jstring internationalCurrencySymbol = getIntCurrencyCode(env, locale);
jstring currencySymbol = NULL;
if (internationalCurrencySymbol != NULL) {
- currencySymbol = getCurrencySymbolNative(env, clazz, locale, internationalCurrencySymbol);
+ currencySymbol = getCurrencySymbolNative(env, NULL, locale, internationalCurrencySymbol);
} else {
internationalCurrencySymbol = env->NewStringUTF("XXX");
}
@@ -725,6 +708,5 @@ int register_com_ibm_icu4jni_util_Resources(JNIEnv* env) {
}
string_class = (jclass) env->NewGlobalRef(stringclass);
- return jniRegisterNativeMethods(env, "com/ibm/icu4jni/util/Resources",
- gMethods, NELEM(gMethods));
+ return jniRegisterNativeMethods(env, "com/ibm/icu4jni/util/ICU", gMethods, NELEM(gMethods));
}
diff --git a/icu/src/main/native/NativeBreakIterator.cpp b/icu/src/main/native/NativeBreakIterator.cpp
index 6cc774b..5b12ba3 100644
--- a/icu/src/main/native/NativeBreakIterator.cpp
+++ b/icu/src/main/native/NativeBreakIterator.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "NativeBreakIterator"
+
#include "JNIHelp.h"
#include "AndroidSystemNatives.h"
#include "ErrorCode.h"
diff --git a/icu/src/main/native/NativeCollation.cpp b/icu/src/main/native/NativeCollation.cpp
index 148c16e..5bc7749 100644
--- a/icu/src/main/native/NativeCollation.cpp
+++ b/icu/src/main/native/NativeCollation.cpp
@@ -7,6 +7,8 @@
*******************************************************************************
*/
+#define LOG_TAG "NativeCollation"
+
#include "JNIHelp.h"
#include "AndroidSystemNatives.h"
#include "ErrorCode.h"
diff --git a/icu/src/main/native/NativeConverter.cpp b/icu/src/main/native/NativeConverter.cpp
index 1bb9ac8..f227f3d 100644
--- a/icu/src/main/native/NativeConverter.cpp
+++ b/icu/src/main/native/NativeConverter.cpp
@@ -15,6 +15,8 @@
* @author: Ram Viswanadha
*/
+#define LOG_TAG "NativeConverter"
+
#include "AndroidSystemNatives.h"
#include "ErrorCode.h"
#include "JNIHelp.h"
diff --git a/icu/src/main/native/NativeDecimalFormat.cpp b/icu/src/main/native/NativeDecimalFormat.cpp
index b62e5b1..6909553 100644
--- a/icu/src/main/native/NativeDecimalFormat.cpp
+++ b/icu/src/main/native/NativeDecimalFormat.cpp
@@ -15,6 +15,7 @@
*/
#define LOG_TAG "NativeDecimalFormat"
+
#include "JNIHelp.h"
#include "AndroidSystemNatives.h"
#include "cutils/log.h"
diff --git a/icu/src/main/native/NativeIDN.cpp b/icu/src/main/native/NativeIDN.cpp
index 72afc74..2b45dbe 100644
--- a/icu/src/main/native/NativeIDN.cpp
+++ b/icu/src/main/native/NativeIDN.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "NativeIDN"
+
#include "ErrorCode.h"
#include "JNIHelp.h"
#include "ScopedJavaUnicodeString.h"
diff --git a/icu/src/main/native/NativeNormalizer.cpp b/icu/src/main/native/NativeNormalizer.cpp
index 0aa7d29..663a7c1 100644
--- a/icu/src/main/native/NativeNormalizer.cpp
+++ b/icu/src/main/native/NativeNormalizer.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "NativeNormalizer"
+
#include "ErrorCode.h"
#include "JNIHelp.h"
#include "ScopedJavaUnicodeString.h"
diff --git a/icu/src/main/native/NativeRegEx.cpp b/icu/src/main/native/NativeRegEx.cpp
index 7b3cafc..f8be4ee 100644
--- a/icu/src/main/native/NativeRegEx.cpp
+++ b/icu/src/main/native/NativeRegEx.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "NativeRegEx"
+
#include "AndroidSystemNatives.h"
#include <stdlib.h>
diff --git a/icu/src/main/native/UCharacter.cpp b/icu/src/main/native/UCharacter.cpp
index 9856a1a..4186b75 100644
--- a/icu/src/main/native/UCharacter.cpp
+++ b/icu/src/main/native/UCharacter.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#define LOG_TAG "UCharacter"
#include "JNIHelp.h"
#include "AndroidSystemNatives.h"
#include "ScopedJavaUnicodeString.h"
diff --git a/icu/src/main/native/sub.mk b/icu/src/main/native/sub.mk
index f72db1b..599c102 100644
--- a/icu/src/main/native/sub.mk
+++ b/icu/src/main/native/sub.mk
@@ -5,6 +5,7 @@
LOCAL_SRC_FILES := \
BidiWrapper.cpp \
ErrorCode.cpp \
+ ICU.cpp \
NativeBreakIterator.cpp \
NativeCollation.cpp \
NativeConverter.cpp \
@@ -12,7 +13,6 @@ LOCAL_SRC_FILES := \
NativeIDN.cpp \
NativeNormalizer.cpp \
NativeRegEx.cpp \
- Resources.cpp \
UCharacter.cpp
LOCAL_C_INCLUDES += \