[Android] LibVLC: fix warnings

Thomas Guillem git at videolan.org
Thu Jun 18 13:47:31 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jun 18 13:36:19 2015 +0200| [9131e784693808e70aff3787c8b5c3946516ea3f] | committer: Thomas Guillem

LibVLC: fix warnings

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

 libvlc/src/org/videolan/libvlc/LibVLC.java    |    2 +-
 libvlc/src/org/videolan/libvlc/Media.java     |    7 +++----
 libvlc/src/org/videolan/libvlc/MediaList.java |    4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index b51dae0..5685d17 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -86,7 +86,7 @@ public class LibVLC extends VLCObject {
             }
         }
 
-        nativeNew(options != null ? options.toArray(new String[options.size()]) : null);
+        nativeNew(options.toArray(new String[options.size()]));
         setEventHandler(EventHandler.getInstance());
     }
 
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index ef66944..14dbebc 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -150,7 +150,7 @@ public class Media extends VLCObject {
         }
     }
 
-    /* Used from JNI */
+    @SuppressWarnings("unused") /* Used from JNI */
     private static Track createAudioTrackFromNative(String codec, String originalCodec, int id, int profile,
             int level, int bitrate, String language, String description,
             int channels, int rate) {
@@ -206,7 +206,7 @@ public class Media extends VLCObject {
         }
     }
 
-    /* Used from JNI */
+    @SuppressWarnings("unused") /* Used from JNI */
     private static Track createSubtitleTrackFromNative(String codec, String originalCodec, int id, int profile,
             int level, int bitrate, String language, String description,
             String encoding) {
@@ -322,8 +322,7 @@ public class Media extends VLCObject {
         final char array[] = uri.toString().toCharArray();
         final StringBuilder sb = new StringBuilder(array.length * 2);
 
-        for (int i = 0; i < array.length; ++i) {
-            final char c = array[i];
+        for (final char c : array) {
             if (URI_AUTHORIZED_CHARS.indexOf(c) != -1)
                 sb.append("%").append(Integer.toHexString(c));
             else
diff --git a/libvlc/src/org/videolan/libvlc/MediaList.java b/libvlc/src/org/videolan/libvlc/MediaList.java
index 984d7ce..9222c09 100644
--- a/libvlc/src/org/videolan/libvlc/MediaList.java
+++ b/libvlc/src/org/videolan/libvlc/MediaList.java
@@ -43,7 +43,7 @@ public class MediaList extends VLCObject {
     }
 
     private int mCount = 0;
-    private final SparseArray<Media> mMediaArray = new SparseArray<Media>();
+    private final SparseArray<Media> mMediaArray = new SparseArray<>();
     private boolean mLocked = false;
 
     private void init() {
@@ -112,7 +112,7 @@ public class MediaList extends VLCObject {
             throw new IllegalStateException("already locked from event callback");
         mLocked = true;
         Event event = null;
-        int index = -1;
+        int index;
 
         switch (eventType) {
         case Events.MediaListItemAdded:



More information about the Android mailing list