AArch64: Make AssetManager and related classes 64-bit compatible
Following changes have been done:
[x] Long is used to store native pointers as pointers can be
64-bit.
[x] AssetManager openAsset native function returned -1 if
file name was empty and java function considered any
non-zero value as success. This has been fixed by native
function throwing Illegal Argument Exception as well.
[x] AssetManager incRefsLocked and decRefsLocked now accept
long as input to support 64-bit native references.
[x] AssetManager incRefsLocked method incorrecly used
'this.hashCode()' instead of the passed parameter id.
This has been fixed.
[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)
Change-Id: I095b9f900d49e51f43ad6afc47cbc23116a6a64a
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index 93ce633..780c4be 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -69,13 +69,13 @@
private final long[] mOffsets = new long[2];
// For communication with native code.
- private int mObject;
+ private long mObject;
private StringBlock mStringBlocks[] = null;
private int mNumRefs = 1;
private boolean mOpen = true;
- private HashMap<Integer, RuntimeException> mRefStacks;
+ private HashMap<Long, RuntimeException> mRefStacks;
/**
* Create a new AssetManager containing only the basic system assets.
@@ -224,7 +224,7 @@
return retArray;
}
- /*package*/ final boolean getThemeValue(int theme, int ident,
+ /*package*/ final boolean getThemeValue(long theme, int ident,
TypedValue outValue, boolean resolveRefs) {
int block = loadThemeAttributeValue(theme, ident, outValue, resolveRefs);
if (block >= 0) {
@@ -312,7 +312,7 @@
if (!mOpen) {
throw new RuntimeException("Assetmanager has been closed");
}
- int asset = openAsset(fileName, accessMode);
+ long asset = openAsset(fileName, accessMode);
if (asset != 0) {
AssetInputStream res = new AssetInputStream(asset);
incRefsLocked(res.hashCode());
@@ -404,7 +404,7 @@
if (!mOpen) {
throw new RuntimeException("Assetmanager has been closed");
}
- int asset = openNonAssetNative(cookie, fileName, accessMode);
+ long asset = openNonAssetNative(cookie, fileName, accessMode);
if (asset != 0) {
AssetInputStream res = new AssetInputStream(asset);
incRefsLocked(res.hashCode());
@@ -484,7 +484,7 @@
if (!mOpen) {
throw new RuntimeException("Assetmanager has been closed");
}
- int xmlBlock = openXmlAssetNative(cookie, fileName);
+ long xmlBlock = openXmlAssetNative(cookie, fileName);
if (xmlBlock != 0) {
XmlBlock res = new XmlBlock(this, xmlBlock);
incRefsLocked(res.hashCode());
@@ -500,18 +500,18 @@
}
}
- /*package*/ final int createTheme() {
+ /*package*/ final long createTheme() {
synchronized (this) {
if (!mOpen) {
throw new RuntimeException("Assetmanager has been closed");
}
- int res = newTheme();
+ long res = newTheme();
incRefsLocked(res);
return res;
}
}
- /*package*/ final void releaseTheme(int theme) {
+ /*package*/ final void releaseTheme(long theme) {
synchronized (this) {
deleteTheme(theme);
decRefsLocked(theme);
@@ -537,7 +537,7 @@
public final class AssetInputStream extends InputStream {
public final int getAssetInt() {
- return mAsset;
+ return (int) mAsset;
}
/**
* @hide
@@ -545,7 +545,7 @@
public final long getNativeAsset() {
return mAsset;
}
- private AssetInputStream(int asset)
+ private AssetInputStream(long asset)
{
mAsset = asset;
mLength = getAssetLength(asset);
@@ -597,7 +597,7 @@
close();
}
- private int mAsset;
+ private long mAsset;
private long mLength;
private long mMarkPos;
}
@@ -678,19 +678,19 @@
/*package*/ native final String getResourceTypeName(int resid);
/*package*/ native final String getResourceEntryName(int resid);
- private native final int openAsset(String fileName, int accessMode);
+ private native final long openAsset(String fileName, int accessMode);
private final native ParcelFileDescriptor openAssetFd(String fileName,
long[] outOffsets) throws IOException;
- private native final int openNonAssetNative(int cookie, String fileName,
+ private native final long openNonAssetNative(int cookie, String fileName,
int accessMode);
private native ParcelFileDescriptor openNonAssetFdNative(int cookie,
String fileName, long[] outOffsets) throws IOException;
- private native final void destroyAsset(int asset);
- private native final int readAssetChar(int asset);
- private native final int readAsset(int asset, byte[] b, int off, int len);
- private native final long seekAsset(int asset, long offset, int whence);
- private native final long getAssetLength(int asset);
- private native final long getAssetRemainingLength(int asset);
+ private native final void destroyAsset(long asset);
+ private native final int readAssetChar(long asset);
+ private native final int readAsset(long asset, byte[] b, int off, int len);
+ private native final long seekAsset(long asset, long offset, int whence);
+ private native final long getAssetLength(long asset);
+ private native final long getAssetRemainingLength(long asset);
/** Returns true if the resource was found, filling in mRetStringBlock and
* mRetData. */
@@ -707,15 +707,15 @@
/*package*/ static final int STYLE_RESOURCE_ID = 3;
/*package*/ static final int STYLE_CHANGING_CONFIGURATIONS = 4;
/*package*/ static final int STYLE_DENSITY = 5;
- /*package*/ native static final boolean applyStyle(int theme,
- int defStyleAttr, int defStyleRes, int xmlParser,
+ /*package*/ native static final boolean applyStyle(long theme,
+ int defStyleAttr, int defStyleRes, long xmlParser,
int[] inAttrs, int[] outValues, int[] outIndices);
/*package*/ native final boolean retrieveAttributes(
- int xmlParser, int[] inAttrs, int[] outValues, int[] outIndices);
+ long xmlParser, int[] inAttrs, int[] outValues, int[] outIndices);
/*package*/ native final int getArraySize(int resource);
/*package*/ native final int retrieveArray(int resource, int[] outValues);
private native final int getStringBlockCount();
- private native final int getNativeStringBlock(int block);
+ private native final long getNativeStringBlock(int block);
/**
* {@hide}
@@ -737,16 +737,16 @@
*/
public native static final int getGlobalAssetManagerCount();
- private native final int newTheme();
- private native final void deleteTheme(int theme);
- /*package*/ native static final void applyThemeStyle(int theme, int styleRes, boolean force);
- /*package*/ native static final void copyTheme(int dest, int source);
- /*package*/ native static final int loadThemeAttributeValue(int theme, int ident,
+ private native final long newTheme();
+ private native final void deleteTheme(long theme);
+ /*package*/ native static final void applyThemeStyle(long theme, int styleRes, boolean force);
+ /*package*/ native static final void copyTheme(long dest, long source);
+ /*package*/ native static final int loadThemeAttributeValue(long theme, int ident,
TypedValue outValue,
boolean resolve);
- /*package*/ native static final void dumpTheme(int theme, int priority, String tag, String prefix);
+ /*package*/ native static final void dumpTheme(long theme, int priority, String tag, String prefix);
- private native final int openXmlAssetNative(int cookie, String fileName);
+ private native final long openXmlAssetNative(int cookie, String fileName);
private native final String[] getArrayStringResource(int arrayRes);
private native final int[] getArrayStringInfo(int arrayRes);
@@ -755,19 +755,19 @@
private native final void init();
private native final void destroy();
- private final void incRefsLocked(int id) {
+ private final void incRefsLocked(long id) {
if (DEBUG_REFS) {
if (mRefStacks == null) {
- mRefStacks = new HashMap<Integer, RuntimeException>();
- RuntimeException ex = new RuntimeException();
- ex.fillInStackTrace();
- mRefStacks.put(this.hashCode(), ex);
+ mRefStacks = new HashMap<Long, RuntimeException>();
}
+ RuntimeException ex = new RuntimeException();
+ ex.fillInStackTrace();
+ mRefStacks.put(id, ex);
}
mNumRefs++;
}
- private final void decRefsLocked(int id) {
+ private final void decRefsLocked(long id) {
if (DEBUG_REFS && mRefStacks != null) {
mRefStacks.remove(id);
}
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index cd5b5d2f..7fc364f 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -1460,7 +1460,7 @@
}
private final AssetManager mAssets;
- private final int mTheme;
+ private final long mTheme;
}
/**
diff --git a/core/java/android/content/res/StringBlock.java b/core/java/android/content/res/StringBlock.java
index 78180b1..77b8a33 100644
--- a/core/java/android/content/res/StringBlock.java
+++ b/core/java/android/content/res/StringBlock.java
@@ -36,7 +36,7 @@
private static final String TAG = "AssetManager";
private static final boolean localLOGV = false;
- private final int mNative;
+ private final long mNative;
private final boolean mUseSparse;
private final boolean mOwnsNative;
private CharSequence[] mStrings;
@@ -474,7 +474,7 @@
* are doing! The given native object must exist for the entire lifetime
* of this newly creating StringBlock.
*/
- StringBlock(int obj, boolean useSparse) {
+ StringBlock(long obj, boolean useSparse) {
mNative = obj;
mUseSparse = useSparse;
mOwnsNative = false;
@@ -482,11 +482,11 @@
+ ": " + nativeGetSize(mNative));
}
- private static native int nativeCreate(byte[] data,
+ private static native long nativeCreate(byte[] data,
int offset,
int size);
- private static native int nativeGetSize(int obj);
- private static native String nativeGetString(int obj, int idx);
- private static native int[] nativeGetStyle(int obj, int idx);
- private static native void nativeDestroy(int obj);
+ private static native int nativeGetSize(long obj);
+ private static native String nativeGetString(long obj, int idx);
+ private static native int[] nativeGetStyle(long obj, int idx);
+ private static native void nativeDestroy(long obj);
}
diff --git a/core/java/android/content/res/XmlBlock.java b/core/java/android/content/res/XmlBlock.java
index bea6529..3ad357f2 100644
--- a/core/java/android/content/res/XmlBlock.java
+++ b/core/java/android/content/res/XmlBlock.java
@@ -75,7 +75,7 @@
}
/*package*/ final class Parser implements XmlResourceParser {
- Parser(int parseState, XmlBlock block) {
+ Parser(long parseState, XmlBlock block) {
mParseState = parseState;
mBlock = block;
block.mOpenCount++;
@@ -458,7 +458,7 @@
return mStrings.get(id);
}
- /*package*/ int mParseState;
+ /*package*/ long mParseState;
private final XmlBlock mBlock;
private boolean mStarted = false;
private boolean mDecNextDepth = false;
@@ -476,41 +476,41 @@
* are doing! The given native object must exist for the entire lifetime
* of this newly creating XmlBlock.
*/
- XmlBlock(AssetManager assets, int xmlBlock) {
+ XmlBlock(AssetManager assets, long xmlBlock) {
mAssets = assets;
mNative = xmlBlock;
mStrings = new StringBlock(nativeGetStringBlock(xmlBlock), false);
}
private final AssetManager mAssets;
- private final int mNative;
+ private final long mNative;
/*package*/ final StringBlock mStrings;
private boolean mOpen = true;
private int mOpenCount = 1;
- private static final native int nativeCreate(byte[] data,
+ private static final native long nativeCreate(byte[] data,
int offset,
int size);
- private static final native int nativeGetStringBlock(int obj);
+ private static final native long nativeGetStringBlock(long obj);
- private static final native int nativeCreateParseState(int obj);
- /*package*/ static final native int nativeNext(int state);
- private static final native int nativeGetNamespace(int state);
- /*package*/ static final native int nativeGetName(int state);
- private static final native int nativeGetText(int state);
- private static final native int nativeGetLineNumber(int state);
- private static final native int nativeGetAttributeCount(int state);
- private static final native int nativeGetAttributeNamespace(int state, int idx);
- private static final native int nativeGetAttributeName(int state, int idx);
- private static final native int nativeGetAttributeResource(int state, int idx);
- private static final native int nativeGetAttributeDataType(int state, int idx);
- private static final native int nativeGetAttributeData(int state, int idx);
- private static final native int nativeGetAttributeStringValue(int state, int idx);
- private static final native int nativeGetIdAttribute(int state);
- private static final native int nativeGetClassAttribute(int state);
- private static final native int nativeGetStyleAttribute(int state);
- private static final native int nativeGetAttributeIndex(int state, String namespace, String name);
- private static final native void nativeDestroyParseState(int state);
+ private static final native long nativeCreateParseState(long obj);
+ /*package*/ static final native int nativeNext(long state);
+ private static final native int nativeGetNamespace(long state);
+ /*package*/ static final native int nativeGetName(long state);
+ private static final native int nativeGetText(long state);
+ private static final native int nativeGetLineNumber(long state);
+ private static final native int nativeGetAttributeCount(long state);
+ private static final native int nativeGetAttributeNamespace(long state, int idx);
+ private static final native int nativeGetAttributeName(long state, int idx);
+ private static final native int nativeGetAttributeResource(long state, int idx);
+ private static final native int nativeGetAttributeDataType(long state, int idx);
+ private static final native int nativeGetAttributeData(long state, int idx);
+ private static final native int nativeGetAttributeStringValue(long state, int idx);
+ private static final native int nativeGetIdAttribute(long state);
+ private static final native int nativeGetClassAttribute(long state);
+ private static final native int nativeGetStyleAttribute(long state);
+ private static final native int nativeGetAttributeIndex(long state, String namespace, String name);
+ private static final native void nativeDestroyParseState(long state);
- private static final native void nativeDestroy(int obj);
+ private static final native void nativeDestroy(long obj);
}
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 8836918..f96aef8 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -88,7 +88,7 @@
{
env->SetIntField(outValue, gTypedValueOffsets.mType, value.dataType);
env->SetIntField(outValue, gTypedValueOffsets.mAssetCookie,
- (jint)table->getTableCookie(block));
+ static_cast<jint>(table->getTableCookie(block)));
env->SetIntField(outValue, gTypedValueOffsets.mData, value.data);
env->SetObjectField(outValue, gTypedValueOffsets.mString, NULL);
env->SetIntField(outValue, gTypedValueOffsets.mResourceId, ref);
@@ -105,7 +105,8 @@
// this guy is exported to other jni routines
AssetManager* assetManagerForJavaObject(JNIEnv* env, jobject obj)
{
- AssetManager* am = (AssetManager*)env->GetIntField(obj, gAssetManagerOffsets.mObject);
+ jlong amHandle = env->GetLongField(obj, gAssetManagerOffsets.mObject);
+ AssetManager* am = reinterpret_cast<AssetManager*>(amHandle);
if (am != NULL) {
return am;
}
@@ -113,7 +114,7 @@
return NULL;
}
-static jint android_content_AssetManager_openAsset(JNIEnv* env, jobject clazz,
+static jlong android_content_AssetManager_openAsset(JNIEnv* env, jobject clazz,
jstring fileName, jint mode)
{
AssetManager* am = assetManagerForJavaObject(env, clazz);
@@ -125,6 +126,7 @@
ScopedUtfChars fileName8(env, fileName);
if (fileName8.c_str() == NULL) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", "Empty file name");
return -1;
}
@@ -143,7 +145,7 @@
//printf("Created Asset Stream: %p\n", a);
- return (jint)a;
+ return reinterpret_cast<jlong>(a);
}
static jobject returnParcelFileDescriptor(JNIEnv* env, Asset* a, jlongArray outOffsets)
@@ -205,7 +207,7 @@
return returnParcelFileDescriptor(env, a, outOffsets);
}
-static jint android_content_AssetManager_openNonAssetNative(JNIEnv* env, jobject clazz,
+static jlong android_content_AssetManager_openNonAssetNative(JNIEnv* env, jobject clazz,
jint cookie,
jstring fileName,
jint mode)
@@ -240,7 +242,7 @@
//printf("Created Asset Stream: %p\n", a);
- return (jint)a;
+ return reinterpret_cast<jlong>(a);
}
static jobject android_content_AssetManager_openNonAssetFdNative(JNIEnv* env, jobject clazz,
@@ -320,9 +322,9 @@
}
static void android_content_AssetManager_destroyAsset(JNIEnv* env, jobject clazz,
- jint asset)
+ jlong assetHandle)
{
- Asset* a = (Asset*)asset;
+ Asset* a = reinterpret_cast<Asset*>(assetHandle);
//printf("Destroying Asset Stream: %p\n", a);
@@ -335,9 +337,9 @@
}
static jint android_content_AssetManager_readAssetChar(JNIEnv* env, jobject clazz,
- jint asset)
+ jlong assetHandle)
{
- Asset* a = (Asset*)asset;
+ Asset* a = reinterpret_cast<Asset*>(assetHandle);
if (a == NULL) {
jniThrowNullPointerException(env, "asset");
@@ -350,10 +352,10 @@
}
static jint android_content_AssetManager_readAsset(JNIEnv* env, jobject clazz,
- jint asset, jbyteArray bArray,
+ jlong assetHandle, jbyteArray bArray,
jint off, jint len)
{
- Asset* a = (Asset*)asset;
+ Asset* a = reinterpret_cast<Asset*>(assetHandle);
if (a == NULL || bArray == NULL) {
jniThrowNullPointerException(env, "asset");
@@ -374,7 +376,7 @@
ssize_t res = a->read(b+off, len);
env->ReleaseByteArrayElements(bArray, b, 0);
- if (res > 0) return res;
+ if (res > 0) return static_cast<jint>(res);
if (res < 0) {
jniThrowException(env, "java/io/IOException", "");
@@ -383,10 +385,10 @@
}
static jlong android_content_AssetManager_seekAsset(JNIEnv* env, jobject clazz,
- jint asset,
+ jlong assetHandle,
jlong offset, jint whence)
{
- Asset* a = (Asset*)asset;
+ Asset* a = reinterpret_cast<Asset*>(assetHandle);
if (a == NULL) {
jniThrowNullPointerException(env, "asset");
@@ -398,9 +400,9 @@
}
static jlong android_content_AssetManager_getAssetLength(JNIEnv* env, jobject clazz,
- jint asset)
+ jlong assetHandle)
{
- Asset* a = (Asset*)asset;
+ Asset* a = reinterpret_cast<Asset*>(assetHandle);
if (a == NULL) {
jniThrowNullPointerException(env, "asset");
@@ -411,9 +413,9 @@
}
static jlong android_content_AssetManager_getAssetRemainingLength(JNIEnv* env, jobject clazz,
- jint asset)
+ jlong assetHandle)
{
- Asset* a = (Asset*)asset;
+ Asset* a = reinterpret_cast<Asset*>(assetHandle);
if (a == NULL) {
jniThrowNullPointerException(env, "asset");
@@ -725,7 +727,11 @@
}
#endif
}
- return block >= 0 ? copyValue(env, outValue, &res, value, ref, block, typeSpecFlags, &config) : block;
+ if (block >= 0) {
+ return copyValue(env, outValue, &res, value, ref, block, typeSpecFlags, &config);
+ }
+
+ return static_cast<jint>(block);
}
static jint android_content_AssetManager_loadResourceBagValue(JNIEnv* env, jobject clazz,
@@ -759,7 +765,7 @@
res.unlock();
if (block < 0) {
- return block;
+ return static_cast<jint>(block);
}
uint32_t ref = ident;
@@ -772,7 +778,11 @@
}
#endif
}
- return block >= 0 ? copyValue(env, outValue, &res, value, ref, block, typeSpecFlags) : block;
+ if (block >= 0) {
+ return copyValue(env, outValue, &res, value, ref, block, typeSpecFlags);
+ }
+
+ return static_cast<jint>(block);
}
static jint android_content_AssetManager_getStringBlockCount(JNIEnv* env, jobject clazz)
@@ -784,14 +794,14 @@
return am->getResources().getTableCount();
}
-static jint android_content_AssetManager_getNativeStringBlock(JNIEnv* env, jobject clazz,
+static jlong android_content_AssetManager_getNativeStringBlock(JNIEnv* env, jobject clazz,
jint block)
{
AssetManager* am = assetManagerForJavaObject(env, clazz);
if (am == NULL) {
return 0;
}
- return (jint)am->getResources().getTableStringBlock(block);
+ return reinterpret_cast<jlong>(am->getResources().getTableStringBlock(block));
}
static jstring android_content_AssetManager_getCookieName(JNIEnv* env, jobject clazz,
@@ -810,43 +820,43 @@
return str;
}
-static jint android_content_AssetManager_newTheme(JNIEnv* env, jobject clazz)
+static jlong android_content_AssetManager_newTheme(JNIEnv* env, jobject clazz)
{
AssetManager* am = assetManagerForJavaObject(env, clazz);
if (am == NULL) {
return 0;
}
- return (jint)(new ResTable::Theme(am->getResources()));
+ return reinterpret_cast<jlong>(new ResTable::Theme(am->getResources()));
}
static void android_content_AssetManager_deleteTheme(JNIEnv* env, jobject clazz,
- jint themeInt)
+ jlong themeHandle)
{
- ResTable::Theme* theme = (ResTable::Theme*)themeInt;
+ ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeHandle);
delete theme;
}
static void android_content_AssetManager_applyThemeStyle(JNIEnv* env, jobject clazz,
- jint themeInt,
+ jlong themeHandle,
jint styleRes,
jboolean force)
{
- ResTable::Theme* theme = (ResTable::Theme*)themeInt;
+ ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeHandle);
theme->applyStyle(styleRes, force ? true : false);
}
static void android_content_AssetManager_copyTheme(JNIEnv* env, jobject clazz,
- jint destInt, jint srcInt)
+ jlong destHandle, jlong srcHandle)
{
- ResTable::Theme* dest = (ResTable::Theme*)destInt;
- ResTable::Theme* src = (ResTable::Theme*)srcInt;
+ ResTable::Theme* dest = reinterpret_cast<ResTable::Theme*>(destHandle);
+ ResTable::Theme* src = reinterpret_cast<ResTable::Theme*>(srcHandle);
dest->setTo(*src);
}
static jint android_content_AssetManager_loadThemeAttributeValue(
- JNIEnv* env, jobject clazz, jint themeInt, jint ident, jobject outValue, jboolean resolve)
+ JNIEnv* env, jobject clazz, jlong themeHandle, jint ident, jobject outValue, jboolean resolve)
{
- ResTable::Theme* theme = (ResTable::Theme*)themeInt;
+ ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeHandle);
const ResTable& res(theme->getResTable());
Res_value value;
@@ -867,10 +877,10 @@
}
static void android_content_AssetManager_dumpTheme(JNIEnv* env, jobject clazz,
- jint themeInt, jint pri,
+ jlong themeHandle, jint pri,
jstring tag, jstring prefix)
{
- ResTable::Theme* theme = (ResTable::Theme*)themeInt;
+ ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeHandle);
const ResTable& res(theme->getResTable());
// XXX Need to use params.
@@ -878,10 +888,10 @@
}
static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject clazz,
- jint themeToken,
+ jlong themeToken,
jint defStyleAttr,
jint defStyleRes,
- jint xmlParserToken,
+ jlong xmlParserToken,
jintArray attrs,
jintArray outValues,
jintArray outIndices)
@@ -902,9 +912,9 @@
DEBUG_STYLES(LOGI("APPLY STYLE: theme=0x%x defStyleAttr=0x%x defStyleRes=0x%x xml=0x%x",
themeToken, defStyleAttr, defStyleRes, xmlParserToken));
- ResTable::Theme* theme = (ResTable::Theme*)themeToken;
+ ResTable::Theme* theme = reinterpret_cast<ResTable::Theme*>(themeToken);
const ResTable& res = theme->getResTable();
- ResXMLParser* xmlParser = (ResXMLParser*)xmlParserToken;
+ ResXMLParser* xmlParser = reinterpret_cast<ResXMLParser*>(xmlParserToken);
ResTable_config config;
Res_value value;
@@ -1097,7 +1107,7 @@
dest[STYLE_TYPE] = value.dataType;
dest[STYLE_DATA] = value.data;
dest[STYLE_ASSET_COOKIE] =
- block != kXmlBlock ? (jint)res.getTableCookie(block) : (jint)-1;
+ block != kXmlBlock ? reinterpret_cast<jint>(res.getTableCookie(block)) : (jint)-1;
dest[STYLE_RESOURCE_ID] = resid;
dest[STYLE_CHANGING_CONFIGURATIONS] = typeSetFlags;
dest[STYLE_DENSITY] = config.density;
@@ -1123,7 +1133,7 @@
}
static jboolean android_content_AssetManager_retrieveAttributes(JNIEnv* env, jobject clazz,
- jint xmlParserToken,
+ jlong xmlParserToken,
jintArray attrs,
jintArray outValues,
jintArray outIndices)
@@ -1240,7 +1250,7 @@
dest[STYLE_TYPE] = value.dataType;
dest[STYLE_DATA] = value.data;
dest[STYLE_ASSET_COOKIE] =
- block != kXmlBlock ? (jint)res.getTableCookie(block) : (jint)-1;
+ block != kXmlBlock ? reinterpret_cast<jint>(res.getTableCookie(block)) : (jint)-1;
dest[STYLE_RESOURCE_ID] = resid;
dest[STYLE_CHANGING_CONFIGURATIONS] = typeSetFlags;
dest[STYLE_DENSITY] = config.density;
@@ -1280,7 +1290,7 @@
ssize_t bagOff = res.getBagLocked(id, &defStyleEnt);
res.unlock();
- return bagOff;
+ return static_cast<jint>(bagOff);
}
static jint android_content_AssetManager_retrieveArray(JNIEnv* env, jobject clazz,
@@ -1352,7 +1362,7 @@
// Write the final value back to Java.
dest[STYLE_TYPE] = value.dataType;
dest[STYLE_DATA] = value.data;
- dest[STYLE_ASSET_COOKIE] = (jint)res.getTableCookie(block);
+ dest[STYLE_ASSET_COOKIE] = reinterpret_cast<jint>(res.getTableCookie(block));
dest[STYLE_RESOURCE_ID] = resid;
dest[STYLE_CHANGING_CONFIGURATIONS] = typeSetFlags;
dest[STYLE_DENSITY] = config.density;
@@ -1370,7 +1380,7 @@
return i;
}
-static jint android_content_AssetManager_openXmlAssetNative(JNIEnv* env, jobject clazz,
+static jlong android_content_AssetManager_openXmlAssetNative(JNIEnv* env, jobject clazz,
jint cookie,
jstring fileName)
{
@@ -1405,7 +1415,7 @@
return 0;
}
- return (jint)block;
+ return reinterpret_cast<jlong>(block);
}
static jintArray android_content_AssetManager_getArrayStringInfo(JNIEnv* env, jobject clazz,
@@ -1580,17 +1590,17 @@
am->addDefaultAssets();
ALOGV("Created AssetManager %p for Java object %p\n", am, clazz);
- env->SetIntField(clazz, gAssetManagerOffsets.mObject, (jint)am);
+ env->SetLongField(clazz, gAssetManagerOffsets.mObject, reinterpret_cast<jlong>(am));
}
static void android_content_AssetManager_destroy(JNIEnv* env, jobject clazz)
{
AssetManager* am = (AssetManager*)
- (env->GetIntField(clazz, gAssetManagerOffsets.mObject));
+ (env->GetLongField(clazz, gAssetManagerOffsets.mObject));
ALOGV("Destroying AssetManager %p for Java object %p\n", am, clazz);
if (am != NULL) {
delete am;
- env->SetIntField(clazz, gAssetManagerOffsets.mObject, 0);
+ env->SetLongField(clazz, gAssetManagerOffsets.mObject, 0);
}
}
@@ -1624,27 +1634,27 @@
/* name, signature, funcPtr */
// Basic asset stuff.
- { "openAsset", "(Ljava/lang/String;I)I",
+ { "openAsset", "(Ljava/lang/String;I)J",
(void*) android_content_AssetManager_openAsset },
{ "openAssetFd", "(Ljava/lang/String;[J)Landroid/os/ParcelFileDescriptor;",
(void*) android_content_AssetManager_openAssetFd },
- { "openNonAssetNative", "(ILjava/lang/String;I)I",
+ { "openNonAssetNative", "(ILjava/lang/String;I)J",
(void*) android_content_AssetManager_openNonAssetNative },
{ "openNonAssetFdNative", "(ILjava/lang/String;[J)Landroid/os/ParcelFileDescriptor;",
(void*) android_content_AssetManager_openNonAssetFdNative },
{ "list", "(Ljava/lang/String;)[Ljava/lang/String;",
(void*) android_content_AssetManager_list },
- { "destroyAsset", "(I)V",
+ { "destroyAsset", "(J)V",
(void*) android_content_AssetManager_destroyAsset },
- { "readAssetChar", "(I)I",
+ { "readAssetChar", "(J)I",
(void*) android_content_AssetManager_readAssetChar },
- { "readAsset", "(I[BII)I",
+ { "readAsset", "(J[BII)I",
(void*) android_content_AssetManager_readAsset },
- { "seekAsset", "(IJI)J",
+ { "seekAsset", "(JJI)J",
(void*) android_content_AssetManager_seekAsset },
- { "getAssetLength", "(I)J",
+ { "getAssetLength", "(J)J",
(void*) android_content_AssetManager_getAssetLength },
- { "getAssetRemainingLength", "(I)J",
+ { "getAssetRemainingLength", "(J)J",
(void*) android_content_AssetManager_getAssetRemainingLength },
{ "addAssetPathNative", "(Ljava/lang/String;)I",
(void*) android_content_AssetManager_addAssetPath },
@@ -1674,27 +1684,27 @@
(void*) android_content_AssetManager_loadResourceBagValue },
{ "getStringBlockCount","()I",
(void*) android_content_AssetManager_getStringBlockCount },
- { "getNativeStringBlock","(I)I",
+ { "getNativeStringBlock","(I)J",
(void*) android_content_AssetManager_getNativeStringBlock },
{ "getCookieName","(I)Ljava/lang/String;",
(void*) android_content_AssetManager_getCookieName },
// Themes.
- { "newTheme", "()I",
+ { "newTheme", "()J",
(void*) android_content_AssetManager_newTheme },
- { "deleteTheme", "(I)V",
+ { "deleteTheme", "(J)V",
(void*) android_content_AssetManager_deleteTheme },
- { "applyThemeStyle", "(IIZ)V",
+ { "applyThemeStyle", "(JIZ)V",
(void*) android_content_AssetManager_applyThemeStyle },
- { "copyTheme", "(II)V",
+ { "copyTheme", "(JJ)V",
(void*) android_content_AssetManager_copyTheme },
- { "loadThemeAttributeValue", "(IILandroid/util/TypedValue;Z)I",
+ { "loadThemeAttributeValue", "(JILandroid/util/TypedValue;Z)I",
(void*) android_content_AssetManager_loadThemeAttributeValue },
- { "dumpTheme", "(IILjava/lang/String;Ljava/lang/String;)V",
+ { "dumpTheme", "(JILjava/lang/String;Ljava/lang/String;)V",
(void*) android_content_AssetManager_dumpTheme },
- { "applyStyle","(IIII[I[I[I)Z",
+ { "applyStyle","(JIIJ[I[I[I)Z",
(void*) android_content_AssetManager_applyStyle },
- { "retrieveAttributes","(I[I[I[I)Z",
+ { "retrieveAttributes","(J[I[I[I)Z",
(void*) android_content_AssetManager_retrieveAttributes },
{ "getArraySize","(I)I",
(void*) android_content_AssetManager_getArraySize },
@@ -1702,7 +1712,7 @@
(void*) android_content_AssetManager_retrieveArray },
// XML files.
- { "openXmlAssetNative", "(ILjava/lang/String;)I",
+ { "openXmlAssetNative", "(ILjava/lang/String;)J",
(void*) android_content_AssetManager_openXmlAssetNative },
// Arrays.
@@ -1766,7 +1776,7 @@
jclass assetManager = env->FindClass("android/content/res/AssetManager");
LOG_FATAL_IF(assetManager == NULL, "Unable to find class android/content/res/AssetManager");
gAssetManagerOffsets.mObject
- = env->GetFieldID(assetManager, "mObject", "I");
+ = env->GetFieldID(assetManager, "mObject", "J");
LOG_FATAL_IF(gAssetManagerOffsets.mObject == NULL, "Unable to find AssetManager.mObject");
jclass stringClass = env->FindClass("java/lang/String");
diff --git a/core/jni/android_util_StringBlock.cpp b/core/jni/android_util_StringBlock.cpp
index 463d3c0..f29250f 100644
--- a/core/jni/android_util_StringBlock.cpp
+++ b/core/jni/android_util_StringBlock.cpp
@@ -31,7 +31,7 @@
// ----------------------------------------------------------------------------
-static jint android_content_StringBlock_nativeCreate(JNIEnv* env, jobject clazz,
+static jlong android_content_StringBlock_nativeCreate(JNIEnv* env, jobject clazz,
jbyteArray bArray,
jint off, jint len)
{
@@ -56,13 +56,13 @@
return 0;
}
- return (jint)osb;
+ return reinterpret_cast<jlong>(osb);
}
static jint android_content_StringBlock_nativeGetSize(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResStringPool* osb = (ResStringPool*)token;
+ ResStringPool* osb = reinterpret_cast<ResStringPool*>(token);
if (osb == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
@@ -72,9 +72,9 @@
}
static jstring android_content_StringBlock_nativeGetString(JNIEnv* env, jobject clazz,
- jint token, jint idx)
+ jlong token, jint idx)
{
- ResStringPool* osb = (ResStringPool*)token;
+ ResStringPool* osb = reinterpret_cast<ResStringPool*>(token);
if (osb == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
@@ -96,9 +96,9 @@
}
static jintArray android_content_StringBlock_nativeGetStyle(JNIEnv* env, jobject clazz,
- jint token, jint idx)
+ jlong token, jint idx)
{
- ResStringPool* osb = (ResStringPool*)token;
+ ResStringPool* osb = reinterpret_cast<ResStringPool*>(token);
if (osb == NULL) {
jniThrowNullPointerException(env, NULL);
return NULL;
@@ -139,9 +139,9 @@
}
static void android_content_StringBlock_nativeDestroy(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResStringPool* osb = (ResStringPool*)token;
+ ResStringPool* osb = reinterpret_cast<ResStringPool*>(token);
if (osb == NULL) {
jniThrowNullPointerException(env, NULL);
return;
@@ -157,15 +157,15 @@
*/
static JNINativeMethod gStringBlockMethods[] = {
/* name, signature, funcPtr */
- { "nativeCreate", "([BII)I",
+ { "nativeCreate", "([BII)J",
(void*) android_content_StringBlock_nativeCreate },
- { "nativeGetSize", "(I)I",
+ { "nativeGetSize", "(J)I",
(void*) android_content_StringBlock_nativeGetSize },
- { "nativeGetString", "(II)Ljava/lang/String;",
+ { "nativeGetString", "(JI)Ljava/lang/String;",
(void*) android_content_StringBlock_nativeGetString },
- { "nativeGetStyle", "(II)[I",
+ { "nativeGetStyle", "(JI)[I",
(void*) android_content_StringBlock_nativeGetStyle },
- { "nativeDestroy", "(I)V",
+ { "nativeDestroy", "(J)V",
(void*) android_content_StringBlock_nativeDestroy },
};
diff --git a/core/jni/android_util_XmlBlock.cpp b/core/jni/android_util_XmlBlock.cpp
index ad6033b..03de5c0 100644
--- a/core/jni/android_util_XmlBlock.cpp
+++ b/core/jni/android_util_XmlBlock.cpp
@@ -31,7 +31,7 @@
// ----------------------------------------------------------------------------
-static jint android_content_XmlBlock_nativeCreate(JNIEnv* env, jobject clazz,
+static jlong android_content_XmlBlock_nativeCreate(JNIEnv* env, jobject clazz,
jbyteArray bArray,
jint off, jint len)
{
@@ -55,25 +55,25 @@
return 0;
}
- return (jint)osb;
+ return reinterpret_cast<jlong>(osb);
}
-static jint android_content_XmlBlock_nativeGetStringBlock(JNIEnv* env, jobject clazz,
- jint token)
+static jlong android_content_XmlBlock_nativeGetStringBlock(JNIEnv* env, jobject clazz,
+ jlong token)
{
- ResXMLTree* osb = (ResXMLTree*)token;
+ ResXMLTree* osb = reinterpret_cast<ResXMLTree*>(token);
if (osb == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)&osb->getStrings();
+ return reinterpret_cast<jlong>(&osb->getStrings());
}
-static jint android_content_XmlBlock_nativeCreateParseState(JNIEnv* env, jobject clazz,
- jint token)
+static jlong android_content_XmlBlock_nativeCreateParseState(JNIEnv* env, jobject clazz,
+ jlong token)
{
- ResXMLTree* osb = (ResXMLTree*)token;
+ ResXMLTree* osb = reinterpret_cast<ResXMLTree*>(token);
if (osb == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
@@ -87,19 +87,19 @@
st->restart();
- return (jint)st;
+ return reinterpret_cast<jlong>(st);
}
static jint android_content_XmlBlock_nativeNext(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
return ResXMLParser::END_DOCUMENT;
}
do {
- jint code = (jint)st->next();
+ ResXMLParser::event_code_t code = st->next();
switch (code) {
case ResXMLParser::START_TAG:
return 2;
@@ -123,139 +123,139 @@
}
static jint android_content_XmlBlock_nativeGetNamespace(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
return -1;
}
- return (jint)st->getElementNamespaceID();
+ return static_cast<jint>(st->getElementNamespaceID());
}
static jint android_content_XmlBlock_nativeGetName(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
return -1;
}
- return (jint)st->getElementNameID();
+ return static_cast<jint>(st->getElementNameID());
}
static jint android_content_XmlBlock_nativeGetText(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
return -1;
}
- return (jint)st->getTextID();
+ return static_cast<jint>(st->getTextID());
}
static jint android_content_XmlBlock_nativeGetLineNumber(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)st->getLineNumber();
+ return static_cast<jint>(st->getLineNumber());
}
static jint android_content_XmlBlock_nativeGetAttributeCount(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)st->getAttributeCount();
+ return static_cast<jint>(st->getAttributeCount());
}
static jint android_content_XmlBlock_nativeGetAttributeNamespace(JNIEnv* env, jobject clazz,
- jint token, jint idx)
+ jlong token, jint idx)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)st->getAttributeNamespaceID(idx);
+ return static_cast<jint>(st->getAttributeNamespaceID(idx));
}
static jint android_content_XmlBlock_nativeGetAttributeName(JNIEnv* env, jobject clazz,
- jint token, jint idx)
+ jlong token, jint idx)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)st->getAttributeNameID(idx);
+ return static_cast<jint>(st->getAttributeNameID(idx));
}
static jint android_content_XmlBlock_nativeGetAttributeResource(JNIEnv* env, jobject clazz,
- jint token, jint idx)
+ jlong token, jint idx)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)st->getAttributeNameResID(idx);
+ return static_cast<jint>(st->getAttributeNameResID(idx));
}
static jint android_content_XmlBlock_nativeGetAttributeDataType(JNIEnv* env, jobject clazz,
- jint token, jint idx)
+ jlong token, jint idx)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)st->getAttributeDataType(idx);
+ return static_cast<jint>(st->getAttributeDataType(idx));
}
static jint android_content_XmlBlock_nativeGetAttributeData(JNIEnv* env, jobject clazz,
- jint token, jint idx)
+ jlong token, jint idx)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)st->getAttributeData(idx);
+ return static_cast<jint>(st->getAttributeData(idx));
}
static jint android_content_XmlBlock_nativeGetAttributeStringValue(JNIEnv* env, jobject clazz,
- jint token, jint idx)
+ jlong token, jint idx)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
- return (jint)st->getAttributeValueStringID(idx);
+ return static_cast<jint>(st->getAttributeValueStringID(idx));
}
static jint android_content_XmlBlock_nativeGetAttributeIndex(JNIEnv* env, jobject clazz,
- jint token,
+ jlong token,
jstring ns, jstring name)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL || name == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
@@ -271,7 +271,7 @@
const char16_t* name16 = env->GetStringChars(name, NULL);
jsize nameLen = env->GetStringLength(name);
- jint idx = (jint)st->indexOfAttribute(ns16, nsLen, name16, nameLen);
+ jint idx = static_cast<jint>(st->indexOfAttribute(ns16, nsLen, name16, nameLen));
if (ns) {
env->ReleaseStringChars(ns, ns16);
@@ -282,35 +282,35 @@
}
static jint android_content_XmlBlock_nativeGetIdAttribute(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
ssize_t idx = st->indexOfID();
- return idx >= 0 ? (jint)st->getAttributeValueStringID(idx) : -1;
+ return idx >= 0 ? static_cast<jint>(st->getAttributeValueStringID(idx)) : -1;
}
static jint android_content_XmlBlock_nativeGetClassAttribute(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
}
ssize_t idx = st->indexOfClass();
- return idx >= 0 ? (jint)st->getAttributeValueStringID(idx) : -1;
+ return idx >= 0 ? static_cast<jint>(st->getAttributeValueStringID(idx)) : -1;
}
static jint android_content_XmlBlock_nativeGetStyleAttribute(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return 0;
@@ -332,9 +332,9 @@
}
static void android_content_XmlBlock_nativeDestroyParseState(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLParser* st = (ResXMLParser*)token;
+ ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
if (st == NULL) {
jniThrowNullPointerException(env, NULL);
return;
@@ -344,9 +344,9 @@
}
static void android_content_XmlBlock_nativeDestroy(JNIEnv* env, jobject clazz,
- jint token)
+ jlong token)
{
- ResXMLTree* osb = (ResXMLTree*)token;
+ ResXMLTree* osb = reinterpret_cast<ResXMLTree*>(token);
if (osb == NULL) {
jniThrowNullPointerException(env, NULL);
return;
@@ -362,47 +362,47 @@
*/
static JNINativeMethod gXmlBlockMethods[] = {
/* name, signature, funcPtr */
- { "nativeCreate", "([BII)I",
+ { "nativeCreate", "([BII)J",
(void*) android_content_XmlBlock_nativeCreate },
- { "nativeGetStringBlock", "(I)I",
+ { "nativeGetStringBlock", "(J)J",
(void*) android_content_XmlBlock_nativeGetStringBlock },
- { "nativeCreateParseState", "(I)I",
+ { "nativeCreateParseState", "(J)J",
(void*) android_content_XmlBlock_nativeCreateParseState },
- { "nativeNext", "(I)I",
+ { "nativeNext", "(J)I",
(void*) android_content_XmlBlock_nativeNext },
- { "nativeGetNamespace", "(I)I",
+ { "nativeGetNamespace", "(J)I",
(void*) android_content_XmlBlock_nativeGetNamespace },
- { "nativeGetName", "(I)I",
+ { "nativeGetName", "(J)I",
(void*) android_content_XmlBlock_nativeGetName },
- { "nativeGetText", "(I)I",
+ { "nativeGetText", "(J)I",
(void*) android_content_XmlBlock_nativeGetText },
- { "nativeGetLineNumber", "(I)I",
+ { "nativeGetLineNumber", "(J)I",
(void*) android_content_XmlBlock_nativeGetLineNumber },
- { "nativeGetAttributeCount", "(I)I",
+ { "nativeGetAttributeCount", "(J)I",
(void*) android_content_XmlBlock_nativeGetAttributeCount },
- { "nativeGetAttributeNamespace","(II)I",
+ { "nativeGetAttributeNamespace","(JI)I",
(void*) android_content_XmlBlock_nativeGetAttributeNamespace },
- { "nativeGetAttributeName", "(II)I",
+ { "nativeGetAttributeName", "(JI)I",
(void*) android_content_XmlBlock_nativeGetAttributeName },
- { "nativeGetAttributeResource", "(II)I",
+ { "nativeGetAttributeResource", "(JI)I",
(void*) android_content_XmlBlock_nativeGetAttributeResource },
- { "nativeGetAttributeDataType", "(II)I",
+ { "nativeGetAttributeDataType", "(JI)I",
(void*) android_content_XmlBlock_nativeGetAttributeDataType },
- { "nativeGetAttributeData", "(II)I",
+ { "nativeGetAttributeData", "(JI)I",
(void*) android_content_XmlBlock_nativeGetAttributeData },
- { "nativeGetAttributeStringValue", "(II)I",
+ { "nativeGetAttributeStringValue", "(JI)I",
(void*) android_content_XmlBlock_nativeGetAttributeStringValue },
- { "nativeGetAttributeIndex", "(ILjava/lang/String;Ljava/lang/String;)I",
+ { "nativeGetAttributeIndex", "(JLjava/lang/String;Ljava/lang/String;)I",
(void*) android_content_XmlBlock_nativeGetAttributeIndex },
- { "nativeGetIdAttribute", "(I)I",
+ { "nativeGetIdAttribute", "(J)I",
(void*) android_content_XmlBlock_nativeGetIdAttribute },
- { "nativeGetClassAttribute", "(I)I",
+ { "nativeGetClassAttribute", "(J)I",
(void*) android_content_XmlBlock_nativeGetClassAttribute },
- { "nativeGetStyleAttribute", "(I)I",
+ { "nativeGetStyleAttribute", "(J)I",
(void*) android_content_XmlBlock_nativeGetStyleAttribute },
- { "nativeDestroyParseState", "(I)V",
+ { "nativeDestroyParseState", "(J)V",
(void*) android_content_XmlBlock_nativeDestroyParseState },
- { "nativeDestroy", "(I)V",
+ { "nativeDestroy", "(J)V",
(void*) android_content_XmlBlock_nativeDestroy },
};
diff --git a/native/android/asset_manager.cpp b/native/android/asset_manager.cpp
index 01db1d3..dee3f8c 100644
--- a/native/android/asset_manager.cpp
+++ b/native/android/asset_manager.cpp
@@ -76,12 +76,12 @@
if (gJNIConfigured == false) {
jclass amClass = env->FindClass("android/content/res/AssetManager");
- gAssetManagerOffsets.mObject = env->GetFieldID(amClass, "mObject", "I");
+ gAssetManagerOffsets.mObject = env->GetFieldID(amClass, "mObject", "J");
gJNIConfigured = true;
}
}
- return (AAssetManager*) env->GetIntField(assetManager, gAssetManagerOffsets.mObject);
+ return (AAssetManager*) env->GetLongField(assetManager, gAssetManagerOffsets.mObject);
}
AAsset* AAssetManager_open(AAssetManager* amgr, const char* filename, int mode)