[vlc-devel] commit: LibVLC: remove last exception ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Feb 6 19:35:48 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb  6 20:24:52 2010 +0200| [ca46a8b72ea78b00394e463d12052e036796cefa] | committer: Rémi Denis-Courmont 

LibVLC: remove last exception

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

 include/vlc/libvlc_media_library.h |   11 ++++-------
 include/vlc/libvlc_media_list.h    |    5 ++---
 src/control/media_library.c        |   15 +++++----------
 src/control/media_list.c           |   18 ++++++++----------
 4 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/include/vlc/libvlc_media_library.h b/include/vlc/libvlc_media_library.h
index 446bd70..f1de875 100644
--- a/include/vlc/libvlc_media_library.h
+++ b/include/vlc/libvlc_media_library.h
@@ -79,22 +79,19 @@ VLC_PUBLIC_API void
  * Load media library.
  *
  * \param p_mlib media library object
- * \param p_e an initialized exception object.
+ * \return 0 on success, -1 on error
  */
-VLC_PUBLIC_API void
-    libvlc_media_library_load( libvlc_media_library_t * p_mlib,
-                               libvlc_exception_t * p_e );
+VLC_PUBLIC_API int
+    libvlc_media_library_load( libvlc_media_library_t * p_mlib );
 
 /**
  * Get media library subitems.
  *
  * \param p_mlib media library object
- * \param p_e an initialized exception object.
  * \return media list subitems
  */
 VLC_PUBLIC_API libvlc_media_list_t *
-    libvlc_media_library_media_list( libvlc_media_library_t * p_mlib,
-                                     libvlc_exception_t * p_e );
+    libvlc_media_library_media_list( libvlc_media_library_t * p_mlib );
 
 
 /** @} */
diff --git a/include/vlc/libvlc_media_list.h b/include/vlc/libvlc_media_list.h
index 5e83372..a77d61b 100644
--- a/include/vlc/libvlc_media_list.h
+++ b/include/vlc/libvlc_media_list.h
@@ -70,10 +70,9 @@ VLC_PUBLIC_API void
 VLC_PUBLIC_API void
     libvlc_media_list_retain( libvlc_media_list_t * );
 
-VLC_DEPRECATED_API void
+VLC_DEPRECATED_API int
     libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
-                                        const char * psz_uri,
-                                        libvlc_exception_t * p_e );
+                                        const char * psz_uri );
 
 /**
  * Associate media instance with this media list instance.
diff --git a/src/control/media_library.c b/src/control/media_library.c
index 8af091d..972f6cd 100644
--- a/src/control/media_library.c
+++ b/src/control/media_library.c
@@ -107,9 +107,7 @@ void libvlc_media_library_retain( libvlc_media_library_t * p_mlib )
  *
  * It doesn't yet load the playlists
  **************************************************************************/
-void
-libvlc_media_library_load( libvlc_media_library_t * p_mlib,
-                           libvlc_exception_t * p_e )
+int libvlc_media_library_load( libvlc_media_library_t * p_mlib )
 {
     char *psz_datadir = config_GetUserDir( VLC_DATA_DIR );
     char * psz_uri;
@@ -122,9 +120,8 @@ libvlc_media_library_load( libvlc_media_library_t * p_mlib,
 
     if( psz_uri == NULL )
     {
-        libvlc_exception_raise( p_e );
         libvlc_printerr( "Not enough memory" );
-        return;
+        return -1;
     }
 
     if( p_mlib->p_mlist )
@@ -132,19 +129,17 @@ libvlc_media_library_load( libvlc_media_library_t * p_mlib,
 
     p_mlib->p_mlist = libvlc_media_list_new( p_mlib->p_libvlc_instance );
 
-    libvlc_media_list_add_file_content( p_mlib->p_mlist, psz_uri, p_e );
+    int ret = libvlc_media_list_add_file_content( p_mlib->p_mlist, psz_uri );
     free( psz_uri );
-    return;
+    return ret;
 }
 
 /**************************************************************************
  *        media_list (Public)
  **************************************************************************/
 libvlc_media_list_t *
-libvlc_media_library_media_list( libvlc_media_library_t * p_mlib,
-                                     libvlc_exception_t * p_e )
+libvlc_media_library_media_list( libvlc_media_library_t * p_mlib )
 {
-    (void)p_e;
     if( p_mlib->p_mlist )
         libvlc_media_list_retain( p_mlib->p_mlist );
     return p_mlib->p_mlist;
diff --git a/src/control/media_list.c b/src/control/media_list.c
index 2c83b45..8dc7e0c 100644
--- a/src/control/media_list.c
+++ b/src/control/media_list.c
@@ -242,10 +242,9 @@ void libvlc_media_list_retain( libvlc_media_list_t * p_mlist )
 /**************************************************************************
  *       add_file_content (Public)
  **************************************************************************/
-void
+int
 libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
-                                    const char * psz_uri,
-                                    libvlc_exception_t * p_e )
+                                    const char * psz_uri )
 {
     input_item_t * p_input_item;
     libvlc_media_t * p_md;
@@ -256,9 +255,8 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
 
     if( !p_input_item )
     {
-        libvlc_exception_raise( p_e );
         libvlc_printerr( "Not enough memory" );
-        return;
+        return -1;
     }
 
     p_md = libvlc_media_new_from_input_item( p_mlist->p_libvlc_instance,
@@ -266,18 +264,18 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
     if( !p_md )
     {
         vlc_gc_decref( p_input_item );
-        return;
+        return -1;
     }
 
     if( libvlc_media_list_add_media( p_mlist, p_md ) )
     {
-        libvlc_exception_raise( p_e );
-        return;
+#warning Missing error handling!
+        /* printerr and leaks */
+        return -1;
     }
 
     input_Read( p_mlist->p_libvlc_instance->p_libvlc_int, p_input_item );
-
-    return;
+    return 0;
 }
 
 /**************************************************************************




More information about the vlc-devel mailing list