Skip to content

Commit

Permalink
Make libjavacore independent of libnativehelper for the PDK.
Browse files Browse the repository at this point in the history
Bug: 6369821
Change-Id: Ie038571a5dac1f301c0c3c6fb84df432e67b62c0
  • Loading branch information
enh-google committed May 4, 2012
1 parent 88f3ec9 commit 7cd6760
Show file tree
Hide file tree
Showing 40 changed files with 147 additions and 206 deletions.
1 change: 1 addition & 0 deletions Android.mk
Expand Up @@ -58,6 +58,7 @@ ifeq ($(WITH_HOST_DALVIK),true)
dalvik \ dalvik \
$(HOST_OUT)/bin/dalvikvm \ $(HOST_OUT)/bin/dalvikvm \
$(HOST_OUT)/bin/dexopt \ $(HOST_OUT)/bin/dexopt \
$(HOST_OUT)/lib/libjavacore.so \
cacerts-host \ cacerts-host \
$(HOST_OUT)/usr/share/zoneinfo/zoneinfo.dat \ $(HOST_OUT)/usr/share/zoneinfo/zoneinfo.dat \
$(HOST_OUT)/usr/share/zoneinfo/zoneinfo.idx \ $(HOST_OUT)/usr/share/zoneinfo/zoneinfo.idx \
Expand Down
13 changes: 8 additions & 5 deletions NativeCode.mk
Expand Up @@ -87,15 +87,15 @@ endif
# Define the rules. # Define the rules.
LOCAL_SRC_FILES := $(core_src_files) LOCAL_SRC_FILES := $(core_src_files)
LOCAL_C_INCLUDES := $(core_c_includes) 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_STATIC_LIBRARIES := $(core_static_libraries)
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libjavacore LOCAL_MODULE := libjavacore


LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
LOCAL_SHARED_LIBRARIES += libstlport LOCAL_SHARED_LIBRARIES += libstlport


include $(BUILD_STATIC_LIBRARY) include $(BUILD_SHARED_LIBRARY)


# #
# Build for the host. # Build for the host.
Expand All @@ -106,9 +106,12 @@ ifeq ($(WITH_HOST_DALVIK),true)
# Define the rules. # Define the rules.
LOCAL_SRC_FILES := $(core_src_files) LOCAL_SRC_FILES := $(core_src_files)
LOCAL_CFLAGS += $(core_cflags) LOCAL_CFLAGS += $(core_cflags)
LOCAL_CPPFLAGS += $(core_cppflags)
LOCAL_C_INCLUDES := $(core_c_includes) LOCAL_C_INCLUDES := $(core_c_includes)
LOCAL_CPPFLAGS += $(core_cppflags)
LOCAL_LDLIBS += -ldl -lpthread
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libjavacore-host LOCAL_MODULE := libjavacore
include $(BUILD_HOST_STATIC_LIBRARY) 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 endif
131 changes: 47 additions & 84 deletions luni/src/main/native/Register.cpp
Expand Up @@ -21,93 +21,56 @@


#include <stdlib.h> #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. // 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); ScopedLocalFrame localFrame(env);


JniConstants::init(env); JniConstants::init(env);


