Commit 310dfdca authored by Damien Fouilleul's avatar Damien Fouilleul

- formating

- javascript fixes
parent 2454f03d
This diff is collapsed.
......@@ -39,7 +39,7 @@ protected:
static const int propertyCount;
static const NPUTF8 * const propertyNames[];
InvokeResult getProperty(int index, NPVariant *result);
InvokeResult getProperty(int index, NPVariant &result);
static const int methodCount;
static const NPUTF8 * const methodNames[];
......@@ -63,13 +63,13 @@ protected:
static const int propertyCount;
static const NPUTF8 * const propertyNames[];
InvokeResult getProperty(int index, NPVariant *result);
InvokeResult setProperty(int index, const NPVariant *value);
InvokeResult getProperty(int index, NPVariant &result);
InvokeResult setProperty(int index, const NPVariant &value);
static const int methodCount;
static const NPUTF8 * const methodNames[];
InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant *result);
InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};
class LibvlcInputNPObject: public RuntimeNPObject
......@@ -86,8 +86,8 @@ protected:
static const int propertyCount;
static const NPUTF8 * const propertyNames[];
InvokeResult getProperty(int index, NPVariant *result);
InvokeResult setProperty(int index, const NPVariant *value);
InvokeResult getProperty(int index, NPVariant &result);
InvokeResult setProperty(int index, const NPVariant &value);
static const int methodCount;
static const NPUTF8 * const methodNames[];
......@@ -106,12 +106,15 @@ protected:
static const int propertyCount;
static const NPUTF8 * const propertyNames[];
InvokeResult getProperty(int index, NPVariant *result);
InvokeResult getProperty(int index, NPVariant &result);
static const int methodCount;
static const NPUTF8 * const methodNames[];
InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant *result);
InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
void parseOptions(const NPString &s, int *i_options, char*** ppsz_options);
void parseOptions(NPObject *obj, int *i_options, char*** ppsz_options);
};
class LibvlcVideoNPObject: public RuntimeNPObject
......@@ -127,13 +130,13 @@ protected:
static const int propertyCount;
static const NPUTF8 * const propertyNames[];
InvokeResult getProperty(int index, NPVariant *result);
InvokeResult setProperty(int index, const NPVariant *value);
InvokeResult getProperty(int index, NPVariant &result);
InvokeResult setProperty(int index, const NPVariant &value);
static const int methodCount;
static const NPUTF8 * const methodNames[];
InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant *result);
InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};
......@@ -35,13 +35,34 @@
#include "nporuntime.h"
#include "vlcplugin.h"
RuntimeNPObject::InvokeResult RuntimeNPObject::getProperty(int index, NPVariant *result)
char* RuntimeNPObject::stringValue(const NPString &s)
{
NPUTF8 *val = new NPUTF8[s.utf8length+1];
if( val )
{
strncpy(val, s.utf8characters, s.utf8length);
val[s.utf8length] = '\0';
}
return val;
}
char* RuntimeNPObject::stringValue(const NPVariant &v)
{
char *s = NULL;
if( NPVARIANT_IS_STRING(v) )
{
return stringValue(NPVARIANT_TO_STRING(v));
}
return s;
}
RuntimeNPObject::InvokeResult RuntimeNPObject::getProperty(int index, NPVariant &result)
{
/* default behaviour */
return INVOKERESULT_GENERIC_ERROR;
}
RuntimeNPObject::InvokeResult RuntimeNPObject::setProperty(int index, const NPVariant *value)
RuntimeNPObject::InvokeResult RuntimeNPObject::setProperty(int index, const NPVariant &value)
{
/* default behaviour */
return INVOKERESULT_GENERIC_ERROR;
......@@ -53,16 +74,16 @@ RuntimeNPObject::InvokeResult RuntimeNPObject::removeProperty(int index)
return INVOKERESULT_GENERIC_ERROR;
}
RuntimeNPObject::InvokeResult RuntimeNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant *result)
RuntimeNPObject::InvokeResult RuntimeNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)
{
/* default beahviour */
return INVOKERESULT_GENERIC_ERROR;
}
RuntimeNPObject::InvokeResult RuntimeNPObject::invokeDefault(const NPVariant *args, uint32_t argCount, NPVariant *result)
RuntimeNPObject::InvokeResult RuntimeNPObject::invokeDefault(const NPVariant *args, uint32_t argCount, NPVariant &result)
{
/* return void */
VOID_TO_NPVARIANT(*result);
VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR;
}
......
......@@ -52,6 +52,9 @@ public:
}
};
static char* stringValue(const NPString &v);
static char* stringValue(const NPVariant &v);
RuntimeNPObject(NPP instance, const NPClass *aClass) :
_instance(instance)
{
......@@ -88,11 +91,11 @@ protected:
uint32_t argCount,
NPVariant *result);
virtual InvokeResult getProperty(int index, NPVariant *result);
virtual InvokeResult setProperty(int index, const NPVariant *value);
virtual InvokeResult getProperty(int index, NPVariant &result);
virtual InvokeResult setProperty(int index, const NPVariant &value);
virtual InvokeResult removeProperty(int index);
virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant *result);
virtual InvokeResult invokeDefault(const NPVariant *args, uint32_t argCount, NPVariant *result);
virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
virtual InvokeResult invokeDefault(const NPVariant *args, uint32_t argCount, NPVariant &result);
bool returnInvokeResult(InvokeResult result);
......@@ -162,7 +165,7 @@ static bool RuntimeNPClassGetProperty(NPObject *npobj, NPIdentifier name, NPVari
if( index != -1 )
{
RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
return vObj->returnInvokeResult(vObj->getProperty(index, result));
return vObj->returnInvokeResult(vObj->getProperty(index, *result));
}
return false;
}
......@@ -175,7 +178,7 @@ static bool RuntimeNPClassSetProperty(NPObject *npobj, NPIdentifier name, const
if( index != -1 )
{
RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
return vObj->returnInvokeResult(vObj->setProperty(index, value));
return vObj->returnInvokeResult(vObj->setProperty(index, *value));
}
return false;
}
......@@ -203,7 +206,7 @@ static bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
if( index != -1 )
{
RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
return vObj->returnInvokeResult(vObj->invoke(index, args, argCount, result));
return vObj->returnInvokeResult(vObj->invoke(index, args, argCount, *result));
}
return false;
......@@ -216,7 +219,7 @@ static bool RuntimeNPClassInvokeDefault(NPObject *npobj,
NPVariant *result)
{
RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
return vObj->returnInvokeResult(vObj->invokeDefault(args, argCount, result));
return vObj->returnInvokeResult(vObj->invokeDefault(args, argCount, *result));
}
template<class T>
......
This diff is collapsed.
......@@ -43,6 +43,6 @@ protected:
static const int methodCount;
static const NPUTF8 * const methodNames[];
virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant *result);
virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment