diff options
-rw-r--r-- | V8Binding/jni/jni_instance.h | 2 | ||||
-rw-r--r-- | WebCore/Android.v8bindings.mk | 4 | ||||
-rw-r--r-- | WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp (renamed from WebCore/bridge/jni/v8/jni_utility_private.cpp) | 54 | ||||
-rw-r--r-- | WebCore/bridge/jni/v8/JNIUtilityPrivate.h (renamed from WebCore/bridge/jni/v8/jni_utility_private.h) | 6 |
4 files changed, 32 insertions, 34 deletions
diff --git a/V8Binding/jni/jni_instance.h b/V8Binding/jni/jni_instance.h index 28a4607..f6c639d 100644 --- a/V8Binding/jni/jni_instance.h +++ b/V8Binding/jni/jni_instance.h @@ -27,7 +27,7 @@ #ifndef _JNI_INSTANCE_H_ #define _JNI_INSTANCE_H_ -#include "jni_utility_private.h" +#include "JNIUtilityPrivate.h" #include <JavaVM/jni.h> #include <wtf/RefCounted.h> diff --git a/WebCore/Android.v8bindings.mk b/WebCore/Android.v8bindings.mk index 88b28c9..b9594a4 100644 --- a/WebCore/Android.v8bindings.mk +++ b/WebCore/Android.v8bindings.mk @@ -172,5 +172,5 @@ LOCAL_SRC_FILES += \ LOCAL_SRC_FILES += \ bridge/jni/JNIUtility.cpp \ - bridge/jni/v8/JavaClassV8.cpp \ - bridge/jni/v8/jni_utility_private.cpp + bridge/jni/v8/JNIUtilityPrivate.cpp \ + bridge/jni/v8/JavaClassV8.cpp diff --git a/WebCore/bridge/jni/v8/jni_utility_private.cpp b/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp index 2f89047..1d2a029 100644 --- a/WebCore/bridge/jni/v8/jni_utility_private.cpp +++ b/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp @@ -24,10 +24,10 @@ */ #include "config.h" -#include "jni_utility_private.h" +#include "JNIUtilityPrivate.h" -#include "jni_runtime.h" #include "jni_npobject.h" +#include "jni_runtime.h" namespace JSC { @@ -42,7 +42,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case array_type: case object_type: { - result.l = (jobject)0; + result.l = static_cast<jobject>(0); // First see if we have a Java instance. if (type == NPVariantType_Object) { @@ -53,12 +53,12 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja // Now convert value to a string if the target type is a java.lang.string, and we're not // converting from a Null. - if (result.l == 0 && strcmp(javaClassName, "java.lang.String") == 0) { + if (!result.l && !strcmp(javaClassName, "java.lang.String")) { #ifdef CONVERT_NULL_TO_EMPTY_STRING if (type == NPVariantType_Null) { - JNIEnv *env = getJNIEnv(); + JNIEnv* env = getJNIEnv(); jchar buf[2]; - jobject javaString = env->functions->NewString (env, buf, 0); + jobject javaString = env->functions->NewString(env, buf, 0); result.l = javaString; } else #else @@ -66,12 +66,12 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja #endif { NPString src = NPVARIANT_TO_STRING(value); - JNIEnv *env = getJNIEnv(); + JNIEnv* env = getJNIEnv(); jobject javaString = env->NewStringUTF(src.UTF8Characters); result.l = javaString; } - } else if (result.l == 0) - bzero (&result, sizeof(jvalue)); // Handle it the same as a void case + } else if (!result.l) + bzero(&result, sizeof(jvalue)); // Handle it the same as a void case } break; @@ -80,14 +80,14 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja if (type == NPVariantType_Bool) result.z = NPVARIANT_TO_BOOLEAN(value); else - bzero(&result, sizeof(jvalue)); // as void case + bzero(&result, sizeof(jvalue)); // as void case } break; case byte_type: { if (type == NPVariantType_Int32) - result.b = (char)NPVARIANT_TO_INT32(value); + result.b = static_cast<char>(NPVARIANT_TO_INT32(value)); else bzero(&result, sizeof(jvalue)); } @@ -96,7 +96,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case char_type: { if (type == NPVariantType_Int32) - result.c = (char)NPVARIANT_TO_INT32(value); + result.c = static_cast<char>(NPVARIANT_TO_INT32(value)); else bzero(&result, sizeof(jvalue)); } @@ -105,7 +105,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case short_type: { if (type == NPVariantType_Int32) - result.s = (jshort)NPVARIANT_TO_INT32(value); + result.s = static_cast<jshort>(NPVARIANT_TO_INT32(value)); else bzero(&result, sizeof(jvalue)); } @@ -114,7 +114,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case int_type: { if (type == NPVariantType_Int32) - result.i = (jint)NPVARIANT_TO_INT32(value); + result.i = static_cast<jint>(NPVARIANT_TO_INT32(value)); else bzero(&result, sizeof(jvalue)); } @@ -123,9 +123,9 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case long_type: { if (type == NPVariantType_Int32) - result.j = (jlong)NPVARIANT_TO_INT32(value); + result.j = static_cast<jlong>(NPVARIANT_TO_INT32(value)); else if (type == NPVariantType_Double) - result.j = (jlong)NPVARIANT_TO_DOUBLE(value); + result.j = static_cast<jlong>(NPVARIANT_TO_DOUBLE(value)); else bzero(&result, sizeof(jvalue)); } @@ -134,9 +134,9 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case float_type: { if (type == NPVariantType_Int32) - result.j = (jfloat)NPVARIANT_TO_INT32(value); + result.j = static_cast<jfloat>(NPVARIANT_TO_INT32(value)); else if (type == NPVariantType_Double) - result.j = (jfloat)NPVARIANT_TO_DOUBLE(value); + result.j = static_cast<jfloat>(NPVARIANT_TO_DOUBLE(value)); else bzero(&result, sizeof(jvalue)); } @@ -145,9 +145,9 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case double_type: { if (type == NPVariantType_Int32) - result.j = (jdouble)NPVARIANT_TO_INT32(value); + result.j = static_cast<jdouble>(NPVARIANT_TO_INT32(value)); else if (type == NPVariantType_Double) - result.j = (jdouble)NPVARIANT_TO_DOUBLE(value); + result.j = static_cast<jdouble>(NPVARIANT_TO_DOUBLE(value)); else bzero(&result, sizeof(jvalue)); } @@ -178,20 +178,18 @@ void convertJValueToNPVariant(jvalue value, JNIType jniType, const char* javaTyp case object_type: { - if (value.l != 0) { - if (strcmp(javaTypeName, "java.lang.String") == 0) { - const char* v = getCharactersFromJString((jstring)value.l); + if (value.l) { + if (!strcmp(javaTypeName, "java.lang.String")) { + const char* v = getCharactersFromJString(static_cast<jstring>(value.l)); // s is freed in NPN_ReleaseVariantValue (see npruntime.cpp) const char* s = strdup(v); - releaseCharactersForJString((jstring)value.l, v); + releaseCharactersForJString(static_cast<jstring>(value.l), v); STRINGZ_TO_NPVARIANT(s, *result); - } else { + } else OBJECT_TO_NPVARIANT(JavaInstanceToNPObject(new JavaInstance(value.l)), *result); - } } - else { + else VOID_TO_NPVARIANT(*result); - } } break; diff --git a/WebCore/bridge/jni/v8/jni_utility_private.h b/WebCore/bridge/jni/v8/JNIUtilityPrivate.h index 344e63c..f20cfb2 100644 --- a/WebCore/bridge/jni/v8/jni_utility_private.h +++ b/WebCore/bridge/jni/v8/JNIUtilityPrivate.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _JNI_UTILITY_PRIVATE_H_ -#define _JNI_UTILITY_PRIVATE_H_ +#ifndef JNIUtilityPrivate_h +#define JNIUtilityPrivate_h #include "JNIUtility.h" #include "npruntime.h" @@ -40,4 +40,4 @@ void convertJValueToNPVariant(jvalue, JNIType, const char* javaClassName, NPVari } // namespace JSC -#endif // _JNI_UTILITY_H_ +#endif // JNIUtilityPrivate_h |