[vlc-commits] npapi: Fix potentially invalid conversion from NPVariant to scalar types

Hugo Beauzée-Luyssen git at videolan.org
Wed May 6 16:20:34 CEST 2015


npapi-vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed May  6 16:12:28 2015 +0200| [a7303bcd3a3ff56e6f550d2e4e841c6952971164] | committer: Hugo Beauzée-Luyssen

npapi: Fix potentially invalid conversion from NPVariant to scalar types

Overload resolution rules tend to chose the overload that matches the instance constness, which is operator NPVariant*() in this case.
ref #14500

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

 extras/macosx/build-plugin.sh |    2 --
 npapi/npruntime/npolibvlc.cpp |   28 ++++++++++++++--------------
 npapi/vlcplugin_base.h        |    2 +-
 npapi/vlcplugin_gtk.cpp       |    2 +-
 npapi/vlcplugin_gtk.h         |    2 +-
 npapi/vlcplugin_mac.h         |    2 +-
 npapi/vlcplugin_mac.mm        |    2 +-
 npapi/vlcplugin_win.cpp       |    2 +-
 npapi/vlcplugin_win.h         |    2 +-
 npapi/vlcplugin_xcb.cpp       |    2 +-
 npapi/vlcplugin_xcb.h         |    2 +-
 npapi/vlcwindowless_base.h    |    2 +-
 12 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/extras/macosx/build-plugin.sh b/extras/macosx/build-plugin.sh
index da9ccbd..3ec5656 100755
--- a/extras/macosx/build-plugin.sh
+++ b/extras/macosx/build-plugin.sh
@@ -100,8 +100,6 @@ info "Bootstrapping"
 ./autogen.sh
 fi
 
-git submodule update --init
-
 info "Creating builddir and configuration"
 mkdir -p ${ARCH}-build && cd ${ARCH}-build
 ../configure --build=${ARCH}-apple-darwin10
diff --git a/npapi/npruntime/npolibvlc.cpp b/npapi/npruntime/npolibvlc.cpp
index 494c4f0..e241c80 100644
--- a/npapi/npruntime/npolibvlc.cpp
+++ b/npapi/npruntime/npolibvlc.cpp
@@ -177,7 +177,7 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index,
             return INVOKERESULT_INVALID_ARGS;
 
         // Don't wrap eventName as it would copy the string even though it's not required.
-        auto listener = npapi::Variant( args[1] );
+        const npapi::Variant listener( args[1] );
 
         if ( !npapi::is_string( args[0] ) ||
             !listener.is<NPObject>() )
@@ -285,7 +285,7 @@ LibvlcAudioNPObject::setProperty(int index, const NPVariant &value)
         if( !mp )
             RETURN_ON_ERROR;
 
