[Spice-commits] 2 commits - SpiceXPI/src
Peter Hatina
phatina at kemper.freedesktop.org
Mon Dec 10 04:07:51 PST 2012
SpiceXPI/src/plugin/np_entry.cpp | 52 ++-----------------------------
SpiceXPI/src/plugin/nsScriptablePeer.cpp | 12 +++++--
2 files changed, 14 insertions(+), 50 deletions(-)
New commits:
commit cc1c1169b1ddab5fc664bd169db086e29ecd6af5
Author: Federico Simoncelli <fsimonce at redhat.com>
Date: Mon Dec 10 13:08:07 2012 +0100
fix issues in ScriptablePluginObject::SetProperty
diff --git a/SpiceXPI/src/plugin/nsScriptablePeer.cpp b/SpiceXPI/src/plugin/nsScriptablePeer.cpp
index caab9b7..622659c 100644
--- a/SpiceXPI/src/plugin/nsScriptablePeer.cpp
+++ b/SpiceXPI/src/plugin/nsScriptablePeer.cpp
@@ -242,12 +242,14 @@ bool ScriptablePluginObject::SetProperty(NPIdentifier name, const NPVariant *val
return false;
std::string str;
+ std::stringstream ss;
PRBool boolean = false;
unsigned short val = -1;
if (NPVARIANT_IS_STRING(*value))
{
- str = NPVARIANT_TO_STRING(*value).UTF8Characters;
+ str.assign(NPVARIANT_TO_STRING(*value).UTF8Characters,
+ NPVARIANT_TO_STRING(*value).UTF8Length);
}
else if (NPVARIANT_IS_BOOLEAN(*value))
{
@@ -256,8 +258,12 @@ bool ScriptablePluginObject::SetProperty(NPIdentifier name, const NPVariant *val
else if (NPVARIANT_IS_INT32(*value))
{
val = NPVARIANT_TO_INT32(*value);
-
- std::stringstream ss;
+ ss << val;
+ ss >> str;
+ }
+ else if (NPVARIANT_IS_DOUBLE(*value))
+ {
+ val = NPVARIANT_TO_DOUBLE(*value);
ss << val;
ss >> str;
}
commit e3722a60d097228277061e8331b45b39117467cc
Author: Federico Simoncelli <fsimonce at redhat.com>
Date: Mon Dec 10 13:06:35 2012 +0100
support smaller NPNetscapeFuncs tables
diff --git a/SpiceXPI/src/plugin/np_entry.cpp b/SpiceXPI/src/plugin/np_entry.cpp
index 4eba645..44f677b 100644
--- a/SpiceXPI/src/plugin/np_entry.cpp
+++ b/SpiceXPI/src/plugin/np_entry.cpp
@@ -45,6 +45,7 @@
// Main plugin entry point implementation -- exports from the
// plugin library
//
+#include <string.h>
#include "npplat.h"
#include "pluginbase.h"
@@ -111,53 +112,10 @@ static NPError fillNetscapeFunctionTable(NPNetscapeFuncs *aNPNFuncs)
if (HIBYTE(aNPNFuncs->version) > NP_VERSION_MAJOR)
return NPERR_INCOMPATIBLE_VERSION_ERROR;
- if (aNPNFuncs->size < sizeof(NPNetscapeFuncs))
- return NPERR_INVALID_FUNCTABLE_ERROR;
-
- NPNFuncs.size = aNPNFuncs->size;
- NPNFuncs.version = aNPNFuncs->version;
- NPNFuncs.geturlnotify = aNPNFuncs->geturlnotify;
- NPNFuncs.geturl = aNPNFuncs->geturl;
- NPNFuncs.posturlnotify = aNPNFuncs->posturlnotify;
- NPNFuncs.posturl = aNPNFuncs->posturl;
- NPNFuncs.requestread = aNPNFuncs->requestread;
- NPNFuncs.newstream = aNPNFuncs->newstream;
- NPNFuncs.write = aNPNFuncs->write;
- NPNFuncs.destroystream = aNPNFuncs->destroystream;
- NPNFuncs.status = aNPNFuncs->status;
- NPNFuncs.uagent = aNPNFuncs->uagent;
- NPNFuncs.memalloc = aNPNFuncs->memalloc;
- NPNFuncs.memfree = aNPNFuncs->memfree;
- NPNFuncs.memflush = aNPNFuncs->memflush;
- NPNFuncs.reloadplugins = aNPNFuncs->reloadplugins;
- NPNFuncs.getvalue = aNPNFuncs->getvalue;
- NPNFuncs.setvalue = aNPNFuncs->setvalue;
- NPNFuncs.invalidaterect = aNPNFuncs->invalidaterect;
- NPNFuncs.invalidateregion = aNPNFuncs->invalidateregion;
- NPNFuncs.forceredraw = aNPNFuncs->forceredraw;
- NPNFuncs.getstringidentifier = aNPNFuncs->getstringidentifier;
- NPNFuncs.getstringidentifiers = aNPNFuncs->getstringidentifiers;
- NPNFuncs.getintidentifier = aNPNFuncs->getintidentifier;
- NPNFuncs.identifierisstring = aNPNFuncs->identifierisstring;
- NPNFuncs.utf8fromidentifier = aNPNFuncs->utf8fromidentifier;
- NPNFuncs.intfromidentifier = aNPNFuncs->intfromidentifier;
- NPNFuncs.createobject = aNPNFuncs->createobject;
- NPNFuncs.retainobject = aNPNFuncs->retainobject;
- NPNFuncs.releaseobject = aNPNFuncs->releaseobject;
- NPNFuncs.invoke = aNPNFuncs->invoke;
- NPNFuncs.invokeDefault = aNPNFuncs->invokeDefault;
- NPNFuncs.evaluate = aNPNFuncs->evaluate;
- NPNFuncs.getproperty = aNPNFuncs->getproperty;
- NPNFuncs.setproperty = aNPNFuncs->setproperty;
- NPNFuncs.removeproperty = aNPNFuncs->removeproperty;
- NPNFuncs.hasproperty = aNPNFuncs->hasproperty;
- NPNFuncs.hasmethod = aNPNFuncs->hasmethod;
- NPNFuncs.releasevariantvalue = aNPNFuncs->releasevariantvalue;
- NPNFuncs.setexception = aNPNFuncs->setexception;
-#ifdef OJI
- NPNFuncs.getJavaEnv = aNPNFuncs->getJavaEnv;
- NPNFuncs.getJavaPeer = aNPNFuncs->getJavaPeer;
-#endif
+ memset(&NPNFuncs, 0, sizeof(NPNetscapeFuncs));
+ memmove(&NPNFuncs, aNPNFuncs,
+ (aNPNFuncs->size < sizeof(NPNetscapeFuncs)) ?
+ aNPNFuncs->size : sizeof(NPNetscapeFuncs));
return NPERR_NO_ERROR;
}
More information about the Spice-commits
mailing list