#endif
#include "vlc_interface.h"
+#include "charset.h"
/*****************************************************************************
* Local macros
void __msg_Destroy( vlc_object_t *p_this )
{
int i;
- for( i = 0 ; i < p_this->p_libvlc->msg_bank.i_queues; i++ )
+ for( i = p_this->p_libvlc->msg_bank.i_queues -1 ; i >= 0; i-- )
{
msg_queue_t *p_queue = p_this->p_libvlc->msg_bank.pp_queues[i];
if( p_queue->i_sub )
#endif
/* Destroy lock */
vlc_mutex_destroy( &p_queue->lock );
+ REMOVE_ELEM( p_this->p_libvlc->msg_bank.pp_queues,
+ p_this->p_libvlc->msg_bank.i_queues, i );
+ free( p_queue );
}
vlc_mutex_destroy( &(p_this->p_libvlc->msg_bank.lock) );
}
msg_item_t * p_item = NULL; /* pointer to message */
msg_item_t item; /* message in case of a full queue */
-#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
+#if !defined(HAVE_VASPRINTF) || defined(__APPLE__) || defined(SYS_BEOS)
int i_size = strlen(psz_format) + INTF_MAX_MSG_SIZE;
#endif
int i;
+ if( p_this->i_flags & OBJECT_FLAGS_QUIET ||
+ (p_this->i_flags & OBJECT_FLAGS_NODBG &&
+ i_type == VLC_MSG_DBG ) )
+ {
+ return;
+ }
+
/*
* Convert message to string
*/
-#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined( SYS_BEOS )
+#if defined(HAVE_VASPRINTF) && !defined(__APPLE__) && !defined( SYS_BEOS )
vlc_va_copy( args, _args );
vasprintf( &psz_str, psz_format, args );
va_end( args );
fprintf( stderr, "main warning: can't store message (%s): ",
strerror(errno) );
vlc_va_copy( args, _args );
+ /* We should use utf8_vfprintf - but it calls malloc()... */
vfprintf( stderr, psz_format, args );
va_end( args );
- fprintf( stderr, "\n" );
+ fputs( "\n", stderr );
return;
}
p_obj = p_obj->p_parent;
}
-#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
+#if !defined(HAVE_VASPRINTF) || defined(__APPLE__) || defined(SYS_BEOS)
vlc_va_copy( args, _args );
vsnprintf( psz_str, i_size, psz_format, args );
va_end( args );
if( p_queue == NULL )
{
vlc_mutex_unlock( &p_bank->lock );
+ if( psz_str ) free( psz_str );
+ if( psz_header ) free( psz_header );
return;
}
free( p_item->psz_module );
if( p_item->psz_msg )
free( p_item->psz_msg );
+ if( p_item->psz_header )
+ free( p_item->psz_header );
}
vlc_mutex_unlock ( &p_queue->lock );
{
if( p_item->psz_header )
{
- fprintf( stderr, "[" GREEN "%.8i" GRAY "] %s %s %s%s: %s%s" GRAY
+ utf8_fprintf( stderr, "[" GREEN "%.8i" GRAY "] %s %s %s%s: %s%s" GRAY
"\n",
p_item->i_object_id, p_item->psz_header,
p_item->psz_module, psz_object,
}
else
{
- fprintf( stderr, "[" GREEN "%.8i" GRAY "] %s %s%s: %s%s" GRAY "\n",
+ utf8_fprintf( stderr, "[" GREEN "%.8i" GRAY "] %s %s%s: %s%s" GRAY "\n",
p_item->i_object_id, p_item->psz_module, psz_object,
ppsz_type[i_type], ppsz_color[i_type],
p_item->psz_msg );
{
if( p_item->psz_header )
{
- fprintf( stderr, "[%.8i] %s %s %s%s: %s\n", p_item->i_object_id,
+ utf8_fprintf( stderr, "[%.8i] %s %s %s%s: %s\n", p_item->i_object_id,
p_item->psz_header, p_item->psz_module,
psz_object, ppsz_type[i_type], p_item->psz_msg );
}
else
{
- fprintf( stderr, "[%.8i] %s %s%s: %s\n", p_item->i_object_id,
+ utf8_fprintf( stderr, "[%.8i] %s %s%s: %s\n", p_item->i_object_id,
p_item->psz_module, psz_object, ppsz_type[i_type],
p_item->psz_msg );
}