[Android] Drop unneeded initialization

Rafaël Carré git at videolan.org
Tue Jan 28 15:07:14 CET 2014


vlc-ports/android | branch: master | Rafaël Carré <funman at videolan.org> | Tue Jan 28 14:42:32 2014 +0100| [b8b94a657217f3af96211fb6a97cbe939e4bc17f] | committer: Rafaël Carré

Drop unneeded initialization

Protect against too large snprintf by using sizeof

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b8b94a657217f3af96211fb6a97cbe939e4bc17f
---

 vlc-android/jni/libvlcjni.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 4e3c6f9..b1e7575 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -228,15 +228,15 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
 
     methodId = (*env)->GetMethodID(env, cls, "getDeblocking", "()I");
     int deblocking = (*env)->CallIntMethod(env, thiz, methodId);
-    char deblockstr[2] = "3";
-    snprintf(deblockstr, 2, "%d", deblocking);
+    char deblockstr[2];
+    snprintf(deblockstr, sizeof(deblockstr), "%d", deblocking);
     LOGD("Using deblocking level %d", deblocking);
 
     methodId = (*env)->GetMethodID(env, cls, "getNetworkCaching", "()I");
     int networkCaching = (*env)->CallIntMethod(env, thiz, methodId);
-    char networkCachingstr[25] = "0";
+    char networkCachingstr[25];
     if(networkCaching > 0) {
-        snprintf(networkCachingstr, 25, "--network-caching=%d", networkCaching);
+        snprintf(networkCachingstr, sizeof(networkCachingstr), "--network-caching=%d", networkCaching);
         LOGD("Using network caching of %d ms", networkCaching);
     }
 



More information about the Android mailing list