[vlc-devel] [PATCH] npapi: use the correct return values instead of break
Daniel Amm
da2424 at t-online.de
Sun May 17 17:34:29 CEST 2015
---
npapi/npruntime/npolibvlc.cpp | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/npapi/npruntime/npolibvlc.cpp b/npapi/npruntime/npolibvlc.cpp
index e241c80..598995a 100644
--- a/npapi/npruntime/npolibvlc.cpp
+++ b/npapi/npruntime/npolibvlc.cpp
@@ -181,7 +181,7 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index,
if ( !npapi::is_string( args[0] ) ||
!listener.is<NPObject>() )
- break;
+ return INVOKERESULT_INVALID_ARGS;
if( !VlcPluginBase::canUseEventListener() )
{
@@ -1589,16 +1589,12 @@ LibvlcMarqueeNPObject::getProperty(int index, npapi::OutVariant& result)
case ID_marquee_position:
result = position_bynumber( mp.marqueeInt( libvlc_marquee_Position ) );
- break;
+ return INVOKERESULT_NO_ERROR;
case ID_marquee_text:
auto marquee = mp.marqueeString( libvlc_marquee_Text );
- if( !marquee.empty() )
- {
- result = marquee;
- return INVOKERESULT_NO_ERROR;
- }
- break;
+ result = marquee;
+ return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_GENERIC_ERROR;
}
@@ -1626,12 +1622,11 @@ LibvlcMarqueeNPObject::setProperty(int index, const NPVariant &value)
case ID_marquee_size:
case ID_marquee_x:
case ID_marquee_y:
- if( v.is<int>() )
- {
- mp.setMarqueeInt( marquee_idx[index], v );
- return INVOKERESULT_NO_ERROR;
- }
- break;
+ if( !v.is<int>() )
+ return INVOKERESULT_INVALID_VALUE;
+
+ mp.setMarqueeInt( marquee_idx[index], v );
+ return INVOKERESULT_NO_ERROR;
case ID_marquee_position:
if( !v.is<const char*>() ||
@@ -1642,12 +1637,11 @@ LibvlcMarqueeNPObject::setProperty(int index, const NPVariant &value)
return INVOKERESULT_NO_ERROR;
case ID_marquee_text:
- if( v.is<const char*>() )
- {
- mp.setMarqueeString( libvlc_marquee_Text, v );
- return INVOKERESULT_NO_ERROR;
- }
- break;
+ if( !v.is<const char*>() )
+ return INVOKERESULT_INVALID_VALUE;
+
+ mp.setMarqueeString( libvlc_marquee_Text, v );
+ return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_SUCH_METHOD;
}
--
2.1.4
More information about the vlc-devel
mailing list