From: Gildas Bazin Date: Thu, 4 Dec 2003 17:15:59 +0000 (+0000) Subject: * ALL: another bunch of MSVC compilation fixes. X-Git-Tag: 0.7.0~228 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=e304db6b4223cf58800f401e06712690389dd82d;p=vlc * ALL: another bunch of MSVC compilation fixes. --- diff --git a/include/vlc_common.h b/include/vlc_common.h index d660795611..a87c990ae5 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -3,7 +3,7 @@ * Collection of useful common types and macros definitions ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: vlc_common.h,v 1.94 2003/12/04 16:02:54 sam Exp $ + * $Id: vlc_common.h,v 1.95 2003/12/04 17:15:59 gbazin Exp $ * * Authors: Samuel Hocevar * Vincent Seguin @@ -450,13 +450,14 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */ #define TAB_APPEND( count, tab, p ) \ if( (count) > 0 ) \ { \ - (void *)(tab) = realloc( (tab), sizeof( void ** ) * ( (count) + 1 ) );\ + (*(void **)(&tab)) = \ + realloc( tab, sizeof( void ** ) * ( (count) + 1 ) ); \ } \ else \ { \ - (void *)(tab) = malloc( sizeof( void ** ) ); \ + (*(void **)(&tab)) = malloc( sizeof( void ** ) ); \ } \ - (void**)(tab)[(count)] = (void*)(p); \ + ((void**)(tab))[count] = (void*)(p); \ (count)++ #define TAB_FIND( count, tab, p, index ) \ @@ -465,7 +466,7 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */ (index) = -1; \ for( _i_ = 0; _i_ < (count); _i_++ ) \ { \ - if((void**)(tab)[_i_]==(void*)(p)) \ + if( ((void**)(tab))[_i_] == (void*)(p) ) \ { \ (index) = _i_; \ break; \ diff --git a/include/vlc_messages.h b/include/vlc_messages.h index 33aacaa622..53c6ae18ec 100644 --- a/include/vlc_messages.h +++ b/include/vlc_messages.h @@ -4,7 +4,7 @@ * interface, such as message output. ***************************************************************************** * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN - * $Id: vlc_messages.h,v 1.9 2003/12/03 23:01:48 sigmunau Exp $ + * $Id: vlc_messages.h,v 1.10 2003/12/04 17:15:59 gbazin Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -104,6 +104,7 @@ struct msg_subscription_t * Prototypes *****************************************************************************/ VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 4, 5 ) ); +VLC_EXPORT( void, __msg_GenericVa, ( vlc_object_t *, int, const char *, const char *, va_list args ) ); VLC_EXPORT( void, __msg_Info, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); VLC_EXPORT( void, __msg_Err, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); VLC_EXPORT( void, __msg_Warn, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); @@ -127,7 +128,42 @@ VLC_EXPORT( void, __msg_Dbg, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_ __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_DBG, MODULE_STRING, \ psz_format, ## args ) -#else /* HAVE_VARIADIC_MACROS */ +#elif defined(_MSC_VER) /* To avoid warnings and even errors with c++ files */ + +inline void msg_Info( void *p_this, const char *psz_format, ... ) +{ + va_list ap; + va_start( ap, psz_format ); + __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_INFO, MODULE_STRING, + psz_format, ap ); + va_end(ap); +} +inline void msg_Err( void *p_this, const char *psz_format, ... ) +{ + va_list ap; + va_start( ap, psz_format ); + __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_ERR, MODULE_STRING, + psz_format, ap ); + va_end(ap); +} +inline void msg_Warn( void *p_this, const char *psz_format, ... ) +{ + va_list ap; + va_start( ap, psz_format ); + __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_WARN, MODULE_STRING, + psz_format, ap ); + va_end(ap); +} +inline void msg_Dbg( void *p_this, const char *psz_format, ... ) +{ + va_list ap; + va_start( ap, psz_format ); + __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_DBG, MODULE_STRING, + psz_format, ap ); + va_end(ap); +} + +#else /* _MSC_VER */ # define msg_Info __msg_Info # define msg_Err __msg_Err diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp index 09fe1f45f7..de3d53e57c 100644 --- a/modules/access/dshow/dshow.cpp +++ b/modules/access/dshow/dshow.cpp @@ -2,7 +2,7 @@ * dshow.cpp : DirectShow access module for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: dshow.cpp,v 1.19 2003/12/04 16:49:43 sam Exp $ + * $Id: dshow.cpp,v 1.20 2003/12/04 17:15:59 gbazin Exp $ * * Author: Gildas Bazin * @@ -310,7 +310,7 @@ static int AccessOpen( vlc_object_t *p_this ) p_input->i_pts_delay = val.i_int * 1000; /* Initialize OLE/COM */ - CoInitializeEx( 0, COINIT_APARTMENTTHREADED ); + CoInitialize( 0 ); /* create access private data */ p_input->p_access_data = p_sys = diff --git a/src/misc/messages.c b/src/misc/messages.c index b30b51eb27..d4ae3aa237 100644 --- a/src/misc/messages.c +++ b/src/misc/messages.c @@ -4,7 +4,7 @@ * modules, especially intf modules. See config.h for output configuration. ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: messages.c,v 1.36 2003/12/03 23:01:48 sigmunau Exp $ + * $Id: messages.c,v 1.37 2003/12/04 17:15:59 gbazin Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -229,6 +229,12 @@ void __msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module, va_end( args ); } +void __msg_GenericVa( vlc_object_t *p_this, int i_type, const char *psz_module, + const char *psz_format, va_list args ) +{ + QueueMsg( p_this, i_type, psz_module, psz_format, args ); +} + /* Generic functions used when variadic macros are not available. */ #define DECLARE_MSG_FN( FN_NAME, FN_TYPE ) \ void FN_NAME( vlc_object_t *p_this, const char *psz_format, ... ) \