[vlc-devel] commit: Progress interaction: remove useless parameter ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 31 23:18:36 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Feb  1 00:18:14 2009 +0200| [065f76087713cbea23bf197195a4f5229665d654] | committer: Rémi Denis-Courmont 

Progress interaction: remove useless parameter

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

 include/vlc_interface.h     |    9 +++------
 modules/access/dvb/scan.c   |    6 +++---
 modules/demux/avi/avi.c     |    6 +++---
 src/interface/interaction.c |   30 +++++++++++-------------------
 src/libvlccore.sym          |    6 +++---
 src/misc/update.c           |   10 +++++-----
 6 files changed, 28 insertions(+), 39 deletions(-)

diff --git a/include/vlc_interface.h b/include/vlc_interface.h
index 6f0be41..f3813d2 100644
--- a/include/vlc_interface.h
+++ b/include/vlc_interface.h
@@ -294,12 +294,9 @@ VLC_EXPORT( int, __intf_UserStringInput,(vlc_object_t*, const char*, const char*
 #define intf_IntfProgress( a, b, c ) __intf_Progress( VLC_OBJECT(a), NULL, b,c, -1 )
 #define intf_UserProgress( a, b, c, d, e ) __intf_Progress( VLC_OBJECT(a),b,c,d,e )
 VLC_EXPORT( interaction_dialog_t *, __intf_Progress,( vlc_object_t*, const char*, const char*, float, int) );
-#define intf_ProgressUpdate( a, b, c, d, e ) __intf_ProgressUpdate( VLC_OBJECT(a),b,c,d,e )
-VLC_EXPORT( void, __intf_ProgressUpdate,( vlc_object_t*, interaction_dialog_t *, const char*, float, int) );
-#define intf_ProgressIsCancelled( a, b ) __intf_UserProgressIsCancelled( VLC_OBJECT(a),b )
-VLC_EXPORT( bool, __intf_UserProgressIsCancelled,( vlc_object_t*, interaction_dialog_t * ) );
-#define intf_UserHide( a, b ) __intf_UserHide( VLC_OBJECT(a), b )
-VLC_EXPORT( void, __intf_UserHide,( vlc_object_t *, interaction_dialog_t * ));
+VLC_EXPORT( void, intf_ProgressUpdate,( interaction_dialog_t *, const char*, float, int) );
+VLC_EXPORT( bool, intf_ProgressIsCancelled,( interaction_dialog_t * ) );
+VLC_EXPORT( void, intf_UserHide,( interaction_dialog_t * ));
 
 /** @} */
 /** @} */
diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index 0db0162..b9842f7 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -136,7 +136,7 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa
 void scan_Clean( scan_t *p_scan )
 {
     if( p_scan->p_dialog != NULL )
-        intf_UserHide( p_scan->p_obj, p_scan->p_dialog );
+        intf_UserHide( p_scan->p_dialog );
 
     for( int i = 0; i < p_scan->i_service; i++ )
         scan_service_Delete( p_scan->pp_service[i] );
@@ -320,7 +320,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
         if( p_scan->p_dialog == NULL )
             p_scan->p_dialog = intf_UserProgress( p_scan->p_obj, _("Scanning DVB-T"), psz_text, 100.0 * f_position, -1 );
         else
-            intf_ProgressUpdate( p_scan->p_obj, p_scan->p_dialog, psz_text, 100 * f_position, -1 );
+            intf_ProgressUpdate( p_scan->p_dialog, psz_text, 100 * f_position, -1 );
         free( psz_text );
     }
 
@@ -330,7 +330,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
 
 bool scan_IsCancelled( scan_t *p_scan )
 {
-    return p_scan->p_dialog && intf_ProgressIsCancelled( p_scan->p_obj, p_scan->p_dialog );
+    return p_scan->p_dialog && intf_ProgressIsCancelled( p_scan->p_dialog );
 }
 
 static scan_service_t *ScanFindService( scan_t *p_scan, int i_service_start, int i_program )
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 99a2618..160c3fb 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -2414,12 +2414,12 @@ static void AVI_IndexCreate( demux_t *p_demux )
         /* Don't update/check dialog too often */
         if( p_dialog && mdate() - i_dialog_update > 100000 )
         {
-            if( intf_ProgressIsCancelled( p_demux, p_dialog ) )
+            if( intf_ProgressIsCancelled( p_dialog ) )
                 break;
 
             double f_pos = 100.0 * stream_Tell( p_demux->s ) /
                            stream_Size( p_demux->s );
-            intf_ProgressUpdate( p_demux, p_dialog,
+            intf_ProgressUpdate( p_dialog,
                                  _( "Fixing AVI Index..." ), f_pos, -1 );
 
             i_dialog_update = mdate();
@@ -2484,7 +2484,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
 
 print_stat:
     if( p_dialog != NULL )
-        intf_UserHide( p_demux, p_dialog );
+        intf_UserHide( p_dialog );
 
     for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ )
     {
diff --git a/src/interface/interaction.c b/src/interface/interaction.c
index efa0939..dbc7d33 100644
--- a/src/interface/interaction.c
+++ b/src/interface/interaction.c
@@ -204,20 +204,17 @@ __intf_Progress( vlc_object_t *p_this, const char *psz_title,
 /**
  * Update a progress bar in a dialogue
  *
- * \param p_this           Parent vlc_object
  * \param p_dialog         Dialog
  * \param psz_status       New status
  * \param f_position       New position (0.0->100.0)
  * \param i_timeToGo       Time (in sec) to go until process is finished
  * \return                 nothing
  */
-void __intf_ProgressUpdate( vlc_object_t *p_this,
-                            interaction_dialog_t *p_dialog,
+void intf_ProgressUpdate( interaction_dialog_t *p_dialog,
                             const char *psz_status, float f_pos, int i_time )
 {
-    interaction_t *p_interaction = InteractionGet( p_this );
-
-    if( !p_interaction ) return;
+    interaction_t *p_interaction = InteractionGet( p_dialog->p_parent );
+    assert( p_interaction );
 
     vlc_object_lock( p_interaction );
     free( p_dialog->psz_description );
@@ -237,18 +234,15 @@ void __intf_ProgressUpdate( vlc_object_t *p_this,
  * Helper function to communicate dialogue cancellations between the
  * interface module and the caller
  *
- * \param p_this           Parent vlc_object
  * \param p_dialog         Dialog
  * \return                 Either true or false
  */
-bool __intf_UserProgressIsCancelled( vlc_object_t *p_this,
-                                     interaction_dialog_t *p_dialog )
+bool intf_ProgressIsCancelled( interaction_dialog_t *p_dialog )
 {
-    interaction_t *p_interaction = InteractionGet( p_this );
+    interaction_t *p_interaction = InteractionGet( p_dialog->p_parent );
     bool b_cancel;
 
-    if( !p_interaction ) return true;
-
+    assert( p_interaction );
     vlc_object_lock( p_interaction );
     b_cancel = p_dialog->b_cancelled;
     vlc_object_unlock( p_interaction );
@@ -329,15 +323,13 @@ int __intf_UserStringInput( vlc_object_t *p_this,
 /**
  * Hide an interaction dialog
  *
- * \param p_this the parent vlc object
  * \param p_dialog the dialog to hide
  * \return nothing
  */
-void __intf_UserHide( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
+void intf_UserHide( interaction_dialog_t *p_dialog )
 {
-    interaction_t *p_interaction = InteractionGet( p_this );
-
-    if( !p_interaction ) return;
+    interaction_t *p_interaction = InteractionGet( p_dialog->p_parent );
+    assert( p_interaction );
 
     vlc_object_lock( p_interaction );
     p_dialog->i_status = ANSWERED_DIALOG;
@@ -442,7 +434,7 @@ int interaction_Unregister( intf_thread_t *intf )
  * The following functions are local
  **********************************************************************/
 
-/* Get the interaction object. Create it if needed */
+/* Get the interaction object */
 static interaction_t * InteractionGet( vlc_object_t *p_this )
 {
     interaction_t *obj = libvlc_priv(p_this->p_libvlc)->p_interaction;
@@ -482,7 +474,7 @@ static void DialogDestroy( interaction_dialog_t *p_dialog )
  * if required */
 static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
 {
-    interaction_t *p_interaction = InteractionGet( p_this );
+    interaction_t *p_interaction = InteractionGet( p_dialog->p_parent );
 
     if( !p_interaction )
         return VLC_EGENERIC;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index eb41fda..ac593f7 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -192,13 +192,13 @@ interaction_Unregister
 __intf_Create
 __intf_Eject
 __intf_Progress
-__intf_ProgressUpdate
+intf_ProgressIsCancelled
+intf_ProgressUpdate
 intf_RunThread
 intf_StopThread
 __intf_UserFatal
-__intf_UserHide
+intf_UserHide
 __intf_UserLoginPassword
-__intf_UserProgressIsCancelled
 __intf_UserStringInput
 __intf_UserWarn
 __intf_UserYesNo
diff --git a/src/misc/update.c b/src/misc/update.c
index 320b727..fc05e6f 100644
--- a/src/misc/update.c
+++ b/src/misc/update.c
@@ -1597,7 +1597,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
     vlc_object_lock( p_udt );
     while( vlc_object_alive( p_udt ) &&
            ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
-           !intf_ProgressIsCancelled( p_udt, p_progress ) )
+           !intf_ProgressIsCancelled( p_progress ) )
     {
         vlc_object_unlock( p_udt );
         if( fwrite( p_buffer, i_read, 1, p_file ) < 1 )
@@ -1614,7 +1614,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
                       p_update->release.psz_url, psz_downloaded, psz_size,
                       f_progress ) != -1 )
         {
-            intf_ProgressUpdate( p_udt, p_progress, psz_status, f_progress, 0 );
+            intf_ProgressUpdate( p_progress, psz_status, f_progress, 0 );
             free( psz_status );
         }
         free( psz_downloaded );
@@ -1626,13 +1626,13 @@ static void* update_DownloadReal( vlc_object_t *p_this )
     p_file = NULL;
 
     if( vlc_object_alive( p_udt ) &&
-        !intf_ProgressIsCancelled( p_udt, p_progress ) )
+        !intf_ProgressIsCancelled( p_progress ) )
     {
         vlc_object_unlock( p_udt );
         if( asprintf( &psz_status, _("%s\nDone %s (100.0%%)"),
             p_update->release.psz_url, psz_size ) != -1 )
         {
-            intf_ProgressUpdate( p_udt, p_progress, psz_status, 100.0, 0 );
+            intf_ProgressUpdate( p_progress, psz_status, 100.0, 0 );
             p_progress = NULL
             free( psz_status );
         }
@@ -1725,7 +1725,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
 end:
     if( p_progress )
     {
-        intf_ProgressUpdate( p_udt, p_progress, _("Cancelled"), 100.0, 0 );
+        intf_ProgressUpdate( p_progress, _("Cancelled"), 100.0, 0 );
     }
     if( p_stream )
         stream_Delete( p_stream );




More information about the vlc-devel mailing list