* modules, especially intf modules. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id: messages.c,v 1.23 2002/11/13 15:28:24 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>
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#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
p_this->p_libvlc->msg_bank.logfile =
CreateFile( L"vlc-log.txt", GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
- OPEN_ALWAYS, 0, NULL );
+ CREATE_ALWAYS, 0, NULL );
SetFilePointer( p_this->p_libvlc->msg_bank.logfile, 0, NULL, FILE_END );
#endif
}
* 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" );
CE_WRITE( ppsz_type[i_type] );
CE_WRITE( ": " );
CE_WRITE( p_item->psz_msg );
- CE_WRITE( "\n" );
+ CE_WRITE( "\r\n" );
FlushFileBuffers( p_this->p_libvlc->msg_bank.logfile );
#else