am b90fc64b: am f44a3f1e: Merge "Use long for pointers in EmojiFactory and PdfDocument"
* commit 'b90fc64b030ee50bda9a0dabb5247660b70d6659':
Use long for pointers in EmojiFactory and PdfDocument
diff --git a/core/java/android/emoji/EmojiFactory.java b/core/java/android/emoji/EmojiFactory.java
index 8fd8695..aba990d 100644
--- a/core/java/android/emoji/EmojiFactory.java
+++ b/core/java/android/emoji/EmojiFactory.java
@@ -54,7 +54,7 @@
}
// A pointer to native EmojiFactory object.
- private int mNativeEmojiFactory;
+ private long mNativeEmojiFactory;
private String mName;
// Cache.
private Map<Integer, WeakReference<Bitmap>> mCache;
@@ -68,7 +68,7 @@
*
* This can be called from JNI code.
*/
- private EmojiFactory(int nativeEmojiFactory, String name) {
+ private EmojiFactory(long nativeEmojiFactory, String name) {
mNativeEmojiFactory = nativeEmojiFactory;
mName = name;
mCache = new CustomLinkedHashMap<Integer, WeakReference<Bitmap>>();
@@ -272,18 +272,18 @@
// native methods
- private native void nativeDestructor(int factory);
- private native Bitmap nativeGetBitmapFromAndroidPua(int nativeEmojiFactory, int AndroidPua);
- private native int nativeGetAndroidPuaFromVendorSpecificSjis(int nativeEmojiFactory,
+ private native void nativeDestructor(long nativeEmojiFactory);
+ private native Bitmap nativeGetBitmapFromAndroidPua(long nativeEmojiFactory, int AndroidPua);
+ private native int nativeGetAndroidPuaFromVendorSpecificSjis(long nativeEmojiFactory,
char sjis);
- private native int nativeGetVendorSpecificSjisFromAndroidPua(int nativeEmojiFactory,
+ private native int nativeGetVendorSpecificSjisFromAndroidPua(long nativeEmojiFactory,
int pua);
- private native int nativeGetAndroidPuaFromVendorSpecificPua(int nativeEmojiFactory,
+ private native int nativeGetAndroidPuaFromVendorSpecificPua(long nativeEmojiFactory,
int vsp);
- private native int nativeGetVendorSpecificPuaFromAndroidPua(int nativeEmojiFactory,
+ private native int nativeGetVendorSpecificPuaFromAndroidPua(long nativeEmojiFactory,
int pua);
- private native int nativeGetMaximumVendorSpecificPua(int nativeEmojiFactory);
- private native int nativeGetMinimumVendorSpecificPua(int nativeEmojiFactory);
- private native int nativeGetMaximumAndroidPua(int nativeEmojiFactory);
- private native int nativeGetMinimumAndroidPua(int nativeEmojiFactory);
+ private native int nativeGetMaximumVendorSpecificPua(long nativeEmojiFactory);
+ private native int nativeGetMinimumVendorSpecificPua(long nativeEmojiFactory);
+ private native int nativeGetMaximumAndroidPua(long nativeEmojiFactory);
+ private native int nativeGetMinimumAndroidPua(long nativeEmojiFactory);
}
diff --git a/core/jni/android/graphics/pdf/PdfDocument.cpp b/core/jni/android/graphics/pdf/PdfDocument.cpp
index 6175a8f..d54aaa8 100644
--- a/core/jni/android/graphics/pdf/PdfDocument.cpp
+++ b/core/jni/android/graphics/pdf/PdfDocument.cpp
@@ -113,24 +113,24 @@
PageRecord* mCurrentPage;
};
-static jint nativeCreateDocument(JNIEnv* env, jobject thiz) {
- return reinterpret_cast<jint>(new PdfDocument());
+static jlong nativeCreateDocument(JNIEnv* env, jobject thiz) {
+ return reinterpret_cast<jlong>(new PdfDocument());
}
-static jint nativeStartPage(JNIEnv* env, jobject thiz, jint documentPtr,
+static jlong nativeStartPage(JNIEnv* env, jobject thiz, jlong documentPtr,
jint pageWidth, jint pageHeight,
jint contentLeft, jint contentTop, jint contentRight, jint contentBottom) {
PdfDocument* document = reinterpret_cast<PdfDocument*>(documentPtr);
- return reinterpret_cast<jint>(document->startPage(pageWidth, pageHeight,
+ return reinterpret_cast<jlong>(document->startPage(pageWidth, pageHeight,
contentLeft, contentTop, contentRight, contentBottom));
}
-static void nativeFinishPage(JNIEnv* env, jobject thiz, jint documentPtr) {
+static void nativeFinishPage(JNIEnv* env, jobject thiz, jlong documentPtr) {
PdfDocument* document = reinterpret_cast<PdfDocument*>(documentPtr);
document->finishPage();
}
-static void nativeWriteTo(JNIEnv* env, jobject thiz, jint documentPtr, jobject out,
+static void nativeWriteTo(JNIEnv* env, jobject thiz, jlong documentPtr, jobject out,
jbyteArray chunk) {
PdfDocument* document = reinterpret_cast<PdfDocument*>(documentPtr);
SkWStream* skWStream = CreateJavaOutputStreamAdaptor(env, out, chunk);
@@ -138,17 +138,17 @@
delete skWStream;
}
-static void nativeClose(JNIEnv* env, jobject thiz, jint documentPtr) {
+static void nativeClose(JNIEnv* env, jobject thiz, jlong documentPtr) {
PdfDocument* document = reinterpret_cast<PdfDocument*>(documentPtr);
document->close();
}
static JNINativeMethod gPdfDocument_Methods[] = {
- {"nativeCreateDocument", "()I", (void*) nativeCreateDocument},
- {"nativeStartPage", "(IIIIIII)I", (void*) nativeStartPage},
- {"nativeFinishPage", "(I)V", (void*) nativeFinishPage},
- {"nativeWriteTo", "(ILjava/io/OutputStream;[B)V", (void*) nativeWriteTo},
- {"nativeClose", "(I)V", (void*) nativeClose}
+ {"nativeCreateDocument", "()J", (void*) nativeCreateDocument},
+ {"nativeStartPage", "(JIIIIII)J", (void*) nativeStartPage},
+ {"nativeFinishPage", "(J)V", (void*) nativeFinishPage},
+ {"nativeWriteTo", "(JLjava/io/OutputStream;[B)V", (void*) nativeWriteTo},
+ {"nativeClose", "(J)V", (void*) nativeClose}
};
int register_android_graphics_pdf_PdfDocument(JNIEnv* env) {
diff --git a/core/jni/android_emoji_EmojiFactory.cpp b/core/jni/android_emoji_EmojiFactory.cpp
index 5276934..f127d29 100644
--- a/core/jni/android_emoji_EmojiFactory.cpp
+++ b/core/jni/android_emoji_EmojiFactory.cpp
@@ -104,7 +104,7 @@
static jobject create_java_EmojiFactory(
JNIEnv* env, EmojiFactory* factory, jstring name) {
jobject obj = env->NewObject(gEmojiFactory_class, gEmojiFactory_constructorMethodID,
- static_cast<jint>(reinterpret_cast<uintptr_t>(factory)), name);
+ reinterpret_cast<jlong>(factory), name);
if (env->ExceptionCheck() != 0) {
ALOGE("*** Uncaught exception returned from Java call!\n");
env->ExceptionDescribe();
@@ -155,7 +155,7 @@
}
static jobject android_emoji_EmojiFactory_getBitmapFromAndroidPua(
- JNIEnv* env, jobject clazz, jint nativeEmojiFactory, jint pua) {
+ JNIEnv* env, jobject clazz, jlong nativeEmojiFactory, jint pua) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
int size;
@@ -175,7 +175,7 @@
}
static void android_emoji_EmojiFactory_destructor(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory) {
/*
// Must not delete this object!!
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
@@ -184,49 +184,49 @@
}
static jint android_emoji_EmojiFactory_getAndroidPuaFromVendorSpecificSjis(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory, jchar sjis) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory, jchar sjis) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
return factory->GetAndroidPuaFromVendorSpecificSjis(sjis);
}
static jint android_emoji_EmojiFactory_getVendorSpecificSjisFromAndroidPua(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory, jint pua) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory, jint pua) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
return factory->GetVendorSpecificSjisFromAndroidPua(pua);
}
static jint android_emoji_EmojiFactory_getAndroidPuaFromVendorSpecificPua(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory, jint vsu) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory, jint vsu) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
return factory->GetAndroidPuaFromVendorSpecificPua(vsu);
}
static jint android_emoji_EmojiFactory_getVendorSpecificPuaFromAndroidPua(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory, jint pua) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory, jint pua) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
return factory->GetVendorSpecificPuaFromAndroidPua(pua);
}
static jint android_emoji_EmojiFactory_getMaximumVendorSpecificPua(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
return factory->GetMaximumVendorSpecificPua();
}
static jint android_emoji_EmojiFactory_getMinimumVendorSpecificPua(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
return factory->GetMinimumVendorSpecificPua();
}
static jint android_emoji_EmojiFactory_getMaximumAndroidPua(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
return factory->GetMaximumAndroidPua();
}
static jint android_emoji_EmojiFactory_getMinimumAndroidPua(
- JNIEnv* env, jobject obj, jint nativeEmojiFactory) {
+ JNIEnv* env, jobject obj, jlong nativeEmojiFactory) {
EmojiFactory *factory = reinterpret_cast<EmojiFactory *>(nativeEmojiFactory);
return factory->GetMinimumAndroidPua();
}
@@ -236,25 +236,25 @@
(void*)android_emoji_EmojiFactory_newInstance},
{ "newAvailableInstance", "()Landroid/emoji/EmojiFactory;",
(void*)android_emoji_EmojiFactory_newAvailableInstance},
- { "nativeDestructor", "(I)V",
+ { "nativeDestructor", "(J)V",
(void*)android_emoji_EmojiFactory_destructor},
- { "nativeGetBitmapFromAndroidPua", "(II)Landroid/graphics/Bitmap;",
+ { "nativeGetBitmapFromAndroidPua", "(JI)Landroid/graphics/Bitmap;",
(void*)android_emoji_EmojiFactory_getBitmapFromAndroidPua},
- { "nativeGetAndroidPuaFromVendorSpecificSjis", "(IC)I",
+ { "nativeGetAndroidPuaFromVendorSpecificSjis", "(JC)I",
(void*)android_emoji_EmojiFactory_getAndroidPuaFromVendorSpecificSjis},
- { "nativeGetVendorSpecificSjisFromAndroidPua", "(II)I",
+ { "nativeGetVendorSpecificSjisFromAndroidPua", "(JI)I",
(void*)android_emoji_EmojiFactory_getVendorSpecificSjisFromAndroidPua},
- { "nativeGetAndroidPuaFromVendorSpecificPua", "(II)I",
+ { "nativeGetAndroidPuaFromVendorSpecificPua", "(JI)I",
(void*)android_emoji_EmojiFactory_getAndroidPuaFromVendorSpecificPua},
- { "nativeGetVendorSpecificPuaFromAndroidPua", "(II)I",
+ { "nativeGetVendorSpecificPuaFromAndroidPua", "(JI)I",
(void*)android_emoji_EmojiFactory_getVendorSpecificPuaFromAndroidPua},
- { "nativeGetMaximumVendorSpecificPua", "(I)I",
+ { "nativeGetMaximumVendorSpecificPua", "(J)I",
(void*)android_emoji_EmojiFactory_getMaximumVendorSpecificPua},
- { "nativeGetMinimumVendorSpecificPua", "(I)I",
+ { "nativeGetMinimumVendorSpecificPua", "(J)I",
(void*)android_emoji_EmojiFactory_getMinimumVendorSpecificPua},
- { "nativeGetMaximumAndroidPua", "(I)I",
+ { "nativeGetMaximumAndroidPua", "(J)I",
(void*)android_emoji_EmojiFactory_getMaximumAndroidPua},
- { "nativeGetMinimumAndroidPua", "(I)I",
+ { "nativeGetMinimumAndroidPua", "(J)I",
(void*)android_emoji_EmojiFactory_getMinimumAndroidPua}
};
@@ -276,7 +276,7 @@
int register_android_emoji_EmojiFactory(JNIEnv* env) {
gEmojiFactory_class = make_globalref(env, "android/emoji/EmojiFactory");
gEmojiFactory_constructorMethodID = env->GetMethodID(
- gEmojiFactory_class, "<init>", "(ILjava/lang/String;)V");
+ gEmojiFactory_class, "<init>", "(JLjava/lang/String;)V");
return jniRegisterNativeMethods(env, "android/emoji/EmojiFactory",
gMethods, NELEM(gMethods));
}
diff --git a/graphics/java/android/graphics/pdf/PdfDocument.java b/graphics/java/android/graphics/pdf/PdfDocument.java
index 29d14a2..f5b07c1 100644
--- a/graphics/java/android/graphics/pdf/PdfDocument.java
+++ b/graphics/java/android/graphics/pdf/PdfDocument.java
@@ -82,7 +82,7 @@
private final List<PageInfo> mPages = new ArrayList<PageInfo>();
- private int mNativeDocument;
+ private long mNativeDocument;
private Page mCurrentPage;
@@ -235,20 +235,20 @@
}
}
- private native int nativeCreateDocument();
+ private native long nativeCreateDocument();
- private native void nativeClose(int document);
+ private native void nativeClose(long nativeDocument);
- private native void nativeFinishPage(int document);
+ private native void nativeFinishPage(long nativeDocument);
- private native void nativeWriteTo(int document, OutputStream out, byte[] chunk);
+ private native void nativeWriteTo(long nativeDocument, OutputStream out, byte[] chunk);
- private static native int nativeStartPage(int documentPtr, int pageWidth, int pageHeight,
+ private static native long nativeStartPage(long nativeDocument, int pageWidth, int pageHeight,
int contentLeft, int contentTop, int contentRight, int contentBottom);
private final class PdfCanvas extends Canvas {
- public PdfCanvas(int nativeCanvas) {
+ public PdfCanvas(long nativeCanvas) {
super(nativeCanvas);
}