* Preamble
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <vlc/vlc.h>
#include <stdarg.h> /* va_list for BSD */
void __msg_Create( vlc_object_t *p_this )
{
int i;
- vlc_mutex_init( p_this, &(p_this->p_libvlc->msg_bank.lock) );
+ vlc_mutex_init( (vlc_object_t *)NULL,
+ &(p_this->p_libvlc->msg_bank.lock) );
for( i = 0; i < 2; i++ )
{
- vlc_mutex_init( p_this, &QUEUE(i).lock );
+ vlc_mutex_init( (vlc_object_t *)NULL, &QUEUE(i).lock );
QUEUE(i).b_overflow = VLC_FALSE;
QUEUE(i).i_id = i;
QUEUE(i).i_start = 0;
{ \
va_list args; \
va_start( args, psz_format ); \
- QueueMsg( (vlc_object_t *)p_this,MSG_QUEUE_NORMAL, FN_TYPE, "unknown", \
+ QueueMsg( p_this,MSG_QUEUE_NORMAL, FN_TYPE, "unknown", \
psz_format, args ); \
va_end( args ); \
} \
int i_size = strlen(psz_format) + INTF_MAX_MSG_SIZE;
#endif
- if( p_this == NULL || p_this->i_flags & OBJECT_FLAGS_QUIET ||
- (p_this->i_flags & OBJECT_FLAGS_NODBG && i_type == VLC_MSG_DBG) )
+ if( p_this == NULL )
{
+#ifndef NDEBUG
+ if( i_type == VLC_MSG_DBG )
+ return;
+#endif
+ utf8_vfprintf( stderr, psz_format, _args );
+ fputc ('\n', stderr);
return;
}
+ if( p_this->i_flags & OBJECT_FLAGS_QUIET ||
+ (p_this->i_flags & OBJECT_FLAGS_NODBG && i_type == VLC_MSG_DBG) )
+ return;
+
#ifndef __GLIBC__
/* Expand %m to strerror(errno) - only once */
char buf[strlen( psz_format ) + 2001], *ptr;
strcpy( buf, psz_format );
- ptr = psz_format = buf;
+ ptr = (char*)buf;
+ psz_format = (const char*) buf;
for( ;; )
{
strncpy( errbuf, net_strerror( sockerr ), 1001 );
WSASetLastError( sockerr );
}
- else
+ if ((sockerr == 0)
+ || (strcmp ("Unknown network stack error", errbuf) == 0))
strncpy( errbuf, strerror( errno ), 1001 );
#endif
errbuf[1000] = 0;
#ifdef __GLIBC__
fprintf( stderr, "main warning: can't store message (%m): " );
#else
- char *psz_err[1001];
+ char psz_err[1001];
#ifndef WIN32
/* we're not using GLIBC, so we are sure that the error description
* will be stored in the buffer we provide to strerror_r() */
strerror_r( errno, psz_err, 1001 );
#else
- int sockerr = WSAGetLastError( );
- if( sockerr )
- {
- strncpy( psz_err, net_strerror( sockerr ), 1001 );
- WSASetLastError( sockerr );
- }
- else
- strncpy( psz_err, strerror( errno ), 1001 );
+ strncpy( psz_err, strerror( errno ), 1001 );
#endif
psz_err[1000] = '\0';
fprintf( stderr, "main warning: can't store message (%s): ", psz_err );
# define RED COL(31)
# define GREEN COL(32)
# define YELLOW COL(33)
-# define WHITE COL(37)
+# define WHITE COL(0)
# define GRAY "\033[0m"
#ifdef UNDER_CE