diff options
author | Elliott Hughes <enh@google.com> | 2013-04-23 00:39:39 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-04-23 00:39:40 +0000 |
commit | 0451730faea2642b759d22134a6f35dc394aa555 (patch) | |
tree | ac03086d3b8b50ca46416be658a98aaef923a32f /luni | |
parent | 60d77a525c05c0d0a5d70d2a903ab3a9029dd58d (diff) | |
parent | 1e5d730e58d94c3bfa14b7dde5ab3981fe5a170b (diff) | |
download | libcore-0451730faea2642b759d22134a6f35dc394aa555.zip libcore-0451730faea2642b759d22134a6f35dc394aa555.tar.gz libcore-0451730faea2642b759d22134a6f35dc394aa555.tar.bz2 |
Merge "More 64-bit fixes for libcore native code."
Diffstat (limited to 'luni')
10 files changed, 128 insertions, 128 deletions
diff --git a/luni/src/main/java/libcore/icu/CollationElementIteratorICU.java b/luni/src/main/java/libcore/icu/CollationElementIteratorICU.java index 05caa0b..5779d17 100644 --- a/luni/src/main/java/libcore/icu/CollationElementIteratorICU.java +++ b/luni/src/main/java/libcore/icu/CollationElementIteratorICU.java @@ -155,12 +155,12 @@ public final class CollationElementIteratorICU { return order & TERTIARY_ORDER_MASK_; } - public static CollationElementIteratorICU getInstance(int collatorAddress, String source) { - int iteratorAddress = NativeCollation.getCollationElementIterator(collatorAddress, source); + public static CollationElementIteratorICU getInstance(long collatorAddress, String source) { + long iteratorAddress = NativeCollation.getCollationElementIterator(collatorAddress, source); return new CollationElementIteratorICU(iteratorAddress); } - private CollationElementIteratorICU(int address) { + private CollationElementIteratorICU(long address) { this.address = address; } @@ -184,7 +184,7 @@ public final class CollationElementIteratorICU { /** * C collator */ - private int address; + private final long address; /** * ICU constant primary order mask for collation elements diff --git a/luni/src/main/java/libcore/icu/NativeBreakIterator.java b/luni/src/main/java/libcore/icu/NativeBreakIterator.java index 4156f9a..7168d96 100644 --- a/luni/src/main/java/libcore/icu/NativeBreakIterator.java +++ b/luni/src/main/java/libcore/icu/NativeBreakIterator.java @@ -29,13 +29,13 @@ public final class NativeBreakIterator implements Cloneable { // The address of the native peer. // Uses of this must be manually synchronized to avoid native crashes. - private final int address; + private final long address; private final int type; private String string; private CharacterIterator charIterator; - private NativeBreakIterator(int address, int type) { + private NativeBreakIterator(long address, int type) { this.address = address; this.type = type; this.charIterator = new StringCharacterIterator(""); @@ -43,7 +43,7 @@ public final class NativeBreakIterator implements Cloneable { @Override public Object clone() { - int cloneAddr = cloneImpl(this.address); + long cloneAddr = cloneImpl(this.address); NativeBreakIterator clone = new NativeBreakIterator(cloneAddr, this.type); clone.string = this.string; // The RI doesn't clone the CharacterIterator. @@ -157,21 +157,21 @@ public final class NativeBreakIterator implements Cloneable { return new NativeBreakIterator(getWordInstanceImpl(where.toString()), BI_WORD_INSTANCE); } - private static native int getCharacterInstanceImpl(String locale); - private static native int getWordInstanceImpl(String locale); - private static native int getLineInstanceImpl(String locale); - private static native int getSentenceInstanceImpl(String locale); - private static synchronized native int cloneImpl(int address); + private static native long getCharacterInstanceImpl(String locale); + private static native long getWordInstanceImpl(String locale); + private static native long getLineInstanceImpl(String locale); + private static native long getSentenceInstanceImpl(String locale); + private static synchronized native long cloneImpl(long address); - private static synchronized native void closeImpl(int address); + private static synchronized native void closeImpl(long address); - private static synchronized native void setTextImpl(int address, String text); - private static synchronized native int precedingImpl(int address, String text, int offset); - private static synchronized native boolean isBoundaryImpl(int address, String text, int offset); - private static synchronized native int nextImpl(int address, String text, int n); - private static synchronized native int previousImpl(int address, String text); - private static synchronized native int currentImpl(int address, String text); - private static synchronized native int firstImpl(int address, String text); - private static synchronized native int followingImpl(int address, String text, int offset); - private static synchronized native int lastImpl(int address, String text); + private static synchronized native void setTextImpl(long address, String text); + private static synchronized native int precedingImpl(long address, String text, int offset); + private static synchronized native boolean isBoundaryImpl(long address, String text, int offset); + private static synchronized native int nextImpl(long address, String text, int n); + private static synchronized native int previousImpl(long address, String text); + private static synchronized native int currentImpl(long address, String text); + private static synchronized native int firstImpl(long address, String text); + private static synchronized native int followingImpl(long address, String text, int offset); + private static synchronized native int lastImpl(long address, String text); } diff --git a/luni/src/main/java/libcore/icu/NativeCollation.java b/luni/src/main/java/libcore/icu/NativeCollation.java index 2f61c49..0373fef 100644 --- a/luni/src/main/java/libcore/icu/NativeCollation.java +++ b/luni/src/main/java/libcore/icu/NativeCollation.java @@ -20,24 +20,24 @@ public final class NativeCollation { } // Collator. - public static native void closeCollator(int address); - public static native int compare(int address, String source, String target); - public static native int getAttribute(int address, int type); - public static native int getCollationElementIterator(int address, String source); - public static native String getRules(int address); - public static native byte[] getSortKey(int address, String source); - public static native int openCollator(String locale); - public static native int openCollatorFromRules(String rules, int normalizationMode, int collationStrength); - public static native int safeClone(int address); - public static native void setAttribute(int address, int type, int value); + public static native void closeCollator(long address); + public static native int compare(long address, String source, String target); + public static native int getAttribute(long address, int type); + public static native int getCollationElementIterator(long address, String source); + public static native String getRules(long address); + public static native byte[] getSortKey(long address, String source); + public static native long openCollator(String locale); + public static native long openCollatorFromRules(String rules, int normalizationMode, int collationStrength); + public static native long safeClone(long address); + public static native void setAttribute(long address, int type, int value); // CollationElementIterator. - public static native void closeElements(int address); - public static native int getMaxExpansion(int address, int order); - public static native int getOffset(int address); - public static native int next(int address); - public static native int previous(int address); - public static native void reset(int address); - public static native void setOffset(int address, int offset); - public static native void setText(int address, String source); + public static native void closeElements(long address); + public static native int getMaxExpansion(long address, int order); + public static native int getOffset(long address); + public static native int next(long address); + public static native int previous(long address); + public static native void reset(long address); + public static native void setOffset(long address, int offset); + public static native void setText(long address, String source); } diff --git a/luni/src/main/java/libcore/icu/NativeDecimalFormat.java b/luni/src/main/java/libcore/icu/NativeDecimalFormat.java index 376526e..0e9ffc4 100644 --- a/luni/src/main/java/libcore/icu/NativeDecimalFormat.java +++ b/luni/src/main/java/libcore/icu/NativeDecimalFormat.java @@ -621,7 +621,7 @@ public final class NativeDecimalFormat implements Cloneable { } private static native void applyPatternImpl(long addr, boolean localized, String pattern); - private static native int cloneImpl(long addr); + private static native long cloneImpl(long addr); private static native void close(long addr); private static native char[] formatLong(long addr, long value, FieldPositionIterator iter); private static native char[] formatDouble(long addr, double value, FieldPositionIterator iter); diff --git a/luni/src/main/java/libcore/icu/NativePluralRules.java b/luni/src/main/java/libcore/icu/NativePluralRules.java index 47cc76b..dbcf089 100644 --- a/luni/src/main/java/libcore/icu/NativePluralRules.java +++ b/luni/src/main/java/libcore/icu/NativePluralRules.java @@ -32,9 +32,9 @@ public final class NativePluralRules { public static final int MANY = 4; public static final int OTHER = 5; - private final int address; + private final long address; - private NativePluralRules(int address) { + private NativePluralRules(long address) { this.address = address; } @@ -58,7 +58,7 @@ public final class NativePluralRules { return quantityForIntImpl(address, value); } - private static native void finalizeImpl(int address); - private static native int forLocaleImpl(String localeName); - private static native int quantityForIntImpl(int address, int value); + private static native void finalizeImpl(long address); + private static native long forLocaleImpl(String localeName); + private static native int quantityForIntImpl(long address, int value); } diff --git a/luni/src/main/java/libcore/icu/RuleBasedCollatorICU.java b/luni/src/main/java/libcore/icu/RuleBasedCollatorICU.java index 4221fe6..3ea942d 100644 --- a/luni/src/main/java/libcore/icu/RuleBasedCollatorICU.java +++ b/luni/src/main/java/libcore/icu/RuleBasedCollatorICU.java @@ -42,7 +42,7 @@ public final class RuleBasedCollatorICU implements Cloneable { public static final int STRENGTH = 5; // The address of the ICU4C native peer. - private int address; + private final long address; public RuleBasedCollatorICU(String rules) throws ParseException { if (rules == null) { @@ -55,7 +55,7 @@ public final class RuleBasedCollatorICU implements Cloneable { address = NativeCollation.openCollator(locale.toString()); } - private RuleBasedCollatorICU(int address) { + private RuleBasedCollatorICU(long address) { this.address = address; } diff --git a/luni/src/main/native/libcore_icu_NativeBreakIterator.cpp b/luni/src/main/native/libcore_icu_NativeBreakIterator.cpp index c025a60..5d715c9 100644 --- a/luni/src/main/native/libcore_icu_NativeBreakIterator.cpp +++ b/luni/src/main/native/libcore_icu_NativeBreakIterator.cpp @@ -27,7 +27,7 @@ // ICU documentation: http://icu-project.org/apiref/icu4c/classBreakIterator.html -static BreakIterator* toBreakIterator(jint address) { +static BreakIterator* toBreakIterator(jlong address) { return reinterpret_cast<BreakIterator*>(static_cast<uintptr_t>(address)); } @@ -39,7 +39,7 @@ static BreakIterator* toBreakIterator(jint address) { */ class BreakIteratorAccessor { public: - BreakIteratorAccessor(JNIEnv* env, jint address, jstring javaInput, bool reset) { + BreakIteratorAccessor(JNIEnv* env, jlong address, jstring javaInput, bool reset) { init(env, address); mJavaInput = javaInput; @@ -64,7 +64,7 @@ class BreakIteratorAccessor { } } - BreakIteratorAccessor(JNIEnv* env, jint address) { + BreakIteratorAccessor(JNIEnv* env, jlong address) { init(env, address); } @@ -85,7 +85,7 @@ class BreakIteratorAccessor { } private: - void init(JNIEnv* env, jint address) { + void init(JNIEnv* env, jlong address) { mEnv = env; mJavaInput = NULL; mBreakIterator = toBreakIterator(address); @@ -119,26 +119,26 @@ class BreakIteratorAccessor { } \ return reinterpret_cast<uintptr_t>(it) -static jint NativeBreakIterator_cloneImpl(JNIEnv* env, jclass, jint address) { +static jint NativeBreakIterator_cloneImpl(JNIEnv* env, jclass, jlong address) { BreakIteratorAccessor it(env, address); return reinterpret_cast<uintptr_t>(it->clone()); } -static void NativeBreakIterator_closeImpl(JNIEnv*, jclass, jint address) { +static void NativeBreakIterator_closeImpl(JNIEnv*, jclass, jlong address) { delete toBreakIterator(address); } -static jint NativeBreakIterator_currentImpl(JNIEnv* env, jclass, jint address, jstring javaInput) { +static jint NativeBreakIterator_currentImpl(JNIEnv* env, jclass, jlong address, jstring javaInput) { BreakIteratorAccessor it(env, address, javaInput, false); return it->current(); } -static jint NativeBreakIterator_firstImpl(JNIEnv* env, jclass, jint address, jstring javaInput) { +static jint NativeBreakIterator_firstImpl(JNIEnv* env, jclass, jlong address, jstring javaInput) { BreakIteratorAccessor it(env, address, javaInput, false); return it->first(); } -static jint NativeBreakIterator_followingImpl(JNIEnv* env, jclass, jint address, jstring javaInput, jint offset) { +static jint NativeBreakIterator_followingImpl(JNIEnv* env, jclass, jlong address, jstring javaInput, jint offset) { BreakIteratorAccessor it(env, address, javaInput, false); return it->following(offset); } @@ -159,17 +159,17 @@ static jint NativeBreakIterator_getWordInstanceImpl(JNIEnv* env, jclass, jstring MAKE_BREAK_ITERATOR_INSTANCE(BreakIterator::createWordInstance); } -static jboolean NativeBreakIterator_isBoundaryImpl(JNIEnv* env, jclass, jint address, jstring javaInput, jint offset) { +static jboolean NativeBreakIterator_isBoundaryImpl(JNIEnv* env, jclass, jlong address, jstring javaInput, jint offset) { BreakIteratorAccessor it(env, address, javaInput, false); return it->isBoundary(offset); } -static jint NativeBreakIterator_lastImpl(JNIEnv* env, jclass, jint address, jstring javaInput) { +static jint NativeBreakIterator_lastImpl(JNIEnv* env, jclass, jlong address, jstring javaInput) { BreakIteratorAccessor it(env, address, javaInput, false); return it->last(); } -static jint NativeBreakIterator_nextImpl(JNIEnv* env, jclass, jint address, jstring javaInput, jint n) { +static jint NativeBreakIterator_nextImpl(JNIEnv* env, jclass, jlong address, jstring javaInput, jint n) { BreakIteratorAccessor it(env, address, javaInput, false); if (n < 0) { while (n++ < -1) { @@ -187,36 +187,36 @@ static jint NativeBreakIterator_nextImpl(JNIEnv* env, jclass, jint address, jstr return -1; } -static jint NativeBreakIterator_precedingImpl(JNIEnv* env, jclass, jint address, jstring javaInput, jint offset) { +static jint NativeBreakIterator_precedingImpl(JNIEnv* env, jclass, jlong address, jstring javaInput, jint offset) { BreakIteratorAccessor it(env, address, javaInput, false); return it->preceding(offset); } -static jint NativeBreakIterator_previousImpl(JNIEnv* env, jclass, jint address, jstring javaInput) { +static jint NativeBreakIterator_previousImpl(JNIEnv* env, jclass, jlong address, jstring javaInput) { BreakIteratorAccessor it(env, address, javaInput, false); return it->previous(); } -static void NativeBreakIterator_setTextImpl(JNIEnv* env, jclass, jint address, jstring javaInput) { +static void NativeBreakIterator_setTextImpl(JNIEnv* env, jclass, jlong address, jstring javaInput) { BreakIteratorAccessor it(env, address, javaInput, true); } static JNINativeMethod gMethods[] = { - NATIVE_METHOD(NativeBreakIterator, cloneImpl, "(I)I"), - NATIVE_METHOD(NativeBreakIterator, closeImpl, "(I)V"), - NATIVE_METHOD(NativeBreakIterator, currentImpl, "(ILjava/lang/String;)I"), - NATIVE_METHOD(NativeBreakIterator, firstImpl, "(ILjava/lang/String;)I"), - NATIVE_METHOD(NativeBreakIterator, followingImpl, "(ILjava/lang/String;I)I"), - NATIVE_METHOD(NativeBreakIterator, getCharacterInstanceImpl, "(Ljava/lang/String;)I"), - NATIVE_METHOD(NativeBreakIterator, getLineInstanceImpl, "(Ljava/lang/String;)I"), - NATIVE_METHOD(NativeBreakIterator, getSentenceInstanceImpl, "(Ljava/lang/String;)I"), - NATIVE_METHOD(NativeBreakIterator, getWordInstanceImpl, "(Ljava/lang/String;)I"), - NATIVE_METHOD(NativeBreakIterator, isBoundaryImpl, "(ILjava/lang/String;I)Z"), - NATIVE_METHOD(NativeBreakIterator, lastImpl, "(ILjava/lang/String;)I"), - NATIVE_METHOD(NativeBreakIterator, nextImpl, "(ILjava/lang/String;I)I"), - NATIVE_METHOD(NativeBreakIterator, precedingImpl, "(ILjava/lang/String;I)I"), - NATIVE_METHOD(NativeBreakIterator, previousImpl, "(ILjava/lang/String;)I"), - NATIVE_METHOD(NativeBreakIterator, setTextImpl, "(ILjava/lang/String;)V"), + NATIVE_METHOD(NativeBreakIterator, cloneImpl, "(J)J"), + NATIVE_METHOD(NativeBreakIterator, closeImpl, "(J)V"), + NATIVE_METHOD(NativeBreakIterator, currentImpl, "(JLjava/lang/String;)I"), + NATIVE_METHOD(NativeBreakIterator, firstImpl, "(JLjava/lang/String;)I"), + NATIVE_METHOD(NativeBreakIterator, followingImpl, "(JLjava/lang/String;I)I"), + NATIVE_METHOD(NativeBreakIterator, getCharacterInstanceImpl, "(Ljava/lang/String;)J"), + NATIVE_METHOD(NativeBreakIterator, getLineInstanceImpl, "(Ljava/lang/String;)J"), + NATIVE_METHOD(NativeBreakIterator, getSentenceInstanceImpl, "(Ljava/lang/String;)J"), + NATIVE_METHOD(NativeBreakIterator, getWordInstanceImpl, "(Ljava/lang/String;)J"), + NATIVE_METHOD(NativeBreakIterator, isBoundaryImpl, "(JLjava/lang/String;I)Z"), + NATIVE_METHOD(NativeBreakIterator, lastImpl, "(JLjava/lang/String;)I"), + NATIVE_METHOD(NativeBreakIterator, nextImpl, "(JLjava/lang/String;I)I"), + NATIVE_METHOD(NativeBreakIterator, precedingImpl, "(JLjava/lang/String;I)I"), + NATIVE_METHOD(NativeBreakIterator, previousImpl, "(JLjava/lang/String;)I"), + NATIVE_METHOD(NativeBreakIterator, setTextImpl, "(JLjava/lang/String;)V"), }; void register_libcore_icu_NativeBreakIterator(JNIEnv* env) { jniRegisterNativeMethods(env, "libcore/icu/NativeBreakIterator", gMethods, NELEM(gMethods)); diff --git a/luni/src/main/native/libcore_icu_NativeCollation.cpp b/luni/src/main/native/libcore_icu_NativeCollation.cpp index 98a78ea..9ac7745 100644 --- a/luni/src/main/native/libcore_icu_NativeCollation.cpp +++ b/luni/src/main/native/libcore_icu_NativeCollation.cpp @@ -20,23 +20,23 @@ #include "unicode/ucol.h" #include "unicode/ucoleitr.h" -static UCollator* toCollator(jint address) { +static UCollator* toCollator(jlong address) { return reinterpret_cast<UCollator*>(static_cast<uintptr_t>(address)); } -static UCollationElements* toCollationElements(jint address) { +static UCollationElements* toCollationElements(jlong address) { return reinterpret_cast<UCollationElements*>(static_cast<uintptr_t>(address)); } -static void NativeCollation_closeCollator(JNIEnv*, jclass, jint address) { +static void NativeCollation_closeCollator(JNIEnv*, jclass, jlong address) { ucol_close(toCollator(address)); } -static void NativeCollation_closeElements(JNIEnv*, jclass, jint address) { +static void NativeCollation_closeElements(JNIEnv*, jclass, jlong address) { ucol_closeElements(toCollationElements(address)); } -static jint NativeCollation_compare(JNIEnv* env, jclass, jint address, jstring javaLhs, jstring javaRhs) { +static jint NativeCollation_compare(JNIEnv* env, jclass, jlong address, jstring javaLhs, jstring javaRhs) { ScopedStringChars lhs(env, javaLhs); if (lhs.get() == NULL) { return 0; @@ -48,14 +48,14 @@ static jint NativeCollation_compare(JNIEnv* env, jclass, jint address, jstring j return ucol_strcoll(toCollator(address), lhs.get(), lhs.size(), rhs.get(), rhs.size()); } -static jint NativeCollation_getAttribute(JNIEnv* env, jclass, jint address, jint type) { +static jint NativeCollation_getAttribute(JNIEnv* env, jclass, jlong address, jint type) { UErrorCode status = U_ZERO_ERROR; jint result = ucol_getAttribute(toCollator(address), (UColAttribute) type, &status); maybeThrowIcuException(env, "ucol_getAttribute", status); return result; } -static jint NativeCollation_getCollationElementIterator(JNIEnv* env, jclass, jint address, jstring javaSource) { +static jlong NativeCollation_getCollationElementIterator(JNIEnv* env, jclass, jlong address, jstring javaSource) { ScopedStringChars source(env, javaSource); if (source.get() == NULL) { return -1; @@ -63,24 +63,24 @@ static jint NativeCollation_getCollationElementIterator(JNIEnv* env, jclass, jin UErrorCode status = U_ZERO_ERROR; UCollationElements* result = ucol_openElements(toCollator(address), source.get(), source.size(), &status); maybeThrowIcuException(env, "ucol_openElements", status); - return static_cast<jint>(reinterpret_cast<uintptr_t>(result)); + return static_cast<jlong>(reinterpret_cast<uintptr_t>(result)); } -static jint NativeCollation_getMaxExpansion(JNIEnv*, jclass, jint address, jint order) { +static jint NativeCollation_getMaxExpansion(JNIEnv*, jclass, jlong address, jint order) { return ucol_getMaxExpansion(toCollationElements(address), order); } -static jint NativeCollation_getOffset(JNIEnv*, jclass, jint address) { +static jint NativeCollation_getOffset(JNIEnv*, jclass, jlong address) { return ucol_getOffset(toCollationElements(address)); } -static jstring NativeCollation_getRules(JNIEnv* env, jclass, jint address) { +static jstring NativeCollation_getRules(JNIEnv* env, jclass, jlong address) { int32_t length = 0; const UChar* rules = ucol_getRules(toCollator(address), &length); return env->NewString(rules, length); } -static jbyteArray NativeCollation_getSortKey(JNIEnv* env, jclass, jint address, jstring javaSource) { +static jbyteArray NativeCollation_getSortKey(JNIEnv* env, jclass, jlong address, jstring javaSource) { ScopedStringChars source(env, javaSource); if (source.get() == NULL) { return NULL; @@ -104,14 +104,14 @@ static jbyteArray NativeCollation_getSortKey(JNIEnv* env, jclass, jint address, return result; } -static jint NativeCollation_next(JNIEnv* env, jclass, jint address) { +static jint NativeCollation_next(JNIEnv* env, jclass, jlong address) { UErrorCode status = U_ZERO_ERROR; jint result = ucol_next(toCollationElements(address), &status); maybeThrowIcuException(env, "ucol_next", status); return result; } -static jint NativeCollation_openCollator(JNIEnv* env, jclass, jstring localeName) { +static jlong NativeCollation_openCollator(JNIEnv* env, jclass, jstring localeName) { ScopedUtfChars localeChars(env, localeName); if (localeChars.c_str() == NULL) { return 0; @@ -119,10 +119,10 @@ static jint NativeCollation_openCollator(JNIEnv* env, jclass, jstring localeName UErrorCode status = U_ZERO_ERROR; UCollator* c = ucol_open(localeChars.c_str(), &status); maybeThrowIcuException(env, "ucol_open", status); - return static_cast<jint>(reinterpret_cast<uintptr_t>(c)); + return static_cast<jlong>(reinterpret_cast<uintptr_t>(c)); } -static jint NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring javaRules, jint mode, jint strength) { +static jlong NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring javaRules, jint mode, jint strength) { ScopedStringChars rules(env, javaRules); if (rules.get() == NULL) { return -1; @@ -131,41 +131,41 @@ static jint NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring j UCollator* c = ucol_openRules(rules.get(), rules.size(), UColAttributeValue(mode), UCollationStrength(strength), NULL, &status); maybeThrowIcuException(env, "ucol_openRules", status); - return static_cast<jint>(reinterpret_cast<uintptr_t>(c)); + return static_cast<jlong>(reinterpret_cast<uintptr_t>(c)); } -static jint NativeCollation_previous(JNIEnv* env, jclass, jint address) { +static jint NativeCollation_previous(JNIEnv* env, jclass, jlong address) { UErrorCode status = U_ZERO_ERROR; jint result = ucol_previous(toCollationElements(address), &status); maybeThrowIcuException(env, "ucol_previous", status); return result; } -static void NativeCollation_reset(JNIEnv*, jclass, jint address) { +static void NativeCollation_reset(JNIEnv*, jclass, jlong address) { ucol_reset(toCollationElements(address)); } -static jint NativeCollation_safeClone(JNIEnv* env, jclass, jint address) { +static jlong NativeCollation_safeClone(JNIEnv* env, jclass, jlong address) { UErrorCode status = U_ZERO_ERROR; jint bufferSize = U_COL_SAFECLONE_BUFFERSIZE; UCollator* c = ucol_safeClone(toCollator(address), NULL, &bufferSize, &status); maybeThrowIcuException(env, "ucol_safeClone", status); - return static_cast<jint>(reinterpret_cast<uintptr_t>(c)); + return static_cast<jlong>(reinterpret_cast<uintptr_t>(c)); } -static void NativeCollation_setAttribute(JNIEnv* env, jclass, jint address, jint type, jint value) { +static void NativeCollation_setAttribute(JNIEnv* env, jclass, jlong address, jint type, jint value) { UErrorCode status = U_ZERO_ERROR; ucol_setAttribute(toCollator(address), (UColAttribute)type, (UColAttributeValue)value, &status); maybeThrowIcuException(env, "ucol_setAttribute", status); } -static void NativeCollation_setOffset(JNIEnv* env, jclass, jint address, jint offset) { +static void NativeCollation_setOffset(JNIEnv* env, jclass, jlong address, jint offset) { UErrorCode status = U_ZERO_ERROR; ucol_setOffset(toCollationElements(address), offset, &status); maybeThrowIcuException(env, "ucol_setOffset", status); } -static void NativeCollation_setText(JNIEnv* env, jclass, jint address, jstring javaSource) { +static void NativeCollation_setText(JNIEnv* env, jclass, jlong address, jstring javaSource) { ScopedStringChars source(env, javaSource); if (source.get() == NULL) { return; @@ -176,24 +176,24 @@ static void NativeCollation_setText(JNIEnv* env, jclass, jint address, jstring j } static JNINativeMethod gMethods[] = { - NATIVE_METHOD(NativeCollation, closeCollator, "(I)V"), - NATIVE_METHOD(NativeCollation, closeElements, "(I)V"), - NATIVE_METHOD(NativeCollation, compare, "(ILjava/lang/String;Ljava/lang/String;)I"), - NATIVE_METHOD(NativeCollation, getAttribute, "(II)I"), - NATIVE_METHOD(NativeCollation, getCollationElementIterator, "(ILjava/lang/String;)I"), - NATIVE_METHOD(NativeCollation, getMaxExpansion, "(II)I"), - NATIVE_METHOD(NativeCollation, getOffset, "(I)I"), - NATIVE_METHOD(NativeCollation, getRules, "(I)Ljava/lang/String;"), - NATIVE_METHOD(NativeCollation, getSortKey, "(ILjava/lang/String;)[B"), - NATIVE_METHOD(NativeCollation, next, "(I)I"), - NATIVE_METHOD(NativeCollation, openCollator, "(Ljava/lang/String;)I"), - NATIVE_METHOD(NativeCollation, openCollatorFromRules, "(Ljava/lang/String;II)I"), - NATIVE_METHOD(NativeCollation, previous, "(I)I"), - NATIVE_METHOD(NativeCollation, reset, "(I)V"), - NATIVE_METHOD(NativeCollation, safeClone, "(I)I"), - NATIVE_METHOD(NativeCollation, setAttribute, "(III)V"), - NATIVE_METHOD(NativeCollation, setOffset, "(II)V"), - NATIVE_METHOD(NativeCollation, setText, "(ILjava/lang/String;)V"), + NATIVE_METHOD(NativeCollation, closeCollator, "(J)V"), + NATIVE_METHOD(NativeCollation, closeElements, "(J)V"), + NATIVE_METHOD(NativeCollation, compare, "(JLjava/lang/String;Ljava/lang/String;)I"), + NATIVE_METHOD(NativeCollation, getAttribute, "(JI)I"), + NATIVE_METHOD(NativeCollation, getCollationElementIterator, "(JLjava/lang/String;)I"), + NATIVE_METHOD(NativeCollation, getMaxExpansion, "(JI)I"), + NATIVE_METHOD(NativeCollation, getOffset, "(J)I"), + NATIVE_METHOD(NativeCollation, getRules, "(J)Ljava/lang/String;"), + NATIVE_METHOD(NativeCollation, getSortKey, "(JLjava/lang/String;)[B"), + NATIVE_METHOD(NativeCollation, next, "(J)I"), + NATIVE_METHOD(NativeCollation, openCollator, "(Ljava/lang/String;)J"), + NATIVE_METHOD(NativeCollation, openCollatorFromRules, "(Ljava/lang/String;II)J"), + NATIVE_METHOD(NativeCollation, previous, "(J)I"), + NATIVE_METHOD(NativeCollation, reset, "(J)V"), + NATIVE_METHOD(NativeCollation, safeClone, "(J)J"), + NATIVE_METHOD(NativeCollation, setAttribute, "(JII)V"), + NATIVE_METHOD(NativeCollation, setOffset, "(JI)V"), + NATIVE_METHOD(NativeCollation, setText, "(JLjava/lang/String;)V"), }; void register_libcore_icu_NativeCollation(JNIEnv* env) { jniRegisterNativeMethods(env, "libcore/icu/NativeCollation", gMethods, NELEM(gMethods)); diff --git a/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp b/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp index efed954..88e6780 100644 --- a/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp +++ b/luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp @@ -343,7 +343,7 @@ static jlong NativeDecimalFormat_cloneImpl(JNIEnv*, jclass, jlong addr) { static JNINativeMethod gMethods[] = { NATIVE_METHOD(NativeDecimalFormat, applyPatternImpl, "(JZLjava/lang/String;)V"), - NATIVE_METHOD(NativeDecimalFormat, cloneImpl, "(J)I"), + NATIVE_METHOD(NativeDecimalFormat, cloneImpl, "(J)J"), NATIVE_METHOD(NativeDecimalFormat, close, "(J)V"), NATIVE_METHOD(NativeDecimalFormat, formatDouble, "(JDLlibcore/icu/NativeDecimalFormat$FieldPositionIterator;)[C"), NATIVE_METHOD(NativeDecimalFormat, formatLong, "(JJLlibcore/icu/NativeDecimalFormat$FieldPositionIterator;)[C"), diff --git a/luni/src/main/native/libcore_icu_NativePluralRules.cpp b/luni/src/main/native/libcore_icu_NativePluralRules.cpp index 571ba6d..8910a8c 100644 --- a/luni/src/main/native/libcore_icu_NativePluralRules.cpp +++ b/luni/src/main/native/libcore_icu_NativePluralRules.cpp @@ -25,15 +25,15 @@ #include <string> -static PluralRules* toPluralRules(jint address) { +static PluralRules* toPluralRules(jlong address) { return reinterpret_cast<PluralRules*>(static_cast<uintptr_t>(address)); } -static void NativePluralRules_finalizeImpl(JNIEnv*, jclass, jint address) { +static void NativePluralRules_finalizeImpl(JNIEnv*, jclass, jlong address) { delete toPluralRules(address); } -static jint NativePluralRules_forLocaleImpl(JNIEnv* env, jclass, jstring javaLocaleName) { +static jlong NativePluralRules_forLocaleImpl(JNIEnv* env, jclass, jstring javaLocaleName) { // The icu4c PluralRules returns a "other: n" default rule for the deprecated locales Java uses. // Work around this by translating back to the current language codes. std::string localeName(ScopedUtfChars(env, javaLocaleName).c_str()); @@ -55,7 +55,7 @@ static jint NativePluralRules_forLocaleImpl(JNIEnv* env, jclass, jstring javaLoc return reinterpret_cast<uintptr_t>(result); } -static jint NativePluralRules_quantityForIntImpl(JNIEnv*, jclass, jint address, jint value) { +static jint NativePluralRules_quantityForIntImpl(JNIEnv*, jclass, jlong address, jint value) { UnicodeString keyword = toPluralRules(address)->select(value); if (keyword == "zero") { return 0; @@ -73,9 +73,9 @@ static jint NativePluralRules_quantityForIntImpl(JNIEnv*, jclass, jint address, } static JNINativeMethod gMethods[] = { - NATIVE_METHOD(NativePluralRules, finalizeImpl, "(I)V"), - NATIVE_METHOD(NativePluralRules, forLocaleImpl, "(Ljava/lang/String;)I"), - NATIVE_METHOD(NativePluralRules, quantityForIntImpl, "(II)I"), + NATIVE_METHOD(NativePluralRules, finalizeImpl, "(J)V"), + NATIVE_METHOD(NativePluralRules, forLocaleImpl, "(Ljava/lang/String;)J"), + NATIVE_METHOD(NativePluralRules, quantityForIntImpl, "(JI)I"), }; void register_libcore_icu_NativePluralRules(JNIEnv* env) { jniRegisterNativeMethods(env, "libcore/icu/NativePluralRules", gMethods, NELEM(gMethods)); |