bool result = #define REGISTER(FN) extern void FN(JNIEnv*); FN(env)
register_java_io_Console(env) != -1 && REGISTER(register_java_io_Console);
register_java_io_File(env) != -1 && REGISTER(register_java_io_File);
register_java_io_ObjectStreamClass(env) != -1 && REGISTER(register_java_io_ObjectStreamClass);
register_java_lang_Character(env) != -1 && REGISTER(register_java_lang_Character);
register_java_lang_Math(env) != -1 && REGISTER(register_java_lang_Math);
register_java_lang_ProcessManager(env) != -1 && REGISTER(register_java_lang_ProcessManager);
register_java_lang_RealToString(env) != -1 && REGISTER(register_java_lang_RealToString);
register_java_lang_StrictMath(env) != -1 && REGISTER(register_java_lang_StrictMath);
register_java_lang_StringToReal(env) != -1 && REGISTER(register_java_lang_StringToReal);
register_java_lang_System(env) != -1 && REGISTER(register_java_lang_System);
register_java_math_NativeBN(env) != -1 && REGISTER(register_java_math_NativeBN);
register_java_nio_ByteOrder(env) != -1 && REGISTER(register_java_nio_ByteOrder);
register_java_nio_charset_Charsets(env) != -1 && REGISTER(register_java_nio_charset_Charsets);
register_java_text_Bidi(env) != -1 && REGISTER(register_java_text_Bidi);
register_java_util_regex_Matcher(env) != -1 && REGISTER(register_java_util_regex_Matcher);
register_java_util_regex_Pattern(env) != -1 && REGISTER(register_java_util_regex_Pattern);
register_java_util_zip_Adler32(env) != -1 && REGISTER(register_java_util_zip_Adler32);
register_java_util_zip_CRC32(env) != -1 && REGISTER(register_java_util_zip_CRC32);
register_java_util_zip_Deflater(env) != -1 && REGISTER(register_java_util_zip_Deflater);
register_java_util_zip_Inflater(env) != -1 && REGISTER(register_java_util_zip_Inflater);
register_libcore_icu_ICU(env) != -1 && REGISTER(register_libcore_icu_ICU);
register_libcore_icu_NativeBreakIterator(env) != -1 && REGISTER(register_libcore_icu_NativeBreakIterator);
register_libcore_icu_NativeCollation(env) != -1 && REGISTER(register_libcore_icu_NativeCollation);
register_libcore_icu_NativeConverter(env) != -1 && REGISTER(register_libcore_icu_NativeConverter);
register_libcore_icu_NativeDecimalFormat(env) != -1 && REGISTER(register_libcore_icu_NativeDecimalFormat);
register_libcore_icu_NativeIDN(env) != -1 && REGISTER(register_libcore_icu_NativeIDN);
register_libcore_icu_NativeNormalizer(env) != -1 && REGISTER(register_libcore_icu_NativeNormalizer);
register_libcore_icu_NativePluralRules(env) != -1 && REGISTER(register_libcore_icu_NativePluralRules);
register_libcore_icu_TimeZones(env) != -1 && REGISTER(register_libcore_icu_TimeZones);
register_libcore_io_AsynchronousCloseMonitor(env) != -1 && REGISTER(register_libcore_io_AsynchronousCloseMonitor);
register_libcore_io_Memory(env) != -1 && REGISTER(register_libcore_io_Memory);
register_libcore_io_OsConstants(env) != -1 && REGISTER(register_libcore_io_OsConstants);
register_libcore_io_Posix(env) != -1 && REGISTER(register_libcore_io_Posix);
register_libcore_net_RawSocket(env) != -1 && REGISTER(register_libcore_net_RawSocket);
register_org_apache_harmony_dalvik_NativeTestTarget(env) != -1 && REGISTER(register_org_apache_harmony_dalvik_NativeTestTarget);
register_org_apache_harmony_xml_ExpatParser(env) != -1 && REGISTER(register_org_apache_harmony_xml_ExpatParser);
register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(env) != -1 && REGISTER(register_org_apache_harmony_xnet_provider_jsse_NativeCrypto);
true; #undef REGISTER

