Codebase list virt-viewer / 431a46e
New patch 0001-Fix-build-with-xulrunner-1.9.1.patch Fix build with xulrunner 1.9.1 Guido Günther 14 years ago
2 changed file(s) with 273 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
1 Date: Tue, 2 Feb 2010 20:16:52 +0100
2 Subject: [PATCH] Fix build with xulrunner 1.9.1
3
4 ---
5 plugin/npshell.c | 1 -
6 plugin/npunix.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++---
7 2 files changed, 168 insertions(+), 9 deletions(-)
8
9 diff --git a/plugin/npshell.c b/plugin/npshell.c
10 index ccd11a5..c369cf8 100644
11 --- a/plugin/npshell.c
12 +++ b/plugin/npshell.c
13 @@ -84,7 +84,6 @@ Contributor(s): Adobe Systems Incorporated.
14 #include <strings.h>
15
16 #include <npapi.h>
17 -#include <npupp.h>
18
19 #include "virt-viewer-plugin.h"
20
21 diff --git a/plugin/npunix.c b/plugin/npunix.c
22 index ddc4bdf..e17e942 100644
23 --- a/plugin/npunix.c
24 +++ b/plugin/npunix.c
25 @@ -57,7 +57,151 @@
26
27 #include <stdio.h>
28 #include <npapi.h>
29 +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
30 #include <npupp.h>
31 +#else
32 +#include <npfunctions.h>
33 +// For 1.9 compatibility
34 +// ------------------------------------------------
35 +typedef NPError (*NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
36 +#define NewNPN_GetValueProc(FUNC) \
37 + ((NPN_GetValueUPP) (FUNC))
38 +#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
39 + (*(FUNC))((ARG1), (ARG2), (ARG3))
40 +
41 +typedef NPError (*NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
42 +#define NewNPN_SetValueProc(FUNC) \
43 + ((NPN_SetValueUPP) (FUNC))
44 +#define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
45 + (*(FUNC))((ARG1), (ARG2), (ARG3))
46 +
47 +typedef NPError (*NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
48 +#define NewNPN_GetURLProc(FUNC) \
49 + ((NPN_GetURLUPP) (FUNC))
50 +#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
51 + (*(FUNC))((ARG1), (ARG2), (ARG3))
52 +
53 +typedef NPError (*NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
54 +#define NewNPN_GetURLNotifyProc(FUNC) \
55 + ((NPN_GetURLNotifyUPP) (FUNC))
56 +#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
57 + (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
58 +
59 +typedef NPError (*NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
60 +#define NewNPN_PostURLProc(FUNC) \
61 + ((NPN_PostURLUPP) (FUNC))
62 +#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
63 + (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
64 +
65 +typedef NPError (*NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
66 +#define NewNPN_PostURLNotifyProc(FUNC) \
67 + ((NPN_PostURLNotifyUPP) (FUNC))
68 +#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
69 + (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
70 +
71 +typedef NPError (*NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
72 +#define NewNPN_RequestReadProc(FUNC) \
73 + ((NPN_RequestReadUPP) (FUNC))
74 +#define CallNPN_RequestReadProc(FUNC, stream, range) \
75 + (*(FUNC))((stream), (range))
76 +
77 +typedef NPError (*NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
78 +#define NewNPN_NewStreamProc(FUNC) \
79 + ((NPN_NewStreamUPP) (FUNC))
80 +#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
81 + (*(FUNC))((npp), (type), (window), (stream))
82 +
83 +typedef int32_t (*NPN_WriteUPP)(NPP instance, NPStream* stream, int32_t len, void* buffer);
84 +#define NewNPN_WriteProc(FUNC) \
85 + ((NPN_WriteUPP) (FUNC))
86 +#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
87 + (*(FUNC))((npp), (stream), (len), (buffer))
88 +
89 +typedef NPError (*NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
90 +#define NewNPN_DestroyStreamProc(FUNC) \
91 + ((NPN_DestroyStreamUPP) (FUNC))
92 +#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
93 + (*(FUNC))((npp), (stream), (reason))
94 +
95 +typedef void (*NPN_StatusUPP)(NPP instance, const char* message);
96 +#define NewNPN_StatusProc(FUNC) \
97 + ((NPN_StatusUPP) (FUNC))
98 +#define CallNPN_StatusProc(FUNC, npp, msg) \
99 + (*(FUNC))((npp), (msg))
100 +
101 +typedef const char* (*NPN_UserAgentUPP)(NPP instance);
102 +#define NewNPN_UserAgentProc(FUNC) \
103 + ((NPN_UserAgentUPP) (FUNC))
104 +#define CallNPN_UserAgentProc(FUNC, ARG1) \
105 + (*(FUNC))((ARG1))
106 +
107 +typedef void* (*NPN_MemAllocUPP)(uint32_t size);
108 +#define NewNPN_MemAllocProc(FUNC) \
109 + ((NPN_MemAllocUPP) (FUNC))
110 +#define CallNPN_MemAllocProc(FUNC, ARG1) \
111 + (*(FUNC))((ARG1))
112 +
113 +typedef void (*NPN_MemFreeUPP)(void* ptr);
114 +#define NewNPN_MemFreeProc(FUNC) \
115 + ((NPN_MemFreeUPP) (FUNC))
116 +#define CallNPN_MemFreeProc(FUNC, ARG1) \
117 + (*(FUNC))((ARG1))
118 +
119 +typedef uint32_t (*NPN_MemFlushUPP)(uint32_t size);
120 +#define NewNPN_MemFlushProc(FUNC) \
121 + ((NPN_MemFlushUPP) (FUNC))
122 +#define CallNPN_MemFlushProc(FUNC, ARG1) \
123 + (*(FUNC))((ARG1))
124 +
125 +typedef void (*NPN_ReloadPluginsUPP)(NPBool reloadPages);
126 +#define NewNPN_ReloadPluginsProc(FUNC) \
127 + ((NPN_ReloadPluginsUPP) (FUNC))
128 +#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
129 + (*(FUNC))((ARG1))
130 +
131 +typedef void (*NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
132 +#define NewNPN_InvalidateRectProc(FUNC) \
133 + ((NPN_InvalidateRectUPP) (FUNC))
134 +#define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
135 + (*(FUNC))((ARG1), (ARG2))
136 +
137 +typedef void (*NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
138 +#define NewNPN_InvalidateRegionProc(FUNC) \
139 + ((NPN_InvalidateRegionUPP) (FUNC))
140 +#define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
141 + (*(FUNC))((ARG1), (ARG2))
142 +
143 +typedef void (*NPN_ForceRedrawUPP)(NPP instance);
144 +#define NewNPN_ForceRedrawProc(FUNC) \
145 + ((NPN_ForceRedrawUPP) (FUNC))
146 +#define CallNPN_ForceRedrawProc(FUNC, ARG1) \
147 + (*(FUNC))((ARG1))
148 +
149 +typedef void* (*NPN_GetJavaEnvUPP)();
150 +#define NewNPN_GetJavaEnvProc(FUNC) \
151 + ((NPN_GetJavaEnvUPP) (FUNC))
152 +#define CallNPN_GetJavaEnvProc(FUNC) \
153 + (*(FUNC))()
154 +
155 +typedef void* (*NPN_GetJavaPeerUPP)(NPP instance);
156 +#define NewNPN_GetJavaPeerProc(FUNC) \
157 + ((NPN_GetJavaPeerUPP) (FUNC))
158 +#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
159 + (*(FUNC))((ARG1))
160 +
161 +typedef bool (*NPN_PushPopupsEnabledStateUPP)(NPP instance, NPBool enabled);
162 +#define NewNPN_PushPopupsEnabledStateProc(FUNC) \
163 + ((NPN_PushPopupsEnabledStateUPP) (FUNC))
164 +#define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
165 + (*(FUNC))((ARG1), (ARG2))
166 +
167 +typedef bool (*NPN_PopPopupsEnabledStateUPP)(NPP instance);
168 +#define NewNPN_PopPopupsEnabledStateProc(FUNC) \
169 + ((NPN_PopPopupsEnabledStateUPP) (FUNC))
170 +#define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
171 + (*(FUNC))((ARG1))
172 +
173 +#endif
174
175 #include <glib.h> /* just for G_GNUC_UNUSED */
176
177 @@ -134,14 +278,14 @@ NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notify
178
179 NPError
180 NPN_PostURL(NPP instance, const char* url, const char* window,
181 - uint32 len, const char* buf, NPBool file)
182 + uint32_t len, const char* buf, NPBool file)
183 {
184 return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
185 url, window, len, buf, file);
186 }
187
188 NPError
189 -NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len,
190 +NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
191 const char* buf, NPBool file, void* notifyData)
192 {
193 return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify,
194 @@ -164,7 +308,7 @@ NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
195 }
196
197 int32
198 -NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
199 +NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
200 {
201 return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
202 stream, len, buffer);
203 @@ -190,7 +334,7 @@ NPN_UserAgent(NPP instance)
204 }
205
206 void*
207 -NPN_MemAlloc(uint32 size)
208 +NPN_MemAlloc(uint32_t size)
209 {
210 return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
211 }
212 @@ -200,7 +344,7 @@ void NPN_MemFree(void* ptr)
213 CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
214 }
215
216 -uint32 NPN_MemFlush(uint32 size)
217 +uint32_t NPN_MemFlush(uint32_t size)
218 {
219 return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
220 }
221 @@ -269,8 +413,8 @@ void NPN_PopPopupsEnabledState(NPP instance)
222 ***********************************************************************/
223
224 static NPError
225 -Private_New(NPMIMEType pluginType, NPP instance, uint16 mode,
226 - int16 argc, char* argn[], char* argv[], NPSavedData* saved)
227 +Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode,
228 + int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
229 {
230 NPError ret;
231 PLUGINDEBUGSTR("New");
232 @@ -315,7 +459,7 @@ Private_WriteReady(NPP instance, NPStream* stream)
233 }
234
235 static int32
236 -Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
237 +Private_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len,
238 void* buffer)
239 {
240 unsigned int result;
241 @@ -501,6 +645,7 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
242 */
243 pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
244 pluginFuncs->size = sizeof(NPPluginFuncs);
245 +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
246 pluginFuncs->newp = NewNPP_NewProc(Private_New);
247 pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy);
248 pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow);
249 @@ -513,6 +658,21 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
250 pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify);
251 pluginFuncs->getvalue = NewNPP_GetValueProc(Private_GetValue);
252 pluginFuncs->event = NewNPP_HandleEventProc(Private_HandleEvent);
253 +#else
254 + pluginFuncs->newp = (NPP_NewProcPtr)(Private_New);
255 + pluginFuncs->destroy = (NPP_DestroyProcPtr)(Private_Destroy);
256 + pluginFuncs->setwindow = (NPP_SetWindowProcPtr)(Private_SetWindow);
257 + pluginFuncs->newstream = (NPP_NewStreamProcPtr)(Private_NewStream);
258 + pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(Private_DestroyStream);
259 + pluginFuncs->asfile = (NPP_StreamAsFileProcPtr)(Private_StreamAsFile);
260 + pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(Private_WriteReady);
261 + pluginFuncs->write = (NPP_WriteProcPtr)(Private_Write);
262 + pluginFuncs->print = (NPP_PrintProcPtr)(Private_Print);
263 + pluginFuncs->urlnotify = (NPP_URLNotifyProcPtr)(Private_URLNotify);
264 + pluginFuncs->getvalue = (NPP_GetValueProcPtr)(Private_GetValue);
265 + pluginFuncs->event = (NPP_HandleEventProcPtr)(Private_HandleEvent);
266 +#endif
267 +
268 #ifdef OJI
269 pluginFuncs->javaClass = Private_GetJavaClass();
270 #endif
271 --
0 0001-Fix-build-with-xulrunner-1.9.1.patch