[Android] MediaLibrary: code simplification

Jean-Baptiste Kempf git at videolan.org
Thu Jun 11 21:42:44 CEST 2015


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Jun 11 21:38:54 2015 +0200| [d48bdb517e427750b928848dca4a5d86c0e1f4d6] | committer: Jean-Baptiste Kempf

MediaLibrary: code simplification

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

 vlc-android/src/org/videolan/vlc/MediaDatabase.java |    2 +-
 vlc-android/src/org/videolan/vlc/MediaLibrary.java  |    9 +++------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index d6fcf8b..48c3a81 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -654,7 +654,7 @@ public class MediaDatabase {
         Cursor cursor;
         HashMap<String, MediaWrapper> medias = new HashMap<String, MediaWrapper>();
         int chunk_count = 0;
-        int count = 0;
+        int count;
 
         do {
             count = 0;
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 2df4fea..44784c3 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -287,7 +287,6 @@ public class MediaLibrary {
                 while (!directories.isEmpty()) {
                     File dir = directories.pop();
                     String dirPath = dir.getAbsolutePath();
-                    File[] f = null;
 
                     // Skip some system folders
                     if (dirPath.startsWith("/proc/") || dirPath.startsWith("/sys/") || dirPath.startsWith("/dev/"))
@@ -313,17 +312,15 @@ public class MediaLibrary {
                     // Filter the extensions and the folders
                     try {
                         String[] files = dir.list();
-                        File file;
-                        if (files != null){
-                            for (String fileName : files){
-                                file = new File(dirPath, fileName);
+                        if (files != null) {
+                            for (String fileName : files) {
+                                File file = new File(dirPath, fileName);
                                 if (mediaFileFilter.accept(file)){
                                     if (file.isFile())
                                         mediaToScan.add(file);
                                     else if (file.isDirectory())
                                         directories.push(file);
                                 }
-                                file = null;
                             }
                         }
                     } catch (Exception e){



More information about the Android mailing list