Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make libjavacore independent of libnativehelper for the PDK.

Bug: 6369821
Change-Id: Ie038571a5dac1f301c0c3c6fb84df432e67b62c0
  • Loading branch information...
commit 7cd6760f7045d771faae8080a8c6150bf678f679 1 parent 88f3ec9
@enh enh authored
Showing with 147 additions and 206 deletions.
  1. +1 −0  Android.mk
  2. +8 −5 NativeCode.mk
  3. +47 −84 luni/src/main/native/Register.cpp
  4. +2 −2 luni/src/main/native/java_io_Console.cpp
  5. +2 −2 luni/src/main/native/java_io_File.cpp
  6. +2 −2 luni/src/main/native/java_io_ObjectStreamClass.cpp
  7. +2 −2 luni/src/main/native/java_lang_Character.cpp
  8. +2 −2 luni/src/main/native/java_lang_Math.cpp
  9. +2 −2 luni/src/main/native/java_lang_ProcessManager.cpp
  10. +2 −2 luni/src/main/native/java_lang_RealToString.cpp
  11. +2 −2 luni/src/main/native/java_lang_StrictMath.cpp
  12. +2 −2 luni/src/main/native/java_lang_StringToReal.cpp
  13. +2 −2 luni/src/main/native/java_lang_System.cpp
  14. +2 −2 luni/src/main/native/java_math_NativeBN.cpp
  15. +2 −2 luni/src/main/native/java_nio_ByteOrder.cpp
  16. +2 −2 luni/src/main/native/java_nio_charset_Charsets.cpp
  17. +2 −2 luni/src/main/native/java_text_Bidi.cpp
  18. +2 −2 luni/src/main/native/java_util_regex_Matcher.cpp
  19. +2 −2 luni/src/main/native/java_util_regex_Pattern.cpp
  20. +2 −2 luni/src/main/native/java_util_zip_Adler32.cpp
  21. +2 −2 luni/src/main/native/java_util_zip_CRC32.cpp
  22. +2 −2 luni/src/main/native/java_util_zip_Deflater.cpp
  23. +2 −2 luni/src/main/native/java_util_zip_Inflater.cpp
  24. +4 −4 luni/src/main/native/libcore_icu_ICU.cpp
  25. +2 −2 luni/src/main/native/libcore_icu_NativeBreakIterator.cpp
  26. +2 −2 luni/src/main/native/libcore_icu_NativeCollation.cpp
  27. +2 −2 luni/src/main/native/libcore_icu_NativeConverter.cpp
  28. +2 −2 luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp
  29. +2 −2 luni/src/main/native/libcore_icu_NativeIDN.cpp
  30. +2 −2 luni/src/main/native/libcore_icu_NativeNormalizer.cpp
  31. +2 −2 luni/src/main/native/libcore_icu_NativePluralRules.cpp
  32. +2 −2 luni/src/main/native/libcore_icu_TimeZones.cpp
  33. +2 −2 luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
  34. +2 −2 luni/src/main/native/libcore_io_Memory.cpp
  35. +2 −2 luni/src/main/native/libcore_io_OsConstants.cpp
  36. +2 −2 luni/src/main/native/libcore_io_Posix.cpp
  37. +5 −9 luni/src/main/native/libcore_net_RawSocket.cpp
  38. +14 −23 luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
  39. +2 −5 luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp
  40. +2 −12 luni/src/main/native/sub.mk