-        auto v = npapi::Variant( value );
+        const npapi::Variant v( value );
         switch( index )
         {
             case ID_audio_mute:
@@ -364,7 +364,7 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args,
             {
                 if ( argCount < 1 )
                     return INVOKERESULT_INVALID_ARGS;
-                auto v = npapi::Variant( args[0] );
+                const npapi::Variant v( args[0] );
                 if( v.is<int>() )
                 {
                     auto tracks = mp.audioTrackDescription();
@@ -485,7 +485,7 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
         if( !mp )
             RETURN_ON_ERROR;
 
-        auto v = npapi::Variant( value );
+        const npapi::Variant v( value );
         switch( index )
         {
             case ID_input_position:
@@ -729,7 +729,7 @@ LibvlcPlaylistItemsNPObject::invoke(int index, const NPVariant *args,
             {
                 if ( argCount < 1 )
                     return INVOKERESULT_INVALID_ARGS;
-                auto v = npapi::Variant( args[0] );
+                const npapi::Variant v( args[0] );
                 if( v.is<int>() )
                 {
                     if( !p_plugin->player().delete_item( v ) )
@@ -893,7 +893,7 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
                 // grab options if available
                 if( argCount > 2 )
                 {
-                    npapi::Variant v = args[2];
+                    const npapi::Variant v( args[2] );
                     if( v.is<std::nullptr_t>() )
                     {
                         // do nothing
@@ -937,7 +937,7 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
             {
                 if ( argCount < 1 )
                     return INVOKERESULT_INVALID_ARGS;
-                npapi::Variant v = args[0];
+                const npapi::Variant v( args[0] );
                 if ( v.is<int>() )
                 {
                     p_plugin->player().mlp().playItemAtIndex( v );
@@ -991,7 +991,7 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
             {
                 if ( argCount < 1 )
                     return INVOKERESULT_INVALID_ARGS;
-                npapi::Variant v = args[0];
+                const npapi::Variant v( args[0] );
                 if ( v.is<int>() )
                 {
                     if( !p_plugin->player().delete_item( v ) )
@@ -1203,7 +1203,7 @@ LibvlcSubtitleNPObject::setProperty(int index, const NPVariant &value)
         {
             case ID_subtitle_track:
             {
-                auto v = npapi::Variant( value );
+                const npapi::Variant v( value );
                 if( v.is<int>() )
                 {
                     auto tracks = mp.spuDescription();
@@ -1248,7 +1248,7 @@ LibvlcSubtitleNPObject::invoke(int index, const NPVariant *args,
             {
                 if ( argCount < 1 )
                     return INVOKERESULT_INVALID_ARGS;
-                auto v = npapi::Variant( args[0] );
+                const npapi::Variant v( args[0] );
                 if ( v.is<int>() )
                 {
                     auto tracks = mp.spuDescription();
@@ -1407,7 +1407,7 @@ LibvlcVideoNPObject::setProperty(int index, const NPVariant &value)
         if( !mp )
             RETURN_ON_ERROR;
 
-        auto v = npapi::Variant( value );
+        const npapi::Variant v( value );
 
         switch( index )
         {
@@ -1616,7 +1616,7 @@ LibvlcMarqueeNPObject::setProperty(int index, const NPVariant &value)
     if( !mp )
         RETURN_ON_ERROR;
 
-    auto v = npapi::Variant( value );
+    const npapi::Variant v( value );
     switch( index )
     {
     case ID_marquee_color:
@@ -1755,7 +1755,7 @@ LibvlcLogoNPObject::setProperty(int index, const NPVariant &value)
     if( !mp )
         RETURN_ON_ERROR;
 
-    auto v = npapi::Variant( value );
+    const npapi::Variant v( value );
 
     switch( index )
     {
@@ -1904,7 +1904,7 @@ LibvlcDeinterlaceNPObject::invoke(int index, const NPVariant *args,
     {
         if( argCount < 1 )
             return INVOKERESULT_INVALID_VALUE;
-        auto v = npapi::Variant( args[0] );
+        const npapi::Variant v( args[0] );
         if ( !v.is<const char*>() )
             return INVOKERESULT_INVALID_VALUE;
 
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index 2ad70cd..721219a 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -108,7 +108,7 @@ public:
 
     virtual void toggle_fullscreen() = 0;
     virtual void set_fullscreen(int) = 0;
-    virtual bool get_fullscreen() = 0;
+    virtual int get_fullscreen() = 0;
 
     virtual void set_toolbar_visible(bool) = 0;
     virtual bool get_toolbar_visible() = 0;
diff --git a/npapi/vlcplugin_gtk.cpp b/npapi/vlcplugin_gtk.cpp
index 7bb44f5..ca54f6c 100644
--- a/npapi/vlcplugin_gtk.cpp
+++ b/npapi/vlcplugin_gtk.cpp
@@ -121,7 +121,7 @@ void VlcPluginGtk::set_fullscreen(int yes)
     }
 }
 
-bool VlcPluginGtk::get_fullscreen()
+int VlcPluginGtk::get_fullscreen()
 {
     return is_fullscreen;
 }
diff --git a/npapi/vlcplugin_gtk.h b/npapi/vlcplugin_gtk.h
index e9adbc5..91df8ae 100644
--- a/npapi/vlcplugin_gtk.h
+++ b/npapi/vlcplugin_gtk.h
@@ -44,7 +44,7 @@ public:
 
     void toggle_fullscreen();
     void set_fullscreen(int);
-    bool get_fullscreen();
+    int get_fullscreen();
     void do_set_fullscreen(bool);
 
     void set_toolbar_visible(bool);
diff --git a/npapi/vlcplugin_mac.h b/npapi/vlcplugin_mac.h
index a686806..0a554e8 100644
--- a/npapi/vlcplugin_mac.h
+++ b/npapi/vlcplugin_mac.h
@@ -38,7 +38,7 @@ public:
 
     void toggle_fullscreen();
     void set_fullscreen( int );
-    bool get_fullscreen();
+    int  get_fullscreen();
 
     bool create_windows();
     bool resize_windows();
diff --git a/npapi/vlcplugin_mac.mm b/npapi/vlcplugin_mac.mm
index abe2759..251f8a7 100644
--- a/npapi/vlcplugin_mac.mm
+++ b/npapi/vlcplugin_mac.mm
@@ -255,7 +255,7 @@ void VlcPluginMac::set_fullscreen(int i_value)
     this->update_controls();
 }
 
-bool  VlcPluginMac::get_fullscreen()
+int  VlcPluginMac::get_fullscreen()
 {
     return libvlc_get_fullscreen(getMD());
 }
diff --git a/npapi/vlcplugin_win.cpp b/npapi/vlcplugin_win.cpp
index 4326148..e81fc07 100644
--- a/npapi/vlcplugin_win.cpp
+++ b/npapi/vlcplugin_win.cpp
@@ -137,7 +137,7 @@ void VlcPluginWin::set_fullscreen(int yes)
     }
 }
 
-bool VlcPluginWin::get_fullscreen()
+int  VlcPluginWin::get_fullscreen()
 {
     return _WindowsManager.IsFullScreen();
 }
diff --git a/npapi/vlcplugin_win.h b/npapi/vlcplugin_win.h
index 4eb6f12..2f7a6d2 100644
--- a/npapi/vlcplugin_win.h
+++ b/npapi/vlcplugin_win.h
@@ -41,7 +41,7 @@ public:
 
     void toggle_fullscreen();
     void set_fullscreen( int );
-    bool get_fullscreen();
+    int  get_fullscreen();
 
     bool create_windows();
     bool resize_windows();
diff --git a/npapi/vlcplugin_xcb.cpp b/npapi/vlcplugin_xcb.cpp
index 87685d9..d833d71 100644
--- a/npapi/vlcplugin_xcb.cpp
+++ b/npapi/vlcplugin_xcb.cpp
@@ -60,7 +60,7 @@ void VlcPluginXcb::set_fullscreen(int yes)
         player().get_mp().setFullscreen( yes );
 }
 
-bool VlcPluginXcb::get_fullscreen()
+int VlcPluginXcb::get_fullscreen()
 {
     if (player().mlp().isPlaying())
         return player().get_mp().fullscreen();
diff --git a/npapi/vlcplugin_xcb.h b/npapi/vlcplugin_xcb.h
index e90a5c9..f66d372 100644
--- a/npapi/vlcplugin_xcb.h
+++ b/npapi/vlcplugin_xcb.h
@@ -36,7 +36,7 @@ public:
 
     void toggle_fullscreen();
     void set_fullscreen( int );
-    bool get_fullscreen();
+    int  get_fullscreen();
 
     bool create_windows();
     bool resize_windows();
diff --git a/npapi/vlcwindowless_base.h b/npapi/vlcwindowless_base.h
index 0e5614b..483e92f 100644
--- a/npapi/vlcwindowless_base.h
+++ b/npapi/vlcwindowless_base.h
@@ -70,7 +70,7 @@ public:
 
     void toggle_fullscreen() { /* STUB */ }
     void set_fullscreen( int ) { /* STUB */ }
-    bool get_fullscreen() { return false; }
+    int  get_fullscreen() { return false; }
 
     void set_toolbar_visible(bool)  { /* STUB */ }
     bool get_toolbar_visible()  { return false; }



More information about the vlc-commits mailing list