1
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
2
Date: Mon, 16 Nov 2009 21:48:41 +0100
3
Subject: [PATCH] fix build with xulrunner 1.9.1
6
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=564718
9
plugin/npunix.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++---
10
2 files changed, 168 insertions(+), 9 deletions(-)
12
diff --git a/plugin/npshell.c b/plugin/npshell.c
13
index 0252a02..e1194aa 100644
14
--- a/plugin/npshell.c
15
+++ b/plugin/npshell.c
16
@@ -81,7 +81,6 @@ Contributor(s): Adobe Systems Incorporated.
22
#include "gtk-vnc-plugin.h"
24
diff --git a/plugin/npunix.c b/plugin/npunix.c
25
index 67a72f0..a9bdd88 100644
32
+#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
35
+#include <npfunctions.h>
36
+// For 1.9 compatibility
37
+// ------------------------------------------------
38
+typedef NPError (*NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
39
+#define NewNPN_GetValueProc(FUNC) \
40
+ ((NPN_GetValueUPP) (FUNC))
41
+#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
42
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
44
+typedef NPError (*NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
45
+#define NewNPN_SetValueProc(FUNC) \
46
+ ((NPN_SetValueUPP) (FUNC))
47
+#define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
48
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
50
+typedef NPError (*NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
51
+#define NewNPN_GetURLProc(FUNC) \
52
+ ((NPN_GetURLUPP) (FUNC))
53
+#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
54
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
56
+typedef NPError (*NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
57
+#define NewNPN_GetURLNotifyProc(FUNC) \
58
+ ((NPN_GetURLNotifyUPP) (FUNC))
59
+#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
60
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
62
+typedef NPError (*NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
63
+#define NewNPN_PostURLProc(FUNC) \
64
+ ((NPN_PostURLUPP) (FUNC))
65
+#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
66
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
68
+typedef NPError (*NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
69
+#define NewNPN_PostURLNotifyProc(FUNC) \
70
+ ((NPN_PostURLNotifyUPP) (FUNC))
71
+#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
72
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
74
+typedef NPError (*NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
75
+#define NewNPN_RequestReadProc(FUNC) \
76
+ ((NPN_RequestReadUPP) (FUNC))
77
+#define CallNPN_RequestReadProc(FUNC, stream, range) \
78
+ (*(FUNC))((stream), (range))
80
+typedef NPError (*NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
81
+#define NewNPN_NewStreamProc(FUNC) \
82
+ ((NPN_NewStreamUPP) (FUNC))
83
+#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
84
+ (*(FUNC))((npp), (type), (window), (stream))
86
+typedef int32_t (*NPN_WriteUPP)(NPP instance, NPStream* stream, int32_t len, void* buffer);
87
+#define NewNPN_WriteProc(FUNC) \
88
+ ((NPN_WriteUPP) (FUNC))
89
+#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
90
+ (*(FUNC))((npp), (stream), (len), (buffer))
92
+typedef NPError (*NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
93
+#define NewNPN_DestroyStreamProc(FUNC) \
94
+ ((NPN_DestroyStreamUPP) (FUNC))
95
+#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
96
+ (*(FUNC))((npp), (stream), (reason))
98
+typedef void (*NPN_StatusUPP)(NPP instance, const char* message);
99
+#define NewNPN_StatusProc(FUNC) \
100
+ ((NPN_StatusUPP) (FUNC))
101
+#define CallNPN_StatusProc(FUNC, npp, msg) \
102
+ (*(FUNC))((npp), (msg))
104
+typedef const char* (*NPN_UserAgentUPP)(NPP instance);
105
+#define NewNPN_UserAgentProc(FUNC) \
106
+ ((NPN_UserAgentUPP) (FUNC))
107
+#define CallNPN_UserAgentProc(FUNC, ARG1) \
110
+typedef void* (*NPN_MemAllocUPP)(uint32_t size);
111
+#define NewNPN_MemAllocProc(FUNC) \
112
+ ((NPN_MemAllocUPP) (FUNC))
113
+#define CallNPN_MemAllocProc(FUNC, ARG1) \
116
+typedef void (*NPN_MemFreeUPP)(void* ptr);
117
+#define NewNPN_MemFreeProc(FUNC) \
118
+ ((NPN_MemFreeUPP) (FUNC))
119
+#define CallNPN_MemFreeProc(FUNC, ARG1) \
122
+typedef uint32_t (*NPN_MemFlushUPP)(uint32_t size);
123
+#define NewNPN_MemFlushProc(FUNC) \
124
+ ((NPN_MemFlushUPP) (FUNC))
125
+#define CallNPN_MemFlushProc(FUNC, ARG1) \
128
+typedef void (*NPN_ReloadPluginsUPP)(NPBool reloadPages);
129
+#define NewNPN_ReloadPluginsProc(FUNC) \
130
+ ((NPN_ReloadPluginsUPP) (FUNC))
131
+#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
134
+typedef void (*NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
135
+#define NewNPN_InvalidateRectProc(FUNC) \
136
+ ((NPN_InvalidateRectUPP) (FUNC))
137
+#define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
138
+ (*(FUNC))((ARG1), (ARG2))
140
+typedef void (*NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
141
+#define NewNPN_InvalidateRegionProc(FUNC) \
142
+ ((NPN_InvalidateRegionUPP) (FUNC))
143
+#define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
144
+ (*(FUNC))((ARG1), (ARG2))
146
+typedef void (*NPN_ForceRedrawUPP)(NPP instance);
147
+#define NewNPN_ForceRedrawProc(FUNC) \
148
+ ((NPN_ForceRedrawUPP) (FUNC))
149
+#define CallNPN_ForceRedrawProc(FUNC, ARG1) \
152
+typedef void* (*NPN_GetJavaEnvUPP)();
153
+#define NewNPN_GetJavaEnvProc(FUNC) \
154
+ ((NPN_GetJavaEnvUPP) (FUNC))
155
+#define CallNPN_GetJavaEnvProc(FUNC) \
158
+typedef void* (*NPN_GetJavaPeerUPP)(NPP instance);
159
+#define NewNPN_GetJavaPeerProc(FUNC) \
160
+ ((NPN_GetJavaPeerUPP) (FUNC))
161
+#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
164
+typedef bool (*NPN_PushPopupsEnabledStateUPP)(NPP instance, NPBool enabled);
165
+#define NewNPN_PushPopupsEnabledStateProc(FUNC) \
166
+ ((NPN_PushPopupsEnabledStateUPP) (FUNC))
167
+#define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
168
+ (*(FUNC))((ARG1), (ARG2))
170
+typedef bool (*NPN_PopPopupsEnabledStateUPP)(NPP instance);
171
+#define NewNPN_PopPopupsEnabledStateProc(FUNC) \
172
+ ((NPN_PopPopupsEnabledStateUPP) (FUNC))
173
+#define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
178
#include <glib.h> /* just for G_GNUC_UNUSED */
180
@@ -132,14 +276,14 @@ NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notify
183
NPN_PostURL(NPP instance, const char* url, const char* window,
184
- uint32 len, const char* buf, NPBool file)
185
+ uint32_t len, const char* buf, NPBool file)
187
return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
188
url, window, len, buf, file);
192
-NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len,
193
+NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
194
const char* buf, NPBool file, void* notifyData)
196
return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify,
197
@@ -162,7 +306,7 @@ NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
201
-NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
202
+NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
204
return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
205
stream, len, buffer);
206
@@ -188,7 +332,7 @@ NPN_UserAgent(NPP instance)
210
-NPN_MemAlloc(uint32 size)
211
+NPN_MemAlloc(uint32_t size)
213
return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
215
@@ -198,7 +342,7 @@ void NPN_MemFree(void* ptr)
216
CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
219
-uint32 NPN_MemFlush(uint32 size)
220
+uint32_t NPN_MemFlush(uint32_t size)
222
return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
224
@@ -267,8 +411,8 @@ void NPN_PopPopupsEnabledState(NPP instance)
225
***********************************************************************/
228
-Private_New(NPMIMEType pluginType, NPP instance, uint16 mode,
229
- int16 argc, char* argn[], char* argv[], NPSavedData* saved)
230
+Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode,
231
+ int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
234
PLUGINDEBUGSTR("New");
235
@@ -313,7 +457,7 @@ Private_WriteReady(NPP instance, NPStream* stream)
239
-Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
240
+Private_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len,
244
@@ -499,6 +643,7 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
246
pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
247
pluginFuncs->size = sizeof(NPPluginFuncs);
248
+#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
249
pluginFuncs->newp = NewNPP_NewProc(Private_New);
250
pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy);
251
pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow);
252
@@ -511,6 +656,21 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
253
pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify);
254
pluginFuncs->getvalue = NewNPP_GetValueProc(Private_GetValue);
255
pluginFuncs->event = NewNPP_HandleEventProc(Private_HandleEvent);
257
+ pluginFuncs->newp = (NPP_NewProcPtr)(Private_New);
258
+ pluginFuncs->destroy = (NPP_DestroyProcPtr)(Private_Destroy);
259
+ pluginFuncs->setwindow = (NPP_SetWindowProcPtr)(Private_SetWindow);
260
+ pluginFuncs->newstream = (NPP_NewStreamProcPtr)(Private_NewStream);
261
+ pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(Private_DestroyStream);
262
+ pluginFuncs->asfile = (NPP_StreamAsFileProcPtr)(Private_StreamAsFile);
263
+ pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(Private_WriteReady);
264
+ pluginFuncs->write = (NPP_WriteProcPtr)(Private_Write);
265
+ pluginFuncs->print = (NPP_PrintProcPtr)(Private_Print);
266
+ pluginFuncs->urlnotify = (NPP_URLNotifyProcPtr)(Private_URLNotify);
267
+ pluginFuncs->getvalue = (NPP_GetValueProcPtr)(Private_GetValue);
268
+ pluginFuncs->event = (NPP_HandleEventProcPtr)(Private_HandleEvent);
272
pluginFuncs->javaClass = Private_GetJavaClass();