View
1  Android.mk
@@ -58,6 +58,7 @@ ifeq ($(WITH_HOST_DALVIK),true)
dalvik \
$(HOST_OUT)/bin/dalvikvm \
$(HOST_OUT)/bin/dexopt \
+ $(HOST_OUT)/lib/libjavacore.so \
cacerts-host \
$(HOST_OUT)/usr/share/zoneinfo/zoneinfo.dat \
$(HOST_OUT)/usr/share/zoneinfo/zoneinfo.idx \
View
13 NativeCode.mk
@@ -87,7 +87,7 @@ endif
# Define the rules.
LOCAL_SRC_FILES := $(core_src_files)
LOCAL_C_INCLUDES := $(core_c_includes)
-LOCAL_SHARED_LIBRARIES := $(core_shared_libraries)
+LOCAL_SHARED_LIBRARIES := $(core_shared_libraries) libexpat libicuuc libicui18n libssl libcrypto libz libnativehelper
LOCAL_STATIC_LIBRARIES := $(core_static_libraries)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libjavacore
@@ -95,7 +95,7 @@ LOCAL_MODULE := libjavacore
LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
LOCAL_SHARED_LIBRARIES += libstlport
-include $(BUILD_STATIC_LIBRARY)
+include $(BUILD_SHARED_LIBRARY)
#
# Build for the host.
@@ -106,9 +106,12 @@ ifeq ($(WITH_HOST_DALVIK),true)
# Define the rules.
LOCAL_SRC_FILES := $(core_src_files)
LOCAL_CFLAGS += $(core_cflags)
- LOCAL_CPPFLAGS += $(core_cppflags)
LOCAL_C_INCLUDES := $(core_c_includes)
+ LOCAL_CPPFLAGS += $(core_cppflags)
+ LOCAL_LDLIBS += -ldl -lpthread
LOCAL_MODULE_TAGS := optional
- LOCAL_MODULE := libjavacore-host
- include $(BUILD_HOST_STATIC_LIBRARY)
+ LOCAL_MODULE := libjavacore
+ LOCAL_SHARED_LIBRARIES := $(core_shared_libraries) libexpat libicuuc libicui18n libssl libcrypto libz-host
+ LOCAL_STATIC_LIBRARIES := $(core_static_libraries)
+ include $(BUILD_HOST_SHARED_LIBRARY)
endif
View
131 luni/src/main/native/Register.cpp
@@ -21,93 +21,56 @@
#include <stdlib.h>
-extern int register_java_io_Console(JNIEnv* env);
-extern int register_java_io_File(JNIEnv* env);
-extern int register_java_io_ObjectStreamClass(JNIEnv* env);
-extern int register_java_lang_Character(JNIEnv* env);
-extern int register_java_lang_Math(JNIEnv* env);
-extern int register_java_lang_ProcessManager(JNIEnv* env);
-extern int register_java_lang_RealToString(JNIEnv* env);
-extern int register_java_lang_StrictMath(JNIEnv* env);
-extern int register_java_lang_StringToReal(JNIEnv* env);
-extern int register_java_lang_System(JNIEnv* env);
-extern int register_java_math_NativeBN(JNIEnv* env);
-extern int register_java_nio_ByteOrder(JNIEnv* env);
-extern int register_java_nio_charset_Charsets(JNIEnv* env);
-extern int register_java_text_Bidi(JNIEnv* env);
-extern int register_java_util_regex_Matcher(JNIEnv* env);
-extern int register_java_util_regex_Pattern(JNIEnv* env);
-extern int register_java_util_zip_Adler32(JNIEnv* env);
-extern int register_java_util_zip_CRC32(JNIEnv* env);
-extern int register_java_util_zip_Deflater(JNIEnv* env);
-extern int register_java_util_zip_Inflater(JNIEnv* env);
-extern int register_libcore_icu_ICU(JNIEnv* env);
-extern int register_libcore_icu_NativeBreakIterator(JNIEnv* env);
-extern int register_libcore_icu_NativeCollation(JNIEnv* env);
-extern int register_libcore_icu_NativeConverter(JNIEnv* env);
-extern int register_libcore_icu_NativeDecimalFormat(JNIEnv* env);
-extern int register_libcore_icu_NativeIDN(JNIEnv* env);
-extern int register_libcore_icu_NativeNormalizer(JNIEnv* env);
-extern int register_libcore_icu_NativePluralRules(JNIEnv* env);
-extern int register_libcore_icu_TimeZones(JNIEnv* env);
-extern int register_libcore_io_AsynchronousCloseMonitor(JNIEnv* env);
-extern int register_libcore_io_Memory(JNIEnv* env);
-extern int register_libcore_io_OsConstants(JNIEnv* env);
-extern int register_libcore_io_Posix(JNIEnv* env);
-extern int register_libcore_net_RawSocket(JNIEnv* env);
-extern int register_org_apache_harmony_dalvik_NativeTestTarget(JNIEnv* env);
-extern int register_org_apache_harmony_xml_ExpatParser(JNIEnv* env);
-extern int register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(JNIEnv* env);
-
// DalvikVM calls this on startup, so we can statically register all our native methods.
-int registerCoreLibrariesJni(JNIEnv* env) {
+int JNI_OnLoad(JavaVM* vm, void*) {
+ JNIEnv* env;
+ if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
+ ALOGE("JavaVM::GetEnv() failed");
+ abort();
+ }
+
ScopedLocalFrame localFrame(env);
JniConstants::init(env);
- bool result =
- register_java_io_Console(env) != -1 &&
- register_java_io_File(env) != -1 &&
- register_java_io_ObjectStreamClass(env) != -1 &&
- register_java_lang_Character(env) != -1 &&
- register_java_lang_Math(env) != -1 &&
- register_java_lang_ProcessManager(env) != -1 &&
- register_java_lang_RealToString(env) != -1 &&
- register_java_lang_StrictMath(env) != -1 &&
- register_java_lang_StringToReal(env) != -1 &&
- register_java_lang_System(env) != -1 &&
- register_java_math_NativeBN(env) != -1 &&
- register_java_nio_ByteOrder(env) != -1 &&
- register_java_nio_charset_Charsets(env) != -1 &&
- register_java_text_Bidi(env) != -1 &&
- register_java_util_regex_Matcher(env) != -1 &&
- register_java_util_regex_Pattern(env) != -1 &&
- register_java_util_zip_Adler32(env) != -1 &&
- register_java_util_zip_CRC32(env) != -1 &&
- register_java_util_zip_Deflater(env) != -1 &&
- register_java_util_zip_Inflater(env) != -1 &&
- register_libcore_icu_ICU(env) != -1 &&
- register_libcore_icu_NativeBreakIterator(env) != -1 &&
- register_libcore_icu_NativeCollation(env) != -1 &&
- register_libcore_icu_NativeConverter(env) != -1 &&
- register_libcore_icu_NativeDecimalFormat(env) != -1 &&
- register_libcore_icu_NativeIDN(env) != -1 &&
- register_libcore_icu_NativeNormalizer(env) != -1 &&
- register_libcore_icu_NativePluralRules(env) != -1 &&
- register_libcore_icu_TimeZones(env) != -1 &&
- register_libcore_io_AsynchronousCloseMonitor(env) != -1 &&
- register_libcore_io_Memory(env) != -1 &&
- register_libcore_io_OsConstants(env) != -1 &&
- register_libcore_io_Posix(env) != -1 &&
- register_libcore_net_RawSocket(env) != -1 &&
- register_org_apache_harmony_dalvik_NativeTestTarget(env) != -1 &&
- register_org_apache_harmony_xml_ExpatParser(env) != -1 &&
- register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(env) != -1 &&
- true;
-
- if (!result) {
- ALOGE("Failed to initialize the core libraries; aborting...");
- abort();
- }
- return 0;
+#define REGISTER(FN) extern void FN(JNIEnv*); FN(env)
+ REGISTER(register_java_io_Console);
+ REGISTER(register_java_io_File);
+ REGISTER(register_java_io_ObjectStreamClass);
+ REGISTER(register_java_lang_Character);
+ REGISTER(register_java_lang_Math);
+ REGISTER(register_java_lang_ProcessManager);
+ REGISTER(register_java_lang_RealToString);
+ REGISTER(register_java_lang_StrictMath);
+ REGISTER(register_java_lang_StringToReal);
+ REGISTER(register_java_lang_System);
+ REGISTER(register_java_math_NativeBN);
+ REGISTER(register_java_nio_ByteOrder);
+ REGISTER(register_java_nio_charset_Charsets);
+ REGISTER(register_java_text_Bidi);
+ REGISTER(register_java_util_regex_Matcher);
+ REGISTER(register_java_util_regex_Pattern);
+ REGISTER(register_java_util_zip_Adler32);
+ REGISTER(register_java_util_zip_CRC32);
+ REGISTER(register_java_util_zip_Deflater);
+ REGISTER(register_java_util_zip_Inflater);
+ REGISTER(register_libcore_icu_ICU);
+ REGISTER(register_libcore_icu_NativeBreakIterator);
+ REGISTER(register_libcore_icu_NativeCollation);
+ REGISTER(register_libcore_icu_NativeConverter);
+ REGISTER(register_libcore_icu_NativeDecimalFormat);
+ REGISTER(register_libcore_icu_NativeIDN);
+ REGISTER(register_libcore_icu_NativeNormalizer);
+ REGISTER(register_libcore_icu_NativePluralRules);
+ REGISTER(register_libcore_icu_TimeZones);
+ REGISTER(register_libcore_io_AsynchronousCloseMonitor);
+ REGISTER(register_libcore_io_Memory);
+ REGISTER(register_libcore_io_OsConstants);
+ REGISTER(register_libcore_io_Posix);
+ REGISTER(register_libcore_net_RawSocket);
+ REGISTER(register_org_apache_harmony_dalvik_NativeTestTarget);
+ REGISTER(register_org_apache_harmony_xml_ExpatParser);
+ REGISTER(register_org_apache_harmony_xnet_provider_jsse_NativeCrypto);
+#undef REGISTER
+ return JNI_VERSION_1_6;
}
View
4 luni/src/main/native/java_io_Console.cpp
@@ -46,6 +46,6 @@ static jint Console_setEchoImpl(JNIEnv* env, jclass, jboolean on, jint previousS
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Console, setEchoImpl, "(ZI)I"),
};
-int register_java_io_Console(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/io/Console", gMethods, NELEM(gMethods));
+void register_java_io_Console(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/io/Console", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_io_File.cpp
@@ -168,6 +168,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(File, realpath, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(File, setLastModifiedImpl, "(Ljava/lang/String;J)Z"),
};
-int register_java_io_File(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/io/File", gMethods, NELEM(gMethods));
+void register_java_io_File(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/io/File", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_io_ObjectStreamClass.cpp
@@ -63,6 +63,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectStreamClass, hasClinit, "(Ljava/lang/Class;)Z"),
NATIVE_METHOD(ObjectStreamClass, newInstance, "(Ljava/lang/Class;I)Ljava/lang/Object;"),
};
-int register_java_io_ObjectStreamClass(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/io/ObjectStreamClass", gMethods, NELEM(gMethods));
+void register_java_io_ObjectStreamClass(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/io/ObjectStreamClass", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_lang_Character.cpp
@@ -160,6 +160,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Character, toTitleCaseImpl, "!(I)I"),
NATIVE_METHOD(Character, toUpperCaseImpl, "!(I)I"),
};
-int register_java_lang_Character(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/lang/Character", gMethods, NELEM(gMethods));
+void register_java_lang_Character(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/lang/Character", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_lang_Math.cpp
@@ -131,6 +131,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Math, tanh, "!(D)D"),
};
-int register_java_lang_Math(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/lang/Math", gMethods, NELEM(gMethods));
+void register_java_lang_Math(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/lang/Math", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_lang_ProcessManager.cpp
@@ -265,6 +265,6 @@ static pid_t ProcessManager_exec(JNIEnv* env, jclass, jobjectArray javaCommands,
static JNINativeMethod methods[] = {
NATIVE_METHOD(ProcessManager, exec, "([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;Z)I"),
};
-int register_java_lang_ProcessManager(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/lang/ProcessManager", methods, NELEM(methods));
+void register_java_lang_ProcessManager(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/lang/ProcessManager", methods, NELEM(methods));
}
View
4 luni/src/main/native/java_lang_RealToString.cpp
@@ -237,6 +237,6 @@ void RealToString_bigIntDigitGenerator(JNIEnv* env, jobject obj, jlong f, jint e
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(RealToString, bigIntDigitGenerator, "(JIZI)V"),
};
-int register_java_lang_RealToString(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/lang/RealToString", gMethods, NELEM(gMethods));
+void register_java_lang_RealToString(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/lang/RealToString", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_lang_StrictMath.cpp
@@ -145,6 +145,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(StrictMath, tanh, "!(D)D"),
};
-int register_java_lang_StrictMath(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/lang/StrictMath", gMethods, NELEM(gMethods));
+void register_java_lang_StrictMath(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/lang/StrictMath", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_lang_StringToReal.cpp
@@ -1008,6 +1008,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(StringToReal, parseFltImpl, "(Ljava/lang/String;I)F"),
NATIVE_METHOD(StringToReal, parseDblImpl, "(Ljava/lang/String;I)D"),
};
-int register_java_lang_StringToReal(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/lang/StringToReal", gMethods, NELEM(gMethods));
+void register_java_lang_StringToReal(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/lang/StringToReal", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_lang_System.cpp
@@ -88,6 +88,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(System, setFieldImpl, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V"),
NATIVE_METHOD(System, specialProperties, "()[Ljava/lang/String;"),
};
-int register_java_lang_System(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/lang/System", gMethods, NELEM(gMethods));
+void register_java_lang_System(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/lang/System", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_math_NativeBN.cpp
@@ -553,6 +553,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeBN, sign, "(I)I"),
NATIVE_METHOD(NativeBN, twosComp2bn, "([BII)Z"),
};
-int register_java_math_NativeBN(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/math/NativeBN", gMethods, NELEM(gMethods));
+void register_java_math_NativeBN(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/math/NativeBN", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_nio_ByteOrder.cpp
@@ -27,6 +27,6 @@ static jboolean ByteOrder_isLittleEndian(JNIEnv*, jclass) {
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ByteOrder, isLittleEndian, "!()Z"),
};
-int register_java_nio_ByteOrder(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/nio/ByteOrder", gMethods, NELEM(gMethods));
+void register_java_nio_ByteOrder(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/nio/ByteOrder", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_nio_charset_Charsets.cpp
@@ -245,6 +245,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Charsets, toIsoLatin1Bytes, "([CII)[B"),
NATIVE_METHOD(Charsets, toUtf8Bytes, "([CII)[B"),
};
-int register_java_nio_charset_Charsets(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/nio/charset/Charsets", gMethods, NELEM(gMethods));
+void register_java_nio_charset_Charsets(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/nio/charset/Charsets", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_text_Bidi.cpp
@@ -187,6 +187,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Bidi, ubidi_setLine, "(JII)J"),
NATIVE_METHOD(Bidi, ubidi_setPara, "(J[CII[B)V"),
};
-int register_java_text_Bidi(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/text/Bidi", gMethods, NELEM(gMethods));
+void register_java_text_Bidi(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/text/Bidi", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_util_regex_Matcher.cpp
@@ -211,6 +211,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Matcher, useAnchoringBoundsImpl, "(IZ)V"),
NATIVE_METHOD(Matcher, useTransparentBoundsImpl, "(IZ)V"),
};
-int register_java_util_regex_Matcher(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/util/regex/Matcher", gMethods, NELEM(gMethods));
+void register_java_util_regex_Matcher(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/util/regex/Matcher", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_util_regex_Pattern.cpp
@@ -95,6 +95,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Pattern, closeImpl, "(I)V"),
NATIVE_METHOD(Pattern, compileImpl, "(Ljava/lang/String;I)I"),
};
-int register_java_util_regex_Pattern(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/util/regex/Pattern", gMethods, NELEM(gMethods));
+void register_java_util_regex_Pattern(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/util/regex/Pattern", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_util_zip_Adler32.cpp
@@ -40,6 +40,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Adler32, updateImpl, "([BIIJ)J"),
NATIVE_METHOD(Adler32, updateByteImpl, "(IJ)J"),
};
-int register_java_util_zip_Adler32(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/util/zip/Adler32", gMethods, NELEM(gMethods));
+void register_java_util_zip_Adler32(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/util/zip/Adler32", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_util_zip_CRC32.cpp
@@ -40,6 +40,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(CRC32, updateImpl, "([BIIJ)J"),
NATIVE_METHOD(CRC32, updateByteImpl, "(BJ)J"),
};
-int register_java_util_zip_CRC32(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/util/zip/CRC32", gMethods, NELEM(gMethods));
+void register_java_util_zip_CRC32(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/util/zip/CRC32", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_util_zip_Deflater.cpp
@@ -146,6 +146,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Deflater, setInputImpl, "([BIIJ)V"),
NATIVE_METHOD(Deflater, setLevelsImpl, "(IIJ)V"),
};
-int register_java_util_zip_Deflater(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/util/zip/Deflater", gMethods, NELEM(gMethods));
+void register_java_util_zip_Deflater(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/util/zip/Deflater", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/java_util_zip_Inflater.cpp
@@ -168,6 +168,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Inflater, setFileInputImpl, "(Ljava/io/FileDescriptor;JIJ)I"),
NATIVE_METHOD(Inflater, setInputImpl, "([BIIJ)V"),
};
-int register_java_util_zip_Inflater(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "java/util/zip/Inflater", gMethods, NELEM(gMethods));
+void register_java_util_zip_Inflater(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/util/zip/Inflater", gMethods, NELEM(gMethods));
}
View
8 luni/src/main/native/libcore_icu_ICU.cpp
@@ -577,7 +577,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ICU, toLowerCase, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(ICU, toUpperCase, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"),
};
-int register_libcore_icu_ICU(JNIEnv* env) {
+void register_libcore_icu_ICU(JNIEnv* env) {
std::string path;
path = u_getDataDirectory();
path += "/";
@@ -586,11 +586,11 @@ int register_libcore_icu_ICU(JNIEnv* env) {
#define FAIL_WITH_STRERROR(s) \
ALOGE("Couldn't " s " '%s': %s", path.c_str(), strerror(errno)); \
- return -1;
+ abort();
#define MAYBE_FAIL_WITH_ICU_ERROR(s) \
if (status != U_ZERO_ERROR) {\
ALOGE("Couldn't initialize ICU (" s "): %s (%s)", u_errorName(status), path.c_str()); \
- return -1; \
+ abort(); \
}
// Open the file and get its length.
@@ -627,5 +627,5 @@ int register_libcore_icu_ICU(JNIEnv* env) {
// and bail.
u_init(&status);
MAYBE_FAIL_WITH_ICU_ERROR("u_init");
- return jniRegisterNativeMethods(env, "libcore/icu/ICU", gMethods, NELEM(gMethods));
+ jniRegisterNativeMethods(env, "libcore/icu/ICU", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_icu_NativeBreakIterator.cpp
@@ -220,6 +220,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeBreakIterator, previousImpl, "(I)I"),
NATIVE_METHOD(NativeBreakIterator, setTextImpl, "(ILjava/lang/String;)V"),
};
-int register_libcore_icu_NativeBreakIterator(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/icu/NativeBreakIterator", gMethods, NELEM(gMethods));
+void register_libcore_icu_NativeBreakIterator(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/icu/NativeBreakIterator", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_icu_NativeCollation.cpp
@@ -194,6 +194,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeCollation, setOffset, "(II)V"),
NATIVE_METHOD(NativeCollation, setText, "(ILjava/lang/String;)V"),
};
-int register_libcore_icu_NativeCollation(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/icu/NativeCollation", gMethods, NELEM(gMethods));
+void register_libcore_icu_NativeCollation(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/icu/NativeCollation", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_icu_NativeConverter.cpp
@@ -608,6 +608,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeConverter, setCallbackDecode, "(JIILjava/lang/String;)I"),
NATIVE_METHOD(NativeConverter, setCallbackEncode, "(JII[B)I"),
};
-int register_libcore_icu_NativeConverter(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/icu/NativeConverter", gMethods, NELEM(gMethods));
+void register_libcore_icu_NativeConverter(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/icu/NativeConverter", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp
@@ -366,6 +366,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeDecimalFormat, setTextAttribute, "(IILjava/lang/String;)V"),
NATIVE_METHOD(NativeDecimalFormat, toPatternImpl, "(IZ)Ljava/lang/String;"),
};
-int register_libcore_icu_NativeDecimalFormat(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/icu/NativeDecimalFormat", gMethods, NELEM(gMethods));
+void register_libcore_icu_NativeDecimalFormat(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/icu/NativeDecimalFormat", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_icu_NativeIDN.cpp
@@ -62,6 +62,6 @@ static jstring NativeIDN_convertImpl(JNIEnv* env, jclass, jstring javaSrc, jint
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeIDN, convertImpl, "(Ljava/lang/String;IZ)Ljava/lang/String;"),
};
-int register_libcore_icu_NativeIDN(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/icu/NativeIDN", gMethods, NELEM(gMethods));
+void register_libcore_icu_NativeIDN(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/icu/NativeIDN", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_icu_NativeNormalizer.cpp
@@ -45,6 +45,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeNormalizer, normalizeImpl, "(Ljava/lang/String;I)Ljava/lang/String;"),
NATIVE_METHOD(NativeNormalizer, isNormalizedImpl, "(Ljava/lang/String;I)Z"),
};
-int register_libcore_icu_NativeNormalizer(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/icu/NativeNormalizer", gMethods, NELEM(gMethods));
+void register_libcore_icu_NativeNormalizer(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/icu/NativeNormalizer", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_icu_NativePluralRules.cpp
@@ -60,6 +60,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativePluralRules, forLocaleImpl, "(Ljava/lang/String;)I"),
NATIVE_METHOD(NativePluralRules, quantityForIntImpl, "(II)I"),
};
-int register_libcore_icu_NativePluralRules(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/icu/NativePluralRules", gMethods, NELEM(gMethods));
+void register_libcore_icu_NativePluralRules(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/icu/NativePluralRules", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_icu_TimeZones.cpp
@@ -226,6 +226,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(TimeZones, forCountryCode, "(Ljava/lang/String;)[Ljava/lang/String;"),
NATIVE_METHOD(TimeZones, getZoneStringsImpl, "(Ljava/lang/String;[Ljava/lang/String;)[[Ljava/lang/String;"),
};
-int register_libcore_icu_TimeZones(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/icu/TimeZones", gMethods, NELEM(gMethods));
+void register_libcore_icu_TimeZones(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/icu/TimeZones", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
@@ -30,7 +30,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(AsynchronousCloseMonitor, signalBlockedThreads, "(Ljava/io/FileDescriptor;)V"),
};
-int register_libcore_io_AsynchronousCloseMonitor(JNIEnv* env) {
+void register_libcore_io_AsynchronousCloseMonitor(JNIEnv* env) {
AsynchronousSocketCloseMonitor::init();
- return jniRegisterNativeMethods(env, "libcore/io/AsynchronousCloseMonitor", gMethods, NELEM(gMethods));
+ jniRegisterNativeMethods(env, "libcore/io/AsynchronousCloseMonitor", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_io_Memory.cpp
@@ -351,6 +351,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Memory, unsafeBulkGet, "(Ljava/lang/Object;II[BIIZ)V"),
NATIVE_METHOD(Memory, unsafeBulkPut, "([BIILjava/lang/Object;IIZ)V"),
};
-int register_libcore_io_Memory(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/io/Memory", gMethods, NELEM(gMethods));
+void register_libcore_io_Memory(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/io/Memory", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_io_OsConstants.cpp
@@ -445,6 +445,6 @@ static void OsConstants_initConstants(JNIEnv* env, jclass c) {
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(OsConstants, initConstants, "()V"),
};
-int register_libcore_io_OsConstants(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/io/OsConstants", gMethods, NELEM(gMethods));
+void register_libcore_io_OsConstants(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/io/OsConstants", gMethods, NELEM(gMethods));
}
View
4 luni/src/main/native/libcore_io_Posix.cpp
@@ -1318,6 +1318,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Posix, writeBytes, "(Ljava/io/FileDescriptor;Ljava/lang/Object;II)I"),
NATIVE_METHOD(Posix, writev, "(Ljava/io/FileDescriptor;[Ljava/lang/Object;[I[I)I"),
};
-int register_libcore_io_Posix(JNIEnv* env) {
- return jniRegisterNativeMethods(env, "libcore/io/Posix", gMethods, NELEM(gMethods));
+void register_libcore_io_Posix(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/io/Posix", gMethods, NELEM(gMethods));
}
View
14 luni/src/main/native/libcore_net_RawSocket.cpp
@@ -204,15 +204,11 @@ static jint RawSocket_recvPacket(JNIEnv* env, jclass, jobject fileDescriptor,
}
static JNINativeMethod gRawMethods[] = {
- NATIVE_METHOD(RawSocket, create,
- "(Ljava/io/FileDescriptor;SLjava/lang/String;)V"),
- NATIVE_METHOD(RawSocket, sendPacket,
- "(Ljava/io/FileDescriptor;Ljava/lang/String;S[B[BII)I"),
- NATIVE_METHOD(RawSocket, recvPacket,
- "(Ljava/io/FileDescriptor;[BIIII)I"),
+ NATIVE_METHOD(RawSocket, create, "(Ljava/io/FileDescriptor;SLjava/lang/String;)V"),
+ NATIVE_METHOD(RawSocket, sendPacket, "(Ljava/io/FileDescriptor;Ljava/lang/String;S[B[BII)I"),
+ NATIVE_METHOD(RawSocket, recvPacket, "(Ljava/io/FileDescriptor;[BIIII)I"),
};
-int register_libcore_net_RawSocket(JNIEnv* env) {
- return jniRegisterNativeMethods(env,
- "libcore/net/RawSocket", gRawMethods, NELEM(gRawMethods));
+void register_libcore_net_RawSocket(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "libcore/net/RawSocket", gRawMethods, NELEM(gRawMethods));
}
View
37 luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -27,7 +27,7 @@
#include "UniquePtr.h"
#include "jni.h"
#include "cutils/log.h"
-#include "cutils/jstring.h" // for strcpylen8to16
+#include "unicode/unistr.h"
#include <string.h>
#include <expat.h>
@@ -410,26 +410,23 @@ static void jniThrowExpatException(JNIEnv* env, XML_Error error) {
* Copies UTF-8 characters into the buffer. Returns the number of Java chars
* which were buffered.
*
- * @param characters to copy into the buffer
- * @param length of characters to copy (in bytes)
* @returns number of UTF-16 characters which were copied
*/
-static size_t fillBuffer(ParsingContext* parsingContext, const char* characters, int length) {
+static size_t fillBuffer(ParsingContext* parsingContext, const char* utf8, int byteCount) {
JNIEnv* env = parsingContext->env;
- // Grow buffer if necessary.
- jcharArray buffer = parsingContext->ensureCapacity(length);
- if (buffer == NULL) return -1;
+ // Grow buffer if necessary (the length in bytes is always >= the length in chars).
+ jcharArray javaChars = parsingContext->ensureCapacity(byteCount);
+ if (javaChars == NULL) return -1;
- // Decode UTF-8 characters into our buffer.
- ScopedCharArrayRW nativeBuffer(env, buffer);
- if (nativeBuffer.get() == NULL) {
+ // Decode UTF-8 characters into our char[].
+ ScopedCharArrayRW chars(env, javaChars);
+ if (chars.get() == NULL) {
return -1;
}
-
- size_t utf16length;
- strcpylen8to16(nativeBuffer.get(), characters, length, &utf16length);
- return utf16length;
+ UErrorCode status = U_ZERO_ERROR;
+ UnicodeString utf16(UnicodeString::fromUTF8(StringPiece(utf8, byteCount)));
+ return utf16.extract(chars.get(), byteCount, status);
}
/**
@@ -1395,13 +1392,7 @@ static JNINativeMethod attributeMethods[] = {
NATIVE_METHOD(ExpatAttributes, getValueForQName, "(ILjava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(ExpatAttributes, getValue, "(ILjava/lang/String;Ljava/lang/String;)Ljava/lang/String;"),
};
-int register_org_apache_harmony_xml_ExpatParser(JNIEnv* env) {
- int result = jniRegisterNativeMethods(env, "org/apache/harmony/xml/ExpatParser",
- parserMethods, NELEM(parserMethods));
- if (result != 0) {
- return result;
- }
-
- return jniRegisterNativeMethods(env, "org/apache/harmony/xml/ExpatAttributes",
- attributeMethods, NELEM(attributeMethods));
+void register_org_apache_harmony_xml_ExpatParser(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "org/apache/harmony/xml/ExpatParser", parserMethods, NELEM(parserMethods));
+ jniRegisterNativeMethods(env, "org/apache/harmony/xml/ExpatAttributes", attributeMethods, NELEM(attributeMethods));
}
View
7 luni/src/main/native/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp
@@ -4311,11 +4311,8 @@ static JNINativeMethod sNativeCryptoMethods[] = {
NATIVE_METHOD(NativeCrypto, SSL_get_npn_negotiated_protocol, "(I)[B"),
};
-int register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(JNIEnv* env) {
+void register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(JNIEnv* env) {
JNI_TRACE("register_org_apache_harmony_xnet_provider_jsse_NativeCrypto");
// Register org.apache.harmony.xnet.provider.jsse.NativeCrypto methods
- return jniRegisterNativeMethods(env,
- "org/apache/harmony/xnet/provider/jsse/NativeCrypto",
- sNativeCryptoMethods,
- NELEM(sNativeCryptoMethods));
+ jniRegisterNativeMethods(env, "org/apache/harmony/xnet/provider/jsse/NativeCrypto", sNativeCryptoMethods, NELEM(sNativeCryptoMethods));
}
View
14 luni/src/main/native/sub.mk
@@ -58,19 +58,9 @@ LOCAL_C_INCLUDES += \
external/openssl/include \
external/zlib
-# Any shared/static libs that are listed here must also
-# be listed in libs/nativehelper/Android.mk.
-# TODO: fix this requirement
-
LOCAL_SHARED_LIBRARIES += \
- libcrypto \
- libcutils \
- libexpat \
- libicuuc \
- libicui18n \
- libssl \
- libutils \
- libz
+ liblog \
+ libnativehelper
LOCAL_STATIC_LIBRARIES += \
libfdlibm
Please sign in to comment.
Something went wrong with that request. Please try again.