[vlc-commits] Update message callback

Rémi Denis-Courmont git at videolan.org
Wed May 11 18:54:36 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May 11 19:38:48 2011 +0300| [9f1762006cc9f790267d3692f17ee7b0db7e3f76] | committer: Rémi Denis-Courmont

Update message callback

 - remove always zero overruns counter,
 - constify message pointer.

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

 include/vlc_messages.h               |    2 +-
 modules/gui/macosx/intf.m            |    4 ++--
 modules/gui/ncurses.c                |    3 +--
 modules/gui/qt4/dialogs/messages.cpp |    5 ++---
 modules/misc/logger.c                |    5 ++---
 src/control/log.c                    |    3 +--
 src/misc/messages.c                  |    2 +-
 7 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/include/vlc_messages.h b/include/vlc_messages.h
index b4b37d6..7996696 100644
--- a/include/vlc_messages.h
+++ b/include/vlc_messages.h
@@ -117,7 +117,7 @@ typedef struct msg_cb_data_t msg_cb_data_t;
  * Message logging callback signature.
  * Accepts one private data pointer, the message, and an overrun counter.
  */
-typedef void (*msg_callback_t) (msg_cb_data_t *, msg_item_t *, unsigned);
+typedef void (*msg_callback_t) (msg_cb_data_t *, const msg_item_t *);
 
 VLC_API msg_subscription_t* msg_Subscribe( libvlc_int_t *, msg_callback_t, msg_cb_data_t * ) VLC_USED;
 VLC_API void msg_Unsubscribe( msg_subscription_t * );
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index f37b852..b05df3e 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -71,7 +71,7 @@ static void updateProgressPanel (void *, const char *, float);
 static bool checkProgressPanel (void *);
 static void destroyProgressPanel (void *);
 
-static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
+static void MsgCallback( msg_cb_data_t *, const msg_item_t * );
 
 #pragma mark -
 #pragma mark VLC Interface Object Callbacks
@@ -153,7 +153,7 @@ static void Run( intf_thread_t *p_intf )
  * ready to be displayed. We store everything in a NSArray in our Cocoa part
  * of this file, so we are forwarding everything through notifications.
  *****************************************************************************/
-static void MsgCallback( msg_cb_data_t *data, msg_item_t *item, unsigned int i )
+static void MsgCallback( msg_cb_data_t *data, const msg_item_t *item )
 {
     int canc = vlc_savecancel();
     NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index da70182..d3fcfd6 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -1773,10 +1773,9 @@ static void HandleKey(intf_thread_t *p_intf)
  *
  */
 
-static void MsgCallback(msg_cb_data_t *data, msg_item_t *msg, unsigned i)
+static void MsgCallback(msg_cb_data_t *data, const msg_item_t *msg)
 {
     intf_sys_t *p_sys = data->p_sys;
-    (void)i; // what is this?
     int canc = vlc_savecancel();
 
     vlc_mutex_lock(&p_sys->msg_lock);
diff --git a/modules/gui/qt4/dialogs/messages.cpp b/modules/gui/qt4/dialogs/messages.cpp
index 20935a2..5c356be 100644
--- a/modules/gui/qt4/dialogs/messages.cpp
+++ b/modules/gui/qt4/dialogs/messages.cpp
@@ -73,7 +73,7 @@ struct msg_cb_data_t
     MessagesDialog *self;
 };
 
-static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
+static void MsgCallback( msg_cb_data_t *, const msg_item_t * );
 
 MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
                : QVLCFrame( _p_intf )
@@ -296,7 +296,7 @@ void MessagesDialog::tabChanged( int i )
     updateButton->setVisible( i == 1 );
 }
 
-static void MsgCallback( msg_cb_data_t *data, msg_item_t *item, unsigned )
+static void MsgCallback( msg_cb_data_t *data, const msg_item_t *item )
 {
     int canc = vlc_savecancel();
 
@@ -304,4 +304,3 @@ static void MsgCallback( msg_cb_data_t *data, msg_item_t *item, unsigned )
 
     vlc_restorecancel( canc );
 }
-
diff --git a/modules/misc/logger.c b/modules/misc/logger.c
index 1183ef0..0fe5459 100644
--- a/modules/misc/logger.c
+++ b/modules/misc/logger.c
@@ -94,7 +94,7 @@ struct intf_sys_t
 static int  Open    ( vlc_object_t * );
 static void Close   ( vlc_object_t * );
 
-static void Overflow (msg_cb_data_t *p_sys, msg_item_t *p_item, unsigned overruns);
+static void Overflow (msg_cb_data_t *p_sys, const msg_item_t *p_item);
 static void TextPrint         ( const msg_item_t *, FILE * );
 static void HtmlPrint         ( const msg_item_t *, FILE * );
 #ifdef HAVE_SYSLOG_H
@@ -366,9 +366,8 @@ static void Close( vlc_object_t *p_this )
 /**
  * Log a message
  */
-static void Overflow (msg_cb_data_t *p_sys, msg_item_t *p_item, unsigned overruns)
+static void Overflow (msg_cb_data_t *p_sys, const msg_item_t *p_item)
 {
-    VLC_UNUSED(overruns);
     int verbosity = var_InheritInteger( p_sys->p_intf, "log-verbose" );
     if (verbosity == -1)
         verbosity = var_InheritInteger( p_sys->p_intf, "verbose" );
diff --git a/src/control/log.c b/src/control/log.c
index c9b5ce6..1caf9d0 100644
--- a/src/control/log.c
+++ b/src/control/log.c
@@ -48,7 +48,7 @@ struct msg_cb_data_t
     int         verbosity;
 };
 
-static void handler( msg_cb_data_t *d, msg_item_t *p_item, unsigned i_drop )
+static void handler( msg_cb_data_t *d, const msg_item_t *p_item )
 {
     if (p_item->i_type > d->verbosity)
         return;
@@ -59,7 +59,6 @@ static void handler( msg_cb_data_t *d, msg_item_t *p_item, unsigned i_drop )
     if (d->count < VLC_MSG_QSIZE)
         d->items[d->count++] = msg;
     vlc_spin_unlock (&d->lock);
-    (void)i_drop;
 }
 
 struct libvlc_log_t
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 5a9be21..188d763 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -413,7 +413,7 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
                 break;
         }
 
-        sub->func (sub->opaque, &msg, 0);
+        sub->func (sub->opaque, &msg);
     }
     vlc_rwlock_unlock (&bank->lock);
     free (msg.psz_msg);



More information about the vlc-commits mailing list