From e72218e36405a28fa142afc38ef1fff50797cc45 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Fri, 26 Mar 2010 11:15:43 +0000 Subject: Cherry pick from master. Cherry-picks WebKit change 56105 to eliminate use of bzero in WebKit common code Note that manual changes were required to JNIUtilityPrivate.cpp as this file has changed upstreamed, but the merge will be trivial. See http://trac.webkit.org/changeset/56105 Bug: 2535696 Change-Id: I464a4aa78b1625961724b6001caba1c315ed9f91 --- WebCore/bridge/jni/JNIUtility.cpp | 2 +- WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp | 2 +- WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp | 6 ++++-- WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp | 20 ++++++++++---------- WebCore/bridge/jni/v8/JavaNPObjectV8.cpp | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) (limited to 'WebCore') diff --git a/WebCore/bridge/jni/JNIUtility.cpp b/WebCore/bridge/jni/JNIUtility.cpp index ee45710..e558955 100644 --- a/WebCore/bridge/jni/JNIUtility.cpp +++ b/WebCore/bridge/jni/JNIUtility.cpp @@ -283,7 +283,7 @@ jvalue getJNIField(jobject obj, JNIType type, const char* name, const char* sign JNIEnv* env = getJNIEnv(); jvalue result; - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); if (obj && jvm && env) { jclass cls = env->GetObjectClass(obj); if (cls) { diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp index 4e1b0d2..8776cd2 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp @@ -83,7 +83,7 @@ jvalue JavaField::dispatchValueFromInstance(ExecState* exec, const JavaInstance* JNIEnv* env = getJNIEnv(); jvalue result; - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); jclass cls = env->GetObjectClass(fieldJInstance); if (cls) { jmethodID mid = env->GetMethodID(cls, name, sig); diff --git a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp index e238ab8..8ce150f 100644 --- a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp +++ b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp @@ -219,7 +219,8 @@ jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType jniType, con result.l = javaString; } } else if (!result.l) - bzero(&result, sizeof(jvalue)); // Handle it the same as a void case + // ANDROID + memset(&result, 0, sizeof(jvalue)); // Handle it the same as a void case } break; @@ -277,7 +278,8 @@ jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType jniType, con default: case void_type: { - bzero(&result, sizeof(jvalue)); + // ANDROID + memset(&result, 0, sizeof(jvalue)); } break; } diff --git a/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp b/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp index 9352983..1bdae53 100644 --- a/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp +++ b/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp @@ -71,7 +71,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja result.l = javaString; } } else if (!result.l) - bzero(&result, sizeof(jvalue)); // Handle it the same as a void case + memset(&result, 0, sizeof(jvalue)); // Handle it the same as a void case } break; @@ -80,7 +80,7 @@ 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 + memset(&result, 0, sizeof(jvalue)); // as void case } break; @@ -89,7 +89,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja if (type == NPVariantType_Int32) result.b = static_cast(NPVARIANT_TO_INT32(value)); else - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); } break; @@ -98,7 +98,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja if (type == NPVariantType_Int32) result.c = static_cast(NPVARIANT_TO_INT32(value)); else - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); } break; @@ -107,7 +107,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja if (type == NPVariantType_Int32) result.s = static_cast(NPVARIANT_TO_INT32(value)); else - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); } break; @@ -116,7 +116,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja if (type == NPVariantType_Int32) result.i = static_cast(NPVARIANT_TO_INT32(value)); else - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); } break; @@ -127,7 +127,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja else if (type == NPVariantType_Double) result.j = static_cast(NPVARIANT_TO_DOUBLE(value)); else - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); } break; @@ -138,7 +138,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja else if (type == NPVariantType_Double) result.f = static_cast(NPVARIANT_TO_DOUBLE(value)); else - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); } break; @@ -149,7 +149,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja else if (type == NPVariantType_Double) result.d = static_cast(NPVARIANT_TO_DOUBLE(value)); else - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); } break; @@ -159,7 +159,7 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja default: case void_type: { - bzero(&result, sizeof(jvalue)); + memset(&result, 0, sizeof(jvalue)); } break; } diff --git a/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp b/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp index 9c39c25..54cb8d6 100644 --- a/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp +++ b/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp @@ -41,7 +41,7 @@ static NPObject* AllocJavaNPObject(NPP, NPClass*) JavaNPObject* obj = static_cast(malloc(sizeof(JavaNPObject))); if (!obj) return 0; - bzero(obj, sizeof(JavaNPObject)); + memset(obj, 0, sizeof(JavaNPObject)); return reinterpret_cast(obj); } -- cgit v1.1