[PATCH] fix build with xulrunner 1.9.1
- From: Guido Günther <agx sigxcpu org>
- Subject: [PATCH] fix build with xulrunner 1.9.1
- Date: Mon, 16 Nov 2009 21:48:41 +0100
---
plugin/npshell.c | 1 -
plugin/npunix.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 168 insertions(+), 9 deletions(-)
diff --git a/plugin/npshell.c b/plugin/npshell.c
index 0252a02..e1194aa 100644
--- a/plugin/npshell.c
+++ b/plugin/npshell.c
@@ -81,7 +81,6 @@ Contributor(s): Adobe Systems Incorporated.
#include <string.h>
#include <npapi.h>
-#include <npupp.h>
#include "gtk-vnc-plugin.h"
diff --git a/plugin/npunix.c b/plugin/npunix.c
index 67a72f0..a9bdd88 100644
--- a/plugin/npunix.c
+++ b/plugin/npunix.c
@@ -55,7 +55,151 @@
#include <stdio.h>
#include <npapi.h>
+#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
#include <npupp.h>
+#else
+#include <npfunctions.h>
+// For 1.9 compatibility
+// ------------------------------------------------
+typedef NPError (*NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
+#define NewNPN_GetValueProc(FUNC) \
+ ((NPN_GetValueUPP) (FUNC))
+#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
+
+typedef NPError (*NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
+#define NewNPN_SetValueProc(FUNC) \
+ ((NPN_SetValueUPP) (FUNC))
+#define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
+
+typedef NPError (*NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
+#define NewNPN_GetURLProc(FUNC) \
+ ((NPN_GetURLUPP) (FUNC))
+#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
+
+typedef NPError (*NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
+#define NewNPN_GetURLNotifyProc(FUNC) \
+ ((NPN_GetURLNotifyUPP) (FUNC))
+#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
+
+typedef NPError (*NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
+#define NewNPN_PostURLProc(FUNC) \
+ ((NPN_PostURLUPP) (FUNC))
+#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
+
+typedef NPError (*NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
+#define NewNPN_PostURLNotifyProc(FUNC) \
+ ((NPN_PostURLNotifyUPP) (FUNC))
+#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
+
+typedef NPError (*NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
+#define NewNPN_RequestReadProc(FUNC) \
+ ((NPN_RequestReadUPP) (FUNC))
+#define CallNPN_RequestReadProc(FUNC, stream, range) \
+ (*(FUNC))((stream), (range))
+
+typedef NPError (*NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
+#define NewNPN_NewStreamProc(FUNC) \
+ ((NPN_NewStreamUPP) (FUNC))
+#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
+ (*(FUNC))((npp), (type), (window), (stream))
+
+typedef int32_t (*NPN_WriteUPP)(NPP instance, NPStream* stream, int32_t len, void* buffer);
+#define NewNPN_WriteProc(FUNC) \
+ ((NPN_WriteUPP) (FUNC))
+#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
+ (*(FUNC))((npp), (stream), (len), (buffer))
+
+typedef NPError (*NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
+#define NewNPN_DestroyStreamProc(FUNC) \
+ ((NPN_DestroyStreamUPP) (FUNC))
+#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
+ (*(FUNC))((npp), (stream), (reason))
+
+typedef void (*NPN_StatusUPP)(NPP instance, const char* message);
+#define NewNPN_StatusProc(FUNC) \
+ ((NPN_StatusUPP) (FUNC))
+#define CallNPN_StatusProc(FUNC, npp, msg) \
+ (*(FUNC))((npp), (msg))
+
+typedef const char* (*NPN_UserAgentUPP)(NPP instance);
+#define NewNPN_UserAgentProc(FUNC) \
+ ((NPN_UserAgentUPP) (FUNC))
+#define CallNPN_UserAgentProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+typedef void* (*NPN_MemAllocUPP)(uint32_t size);
+#define NewNPN_MemAllocProc(FUNC) \
+ ((NPN_MemAllocUPP) (FUNC))
+#define CallNPN_MemAllocProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+typedef void (*NPN_MemFreeUPP)(void* ptr);
+#define NewNPN_MemFreeProc(FUNC) \
+ ((NPN_MemFreeUPP) (FUNC))
+#define CallNPN_MemFreeProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+typedef uint32_t (*NPN_MemFlushUPP)(uint32_t size);
+#define NewNPN_MemFlushProc(FUNC) \
+ ((NPN_MemFlushUPP) (FUNC))
+#define CallNPN_MemFlushProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+typedef void (*NPN_ReloadPluginsUPP)(NPBool reloadPages);
+#define NewNPN_ReloadPluginsProc(FUNC) \
+ ((NPN_ReloadPluginsUPP) (FUNC))
+#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+typedef void (*NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
+#define NewNPN_InvalidateRectProc(FUNC) \
+ ((NPN_InvalidateRectUPP) (FUNC))
+#define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
+ (*(FUNC))((ARG1), (ARG2))
+
+typedef void (*NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
+#define NewNPN_InvalidateRegionProc(FUNC) \
+ ((NPN_InvalidateRegionUPP) (FUNC))
+#define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
+ (*(FUNC))((ARG1), (ARG2))
+
+typedef void (*NPN_ForceRedrawUPP)(NPP instance);
+#define NewNPN_ForceRedrawProc(FUNC) \
+ ((NPN_ForceRedrawUPP) (FUNC))
+#define CallNPN_ForceRedrawProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+typedef void* (*NPN_GetJavaEnvUPP)();
+#define NewNPN_GetJavaEnvProc(FUNC) \
+ ((NPN_GetJavaEnvUPP) (FUNC))
+#define CallNPN_GetJavaEnvProc(FUNC) \
+ (*(FUNC))()
+
+typedef void* (*NPN_GetJavaPeerUPP)(NPP instance);
+#define NewNPN_GetJavaPeerProc(FUNC) \
+ ((NPN_GetJavaPeerUPP) (FUNC))
+#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+typedef bool (*NPN_PushPopupsEnabledStateUPP)(NPP instance, NPBool enabled);
+#define NewNPN_PushPopupsEnabledStateProc(FUNC) \
+ ((NPN_PushPopupsEnabledStateUPP) (FUNC))
+#define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
+ (*(FUNC))((ARG1), (ARG2))
+
+typedef bool (*NPN_PopPopupsEnabledStateUPP)(NPP instance);
+#define NewNPN_PopPopupsEnabledStateProc(FUNC) \
+ ((NPN_PopPopupsEnabledStateUPP) (FUNC))
+#define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+#endif
#include <glib.h> /* just for G_GNUC_UNUSED */
@@ -132,14 +276,14 @@ NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notify
NPError
NPN_PostURL(NPP instance, const char* url, const char* window,
- uint32 len, const char* buf, NPBool file)
+ uint32_t len, const char* buf, NPBool file)
{
return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
url, window, len, buf, file);
}
NPError
-NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len,
+NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
const char* buf, NPBool file, void* notifyData)
{
return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify,
@@ -162,7 +306,7 @@ NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
}
int32
-NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
+NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
{
return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
stream, len, buffer);
@@ -188,7 +332,7 @@ NPN_UserAgent(NPP instance)
}
void*
-NPN_MemAlloc(uint32 size)
+NPN_MemAlloc(uint32_t size)
{
return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
}
@@ -198,7 +342,7 @@ void NPN_MemFree(void* ptr)
CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
}
-uint32 NPN_MemFlush(uint32 size)
+uint32_t NPN_MemFlush(uint32_t size)
{
return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
}
@@ -267,8 +411,8 @@ void NPN_PopPopupsEnabledState(NPP instance)
***********************************************************************/
static NPError
-Private_New(NPMIMEType pluginType, NPP instance, uint16 mode,
- int16 argc, char* argn[], char* argv[], NPSavedData* saved)
+Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode,
+ int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
{
NPError ret;
PLUGINDEBUGSTR("New");
@@ -313,7 +457,7 @@ Private_WriteReady(NPP instance, NPStream* stream)
}
static int32
-Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
+Private_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len,
void* buffer)
{
unsigned int result;
@@ -499,6 +643,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);
@@ -511,6 +656,21 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify);
pluginFuncs->getvalue = NewNPP_GetValueProc(Private_GetValue);
pluginFuncs->event = NewNPP_HandleEventProc(Private_HandleEvent);
+#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->urlnotify = (NPP_URLNotifyProcPtr)(Private_URLNotify);
+ pluginFuncs->getvalue = (NPP_GetValueProcPtr)(Private_GetValue);
+ pluginFuncs->event = (NPP_HandleEventProcPtr)(Private_HandleEvent);
+#endif
+
#ifdef OJI
pluginFuncs->javaClass = Private_GetJavaClass();
#endif
--
1.6.5.2
--+QahgC5+KEYLbs62--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]