[vlc-devel] commit: Cosmetics: activex plugin: add a helper for bool -> VARIANT_BOOL. ( JP Dinger )

git version control git at videolan.org
Fri Jan 29 16:55:03 CET 2010


vlc | branch: master | JP Dinger <jpd at videolan.org> | Tue Jan 26 10:30:04 2010 +0100| [8fa162cf3e9cb372e6d470c62841b3aa1d328ad7] | committer: JP Dinger 

Cosmetics: activex plugin: add a helper for bool -> VARIANT_BOOL.

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

 projects/activex/vlccontrol2.cpp |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/projects/activex/vlccontrol2.cpp b/projects/activex/vlccontrol2.cpp
index 3490e91..a32686f 100644
--- a/projects/activex/vlccontrol2.cpp
+++ b/projects/activex/vlccontrol2.cpp
@@ -87,8 +87,10 @@ HRESULT object_get(I **dst, I *src)
     return E_OUTOFMEMORY;
 }
 
-// ---------
+static inline
+VARIANT_BOOL varbool(bool b) { return b ? VARIANT_TRUE : VARIANT_FALSE; }
 
+// ---------
 
 STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute)
 {
@@ -98,8 +100,7 @@ STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute)
     libvlc_instance_t* p_libvlc;
     HRESULT hr = getVLC(&p_libvlc);
     if( SUCCEEDED(hr) )
-        *mute = libvlc_audio_get_mute(p_libvlc) ?
-                        VARIANT_TRUE : VARIANT_FALSE;
+        *mute = varbool( libvlc_audio_get_mute(p_libvlc) );
     return hr;
 };
 
@@ -460,8 +461,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
 
-        *hasVout = libvlc_media_player_has_vout(p_md, &ex) ?
-                                VARIANT_TRUE : VARIANT_FALSE;
+        *hasVout = varbool( libvlc_media_player_has_vout(p_md, &ex) );
         hr = exception_bridge(&ex);
     }
     return hr;
@@ -635,8 +635,7 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
 
-        *isPlaying = libvlc_media_player_is_playing(p_md) ?
-                     VARIANT_TRUE: VARIANT_FALSE;
+        *isPlaying = varbool( libvlc_media_player_is_playing(p_md) );
         libvlc_exception_clear(&ex);
     }
     return hr;
@@ -944,8 +943,7 @@ STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen)
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
 
-        *fullscreen = libvlc_get_fullscreen(p_md, &ex) ?
-                      VARIANT_TRUE : VARIANT_FALSE;
+        *fullscreen = varbool( libvlc_get_fullscreen(p_md, &ex) );
         hr = exception_bridge(&ex);
     }
     return hr;
@@ -1537,7 +1535,7 @@ STDMETHODIMP VLCControl2::get_AutoLoop(VARIANT_BOOL *autoloop)
     if( NULL == autoloop )
         return E_POINTER;
 
-    *autoloop = _p_instance->getAutoLoop() ? VARIANT_TRUE: VARIANT_FALSE;
+    *autoloop = varbool( _p_instance->getAutoLoop() );
     return S_OK;
 };
 
@@ -1552,7 +1550,7 @@ STDMETHODIMP VLCControl2::get_AutoPlay(VARIANT_BOOL *autoplay)
     if( NULL == autoplay )
         return E_POINTER;
 
-    *autoplay = _p_instance->getAutoPlay() ? VARIANT_TRUE: VARIANT_FALSE;
+    *autoplay = varbool( _p_instance->getAutoPlay() );
     return S_OK;
 };
 
@@ -1614,7 +1612,7 @@ STDMETHODIMP VLCControl2::get_Toolbar(VARIANT_BOOL *visible)
      */
 
     /* DISABLED for now */
-    //  *visible = _p_instance->getShowToolbar() ? VARIANT_TRUE: VARIANT_FALSE;
+    //  *visible = varbool( _p_instance->getShowToolbar() );
 
     *visible = VARIANT_FALSE;
 
@@ -1666,7 +1664,7 @@ STDMETHODIMP VLCControl2::get_Visible(VARIANT_BOOL *isVisible)
     if( NULL == isVisible )
         return E_POINTER;
 
-    *isVisible = _p_instance->getVisible() ? VARIANT_TRUE : VARIANT_FALSE;
+    *isVisible = varbool( _p_instance->getVisible() );
 
     return NOERROR;
 };




More information about the vlc-devel mailing list