[vlc-commits] Add few missing error messages to libvlc.

Alexey Sokolov git at videolan.org
Mon Jul 25 22:03:47 CEST 2011


vlc | branch: master | Alexey Sokolov <alexey at alexeysokolov.co.cc> | Sun Jul 24 20:35:26 2011 +0700| [a5c2c7eadd2ad12d47c13f096aee21baf858a5bb] | committer: Jean-Baptiste Kempf

Add few missing error messages to libvlc.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 include/vlc/libvlc_media_list.h |    2 +-
 src/control/core.c              |   15 ++++++++++++++-
 src/control/media_library.c     |    3 +++
 src/control/media_list.c        |    1 +
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/include/vlc/libvlc_media_list.h b/include/vlc/libvlc_media_list.h
index 92f5376..46474a9 100644
--- a/include/vlc/libvlc_media_list.h
+++ b/include/vlc/libvlc_media_list.h
@@ -156,7 +156,7 @@ LIBVLC_API libvlc_media_t *
  *
  * \param p_ml a media list instance
  * \param p_md media instance
- * \return position of media instance
+ * \return position of media instance or -1 if media not found
  */
 LIBVLC_API int
     libvlc_media_list_index_of_item( libvlc_media_list_t *p_ml,
diff --git a/src/control/core.c b/src/control/core.c
index d5836be..2834af1 100644
--- a/src/control/core.c
+++ b/src/control/core.c
@@ -114,7 +114,20 @@ void libvlc_release( libvlc_instance_t *p_instance )
 
 int libvlc_add_intf( libvlc_instance_t *p_i, const char *name )
 {
-    return libvlc_InternalAddIntf( p_i->p_libvlc_int, name ) ? -1 : 0;
+    if( libvlc_InternalAddIntf( p_i->p_libvlc_int, name ))
+    {
+        if( name )
+        {
+            libvlc_printerr("interface \"%s\" initialization failed",
+                name );
+        }
+        else
+        {
+            libvlc_printerr("default interface initialization failed");
+        }
+        return -1;
+    }
+    return 0;
 }
 
 void libvlc_set_exit_handler( libvlc_instance_t *p_i, void (*cb) (void *),
diff --git a/src/control/media_library.c b/src/control/media_library.c
index 972f6cd..e23bbf6 100644
--- a/src/control/media_library.c
+++ b/src/control/media_library.c
@@ -64,7 +64,10 @@ libvlc_media_library_new( libvlc_instance_t * p_inst )
     p_mlib = malloc(sizeof(libvlc_media_library_t));
 
     if( !p_mlib )
+    {
+        libvlc_printerr( "Not enough memory" );
         return NULL;
+    }
 
     p_mlib->p_libvlc_instance = p_inst;
     p_mlib->i_refcount = 1;
diff --git a/src/control/media_list.c b/src/control/media_list.c
index 2011f95..0691a2c 100644
--- a/src/control/media_list.c
+++ b/src/control/media_list.c
@@ -454,6 +454,7 @@ int libvlc_media_list_index_of_item( libvlc_media_list_t * p_mlist,
         if( p_searched_md == p_md )
             return i;
     }
+    libvlc_printerr( "Media not found" );
     return -1;
 }
 



More information about the vlc-commits mailing list