]> git.sesse.net Git - vlc/blobdiff - src/misc/messages.c
Doxyfile:
[vlc] / src / misc / messages.c
index 40660fd4ffb0b2e01c7bc83238eed8f92202961a..8d01dea5c92f0e00062bb45a8fc7eb7b04308232 100644 (file)
@@ -4,7 +4,7 @@
  * modules, especially intf modules. See config.h for output configuration.
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: messages.c,v 1.28 2002/12/30 17:36:01 gbazin 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
@@ -244,22 +255,25 @@ DECLARE_MSG_FN( __msg_Dbg,  VLC_MSG_DBG );
  * 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
@@ -272,13 +286,17 @@ static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
 #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
 
@@ -313,7 +331,7 @@ static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
             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" );
@@ -408,20 +426,12 @@ static void FlushMsg ( msg_bank_t *p_bank )
  *****************************************************************************/
 static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
 {
-#ifndef WIN32
 #   define COL(x)  "\033[" #x ";1m"
 #   define RED     COL(31)
 #   define GREEN   COL(32)
 #   define YELLOW  COL(33)
 #   define WHITE   COL(37)
 #   define GRAY    "\033[0m"
-#else
-#   define RED     ""
-#   define GREEN   ""
-#   define YELLOW  ""
-#   define WHITE   ""
-#   define GRAY    ""
-#endif
 
 #ifdef UNDER_CE
     int i_dummy;