From d7d5ed49031490b08774a825e4372e5bf0c2d1bc Mon Sep 17 00:00:00 2001 From: Jean-Paul Saman Date: Fri, 5 Jun 2009 20:53:03 +0200 Subject: [PATCH] xulrunner-1.9.1 patch by Dominique Leuenberger Signed off: Jean-Paul Saman --- projects/mozilla/support/npunix.c | 188 +++++++++++++++++++++++++++++- 1 file changed, 187 insertions(+), 1 deletion(-) diff --git a/projects/mozilla/support/npunix.c b/projects/mozilla/support/npunix.c index 0f6efc0b09..41ceff25a3 100644 --- a/projects/mozilla/support/npunix.c +++ b/projects/mozilla/support/npunix.c @@ -103,149 +103,242 @@ NPN_Version(int* plugin_major, int* plugin_minor, NPError NPN_GetValue(NPP instance, NPNVariable variable, void *r_value) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_GetValueProc(gNetscapeFuncs.getvalue, instance, variable, r_value); +#else + return (*gNetscapeFuncs.getvalue)(instance, variable, r_value); +#endif } NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_SetValueProc(gNetscapeFuncs.setvalue, instance, variable, value); +#else + return (*gNetscapeFuncs.setvalue)(instance, variable, value); +#endif } NPError NPN_GetURL(NPP instance, const char* url, const char* window) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window); +#else + return (*gNetscapeFuncs.geturl)(instance, url, window); +#endif } NPError NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData); +#else + return (*gNetscapeFuncs.geturlnotify)(instance, url, window, notifyData); +#endif } NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance, url, window, len, buf, file); +#else + return (*gNetscapeFuncs.posturl)(instance, url, window, len, buf, file); +#endif } NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify, instance, url, window, len, buf, file, notifyData); +#else + return (*gNetscapeFuncs.posturlnotify)(instance, url, window, len, buf, file, notifyData); + +#endif } NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_RequestReadProc(gNetscapeFuncs.requestread, stream, rangeList); +#else + return (*gNetscapeFuncs.requestread)(stream, rangeList); +#endif } NPError NPN_NewStream(NPP instance, NPMIMEType type, const char *window, NPStream** stream_ptr) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance, type, window, stream_ptr); +#else + return (*gNetscapeFuncs.newstream)(instance, type, window, stream_ptr); +#endif } int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_WriteProc(gNetscapeFuncs.write, instance, stream, len, buffer); +#else + return (*gNetscapeFuncs.write)(instance, stream, len, buffer); +#endif } NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream, instance, stream, reason); +#else + return (*gNetscapeFuncs.destroystream)(instance, stream, reason); +#endif } void NPN_Status(NPP instance, const char* message) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_StatusProc(gNetscapeFuncs.status, instance, message); +#else + (*gNetscapeFuncs.status)(instance, message); +#endif } const char* NPN_UserAgent(NPP instance) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance); +#else + return (*gNetscapeFuncs.uagent)(instance); +#endif } void *NPN_MemAlloc(uint32_t size) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size); +#else + return (*gNetscapeFuncs.memalloc)(size); +#endif } void NPN_MemFree(void* ptr) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr); +#else + (*gNetscapeFuncs.memfree)(ptr); +#endif } uint32_t NPN_MemFlush(uint32_t size) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size); +#else + return (*gNetscapeFuncs.memflush)(size); +#endif } void NPN_ReloadPlugins(NPBool reloadPages) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages); +#else + (*gNetscapeFuncs.reloadplugins)(reloadPages); +#endif } #ifdef OJI JRIEnv* NPN_GetJavaEnv() { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_GetJavaEnvProc(gNetscapeFuncs.getJavaEnv); +#else + return (*gNetscapeFuncs.getJavaEnv); +#endif } jref NPN_GetJavaPeer(NPP instance) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_GetJavaPeerProc(gNetscapeFuncs.getJavaPeer, instance); +#else + return (*gNetscapeFuncs.getJavaPeer)(instance); +#endif } #endif void NPN_InvalidateRect(NPP instance, NPRect *invalidRect) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance, invalidRect); +#else + (*gNetscapeFuncs.invalidaterect)(instance, invalidRect); +#endif } void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance, invalidRegion); +#else + (*gNetscapeFuncs.invalidateregion)(instance, invalidRegion); +#endif } void NPN_ForceRedraw(NPP instance) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance); +#else + (*gNetscapeFuncs.forceredraw)(instance); +#endif } void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_PushPopupsEnabledStateProc(gNetscapeFuncs.pushpopupsenabledstate, instance, enabled); +#else + (*gNetscapeFuncs.pushpopupsenabledstate)(instance, enabled); +#endif } void NPN_PopPopupsEnabledState(NPP instance) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_PopPopupsEnabledStateProc(gNetscapeFuncs.poppopupsenabledstate, instance); +#else + (*gNetscapeFuncs.poppopupsenabledstate)(instance); +#endif } NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) @@ -253,8 +346,12 @@ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_GetStringIdentifierProc( gNetscapeFuncs.getstringidentifier, name); +#else + return (*gNetscapeFuncs.getstringidentifier)(name); +#endif } return NULL; } @@ -265,8 +362,12 @@ void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_GetStringIdentifiersProc(gNetscapeFuncs.getstringidentifiers, names, nameCount, identifiers); +#else + (*gNetscapeFuncs.getstringidentifiers)(names, nameCount, identifiers); +#endif } } @@ -275,7 +376,11 @@ NPIdentifier NPN_GetIntIdentifier(int32_t intid) int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_GetIntIdentifierProc(gNetscapeFuncs.getintidentifier, intid); +#else + return (*gNetscapeFuncs.getintidentifier)(intid); +#endif } return NULL; } @@ -285,9 +390,13 @@ bool NPN_IdentifierIsString(NPIdentifier identifier) int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_IdentifierIsStringProc( gNetscapeFuncs.identifierisstring, identifier); +#else + return (*gNetscapeFuncs.identifierisstring)(identifier); +#endif } return false; } @@ -297,9 +406,13 @@ NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier) int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_UTF8FromIdentifierProc( gNetscapeFuncs.utf8fromidentifier, identifier); +#else + return (*gNetscapeFuncs.utf8fromidentifier)(identifier); +#endif } return NULL; } @@ -309,9 +422,13 @@ int32_t NPN_IntFromIdentifier(NPIdentifier identifier) int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_IntFromIdentifierProc( gNetscapeFuncs.intfromidentifier, identifier); +#else + return (*gNetscapeFuncs.intfromidentifier)(identifier); +#endif } return 0; } @@ -320,7 +437,11 @@ NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_CreateObjectProc(gNetscapeFuncs.createobject, npp, aClass); +#else + return (*gNetscapeFuncs.createobject)(npp, aClass); +#endif return NULL; } @@ -328,7 +449,11 @@ NPObject *NPN_RetainObject(NPObject *obj) { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_RetainObjectProc(gNetscapeFuncs.retainobject, obj); +#else + return (*gNetscapeFuncs.retainobject)(obj); +#endif return NULL; } @@ -336,7 +461,11 @@ void NPN_ReleaseObject(NPObject *obj) { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_ReleaseObjectProc(gNetscapeFuncs.releaseobject, obj); +#else + (*gNetscapeFuncs.releaseobject)(obj); +#endif } bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName, @@ -344,8 +473,12 @@ bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName, { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_InvokeProc(gNetscapeFuncs.invoke, npp, obj, methodName, args, argCount, result); +#else + return (*gNetscapeFuncs.invoke)(npp, obj, methodName, args, argCount, result); +#endif return false; } @@ -354,8 +487,12 @@ bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args, { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_InvokeDefaultProc(gNetscapeFuncs.invokeDefault, npp, obj, args, argCount, result); +#else + return (*gNetscapeFuncs.invokeDefault)(npp, obj, args, argCount, result); +#endif return false; } @@ -364,8 +501,12 @@ bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script, { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_EvaluateProc(gNetscapeFuncs.evaluate, npp, obj, script, result); +#else + return (*gNetscapeFuncs.evaluate)(npp, obj, script, result); +#endif return false; } @@ -374,8 +515,12 @@ bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_GetPropertyProc(gNetscapeFuncs.getproperty, npp, obj, propertyName, result); +#else + return (*gNetscapeFuncs.getproperty)(npp, obj, propertyName, result); +#endif return false; } @@ -384,8 +529,12 @@ bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_SetPropertyProc(gNetscapeFuncs.setproperty, npp, obj, propertyName, value); +#else + return (*gNetscapeFuncs.setproperty)(npp, obj, propertyName, value); +#endif return false; } @@ -393,8 +542,12 @@ bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_RemovePropertyProc(gNetscapeFuncs.removeproperty, npp, obj, propertyName); +#else + return (*gNetscapeFuncs.removeproperty)(npp, obj, propertyName); +#endif return false; } @@ -402,8 +555,12 @@ bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_HasPropertyProc(gNetscapeFuncs.hasproperty, npp, obj, propertyName); +#else + return (*gNetscapeFuncs.hasproperty)(npp, obj, propertyName); +#endif return false; } @@ -411,8 +568,12 @@ bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName) { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) return CallNPN_HasMethodProc(gNetscapeFuncs.hasmethod, npp, obj, methodName); +#else + return (*gNetscapeFuncs.hasmethod)(npp, obj, methodName); +#endif return false; } @@ -420,14 +581,22 @@ void NPN_ReleaseVariantValue(NPVariant *variant) { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_ReleaseVariantValueProc(gNetscapeFuncs.releasevariantvalue, variant); +#else + (*gNetscapeFuncs.releasevariantvalue)(variant); +#endif } void NPN_SetException(NPObject* obj, const NPUTF8 *message) { int minor = gNetscapeFuncs.version & 0xFF; if( minor >= 14 ) +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) CallNPN_SetExceptionProc(gNetscapeFuncs.setexception, obj, message); +#else + (*gNetscapeFuncs.setexception)(obj, message); +#endif } /*********************************************************************** @@ -766,6 +935,7 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs) */ pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; pluginFuncs->size = sizeof(NPPluginFuncs); +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) pluginFuncs->newp = NewNPP_NewProc(Private_New); pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy); pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow); @@ -777,11 +947,27 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs) pluginFuncs->print = NewNPP_PrintProc(Private_Print); pluginFuncs->getvalue = NewNPP_GetValueProc(Private_GetValue); pluginFuncs->setvalue = NewNPP_SetValueProc(Private_SetValue); - +#else + pluginFuncs->newp = (NPP_NewProcPtr)(Private_New); + pluginFuncs->destroy = (NPP_DestroyProcPtr)(Private_Destroy); + pluginFuncs->setwindow = (NPP_SetWindowProcPtr)(Private_SetWindow); + pluginFuncs->newstream = (NPP_NewStreamProcPtr)(Private_NewStream); + pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(Private_DestroyStream); + pluginFuncs->asfile = (NPP_StreamAsFileProcPtr)(Private_StreamAsFile); + pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(Private_WriteReady); + pluginFuncs->write = (NPP_WriteProcPtr)(Private_Write); + pluginFuncs->print = (NPP_PrintProcPtr)(Private_Print); + pluginFuncs->getvalue = (NPP_GetValueProcPtr)(Private_GetValue); + pluginFuncs->setvalue = (NPP_SetValueProcPtr)(Private_SetValue); +#endif pluginFuncs->event = NULL; if( minor >= NPVERS_HAS_NOTIFICATION ) { +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify); +#else + pluginFuncs->urlnotify = (NPP_URLNotifyProcPtr)(Private_URLNotify); +#endif } #ifdef OJI if( minor >= NPVERS_HAS_LIVECONNECT ) -- 2.39.2