]> git.sesse.net Git - vlc/commitdiff
* ALL: another bunch of MSVC compilation fixes.
authorGildas Bazin <gbazin@videolan.org>
Thu, 4 Dec 2003 17:15:59 +0000 (17:15 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 4 Dec 2003 17:15:59 +0000 (17:15 +0000)
include/vlc_common.h
include/vlc_messages.h
modules/access/dshow/dshow.cpp
src/misc/messages.c

index d6607956116c1d17f0048851b70e5f82da8dd700..a87c990ae5a427e3bb329c604304d2ac728c65d9 100644 (file)
@@ -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 <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -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;                          \
index 33aacaa62295368e3780e7ce2d98a19af72996b7..53c6ae18ec8b56b347a0224c6471ae6fe893334c 100644 (file)
@@ -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 <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -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
index 09fe1f45f735f6b95a5143446c964ea3d9115f1d..de3d53e57cbea1d7d7c16b2ed8b8d9d008b6685b 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -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 =
index b30b51eb273ed084aaf30e91d6e564bd9eb5e767..d4ae3aa237e24d3d5a4a7f4a367f4875e9713910 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.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 <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -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, ... ) \