return JNI_VERSION_1_6;
if (!result) {
ALOGE("Failed to initialize the core libraries; aborting...");
abort();
}
return 0;
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_io_Console.cpp
Expand Up @@ -46,6 +46,6 @@ static jint Console_setEchoImpl(JNIEnv* env, jclass, jboolean on, jint previousS
static JNINativeMethod gMethods[] = { static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Console, setEchoImpl, "(ZI)I"), NATIVE_METHOD(Console, setEchoImpl, "(ZI)I"),
}; };
int register_java_io_Console(JNIEnv* env) { void register_java_io_Console(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/io/Console", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/io/Console", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_io_File.cpp
Expand Up @@ -168,6 +168,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(File, realpath, "(Ljava/lang/String;)Ljava/lang/String;"), NATIVE_METHOD(File, realpath, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(File, setLastModifiedImpl, "(Ljava/lang/String;J)Z"), NATIVE_METHOD(File, setLastModifiedImpl, "(Ljava/lang/String;J)Z"),
}; };
int register_java_io_File(JNIEnv* env) { void register_java_io_File(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/io/File", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/io/File", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_io_ObjectStreamClass.cpp
Expand Up @@ -63,6 +63,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectStreamClass, hasClinit, "(Ljava/lang/Class;)Z"), NATIVE_METHOD(ObjectStreamClass, hasClinit, "(Ljava/lang/Class;)Z"),
NATIVE_METHOD(ObjectStreamClass, newInstance, "(Ljava/lang/Class;I)Ljava/lang/Object;"), NATIVE_METHOD(ObjectStreamClass, newInstance, "(Ljava/lang/Class;I)Ljava/lang/Object;"),
}; };
int register_java_io_ObjectStreamClass(JNIEnv* env) { void register_java_io_ObjectStreamClass(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/io/ObjectStreamClass", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/io/ObjectStreamClass", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_lang_Character.cpp
Expand Up @@ -160,6 +160,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Character, toTitleCaseImpl, "!(I)I"), NATIVE_METHOD(Character, toTitleCaseImpl, "!(I)I"),
NATIVE_METHOD(Character, toUpperCaseImpl, "!(I)I"), NATIVE_METHOD(Character, toUpperCaseImpl, "!(I)I"),
}; };
int register_java_lang_Character(JNIEnv* env) { void register_java_lang_Character(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/lang/Character", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/lang/Character", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_lang_Math.cpp
Expand Up @@ -131,6 +131,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Math, tanh, "!(D)D"), NATIVE_METHOD(Math, tanh, "!(D)D"),
}; };


