[vlc-devel] commit: Use native C/C++ boolean type ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Mar 17 20:11:31 CET 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Mon Mar 17 20:04:45 2008 +0200| [2e7e22467bd0ba3d9ef6cb2211fab3133ae40486]

Use native C/C++ boolean type

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2e7e22467bd0ba3d9ef6cb2211fab3133ae40486
---

 include/vlc/vlc.h                              |    8 +++++---
 modules/access/bda/bda.c                       |    2 +-
 modules/access/dvb/access.c                    |    2 +-
 modules/access/fake.c                          |    2 +-
 modules/demux/live555.cpp                      |    2 +-
 modules/gui/macosx/voutgl.m                    |    2 +-
 modules/gui/macosx/voutqt.m                    |    2 +-
 modules/gui/minimal_macosx/VLCOpenGLVoutView.m |    2 +-
 modules/video_output/msw/events.c              |    2 +-
 modules/video_output/x11/xcommon.c             |    2 +-
 src/input/es_out.c                             |    4 ++--
 11 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/include/vlc/vlc.h b/include/vlc/vlc.h
index d8e00dc..53e5e18 100644
--- a/include/vlc/vlc.h
+++ b/include/vlc/vlc.h
@@ -38,12 +38,14 @@
 
 # ifdef __cplusplus
 extern "C" {
+# else
+#  include <stdbool.h>
 # endif
 
 /*****************************************************************************
  * Our custom types
  *****************************************************************************/
-typedef int vlc_bool_t;
+typedef bool vlc_bool_t;
 typedef struct vlc_list_t vlc_list_t;
 typedef struct vlc_object_t vlc_object_t;
 
@@ -131,8 +133,8 @@ struct vlc_list_t
 /*****************************************************************************
  * Booleans
  *****************************************************************************/
-#define VLC_FALSE 0
-#define VLC_TRUE  1
+#define VLC_FALSE false
+#define VLC_TRUE  true
 
 /*****************************************************************************
  * Playlist
diff --git a/modules/access/bda/bda.c b/modules/access/bda/bda.c
index 563f627..37aa963 100644
--- a/modules/access/bda/bda.c
+++ b/modules/access/bda/bda.c
@@ -525,7 +525,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
 
     case ACCESS_SET_PRIVATE_ID_STATE: /* 11 */
         i_int  = (int)va_arg( args, int );
-        b_bool = (vlc_bool_t)va_arg( args, vlc_bool_t );
+        b_bool = (bool)va_arg( args, int );
         break;
     case ACCESS_SET_PRIVATE_ID_CA:  /* 12 -From Demux */
         break;
diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index 7547d75..685a186 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -551,7 +551,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
 
         case ACCESS_SET_PRIVATE_ID_STATE:
             i_int  = (int)va_arg( args, int );               /* Private data (pid for now)*/
-            b_bool = (vlc_bool_t)va_arg( args, vlc_bool_t ); /* b_selected */
+            b_bool = (bool)va_arg( args, int ); /* b_selected */
             if( !p_sys->b_budget_mode )
             {
                 /* FIXME we may want to give the real type (me ?, I don't ;) */
diff --git a/modules/access/fake.c b/modules/access/fake.c
index 93ae851..d5cf5c3 100644
--- a/modules/access/fake.c
+++ b/modules/access/fake.c
@@ -153,7 +153,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return VLC_SUCCESS;
 
         case DEMUX_SET_PAUSE_STATE:
-            b = (vlc_bool_t)va_arg( args, vlc_bool_t );
+            b = (bool)va_arg( args, int );
             if ( b )
             {
                 p_sys->i_pause_pts = mdate();
diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index 9e5035b..ea58cca 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -1374,7 +1374,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             double d_npt = (double) p_sys->i_npt / I64C(1000000);
             int i;
 
-            b_bool = (vlc_bool_t)va_arg( args, vlc_bool_t );
+            b_bool = (bool)va_arg( args, int );
             if( p_sys->rtsp == NULL )
                 return VLC_EGENERIC;
 
diff --git a/modules/gui/macosx/voutgl.m b/modules/gui/macosx/voutgl.m
index 182f2f4..0ed822e 100644
--- a/modules/gui/macosx/voutgl.m
+++ b/modules/gui/macosx/voutgl.m
@@ -271,7 +271,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
     switch( i_query )
     {
         case VOUT_SET_STAY_ON_TOP:
-            b_arg = va_arg( args, vlc_bool_t );
+            b_arg = (bool) va_arg( args, int );
             [p_vout->p_sys->o_vout_view setOnTop: b_arg];
             return VLC_SUCCESS;
 
diff --git a/modules/gui/macosx/voutqt.m b/modules/gui/macosx/voutqt.m
index 6e053e7..88370bd 100644
--- a/modules/gui/macosx/voutqt.m
+++ b/modules/gui/macosx/voutqt.m
@@ -459,7 +459,7 @@ static int ControlVideo( vout_thread_t *p_vout, int i_query, va_list args )
     switch( i_query )
     {
         case VOUT_SET_STAY_ON_TOP:
-            b_arg = va_arg( args, vlc_bool_t );
+            b_arg = (bool) va_arg( args, int );
             [p_vout->p_sys->o_vout_view setOnTop: b_arg];
             return VLC_SUCCESS;
 
diff --git a/modules/gui/minimal_macosx/VLCOpenGLVoutView.m b/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
index 7da994f..8ca9012 100644
--- a/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
+++ b/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
@@ -147,7 +147,7 @@ int cocoaglvoutviewControl( vout_thread_t *p_vout, int i_query, va_list args )
     switch( i_query )
     {
         case VOUT_SET_STAY_ON_TOP:
-            b_arg = va_arg( args, vlc_bool_t );
+            b_arg = (bool) va_arg( args, int );
             [[p_vout->p_sys->o_glview container] setOnTop: b_arg];
             return VLC_SUCCESS;
 
diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index 975519f..d2769ae 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -1129,7 +1129,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
 
 #ifdef MODULE_NAME_IS_wingapi
     case VOUT_SET_FOCUS:
-        b_bool = va_arg( args, vlc_bool_t );
+        b_bool = (bool) va_arg( args, int );
         p_vout->p_sys->b_parent_focus = b_bool;
         if( b_bool ) GXResume();
         else if( !p_vout->p_sys->b_focus ) GXSuspend();
diff --git a/modules/video_output/x11/xcommon.c b/modules/video_output/x11/xcommon.c
index 0563c19..e9829c7 100644
--- a/modules/video_output/x11/xcommon.c
+++ b/modules/video_output/x11/xcommon.c
@@ -3139,7 +3139,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
                 return vout_ControlWindow( p_vout,
                     (void *)p_vout->p_sys->p_win->owner_window, i_query, args);
 
-            b_arg = va_arg( args, vlc_bool_t );
+            b_arg = (bool) va_arg( args, int );
             vlc_mutex_lock( &p_vout->p_sys->lock );
 #ifdef MODULE_NAME_IS_xvmc
             xvmc_context_reader_lock( &p_vout->p_sys->xvmc_lock );
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 768b66a..733d907 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1562,7 +1562,7 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
     {
         case ES_OUT_SET_ES_STATE:
             es = (es_out_id_t*) va_arg( args, es_out_id_t * );
-            b = (vlc_bool_t) va_arg( args, vlc_bool_t );
+            b = (bool) va_arg( args, int );
             if( b && !EsIsSelected( es ) )
             {
                 EsSelect( out, es );
@@ -1584,7 +1584,7 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
 
         case ES_OUT_SET_ACTIVE:
         {
-            b = (vlc_bool_t) va_arg( args, vlc_bool_t );
+            b = (bool) va_arg( args, int );
             p_sys->b_active = b;
             /* Needed ? */
             if( b )




More information about the vlc-devel mailing list