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
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 @@
     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 @@
     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 @@
                     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 @@
     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 @@
                     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 @@
             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 @@
             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 @@
             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 @@
             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 @@
             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 @@
             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 @@
             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 @@
             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 @@
     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 @@
     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);
 }