OSDN Git Service

Cherry-picks WebKit change 56105 to eliminate use of bzero in WebKit common code
authorSteve Block <steveblock@google.com>
Fri, 26 Mar 2010 11:15:43 +0000 (11:15 +0000)
committerSteve Block <steveblock@google.com>
Fri, 26 Mar 2010 11:17:35 +0000 (11:17 +0000)
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: I08da8279d3af93aba38ecf21731c8a251502abae

WebCore/bridge/jni/JNIUtility.cpp
WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp
WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp
WebCore/bridge/jni/v8/JavaNPObjectV8.cpp

index ee45710..e558955 100644 (file)
@@ -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) {
index 4e1b0d2..8776cd2 100644 (file)
@@ -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);
index e238ab8..8ce150f 100644 (file)
@@ -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;
     }
index 9352983..1bdae53 100644 (file)
@@ -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<char>(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<char>(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<jshort>(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<jint>(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<jlong>(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<jfloat>(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<jdouble>(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;
     }
index 9c39c25..54cb8d6 100644 (file)
@@ -41,7 +41,7 @@ static NPObject* AllocJavaNPObject(NPP, NPClass*)
     JavaNPObject* obj = static_cast<JavaNPObject*>(malloc(sizeof(JavaNPObject)));
     if (!obj)
         return 0;
-    bzero(obj, sizeof(JavaNPObject));
+    memset(obj, 0, sizeof(JavaNPObject));
     return reinterpret_cast<NPObject*>(obj);
 }