* modules, especially intf modules. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id: messages.c,v 1.26 2002/12/18 11:47:35 sam Exp $
+ * $Id: messages.c,v 1.34 2003/06/24 13:33:49 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
#endif
#ifdef HAVE_UNISTD_H
-#include <unistd.h> /* close(), write() */
+# include <unistd.h> /* close(), write() */
#endif
-#include "interface.h"
+#include "vlc_interface.h"
+
+/*****************************************************************************
+ * Local macros
+ *****************************************************************************/
+#if defined(HAVE_VA_COPY)
+# define vlc_va_copy(dest,src) va_copy(dest,src)
+#elif defined(HAVE___VA_COPY)
+# define vlc_va_copy(dest,src) __va_copy(dest,src)
+#else
+# define vlc_va_copy(dest,src) (dest)=(src)
+#endif
/*****************************************************************************
* Local prototypes
* These functions queue a message for later printing.
*****************************************************************************/
void __msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module,
- const char *psz_format, ... ) ATTRIBUTE_FORMAT( 4, 5 )
+ const char *psz_format, ... )
{
va_list args;
/* Generic functions used when variadic macros are not available. */
#define DECLARE_MSG_FN( FN_NAME, FN_TYPE ) \
void FN_NAME( void *p_this, const char *psz_format, ... ) \
- ATTRIBUTE_FORMAT( 2, 3 ) \
{ \
va_list args; \
va_start( args, psz_format ); \
* a warning.
*****************************************************************************/
static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
- const char *psz_format, va_list args )
+ const char *psz_format, va_list _args )
{
msg_bank_t * p_bank = &p_this->p_libvlc->msg_bank; /* message bank */
char * psz_str = NULL; /* formatted message string */
+ va_list args;
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)
+#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
int i_size = strlen(psz_format) + INTF_MAX_MSG_SIZE;
#endif
/*
* Convert message to string
*/
-#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN)
+#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined( SYS_BEOS )
+ vlc_va_copy( args, _args );
vasprintf( &psz_str, psz_format, args );
+ va_end( args );
#else
psz_str = (char*) malloc( i_size * sizeof(char) );
#endif
#else
fprintf( stderr, "main warning: can't store message: " );
#endif
+ vlc_va_copy( args, _args );
vfprintf( stderr, psz_format, args );
+ va_end( args );
fprintf( stderr, "\n" );
return;
}
-#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN)
+#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
+ vlc_va_copy( args, _args );
vsnprintf( psz_str, i_size, psz_format, args );
+ va_end( args );
psz_str[ i_size - 1 ] = 0; /* Just in case */
#endif
p_item = p_bank->msg + p_bank->i_stop;
p_bank->i_stop = (p_bank->i_stop + 1) % VLC_MSG_QSIZE;
- p_item->i_type = VLC_MSG_ERR;
+ p_item->i_type = VLC_MSG_WARN;
p_item->i_object_id = p_this->i_object_id;
p_item->i_object_type = p_this->i_object_type;
p_item->psz_module = strdup( "message" );