[vlc-commits] commit: ML: Fix binary search (Srikanth Raju )

git at videolan.org git at videolan.org
Tue Dec 21 20:27:25 CET 2010


vlc | branch: master | Srikanth Raju <srikiraju at gmail.com> | Wed Dec 22 01:01:36 2010 +0530| [b604f90e0579dfc50f090858754ef8b4f421e501] | committer: Srikanth Raju 

ML: Fix binary search

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

 modules/media_library/sql_media_library.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/media_library/sql_media_library.c b/modules/media_library/sql_media_library.c
index 1b35260..e2b25bf 100644
--- a/modules/media_library/sql_media_library.c
+++ b/modules/media_library/sql_media_library.c
@@ -60,7 +60,7 @@ static int CreateInputItemFromMedia( media_library_t *p_ml,
 struct ml_table_elt
 {
     int column_id;
-    char column_name[];
+    char column_name[20];
 };
 
 static const struct ml_table_elt ml_table_map[]=
@@ -486,9 +486,9 @@ int SQLToMediaArray( media_library_t *p_ml, vlc_array_t *p_result_array,
             int mid = (low + high ) / 2;
             char* mid_val = ml_table_map[mid].column_name;
             int cmp = strcmp( mid_val, res( 0, col ) );
-            if( cmp > 0 )
+            if( cmp < 0 )
                 low = mid + 1;
-            else if ( cmp < 0 )
+            else if ( cmp > 0 )
                 high = mid - 1;
             else
             {



More information about the vlc-commits mailing list