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

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


npapi-vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed May  6 16:24:59 2015 +0200| [61cc2aa138ef3e2b6fe6cc710da923f68398c24a] | 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=61cc2aa138ef3e2b6fe6cc710da923f68398c24a
---

 npapi/npruntime/npolibvlc.cpp |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

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;
 



More information about the vlc-commits mailing list