int register_java_lang_Math(JNIEnv* env) { void register_java_lang_Math(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/lang/Math", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/lang/Math", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_lang_ProcessManager.cpp
Expand Up @@ -265,6 +265,6 @@ static pid_t ProcessManager_exec(JNIEnv* env, jclass, jobjectArray javaCommands,
static JNINativeMethod methods[] = { 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"), 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) { void register_java_lang_ProcessManager(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/lang/ProcessManager", methods, NELEM(methods)); jniRegisterNativeMethods(env, "java/lang/ProcessManager", methods, NELEM(methods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_lang_RealToString.cpp
Expand Up @@ -237,6 +237,6 @@ void RealToString_bigIntDigitGenerator(JNIEnv* env, jobject obj, jlong f, jint e
static JNINativeMethod gMethods[] = { static JNINativeMethod gMethods[] = {
NATIVE_METHOD(RealToString, bigIntDigitGenerator, "(JIZI)V"), NATIVE_METHOD(RealToString, bigIntDigitGenerator, "(JIZI)V"),
}; };
int register_java_lang_RealToString(JNIEnv* env) { void register_java_lang_RealToString(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/lang/RealToString", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/lang/RealToString", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_lang_StrictMath.cpp
Expand Up @@ -145,6 +145,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(StrictMath, tanh, "!(D)D"), NATIVE_METHOD(StrictMath, tanh, "!(D)D"),
}; };


int register_java_lang_StrictMath(JNIEnv* env) { void register_java_lang_StrictMath(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/lang/StrictMath", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/lang/StrictMath", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_lang_StringToReal.cpp
Expand Up @@ -1008,6 +1008,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(StringToReal, parseFltImpl, "(Ljava/lang/String;I)F"), NATIVE_METHOD(StringToReal, parseFltImpl, "(Ljava/lang/String;I)F"),
NATIVE_METHOD(StringToReal, parseDblImpl, "(Ljava/lang/String;I)D"), NATIVE_METHOD(StringToReal, parseDblImpl, "(Ljava/lang/String;I)D"),
}; };
int register_java_lang_StringToReal(JNIEnv* env) { void register_java_lang_StringToReal(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/lang/StringToReal", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/lang/StringToReal", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_lang_System.cpp
Expand Up @@ -88,6 +88,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(System, setFieldImpl, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V"), NATIVE_METHOD(System, setFieldImpl, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V"),
NATIVE_METHOD(System, specialProperties, "()[Ljava/lang/String;"), NATIVE_METHOD(System, specialProperties, "()[Ljava/lang/String;"),
}; };
int register_java_lang_System(JNIEnv* env) { void register_java_lang_System(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/lang/System", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/lang/System", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_math_NativeBN.cpp
Expand Up @@ -553,6 +553,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeBN, sign, "(I)I"), NATIVE_METHOD(NativeBN, sign, "(I)I"),
NATIVE_METHOD(NativeBN, twosComp2bn, "([BII)Z"), NATIVE_METHOD(NativeBN, twosComp2bn, "([BII)Z"),
}; };
int register_java_math_NativeBN(JNIEnv* env) { void register_java_math_NativeBN(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/math/NativeBN", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/math/NativeBN", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_nio_ByteOrder.cpp
Expand Up @@ -27,6 +27,6 @@ static jboolean ByteOrder_isLittleEndian(JNIEnv*, jclass) {
static JNINativeMethod gMethods[] = { static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ByteOrder, isLittleEndian, "!()Z"), NATIVE_METHOD(ByteOrder, isLittleEndian, "!()Z"),
}; };
int register_java_nio_ByteOrder(JNIEnv* env) { void register_java_nio_ByteOrder(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/nio/ByteOrder", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/nio/ByteOrder", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_nio_charset_Charsets.cpp
Expand Up @@ -245,6 +245,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Charsets, toIsoLatin1Bytes, "([CII)[B"), NATIVE_METHOD(Charsets, toIsoLatin1Bytes, "([CII)[B"),
NATIVE_METHOD(Charsets, toUtf8Bytes, "([CII)[B"), NATIVE_METHOD(Charsets, toUtf8Bytes, "([CII)[B"),
}; };
int register_java_nio_charset_Charsets(JNIEnv* env) { void register_java_nio_charset_Charsets(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/nio/charset/Charsets", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/nio/charset/Charsets", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_text_Bidi.cpp
Expand Up @@ -187,6 +187,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Bidi, ubidi_setLine, "(JII)J"), NATIVE_METHOD(Bidi, ubidi_setLine, "(JII)J"),
NATIVE_METHOD(Bidi, ubidi_setPara, "(J[CII[B)V"), NATIVE_METHOD(Bidi, ubidi_setPara, "(J[CII[B)V"),
}; };
int register_java_text_Bidi(JNIEnv* env) { void register_java_text_Bidi(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/text/Bidi", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/text/Bidi", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_util_regex_Matcher.cpp
Expand Up @@ -211,6 +211,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Matcher, useAnchoringBoundsImpl, "(IZ)V"), NATIVE_METHOD(Matcher, useAnchoringBoundsImpl, "(IZ)V"),
NATIVE_METHOD(Matcher, useTransparentBoundsImpl, "(IZ)V"), NATIVE_METHOD(Matcher, useTransparentBoundsImpl, "(IZ)V"),
}; };
int register_java_util_regex_Matcher(JNIEnv* env) { void register_java_util_regex_Matcher(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/util/regex/Matcher", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/util/regex/Matcher", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_util_regex_Pattern.cpp
Expand Up @@ -95,6 +95,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Pattern, closeImpl, "(I)V"), NATIVE_METHOD(Pattern, closeImpl, "(I)V"),
NATIVE_METHOD(Pattern, compileImpl, "(Ljava/lang/String;I)I"), NATIVE_METHOD(Pattern, compileImpl, "(Ljava/lang/String;I)I"),
}; };
int register_java_util_regex_Pattern(JNIEnv* env) { void register_java_util_regex_Pattern(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/util/regex/Pattern", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/util/regex/Pattern", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_util_zip_Adler32.cpp
Expand Up @@ -40,6 +40,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Adler32, updateImpl, "([BIIJ)J"), NATIVE_METHOD(Adler32, updateImpl, "([BIIJ)J"),
NATIVE_METHOD(Adler32, updateByteImpl, "(IJ)J"), NATIVE_METHOD(Adler32, updateByteImpl, "(IJ)J"),
}; };
int register_java_util_zip_Adler32(JNIEnv* env) { void register_java_util_zip_Adler32(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/util/zip/Adler32", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/util/zip/Adler32", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_util_zip_CRC32.cpp
Expand Up @@ -40,6 +40,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(CRC32, updateImpl, "([BIIJ)J"), NATIVE_METHOD(CRC32, updateImpl, "([BIIJ)J"),
NATIVE_METHOD(CRC32, updateByteImpl, "(BJ)J"), NATIVE_METHOD(CRC32, updateByteImpl, "(BJ)J"),
}; };
int register_java_util_zip_CRC32(JNIEnv* env) { void register_java_util_zip_CRC32(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/util/zip/CRC32", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/util/zip/CRC32", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_util_zip_Deflater.cpp
Expand Up @@ -146,6 +146,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Deflater, setInputImpl, "([BIIJ)V"), NATIVE_METHOD(Deflater, setInputImpl, "([BIIJ)V"),
NATIVE_METHOD(Deflater, setLevelsImpl, "(IIJ)V"), NATIVE_METHOD(Deflater, setLevelsImpl, "(IIJ)V"),
}; };
int register_java_util_zip_Deflater(JNIEnv* env) { void register_java_util_zip_Deflater(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/util/zip/Deflater", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/util/zip/Deflater", gMethods, NELEM(gMethods));
} }
4 changes: 2 additions & 2 deletions luni/src/main/native/java_util_zip_Inflater.cpp
Expand Up @@ -168,6 +168,6 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Inflater, setFileInputImpl, "(Ljava/io/FileDescriptor;JIJ)I"), NATIVE_METHOD(Inflater, setFileInputImpl, "(Ljava/io/FileDescriptor;JIJ)I"),
NATIVE_METHOD(Inflater, setInputImpl, "([BIIJ)V"), NATIVE_METHOD(Inflater, setInputImpl, "([BIIJ)V"),
}; };
int register_java_util_zip_Inflater(JNIEnv* env) { void register_java_util_zip_Inflater(JNIEnv* env) {
return jniRegisterNativeMethods(env, "java/util/zip/Inflater", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "java/util/zip/Inflater", gMethods, NELEM(gMethods));
} }
8 changes: 4 additions & 4 deletions luni/src/main/native/libcore_icu_ICU.cpp
Expand Up @@ -577,7 +577,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ICU, toLowerCase, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"), 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;"), 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; std::string path;
path = u_getDataDirectory(); path = u_getDataDirectory();
path += "/"; path += "/";
Expand All @@ -586,11 +586,11 @@ int register_libcore_icu_ICU(JNIEnv* env) {


#define FAIL_WITH_STRERROR(s) \ #define FAIL_WITH_STRERROR(s) \
ALOGE("Couldn't " s " '%s': %s", path.c_str(), strerror(errno)); \ ALOGE("Couldn't " s " '%s': %s", path.c_str(), strerror(errno)); \
return -1; abort();
#define MAYBE_FAIL_WITH_ICU_ERROR(s) \ #define MAYBE_FAIL_WITH_ICU_ERROR(s) \
if (status != U_ZERO_ERROR) {\ if (status != U_ZERO_ERROR) {\
ALOGE("Couldn't initialize ICU (" s "): %s (%s)", u_errorName(status), path.c_str()); \ ALOGE("Couldn't initialize ICU (" s "): %s (%s)", u_errorName(status), path.c_str()); \
return -1; \ abort(); \
} }


// Open the file and get its length. // Open the file and get its length.
Expand Down Expand Up @@ -627,5 +627,5 @@ int register_libcore_icu_ICU(JNIEnv* env) {
// and bail. // and bail.
u_init(&status); u_init(&status);
MAYBE_FAIL_WITH_ICU_ERROR("u_init"); MAYBE_FAIL_WITH_ICU_ERROR("u_init");
return jniRegisterNativeMethods(env, "libcore/icu/ICU", gMethods, NELEM(gMethods)); jniRegisterNativeMethods(env, "libcore/icu/ICU", gMethods, NELEM(gMethods));
} }

0 comments on commit 7cd6760

Please sign in to comment.