diff options
author | Federico Simoncelli <fsimonce@redhat.com> | 2012-12-10 13:06:35 +0100 |
---|---|---|
committer | Peter Hatina <phatina@redhat.com> | 2012-12-10 13:06:35 +0100 |
commit | e3722a60d097228277061e8331b45b39117467cc (patch) | |
tree | 8494a6909687385b24b41f4b23ec1b6499c9cf7e /SpiceXPI | |
parent | 792aa02fc887af2678a51334750524ab20c48735 (diff) |
support smaller NPNetscapeFuncs tables
Diffstat (limited to 'SpiceXPI')
-rw-r--r-- | SpiceXPI/src/plugin/np_entry.cpp | 52 |
1 files changed, 5 insertions, 47 deletions
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; } |