Merge lp:~jazzva/nspluginwrapper/1.3.0 into lp:nspluginwrapper
- 1.3.0
- Merge into ubuntu
Status: | Needs review |
---|---|
Proposed branch: | lp:~jazzva/nspluginwrapper/1.3.0 |
Merge into: | lp:nspluginwrapper |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~jazzva/nspluginwrapper/1.3.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexander Sack | Pending | ||
Review via email: mp+9961@code.launchpad.net |
Commit message
Description of the change
- 54. By Saša Bodiroža
-
Uncommit 0ubuntu6 changes from ubuntu-dev's branch, and directly apply diff from the archive
* debian/
patches/ use_syslsb. patch; dont build LSB libs on our own;
this should unbreak flash+nspluginwrapper after latest ia32-libs
update
+ use USE_SYSTEM_LSB accordingly in debian/rules - 55. By Saša Bodiroža
-
releasing version 1.2.2-0ubuntu6
- 56. By Saša Bodiroža
-
Merge with upstream branch r1.1.7
- 57. By Saša Bodiroža
-
Add initial changelog entry
- 58. By Saša Bodiroža
-
Update Maintainer field in debian/control, as proposed by
DebianMaintainerField spec - 59. By Saša Bodiroža
-
* Update debian/
patches/ 000_debian_ make_symlinks. diff
- change short option for "nosymlinks" from "n" to "s" to avoid collision
with option "native"
- add option "nosymlinks" to print_usage() - 60. By Saša Bodiroža
-
* Update debian/
patches/ 003_update_ help_info. diff because of change in
debian/patches/ 000_debian_ make_symlinks. diff
* Refresh patches - 61. By Saša Bodiroža
-
Update debian/
patches/ use_syslsb. patch because of different Makefile - 62. By Saša Bodiroža
-
Add patch debian/
patches/ 004_system_ only_update. diff from Debian
version 1.2.2-1 - 63. By Saša Bodiroža
-
change short option for "nosymlinks" from "n" to "x" to avoid collision
- 64. By Saša Bodiroža
-
Update .bzr-builddeb/
default. conf - 65. By Saša Bodiroža
-
Add LP bug number to debian/changelog
- 66. By Saša Bodiroža
-
Add patch debian/
patches/ 000_allow_ empty_short_ option. diff to allow no short
option for some parameter. - 67. By Saša Bodiroža
-
Increment indices in the name of all previous patches.
- 68. By Saša Bodiroža
-
Refresh patches
- 69. By Saša Bodiroža
-
Attribute the patch 000_allow_
empty_short_ option. diff to Alexander Sack - 70. By Saša Bodiroža
-
* Remove short option "x" for "nosymlinks" option in
debian/patches/ 001_debian_ make_symlinks. diff
- Update debian/patches/ 004_update_ help_info. diff
- Update debian/patches/ 005_system_ only_update. diff - 71. By Saša Bodiroža
-
releasing version 1.3.0-0ubuntu1
Unmerged revisions
- 71. By Saša Bodiroža
-
releasing version 1.3.0-0ubuntu1
- 70. By Saša Bodiroža
-
* Remove short option "x" for "nosymlinks" option in
debian/patches/ 001_debian_ make_symlinks. diff
- Update debian/patches/ 004_update_ help_info. diff
- Update debian/patches/ 005_system_ only_update. diff - 69. By Saša Bodiroža
-
Attribute the patch 000_allow_
empty_short_ option. diff to Alexander Sack - 68. By Saša Bodiroža
-
Refresh patches
- 67. By Saša Bodiroža
-
Increment indices in the name of all previous patches.
- 66. By Saša Bodiroža
-
Add patch debian/
patches/ 000_allow_ empty_short_ option. diff to allow no short
option for some parameter. - 65. By Saša Bodiroža
-
Add LP bug number to debian/changelog
- 64. By Saša Bodiroža
-
Update .bzr-builddeb/
default. conf - 63. By Saša Bodiroža
-
change short option for "nosymlinks" from "n" to "x" to avoid collision
- 62. By Saša Bodiroža
-
Add patch debian/
patches/ 004_system_ only_update. diff from Debian
version 1.2.2-1
Preview Diff
1 | === modified file '.bzr-builddeb/default.conf' | |||
2 | --- .bzr-builddeb/default.conf 2009-01-02 10:12:06 +0000 | |||
3 | +++ .bzr-builddeb/default.conf 2009-08-11 01:33:30 +0000 | |||
4 | @@ -1,5 +1,5 @@ | |||
5 | 1 | [BUILDDEB] | 1 | [BUILDDEB] |
6 | 2 | merge=True | 2 | merge=True |
7 | 3 | export-upstream = . | 3 | export-upstream = . |
9 | 4 | export-upstream-revision = revid:jazzva@gmail.com-20090102100727-yx8scdwpkmh9xace | 4 | export-upstream-revision = revid:jazzva@gmail.com-20090811003842-htca2u6z7nfh10w3 |
10 | 5 | 5 | ||
11 | 6 | 6 | ||
12 | === modified file 'ChangeLog' | |||
13 | --- ChangeLog 2009-01-02 10:07:27 +0000 | |||
14 | +++ ChangeLog 2009-08-11 00:38:42 +0000 | |||
15 | @@ -1,8 +1,58 @@ | |||
21 | 1 | 2009-01-01 07:36 Gwenole Beauchesne <gb.public@free.fr> | 1 | 2009-01-02 08:50 Gwenole Beauchesne <gb.public@free.fr> |
22 | 2 | 2 | ||
23 | 3 | * NEWS, nspluginwrapper.spec: Updates for 1.2.2. | 3 | * NEWS, nspluginwrapper.spec: Fix spelling. |
24 | 4 | 4 | ||
25 | 5 | 2009-01-01 07:34 Gwenole Beauchesne <gb.public@free.fr> | 5 | 2009-01-01 20:51 Gwenole Beauchesne <gb.public@free.fr> |
26 | 6 | |||
27 | 7 | * src/rpc.c: Factor our socket creation. | ||
28 | 8 | |||
29 | 9 | 2009-01-01 20:26 Gwenole Beauchesne <gb.public@free.fr> | ||
30 | 10 | |||
31 | 11 | * src/npruntime-impl.h, src/npruntime.c, src/npw-viewer.c: Make it | ||
32 | 12 | possible to disable NPIdentifier cache with | ||
33 | 13 | NPW_NPRUNTIME_CACHE=no too. | ||
34 | 14 | |||
35 | 15 | 2009-01-01 17:58 Gwenole Beauchesne <gb.public@free.fr> | ||
36 | 16 | |||
37 | 17 | * NEWS, nspluginwrapper.spec: Updates for 1.3.0. | ||
38 | 18 | |||
39 | 19 | 2009-01-01 17:56 Gwenole Beauchesne <gb.public@free.fr> | ||
40 | 20 | |||
41 | 21 | * configure, lsb-build/headers/glib-2.0/glib.h, | ||
42 | 22 | lsb-build/stub_libs/libglib-2.0.c: Add g_hash_table_find() and | ||
43 | 23 | g_hash_table_remove_all() thunks. Besides, for bi-arch builds, | ||
44 | 24 | it's assumed that 32-/64-bit glib versions are the same and | ||
45 | 25 | exports the same functions. | ||
46 | 26 | |||
47 | 27 | 2009-01-01 17:46 Gwenole Beauchesne <gb.public@free.fr> | ||
48 | 28 | |||
49 | 29 | * src/npw-viewer.c: Add NPIdentifier cache. | ||
50 | 30 | |||
51 | 31 | 2009-01-01 15:13 Gwenole Beauchesne <gb.public@free.fr> | ||
52 | 32 | |||
53 | 33 | * src/npruntime-impl.h, src/npruntime.c: Add NPClass::HasMethod | ||
54 | 34 | cache so that to lower RPC round-trip. | ||
55 | 35 | |||
56 | 36 | 2009-01-01 13:54 Gwenole Beauchesne <gb.public@free.fr> | ||
57 | 37 | |||
58 | 38 | * src/npw-viewer.c: Forcibly destroy the Xt source on exit. | ||
59 | 39 | |||
60 | 40 | 2009-01-01 11:02 Gwenole Beauchesne <gb.public@free.fr> | ||
61 | 41 | |||
62 | 42 | * NEWS: Updates. | ||
63 | 43 | |||
64 | 44 | 2009-01-01 10:58 Gwenole Beauchesne <gb.public@free.fr> | ||
65 | 45 | |||
66 | 46 | * src/npw-viewer.c: Don't create Xt polling sources if we know the | ||
67 | 47 | plug-in uses Gtk (XEMBED). | ||
68 | 48 | |||
69 | 49 | 2009-01-01 10:33 Gwenole Beauchesne <gb.public@free.fr> | ||
70 | 50 | |||
71 | 51 | * src/npw-viewer.c: Get rid of the extra 25ms timer. The Xt timers | ||
72 | 52 | & input sources are now | ||
73 | 53 | checked in the X events source ::prepare() function. | ||
74 | 54 | |||
75 | 55 | 2009-01-01 07:31 Gwenole Beauchesne <gb.public@free.fr> | ||
76 | 6 | 56 | ||
77 | 7 | * Makefile, NEWS, README, configure, src/cxxabi-compat.cpp, | 57 | * Makefile, NEWS, README, configure, src/cxxabi-compat.cpp, |
78 | 8 | src/debug.c, src/debug.h, src/libxpcom.c, src/npruntime-impl.h, | 58 | src/debug.c, src/debug.h, src/libxpcom.c, src/npruntime-impl.h, |
79 | @@ -17,85 +67,186 @@ | |||
80 | 17 | utils/getdeps.sh, utils/mkruntime.sh, utils/repackage.sh: Update | 67 | utils/getdeps.sh, utils/mkruntime.sh, utils/repackage.sh: Update |
81 | 18 | copyright notices. | 68 | copyright notices. |
82 | 19 | 69 | ||
145 | 20 | 2008-12-28 11:36 Gwenole Beauchesne <gb.public@free.fr> | 70 | 2008-12-29 15:14 Gwenole Beauchesne <gb.public@free.fr> |
146 | 21 | 71 | ||
147 | 22 | * NEWS, src/npw-malloc.c, src/npw-malloc.h, src/npw-viewer.c: | 72 | * src/npw-config.c: Fix upgrades from previous versions. |
148 | 23 | Backport from trunk: | 73 | |
149 | 24 | 74 | 2008-12-29 14:53 Gwenole Beauchesne <gb.public@free.fr> | |
150 | 25 | Make sure NPWindow::ws_info points to a unique location for the | 75 | |
151 | 26 | lifetime of the window. This fixes support for the VLC plugin | 76 | * Makefile, nspluginwrapper.spec: Rename loader script to |
152 | 27 | that makes a local copy of NPWindow but doesn't bother about | 77 | npviewer.sh. |
153 | 28 | making an NPWindow::ws_info copy. | 78 | |
154 | 29 | 79 | 2008-12-29 14:52 Gwenole Beauchesne <gb.public@free.fr> | |
155 | 30 | 2008-12-26 23:37 Gwenole Beauchesne <gb.public@free.fr> | 80 | |
156 | 31 | 81 | * Makefile, configure, src/npw-config.c, src/npw-wrapper.c, | |
157 | 32 | * NEWS: Updates with "hot" fixes. | 82 | src/sysdeps.h: Make it possible to use alternate viewer paths |
158 | 33 | 83 | with --viewer-paths configure option. By default, | |
159 | 34 | 2008-12-26 23:33 Gwenole Beauchesne <gb.public@free.fr> | 84 | pkglibdir/%ARCH%/%OS% is used. If no viewer path includes an |
160 | 35 | 85 | ARCH/OS expansion, then nspluginwrapper files are installed in a | |
161 | 36 | * src/npw-wrapper.c: Backport from trunk: | 86 | "flat" hierarchy. NPW_PluginInfo format is now extended to |
162 | 37 | 87 | include the viewer_path[] too. | |
163 | 38 | Fix NPN_GetStringIdentifiers() to free identifiers with | 88 | |
164 | 39 | NPW_MemFree(). | 89 | 2008-12-29 10:48 Gwenole Beauchesne <gb.public@free.fr> |
165 | 40 | * src/npw-player.c: Backport from trunk: | 90 | |
166 | 41 | 91 | * src/npw-viewer.sh: Move down NPW_VIEWER_DIR, after | |
167 | 42 | Fix stream_new() to return NULL if an error occurred. | 92 | TARGET_ARCH/TARGET_OS were normalised. Also fix uses of |
168 | 43 | 93 | normalized ARCH/OS variables. | |
169 | 44 | 2008-12-26 13:42 Gwenole Beauchesne <gb.public@free.fr> | 94 | |
170 | 45 | 95 | 2008-12-29 09:47 Gwenole Beauchesne <gb.public@free.fr> | |
171 | 46 | * nspluginwrapper.spec: Bump release for development. | 96 | |
172 | 47 | 97 | * src/npw-viewer.sh: Normalize ARCH/OS variables here too. | |
173 | 48 | 2008-12-25 21:43 Gwenole Beauchesne <gb.public@free.fr> | 98 | |
174 | 49 | 99 | 2008-12-28 18:16 Gwenole Beauchesne <gb.public@free.fr> | |
175 | 50 | * nspluginwrapper.spec: Fix day-of-week. | 100 | |
176 | 51 | 101 | * Makefile, src/npw-viewer.sh: Factor out install paths. | |
177 | 52 | 2008-12-25 21:40 Gwenole Beauchesne <gb.public@free.fr> | 102 | |
178 | 53 | 103 | 2008-12-28 17:18 Gwenole Beauchesne <gb.public@free.fr> | |
179 | 54 | * NEWS, nspluginwrapper.spec: Updates for real 1.2.0 release. | 104 | |
180 | 55 | 105 | * configure: Improve biarch-build check. | |
181 | 56 | 2008-12-25 21:37 Gwenole Beauchesne <gb.public@free.fr> | 106 | |
182 | 57 | 107 | 2008-12-28 17:03 Gwenole Beauchesne <gb.public@free.fr> | |
183 | 58 | * ChangeLog, Makefile: Fix ChangeLog generation for the branch. | 108 | |
184 | 59 | 109 | * Makefile, configure, src/rpc.c: Normalize CPU and OS values for | |
185 | 60 | 2008-12-25 21:29 Gwenole Beauchesne <gb.public@free.fr> | 110 | both hosts and targets. Cleanup a few internal configure option |
186 | 61 | 111 | names. Rephrase --enable-generic. | |
187 | 62 | * ChangeLog: Generated by svn2cl. | 112 | |
188 | 63 | 113 | 2008-12-28 11:25 Gwenole Beauchesne <gb.public@free.fr> | |
189 | 64 | 2008-12-25 21:29 Gwenole Beauchesne <gb.public@free.fr> | 114 | |
190 | 65 | 115 | * src/npw-viewer.c: Make sure NPWindow::ws_info points to a unique | |
191 | 66 | * ChangeLog: Generated by svn2cl. | 116 | location for the lifetime of the window. This fixes support for |
192 | 67 | 117 | the VLC plugin that makes a local copy of NPWindow but doesn't | |
193 | 68 | 2008-12-21 21:43 Gwenole Beauchesne <gb.public@free.fr> | 118 | bother about making an NPWindow::ws_info copy. |
194 | 69 | 119 | ||
195 | 70 | * src/debug.h: Fix npw_return_if_fail() definition in !DEBUG mode. | 120 | 2008-12-28 11:21 Gwenole Beauchesne <gb.public@free.fr> |
196 | 71 | 121 | ||
197 | 72 | 2008-12-21 14:02 Gwenole Beauchesne <gb.public@free.fr> | 122 | * src/npw-malloc.c, src/npw-malloc.h: Add NPW_MemAllocCopy() and |
198 | 73 | 123 | NPW_MemClone() functions. | |
199 | 74 | * src/npw-viewer.c: Destroy the plugin window in NPP_Destroy(). | 124 | |
200 | 75 | NPAPI docs mention plugin shall not use graphics operations | 125 | 2008-12-27 15:19 Gwenole Beauchesne <gb.public@free.fr> |
201 | 76 | beyond that call. So, don't bother with broken plugins, we | 126 | |
202 | 77 | already have our own bugs to bother with... | 127 | * src/npw-viewer.c: Minor clean-ups. |
203 | 78 | 128 | ||
204 | 79 | 2008-12-21 12:14 Gwenole Beauchesne <gb.public@free.fr> | 129 | 2008-12-27 14:56 Gwenole Beauchesne <gb.public@free.fr> |
205 | 80 | 130 | ||
206 | 81 | * .: Create nspluginwrapper-1.2-branch from rev 837. | 131 | * configure: Enable main-thread checks by default for all builds |
207 | 132 | from snapshots. | ||
208 | 133 | |||
209 | 134 | 2008-12-27 14:54 Gwenole Beauchesne <gb.public@free.fr> | ||
210 | 135 | |||
211 | 136 | * configure, src/npruntime.c, src/npw-viewer.c: Rework configure | ||
212 | 137 | option. Use NPW_THREAD_CHECK=yes (or "1") at run-time. | ||
213 | 138 | |||
214 | 139 | 2008-12-27 14:45 Gwenole Beauchesne <gb.public@free.fr> | ||
215 | 140 | |||
216 | 141 | * configure, src/npruntime.c, src/npw-viewer.c: Convert the PID | ||
217 | 142 | check to a main-thread check. | ||
218 | 143 | |||
219 | 144 | 2008-12-27 12:19 Gwenole Beauchesne <gb.public@free.fr> | ||
220 | 145 | |||
221 | 146 | * src/npw-malloc.c: Simplify memory allocation code further. | ||
222 | 147 | |||
223 | 148 | 2008-12-27 12:07 Gwenole Beauchesne <gb.public@free.fr> | ||
224 | 149 | |||
225 | 150 | * src/npw-malloc.c: Allow malloc-checks for the libc memory | ||
226 | 151 | allocation hooks too. This also simplifies/clarifies the | ||
227 | 152 | different memory allocation backends. | ||
228 | 153 | |||
229 | 154 | 2008-12-27 11:45 Gwenole Beauchesne <gb.public@free.fr> | ||
230 | 155 | |||
231 | 156 | * Makefile, configure, src/npw-malloc.c: Enable malloc-checks by | ||
232 | 157 | default for all builds from snapshots. | ||
233 | 158 | |||
234 | 159 | 2008-12-27 11:16 Gwenole Beauchesne <gb.public@free.fr> | ||
235 | 160 | |||
236 | 161 | * configure, src/npw-malloc.c, src/npw-malloc.h: Add basic malloc | ||
237 | 162 | check routines to detect possible buffer overflows or | ||
238 | 163 | underflows. This is enabled at run-time with | ||
239 | 164 | NPW_MALLOC_CHECK=yes (or "1"). | ||
240 | 165 | |||
241 | 166 | 2008-12-26 23:31 Gwenole Beauchesne <gb.public@free.fr> | ||
242 | 167 | |||
243 | 168 | * src/npw-wrapper.c: Fix NPN_GetStringIdentifiers() to free | ||
244 | 169 | identifiers with NPW_MemFree(). | ||
245 | 170 | |||
246 | 171 | 2008-12-26 23:24 Gwenole Beauchesne <gb.public@free.fr> | ||
247 | 172 | |||
248 | 173 | * src/npw-player.c: Fix stream_new() to return NULL if an error | ||
249 | 174 | occurred. | ||
250 | 175 | |||
251 | 176 | 2008-12-26 21:34 Gwenole Beauchesne <gb.public@free.fr> | ||
252 | 177 | |||
253 | 178 | * NEWS, nspluginwrapper.spec: Merge documentation updates from | ||
254 | 179 | 1.2-branch. | ||
255 | 180 | |||
256 | 181 | 2008-12-26 21:26 Gwenole Beauchesne <gb.public@free.fr> | ||
257 | 182 | |||
258 | 183 | * src/npruntime.c: Use NPW_MemAlloc() instead of NPW_MemAlloc0() | ||
259 | 184 | since all struct members are initialized manually. | ||
260 | 185 | |||
261 | 186 | 2008-12-26 21:24 Gwenole Beauchesne <gb.public@free.fr> | ||
262 | 187 | |||
263 | 188 | * src/npw-malloc.c: Report an error instead of a debug-warning for | ||
264 | 189 | NPW_MemFree()'ing a pointer that was not allocated with | ||
265 | 190 | NPW_MemAlloc(). | ||
266 | 191 | |||
267 | 192 | 2008-12-25 21:23 Gwenole Beauchesne <gb.public@free.fr> | ||
268 | 193 | |||
269 | 194 | * src/debug.h: Merge from 1.2-branch: | ||
270 | 195 | |||
271 | 196 | Fix npw_return_if_fail() definition in !DEBUG mode. | ||
272 | 197 | |||
273 | 198 | 2008-12-25 21:22 Gwenole Beauchesne <gb.public@free.fr> | ||
274 | 199 | |||
275 | 200 | * src/npw-viewer.c: Merge from 1.2-branch: | ||
276 | 201 | |||
277 | 202 | Destroy the plugin window in NPP_Destroy(). NPAPI docs mention | ||
278 | 203 | plugin shall not use graphics operations beyond that call. So, | ||
279 | 204 | don't bother with broken plugins, we already have our own bugs | ||
280 | 205 | to bother with... | ||
281 | 206 | |||
282 | 207 | 2008-12-25 21:21 Gwenole Beauchesne <gb.public@free.fr> | ||
283 | 208 | |||
284 | 209 | * src/npw-rpc.h, src/npw-viewer.c, src/npw-wrapper.c: Revert RPC | ||
285 | 210 | sync and silent X errors commits. They didn't fix anything in a | ||
286 | 211 | useful way. IOW, don't bother fixing bugs that are not | ||
287 | 212 | nspluginwrapper related and that could actually degrade its | ||
288 | 213 | stability. | ||
289 | 214 | |||
290 | 215 | 2008-12-21 12:19 Gwenole Beauchesne <gb.public@free.fr> | ||
291 | 216 | |||
292 | 217 | * nspluginwrapper.spec, src/npw-wrapper.c: Bump release for | ||
293 | 218 | development. | ||
294 | 219 | |||
295 | 220 | 2008-12-21 09:32 Gwenole Beauchesne <gb.public@free.fr> | ||
296 | 221 | |||
297 | 222 | * src/npw-rpc.h, src/npw-viewer.c, src/npw-wrapper.c: Try to | ||
298 | 223 | improve the RPC flush mechanism. Flash doesn't like "cancelled" | ||
299 | 224 | NPN_GetURLNotify() with an NPERR_INVALID_INSTANCE_ERROR return. | ||
300 | 225 | So, we try our best to honour that call prior to sending | ||
301 | 226 | NPP_Destroy(). | ||
302 | 227 | |||
303 | 228 | 2008-12-21 08:19 Gwenole Beauchesne <gb.public@free.fr> | ||
304 | 229 | |||
305 | 230 | * src/npw-wrapper.c: Purge all incoming RPC prior to calling | ||
306 | 231 | NPP_Destroy(). | ||
307 | 232 | |||
308 | 233 | 2008-12-21 08:16 Gwenole Beauchesne <gb.public@free.fr> | ||
309 | 234 | |||
310 | 235 | * src/npw-viewer.c: Don't kill the application on X errors. That | ||
311 | 236 | is, we ignore all X errors that could arise between the | ||
312 | 237 | completion of NPP_Destroy() and plugin_instance_finalize(). This | ||
313 | 238 | is not fully correct as other plugins can be created and then | ||
314 | 239 | destroyed in the while. | ||
315 | 240 | |||
316 | 241 | XXX: this is a hack to debug later because in the presence of | ||
317 | 242 | Firefox 3.0 (i.e. neither 3.1b2 nor 2.x are affected, it seems), | ||
318 | 243 | the toplevel window receives an "unexpected GDK_DESTROY from the | ||
319 | 244 | outside". Native plugins often get that without nspluginwrapper | ||
320 | 245 | too but the application is not killed either. | ||
321 | 82 | 246 | ||
322 | 83 | 2008-12-20 22:24 Gwenole Beauchesne <gb.public@free.fr> | 247 | 2008-12-20 22:24 Gwenole Beauchesne <gb.public@free.fr> |
323 | 84 | 248 | ||
338 | 85 | * gwenole/projects/nspluginwrapper/trunk/ChangeLog: Generated by | 249 | * ChangeLog: Generated by svn2cl. |
325 | 86 | svn2cl. | ||
326 | 87 | |||
327 | 88 | 2008-12-20 22:22 Gwenole Beauchesne <gb.public@free.fr> | ||
328 | 89 | |||
329 | 90 | * gwenole/projects/nspluginwrapper/trunk/NEWS, | ||
330 | 91 | gwenole/projects/nspluginwrapper/trunk/nspluginwrapper.spec: | ||
331 | 92 | 1.2.0. | ||
332 | 93 | |||
333 | 94 | 2008-12-20 21:32 Gwenole Beauchesne <gb.public@free.fr> | ||
334 | 95 | |||
335 | 96 | * gwenole/projects/nspluginwrapper/trunk/src/npw-config.c: | ||
336 | 97 | Suppress error messages in non-verbose mode when exec()'ing | ||
337 | 98 | npviewer.bin (Stanislav Brabec). | ||
339 | 99 | 250 | ||
340 | 100 | 2008-12-20 22:22 Gwenole Beauchesne <gb.public@free.fr> | 251 | 2008-12-20 22:22 Gwenole Beauchesne <gb.public@free.fr> |
341 | 101 | 252 | ||
342 | 102 | 253 | ||
343 | === modified file 'Makefile' | |||
344 | --- Makefile 2009-01-02 10:07:27 +0000 | |||
345 | +++ Makefile 2009-08-11 00:38:42 +0000 | |||
346 | @@ -23,10 +23,10 @@ | |||
347 | 23 | ifeq ($(SNAPSHOT),) | 23 | ifeq ($(SNAPSHOT),) |
348 | 24 | SNAPSHOT := $(shell echo "$(RELEASE)" | grep "^0") | 24 | SNAPSHOT := $(shell echo "$(RELEASE)" | grep "^0") |
349 | 25 | ifeq ($(SNAPSHOT),$(RELEASE)) | 25 | ifeq ($(SNAPSHOT),$(RELEASE)) |
354 | 26 | SNAPSHOT := 1 | 26 | SNAPSHOT := 2 |
355 | 27 | endif | 27 | endif |
356 | 28 | endif | 28 | endif |
357 | 29 | ifeq ($(SNAPSHOT),1) | 29 | ifeq ($(SNAPSHOT),2) |
358 | 30 | VERSION_SUFFIX = -$(SVNDATE) | 30 | VERSION_SUFFIX = -$(SVNDATE) |
359 | 31 | endif | 31 | endif |
360 | 32 | 32 | ||
361 | @@ -77,7 +77,7 @@ | |||
362 | 77 | endif | 77 | endif |
363 | 78 | 78 | ||
364 | 79 | ARCH_32 = $(ARCH) | 79 | ARCH_32 = $(ARCH) |
366 | 80 | ifeq ($(biarch), yes) | 80 | ifeq ($(build_biarch), yes) |
367 | 81 | ARCH_32 = $(TARGET_ARCH) | 81 | ARCH_32 = $(TARGET_ARCH) |
368 | 82 | LSB_LIBS = $(LSB_OBJ_DIR)/libc.so $(LSB_OBJ_DIR)/libgcc_s_32.so | 82 | LSB_LIBS = $(LSB_OBJ_DIR)/libc.so $(LSB_OBJ_DIR)/libgcc_s_32.so |
369 | 83 | LSB_LIBS += $(LSB_CORE_STUBS:%=$(LSB_OBJ_DIR)/%.so) | 83 | LSB_LIBS += $(LSB_CORE_STUBS:%=$(LSB_OBJ_DIR)/%.so) |
370 | @@ -114,7 +114,7 @@ | |||
371 | 114 | npviewer_RAWSRCS = npw-viewer.c npw-common.c npw-malloc.c npw-rpc.c rpc.c debug.c utils.c npruntime.c | 114 | npviewer_RAWSRCS = npw-viewer.c npw-common.c npw-malloc.c npw-rpc.c rpc.c debug.c utils.c npruntime.c |
372 | 115 | npviewer_SOURCES = $(npviewer_RAWSRCS:%.c=$(SRC_PATH)/src/%.c) | 115 | npviewer_SOURCES = $(npviewer_RAWSRCS:%.c=$(SRC_PATH)/src/%.c) |
373 | 116 | npviewer_OBJECTS = $(npviewer_RAWSRCS:%.c=npviewer-%.o) | 116 | npviewer_OBJECTS = $(npviewer_RAWSRCS:%.c=npviewer-%.o) |
375 | 117 | ifeq ($(biarch),yes) | 117 | ifeq ($(build_biarch),yes) |
376 | 118 | npviewer_CFLAGS = $(CFLAGS_32) | 118 | npviewer_CFLAGS = $(CFLAGS_32) |
377 | 119 | npviewer_CFLAGS += -I$(LSB_INC_DIR) | 119 | npviewer_CFLAGS += -I$(LSB_INC_DIR) |
378 | 120 | npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0 | 120 | npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0 |
379 | @@ -155,7 +155,7 @@ | |||
380 | 155 | libxpcom_SOURCES = $(libxpcom_RAWSRCS:%.c=$(SRC_PATH)/src/%.c) | 155 | libxpcom_SOURCES = $(libxpcom_RAWSRCS:%.c=$(SRC_PATH)/src/%.c) |
381 | 156 | libxpcom_OBJECTS = $(libxpcom_RAWSRCS:%.c=libxpcom-%.o) | 156 | libxpcom_OBJECTS = $(libxpcom_RAWSRCS:%.c=libxpcom-%.o) |
382 | 157 | libxpcom_CFLAGS = $(PIC_CFLAGS) | 157 | libxpcom_CFLAGS = $(PIC_CFLAGS) |
384 | 158 | ifeq ($(biarch),yes) | 158 | ifeq ($(build_biarch),yes) |
385 | 159 | libxpcom_CFLAGS += -I$(LSB_INC_DIR) | 159 | libxpcom_CFLAGS += -I$(LSB_INC_DIR) |
386 | 160 | libxpcom_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR) | 160 | libxpcom_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR) |
387 | 161 | endif | 161 | endif |
388 | @@ -182,7 +182,7 @@ | |||
389 | 182 | npconfig_LDFLAGS += $(libpthread_LDFLAGS) | 182 | npconfig_LDFLAGS += $(libpthread_LDFLAGS) |
390 | 183 | endif | 183 | endif |
391 | 184 | 184 | ||
393 | 185 | nploader_PROGRAM = npviewer | 185 | nploader_PROGRAM = npviewer.sh |
394 | 186 | nploader_RAWSRCS = npw-viewer.sh | 186 | nploader_RAWSRCS = npw-viewer.sh |
395 | 187 | nploader_SOURCES = $(nploader_RAWSRCS:%.sh=$(SRC_PATH)/src/%.sh) | 187 | nploader_SOURCES = $(nploader_RAWSRCS:%.sh=$(SRC_PATH)/src/%.sh) |
396 | 188 | 188 | ||
397 | @@ -255,51 +255,43 @@ | |||
398 | 255 | 255 | ||
399 | 256 | uninstall: uninstall.player uninstall.wrapper uninstall.viewer uninstall.libxpcom uninstall.libnoxshm uninstall.loader uninstall.config uninstall.dirs | 256 | uninstall: uninstall.player uninstall.wrapper uninstall.viewer uninstall.libxpcom uninstall.libnoxshm uninstall.loader uninstall.config uninstall.dirs |
400 | 257 | uninstall.dirs: | 257 | uninstall.dirs: |
408 | 258 | rmdir $(DESTDIR)$(pkglibdir)/noarch | 258 | rmdir -p $(DESTDIR)$(nptargetdir) || : |
409 | 259 | rmdir $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS) | 259 | rmdir -p $(DESTDIR)$(nphostdir) || : |
410 | 260 | rmdir $(DESTDIR)$(pkglibdir)/$(ARCH) | 260 | rmdir -p $(DESTDIR)$(npcommondir) || : |
404 | 261 | ifneq ($(ARCH),$(ARCH_32)) | ||
405 | 262 | rmdir $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS) | ||
406 | 263 | rmdir $(DESTDIR)$(pkglibdir)/$(ARCH_32) | ||
407 | 264 | endif | ||
411 | 265 | uninstall.player: | 261 | uninstall.player: |
413 | 266 | rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM) | 262 | rm -f $(DESTDIR)$(nphostdir)/$(npplayer_PROGRAM) |
414 | 267 | uninstall.wrapper: | 263 | uninstall.wrapper: |
416 | 268 | rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npwrapper_LIBRARY) | 264 | rm -f $(DESTDIR)$(nphostdir)/$(npwrapper_LIBRARY) |
417 | 269 | uninstall.viewer: | 265 | uninstall.viewer: |
420 | 270 | rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM) | 266 | rm -f $(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM) |
421 | 271 | rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM:%.bin=%) | 267 | rm -f $(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM:%.bin=%) |
422 | 272 | uninstall.libxpcom: | 268 | uninstall.libxpcom: |
424 | 273 | rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libxpcom_LIBRARY) | 269 | rm -f $(DESTDIR)$(nptargetdir)/$(libxpcom_LIBRARY) |
425 | 274 | uninstall.libnoxshm: | 270 | uninstall.libnoxshm: |
427 | 275 | rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libnoxshm_LIBRARY) | 271 | rm -f $(DESTDIR)$(nptargetdir)/$(libnoxshm_LIBRARY) |
428 | 276 | uninstall.loader: | 272 | uninstall.loader: |
430 | 277 | rm -f $(DESTDIR)$(pkglibdir)/noarch/$(nploader_PROGRAM) | 273 | rm -f $(DESTDIR)$(npcommondir)/$(nploader_PROGRAM) |
431 | 278 | uninstall.config: | 274 | uninstall.config: |
432 | 279 | rm -f $(DESTDIR)$(bindir)/nspluginwrapper | 275 | rm -f $(DESTDIR)$(bindir)/nspluginwrapper |
434 | 280 | rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM) | 276 | rm -f $(DESTDIR)$(nphostdir)/$(npconfig_PROGRAM) |
435 | 281 | uninstall.mkruntime: | 277 | uninstall.mkruntime: |
437 | 282 | rm -f $(DESTDIR)$(pkglibdir)/noarch/mkruntime | 278 | rm -f $(DESTDIR)$(npcommondir)/mkruntime |
438 | 283 | 279 | ||
439 | 284 | install: install.dirs install.player install.wrapper install.viewer install.libxpcom install.libnoxshm install.loader install.config | 280 | install: install.dirs install.player install.wrapper install.viewer install.libxpcom install.libnoxshm install.loader install.config |
440 | 285 | install.dirs: | 281 | install.dirs: |
448 | 286 | mkdir -p $(DESTDIR)$(pkglibdir)/noarch | 282 | mkdir -p $(DESTDIR)$(npcommondir) || : |
449 | 287 | mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH) | 283 | mkdir -p $(DESTDIR)$(nphostdir) || : |
450 | 288 | mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS) | 284 | mkdir -p $(DESTDIR)$(nptargetdir) || : |
444 | 289 | ifneq ($(ARCH),$(ARCH_32)) | ||
445 | 290 | mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH_32) | ||
446 | 291 | mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS) | ||
447 | 292 | endif | ||
451 | 293 | ifeq ($(build_player),yes) | 285 | ifeq ($(build_player),yes) |
452 | 294 | install.player: $(npplayer_PROGRAM) | 286 | install.player: $(npplayer_PROGRAM) |
454 | 295 | $(INSTALL) -m 755 $(STRIP_OPT) $(npplayer_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM) | 287 | $(INSTALL) -m 755 $(STRIP_OPT) $(npplayer_PROGRAM) $(DESTDIR)$(nphostdir)/$(npplayer_PROGRAM) |
455 | 296 | mkdir -p $(DESTDIR)$(bindir) | 288 | mkdir -p $(DESTDIR)$(bindir) |
457 | 297 | $(LN_S) $(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM) $(DESTDIR)$(bindir)/nspluginplayer | 289 | $(LN_S) $(nphostdir)/$(npplayer_PROGRAM) $(DESTDIR)$(bindir)/nspluginplayer |
458 | 298 | else | 290 | else |
459 | 299 | install.player: | 291 | install.player: |
460 | 300 | endif | 292 | endif |
461 | 301 | install.wrapper: $(npwrapper_LIBRARY) | 293 | install.wrapper: $(npwrapper_LIBRARY) |
463 | 302 | $(INSTALL) -m 755 $(STRIP_OPT) $(npwrapper_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npwrapper_LIBRARY) | 294 | $(INSTALL) -m 755 $(STRIP_OPT) $(npwrapper_LIBRARY) $(DESTDIR)$(nphostdir)/$(npwrapper_LIBRARY) |
464 | 303 | ifeq ($(build_viewer),yes) | 295 | ifeq ($(build_viewer),yes) |
465 | 304 | install.viewer: install.viewer.bin install.viewer.glue | 296 | install.viewer: install.viewer.bin install.viewer.glue |
466 | 305 | install.libxpcom: do.install.libxpcom | 297 | install.libxpcom: do.install.libxpcom |
467 | @@ -310,26 +302,26 @@ | |||
468 | 310 | install.libnoxshm: | 302 | install.libnoxshm: |
469 | 311 | endif | 303 | endif |
470 | 312 | install.viewer.bin: $(npviewer_PROGRAM) | 304 | install.viewer.bin: $(npviewer_PROGRAM) |
472 | 313 | $(INSTALL) -m 755 $(STRIP_OPT) $(npviewer_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM) | 305 | $(INSTALL) -m 755 $(STRIP_OPT) $(npviewer_PROGRAM) $(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM) |
473 | 314 | install.viewer.glue:: | 306 | install.viewer.glue:: |
475 | 315 | p=$(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM:%.bin=%); \ | 307 | p=$(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM:%.bin=%); \ |
476 | 316 | echo "#!/bin/sh" > $$p; \ | 308 | echo "#!/bin/sh" > $$p; \ |
477 | 317 | echo "TARGET_OS=$(TARGET_OS)" >> $$p; \ | 309 | echo "TARGET_OS=$(TARGET_OS)" >> $$p; \ |
478 | 318 | echo "TARGET_ARCH=$(TARGET_ARCH)" >> $$p; \ | 310 | echo "TARGET_ARCH=$(TARGET_ARCH)" >> $$p; \ |
480 | 319 | echo ". $(pkglibdir)/noarch/$(nploader_PROGRAM)" >> $$p; \ | 311 | echo ". $(npcommondir)/$(nploader_PROGRAM)" >> $$p; \ |
481 | 320 | chmod 755 $$p | 312 | chmod 755 $$p |
482 | 321 | do.install.libxpcom: $(libxpcom_LIBRARY) | 313 | do.install.libxpcom: $(libxpcom_LIBRARY) |
484 | 322 | $(INSTALL) -m 755 $(STRIP_OPT) $(libxpcom_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libxpcom_LIBRARY) | 314 | $(INSTALL) -m 755 $(STRIP_OPT) $(libxpcom_LIBRARY) $(DESTDIR)$(nptargetdir)/$(libxpcom_LIBRARY) |
485 | 323 | do.install.libnoxshm: $(libnoxshm_LIBRARY) | 315 | do.install.libnoxshm: $(libnoxshm_LIBRARY) |
487 | 324 | $(INSTALL) -m 755 $(STRIP_OPT) $(libnoxshm_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libnoxshm_LIBRARY) | 316 | $(INSTALL) -m 755 $(STRIP_OPT) $(libnoxshm_LIBRARY) $(DESTDIR)$(nptargetdir)/$(libnoxshm_LIBRARY) |
488 | 325 | install.config: $(npconfig_PROGRAM) | 317 | install.config: $(npconfig_PROGRAM) |
490 | 326 | $(INSTALL) -m 755 $(STRIP_OPT) $(npconfig_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM) | 318 | $(INSTALL) -m 755 $(STRIP_OPT) $(npconfig_PROGRAM) $(DESTDIR)$(nphostdir)/$(npconfig_PROGRAM) |
491 | 327 | mkdir -p $(DESTDIR)$(bindir) | 319 | mkdir -p $(DESTDIR)$(bindir) |
493 | 328 | $(LN_S) $(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM) $(DESTDIR)$(bindir)/nspluginwrapper | 320 | $(LN_S) $(nphostdir)/$(npconfig_PROGRAM) $(DESTDIR)$(bindir)/nspluginwrapper |
494 | 329 | install.loader: $(nploader_PROGRAM) | 321 | install.loader: $(nploader_PROGRAM) |
496 | 330 | $(INSTALL) -m 755 $(nploader_PROGRAM) $(DESTDIR)$(pkglibdir)/noarch/$(nploader_PROGRAM) | 322 | $(INSTALL) -m 755 $(nploader_PROGRAM) $(DESTDIR)$(npcommondir)/$(nploader_PROGRAM) |
497 | 331 | install.mkruntime: $(SRC_PATH)/utils/mkruntime.sh | 323 | install.mkruntime: $(SRC_PATH)/utils/mkruntime.sh |
499 | 332 | $(INSTALL) -m 755 $< $(DESTDIR)$(pkglibdir)/noarch/mkruntime | 324 | $(INSTALL) -m 755 $< $(DESTDIR)$(npcommondir)/mkruntime |
500 | 333 | 325 | ||
501 | 334 | $(archivedir):: | 326 | $(archivedir):: |
502 | 335 | [ -d $(archivedir) ] || mkdir $(archivedir) > /dev/null 2>&1 | 327 | [ -d $(archivedir) ] || mkdir $(archivedir) > /dev/null 2>&1 |
503 | @@ -342,7 +334,7 @@ | |||
504 | 342 | BUILDDIR=`mktemp -d /tmp/buildXXXXXXXX` ; \ | 334 | BUILDDIR=`mktemp -d /tmp/buildXXXXXXXX` ; \ |
505 | 343 | mkdir -p $$BUILDDIR/$(PACKAGE)-$(VERSION) ; \ | 335 | mkdir -p $$BUILDDIR/$(PACKAGE)-$(VERSION) ; \ |
506 | 344 | (cd $(SRC_PATH) && tar c $(FILES)) | tar x -C $$BUILDDIR/$(PACKAGE)-$(VERSION) ; \ | 336 | (cd $(SRC_PATH) && tar c $(FILES)) | tar x -C $$BUILDDIR/$(PACKAGE)-$(VERSION) ; \ |
508 | 345 | [ "$(SNAPSHOT)" = "1" ] && svndate_def="%" || svndate_def="#" ; \ | 337 | [ "$(SNAPSHOT)" = "2" ] && svndate_def="%" || svndate_def="#" ; \ |
509 | 346 | sed -e "s/^[%#]define svndate.*/$${svndate_def}define svndate $(SVNDATE)/" \ | 338 | sed -e "s/^[%#]define svndate.*/$${svndate_def}define svndate $(SVNDATE)/" \ |
510 | 347 | < $(SRC_PATH)/nspluginwrapper.spec \ | 339 | < $(SRC_PATH)/nspluginwrapper.spec \ |
511 | 348 | > $$BUILDDIR/$(PACKAGE)-$(VERSION)/nspluginwrapper.spec ; \ | 340 | > $$BUILDDIR/$(PACKAGE)-$(VERSION)/nspluginwrapper.spec ; \ |
512 | @@ -367,7 +359,7 @@ | |||
513 | 367 | 359 | ||
514 | 368 | changelog: ../common/authors.xml | 360 | changelog: ../common/authors.xml |
515 | 369 | svn_prefix=`svn info .|sed -n '/^URL *: .*\/svn\/\(.*\)$$/s//\1\//p'`; \ | 361 | svn_prefix=`svn info .|sed -n '/^URL *: .*\/svn\/\(.*\)$$/s//\1\//p'`; \ |
517 | 370 | LC_ALL=C TZ=GMT svn2cl --strip-prefix=$$svn_prefix --authors=../common/authors.xml --accum || : | 362 | LC_ALL=C TZ=GMT svn2cl --strip-prefix=$$svn_prefix --authors=../common/authors.xml || : |
518 | 371 | changelog.commit: changelog | 363 | changelog.commit: changelog |
519 | 372 | svn commit -m "Generated by svn2cl." ChangeLog | 364 | svn commit -m "Generated by svn2cl." ChangeLog |
520 | 373 | 365 | ||
521 | @@ -413,7 +405,7 @@ | |||
522 | 413 | $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS) | 405 | $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS) |
523 | 414 | 406 | ||
524 | 415 | $(nploader_PROGRAM): $(nploader_SOURCES) | 407 | $(nploader_PROGRAM): $(nploader_SOURCES) |
526 | 416 | sed -e "s|%NPW_LIBDIR%|$(pkglibdir)|" $< > $@ | 408 | sed -e 's|%NPW_VIEWER_DIR%|$(nptargetdir_var)|' $< > $@ |
527 | 417 | chmod 755 $@ | 409 | chmod 755 $@ |
528 | 418 | 410 | ||
529 | 419 | $(LSB_OBJ_DIR):: | 411 | $(LSB_OBJ_DIR):: |
530 | 420 | 412 | ||
531 | === modified file 'NEWS' | |||
532 | --- NEWS 2009-01-02 10:07:27 +0000 | |||
533 | +++ NEWS 2009-08-11 00:38:42 +0000 | |||
534 | @@ -1,6 +1,14 @@ | |||
535 | 1 | nspluginwrapper NEWS -- history of user-visible changes. 2009-01-02 | 1 | nspluginwrapper NEWS -- history of user-visible changes. 2009-01-02 |
536 | 2 | Copyright (C) 2005-2009 Gwenole Beauchesne | 2 | Copyright (C) 2005-2009 Gwenole Beauchesne |
537 | 3 | 3 | ||
538 | 4 | Version 1.3.0 (BETA) - 02.Jan.2009 | ||
539 | 5 | * Don't poll for Xt events in Gtk (XEMBED) plug-ins | ||
540 | 6 | * Use 40 Hz timer for Xt events only when necessary (Xt input sources) | ||
541 | 7 | * Add NPIdentifier and NPClass::HasMethod caches, i.e. lower RPC traffic | ||
542 | 8 | * Add support for multiple viewer paths, see --viewer-paths=PATH-EXPR | ||
543 | 9 | * Add basic checks for malloc()'ed buffer underflow/overflow | ||
544 | 10 | * Add checks for single-threaded calls into the browser (NPN_*() functions) | ||
545 | 11 | |||
546 | 4 | Version 1.2.2 - 02.Jan.2009 | 12 | Version 1.2.2 - 02.Jan.2009 |
547 | 5 | * Fix support for the VLC plug-in | 13 | * Fix support for the VLC plug-in |
548 | 6 | * Fix memory deallocation in NPN_GetStringIdentifiers() | 14 | * Fix memory deallocation in NPN_GetStringIdentifiers() |
549 | @@ -12,7 +20,8 @@ | |||
550 | 12 | * Add support for SunStudio compilers | 20 | * Add support for SunStudio compilers |
551 | 13 | * Add support for Flash Player 10 on OpenSolaris 2008.11 | 21 | * Add support for Flash Player 10 on OpenSolaris 2008.11 |
552 | 14 | * Fix build on non-Linux platforms | 22 | * Fix build on non-Linux platforms |
554 | 15 | * Fix NPP_Destroy() to keep NPP instances longer, but destroy window immediately | 23 | * Fix NPP_Destroy() to keep NPP instances longer |
555 | 24 | * Fix NPP_Destroy() to destroy the plugin window immediately | ||
556 | 16 | 25 | ||
557 | 17 | Version 1.1.10 (BETA) - 08.Dec.2008 | 26 | Version 1.1.10 (BETA) - 08.Dec.2008 |
558 | 18 | * Fix NPPVpluginScriptableNPObject::Invalidate() | 27 | * Fix NPPVpluginScriptableNPObject::Invalidate() |
559 | 19 | 28 | ||
560 | === modified file 'configure' | |||
561 | --- configure 2009-01-02 10:07:27 +0000 | |||
562 | +++ configure 2009-08-11 00:38:42 +0000 | |||
563 | @@ -19,15 +19,63 @@ | |||
564 | 19 | TMPE="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}" | 19 | TMPE="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}" |
565 | 20 | TMPS="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}.S" | 20 | TMPS="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}.S" |
566 | 21 | 21 | ||
567 | 22 | # find source path | ||
568 | 23 | # XXX: we assume an absolute path is given when launching configure, | ||
569 | 24 | # except in './configure' case. | ||
570 | 25 | source_path=${0%configure} | ||
571 | 26 | source_path=${source_path%/} | ||
572 | 27 | source_path_used="yes" | ||
573 | 28 | if test -z "$source_path" -o "$source_path" = "." ; then | ||
574 | 29 | source_path=`pwd` | ||
575 | 30 | source_path_used="no" | ||
576 | 31 | fi | ||
577 | 32 | |||
578 | 33 | # determine versions | ||
579 | 34 | VERSION=`sed < $source_path/$PACKAGE.spec -n '/^\%define version[ ]*/s///p'` | ||
580 | 35 | RELEASE=`sed < $source_path/$PACKAGE.spec -n '/^\%define release[ ]*/s///p'` | ||
581 | 36 | SVNDATE=`sed < $source_path/$PACKAGE.spec -n '/^\%define svndate[ ]*/s///p'` | ||
582 | 37 | if test -z "$SVNDATE"; then | ||
583 | 38 | SVNDATE=`date '+%Y%m%d'` | ||
584 | 39 | fi | ||
585 | 40 | |||
586 | 41 | MAJOR_VERSION=`echo "$VERSION"|cut -d'.' -f1` | ||
587 | 42 | MINOR_VERSION=`echo "$VERSION"|cut -d'.' -f2` | ||
588 | 43 | MICRO_VERSION=`echo "$VERSION"|cut -d'.' -f3` | ||
589 | 44 | |||
590 | 45 | # development snapshots are officially generated tarballs for testing | ||
591 | 46 | # ("odd" minor and micro versions) | ||
592 | 47 | is_odd() { | ||
593 | 48 | local rem=`expr "$1" % 2` | ||
594 | 49 | test $rem -eq 1 && return 0 || return 1 | ||
595 | 50 | } | ||
596 | 51 | |||
597 | 52 | if is_odd $MINOR_VERSION || is_odd $MICRO_VERSION; then | ||
598 | 53 | SNAPSHOT=1 | ||
599 | 54 | else | ||
600 | 55 | SNAPSHOT=0 | ||
601 | 56 | fi | ||
602 | 57 | |||
603 | 58 | # snapshots can also be unofficially generated tarballs | ||
604 | 59 | # (Release: 0.1 in specfile) | ||
605 | 60 | if echo "$RELEASE" | grep -q ^0; then | ||
606 | 61 | SNAPSHOT=2 | ||
607 | 62 | fi | ||
608 | 63 | |||
609 | 64 | if test $SNAPSHOT -ge 1; then | ||
610 | 65 | yes_for_snapshots="yes" | ||
611 | 66 | else | ||
612 | 67 | yes_for_snapshots="no" | ||
613 | 68 | fi | ||
614 | 69 | |||
615 | 22 | # default parameters | 70 | # default parameters |
616 | 23 | prefix="/usr" | 71 | prefix="/usr" |
617 | 24 | lib32="" | 72 | lib32="" |
618 | 25 | lib64="" | 73 | lib64="" |
619 | 26 | x_base_dirs="" | 74 | x_base_dirs="" |
620 | 27 | biarch="guess" | ||
621 | 28 | build_viewer="guess" | 75 | build_viewer="guess" |
622 | 29 | build_player="yes" | 76 | build_player="yes" |
624 | 30 | linux_only="guess" | 77 | build_generic="guess" |
625 | 78 | build_biarch="guess" | ||
626 | 31 | strip="no" | 79 | strip="no" |
627 | 32 | cc="gcc" | 80 | cc="gcc" |
628 | 33 | cxx="g++" | 81 | cxx="g++" |
629 | @@ -37,52 +85,49 @@ | |||
630 | 37 | target_cpu="i386" | 85 | target_cpu="i386" |
631 | 38 | rpc_init_timeout=5 | 86 | rpc_init_timeout=5 |
632 | 39 | malloc_hooks="glib,libc" | 87 | malloc_hooks="glib,libc" |
635 | 40 | use_pid_check="no" | 88 | enable_malloc_check="$yes_for_snapshots" |
636 | 41 | case "$host_cpu" in | 89 | enable_thread_check="$yes_for_snapshots" |
637 | 90 | |||
638 | 91 | normalize_cpu() { | ||
639 | 92 | local cpu="$1" | ||
640 | 93 | case "$cpu" in | ||
641 | 42 | arm*) | 94 | arm*) |
643 | 43 | host_cpu="arm" | 95 | cpu="arm" |
644 | 44 | ;; | 96 | ;; |
647 | 45 | i386|i486|i586|i686|i86pc|BePC) | 97 | i[3456]86|k[678]|i86pc|BePC) |
648 | 46 | host_cpu="i386" | 98 | cpu="i386" |
649 | 47 | ;; | 99 | ;; |
650 | 48 | ia64) | 100 | ia64) |
652 | 49 | host_cpu="ia64" | 101 | cpu="ia64" |
653 | 50 | ;; | 102 | ;; |
654 | 51 | "Power Macintosh"|ppc) | 103 | "Power Macintosh"|ppc) |
656 | 52 | host_cpu="ppc" | 104 | cpu="ppc" |
657 | 53 | ;; | 105 | ;; |
658 | 54 | ppc64) | 106 | ppc64) |
660 | 55 | host_cpu="ppc64" | 107 | cpu="ppc64" |
661 | 56 | ;; | 108 | ;; |
662 | 57 | sparc) | 109 | sparc) |
664 | 58 | host_cpu="sparc" | 110 | cpu="sparc" |
665 | 59 | ;; | 111 | ;; |
666 | 60 | sparc64) | 112 | sparc64) |
668 | 61 | host_cpu="sparc64" | 113 | cpu="sparc64" |
669 | 62 | ;; | 114 | ;; |
670 | 63 | x86_64|amd64) | 115 | x86_64|amd64) |
675 | 64 | host_cpu="x86_64" | 116 | cpu="x86_64" |
672 | 65 | ;; | ||
673 | 66 | *) | ||
674 | 67 | host_cpu="unknown" | ||
676 | 68 | ;; | 117 | ;; |
677 | 69 | esac | 118 | esac |
679 | 70 | case "$host_os" in | 119 | echo "$cpu" |
680 | 120 | } | ||
681 | 121 | |||
682 | 122 | normalize_os() { | ||
683 | 123 | local os="$1" | ||
684 | 124 | case "$os" in | ||
685 | 71 | sunos*) | 125 | sunos*) |
687 | 72 | host_os="solaris" | 126 | os="solaris" |
688 | 73 | ;; | 127 | ;; |
689 | 74 | esac | 128 | esac |
701 | 75 | 129 | echo "$os" | |
702 | 76 | # find source path | 130 | } |
692 | 77 | # XXX: we assume an absolute path is given when launching configure, | ||
693 | 78 | # except in './configure' case. | ||
694 | 79 | source_path=${0%configure} | ||
695 | 80 | source_path=${source_path%/} | ||
696 | 81 | source_path_used="yes" | ||
697 | 82 | if test -z "$source_path" -o "$source_path" = "." ; then | ||
698 | 83 | source_path=`pwd` | ||
699 | 84 | source_path_used="no" | ||
700 | 85 | fi | ||
703 | 86 | 131 | ||
704 | 87 | for opt do | 132 | for opt do |
705 | 88 | case "$opt" in | 133 | case "$opt" in |
706 | @@ -92,14 +137,20 @@ | |||
707 | 92 | --pkglibdir=*) | 137 | --pkglibdir=*) |
708 | 93 | pkglibdir=`echo "$opt" | cut -d '=' -f 2` | 138 | pkglibdir=`echo "$opt" | cut -d '=' -f 2` |
709 | 94 | ;; | 139 | ;; |
710 | 140 | --viewer-paths=*) | ||
711 | 141 | viewer_paths=`echo "$opt" | cut -d '=' -f 2` | ||
712 | 142 | ;; | ||
713 | 95 | --target-os=*) | 143 | --target-os=*) |
714 | 96 | target_os=`echo "$opt" | cut -d '=' -f 2 | tr '[A-Z]' '[a-z]'` | 144 | target_os=`echo "$opt" | cut -d '=' -f 2 | tr '[A-Z]' '[a-z]'` |
715 | 97 | ;; | 145 | ;; |
716 | 98 | --target-cpu=*) | 146 | --target-cpu=*) |
718 | 99 | target_cpu=`echo "$opt" | cut -d '=' -f 2 | sed -e 's/^i.86$/i386/'` | 147 | target_cpu=`echo "$opt" | cut -d '=' -f 2` |
719 | 100 | ;; | 148 | ;; |
720 | 101 | --enable-generic) | 149 | --enable-generic) |
722 | 102 | linux_only="no" | 150 | build_generic="yes" |
723 | 151 | ;; | ||
724 | 152 | --disable-generic) | ||
725 | 153 | build_generic="no" | ||
726 | 103 | ;; | 154 | ;; |
727 | 104 | --enable-strip) | 155 | --enable-strip) |
728 | 105 | strip="yes" | 156 | strip="yes" |
729 | @@ -108,10 +159,10 @@ | |||
730 | 108 | strip="no" | 159 | strip="no" |
731 | 109 | ;; | 160 | ;; |
732 | 110 | --enable-biarch) | 161 | --enable-biarch) |
734 | 111 | biarch="yes" | 162 | build_biarch="yes" |
735 | 112 | ;; | 163 | ;; |
736 | 113 | --disable-biarch) | 164 | --disable-biarch) |
738 | 114 | biarch="no" | 165 | build_biarch="no" |
739 | 115 | ;; | 166 | ;; |
740 | 116 | --enable-viewer) | 167 | --enable-viewer) |
741 | 117 | build_viewer="yes" | 168 | build_viewer="yes" |
742 | @@ -125,11 +176,17 @@ | |||
743 | 125 | --disable-player) | 176 | --disable-player) |
744 | 126 | build_player="no" | 177 | build_player="no" |
745 | 127 | ;; | 178 | ;; |
751 | 128 | --enable-pid-check) | 179 | --enable-thread-check) |
752 | 129 | use_pid_check="yes" | 180 | enable_thread_check="yes" |
753 | 130 | ;; | 181 | ;; |
754 | 131 | --disable-pid-check) | 182 | --disable-thread-check) |
755 | 132 | use_pid_check="no" | 183 | enable_thread_check="no" |
756 | 184 | ;; | ||
757 | 185 | --enable-malloc-check) | ||
758 | 186 | enable_malloc_check="yes" | ||
759 | 187 | ;; | ||
760 | 188 | --disable-malloc-check) | ||
761 | 189 | enable_malloc_check="no" | ||
762 | 133 | ;; | 190 | ;; |
763 | 134 | --with-lib32=*) | 191 | --with-lib32=*) |
764 | 135 | lib32=`echo "$opt" | cut -d '=' -f 2` | 192 | lib32=`echo "$opt" | cut -d '=' -f 2` |
765 | @@ -155,34 +212,45 @@ | |||
766 | 155 | esac | 212 | esac |
767 | 156 | done | 213 | done |
768 | 157 | 214 | ||
769 | 215 | host_cpu=`normalize_cpu "$host_cpu"` | ||
770 | 216 | host_os=`normalize_os "$host_os"` | ||
771 | 217 | target_cpu=`normalize_cpu "$target_cpu"` | ||
772 | 218 | target_os=`normalize_os "$target_os"` | ||
773 | 219 | |||
774 | 158 | # check for linux only build | 220 | # check for linux only build |
776 | 159 | if test "$linux_only" = "guess"; then | 221 | if test "$build_generic" = "guess"; then |
777 | 160 | if test "$host_os" = "linux" -a "$target_os" = "linux"; then | 222 | if test "$host_os" = "linux" -a "$target_os" = "linux"; then |
779 | 161 | linux_only="yes" | 223 | build_generic="no" |
780 | 162 | else | 224 | else |
782 | 163 | linux_only="no" | 225 | build_generic="yes" |
783 | 164 | fi | 226 | fi |
784 | 165 | fi | 227 | fi |
785 | 166 | 228 | ||
786 | 167 | # check for biarch build (Linux only) | 229 | # check for biarch build (Linux only) |
790 | 168 | if test "$biarch" = "guess"; then | 230 | # XXX: biarch builds require LSB headers for now |
791 | 169 | # XXX: biarch builds require LSB headers for now | 231 | build_biarch_possible="no" |
792 | 170 | biarch="no" | 232 | if test "$host_os" = "linux" -a "$target_os" = "linux"; then |
793 | 171 | case $host_cpu:$target_cpu in | 233 | case $host_cpu:$target_cpu in |
794 | 172 | x86_64:i386 | ppc64:ppc) | 234 | x86_64:i386 | ppc64:ppc) |
798 | 173 | if test "$host_os" = "linux"; then | 235 | build_biarch_possible="yes" |
796 | 174 | biarch="yes" | ||
797 | 175 | fi | ||
799 | 176 | ;; | 236 | ;; |
800 | 177 | esac | 237 | esac |
801 | 178 | fi | 238 | fi |
802 | 239 | if test "$build_biarch" = "guess"; then | ||
803 | 240 | build_biarch="$build_biarch_possible" | ||
804 | 241 | elif test "$build_biarch" = "yes"; then | ||
805 | 242 | if test "$build_biarch_possible" = "no"; then | ||
806 | 243 | echo "WARNING: bi-arch build is not possible, disabling" | ||
807 | 244 | build_biarch="no" | ||
808 | 245 | fi | ||
809 | 246 | fi | ||
810 | 179 | 247 | ||
811 | 180 | # check for viewer build | 248 | # check for viewer build |
812 | 181 | if test "$build_viewer" = "guess"; then | 249 | if test "$build_viewer" = "guess"; then |
813 | 182 | build_viewer="no" | 250 | build_viewer="no" |
814 | 183 | case $host_os in | 251 | case $host_os in |
815 | 184 | linux) | 252 | linux) |
817 | 185 | if test "$host_cpu" = "$target_cpu" -o "$biarch" = "yes"; then | 253 | if test "$host_cpu" = "$target_cpu" -o "$build_biarch" = "yes"; then |
818 | 186 | build_viewer="yes" | 254 | build_viewer="yes" |
819 | 187 | fi | 255 | fi |
820 | 188 | ;; | 256 | ;; |
821 | @@ -224,6 +292,12 @@ | |||
822 | 224 | pkglibdir="$prefix/lib/$PACKAGE" | 292 | pkglibdir="$prefix/lib/$PACKAGE" |
823 | 225 | fi | 293 | fi |
824 | 226 | 294 | ||
825 | 295 | # check for viewer paths | ||
826 | 296 | default_viewer_paths="$pkglibdir/%ARCH%/%OS%" | ||
827 | 297 | if test -z "$viewer_paths"; then | ||
828 | 298 | viewer_paths="$default_viewer_paths" | ||
829 | 299 | fi | ||
830 | 300 | |||
831 | 227 | # check for __attribute__((visibility())) support | 301 | # check for __attribute__((visibility())) support |
832 | 228 | cat > $TMPC << EOF | 302 | cat > $TMPC << EOF |
833 | 229 | int foo __attribute__((visibility("hidden"))) = 1; | 303 | int foo __attribute__((visibility("hidden"))) = 1; |
834 | @@ -280,7 +354,7 @@ | |||
835 | 280 | fi | 354 | fi |
836 | 281 | 355 | ||
837 | 282 | # check for __stack_chk_fail() in target GNU C library | 356 | # check for __stack_chk_fail() in target GNU C library |
839 | 283 | if test "$biarch" = "yes"; then | 357 | if test "$build_biarch" = "yes"; then |
840 | 284 | glibc_header_dir="/usr/include" | 358 | glibc_header_dir="/usr/include" |
841 | 285 | libc_provides_ssp=no | 359 | libc_provides_ssp=no |
842 | 286 | if test -f $glibc_header_dir/features.h \ | 360 | if test -f $glibc_header_dir/features.h \ |
843 | @@ -370,7 +444,7 @@ | |||
844 | 370 | CFLAGS="$CFLAGS -mtune=generic" | 444 | CFLAGS="$CFLAGS -mtune=generic" |
845 | 371 | fi | 445 | fi |
846 | 372 | fi | 446 | fi |
848 | 373 | if test "$biarch" = "yes" -a -z "$CFLAGS_32"; then | 447 | if test "$build_biarch" = "yes" -a -z "$CFLAGS_32"; then |
849 | 374 | CFLAGS_32="-m32 -O2 -g" | 448 | CFLAGS_32="-m32 -O2 -g" |
850 | 375 | if check_cc_option -mtune=generic $CFLAGS_32; then | 449 | if check_cc_option -mtune=generic $CFLAGS_32; then |
851 | 376 | CFLAGS_32="$CFLAGS_32 -mtune=generic" | 450 | CFLAGS_32="$CFLAGS_32 -mtune=generic" |
852 | @@ -596,7 +670,7 @@ | |||
853 | 596 | is_ok="yes" | 670 | is_ok="yes" |
854 | 597 | ;; | 671 | ;; |
855 | 598 | glib) | 672 | glib) |
857 | 599 | if test "x$linux_only" = "xno"; then | 673 | if test "x$build_generic" = "xyes"; then |
858 | 600 | echo "WARNING: disabling glib memory hooks with --enable-generic" | 674 | echo "WARNING: disabling glib memory hooks with --enable-generic" |
859 | 601 | elif ! $pkgconfig --atleast-version=2.10 glib-2.0; then | 675 | elif ! $pkgconfig --atleast-version=2.10 glib-2.0; then |
860 | 602 | echo "WARNING: disabling glib memory hooks that require glib >= 2.10 (system is $GLIB_VERSION)" | 676 | echo "WARNING: disabling glib memory hooks that require glib >= 2.10 (system is $GLIB_VERSION)" |
861 | @@ -631,6 +705,7 @@ | |||
862 | 631 | echo " --help print this message" | 705 | echo " --help print this message" |
863 | 632 | echo " --prefix=PREFIX install in PREFIX [$prefix]" | 706 | echo " --prefix=PREFIX install in PREFIX [$prefix]" |
864 | 633 | echo " --pkglibdir=ROOT install private files in ROOT [$pkglibdir]" | 707 | echo " --pkglibdir=ROOT install private files in ROOT [$pkglibdir]" |
865 | 708 | echo " --viewer-paths=PATH allowed viewer lookup PATH [$viewer_paths]" | ||
866 | 634 | echo " --target-os=OS build plugin support for target OS [$target_os]" | 709 | echo " --target-os=OS build plugin support for target OS [$target_os]" |
867 | 635 | echo " --target-cpu=CPU build plugin support for target CPU [$target_cpu]" | 710 | echo " --target-cpu=CPU build plugin support for target CPU [$target_cpu]" |
868 | 636 | echo " --enable-viewer build viewer [$build_viewer]" | 711 | echo " --enable-viewer build viewer [$build_viewer]" |
869 | @@ -639,9 +714,10 @@ | |||
870 | 639 | echo "Advanced options (experts only):" | 714 | echo "Advanced options (experts only):" |
871 | 640 | echo " --source-path=PATH path of source code [$source_path]" | 715 | echo " --source-path=PATH path of source code [$source_path]" |
872 | 641 | echo " --enable-strip strip resulting binaries and libraries [$strip]" | 716 | echo " --enable-strip strip resulting binaries and libraries [$strip]" |
876 | 642 | echo " --enable-generic don't use system-specific additions" | 717 | echo " --enable-generic build with generic APIs [$build_generic]" |
877 | 643 | echo " --enable-biarch build both 32-bit and 64-bit components at once" | 718 | echo " --enable-biarch build both 32-bit and 64-bit components at once [$build_biarch]" |
878 | 644 | echo " --enable-pid-check enable PID check (DEBUG) [$use_pid_check]" | 719 | echo " --enable-thread-check enable main thread checks (DEBUG) [$enable_thread_check]" |
879 | 720 | echo " --enable-malloc-check enable memory allocation checks (DEBUG) [$enable_malloc_check]" | ||
880 | 645 | echo " --with-lib32=NAME use NAME as the 32-bit library dir name [$lib32]" | 721 | echo " --with-lib32=NAME use NAME as the 32-bit library dir name [$lib32]" |
881 | 646 | echo " --with-lib64=NAME use NAME as the 64-bit library dir name [$lib64]" | 722 | echo " --with-lib64=NAME use NAME as the 64-bit library dir name [$lib64]" |
882 | 647 | echo " --with-x11-prefix=PREFIX use PREFIX as the X11 base dir [autodetect]" | 723 | echo " --with-x11-prefix=PREFIX use PREFIX as the X11 base dir [autodetect]" |
883 | @@ -654,18 +730,19 @@ | |||
884 | 654 | exit 1 | 730 | exit 1 |
885 | 655 | fi | 731 | fi |
886 | 656 | 732 | ||
887 | 733 | echo "Source path $source_path" | ||
888 | 657 | echo "Install prefix $prefix" | 734 | echo "Install prefix $prefix" |
889 | 658 | echo "nspluginwrapper root dir $pkglibdir" | 735 | echo "nspluginwrapper root dir $pkglibdir" |
892 | 659 | echo "Strip binaries $strip" | 736 | echo "Viewer paths $viewer_paths" |
891 | 660 | echo "Bi-arch build $biarch" | ||
893 | 661 | echo "Build viewer $build_viewer" | 737 | echo "Build viewer $build_viewer" |
894 | 662 | echo "Build for Linux only $linux_only" | ||
895 | 663 | echo "Build standalone player $build_player" | 738 | echo "Build standalone player $build_player" |
896 | 739 | echo "Build 32-/64-bit at once $build_biarch" | ||
897 | 740 | echo "Build with generic APIs $build_generic" | ||
898 | 664 | echo "32-bit library dir name $lib32" | 741 | echo "32-bit library dir name $lib32" |
899 | 665 | echo "64-bit library dir name $lib64" | 742 | echo "64-bit library dir name $lib64" |
900 | 666 | echo "Source path $source_path" | ||
901 | 667 | echo "C compiler $cc" | 743 | echo "C compiler $cc" |
902 | 668 | echo "C++ compiler $cxx" | 744 | echo "C++ compiler $cxx" |
903 | 745 | echo "Strip binaries $strip" | ||
904 | 669 | echo "Host OS $host_os" | 746 | echo "Host OS $host_os" |
905 | 670 | echo "Host CPU $host_cpu" | 747 | echo "Host CPU $host_cpu" |
906 | 671 | echo "Host big endian $bigendian" | 748 | echo "Host big endian $bigendian" |
907 | @@ -673,7 +750,8 @@ | |||
908 | 673 | echo "Target CPU $target_cpu" | 750 | echo "Target CPU $target_cpu" |
909 | 674 | echo "RPC init timeout $rpc_init_timeout secs" | 751 | echo "RPC init timeout $rpc_init_timeout secs" |
910 | 675 | echo "Memory allocation hooks $malloc_hooks" | 752 | echo "Memory allocation hooks $malloc_hooks" |
912 | 676 | echo "Use PID check (DEBUG) $use_pid_check" | 753 | echo "Use thread checks (DEBUG) $enable_thread_check" |
913 | 754 | echo "Use malloc checks (DEBUG) $enable_malloc_check" | ||
914 | 677 | 755 | ||
915 | 678 | config_mak="config-host.mak" | 756 | config_mak="config-host.mak" |
916 | 679 | echo "# Automatically generated by configure - do not modify" > $config_mak | 757 | echo "# Automatically generated by configure - do not modify" > $config_mak |
917 | @@ -691,7 +769,7 @@ | |||
918 | 691 | echo "GTK_LDFLAGS=$GTK_LDFLAGS" >> $config_mak | 769 | echo "GTK_LDFLAGS=$GTK_LDFLAGS" >> $config_mak |
919 | 692 | echo "CURL_CFLAGS=$CURL_CFLAGS" >> $config_mak | 770 | echo "CURL_CFLAGS=$CURL_CFLAGS" >> $config_mak |
920 | 693 | echo "CURL_LDFLAGS=$CURL_LDFLAGS" >> $config_mak | 771 | echo "CURL_LDFLAGS=$CURL_LDFLAGS" >> $config_mak |
922 | 694 | if test "$biarch" = "yes"; then | 772 | if test "$build_biarch" = "yes"; then |
923 | 695 | echo "LDFLAGS_32=-m32" >> $config_mak | 773 | echo "LDFLAGS_32=-m32" >> $config_mak |
924 | 696 | echo "CFLAGS_32=$CFLAGS_32" >> $config_mak | 774 | echo "CFLAGS_32=$CFLAGS_32" >> $config_mak |
925 | 697 | else | 775 | else |
926 | @@ -768,7 +846,7 @@ | |||
927 | 768 | echo "SRC_PATH=$source_path" >> $config_mak | 846 | echo "SRC_PATH=$source_path" >> $config_mak |
928 | 769 | echo "build_viewer=$build_viewer" >> $config_mak | 847 | echo "build_viewer=$build_viewer" >> $config_mak |
929 | 770 | echo "build_player=$build_player" >> $config_mak | 848 | echo "build_player=$build_player" >> $config_mak |
931 | 771 | echo "biarch=$biarch" >> $config_mak | 849 | echo "build_biarch=$build_biarch" >> $config_mak |
932 | 772 | echo "lib32=$lib32" >> $config_mak | 850 | echo "lib32=$lib32" >> $config_mak |
933 | 773 | echo "lib64=$lib64" >> $config_mak | 851 | echo "lib64=$lib64" >> $config_mak |
934 | 774 | echo "prefix=$prefix" >> $config_mak | 852 | echo "prefix=$prefix" >> $config_mak |
935 | @@ -780,21 +858,11 @@ | |||
936 | 780 | echo "x11prefix=$x_base_dir" >> $config_mak | 858 | echo "x11prefix=$x_base_dir" >> $config_mak |
937 | 781 | echo "ALLOW_STRIP=$strip" >> $config_mak | 859 | echo "ALLOW_STRIP=$strip" >> $config_mak |
938 | 782 | 860 | ||
939 | 783 | VERSION=`sed < $source_path/$PACKAGE.spec -n '/^\%define version[ ]*/s///p'` | ||
940 | 784 | RELEASE=`sed < $source_path/$PACKAGE.spec -n '/^\%define release[ ]*/s///p'` | ||
941 | 785 | SVNDATE=`sed < $source_path/$PACKAGE.spec -n '/^\%define svndate[ ]*/s///p'` | ||
942 | 786 | if test -z "$SVNDATE"; then | ||
943 | 787 | SVNDATE=`date '+%Y%m%d'` | ||
944 | 788 | fi | ||
945 | 789 | SNAPSHOT=0 | ||
946 | 790 | if echo "$RELEASE" | grep -q ^0; then | ||
947 | 791 | SNAPSHOT=1 | ||
948 | 792 | fi | ||
949 | 793 | echo "VERSION=$VERSION" >> $config_mak | 861 | echo "VERSION=$VERSION" >> $config_mak |
950 | 794 | echo "SVNDATE=$SVNDATE" >> $config_mak | 862 | echo "SVNDATE=$SVNDATE" >> $config_mak |
951 | 795 | echo "SNAPSHOT=$SNAPSHOT" >> $config_mak | 863 | echo "SNAPSHOT=$SNAPSHOT" >> $config_mak |
952 | 796 | echo "#define NPW_SNAPSHOT $SNAPSHOT" >> $config_h | 864 | echo "#define NPW_SNAPSHOT $SNAPSHOT" >> $config_h |
954 | 797 | if test "$SNAPSHOT" = "1"; then | 865 | if test $SNAPSHOT -ge 2; then |
955 | 798 | echo "#define NPW_VERSION \"$VERSION-Pre ($SVNDATE)\"" >> $config_h | 866 | echo "#define NPW_VERSION \"$VERSION-Pre ($SVNDATE)\"" >> $config_h |
956 | 799 | else | 867 | else |
957 | 800 | echo "#define NPW_VERSION \"$VERSION\"" >> $config_h | 868 | echo "#define NPW_VERSION \"$VERSION\"" >> $config_h |
958 | @@ -803,6 +871,26 @@ | |||
959 | 803 | echo "pkglibdir=$pkglibdir" >> $config_mak | 871 | echo "pkglibdir=$pkglibdir" >> $config_mak |
960 | 804 | echo "#define NPW_LIBDIR \"$pkglibdir\"" >> $config_h | 872 | echo "#define NPW_LIBDIR \"$pkglibdir\"" >> $config_h |
961 | 805 | 873 | ||
962 | 874 | # check if we want to install files in ARCH/OS specific locations | ||
963 | 875 | if echo ":$viewer_paths" | $EGREP -q ":$pkglibdir/%(ARCH|OS)%"; then | ||
964 | 876 | npw_common_libdir="$pkglibdir/noarch" | ||
965 | 877 | npw_host_libdir="$pkglibdir/$host_cpu/$host_os" | ||
966 | 878 | npw_target_libdir="$pkglibdir/$target_cpu/$target_os" | ||
967 | 879 | npw_target_libdir_var="$pkglibdir/\\\$\$TARGET_ARCH/\\\$\$TARGET_OS" | ||
968 | 880 | else | ||
969 | 881 | npw_common_libdir="$pkglibdir" | ||
970 | 882 | npw_host_libdir="$npw_common_libdir" | ||
971 | 883 | npw_target_libdir="$npw_common_libdir" | ||
972 | 884 | npw_target_libdir_var="$npw_common_libdir" | ||
973 | 885 | fi | ||
974 | 886 | echo "npcommondir=$npw_common_libdir" >> $config_mak | ||
975 | 887 | echo "nphostdir=$npw_host_libdir" >> $config_mak | ||
976 | 888 | echo "nptargetdir=$npw_target_libdir" >> $config_mak | ||
977 | 889 | echo "nptargetdir_var=$npw_target_libdir_var" >> $config_mak | ||
978 | 890 | echo "#define NPW_HOST_LIBDIR \"$npw_host_libdir\"" >> $config_h | ||
979 | 891 | echo "#define NPW_TARGET_LIBDIR \"$npw_target_libdir\"" >> $config_h | ||
980 | 892 | echo "#define NPW_VIEWER_PATHS \"$viewer_paths\"" >> $config_h | ||
981 | 893 | |||
982 | 806 | echo "#define RPC_INIT_TIMEOUT $rpc_init_timeout" >> $config_h | 894 | echo "#define RPC_INIT_TIMEOUT $rpc_init_timeout" >> $config_h |
983 | 807 | 895 | ||
984 | 808 | for mh in $malloc_hooks; do | 896 | for mh in $malloc_hooks; do |
985 | @@ -832,11 +920,29 @@ | |||
986 | 832 | else | 920 | else |
987 | 833 | echo "#undef TARGET_LIBC_PROVIDES_SSP" >> $config_h | 921 | echo "#undef TARGET_LIBC_PROVIDES_SSP" >> $config_h |
988 | 834 | fi | 922 | fi |
994 | 835 | if test "$use_pid_check" = "yes"; then | 923 | if test "$enable_thread_check" = "yes"; then |
995 | 836 | echo "#define USE_PID_CHECK 1" >> $config_h | 924 | echo "#define ENABLE_THREAD_CHECK 1" >> $config_h |
996 | 837 | else | 925 | else |
997 | 838 | echo "#define USE_PID_CHECK 0" >> $config_h | 926 | echo "#undef ENABLE_THREAD_CHECK" >> $config_h |
998 | 839 | fi | 927 | fi |
999 | 928 | if test "$enable_malloc_check" = "yes"; then | ||
1000 | 929 | echo "#define ENABLE_MALLOC_CHECK 1" >> $config_h | ||
1001 | 930 | else | ||
1002 | 931 | echo "#undef ENABLE_MALLOC_CHECK" >> $config_h | ||
1003 | 932 | fi | ||
1004 | 933 | |||
1005 | 934 | # check for functions in <glib.h> | ||
1006 | 935 | for func in g_hash_table_remove_all g_hash_table_find; do | ||
1007 | 936 | cat > $TMPC << EOF | ||
1008 | 937 | extern void $func(void); | ||
1009 | 938 | int main(void) { $func(); return 0; } | ||
1010 | 939 | EOF | ||
1011 | 940 | if $cc $TMPC -o $TMPE $GLIB_CFLAGS $GLIB_LDFLAGS > /dev/null 2>&1; then | ||
1012 | 941 | func_def=`echo "$func" | tr '[:lower:]./-' '[:upper:]___'` | ||
1013 | 942 | echo "#define HAVE_$func_def 1" >> $config_h | ||
1014 | 943 | fi | ||
1015 | 944 | rm -f $TMPC $TMPE | ||
1016 | 945 | done | ||
1017 | 840 | 946 | ||
1018 | 841 | config_mak="config.mak" | 947 | config_mak="config.mak" |
1019 | 842 | echo "# Automatically generated by configure - do not modify" > $config_mak | 948 | echo "# Automatically generated by configure - do not modify" > $config_mak |
1020 | @@ -846,8 +952,10 @@ | |||
1021 | 846 | echo "/* Automatically generated by configure - do not modify */" > $config_h | 952 | echo "/* Automatically generated by configure - do not modify */" > $config_h |
1022 | 847 | echo "#include \"config-host.h\"" >> $config_h | 953 | echo "#include \"config-host.h\"" >> $config_h |
1023 | 848 | 954 | ||
1026 | 849 | if test "$linux_only" = "yes"; then | 955 | if test "$build_generic" = "yes"; then |
1027 | 850 | echo "#define BUILD_LINUX_ONLY 1" >> $config_h | 956 | echo "#define BUILD_GENERIC 1" >> $config_h |
1028 | 957 | else | ||
1029 | 958 | echo "#undef BUILD_GENERIC" >> $config_h | ||
1030 | 851 | fi | 959 | fi |
1031 | 852 | 960 | ||
1032 | 853 | if test "$target_os" = "linux"; then | 961 | if test "$target_os" = "linux"; then |
1033 | 854 | 962 | ||
1034 | === modified file 'debian/changelog' | |||
1035 | --- debian/changelog 2009-04-08 18:38:27 +0000 | |||
1036 | +++ debian/changelog 2009-08-11 01:50:22 +0000 | |||
1037 | @@ -1,3 +1,30 @@ | |||
1038 | 1 | nspluginwrapper (1.3.0-0ubuntu1) karmic; urgency=low | ||
1039 | 2 | |||
1040 | 3 | * New upstream release 1.3.0 (LP: #411740) | ||
1041 | 4 | * Update Maintainer field in debian/control, as proposed by | ||
1042 | 5 | DebianMaintainerField spec | ||
1043 | 6 | * Update debian/patches/000_debian_make_symlinks.diff | ||
1044 | 7 | - change short option for "nosymlinks" from "n" to "x" to avoid collision | ||
1045 | 8 | with option "native" | ||
1046 | 9 | - add option "nosymlinks" to print_usage() | ||
1047 | 10 | * Update debian/patches/003_update_help_info.diff because of change in | ||
1048 | 11 | debian/patches/000_debian_make_symlinks.diff | ||
1049 | 12 | * Update debian/patches/use_syslsb.patch because of different Makefile | ||
1050 | 13 | * Add patch debian/patches/004_system_only_update.diff from Debian | ||
1051 | 14 | version 1.2.2-1 | ||
1052 | 15 | * Refresh patches | ||
1053 | 16 | |||
1054 | 17 | -- Sasa Bodiroza <jazzva@gmail.com> Tue, 11 Aug 2009 03:49:59 +0200 | ||
1055 | 18 | |||
1056 | 19 | nspluginwrapper (1.2.2-0ubuntu6) karmic; urgency=low | ||
1057 | 20 | |||
1058 | 21 | * debian/patches/use_syslsb.patch; dont build LSB libs on our own; | ||
1059 | 22 | this should unbreak flash+nspluginwrapper after latest ia32-libs | ||
1060 | 23 | update | ||
1061 | 24 | + use USE_SYSTEM_LSB accordingly in debian/rules | ||
1062 | 25 | |||
1063 | 26 | -- Alexander Sack <asac@ubuntu.com> Sun, 09 Aug 2009 14:31:49 +0200 | ||
1064 | 27 | |||
1065 | 1 | nspluginwrapper (1.2.2-0ubuntu5) jaunty; urgency=low | 28 | nspluginwrapper (1.2.2-0ubuntu5) jaunty; urgency=low |
1066 | 2 | 29 | ||
1067 | 3 | * Add iceweasel dir to debian/nspluginwrapper.postinst for removal of | 30 | * Add iceweasel dir to debian/nspluginwrapper.postinst for removal of |
1068 | 4 | 31 | ||
1069 | === modified file 'debian/control' | |||
1070 | --- debian/control 2008-08-27 17:19:36 +0000 | |||
1071 | +++ debian/control 2009-08-11 00:41:22 +0000 | |||
1072 | @@ -1,7 +1,7 @@ | |||
1073 | 1 | Source: nspluginwrapper | 1 | Source: nspluginwrapper |
1074 | 2 | Section: utils | 2 | Section: utils |
1075 | 3 | Priority: optional | 3 | Priority: optional |
1077 | 4 | Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
1078 | 5 | XSBC-Original-Maintainer: Rob Andrews <rob@choralone.org> | 5 | XSBC-Original-Maintainer: Rob Andrews <rob@choralone.org> |
1079 | 6 | Build-Depends: debhelper (>= 5), quilt, autotools-dev, libc6-dev-i386 [ amd64 ], libxt-dev, x11proto-core-dev, x11proto-xext-dev, libx11-dev, libatk1.0-dev, libfontconfig1-dev, libgtk2.0-dev, libglib2.0-dev, libpango1.0-dev, ia32-libs [ amd64 ], gcc-multilib [ amd64 ], g++-multilib [ amd64 ], libcurl4-gnutls-dev | 6 | Build-Depends: debhelper (>= 5), quilt, autotools-dev, libc6-dev-i386 [ amd64 ], libxt-dev, x11proto-core-dev, x11proto-xext-dev, libx11-dev, libatk1.0-dev, libfontconfig1-dev, libgtk2.0-dev, libglib2.0-dev, libpango1.0-dev, ia32-libs [ amd64 ], gcc-multilib [ amd64 ], g++-multilib [ amd64 ], libcurl4-gnutls-dev |
1080 | 7 | Standards-Version: 3.8.0 | 7 | Standards-Version: 3.8.0 |
1081 | 8 | 8 | ||
1082 | === modified file 'debian/patches/000_debian_make_symlinks.diff' | |||
1083 | --- debian/patches/000_debian_make_symlinks.diff 2009-03-07 17:43:52 +0000 | |||
1084 | +++ debian/patches/000_debian_make_symlinks.diff 2009-08-11 01:31:54 +0000 | |||
1085 | @@ -7,10 +7,10 @@ | |||
1086 | 7 | 7 | ||
1087 | 8 | -- Rob Andrews <rob@choralone.org> Fri, 29 Jun 2007 21:59:49 +0100 | 8 | -- Rob Andrews <rob@choralone.org> Fri, 29 Jun 2007 21:59:49 +0100 |
1088 | 9 | 9 | ||
1090 | 10 | Index: ubuntu.1.2.2-0ubuntu1/src/npw-config.c | 10 | Index: ubuntu/src/npw-config.c |
1091 | 11 | =================================================================== | 11 | =================================================================== |
1094 | 12 | --- ubuntu.1.2.2-0ubuntu1.orig/src/npw-config.c 2009-01-03 16:26:07.000000000 +0100 | 12 | --- ubuntu.orig/src/npw-config.c 2009-08-11 01:53:50.000000000 +0200 |
1095 | 13 | +++ ubuntu.1.2.2-0ubuntu1/src/npw-config.c 2009-03-07 18:38:14.000000000 +0100 | 13 | +++ ubuntu/src/npw-config.c 2009-08-11 01:59:54.000000000 +0200 |
1096 | 14 | @@ -44,6 +44,16 @@ | 14 | @@ -44,6 +44,16 @@ |
1097 | 15 | static bool g_allow_native = false; | 15 | static bool g_allow_native = false; |
1098 | 16 | static const char NPW_CONFIG[] = "nspluginwrapper"; | 16 | static const char NPW_CONFIG[] = "nspluginwrapper"; |
1099 | @@ -28,7 +28,7 @@ | |||
1100 | 28 | static void error(const char *format, ...) | 28 | static void error(const char *format, ...) |
1101 | 29 | { | 29 | { |
1102 | 30 | va_list args; | 30 | va_list args; |
1104 | 31 | @@ -161,7 +171,7 @@ | 31 | @@ -226,7 +236,7 @@ |
1105 | 32 | } | 32 | } |
1106 | 33 | else if (access("/etc/debian_version", F_OK) == 0) { | 33 | else if (access("/etc/debian_version", F_OK) == 0) { |
1107 | 34 | static const char *debian_dirs[] = { | 34 | static const char *debian_dirs[] = { |
1108 | @@ -37,7 +37,7 @@ | |||
1109 | 37 | }; | 37 | }; |
1110 | 38 | dirs = debian_dirs; | 38 | dirs = debian_dirs; |
1111 | 39 | } | 39 | } |
1113 | 40 | @@ -812,6 +822,49 @@ | 40 | @@ -941,6 +951,49 @@ |
1114 | 41 | printf(" into %s\n", d_plugin_path); | 41 | printf(" into %s\n", d_plugin_path); |
1115 | 42 | 42 | ||
1116 | 43 | free(plugin_data); | 43 | free(plugin_data); |
1117 | @@ -87,7 +87,7 @@ | |||
1118 | 87 | return 0; | 87 | return 0; |
1119 | 88 | } | 88 | } |
1120 | 89 | 89 | ||
1122 | 90 | @@ -871,6 +924,48 @@ | 90 | @@ -1000,6 +1053,48 @@ |
1123 | 91 | if (unlink(plugin_path) < 0) | 91 | if (unlink(plugin_path) < 0) |
1124 | 92 | return 1; | 92 | return 1; |
1125 | 93 | 93 | ||
1126 | @@ -136,7 +136,15 @@ | |||
1127 | 136 | return 0; | 136 | return 0; |
1128 | 137 | } | 137 | } |
1129 | 138 | 138 | ||
1131 | 139 | @@ -1033,6 +1128,12 @@ | 139 | @@ -1141,6 +1236,7 @@ |
1132 | 140 | printf(" -a --auto flag: set automatic mode for plugins discovery\n"); | ||
1133 | 141 | printf(" -n --native flag: allow native plugin(s) to be wrapped\n"); | ||
1134 | 142 | printf(" -l --list list plugins currently installed\n"); | ||
1135 | 143 | + printf(" -x --nosymlinks do not create symlinks to the installed plugin\n"); | ||
1136 | 144 | printf(" -u --update update plugin(s) currently installed\n"); | ||
1137 | 145 | printf(" -i --install [FILE(S)] install plugin(s)\n"); | ||
1138 | 146 | printf(" -r --remove [FILE(S)] remove plugin(s)\n"); | ||
1139 | 147 | @@ -1171,6 +1267,12 @@ | ||
1140 | 140 | return 0; | 148 | return 0; |
1141 | 141 | } | 149 | } |
1142 | 142 | 150 | ||
1143 | @@ -149,11 +157,11 @@ | |||
1144 | 149 | static int process_list(int argvc, char *argv[]) | 157 | static int process_list(int argvc, char *argv[]) |
1145 | 150 | { | 158 | { |
1146 | 151 | const char **plugin_dirs = get_mozilla_plugin_dirs(); | 159 | const char **plugin_dirs = get_mozilla_plugin_dirs(); |
1148 | 152 | @@ -1152,6 +1253,7 @@ | 160 | @@ -1294,6 +1396,7 @@ |
1149 | 153 | { 'a', "auto", process_auto, 0 }, | 161 | { 'a', "auto", process_auto, 0 }, |
1150 | 154 | { 'n', "native", process_native, 0 }, | 162 | { 'n', "native", process_native, 0 }, |
1151 | 155 | { 'l', "list", process_list, 1 }, | 163 | { 'l', "list", process_list, 1 }, |
1153 | 156 | + { 'n', "nosymlinks", process_nolink, 0 }, | 164 | + { 'x', "nosymlinks", process_nolink, 0 }, |
1154 | 157 | { 'u', "update", process_update, 1 }, | 165 | { 'u', "update", process_update, 1 }, |
1155 | 158 | { 'i', "install", process_install, 1 }, | 166 | { 'i', "install", process_install, 1 }, |
1156 | 159 | { 'r', "remove", process_remove, 1 }, | 167 | { 'r', "remove", process_remove, 1 }, |
1157 | 160 | 168 | ||
1158 | === modified file 'debian/patches/001_remove_bashisms.diff' | |||
1159 | --- debian/patches/001_remove_bashisms.diff 2009-03-07 17:43:52 +0000 | |||
1160 | +++ debian/patches/001_remove_bashisms.diff 2009-08-11 01:00:52 +0000 | |||
1161 | @@ -3,10 +3,10 @@ | |||
1162 | 3 | 3 | ||
1163 | 4 | -- Rob Andrews <rob@choralone.org> Thu, 28 Jun 2007 18:08:54 +0100 | 4 | -- Rob Andrews <rob@choralone.org> Thu, 28 Jun 2007 18:08:54 +0100 |
1164 | 5 | 5 | ||
1166 | 6 | Index: ubuntu.1.2.2-0ubuntu1/utils/mkruntime.sh | 6 | Index: nspluginwrapper/utils/mkruntime.sh |
1167 | 7 | =================================================================== | 7 | =================================================================== |
1170 | 8 | --- ubuntu.1.2.2-0ubuntu1.orig/utils/mkruntime.sh 2009-01-02 11:19:18.000000000 +0100 | 8 | --- nspluginwrapper.orig/utils/mkruntime.sh 2009-08-11 02:41:59.000000000 +0200 |
1171 | 9 | +++ ubuntu.1.2.2-0ubuntu1/utils/mkruntime.sh 2009-03-07 18:38:19.000000000 +0100 | 9 | +++ nspluginwrapper/utils/mkruntime.sh 2009-08-11 02:45:41.000000000 +0200 |
1172 | 10 | @@ -12,15 +12,15 @@ | 10 | @@ -12,15 +12,15 @@ |
1173 | 11 | # - Check acroread5, something is missing while loading a PDF | 11 | # - Check acroread5, something is missing while loading a PDF |
1174 | 12 | # - Enough for Flash Player & PluginSDK npsimple.so | 12 | # - Enough for Flash Player & PluginSDK npsimple.so |
1175 | 13 | 13 | ||
1176 | === modified file 'debian/patches/002_install_to_NSPLUGINDIR.diff' | |||
1177 | --- debian/patches/002_install_to_NSPLUGINDIR.diff 2009-03-19 20:47:09 +0000 | |||
1178 | +++ debian/patches/002_install_to_NSPLUGINDIR.diff 2009-08-11 01:00:52 +0000 | |||
1179 | @@ -5,11 +5,11 @@ | |||
1180 | 5 | 5 | ||
1181 | 6 | -- Rob Andrews <rob@choralone.org> Sat, 14 Jul 2007 18:45:00 +0100 | 6 | -- Rob Andrews <rob@choralone.org> Sat, 14 Jul 2007 18:45:00 +0100 |
1182 | 7 | 7 | ||
1184 | 8 | Index: ubuntu.1.2.2-0ubuntu2/src/npw-config.c | 8 | Index: nspluginwrapper/src/npw-config.c |
1185 | 9 | =================================================================== | 9 | =================================================================== |
1189 | 10 | --- ubuntu.1.2.2-0ubuntu2.orig/src/npw-config.c 2009-03-19 21:33:48.000000000 +0100 | 10 | --- nspluginwrapper.orig/src/npw-config.c 2009-08-11 02:45:38.000000000 +0200 |
1190 | 11 | +++ ubuntu.1.2.2-0ubuntu2/src/npw-config.c 2009-03-19 21:34:02.000000000 +0100 | 11 | +++ nspluginwrapper/src/npw-config.c 2009-08-11 02:45:50.000000000 +0200 |
1191 | 12 | @@ -124,6 +124,10 @@ | 12 | @@ -189,6 +189,10 @@ |
1192 | 13 | static const char default_dir[] = LIBDIR "/mozilla/plugins"; | 13 | static const char default_dir[] = LIBDIR "/mozilla/plugins"; |
1193 | 14 | static const char *dir = NULL; | 14 | static const char *dir = NULL; |
1194 | 15 | 15 | ||
1195 | @@ -20,7 +20,7 @@ | |||
1196 | 20 | if (dir == NULL) { | 20 | if (dir == NULL) { |
1197 | 21 | const char **dirs = NULL; | 21 | const char **dirs = NULL; |
1198 | 22 | 22 | ||
1200 | 23 | @@ -826,7 +830,8 @@ | 23 | @@ -955,7 +959,8 @@ |
1201 | 24 | /* Install symlinks on Debian systems */ | 24 | /* Install symlinks on Debian systems */ |
1202 | 25 | if (has_system_wide_wrapper_plugin(plugin_path, true) | 25 | if (has_system_wide_wrapper_plugin(plugin_path, true) |
1203 | 26 | && (access("/etc/debian_version", F_OK) == 0) | 26 | && (access("/etc/debian_version", F_OK) == 0) |
1204 | 27 | 27 | ||
1205 | === modified file 'debian/patches/003_update_help_info.diff' | |||
1206 | --- debian/patches/003_update_help_info.diff 2009-03-07 17:43:52 +0000 | |||
1207 | +++ debian/patches/003_update_help_info.diff 2009-08-11 01:31:54 +0000 | |||
1208 | @@ -2,14 +2,14 @@ | |||
1209 | 2 | 2 | ||
1210 | 3 | -- Rob Andrews <rob@choralone.org> Sun, 02 Sep 2007 11:58:27 +0100 | 3 | -- Rob Andrews <rob@choralone.org> Sun, 02 Sep 2007 11:58:27 +0100 |
1211 | 4 | 4 | ||
1213 | 5 | Index: ubuntu.1.2.2-0ubuntu1/src/npw-config.c | 5 | Index: nspluginwrapper/src/npw-config.c |
1214 | 6 | =================================================================== | 6 | =================================================================== |
1219 | 7 | --- ubuntu.1.2.2-0ubuntu1.orig/src/npw-config.c 2009-03-07 18:38:23.000000000 +0100 | 7 | --- nspluginwrapper.orig/src/npw-config.c 2009-08-11 02:46:48.000000000 +0200 |
1220 | 8 | +++ ubuntu.1.2.2-0ubuntu1/src/npw-config.c 2009-03-07 18:38:28.000000000 +0100 | 8 | +++ nspluginwrapper/src/npw-config.c 2009-08-11 02:47:57.000000000 +0200 |
1221 | 9 | @@ -1102,7 +1102,7 @@ | 9 | @@ -1242,7 +1242,7 @@ |
1218 | 10 | printf(" -a --auto flag: set automatic mode for plugins discovery\n"); | ||
1222 | 11 | printf(" -n --native flag: allow native plugin(s) to be wrapped\n"); | 10 | printf(" -n --native flag: allow native plugin(s) to be wrapped\n"); |
1223 | 12 | printf(" -l --list list plugins currently installed\n"); | 11 | printf(" -l --list list plugins currently installed\n"); |
1224 | 12 | printf(" -x --nosymlinks do not create symlinks to the installed plugin\n"); | ||
1225 | 13 | - printf(" -u --update update plugin(s) currently installed\n"); | 13 | - printf(" -u --update update plugin(s) currently installed\n"); |
1226 | 14 | + printf(" -u --update [FILE(S)] update plugin(s) currently installed\n"); | 14 | + printf(" -u --update [FILE(S)] update plugin(s) currently installed\n"); |
1227 | 15 | printf(" -i --install [FILE(S)] install plugin(s)\n"); | 15 | printf(" -i --install [FILE(S)] install plugin(s)\n"); |
1228 | 16 | 16 | ||
1229 | === modified file 'debian/patches/004_fix_threading.diff' | |||
1230 | --- debian/patches/004_fix_threading.diff 2009-03-07 17:43:52 +0000 | |||
1231 | +++ debian/patches/004_fix_threading.diff 2009-08-11 01:00:52 +0000 | |||
1232 | @@ -2,10 +2,10 @@ | |||
1233 | 2 | 2 | ||
1234 | 3 | -- Rob Andrews <rob@choralone.org> Sat, 26 Jan 2008 03:01:31 +0000 | 3 | -- Rob Andrews <rob@choralone.org> Sat, 26 Jan 2008 03:01:31 +0000 |
1235 | 4 | 4 | ||
1237 | 5 | Index: ubuntu.1.2.2-0ubuntu1/Makefile | 5 | Index: nspluginwrapper/Makefile |
1238 | 6 | =================================================================== | 6 | =================================================================== |
1241 | 7 | --- ubuntu.1.2.2-0ubuntu1.orig/Makefile 2009-01-02 11:19:18.000000000 +0100 | 7 | --- nspluginwrapper.orig/Makefile 2009-08-11 02:41:59.000000000 +0200 |
1242 | 8 | +++ ubuntu.1.2.2-0ubuntu1/Makefile 2009-03-07 18:38:33.000000000 +0100 | 8 | +++ nspluginwrapper/Makefile 2009-08-11 02:49:12.000000000 +0200 |
1243 | 9 | @@ -120,7 +120,7 @@ | 9 | @@ -120,7 +120,7 @@ |
1244 | 10 | npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0 | 10 | npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0 |
1245 | 11 | npviewer_CFLAGS += -I$(LSB_INC_DIR)/gtk-2.0 | 11 | npviewer_CFLAGS += -I$(LSB_INC_DIR)/gtk-2.0 |
1246 | 12 | 12 | ||
1247 | === added file 'debian/patches/004_system_only_update.diff' | |||
1248 | --- debian/patches/004_system_only_update.diff 1970-01-01 00:00:00 +0000 | |||
1249 | +++ debian/patches/004_system_only_update.diff 2009-08-11 01:31:54 +0000 | |||
1250 | @@ -0,0 +1,63 @@ | |||
1251 | 1 | Force npconfig to only update system mozilla plugin dir if requested. | ||
1252 | 2 | |||
1253 | 3 | -- Rob Andrews <rob@choralone.org> Mon, 09 Mar 2009 22:59:45 +0000 | ||
1254 | 4 | |||
1255 | 5 | Index: nspluginwrapper/src/npw-config.c | ||
1256 | 6 | =================================================================== | ||
1257 | 7 | --- nspluginwrapper.orig/src/npw-config.c 2009-08-11 03:22:31.000000000 +0200 | ||
1258 | 8 | +++ nspluginwrapper/src/npw-config.c 2009-08-11 03:22:31.000000000 +0200 | ||
1259 | 9 | @@ -42,6 +42,7 @@ | ||
1260 | 10 | static bool g_auto = false; | ||
1261 | 11 | static bool g_verbose = false; | ||
1262 | 12 | static bool g_allow_native = false; | ||
1263 | 13 | +static bool g_systemonly = false; | ||
1264 | 14 | static const char NPW_CONFIG[] = "nspluginwrapper"; | ||
1265 | 15 | |||
1266 | 16 | /* On Debian systems, we install/remove symlinks from these paths. | ||
1267 | 17 | @@ -1239,6 +1240,7 @@ | ||
1268 | 18 | printf(" -h --help print this message\n"); | ||
1269 | 19 | printf(" -v --verbose flag: set verbose mode\n"); | ||
1270 | 20 | printf(" -a --auto flag: set automatic mode for plugins discovery\n"); | ||
1271 | 21 | + printf(" -s --systemonly when auto updating, only process the system plugin directory\n"); | ||
1272 | 22 | printf(" -n --native flag: allow native plugin(s) to be wrapped\n"); | ||
1273 | 23 | printf(" -l --list list plugins currently installed\n"); | ||
1274 | 24 | printf(" -x --nosymlinks do not create symlinks to the installed plugin\n"); | ||
1275 | 25 | @@ -1298,9 +1300,16 @@ | ||
1276 | 26 | { | ||
1277 | 27 | int i; | ||
1278 | 28 | |||
1279 | 29 | - if (g_auto) | ||
1280 | 30 | + if (g_auto && !g_systemonly) | ||
1281 | 31 | return auto_update_plugins(); | ||
1282 | 32 | |||
1283 | 33 | + if (g_auto && g_systemonly) | ||
1284 | 34 | + { | ||
1285 | 35 | + if (g_verbose) | ||
1286 | 36 | + printf("Auto-updating system plugin path.\n"); | ||
1287 | 37 | + return process_plugin_dir(get_system_mozilla_plugin_dir(), (is_plugin_cb)is_wrapper_plugin_0, (process_plugin_cb)update_plugin); | ||
1288 | 38 | + } | ||
1289 | 39 | + | ||
1290 | 40 | if (argc < 1) | ||
1291 | 41 | error("expected plugin(s) file name to update"); | ||
1292 | 42 | |||
1293 | 43 | @@ -1371,6 +1380,12 @@ | ||
1294 | 44 | return 0; | ||
1295 | 45 | } | ||
1296 | 46 | |||
1297 | 47 | +static int process_system_only(int argc, char *argv[]) | ||
1298 | 48 | +{ | ||
1299 | 49 | + g_systemonly = true; | ||
1300 | 50 | + return 0; | ||
1301 | 51 | +} | ||
1302 | 52 | + | ||
1303 | 53 | int main(int argc, char *argv[]) | ||
1304 | 54 | { | ||
1305 | 55 | char **args; | ||
1306 | 56 | @@ -1399,6 +1414,7 @@ | ||
1307 | 57 | { 'h', "help", process_help, 1 }, | ||
1308 | 58 | { 'v', "verbose", process_verbose, 0 }, | ||
1309 | 59 | { 'a', "auto", process_auto, 0 }, | ||
1310 | 60 | + { 's', "systemonly", process_system_only, 0 }, | ||
1311 | 61 | { 'n', "native", process_native, 0 }, | ||
1312 | 62 | { 'l', "list", process_list, 1 }, | ||
1313 | 63 | { 'x', "nosymlinks", process_nolink, 0 }, | ||
1314 | 0 | 64 | ||
1315 | === modified file 'debian/patches/005_process_env_dirs.diff' | |||
1316 | --- debian/patches/005_process_env_dirs.diff 2009-04-02 14:37:55 +0000 | |||
1317 | +++ debian/patches/005_process_env_dirs.diff 2009-08-11 01:28:09 +0000 | |||
1318 | @@ -4,10 +4,10 @@ | |||
1319 | 4 | Adjust npconfig_CFLAGS in Makefile to include glib during compile. | 4 | Adjust npconfig_CFLAGS in Makefile to include glib during compile. |
1320 | 5 | 5 | ||
1321 | 6 | -- Sasa Bodiroza <jazzva@gmail.com> Wed, 01 Apr 2009 21:50:00 +0200 | 6 | -- Sasa Bodiroza <jazzva@gmail.com> Wed, 01 Apr 2009 21:50:00 +0200 |
1323 | 7 | Index: ubuntu.1.2.2-0ubuntu3/src/npw-config.c | 7 | Index: nspluginwrapper/src/npw-config.c |
1324 | 8 | =================================================================== | 8 | =================================================================== |
1327 | 9 | --- ubuntu.1.2.2-0ubuntu3.orig/src/npw-config.c 2009-04-02 16:29:55.000000000 +0200 | 9 | --- nspluginwrapper.orig/src/npw-config.c 2009-08-11 03:22:49.000000000 +0200 |
1328 | 10 | +++ ubuntu.1.2.2-0ubuntu3/src/npw-config.c 2009-04-02 16:32:56.000000000 +0200 | 10 | +++ nspluginwrapper/src/npw-config.c 2009-08-11 03:22:49.000000000 +0200 |
1329 | 11 | @@ -38,6 +38,7 @@ | 11 | @@ -38,6 +38,7 @@ |
1330 | 12 | #include <pwd.h> | 12 | #include <pwd.h> |
1331 | 13 | #include <dirent.h> | 13 | #include <dirent.h> |
1332 | @@ -16,7 +16,7 @@ | |||
1333 | 16 | 16 | ||
1334 | 17 | static bool g_auto = false; | 17 | static bool g_auto = false; |
1335 | 18 | static bool g_verbose = false; | 18 | static bool g_verbose = false; |
1337 | 19 | @@ -213,6 +214,21 @@ | 19 | @@ -279,6 +280,21 @@ |
1338 | 20 | return plugin_path; | 20 | return plugin_path; |
1339 | 21 | } | 21 | } |
1340 | 22 | 22 | ||
1341 | @@ -38,7 +38,7 @@ | |||
1342 | 38 | static const char **get_mozilla_plugin_dirs(void) | 38 | static const char **get_mozilla_plugin_dirs(void) |
1343 | 39 | { | 39 | { |
1344 | 40 | static const char *default_dirs[] = { | 40 | static const char *default_dirs[] = { |
1346 | 41 | @@ -257,13 +273,23 @@ | 41 | @@ -323,13 +339,23 @@ |
1347 | 42 | }; | 42 | }; |
1348 | 43 | 43 | ||
1349 | 44 | const int n_default_dirs = (sizeof(default_dirs) / sizeof(default_dirs[0])); | 44 | const int n_default_dirs = (sizeof(default_dirs) / sizeof(default_dirs[0])); |
1350 | @@ -63,10 +63,10 @@ | |||
1351 | 63 | dirs[j++] = get_user_mozilla_plugin_dir(); | 63 | dirs[j++] = get_user_mozilla_plugin_dir(); |
1352 | 64 | dirs[j] = NULL; | 64 | dirs[j] = NULL; |
1353 | 65 | return dirs; | 65 | return dirs; |
1355 | 66 | Index: ubuntu.1.2.2-0ubuntu3/Makefile | 66 | Index: nspluginwrapper/Makefile |
1356 | 67 | =================================================================== | 67 | =================================================================== |
1359 | 68 | --- ubuntu.1.2.2-0ubuntu3.orig/Makefile 2009-04-02 16:29:55.000000000 +0200 | 68 | --- nspluginwrapper.orig/Makefile 2009-08-11 03:22:48.000000000 +0200 |
1360 | 69 | +++ ubuntu.1.2.2-0ubuntu3/Makefile 2009-04-02 16:29:55.000000000 +0200 | 69 | +++ nspluginwrapper/Makefile 2009-08-11 03:22:49.000000000 +0200 |
1361 | 70 | @@ -174,7 +174,8 @@ | 70 | @@ -174,7 +174,8 @@ |
1362 | 71 | npconfig_RAWSRCS = npw-config.c | 71 | npconfig_RAWSRCS = npw-config.c |
1363 | 72 | npconfig_SOURCES = $(npconfig_RAWSRCS:%.c=$(SRC_PATH)/src/%.c) | 72 | npconfig_SOURCES = $(npconfig_RAWSRCS:%.c=$(SRC_PATH)/src/%.c) |
1364 | @@ -77,7 +77,7 @@ | |||
1365 | 77 | ifneq (,$(findstring $(OS),netbsd dragonfly)) | 77 | ifneq (,$(findstring $(OS),netbsd dragonfly)) |
1366 | 78 | # We will try to dlopen() the native plugin library. If that lib is | 78 | # We will try to dlopen() the native plugin library. If that lib is |
1367 | 79 | # linked against libpthread, then so must our program too. | 79 | # linked against libpthread, then so must our program too. |
1369 | 80 | @@ -410,7 +411,7 @@ | 80 | @@ -402,7 +403,7 @@ |
1370 | 81 | $(CC) -o $@ $(npconfig_OBJECTS) $(npconfig_LDFLAGS) | 81 | $(CC) -o $@ $(npconfig_OBJECTS) $(npconfig_LDFLAGS) |
1371 | 82 | 82 | ||
1372 | 83 | npconfig-%.o: $(SRC_PATH)/src/%.c | 83 | npconfig-%.o: $(SRC_PATH)/src/%.c |
1373 | @@ -85,4 +85,4 @@ | |||
1374 | 85 | + $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS) $(npconfig_CFLAGS) | 85 | + $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS) $(npconfig_CFLAGS) |
1375 | 86 | 86 | ||
1376 | 87 | $(nploader_PROGRAM): $(nploader_SOURCES) | 87 | $(nploader_PROGRAM): $(nploader_SOURCES) |
1378 | 88 | sed -e "s|%NPW_LIBDIR%|$(pkglibdir)|" $< > $@ | 88 | sed -e 's|%NPW_VIEWER_DIR%|$(nptargetdir_var)|' $< > $@ |
1379 | 89 | 89 | ||
1380 | === modified file 'debian/patches/series' | |||
1381 | --- debian/patches/series 2009-04-01 20:10:03 +0000 | |||
1382 | +++ debian/patches/series 2009-08-11 01:28:09 +0000 | |||
1383 | @@ -3,4 +3,6 @@ | |||
1384 | 3 | 002_install_to_NSPLUGINDIR.diff | 3 | 002_install_to_NSPLUGINDIR.diff |
1385 | 4 | 003_update_help_info.diff | 4 | 003_update_help_info.diff |
1386 | 5 | 004_fix_threading.diff | 5 | 004_fix_threading.diff |
1387 | 6 | 004_system_only_update.diff | ||
1388 | 6 | 005_process_env_dirs.diff | 7 | 005_process_env_dirs.diff |
1389 | 8 | use_syslsb.patch | ||
1390 | 7 | 9 | ||
1391 | === added file 'debian/patches/use_syslsb.patch' | |||
1392 | --- debian/patches/use_syslsb.patch 1970-01-01 00:00:00 +0000 | |||
1393 | +++ debian/patches/use_syslsb.patch 2009-08-11 01:11:02 +0000 | |||
1394 | @@ -0,0 +1,126 @@ | |||
1395 | 1 | --- | ||
1396 | 2 | Makefile | 36 ++++++++++++++++++++++++++++++++++++ | ||
1397 | 3 | 1 file changed, 36 insertions(+) | ||
1398 | 4 | |||
1399 | 5 | Index: nspluginwrapper/Makefile | ||
1400 | 6 | =================================================================== | ||
1401 | 7 | --- nspluginwrapper.orig/Makefile 2009-08-11 03:03:59.000000000 +0200 | ||
1402 | 8 | +++ nspluginwrapper/Makefile 2009-08-11 03:10:00.000000000 +0200 | ||
1403 | 9 | @@ -79,11 +79,13 @@ | ||
1404 | 10 | ARCH_32 = $(ARCH) | ||
1405 | 11 | ifeq ($(build_biarch), yes) | ||
1406 | 12 | ARCH_32 = $(TARGET_ARCH) | ||
1407 | 13 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1408 | 14 | LSB_LIBS = $(LSB_OBJ_DIR)/libc.so $(LSB_OBJ_DIR)/libgcc_s_32.so | ||
1409 | 15 | LSB_LIBS += $(LSB_CORE_STUBS:%=$(LSB_OBJ_DIR)/%.so) | ||
1410 | 16 | LSB_LIBS += $(LSB_CORE_STATIC_STUBS:%=$(LSB_OBJ_DIR)/%.a) | ||
1411 | 17 | LSB_LIBS += $(LSB_DESKTOP_STUBS:%=$(LSB_OBJ_DIR)/%.so) | ||
1412 | 18 | endif | ||
1413 | 19 | +endif | ||
1414 | 20 | |||
1415 | 21 | LSB_TOP_DIR = $(SRC_PATH)/lsb-build | ||
1416 | 22 | LSB_INC_DIR = $(LSB_TOP_DIR)/headers | ||
1417 | 23 | @@ -119,7 +121,11 @@ | ||
1418 | 24 | npviewer_CFLAGS += -I$(LSB_INC_DIR) | ||
1419 | 25 | npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0 | ||
1420 | 26 | npviewer_CFLAGS += -I$(LSB_INC_DIR)/gtk-2.0 | ||
1421 | 27 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1422 | 28 | npviewer_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR) | ||
1423 | 29 | +else | ||
1424 | 30 | +npviewer_LDFLAGS = $(LDFLAGS_32) -L/usr/lib32/ | ||
1425 | 31 | +endif | ||
1426 | 32 | npviewer_LDFLAGS += -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -ldl -lglib-2.0 -lgthread-2.0 -lX11 -lXt | ||
1427 | 33 | else | ||
1428 | 34 | npviewer_CFLAGS += $(GTK_CFLAGS) | ||
1429 | 35 | @@ -157,7 +163,11 @@ | ||
1430 | 36 | libxpcom_CFLAGS = $(PIC_CFLAGS) | ||
1431 | 37 | ifeq ($(build_biarch),yes) | ||
1432 | 38 | libxpcom_CFLAGS += -I$(LSB_INC_DIR) | ||
1433 | 39 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1434 | 40 | libxpcom_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR) | ||
1435 | 41 | +else | ||
1436 | 42 | +libxpcom_LDFLAGS = $(LDFLAGS_32) -L/usr/lib32/ | ||
1437 | 43 | +endif | ||
1438 | 44 | endif | ||
1439 | 45 | |||
1440 | 46 | libnoxshm_LIBRARY = libnoxshm.so | ||
1441 | 47 | @@ -167,7 +177,11 @@ | ||
1442 | 48 | libnoxshm_CFLAGS = $(PIC_CFLAGS) | ||
1443 | 49 | ifeq ($(biarch),yes) | ||
1444 | 50 | libnoxshm_CFLAGS += -I$(LSB_INC_DIR) | ||
1445 | 51 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1446 | 52 | libnoxshm_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR) | ||
1447 | 53 | +else | ||
1448 | 54 | +libxpcom_LDFLAGS = $(LDFLAGS_32) -L/usr/lib32/ | ||
1449 | 55 | +endif | ||
1450 | 56 | endif | ||
1451 | 57 | |||
1452 | 58 | npconfig_PROGRAM = npconfig | ||
1453 | 59 | @@ -235,6 +249,7 @@ | ||
1454 | 60 | FILES += $(addprefix $(LSB_TOP_DIR)/headers/,$(shell cat $(LSB_TOP_DIR)/headers/core_filelist)) | ||
1455 | 61 | FILES += $(LSB_TOP_DIR)/headers/desktop_filelist | ||
1456 | 62 | FILES += $(addprefix $(LSB_TOP_DIR)/headers/,$(shell cat $(LSB_TOP_DIR)/headers/desktop_filelist)) | ||
1457 | 63 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1458 | 64 | FILES += $(LSB_SRC_DIR)/LibNameMap.txt | ||
1459 | 65 | FILES += $(LSB_SRC_DIR)/core_filelist | ||
1460 | 66 | FILES += $(LSB_SRC_DIR)/core_static_filelist | ||
1461 | 67 | @@ -244,6 +259,7 @@ | ||
1462 | 68 | FILES += $(patsubst %,$(LSB_SRC_DIR)/%.c,$(LSB_CORE_STATIC_STUBS)) | ||
1463 | 69 | FILES += $(patsubst %,$(LSB_SRC_DIR)/%.c,$(LSB_DESKTOP_STUBS)) | ||
1464 | 70 | FILES += $(patsubst %,$(LSB_SRC_DIR)/%.Version,$(LSB_DESKTOP_STUBS)) | ||
1465 | 71 | +endif | ||
1466 | 72 | |||
1467 | 73 | all: $(TARGETS) | ||
1468 | 74 | |||
1469 | 75 | @@ -370,8 +386,13 @@ | ||
1470 | 76 | npwrapper-%.os: $(SRC_PATH)/src/%.c | ||
1471 | 77 | $(CC) -o $@ -c $< $(PIC_CFLAGS) $(CPPFLAGS) $(npwrapper_CFLAGS) -DBUILD_WRAPPER | ||
1472 | 78 | |||
1473 | 79 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1474 | 80 | $(npviewer_PROGRAM): $(npviewer_OBJECTS) $(npviewer_MAPFILE) $(LSB_OBJ_DIR) $(LSB_LIBS) | ||
1475 | 81 | $(CC) $(LDFLAGS_32) -o $@ $(npviewer_OBJECTS) $(npviewer_LDFLAGS) | ||
1476 | 82 | +else | ||
1477 | 83 | +$(npviewer_PROGRAM): $(npviewer_OBJECTS) $(npviewer_MAPFILE) | ||
1478 | 84 | + $(CC) $(LDFLAGS_32) -o $@ $(npviewer_OBJECTS) $(npviewer_LDFLAGS) | ||
1479 | 85 | +endif | ||
1480 | 86 | |||
1481 | 87 | npviewer-%.o: $(SRC_PATH)/src/%.c | ||
1482 | 88 | $(CC) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(npviewer_CFLAGS) -DBUILD_VIEWER | ||
1483 | 89 | @@ -379,22 +400,37 @@ | ||
1484 | 90 | npviewer-%.o: $(SRC_PATH)/src/%.cpp | ||
1485 | 91 | $(CXX) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(npviewer_CFLAGS) -DBUILD_VIEWER | ||
1486 | 92 | |||
1487 | 93 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1488 | 94 | $(npplayer_PROGRAM): $(npplayer_OBJECTS) $(npplayer_MAPFILE) $(LSB_OBJ_DIR) $(LSB_LIBS) | ||
1489 | 95 | $(CC) $(LDFLAGS) -o $@ $(npplayer_OBJECTS) $(npplayer_LDFLAGS) | ||
1490 | 96 | +else | ||
1491 | 97 | +$(npplayer_PROGRAM): $(npplayer_OBJECTS) $(npplayer_MAPFILE) | ||
1492 | 98 | + $(CC) $(LDFLAGS) -o $@ $(npplayer_OBJECTS) $(npplayer_LDFLAGS) | ||
1493 | 99 | +endif | ||
1494 | 100 | |||
1495 | 101 | npplayer-%.o: $(SRC_PATH)/src/%.c | ||
1496 | 102 | $(CC) $(CFLAGS) -o $@ -c $< $(CPPFLAGS) $(npplayer_CFLAGS) -DBUILD_PLAYER | ||
1497 | 103 | npplayer-%.o: $(SRC_PATH)/src/tidy/%.c | ||
1498 | 104 | $(CC) $(CFLAGS) -o $@ -c $< $(CPPFLAGS) $(npplayer_CFLAGS) -DBUILD_PLAYER | ||
1499 | 105 | |||
1500 | 106 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1501 | 107 | $(libxpcom_LIBRARY): $(libxpcom_OBJECTS) $(LSB_OBJ_DIR) $(LSB_LIBS) | ||
1502 | 108 | $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libxpcom_OBJECTS) $(libxpcom_LDFLAGS) -Wl,$(LD_soname),libxpcom.so | ||
1503 | 109 | +else | ||
1504 | 110 | +$(libxpcom_LIBRARY): $(libxpcom_OBJECTS) | ||
1505 | 111 | + $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libxpcom_OBJECTS) $(libxpcom_LDFLAGS) -Wl,$(LD_soname),libxpcom.so | ||
1506 | 112 | +endif | ||
1507 | 113 | |||
1508 | 114 | libxpcom-%.o: $(SRC_PATH)/src/%.c | ||
1509 | 115 | $(CC) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(libxpcom_CFLAGS) -DBUILD_XPCOM | ||
1510 | 116 | |||
1511 | 117 | +ifeq (,$(USE_SYSTEM_LSB)) | ||
1512 | 118 | $(libnoxshm_LIBRARY): $(libnoxshm_OBJECTS) $(LSB_OBJ_DIR) $(LSB_LIBS) | ||
1513 | 119 | $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libnoxshm_OBJECTS) $(libnoxshm_LDFLAGS) -Wl,$(LD_soname),libnoxshm.so | ||
1514 | 120 | +else | ||
1515 | 121 | +$(libnoxshm_LIBRARY): $(libnoxshm_OBJECTS) | ||
1516 | 122 | + $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libnoxshm_OBJECTS) $(libnoxshm_LDFLAGS) -Wl,$(LD_soname),libnoxshm.so | ||
1517 | 123 | +endif | ||
1518 | 124 | |||
1519 | 125 | libnoxshm-%.o: $(SRC_PATH)/src/%.c | ||
1520 | 126 | $(CC) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(libnoxshm_CFLAGS) | ||
1521 | 0 | 127 | ||
1522 | === modified file 'debian/rules' (properties changed: +x to -x) | |||
1523 | --- debian/rules 2008-08-27 01:07:14 +0000 | |||
1524 | +++ debian/rules 2009-08-11 00:37:05 +0000 | |||
1525 | @@ -49,7 +49,7 @@ | |||
1526 | 49 | build: configure build-stamp | 49 | build: configure build-stamp |
1527 | 50 | build-stamp: | 50 | build-stamp: |
1528 | 51 | dh_testdir | 51 | dh_testdir |
1530 | 52 | $(MAKE) | 52 | $(MAKE) USE_SYSTEM_LSB=1 |
1531 | 53 | touch $@ | 53 | touch $@ |
1532 | 54 | 54 | ||
1533 | 55 | clean: clean-patched unpatch | 55 | clean: clean-patched unpatch |
1534 | @@ -65,7 +65,7 @@ | |||
1535 | 65 | dh_testroot | 65 | dh_testroot |
1536 | 66 | dh_clean -k | 66 | dh_clean -k |
1537 | 67 | dh_installdirs | 67 | dh_installdirs |
1539 | 68 | $(MAKE) DESTDIR=$(CURDIR)/debian/nspluginwrapper install | 68 | $(MAKE) USE_SYSTEM_LSB=1 DESTDIR=$(CURDIR)/debian/nspluginwrapper install |
1540 | 69 | 69 | ||
1541 | 70 | 70 | ||
1542 | 71 | # Build architecture-independent files here. | 71 | # Build architecture-independent files here. |
1543 | 72 | 72 | ||
1544 | === modified file 'lsb-build/headers/glib-2.0/glib.h' | |||
1545 | --- lsb-build/headers/glib-2.0/glib.h 2008-10-15 15:29:08 +0000 | |||
1546 | +++ lsb-build/headers/glib-2.0/glib.h 2009-08-11 00:38:42 +0000 | |||
1547 | @@ -2642,6 +2642,7 @@ | |||
1548 | 2642 | extern GHashTable *g_hash_table_new(GHashFunc, GEqualFunc); | 2642 | extern GHashTable *g_hash_table_new(GHashFunc, GEqualFunc); |
1549 | 2643 | extern const gchar *g_dir_read_name(GDir *); | 2643 | extern const gchar *g_dir_read_name(GDir *); |
1550 | 2644 | extern gboolean g_hash_table_remove(GHashTable *, gconstpointer); | 2644 | extern gboolean g_hash_table_remove(GHashTable *, gconstpointer); |
1551 | 2645 | extern void g_hash_table_remove_all(GHashTable *); | ||
1552 | 2645 | extern gchar *g_utf8_strdown(const gchar *, gssize); | 2646 | extern gchar *g_utf8_strdown(const gchar *, gssize); |
1553 | 2646 | extern GIOCondition g_io_channel_get_buffer_condition(GIOChannel *); | 2647 | extern GIOCondition g_io_channel_get_buffer_condition(GIOChannel *); |
1554 | 2647 | extern GSource *g_child_watch_source_new(GPid); | 2648 | extern GSource *g_child_watch_source_new(GPid); |
1555 | 2648 | 2649 | ||
1556 | === modified file 'lsb-build/stub_libs/libglib-2.0.c' | |||
1557 | --- lsb-build/stub_libs/libglib-2.0.c 2008-10-15 15:29:08 +0000 | |||
1558 | +++ lsb-build/stub_libs/libglib-2.0.c 2009-08-11 00:38:42 +0000 | |||
1559 | @@ -195,6 +195,7 @@ | |||
1560 | 195 | void g_hash_table_new() {} ; | 195 | void g_hash_table_new() {} ; |
1561 | 196 | void g_hash_table_new_full() {} ; | 196 | void g_hash_table_new_full() {} ; |
1562 | 197 | void g_hash_table_remove() {} ; | 197 | void g_hash_table_remove() {} ; |
1563 | 198 | void g_hash_table_remove_all() {} ; | ||
1564 | 198 | void g_hash_table_replace() {} ; | 199 | void g_hash_table_replace() {} ; |
1565 | 199 | void g_hash_table_size() {} ; | 200 | void g_hash_table_size() {} ; |
1566 | 200 | void g_hash_table_steal() {} ; | 201 | void g_hash_table_steal() {} ; |
1567 | 201 | 202 | ||
1568 | === modified file 'nspluginwrapper.spec' | |||
1569 | --- nspluginwrapper.spec 2009-01-02 10:07:27 +0000 | |||
1570 | +++ nspluginwrapper.spec 2009-08-11 00:38:42 +0000 | |||
1571 | @@ -1,7 +1,7 @@ | |||
1572 | 1 | %define name nspluginwrapper | 1 | %define name nspluginwrapper |
1574 | 2 | %define version 1.2.2 | 2 | %define version 1.3.0 |
1575 | 3 | %define release 1 | 3 | %define release 1 |
1577 | 4 | #define svndate DATE | 4 | #define svndate 20090102 |
1578 | 5 | 5 | ||
1579 | 6 | # define 32-bit arch of multiarch platforms | 6 | # define 32-bit arch of multiarch platforms |
1580 | 7 | %define arch_32 %{nil} | 7 | %define arch_32 %{nil} |
1581 | @@ -159,7 +159,7 @@ | |||
1582 | 159 | %{plugindir}/npwrapper.so | 159 | %{plugindir}/npwrapper.so |
1583 | 160 | %dir %{pkglibdir} | 160 | %dir %{pkglibdir} |
1584 | 161 | %dir %{pkglibdir}/noarch | 161 | %dir %{pkglibdir}/noarch |
1586 | 162 | %{pkglibdir}/noarch/npviewer | 162 | %{pkglibdir}/noarch/npviewer.sh |
1587 | 163 | %dir %{pkglibdir}/%{_arch} | 163 | %dir %{pkglibdir}/%{_arch} |
1588 | 164 | %dir %{pkglibdir}/%{_arch}/%{_os} | 164 | %dir %{pkglibdir}/%{_arch}/%{_os} |
1589 | 165 | %{pkglibdir}/%{_arch}/%{_os}/npconfig | 165 | %{pkglibdir}/%{_arch}/%{_os}/npconfig |
1590 | @@ -191,6 +191,14 @@ | |||
1591 | 191 | %endif | 191 | %endif |
1592 | 192 | 192 | ||
1593 | 193 | %changelog | 193 | %changelog |
1594 | 194 | * Fri Jan 02 2009 Gwenole Beauchesne <gb.public@free.fr> 1.3.0-1 | ||
1595 | 195 | - don't poll for Xt events in Gtk (XEMBED) plug-ins | ||
1596 | 196 | - use 40 Hz timer for Xt events only when necessary (Xt input sources) | ||
1597 | 197 | - add NPIdentifier and NPClass::HasMethod caches, i.e. lower RPC traffic | ||
1598 | 198 | - add support for multiple viewer paths, see --viewer-paths=PATH-EXPR | ||
1599 | 199 | - add basic checks for malloc()'ed buffer underflow/overflow | ||
1600 | 200 | - add checks for single-threaded calls into the browser (NPN_*() functions) | ||
1601 | 201 | |||
1602 | 194 | * Fri Jan 02 2009 Gwenole Beauchesne <gb.public@free.fr> 1.2.2-1 | 202 | * Fri Jan 02 2009 Gwenole Beauchesne <gb.public@free.fr> 1.2.2-1 |
1603 | 195 | - fix support for the VLC plug-in | 203 | - fix support for the VLC plug-in |
1604 | 196 | - fix memory deallocation in NPN_GetStringIdentifiers() | 204 | - fix memory deallocation in NPN_GetStringIdentifiers() |
1605 | 197 | 205 | ||
1606 | === modified file 'src/npruntime-impl.h' | |||
1607 | --- src/npruntime-impl.h 2009-01-02 10:07:27 +0000 | |||
1608 | +++ src/npruntime-impl.h 2009-08-11 00:38:42 +0000 | |||
1609 | @@ -27,6 +27,7 @@ | |||
1610 | 27 | uint32_t npobj_id; | 27 | uint32_t npobj_id; |
1611 | 28 | bool is_valid; | 28 | bool is_valid; |
1612 | 29 | void *plugin; | 29 | void *plugin; |
1613 | 30 | void *hasMethod_cache; | ||
1614 | 30 | } NPObjectInfo; | 31 | } NPObjectInfo; |
1615 | 31 | 32 | ||
1616 | 32 | extern NPObjectInfo *npobject_info_new(NPObject *npobj) attribute_hidden; | 33 | extern NPObjectInfo *npobject_info_new(NPObject *npobj) attribute_hidden; |
1617 | @@ -59,6 +60,10 @@ | |||
1618 | 59 | extern void print_npvariant_args(const struct _NPVariant *args, uint32_t nargs) attribute_hidden; | 60 | extern void print_npvariant_args(const struct _NPVariant *args, uint32_t nargs) attribute_hidden; |
1619 | 60 | 61 | ||
1620 | 61 | // Deactivate all NPObject instances | 62 | // Deactivate all NPObject instances |
1622 | 62 | extern void npruntime_deactivate(void); | 63 | extern void npruntime_deactivate(void) attribute_hidden; |
1623 | 64 | |||
1624 | 65 | // Check whether to use NPRuntime data caching | ||
1625 | 66 | // (on by default, disabled with NPW_NPRUNTIME_CACHE=0|no) | ||
1626 | 67 | extern bool npruntime_use_cache(void) attribute_hidden; | ||
1627 | 63 | 68 | ||
1628 | 64 | #endif /* NPRUNTIME_IMPL_H */ | 69 | #endif /* NPRUNTIME_IMPL_H */ |
1629 | 65 | 70 | ||
1630 | === modified file 'src/npruntime.c' | |||
1631 | --- src/npruntime.c 2009-01-02 10:07:27 +0000 | |||
1632 | +++ src/npruntime.c 2009-08-11 00:38:42 +0000 | |||
1633 | @@ -30,15 +30,55 @@ | |||
1634 | 30 | #include "debug.h" | 30 | #include "debug.h" |
1635 | 31 | 31 | ||
1636 | 32 | 32 | ||
1637 | 33 | // Define to enable NPClass::HasMethod cache | ||
1638 | 34 | #define USE_NPCLASS_HAS_METHOD_CACHE 1 | ||
1639 | 35 | |||
1640 | 36 | // Define to enable NPClass::HasProperty cache (derived from ::HasMethod cache) | ||
1641 | 37 | #define USE_NPCLASS_HAS_PROPERTY_CACHE 1 | ||
1642 | 38 | |||
1643 | 33 | // Defined in npw-{wrapper,viewer}.c | 39 | // Defined in npw-{wrapper,viewer}.c |
1644 | 34 | extern rpc_connection_t *g_rpc_connection attribute_hidden; | 40 | extern rpc_connection_t *g_rpc_connection attribute_hidden; |
1645 | 35 | 41 | ||
1646 | 36 | // Defined in npw-viewer.c | 42 | // Defined in npw-viewer.c |
1652 | 37 | #if USE_PID_CHECK && NPW_IS_PLUGIN | 43 | #if defined(ENABLE_THREAD_CHECK) && NPW_IS_PLUGIN |
1653 | 38 | extern bool pid_check(void); | 44 | extern bool thread_check(void); |
1654 | 39 | #else | 45 | #else |
1655 | 40 | #define pid_check() true | 46 | #define thread_check() true |
1656 | 41 | #endif | 47 | #endif |
1657 | 48 | |||
1658 | 49 | |||
1659 | 50 | /* ====================================================================== */ | ||
1660 | 51 | /* === Helpers === */ | ||
1661 | 52 | /* ====================================================================== */ | ||
1662 | 53 | |||
1663 | 54 | static inline bool get_use_npruntime_cache_env(void) | ||
1664 | 55 | { | ||
1665 | 56 | const gchar *env = getenv("NPW_NPRUNTIME_CACHE"); | ||
1666 | 57 | return env == NULL || (strcmp(env, "no") != 0 && strcmp(env, "0") != 0); | ||
1667 | 58 | } | ||
1668 | 59 | |||
1669 | 60 | bool npruntime_use_cache(void) | ||
1670 | 61 | { | ||
1671 | 62 | static int use_cache = -1; | ||
1672 | 63 | if (G_UNLIKELY(use_cache < 0)) | ||
1673 | 64 | use_cache = get_use_npruntime_cache_env(); | ||
1674 | 65 | return use_cache; | ||
1675 | 66 | } | ||
1676 | 67 | |||
1677 | 68 | static inline bool use_npclass_has_method_cache(void) | ||
1678 | 69 | { | ||
1679 | 70 | #if USE_NPCLASS_HAS_METHOD_CACHE | ||
1680 | 71 | return npruntime_use_cache(); | ||
1681 | 72 | #else | ||
1682 | 73 | return false; | ||
1683 | 74 | #endif | ||
1684 | 75 | } | ||
1685 | 76 | |||
1686 | 77 | static inline bool use_npclass_has_property_cache(void) | ||
1687 | 78 | { | ||
1688 | 79 | /* this depends on the NPClass::HasMethod cache */ | ||
1689 | 80 | return use_npclass_has_method_cache(); | ||
1690 | 81 | } | ||
1691 | 42 | 82 | ||
1692 | 43 | 83 | ||
1693 | 44 | /* ====================================================================== */ | 84 | /* ====================================================================== */ |
1694 | @@ -131,8 +171,8 @@ | |||
1695 | 131 | if (!is_valid_npobject_class(npobj)) | 171 | if (!is_valid_npobject_class(npobj)) |
1696 | 132 | return; | 172 | return; |
1697 | 133 | 173 | ||
1700 | 134 | if (!pid_check()) { | 174 | if (!thread_check()) { |
1701 | 135 | npw_printf("WARNING: NPClass::Invalidate called from the wrong process\n"); | 175 | npw_printf("WARNING: NPClass::Invalidate not called from the main thread\n"); |
1702 | 136 | return; | 176 | return; |
1703 | 137 | } | 177 | } |
1704 | 138 | 178 | ||
1705 | @@ -196,18 +236,34 @@ | |||
1706 | 196 | return ret; | 236 | return ret; |
1707 | 197 | } | 237 | } |
1708 | 198 | 238 | ||
1709 | 239 | static bool npclass_cached_HasMethod(NPObject *npobj, NPIdentifier name) | ||
1710 | 240 | { | ||
1711 | 241 | NPObjectInfo *npobj_info = npobject_info_lookup(npobj); | ||
1712 | 242 | if (use_npclass_has_method_cache() && npobj_info) { | ||
1713 | 243 | if (G_UNLIKELY(npobj_info->hasMethod_cache == NULL)) | ||
1714 | 244 | npobj_info->hasMethod_cache = g_hash_table_new(NULL, NULL); | ||
1715 | 245 | gpointer hasMethod = NULL; | ||
1716 | 246 | if (g_hash_table_lookup_extended(npobj_info->hasMethod_cache, name, NULL, &hasMethod)) | ||
1717 | 247 | return GPOINTER_TO_UINT(hasMethod); | ||
1718 | 248 | } | ||
1719 | 249 | bool hasMethod = npclass_invoke_HasMethod(npobj, name); | ||
1720 | 250 | if (use_npclass_has_method_cache() && npobj_info) | ||
1721 | 251 | g_hash_table_insert(npobj_info->hasMethod_cache, name, GUINT_TO_POINTER(hasMethod)); | ||
1722 | 252 | return hasMethod; | ||
1723 | 253 | } | ||
1724 | 254 | |||
1725 | 199 | bool g_NPClass_HasMethod(NPObject *npobj, NPIdentifier name) | 255 | bool g_NPClass_HasMethod(NPObject *npobj, NPIdentifier name) |
1726 | 200 | { | 256 | { |
1727 | 201 | if (!is_valid_npobject_class(npobj)) | 257 | if (!is_valid_npobject_class(npobj)) |
1728 | 202 | return false; | 258 | return false; |
1729 | 203 | 259 | ||
1732 | 204 | if (!pid_check()) { | 260 | if (!thread_check()) { |
1733 | 205 | npw_printf("WARNING: NPClass::HasMethod called from the wrong process\n"); | 261 | npw_printf("WARNING: NPClass::HasMethod not called from the main thread\n"); |
1734 | 206 | return false; | 262 | return false; |
1735 | 207 | } | 263 | } |
1736 | 208 | 264 | ||
1737 | 209 | D(bugiI("NPClass::HasMethod(npobj %p, name id %p)\n", npobj, name)); | 265 | D(bugiI("NPClass::HasMethod(npobj %p, name id %p)\n", npobj, name)); |
1739 | 210 | bool ret = npclass_invoke_HasMethod(npobj, name); | 266 | bool ret = npclass_cached_HasMethod(npobj, name); |
1740 | 211 | D(bugiD("NPClass::HasMethod return: %d\n", ret)); | 267 | D(bugiD("NPClass::HasMethod return: %d\n", ret)); |
1741 | 212 | return ret; | 268 | return ret; |
1742 | 213 | } | 269 | } |
1743 | @@ -300,8 +356,8 @@ | |||
1744 | 300 | if (!is_valid_npobject_class(npobj)) | 356 | if (!is_valid_npobject_class(npobj)) |
1745 | 301 | return false; | 357 | return false; |
1746 | 302 | 358 | ||
1749 | 303 | if (!pid_check()) { | 359 | if (!thread_check()) { |
1750 | 304 | npw_printf("WARNING: NPClass::Invoke called from the wrong process\n"); | 360 | npw_printf("WARNING: NPClass::Invoke not called from the main thread\n"); |
1751 | 305 | return false; | 361 | return false; |
1752 | 306 | } | 362 | } |
1753 | 307 | 363 | ||
1754 | @@ -399,8 +455,8 @@ | |||
1755 | 399 | if (!is_valid_npobject_class(npobj)) | 455 | if (!is_valid_npobject_class(npobj)) |
1756 | 400 | return false; | 456 | return false; |
1757 | 401 | 457 | ||
1760 | 402 | if (!pid_check()) { | 458 | if (!thread_check()) { |
1761 | 403 | npw_printf("WARNING: NPClass::InvokeDefault called from the wrong process\n"); | 459 | npw_printf("WARNING: NPClass::InvokeDefault not called from the main thread\n"); |
1762 | 404 | return false; | 460 | return false; |
1763 | 405 | } | 461 | } |
1764 | 406 | 462 | ||
1765 | @@ -468,18 +524,29 @@ | |||
1766 | 468 | return ret; | 524 | return ret; |
1767 | 469 | } | 525 | } |
1768 | 470 | 526 | ||
1769 | 527 | static bool npclass_cached_HasProperty(NPObject *npobj, NPIdentifier name) | ||
1770 | 528 | { | ||
1771 | 529 | NPObjectInfo *npobj_info = npobject_info_lookup(npobj); | ||
1772 | 530 | if (use_npclass_has_property_cache() && npobj_info && npobj_info->hasMethod_cache) { | ||
1773 | 531 | /* If the NPIdentifier references a method, it can't be a property */ | ||
1774 | 532 | if (g_hash_table_lookup_extended(npobj_info->hasMethod_cache, name, NULL, NULL)) | ||
1775 | 533 | return false; | ||
1776 | 534 | } | ||
1777 | 535 | return npclass_invoke_HasProperty(npobj, name); | ||
1778 | 536 | } | ||
1779 | 537 | |||
1780 | 471 | bool g_NPClass_HasProperty(NPObject *npobj, NPIdentifier name) | 538 | bool g_NPClass_HasProperty(NPObject *npobj, NPIdentifier name) |
1781 | 472 | { | 539 | { |
1782 | 473 | if (!is_valid_npobject_class(npobj)) | 540 | if (!is_valid_npobject_class(npobj)) |
1783 | 474 | return false; | 541 | return false; |
1784 | 475 | 542 | ||
1787 | 476 | if (!pid_check()) { | 543 | if (!thread_check()) { |
1788 | 477 | npw_printf("WARNING: NPClass::HasProperty called from the wrong process\n"); | 544 | npw_printf("WARNING: NPClass::HasProperty not called from the main thread\n"); |
1789 | 478 | return false; | 545 | return false; |
1790 | 479 | } | 546 | } |
1791 | 480 | 547 | ||
1792 | 481 | D(bugiI("NPClass::HasProperty(npobj %p, name id %p)\n", npobj, name)); | 548 | D(bugiI("NPClass::HasProperty(npobj %p, name id %p)\n", npobj, name)); |
1794 | 482 | bool ret = npclass_invoke_HasProperty(npobj, name); | 549 | bool ret = npclass_cached_HasProperty(npobj, name); |
1795 | 483 | D(bugiD("NPClass::HasProperty return: %d\n", ret)); | 550 | D(bugiD("NPClass::HasProperty return: %d\n", ret)); |
1796 | 484 | return ret; | 551 | return ret; |
1797 | 485 | } | 552 | } |
1798 | @@ -559,8 +626,8 @@ | |||
1799 | 559 | if (!is_valid_npobject_class(npobj)) | 626 | if (!is_valid_npobject_class(npobj)) |
1800 | 560 | return false; | 627 | return false; |
1801 | 561 | 628 | ||
1804 | 562 | if (!pid_check()) { | 629 | if (!thread_check()) { |
1805 | 563 | npw_printf("WARNING: NPClass::GetProperty called from the wrong process\n"); | 630 | npw_printf("WARNING: NPClass::GetProperty not called from the main thread\n"); |
1806 | 564 | return false; | 631 | return false; |
1807 | 565 | } | 632 | } |
1808 | 566 | 633 | ||
1809 | @@ -645,8 +712,8 @@ | |||
1810 | 645 | if (!is_valid_npobject_class(npobj)) | 712 | if (!is_valid_npobject_class(npobj)) |
1811 | 646 | return false; | 713 | return false; |
1812 | 647 | 714 | ||
1815 | 648 | if (!pid_check()) { | 715 | if (!thread_check()) { |
1816 | 649 | npw_printf("WARNING: NPClass::SetProperty called from the wrong process\n"); | 716 | npw_printf("WARNING: NPClass::SetProperty not called from the main thread\n"); |
1817 | 650 | return false; | 717 | return false; |
1818 | 651 | } | 718 | } |
1819 | 652 | 719 | ||
1820 | @@ -716,8 +783,8 @@ | |||
1821 | 716 | if (!is_valid_npobject_class(npobj)) | 783 | if (!is_valid_npobject_class(npobj)) |
1822 | 717 | return false; | 784 | return false; |
1823 | 718 | 785 | ||
1826 | 719 | if (!pid_check()) { | 786 | if (!thread_check()) { |
1827 | 720 | npw_printf("WARNING: NPClass::RemoveProperty called from the wrong process\n"); | 787 | npw_printf("WARNING: NPClass::RemoveProperty not called from the main thread\n"); |
1828 | 721 | return false; | 788 | return false; |
1829 | 722 | } | 789 | } |
1830 | 723 | 790 | ||
1831 | @@ -734,22 +801,31 @@ | |||
1832 | 734 | 801 | ||
1833 | 735 | NPObjectInfo *npobject_info_new(NPObject *npobj) | 802 | NPObjectInfo *npobject_info_new(NPObject *npobj) |
1834 | 736 | { | 803 | { |
1836 | 737 | NPObjectInfo *npobj_info = NPW_MemNew0(NPObjectInfo, 1); | 804 | NPObjectInfo *npobj_info = NPW_MemNew(NPObjectInfo, 1); |
1837 | 738 | if (npobj_info) { | 805 | if (npobj_info) { |
1838 | 739 | static uint32_t id; | 806 | static uint32_t id; |
1839 | 740 | npobj_info->npobj = npobj; | 807 | npobj_info->npobj = npobj; |
1840 | 741 | npobj_info->npobj_id = ++id; | 808 | npobj_info->npobj_id = ++id; |
1841 | 742 | npobj_info->is_valid = true; | 809 | npobj_info->is_valid = true; |
1842 | 810 | npobj_info->plugin = NULL; | ||
1843 | 811 | npobj_info->hasMethod_cache = NULL; | ||
1844 | 743 | } | 812 | } |
1845 | 744 | return npobj_info; | 813 | return npobj_info; |
1846 | 745 | } | 814 | } |
1847 | 746 | 815 | ||
1848 | 747 | void npobject_info_destroy(NPObjectInfo *npobj_info) | 816 | void npobject_info_destroy(NPObjectInfo *npobj_info) |
1849 | 748 | { | 817 | { |
1853 | 749 | if (npobj_info) { | 818 | if (npobj_info == NULL) |
1854 | 750 | npw_plugin_instance_unref(npobj_info->plugin); | 819 | return; |
1855 | 751 | NPW_MemFree(npobj_info); | 820 | |
1856 | 821 | npw_plugin_instance_unref(npobj_info->plugin); | ||
1857 | 822 | |||
1858 | 823 | if (npobj_info->hasMethod_cache) { | ||
1859 | 824 | g_hash_table_destroy(npobj_info->hasMethod_cache); | ||
1860 | 825 | npobj_info->hasMethod_cache = NULL; | ||
1861 | 752 | } | 826 | } |
1862 | 827 | |||
1863 | 828 | NPW_MemFree(npobj_info); | ||
1864 | 753 | } | 829 | } |
1865 | 754 | 830 | ||
1866 | 755 | 831 | ||
1867 | 756 | 832 | ||
1868 | === modified file 'src/npw-config.c' | |||
1869 | --- src/npw-config.c 2009-01-02 10:12:06 +0000 | |||
1870 | +++ src/npw-config.c 2009-08-11 00:40:05 +0000 | |||
1871 | @@ -71,6 +71,71 @@ | |||
1872 | 71 | return 1; | 71 | return 1; |
1873 | 72 | } | 72 | } |
1874 | 73 | 73 | ||
1875 | 74 | static const char *strnstr(const char *str, int len, const char *substr) | ||
1876 | 75 | { | ||
1877 | 76 | const char *match = strstr(str, substr); | ||
1878 | 77 | if (len > 0 && (match + strlen(substr) > str + len)) | ||
1879 | 78 | match = NULL; | ||
1880 | 79 | return match; | ||
1881 | 80 | } | ||
1882 | 81 | |||
1883 | 82 | typedef struct { | ||
1884 | 83 | const char *name; | ||
1885 | 84 | const char *value; | ||
1886 | 85 | } Var; | ||
1887 | 86 | |||
1888 | 87 | static int strexpand(char *dst, int dstlen, const char *src, int srclen, const Var *vars) | ||
1889 | 88 | { | ||
1890 | 89 | if (dst == NULL || dstlen < 1 || src == NULL) | ||
1891 | 90 | return -1; | ||
1892 | 91 | |||
1893 | 92 | if (srclen <= 0) | ||
1894 | 93 | srclen = strlen(src); | ||
1895 | 94 | |||
1896 | 95 | int n = 0; | ||
1897 | 96 | for (int i = 0; i < srclen; i++) { | ||
1898 | 97 | char ch = src[i]; | ||
1899 | 98 | if (ch != '%') { | ||
1900 | 99 | dst[n++] = ch; | ||
1901 | 100 | if (n >= dstlen - 1) | ||
1902 | 101 | return -1; | ||
1903 | 102 | } | ||
1904 | 103 | else { | ||
1905 | 104 | char var[16]; | ||
1906 | 105 | const char *str = &src[i + 1]; | ||
1907 | 106 | const char *end = strchr(str, '%'); | ||
1908 | 107 | if (end == NULL) | ||
1909 | 108 | error("unterminated var '%s'", str); | ||
1910 | 109 | |||
1911 | 110 | int len = end - str; | ||
1912 | 111 | if (len >= sizeof(var) - 1) { | ||
1913 | 112 | len = sizeof(var) - 1; | ||
1914 | 113 | memcpy(var, str, len); | ||
1915 | 114 | var[len] = '\0'; | ||
1916 | 115 | error("unsupported var '%s...'", var); | ||
1917 | 116 | } | ||
1918 | 117 | memcpy(var, str, len); | ||
1919 | 118 | var[len] = '\0'; | ||
1920 | 119 | |||
1921 | 120 | str = NULL; | ||
1922 | 121 | for (int j = 0; vars[j].name != NULL; j++) { | ||
1923 | 122 | if (strcmp(vars[j].name, var) == 0) { | ||
1924 | 123 | str = vars[j].value; | ||
1925 | 124 | break; | ||
1926 | 125 | } | ||
1927 | 126 | } | ||
1928 | 127 | if (str == NULL) | ||
1929 | 128 | error("could not expand var '%s'", var); | ||
1930 | 129 | i += len + 1; | ||
1931 | 130 | len = strlen(str); | ||
1932 | 131 | memcpy(&dst[n], str, len); | ||
1933 | 132 | n += len; | ||
1934 | 133 | } | ||
1935 | 134 | } | ||
1936 | 135 | dst[n] = '\0'; | ||
1937 | 136 | return 0; | ||
1938 | 137 | } | ||
1939 | 138 | |||
1940 | 74 | /* Implement mkdir -p with default permissions (derived from busybox code) */ | 139 | /* Implement mkdir -p with default permissions (derived from busybox code) */ |
1941 | 75 | static int mkdir_p(const char *path) | 140 | static int mkdir_p(const char *path) |
1942 | 76 | { | 141 | { |
1943 | @@ -489,6 +554,30 @@ | |||
1944 | 489 | EXIT_VIEWER_NATIVE = 20 | 554 | EXIT_VIEWER_NATIVE = 20 |
1945 | 490 | }; | 555 | }; |
1946 | 491 | 556 | ||
1947 | 557 | static bool is_plugin_viewer_ok(const char *viewer_path, const char *filename) | ||
1948 | 558 | { | ||
1949 | 559 | int pid = fork(); | ||
1950 | 560 | if (pid < 0) | ||
1951 | 561 | return false; | ||
1952 | 562 | if (pid == 0) { | ||
1953 | 563 | if (!g_verbose) { | ||
1954 | 564 | // don't spit out errors in non-verbose mode, we only need | ||
1955 | 565 | // to know whether there is a valid viewer or not | ||
1956 | 566 | freopen("/dev/null", "w", stderr); | ||
1957 | 567 | } | ||
1958 | 568 | execl(viewer_path, NPW_VIEWER, "--test", "--plugin", filename, NULL); | ||
1959 | 569 | exit(1); | ||
1960 | 570 | } | ||
1961 | 571 | else { | ||
1962 | 572 | int status; | ||
1963 | 573 | while (waitpid(pid, &status, 0) != pid) | ||
1964 | 574 | ; | ||
1965 | 575 | if (WIFEXITED(status) && WEXITSTATUS(status) == 0) | ||
1966 | 576 | return true; | ||
1967 | 577 | } | ||
1968 | 578 | return false; | ||
1969 | 579 | } | ||
1970 | 580 | |||
1971 | 492 | static int detect_plugin_viewer(const char *filename, NPW_PluginInfo *out_plugin_info) | 581 | static int detect_plugin_viewer(const char *filename, NPW_PluginInfo *out_plugin_info) |
1972 | 493 | { | 582 | { |
1973 | 494 | static const char *target_arch_table[] = { | 583 | static const char *target_arch_table[] = { |
1974 | @@ -522,52 +611,60 @@ | |||
1975 | 522 | && out_plugin_info->target_os && strcmp(out_plugin_info->target_os, HOST_OS) == 0) | 611 | && out_plugin_info->target_os && strcmp(out_plugin_info->target_os, HOST_OS) == 0) |
1976 | 523 | return EXIT_VIEWER_NATIVE; | 612 | return EXIT_VIEWER_NATIVE; |
1977 | 524 | 613 | ||
2024 | 525 | for (int i = 0; i < target_arch_table_size; i++) { | 614 | enum { VAR_ARCH, VAR_OS, VAR_COUNT }; |
2025 | 526 | const char *target_arch = target_arch_table[i]; | 615 | Var vars[VAR_COUNT+1]; |
2026 | 527 | if (target_arch == NULL) | 616 | vars[VAR_ARCH].name = "ARCH"; |
2027 | 528 | continue; | 617 | vars[VAR_OS].name = "OS"; |
2028 | 529 | char viewer_arch_path[PATH_MAX]; | 618 | vars[VAR_COUNT].name = NULL; |
2029 | 530 | sprintf(viewer_arch_path, "%s/%s", NPW_LIBDIR, target_arch); | 619 | vars[VAR_COUNT].value = NULL; |
2030 | 531 | if (access(viewer_arch_path, F_OK) != 0) { | 620 | |
2031 | 532 | target_arch_table[i] = NULL; // this target ARCH is not available, skip it for good | 621 | char viewer_path[sizeof(out_plugin_info->viewer_path)]; |
2032 | 533 | continue; | 622 | const int viewer_path_len = sizeof(viewer_path) - strlen(NPW_VIEWER) - 1; |
2033 | 534 | } | 623 | const char viewer_paths[] = NPW_VIEWER_PATHS; |
2034 | 535 | for (int j = 0; j < target_os_table_size; j++) { | 624 | const char *viewer_path_spec_end, *viewer_path_spec = viewer_paths; |
2035 | 536 | const char *target_os = target_os_table[j]; | 625 | do { |
2036 | 537 | if (target_os == NULL) | 626 | int len; |
2037 | 538 | continue; | 627 | if ((viewer_path_spec_end = strchr(viewer_path_spec, ':')) != NULL) |
2038 | 539 | char viewer_path[PATH_MAX]; | 628 | len = viewer_path_spec_end - viewer_path_spec; |
2039 | 540 | sprintf(viewer_path, "%s/%s/%s", viewer_arch_path, target_os, NPW_VIEWER); | 629 | else |
2040 | 541 | if (access(viewer_path, F_OK) != 0) | 630 | len = strchr(viewer_path_spec, '\0') - viewer_path_spec; |
2041 | 542 | continue; | 631 | |
2042 | 543 | int pid = fork(); | 632 | for (int i = 0; i < target_arch_table_size; i++) { |
2043 | 544 | if (pid < 0) | 633 | const char *target_arch = target_arch_table[i]; |
2044 | 545 | continue; | 634 | if (target_arch == NULL) |
2045 | 546 | else if (pid == 0) { | 635 | continue; |
2046 | 547 | if (!g_verbose) { | 636 | vars[VAR_ARCH].value = target_arch; |
2047 | 548 | // don't spit out errors in non-verbose mode, we only need | 637 | |
2048 | 549 | // to know whether there is a valid viewer or not | 638 | for (int j = 0; j < target_os_table_size; j++) { |
2049 | 550 | freopen("/dev/null", "w", stderr); | 639 | const char *target_os = target_os_table[j]; |
2050 | 551 | } | 640 | if (target_os == NULL) |
2051 | 552 | execl(viewer_path, NPW_VIEWER, "--test", "--plugin", filename, NULL); | 641 | continue; |
2052 | 553 | exit(1); | 642 | vars[VAR_OS].value = target_os; |
2053 | 554 | } | 643 | |
2054 | 555 | else { | 644 | if (strexpand(viewer_path, viewer_path_len, viewer_path_spec, len, vars) < 0) |
2055 | 556 | int status; | 645 | continue; |
2056 | 557 | while (waitpid(pid, &status, 0) != pid) | 646 | strcat(viewer_path, "/" NPW_VIEWER); |
2057 | 558 | ; | 647 | if (access(viewer_path, F_OK) != 0) |
2058 | 559 | if (WIFEXITED(status)) { | 648 | continue; |
2059 | 560 | status = WEXITSTATUS(status); | 649 | |
2060 | 561 | if (status == EXIT_VIEWER_OK && out_plugin_info) { | 650 | if (is_plugin_viewer_ok(viewer_path, filename)) { |
2061 | 562 | strcpy(out_plugin_info->target_arch, target_arch); | 651 | strcpy(out_plugin_info->target_arch, target_arch); |
2062 | 563 | strcpy(out_plugin_info->target_os, target_os); | 652 | strcpy(out_plugin_info->target_os, target_os); |
2063 | 564 | } | 653 | strcpy(out_plugin_info->viewer_path, viewer_path); |
2064 | 565 | return status; | 654 | return EXIT_VIEWER_OK; |
2065 | 566 | } | 655 | } |
2066 | 567 | return EXIT_VIEWER_ERROR; | 656 | |
2067 | 568 | } | 657 | if (strnstr(viewer_path_spec, len, "%OS%") == NULL) |
2068 | 569 | } | 658 | break; // don't iterate over OS table if there is no "%OS%" pattern |
2069 | 570 | } | 659 | } |
2070 | 660 | |||
2071 | 661 | if (strnstr(viewer_path_spec, len, "%ARCH%") == NULL) | ||
2072 | 662 | break; // don't iterate over ARCH table if there is no "%ARCH%" pattern | ||
2073 | 663 | } | ||
2074 | 664 | |||
2075 | 665 | viewer_path_spec += len + 1; | ||
2076 | 666 | } while (viewer_path_spec_end != NULL); | ||
2077 | 667 | |||
2078 | 571 | return EXIT_VIEWER_NOT_FOUND; | 668 | return EXIT_VIEWER_NOT_FOUND; |
2079 | 572 | } | 669 | } |
2080 | 573 | 670 | ||
2081 | @@ -604,15 +701,27 @@ | |||
2082 | 604 | if ((pi = (NPW_PluginInfo *)dlsym(handle, "NPW_Plugin")) == NULL) | 701 | if ((pi = (NPW_PluginInfo *)dlsym(handle, "NPW_Plugin")) == NULL) |
2083 | 605 | return false; | 702 | return false; |
2084 | 606 | if (out_plugin_info) { | 703 | if (out_plugin_info) { |
2085 | 704 | int plugin_info_version = 0; | ||
2086 | 705 | if (strncmp(pi->ident, "NPW:0.9.90", 10) != 0) | ||
2087 | 706 | plugin_info_version = 1; | ||
2088 | 707 | if (strncmp(pi->ident, "NPW:X:", 6) == 0) | ||
2089 | 708 | plugin_info_version = pi->struct_version; | ||
2090 | 709 | out_plugin_info->struct_version = plugin_info_version; | ||
2091 | 607 | strcpy(out_plugin_info->ident, pi->ident); | 710 | strcpy(out_plugin_info->ident, pi->ident); |
2092 | 608 | strcpy(out_plugin_info->path, pi->path); | 711 | strcpy(out_plugin_info->path, pi->path); |
2093 | 609 | out_plugin_info->mtime = pi->mtime; | 712 | out_plugin_info->mtime = pi->mtime; |
2097 | 610 | out_plugin_info->target_arch[0] = '\0'; | 713 | if (plugin_info_version >= 1) { // additional members in 0.9.91+ |
2095 | 611 | out_plugin_info->target_os[0] = '\0'; | ||
2096 | 612 | if (strncmp(pi->ident, "NPW:0.9.90", 10) != 0) { // additional members in 0.9.91+ | ||
2098 | 613 | strcpy(out_plugin_info->target_arch, pi->target_arch); | 714 | strcpy(out_plugin_info->target_arch, pi->target_arch); |
2099 | 614 | strcpy(out_plugin_info->target_os, pi->target_os); | 715 | strcpy(out_plugin_info->target_os, pi->target_os); |
2100 | 615 | } | 716 | } |
2101 | 717 | else { | ||
2102 | 718 | out_plugin_info->target_arch[0] = '\0'; | ||
2103 | 719 | out_plugin_info->target_os[0] = '\0'; | ||
2104 | 720 | } | ||
2105 | 721 | if (plugin_info_version >= 2) // additional members in 1.3.0+ | ||
2106 | 722 | strcpy(out_plugin_info->viewer_path, pi->viewer_path); | ||
2107 | 723 | else | ||
2108 | 724 | out_plugin_info->viewer_path[0] = '\0'; | ||
2109 | 616 | } | 725 | } |
2110 | 617 | return true; | 726 | return true; |
2111 | 618 | } | 727 | } |
2112 | @@ -628,12 +737,26 @@ | |||
2113 | 628 | return ret; | 737 | return ret; |
2114 | 629 | } | 738 | } |
2115 | 630 | 739 | ||
2116 | 740 | static bool is_master_wrapper_plugin(const char *plugin_path) | ||
2117 | 741 | { | ||
2118 | 742 | static const char *master_plugin_paths[] = { | ||
2119 | 743 | NPW_LIBDIR "/" HOST_ARCH "/" NPW_WRAPPER, | ||
2120 | 744 | NPW_LIBDIR "/" HOST_ARCH "/" HOST_OS "/" NPW_WRAPPER, | ||
2121 | 745 | NPW_DEFAULT_PLUGIN_PATH, | ||
2122 | 746 | NULL | ||
2123 | 747 | }; | ||
2124 | 748 | for (int i = 0; master_plugin_paths[i] != NULL; i++) { | ||
2125 | 749 | if (strcmp(master_plugin_paths[i], plugin_path) == 0) | ||
2126 | 750 | return true; | ||
2127 | 751 | } | ||
2128 | 752 | return false; | ||
2129 | 753 | } | ||
2130 | 754 | |||
2131 | 631 | static bool is_wrapper_plugin_0(const char *plugin_path) | 755 | static bool is_wrapper_plugin_0(const char *plugin_path) |
2132 | 632 | { | 756 | { |
2133 | 633 | NPW_PluginInfo plugin_info; | 757 | NPW_PluginInfo plugin_info; |
2134 | 634 | return is_wrapper_plugin(plugin_path, &plugin_info) | 758 | return is_wrapper_plugin(plugin_path, &plugin_info) |
2137 | 635 | && strcmp(plugin_info.path, NPW_DEFAULT_PLUGIN_PATH) != 0 // exclude OS/ARCH npwrapper.so | 759 | && !is_master_wrapper_plugin(plugin_path); |
2136 | 636 | && strcmp(plugin_info.path, NPW_OLD_DEFAULT_PLUGIN_PATH) != 0; // exclude ARCH npwrapper.so | ||
2138 | 637 | } | 760 | } |
2139 | 638 | 761 | ||
2140 | 639 | static bool has_system_wide_wrapper_plugin(const char *plugin_path, bool check_ident) | 762 | static bool has_system_wide_wrapper_plugin(const char *plugin_path, bool check_ident) |
2141 | @@ -789,11 +912,17 @@ | |||
2142 | 789 | if (!is_plugin_viewer_available(plugin_path, plugin_info)) | 912 | if (!is_plugin_viewer_available(plugin_path, plugin_info)) |
2143 | 790 | return 15; | 913 | return 15; |
2144 | 791 | } | 914 | } |
2145 | 915 | if (plugin_info->viewer_path[0] == '\0') { | ||
2146 | 916 | if (!is_plugin_viewer_available(plugin_path, plugin_info)) | ||
2147 | 917 | return 16; | ||
2148 | 918 | } | ||
2149 | 792 | 919 | ||
2150 | 793 | NPW_PluginInfo *pi = (NPW_PluginInfo *)(plugin_data + ofs - NPW_PLUGIN_IDENT_SIZE); | 920 | NPW_PluginInfo *pi = (NPW_PluginInfo *)(plugin_data + ofs - NPW_PLUGIN_IDENT_SIZE); |
2151 | 794 | pi->mtime = st.st_mtime; | 921 | pi->mtime = st.st_mtime; |
2152 | 795 | strcpy(pi->target_arch, plugin_info->target_arch); | 922 | strcpy(pi->target_arch, plugin_info->target_arch); |
2153 | 796 | strcpy(pi->target_os, plugin_info->target_os); | 923 | strcpy(pi->target_os, plugin_info->target_os); |
2154 | 924 | pi->struct_version = w_plugin_info.struct_version; | ||
2155 | 925 | strcpy(pi->viewer_path, plugin_info->viewer_path); | ||
2156 | 797 | 926 | ||
2157 | 798 | int mode = 0700; | 927 | int mode = 0700; |
2158 | 799 | if (!is_user_home_path(d_plugin_path) && | 928 | if (!is_user_home_path(d_plugin_path) && |
2159 | @@ -902,6 +1031,7 @@ | |||
2160 | 902 | 1031 | ||
2161 | 903 | int ret = 0; | 1032 | int ret = 0; |
2162 | 904 | NPW_PluginInfo plugin_info; | 1033 | NPW_PluginInfo plugin_info; |
2163 | 1034 | memset(&plugin_info, 0, sizeof(plugin_info)); | ||
2164 | 905 | is_wrapper_plugin(plugin_path, &plugin_info); | 1035 | is_wrapper_plugin(plugin_path, &plugin_info); |
2165 | 906 | 1036 | ||
2166 | 907 | struct stat st; | 1037 | struct stat st; |
2167 | @@ -968,13 +1098,21 @@ | |||
2168 | 968 | static int list_plugin(const char *plugin_path) | 1098 | static int list_plugin(const char *plugin_path) |
2169 | 969 | { | 1099 | { |
2170 | 970 | NPW_PluginInfo plugin_info; | 1100 | NPW_PluginInfo plugin_info; |
2171 | 1101 | memset(&plugin_info, 0, sizeof(plugin_info)); | ||
2172 | 971 | is_wrapper_plugin(plugin_path, &plugin_info); | 1102 | is_wrapper_plugin(plugin_path, &plugin_info); |
2173 | 972 | 1103 | ||
2174 | 973 | printf("%s\n", plugin_path); | 1104 | printf("%s\n", plugin_path); |
2175 | 974 | printf(" Original plugin: %s\n", plugin_info.path); | 1105 | printf(" Original plugin: %s\n", plugin_info.path); |
2176 | 1106 | if (plugin_info.struct_version >= 2 && plugin_info.viewer_path[0] != '\0') | ||
2177 | 1107 | printf(" Plugin viewer: %s\n", plugin_info.viewer_path); | ||
2178 | 975 | char *str = strtok(plugin_info.ident, ":"); | 1108 | char *str = strtok(plugin_info.ident, ":"); |
2179 | 976 | if (str && strcmp(str, "NPW") == 0) { | 1109 | if (str && strcmp(str, "NPW") == 0) { |
2180 | 977 | str = strtok(NULL, ":"); | 1110 | str = strtok(NULL, ":"); |
2181 | 1111 | if (plugin_info.struct_version >= 2) { /* skip 'X' */ | ||
2182 | 1112 | if (str[0] != 'X') | ||
2183 | 1113 | error("invalid NPW_PluginInfo format"); | ||
2184 | 1114 | str = strtok(NULL, ":"); | ||
2185 | 1115 | } | ||
2186 | 978 | if (str) { | 1116 | if (str) { |
2187 | 979 | printf(" Wrapper version string: %s", str); | 1117 | printf(" Wrapper version string: %s", str); |
2188 | 980 | str = strtok(NULL, ":"); | 1118 | str = strtok(NULL, ":"); |
2189 | @@ -1083,15 +1221,19 @@ | |||
2190 | 1083 | 1221 | ||
2191 | 1084 | for (i = 0; i < argc; i++) { | 1222 | for (i = 0; i < argc; i++) { |
2192 | 1085 | NPW_PluginInfo plugin_info; | 1223 | NPW_PluginInfo plugin_info; |
2193 | 1224 | memset(&plugin_info, 0, sizeof(plugin_info)); | ||
2194 | 1225 | |||
2195 | 1086 | const char *plugin_path = argv[i]; | 1226 | const char *plugin_path = argv[i]; |
2196 | 1087 | if (!is_plugin(plugin_path, &plugin_info)) | 1227 | if (!is_plugin(plugin_path, &plugin_info)) |
2197 | 1088 | error("%s is not a valid NPAPI plugin", plugin_path); | 1228 | error("%s is not a valid NPAPI plugin", plugin_path); |
2198 | 1229 | |||
2199 | 1089 | ret = detect_plugin_viewer(plugin_path, &plugin_info); | 1230 | ret = detect_plugin_viewer(plugin_path, &plugin_info); |
2200 | 1090 | if (ret != EXIT_VIEWER_OK) { | 1231 | if (ret != EXIT_VIEWER_OK) { |
2201 | 1091 | if (ret == EXIT_VIEWER_NATIVE) | 1232 | if (ret == EXIT_VIEWER_NATIVE) |
2202 | 1092 | return 0; /* silently ignore exit status */ | 1233 | return 0; /* silently ignore exit status */ |
2203 | 1093 | error("no appropriate viewer found for %s", plugin_path); | 1234 | error("no appropriate viewer found for %s", plugin_path); |
2204 | 1094 | } | 1235 | } |
2205 | 1236 | |||
2206 | 1095 | ret = install_plugin(plugin_path, &plugin_info); | 1237 | ret = install_plugin(plugin_path, &plugin_info); |
2207 | 1096 | if (ret != 0) | 1238 | if (ret != 0) |
2208 | 1097 | return ret; | 1239 | return ret; |
2209 | 1098 | 1240 | ||
2210 | === modified file 'src/npw-malloc.c' | |||
2211 | --- src/npw-malloc.c 2009-01-02 10:07:27 +0000 | |||
2212 | +++ src/npw-malloc.c 2009-08-11 00:38:42 +0000 | |||
2213 | @@ -23,17 +23,33 @@ | |||
2214 | 23 | #define DEBUG 1 | 23 | #define DEBUG 1 |
2215 | 24 | #include "debug.h" | 24 | #include "debug.h" |
2216 | 25 | 25 | ||
2220 | 26 | typedef void *(*NPW_MemAllocProcPtr) (uint32_t); | 26 | typedef void *(*NPW_MemAllocProcPtr) (uint32_t); |
2221 | 27 | typedef void *(*NPW_MemAlloc0ProcPtr) (uint32_t); | 27 | typedef void (*NPW_MemFreeProcPtr) (void *, uint32_t); |
2219 | 28 | typedef void (*NPW_MemFreeProcPtr) (void *); | ||
2222 | 29 | 28 | ||
2223 | 30 | typedef struct _NPW_MallocHooks NPW_MallocHooks; | 29 | typedef struct _NPW_MallocHooks NPW_MallocHooks; |
2224 | 31 | struct _NPW_MallocHooks | 30 | struct _NPW_MallocHooks |
2225 | 32 | { | 31 | { |
2230 | 33 | NPW_MemAllocProcPtr memalloc; | 32 | NPW_MemAllocProcPtr memalloc; |
2231 | 34 | NPW_MemAlloc0ProcPtr memalloc0; | 33 | NPW_MemAllocProcPtr memalloc0; |
2232 | 35 | NPW_MemFreeProcPtr memfree; | 34 | NPW_MemFreeProcPtr memfree; |
2233 | 36 | }; | 35 | }; |
2234 | 36 | |||
2235 | 37 | #define NPW_MALLOC_MAGIC 0x4e50574d /* 'NPWM' */ | ||
2236 | 38 | |||
2237 | 39 | typedef struct _NPW_MemBlock NPW_MemBlock; | ||
2238 | 40 | struct _NPW_MemBlock | ||
2239 | 41 | { | ||
2240 | 42 | uint32_t magic; | ||
2241 | 43 | uint32_t real_size; | ||
2242 | 44 | uint32_t alloc_size; | ||
2243 | 45 | uint32_t alloc_lineno; | ||
2244 | 46 | const char *alloc_file; | ||
2245 | 47 | }; | ||
2246 | 48 | |||
2247 | 49 | static void *npw_mem_alloc (uint32_t size, const char *file, int lineno); | ||
2248 | 50 | static void *npw_mem_alloc0 (uint32_t size, const char *file, int lineno); | ||
2249 | 51 | static void *npw_mem_alloc_copy (uint32_t size, const void *ptr, const char *file, int lineno); | ||
2250 | 52 | static void npw_mem_free (void *ptr, const char *file, int lineno); | ||
2251 | 37 | 53 | ||
2252 | 38 | /* ====================================================================== */ | 54 | /* ====================================================================== */ |
2253 | 39 | /* === Standard C library === */ | 55 | /* === Standard C library === */ |
2254 | @@ -59,7 +75,7 @@ | |||
2255 | 59 | } | 75 | } |
2256 | 60 | 76 | ||
2257 | 61 | static void | 77 | static void |
2259 | 62 | NPW_Libc_MemFree (void *ptr) | 78 | NPW_Libc_MemFree (void *ptr, uint32_t size) |
2260 | 63 | { | 79 | { |
2261 | 64 | free (ptr); | 80 | free (ptr); |
2262 | 65 | } | 81 | } |
2263 | @@ -82,57 +98,22 @@ | |||
2264 | 82 | #if USE_MALLOC_GLIB | 98 | #if USE_MALLOC_GLIB |
2265 | 83 | #include <glib.h> | 99 | #include <glib.h> |
2266 | 84 | 100 | ||
2267 | 85 | #define NPW_GLIB_MALLOC_MAGIC 0x476c6962 /* 'Glib' */ | ||
2268 | 86 | |||
2269 | 87 | typedef struct _NPW_Glib_MemBlock NPW_Glib_MemBlock; | ||
2270 | 88 | struct _NPW_Glib_MemBlock | ||
2271 | 89 | { | ||
2272 | 90 | uint32_t magic; | ||
2273 | 91 | uint32_t real_size; | ||
2274 | 92 | char data[]; | ||
2275 | 93 | }; | ||
2276 | 94 | |||
2277 | 95 | static void * | 101 | static void * |
2278 | 96 | NPW_Glib_MemAlloc (uint32_t size) | 102 | NPW_Glib_MemAlloc (uint32_t size) |
2279 | 97 | { | 103 | { |
2289 | 98 | uint32_t real_size; | 104 | return g_slice_alloc (size); |
2281 | 99 | NPW_Glib_MemBlock *mem; | ||
2282 | 100 | |||
2283 | 101 | real_size = sizeof (*mem) + size; | ||
2284 | 102 | if ((mem = g_slice_alloc (real_size)) == NULL) | ||
2285 | 103 | return NULL; | ||
2286 | 104 | mem->magic = NPW_GLIB_MALLOC_MAGIC; | ||
2287 | 105 | mem->real_size = real_size; | ||
2288 | 106 | return &mem->data[0]; | ||
2290 | 107 | } | 105 | } |
2291 | 108 | 106 | ||
2292 | 109 | static void * | 107 | static void * |
2293 | 110 | NPW_Glib_MemAlloc0 (uint32_t size) | 108 | NPW_Glib_MemAlloc0 (uint32_t size) |
2294 | 111 | { | 109 | { |
2304 | 112 | uint32_t real_size; | 110 | return g_slice_alloc0 (size); |
2296 | 113 | NPW_Glib_MemBlock *mem; | ||
2297 | 114 | |||
2298 | 115 | real_size = sizeof (*mem) + size; | ||
2299 | 116 | if ((mem = g_slice_alloc0 (real_size)) == NULL) | ||
2300 | 117 | return NULL; | ||
2301 | 118 | mem->magic = NPW_GLIB_MALLOC_MAGIC; | ||
2302 | 119 | mem->real_size = real_size; | ||
2303 | 120 | return &mem->data[0]; | ||
2305 | 121 | } | 111 | } |
2306 | 122 | 112 | ||
2307 | 123 | static void | 113 | static void |
2309 | 124 | NPW_Glib_MemFree (void *ptr) | 114 | NPW_Glib_MemFree (void *ptr, uint32_t size) |
2310 | 125 | { | 115 | { |
2321 | 126 | if (ptr == NULL) | 116 | g_slice_free1 (size, ptr); |
2312 | 127 | return; | ||
2313 | 128 | NPW_Glib_MemBlock *mem = (NPW_Glib_MemBlock *)((char *)ptr - sizeof (*mem)); | ||
2314 | 129 | if (mem->magic == NPW_GLIB_MALLOC_MAGIC) | ||
2315 | 130 | g_slice_free1 (mem->real_size, mem); | ||
2316 | 131 | else | ||
2317 | 132 | { | ||
2318 | 133 | D(bug("WARNING: block %p was not allocated with NPN_MemAlloc(), reverting to libc free()\n", ptr)); | ||
2319 | 134 | free (ptr); | ||
2320 | 135 | } | ||
2322 | 136 | } | 117 | } |
2323 | 137 | 118 | ||
2324 | 138 | static const NPW_MallocHooks g_glib_hooks = { | 119 | static const NPW_MallocHooks g_glib_hooks = { |
2325 | @@ -190,26 +171,200 @@ | |||
2326 | 190 | void * | 171 | void * |
2327 | 191 | NPW_MemAlloc (uint32_t size) | 172 | NPW_MemAlloc (uint32_t size) |
2328 | 192 | { | 173 | { |
2330 | 193 | return get_malloc_hooks ()->memalloc (size); | 174 | return npw_mem_alloc (size, NULL, 0); |
2331 | 194 | } | 175 | } |
2332 | 195 | 176 | ||
2333 | 196 | void * | 177 | void * |
2334 | 197 | NPW_MemAlloc0 (uint32_t size) | 178 | NPW_MemAlloc0 (uint32_t size) |
2335 | 198 | { | 179 | { |
2343 | 199 | return get_malloc_hooks ()->memalloc0 (size); | 180 | return npw_mem_alloc0 (size, NULL, 0); |
2344 | 200 | } | 181 | } |
2345 | 201 | 182 | ||
2346 | 202 | void * | 183 | void * |
2347 | 203 | NPW_MemAllocCopy (uint32_t size, const void *src) | 184 | NPW_MemAllocCopy (uint32_t size, const void *ptr) |
2348 | 204 | { | 185 | { |
2349 | 205 | void *ptr = NPW_MemAlloc (size); | 186 | return npw_mem_alloc_copy (size, ptr, NULL, 0); |
2350 | 187 | } | ||
2351 | 188 | |||
2352 | 189 | void | ||
2353 | 190 | NPW_MemFree (void *ptr) | ||
2354 | 191 | { | ||
2355 | 192 | npw_mem_free (ptr, NULL, 0); | ||
2356 | 193 | } | ||
2357 | 194 | |||
2358 | 195 | void * | ||
2359 | 196 | NPW_Debug_MemAlloc (uint32_t size, const char *file, int lineno) | ||
2360 | 197 | { | ||
2361 | 198 | return npw_mem_alloc (size, file, lineno); | ||
2362 | 199 | } | ||
2363 | 200 | |||
2364 | 201 | void * | ||
2365 | 202 | NPW_Debug_MemAlloc0 (uint32_t size, const char *file, int lineno) | ||
2366 | 203 | { | ||
2367 | 204 | return npw_mem_alloc0 (size, file, lineno); | ||
2368 | 205 | } | ||
2369 | 206 | |||
2370 | 207 | void * | ||
2371 | 208 | NPW_Debug_MemAllocCopy (uint32_t size, const void *ptr, const char *file, int lineno) | ||
2372 | 209 | { | ||
2373 | 210 | return npw_mem_alloc_copy (size, ptr, file, lineno); | ||
2374 | 211 | } | ||
2375 | 212 | |||
2376 | 213 | void | ||
2377 | 214 | NPW_Debug_MemFree (void *ptr, const char *file, int lineno) | ||
2378 | 215 | { | ||
2379 | 216 | npw_mem_free (ptr, file, lineno); | ||
2380 | 217 | } | ||
2381 | 218 | |||
2382 | 219 | /* ====================================================================== */ | ||
2383 | 220 | /* === Implementation allowing basic underflow/overflow checks === */ | ||
2384 | 221 | /* ====================================================================== */ | ||
2385 | 222 | |||
2386 | 223 | #ifdef ENABLE_MALLOC_CHECK | ||
2387 | 224 | static bool | ||
2388 | 225 | is_malloc_check_enabled_1 (void) | ||
2389 | 226 | { | ||
2390 | 227 | const char *malloc_check_str; | ||
2391 | 228 | if ((malloc_check_str = getenv ("NPW_MALLOC_CHECK")) != NULL) | ||
2392 | 229 | return ((strcmp (malloc_check_str, "yes") == 0) || | ||
2393 | 230 | (strcmp (malloc_check_str, "1") == 0)); | ||
2394 | 231 | |||
2395 | 232 | /* enable malloc-checks by default for all builds from snapshots */ | ||
2396 | 233 | return NPW_SNAPSHOT > 0; | ||
2397 | 234 | } | ||
2398 | 235 | #endif | ||
2399 | 236 | |||
2400 | 237 | #define MALLOC_CHECK_GUARD_MARK 'E' | ||
2401 | 238 | #define MALLOC_CHECK_GUARD_SIZE malloc_check_guards_size () | ||
2402 | 239 | |||
2403 | 240 | static inline bool | ||
2404 | 241 | is_malloc_check_enabled (void) | ||
2405 | 242 | { | ||
2406 | 243 | #ifdef ENABLE_MALLOC_CHECK | ||
2407 | 244 | static int malloc_check = -1; | ||
2408 | 245 | if (malloc_check < 0) | ||
2409 | 246 | malloc_check = is_malloc_check_enabled_1 (); | ||
2410 | 247 | return malloc_check; | ||
2411 | 248 | #else | ||
2412 | 249 | return false; | ||
2413 | 250 | #endif | ||
2414 | 251 | } | ||
2415 | 252 | |||
2416 | 253 | static inline uint32_t | ||
2417 | 254 | malloc_check_guards_size (void) | ||
2418 | 255 | { | ||
2419 | 256 | return is_malloc_check_enabled () ? 16 : 0; | ||
2420 | 257 | } | ||
2421 | 258 | |||
2422 | 259 | static void | ||
2423 | 260 | malloc_check_guards_init (uint8_t *ptr, uint32_t size) | ||
2424 | 261 | { | ||
2425 | 262 | if (!is_malloc_check_enabled ()) | ||
2426 | 263 | return; | ||
2427 | 264 | |||
2428 | 265 | memset (ptr - MALLOC_CHECK_GUARD_SIZE, | ||
2429 | 266 | MALLOC_CHECK_GUARD_MARK, | ||
2430 | 267 | MALLOC_CHECK_GUARD_SIZE); | ||
2431 | 268 | memset (ptr + size, | ||
2432 | 269 | MALLOC_CHECK_GUARD_MARK, | ||
2433 | 270 | MALLOC_CHECK_GUARD_SIZE); | ||
2434 | 271 | } | ||
2435 | 272 | |||
2436 | 273 | static bool | ||
2437 | 274 | malloc_check_guards_ok (uint8_t *ptr, uint32_t size, int *punderflow, int *poverflow) | ||
2438 | 275 | { | ||
2439 | 276 | if (!is_malloc_check_enabled ()) | ||
2440 | 277 | return true; | ||
2441 | 278 | |||
2442 | 279 | int i, underflow = 0, overflow = 0; | ||
2443 | 280 | for (i = 0; i < MALLOC_CHECK_GUARD_SIZE; i++) | ||
2444 | 281 | { | ||
2445 | 282 | if (ptr[-(1 + i)] != MALLOC_CHECK_GUARD_MARK) | ||
2446 | 283 | ++underflow; | ||
2447 | 284 | if (ptr[size + i] != MALLOC_CHECK_GUARD_MARK) | ||
2448 | 285 | ++overflow; | ||
2449 | 286 | } | ||
2450 | 287 | if (punderflow) | ||
2451 | 288 | *punderflow = underflow; | ||
2452 | 289 | if (poverflow) | ||
2453 | 290 | *poverflow = overflow; | ||
2454 | 291 | return !underflow && !overflow; | ||
2455 | 292 | } | ||
2456 | 293 | |||
2457 | 294 | static inline void * | ||
2458 | 295 | npw_do_mem_alloc (NPW_MemAllocProcPtr mem_alloc_func, uint32_t size, const char *file, int lineno) | ||
2459 | 296 | { | ||
2460 | 297 | uint32_t real_size; | ||
2461 | 298 | NPW_MemBlock *mem; | ||
2462 | 299 | |||
2463 | 300 | real_size = sizeof (*mem) + size + 2 * MALLOC_CHECK_GUARD_SIZE; | ||
2464 | 301 | if ((mem = mem_alloc_func (real_size)) == NULL) | ||
2465 | 302 | return NULL; | ||
2466 | 303 | |||
2467 | 304 | mem->magic = NPW_MALLOC_MAGIC; | ||
2468 | 305 | mem->real_size = real_size; | ||
2469 | 306 | mem->alloc_size = size; | ||
2470 | 307 | mem->alloc_file = file; | ||
2471 | 308 | mem->alloc_lineno = lineno; | ||
2472 | 309 | |||
2473 | 310 | uint8_t *ptr = (uint8_t *)mem + sizeof (*mem) + MALLOC_CHECK_GUARD_SIZE; | ||
2474 | 311 | malloc_check_guards_init (ptr, size); | ||
2475 | 312 | return ptr; | ||
2476 | 313 | } | ||
2477 | 314 | |||
2478 | 315 | static void * | ||
2479 | 316 | npw_mem_alloc (uint32_t size, const char *file, int lineno) | ||
2480 | 317 | { | ||
2481 | 318 | return npw_do_mem_alloc (get_malloc_hooks ()->memalloc, size, file, lineno); | ||
2482 | 319 | } | ||
2483 | 320 | |||
2484 | 321 | static void * | ||
2485 | 322 | npw_mem_alloc0 (uint32_t size, const char *file, int lineno) | ||
2486 | 323 | { | ||
2487 | 324 | return npw_do_mem_alloc (get_malloc_hooks ()->memalloc0, size, file, lineno); | ||
2488 | 325 | } | ||
2489 | 326 | |||
2490 | 327 | static void * | ||
2491 | 328 | npw_mem_alloc_copy (uint32_t size, const void *src, const char *file, int lineno) | ||
2492 | 329 | { | ||
2493 | 330 | void *ptr = npw_mem_alloc (size, file, lineno); | ||
2494 | 206 | if (ptr) | 331 | if (ptr) |
2495 | 207 | memcpy (ptr, src, size); | 332 | memcpy (ptr, src, size); |
2496 | 208 | return ptr; | 333 | return ptr; |
2497 | 209 | } | 334 | } |
2498 | 210 | 335 | ||
2501 | 211 | void | 336 | static void |
2502 | 212 | NPW_MemFree (void *ptr) | 337 | npw_mem_free (void *ptr, const char *file, int lineno) |
2503 | 213 | { | 338 | { |
2505 | 214 | get_malloc_hooks ()->memfree (ptr); | 339 | if (ptr == NULL) |
2506 | 340 | return; | ||
2507 | 341 | |||
2508 | 342 | NPW_MemBlock *mem = (NPW_MemBlock *)((char *)ptr - (sizeof (*mem) + MALLOC_CHECK_GUARD_SIZE)); | ||
2509 | 343 | if (mem->magic == NPW_MALLOC_MAGIC) | ||
2510 | 344 | { | ||
2511 | 345 | int underflow, overflow; | ||
2512 | 346 | if (!malloc_check_guards_ok (ptr, mem->alloc_size, &underflow, &overflow)) | ||
2513 | 347 | { | ||
2514 | 348 | if (underflow) | ||
2515 | 349 | npw_printf ("ERROR: detected underflow of %d bytes\n" | ||
2516 | 350 | " for block allocated at %s:%d\n" | ||
2517 | 351 | " and released at %s:%d\n", | ||
2518 | 352 | underflow, | ||
2519 | 353 | mem->alloc_file, mem->alloc_lineno, | ||
2520 | 354 | file, lineno); | ||
2521 | 355 | if (overflow) | ||
2522 | 356 | npw_printf ("ERROR: detected overflow of %d bytes\n" | ||
2523 | 357 | " for block allocated at %s:%d\n" | ||
2524 | 358 | " and released at %s:%d\n", | ||
2525 | 359 | overflow, | ||
2526 | 360 | mem->alloc_file, mem->alloc_lineno, | ||
2527 | 361 | file, lineno); | ||
2528 | 362 | } | ||
2529 | 363 | get_malloc_hooks ()->memfree (mem, mem->real_size); | ||
2530 | 364 | } | ||
2531 | 365 | else | ||
2532 | 366 | { | ||
2533 | 367 | npw_printf("ERROR: block %p was not allocated with NPW_MemAlloc(), reverting to libc free()\n", ptr); | ||
2534 | 368 | free (ptr); | ||
2535 | 369 | } | ||
2536 | 215 | } | 370 | } |
2537 | 216 | 371 | ||
2538 | === modified file 'src/npw-malloc.h' | |||
2539 | --- src/npw-malloc.h 2009-01-02 10:07:27 +0000 | |||
2540 | +++ src/npw-malloc.h 2009-08-11 00:38:42 +0000 | |||
2541 | @@ -33,6 +33,18 @@ | |||
2542 | 33 | void | 33 | void |
2543 | 34 | NPW_MemFree (void *ptr); | 34 | NPW_MemFree (void *ptr); |
2544 | 35 | 35 | ||
2545 | 36 | void * | ||
2546 | 37 | NPW_Debug_MemAlloc (uint32_t size, const char *file, int lineno); | ||
2547 | 38 | |||
2548 | 39 | void * | ||
2549 | 40 | NPW_Debug_MemAlloc0 (uint32_t size, const char *file, int lineno); | ||
2550 | 41 | |||
2551 | 42 | void * | ||
2552 | 43 | NPW_Debug_MemAllocCopy (uint32_t size, const void *ptr, const char *file, int lineno); | ||
2553 | 44 | |||
2554 | 45 | void | ||
2555 | 46 | NPW_Debug_MemFree (void *ptr, const char *file, int lineno); | ||
2556 | 47 | |||
2557 | 36 | #define NPW_MemNew(type, n) \ | 48 | #define NPW_MemNew(type, n) \ |
2558 | 37 | ((type *) NPW_MemAlloc ((n) * sizeof (type))) | 49 | ((type *) NPW_MemAlloc ((n) * sizeof (type))) |
2559 | 38 | 50 | ||
2560 | @@ -42,4 +54,11 @@ | |||
2561 | 42 | #define NPW_MemClone(type, ptr) \ | 54 | #define NPW_MemClone(type, ptr) \ |
2562 | 43 | ((type *) NPW_MemAllocCopy (sizeof (type), ptr)) | 55 | ((type *) NPW_MemAllocCopy (sizeof (type), ptr)) |
2563 | 44 | 56 | ||
2564 | 57 | #ifdef ENABLE_MALLOC_CHECK | ||
2565 | 58 | # define NPW_MemAlloc(SIZE) NPW_Debug_MemAlloc(SIZE, __FILE__, __LINE__) | ||
2566 | 59 | # define NPW_MemAlloc0(SIZE) NPW_Debug_MemAlloc0(SIZE, __FILE__, __LINE__) | ||
2567 | 60 | # define NPW_MemAllocCopy(SIZE, PTR) NPW_Debug_MemAllocCopy(SIZE, PTR, __FILE__, __LINE__) | ||
2568 | 61 | # define NPW_MemFree(PTR) NPW_Debug_MemFree(PTR, __FILE__, __LINE__) | ||
2569 | 62 | #endif | ||
2570 | 63 | |||
2571 | 45 | #endif /* NPW_MALLOC_H */ | 64 | #endif /* NPW_MALLOC_H */ |
2572 | 46 | 65 | ||
2573 | === modified file 'src/npw-viewer.c' | |||
2574 | --- src/npw-viewer.c 2009-01-02 10:07:27 +0000 | |||
2575 | +++ src/npw-viewer.c 2009-08-11 00:38:42 +0000 | |||
2576 | @@ -28,6 +28,8 @@ | |||
2577 | 28 | #include <dlfcn.h> | 28 | #include <dlfcn.h> |
2578 | 29 | #include <unistd.h> | 29 | #include <unistd.h> |
2579 | 30 | #include <errno.h> | 30 | #include <errno.h> |
2580 | 31 | #include <pthread.h> | ||
2581 | 32 | #include <fcntl.h> | ||
2582 | 31 | 33 | ||
2583 | 32 | #include <X11/X.h> | 34 | #include <X11/X.h> |
2584 | 33 | #include <X11/Xlib.h> | 35 | #include <X11/Xlib.h> |
2585 | @@ -58,11 +60,15 @@ | |||
2586 | 58 | // Define to allow windowless plugins | 60 | // Define to allow windowless plugins |
2587 | 59 | #define ALLOW_WINDOWLESS_PLUGINS 1 | 61 | #define ALLOW_WINDOWLESS_PLUGINS 1 |
2588 | 60 | 62 | ||
2589 | 63 | // Define to use NPIdentifier cache | ||
2590 | 64 | #define USE_NPIDENTIFIER_CACHE 1 | ||
2591 | 65 | #define NPIDENTIFIER_CACHE_SIZE 256 | ||
2592 | 66 | |||
2593 | 61 | // RPC global connections | 67 | // RPC global connections |
2594 | 62 | rpc_connection_t *g_rpc_connection attribute_hidden = NULL; | 68 | rpc_connection_t *g_rpc_connection attribute_hidden = NULL; |
2595 | 63 | 69 | ||
2598 | 64 | // Viewer orignal pid - check against incorrect plugins | 70 | // Viewer main thread - make sure we call into the browser from the main thread |
2599 | 65 | static pid_t g_viewer_pid = 0; | 71 | static pthread_t g_main_thread = 0; |
2600 | 66 | 72 | ||
2601 | 67 | // Instance state information about the plugin | 73 | // Instance state information about the plugin |
2602 | 68 | typedef struct _PluginInstance { | 74 | typedef struct _PluginInstance { |
2603 | @@ -101,6 +107,8 @@ | |||
2604 | 101 | 107 | ||
2605 | 102 | // Prototypes | 108 | // Prototypes |
2606 | 103 | static void destroy_window(PluginInstance *plugin); | 109 | static void destroy_window(PluginInstance *plugin); |
2607 | 110 | static int xt_source_create(void); | ||
2608 | 111 | static void xt_source_destroy(void); | ||
2609 | 104 | 112 | ||
2610 | 105 | 113 | ||
2611 | 106 | /* ====================================================================== */ | 114 | /* ====================================================================== */ |
2612 | @@ -162,16 +170,38 @@ | |||
2613 | 162 | } | 170 | } |
2614 | 163 | } | 171 | } |
2615 | 164 | 172 | ||
2626 | 165 | // Pid support routines | 173 | // Thread support routines |
2627 | 166 | static void pid_init(void) | 174 | static void thread_check_init(void) |
2628 | 167 | { | 175 | { |
2629 | 168 | g_viewer_pid = getpid(); | 176 | g_main_thread = pthread_self(); |
2630 | 169 | } | 177 | } |
2631 | 170 | 178 | ||
2632 | 171 | bool pid_check(void) | 179 | #ifdef ENABLE_THREAD_CHECK |
2633 | 172 | { | 180 | static bool is_thread_check_enabled_1(void) |
2634 | 173 | #if USE_PID_CHECK | 181 | { |
2635 | 174 | return (g_viewer_pid == getpid()); | 182 | const char *thread_check_str; |
2636 | 183 | if ((thread_check_str = getenv("NPW_THREAD_CHECK")) != NULL) | ||
2637 | 184 | return ((strcmp(thread_check_str, "yes") == 0) || | ||
2638 | 185 | (strcmp(thread_check_str, "1") == 0)); | ||
2639 | 186 | |||
2640 | 187 | /* enable main-thread checks by default for all builds from snapshots */ | ||
2641 | 188 | return NPW_SNAPSHOT > 0; | ||
2642 | 189 | } | ||
2643 | 190 | |||
2644 | 191 | static inline bool is_thread_check_enabled(void) | ||
2645 | 192 | { | ||
2646 | 193 | static int thread_check = -1; | ||
2647 | 194 | if (thread_check < 0) | ||
2648 | 195 | thread_check = is_thread_check_enabled_1(); | ||
2649 | 196 | return thread_check; | ||
2650 | 197 | } | ||
2651 | 198 | #endif | ||
2652 | 199 | |||
2653 | 200 | bool thread_check(void) | ||
2654 | 201 | { | ||
2655 | 202 | #ifdef ENABLE_THREAD_CHECK | ||
2656 | 203 | if (is_thread_check_enabled()) | ||
2657 | 204 | return (g_main_thread == pthread_self()); | ||
2658 | 175 | #endif | 205 | #endif |
2659 | 176 | return true; | 206 | return true; |
2660 | 177 | } | 207 | } |
2661 | @@ -180,8 +210,7 @@ | |||
2662 | 180 | // XXX: use a pipe, this should be faster (avoids GSource creation and | 210 | // XXX: use a pipe, this should be faster (avoids GSource creation and |
2663 | 181 | // explicit memory allocation) | 211 | // explicit memory allocation) |
2664 | 182 | enum { | 212 | enum { |
2667 | 183 | RPC_DELAYED_NPN_RELEASE_OBJECT = 1, | 213 | RPC_DELAYED_NPN_RELEASE_OBJECT = 1 |
2666 | 184 | RPC_DELAYED_NPN_INVALIDATE_RECT, | ||
2668 | 185 | }; | 214 | }; |
2669 | 186 | 215 | ||
2670 | 187 | typedef struct _DelayedCall { | 216 | typedef struct _DelayedCall { |
2671 | @@ -251,6 +280,200 @@ | |||
2672 | 251 | return delayed_calls_process(NULL, FALSE); | 280 | return delayed_calls_process(NULL, FALSE); |
2673 | 252 | } | 281 | } |
2674 | 253 | 282 | ||
2675 | 283 | // NPIdentifier cache | ||
2676 | 284 | static inline bool use_npidentifier_cache(void) | ||
2677 | 285 | { | ||
2678 | 286 | return USE_NPIDENTIFIER_CACHE && npruntime_use_cache(); | ||
2679 | 287 | } | ||
2680 | 288 | |||
2681 | 289 | #if USE_NPIDENTIFIER_CACHE | ||
2682 | 290 | /* XXX: NPIdentifierInfo could become the NPIdentifier, thus avoiding | ||
2683 | 291 | the global hash table, if there is a garbage collector. Otherwise, | ||
2684 | 292 | we will be leaking memory since there is no function that kills an | ||
2685 | 293 | NPIdentifier. */ | ||
2686 | 294 | typedef struct _NPIdentifierInfo { | ||
2687 | 295 | guint string_len; /* >0 implies 1+strlen(string), =0 implies an integer */ | ||
2688 | 296 | union { | ||
2689 | 297 | gchar *string; | ||
2690 | 298 | int32_t value; | ||
2691 | 299 | } u; | ||
2692 | 300 | } NPIdentifierInfo; | ||
2693 | 301 | |||
2694 | 302 | static GHashTable *g_npidentifier_cache = NULL; | ||
2695 | 303 | |||
2696 | 304 | |||
2697 | 305 | static inline NPIdentifierInfo *npidentifier_info_new(void) | ||
2698 | 306 | { | ||
2699 | 307 | return NPW_MemNew(NPIdentifierInfo, 1); | ||
2700 | 308 | } | ||
2701 | 309 | |||
2702 | 310 | static inline void npidentifier_info_destroy(NPIdentifierInfo *npi) | ||
2703 | 311 | { | ||
2704 | 312 | if (G_UNLIKELY(npi == NULL)) | ||
2705 | 313 | return; | ||
2706 | 314 | if (npi->string_len > 0) { | ||
2707 | 315 | NPW_MemFree(npi->u.string); | ||
2708 | 316 | npi->u.string = NULL; | ||
2709 | 317 | } | ||
2710 | 318 | NPW_MemFree(npi); | ||
2711 | 319 | } | ||
2712 | 320 | |||
2713 | 321 | static inline void npidentifier_cache_create(void) | ||
2714 | 322 | { | ||
2715 | 323 | g_npidentifier_cache = | ||
2716 | 324 | g_hash_table_new_full(NULL, NULL, NULL, | ||
2717 | 325 | (GDestroyNotify)npidentifier_info_destroy); | ||
2718 | 326 | } | ||
2719 | 327 | |||
2720 | 328 | static inline void npidentifier_cache_destroy(void) | ||
2721 | 329 | { | ||
2722 | 330 | if (g_npidentifier_cache) { | ||
2723 | 331 | g_hash_table_destroy(g_npidentifier_cache); | ||
2724 | 332 | g_npidentifier_cache = NULL; | ||
2725 | 333 | } | ||
2726 | 334 | } | ||
2727 | 335 | |||
2728 | 336 | static void npidentifier_cache_invalidate(void) | ||
2729 | 337 | { | ||
2730 | 338 | #if defined(HAVE_G_HASH_TABLE_REMOVE_ALL) && !defined(BUILD_GENERIC) | ||
2731 | 339 | if (g_npidentifier_cache) | ||
2732 | 340 | g_hash_table_remove_all(g_npidentifier_cache); | ||
2733 | 341 | #else | ||
2734 | 342 | npidentifier_cache_destroy(); | ||
2735 | 343 | npidentifier_cache_create(); | ||
2736 | 344 | #endif | ||
2737 | 345 | } | ||
2738 | 346 | |||
2739 | 347 | static void npidentifier_cache_reserve(int n_entries) | ||
2740 | 348 | { | ||
2741 | 349 | if (G_UNLIKELY(g_npidentifier_cache == NULL)) | ||
2742 | 350 | npidentifier_cache_create(); | ||
2743 | 351 | if (g_hash_table_size(g_npidentifier_cache) + n_entries > NPIDENTIFIER_CACHE_SIZE) | ||
2744 | 352 | npidentifier_cache_invalidate(); | ||
2745 | 353 | } | ||
2746 | 354 | |||
2747 | 355 | static inline NPIdentifierInfo *npidentifier_cache_lookup(NPIdentifier ident) | ||
2748 | 356 | { | ||
2749 | 357 | if (G_UNLIKELY(g_npidentifier_cache == NULL)) | ||
2750 | 358 | return NULL; | ||
2751 | 359 | return g_hash_table_lookup(g_npidentifier_cache, ident); | ||
2752 | 360 | } | ||
2753 | 361 | |||
2754 | 362 | static void npidentifier_cache_add_int(NPIdentifier ident, int32_t value) | ||
2755 | 363 | { | ||
2756 | 364 | if (G_UNLIKELY(g_npidentifier_cache == NULL)) | ||
2757 | 365 | return; | ||
2758 | 366 | NPIdentifierInfo *npi = npidentifier_info_new(); | ||
2759 | 367 | if (G_UNLIKELY(npi == NULL)) | ||
2760 | 368 | return; | ||
2761 | 369 | npi->string_len = 0; | ||
2762 | 370 | npi->u.value = value; | ||
2763 | 371 | g_hash_table_insert(g_npidentifier_cache, ident, npi); | ||
2764 | 372 | } | ||
2765 | 373 | |||
2766 | 374 | typedef struct _NPIdentifierFindArgs { | ||
2767 | 375 | NPIdentifierInfo info; /* in */ | ||
2768 | 376 | NPIdentifier ident; /* out */ | ||
2769 | 377 | } NPIdentifierFindArgs; | ||
2770 | 378 | |||
2771 | 379 | static gboolean npidentifier_cache_find_info(gpointer key, gpointer value, gpointer user_data) | ||
2772 | 380 | { | ||
2773 | 381 | NPIdentifier *ident = (NPIdentifier)key; | ||
2774 | 382 | NPIdentifierInfo *npi = (NPIdentifierInfo *)value; | ||
2775 | 383 | NPIdentifierFindArgs *args = (NPIdentifierFindArgs *)user_data; | ||
2776 | 384 | #if !defined(HAVE_G_HASH_TABLE_FIND) || defined(BUILD_GENERIC) | ||
2777 | 385 | if (args->ident) | ||
2778 | 386 | return FALSE; | ||
2779 | 387 | #endif | ||
2780 | 388 | if (npi->string_len != args->info.string_len) | ||
2781 | 389 | return FALSE; | ||
2782 | 390 | if (args->info.string_len > 0) { /* a string */ | ||
2783 | 391 | if (memcmp(args->info.u.string, npi->u.string, args->info.string_len) == 0) { | ||
2784 | 392 | args->ident = ident; | ||
2785 | 393 | return TRUE; | ||
2786 | 394 | } | ||
2787 | 395 | } | ||
2788 | 396 | else { /* an integer */ | ||
2789 | 397 | if (args->info.u.value == npi->u.value) { | ||
2790 | 398 | args->ident = ident; | ||
2791 | 399 | return TRUE; | ||
2792 | 400 | } | ||
2793 | 401 | } | ||
2794 | 402 | return FALSE; | ||
2795 | 403 | } | ||
2796 | 404 | |||
2797 | 405 | static inline bool npidentifier_cache_find(NPIdentifierFindArgs *args, NPIdentifier *pident) | ||
2798 | 406 | { | ||
2799 | 407 | args->ident = NULL; | ||
2800 | 408 | #if defined(HAVE_G_HASH_TABLE_FIND) && !defined(BUILD_GENERIC) | ||
2801 | 409 | if (!g_hash_table_find(g_npidentifier_cache, npidentifier_cache_find_info, args)) | ||
2802 | 410 | return false; | ||
2803 | 411 | #else | ||
2804 | 412 | g_hash_table_foreach(g_npidentifier_cache, (GHFunc)npidentifier_cache_find_info, args); | ||
2805 | 413 | if (args->ident == NULL) | ||
2806 | 414 | return false; | ||
2807 | 415 | #endif | ||
2808 | 416 | |||
2809 | 417 | if (pident) | ||
2810 | 418 | *pident = args->ident; | ||
2811 | 419 | return true; | ||
2812 | 420 | } | ||
2813 | 421 | |||
2814 | 422 | static inline bool npidentifier_cache_has_int(int32_t value, NPIdentifier *pident) | ||
2815 | 423 | { | ||
2816 | 424 | if (G_UNLIKELY(g_npidentifier_cache == NULL)) | ||
2817 | 425 | return false; | ||
2818 | 426 | |||
2819 | 427 | NPIdentifierFindArgs args; | ||
2820 | 428 | args.info.string_len = 0; | ||
2821 | 429 | args.info.u.value = value; | ||
2822 | 430 | return npidentifier_cache_find(&args, pident); | ||
2823 | 431 | } | ||
2824 | 432 | |||
2825 | 433 | static inline int32_t npidentifier_cache_get_int(NPIdentifier ident) | ||
2826 | 434 | { | ||
2827 | 435 | NPIdentifierInfo *npi = npidentifier_cache_lookup(ident); | ||
2828 | 436 | if (G_UNLIKELY(npi == NULL || npi->string_len > 0)) | ||
2829 | 437 | return 0; | ||
2830 | 438 | return npi->u.value; | ||
2831 | 439 | } | ||
2832 | 440 | |||
2833 | 441 | static void npidentifier_cache_add_string(NPIdentifier ident, const gchar *str) | ||
2834 | 442 | { | ||
2835 | 443 | if (G_UNLIKELY(g_npidentifier_cache == NULL)) | ||
2836 | 444 | return; | ||
2837 | 445 | NPIdentifierInfo *npi = npidentifier_info_new(); | ||
2838 | 446 | if (G_UNLIKELY(npi == NULL)) | ||
2839 | 447 | return; | ||
2840 | 448 | npi->string_len = strlen(str) + 1; | ||
2841 | 449 | if ((npi->u.string = NPW_MemAlloc(npi->string_len)) == NULL) { | ||
2842 | 450 | npidentifier_info_destroy(npi); | ||
2843 | 451 | return; | ||
2844 | 452 | } | ||
2845 | 453 | memcpy(npi->u.string, str, npi->string_len); | ||
2846 | 454 | g_hash_table_insert(g_npidentifier_cache, ident, npi); | ||
2847 | 455 | } | ||
2848 | 456 | |||
2849 | 457 | static inline bool npidentifier_cache_has_string(const gchar *str, NPIdentifier *pident) | ||
2850 | 458 | { | ||
2851 | 459 | if (G_UNLIKELY(g_npidentifier_cache == NULL)) | ||
2852 | 460 | return false; | ||
2853 | 461 | |||
2854 | 462 | NPIdentifierFindArgs args; | ||
2855 | 463 | args.info.string_len = strlen(str) + 1; | ||
2856 | 464 | args.info.u.string = (gchar *)str; | ||
2857 | 465 | return npidentifier_cache_find(&args, pident); | ||
2858 | 466 | } | ||
2859 | 467 | |||
2860 | 468 | static inline NPUTF8 *npidentifier_cache_get_string_copy(NPIdentifier ident) | ||
2861 | 469 | { | ||
2862 | 470 | NPIdentifierInfo *npi = npidentifier_cache_lookup(ident); | ||
2863 | 471 | if (G_UNLIKELY(npi == NULL || npi->string_len == 0)) | ||
2864 | 472 | return NULL; | ||
2865 | 473 | return NPW_MemAllocCopy(npi->string_len, npi->u.string); | ||
2866 | 474 | } | ||
2867 | 475 | #endif | ||
2868 | 476 | |||
2869 | 254 | 477 | ||
2870 | 255 | /* ====================================================================== */ | 478 | /* ====================================================================== */ |
2871 | 256 | /* === X Toolkit glue === */ | 479 | /* === X Toolkit glue === */ |
2872 | @@ -302,6 +525,57 @@ | |||
2873 | 302 | CorePart core; | 525 | CorePart core; |
2874 | 303 | } WidgetRec, CoreRec; | 526 | } WidgetRec, CoreRec; |
2875 | 304 | 527 | ||
2876 | 528 | typedef struct _TimerEventRec { | ||
2877 | 529 | struct timeval te_timer_value; | ||
2878 | 530 | struct _TimerEventRec *te_next; | ||
2879 | 531 | XtTimerCallbackProc te_proc; | ||
2880 | 532 | XtAppContext app; | ||
2881 | 533 | XtPointer te_closure; | ||
2882 | 534 | } TimerEventRec; | ||
2883 | 535 | |||
2884 | 536 | typedef struct _InputEvent { | ||
2885 | 537 | XtInputCallbackProc ie_proc; | ||
2886 | 538 | XtPointer ie_closure; | ||
2887 | 539 | struct _InputEvent *ie_next; | ||
2888 | 540 | struct _InputEvent *ie_oq; | ||
2889 | 541 | XtAppContext app; | ||
2890 | 542 | int ie_source; | ||
2891 | 543 | XtInputMask ie_condition; | ||
2892 | 544 | } InputEvent; | ||
2893 | 545 | |||
2894 | 546 | typedef struct _SignalEventRec { | ||
2895 | 547 | XtSignalCallbackProc se_proc; | ||
2896 | 548 | XtPointer se_closure; | ||
2897 | 549 | struct _SignalEventRec *se_next; | ||
2898 | 550 | XtAppContext app; | ||
2899 | 551 | Boolean se_notice; | ||
2900 | 552 | } SignalEventRec; | ||
2901 | 553 | |||
2902 | 554 | struct _XtAppStruct { | ||
2903 | 555 | XtAppContext next; /* link to next app in process context */ | ||
2904 | 556 | void *process; /* back pointer to our process context */ | ||
2905 | 557 | void *destroy_callbacks; | ||
2906 | 558 | Display **list; | ||
2907 | 559 | TimerEventRec *timerQueue; | ||
2908 | 560 | void *workQueue; | ||
2909 | 561 | InputEvent **input_list; | ||
2910 | 562 | InputEvent *outstandingQueue; | ||
2911 | 563 | SignalEventRec *signalQueue; | ||
2912 | 564 | XrmDatabase errorDB; | ||
2913 | 565 | XtErrorMsgHandler errorMsgHandler, warningMsgHandler; | ||
2914 | 566 | XtErrorHandler errorHandler, warningHandler; | ||
2915 | 567 | struct _ActionListRec *action_table; | ||
2916 | 568 | void *converterTable; | ||
2917 | 569 | unsigned long selectionTimeout; | ||
2918 | 570 | char __maxed__nfds[3*sizeof(fd_set)+4]; | ||
2919 | 571 | short __maybe__count; /* num of assigned entries in list */ | ||
2920 | 572 | short __maybe__max; /* allocate size of list */ | ||
2921 | 573 | short __maybe__last; | ||
2922 | 574 | short __maybe__input_count; | ||
2923 | 575 | short __maybe__input_max; /* elts input_list init'd with */ | ||
2924 | 576 | /* ... don't care about other members */ | ||
2925 | 577 | }; | ||
2926 | 578 | |||
2927 | 305 | extern void XtResizeWidget( | 579 | extern void XtResizeWidget( |
2928 | 306 | Widget /* widget */, | 580 | Widget /* widget */, |
2929 | 307 | _XtDimension /* width */, | 581 | _XtDimension /* width */, |
2930 | @@ -780,8 +1054,8 @@ | |||
2931 | 780 | static NPError | 1054 | static NPError |
2932 | 781 | g_NPN_GetURL(NPP instance, const char *url, const char *target) | 1055 | g_NPN_GetURL(NPP instance, const char *url, const char *target) |
2933 | 782 | { | 1056 | { |
2936 | 783 | if (!pid_check()) { | 1057 | if (!thread_check()) { |
2937 | 784 | npw_printf("WARNING: NPN_GetURL called from the wrong process\n"); | 1058 | npw_printf("WARNING: NPN_GetURL not called from the main thread\n"); |
2938 | 785 | return NPERR_INVALID_INSTANCE_ERROR; | 1059 | return NPERR_INVALID_INSTANCE_ERROR; |
2939 | 786 | } | 1060 | } |
2940 | 787 | 1061 | ||
2941 | @@ -834,8 +1108,8 @@ | |||
2942 | 834 | static NPError | 1108 | static NPError |
2943 | 835 | g_NPN_GetURLNotify(NPP instance, const char *url, const char *target, void *notifyData) | 1109 | g_NPN_GetURLNotify(NPP instance, const char *url, const char *target, void *notifyData) |
2944 | 836 | { | 1110 | { |
2947 | 837 | if (!pid_check()) { | 1111 | if (!thread_check()) { |
2948 | 838 | npw_printf("WARNING: NPN_GetURLNotify called from the wrong process\n"); | 1112 | npw_printf("WARNING: NPN_GetURLNotify not called from the main thread\n"); |
2949 | 839 | return NPERR_INVALID_INSTANCE_ERROR; | 1113 | return NPERR_INVALID_INSTANCE_ERROR; |
2950 | 840 | } | 1114 | } |
2951 | 841 | 1115 | ||
2952 | @@ -933,8 +1207,8 @@ | |||
2953 | 933 | { | 1207 | { |
2954 | 934 | D(bug("NPN_GetValue instance=%p, variable=%d [%s]\n", instance, variable, string_of_NPNVariable(variable))); | 1208 | D(bug("NPN_GetValue instance=%p, variable=%d [%s]\n", instance, variable, string_of_NPNVariable(variable))); |
2955 | 935 | 1209 | ||
2958 | 936 | if (!pid_check()) { | 1210 | if (!thread_check()) { |
2959 | 937 | npw_printf("WARNING: NPN_GetValue called from the wrong process\n"); | 1211 | npw_printf("WARNING: NPN_GetValue not called from the main thread\n"); |
2960 | 938 | return NPERR_INVALID_INSTANCE_ERROR; | 1212 | return NPERR_INVALID_INSTANCE_ERROR; |
2961 | 939 | } | 1213 | } |
2962 | 940 | 1214 | ||
2963 | @@ -1038,8 +1312,8 @@ | |||
2964 | 1038 | static void | 1312 | static void |
2965 | 1039 | g_NPN_InvalidateRect(NPP instance, NPRect *invalidRect) | 1313 | g_NPN_InvalidateRect(NPP instance, NPRect *invalidRect) |
2966 | 1040 | { | 1314 | { |
2969 | 1041 | if (!pid_check()) { | 1315 | if (!thread_check()) { |
2970 | 1042 | npw_printf("WARNING: NPN_InvalidateRect called from the wrong process\n"); | 1316 | npw_printf("WARNING: NPN_InvalidateRect not called from the main thread\n"); |
2971 | 1043 | return; | 1317 | return; |
2972 | 1044 | } | 1318 | } |
2973 | 1045 | 1319 | ||
2974 | @@ -1132,8 +1406,8 @@ | |||
2975 | 1132 | static NPError | 1406 | static NPError |
2976 | 1133 | g_NPN_PostURL(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file) | 1407 | g_NPN_PostURL(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file) |
2977 | 1134 | { | 1408 | { |
2980 | 1135 | if (!pid_check()) { | 1409 | if (!thread_check()) { |
2981 | 1136 | npw_printf("WARNING: NPN_PostURL called from the wrong process\n"); | 1410 | npw_printf("WARNING: NPN_PostURL not called from the main thread\n"); |
2982 | 1137 | return NPERR_INVALID_INSTANCE_ERROR; | 1411 | return NPERR_INVALID_INSTANCE_ERROR; |
2983 | 1138 | } | 1412 | } |
2984 | 1139 | 1413 | ||
2985 | @@ -1188,8 +1462,8 @@ | |||
2986 | 1188 | static NPError | 1462 | static NPError |
2987 | 1189 | g_NPN_PostURLNotify(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file, void *notifyData) | 1463 | g_NPN_PostURLNotify(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file, void *notifyData) |
2988 | 1190 | { | 1464 | { |
2991 | 1191 | if (!pid_check()) { | 1465 | if (!thread_check()) { |
2992 | 1192 | npw_printf("WARNING: NPN_PostURLNotify called from the wrong process\n"); | 1466 | npw_printf("WARNING: NPN_PostURLNotify not called from the main thread\n"); |
2993 | 1193 | return NPERR_INVALID_INSTANCE_ERROR; | 1467 | return NPERR_INVALID_INSTANCE_ERROR; |
2994 | 1194 | } | 1468 | } |
2995 | 1195 | 1469 | ||
2996 | @@ -1267,8 +1541,8 @@ | |||
2997 | 1267 | static NPError | 1541 | static NPError |
2998 | 1268 | g_NPN_RequestRead(NPStream *stream, NPByteRange *rangeList) | 1542 | g_NPN_RequestRead(NPStream *stream, NPByteRange *rangeList) |
2999 | 1269 | { | 1543 | { |
3002 | 1270 | if (!pid_check()) { | 1544 | if (!thread_check()) { |
3003 | 1271 | npw_printf("WARNING: NPN_RequestRead called from the wrong process\n"); | 1545 | npw_printf("WARNING: NPN_RequestRead not called from the main thread\n"); |
3004 | 1272 | return NPERR_INVALID_INSTANCE_ERROR; | 1546 | return NPERR_INVALID_INSTANCE_ERROR; |
3005 | 1273 | } | 1547 | } |
3006 | 1274 | 1548 | ||
3007 | @@ -1320,8 +1594,8 @@ | |||
3008 | 1320 | static NPError | 1594 | static NPError |
3009 | 1321 | g_NPN_SetValue(NPP instance, NPPVariable variable, void *value) | 1595 | g_NPN_SetValue(NPP instance, NPPVariable variable, void *value) |
3010 | 1322 | { | 1596 | { |
3013 | 1323 | if (!pid_check()) { | 1597 | if (!thread_check()) { |
3014 | 1324 | npw_printf("WARNING: NPN_SetValue called from the wrong process\n"); | 1598 | npw_printf("WARNING: NPN_SetValue not called from the main thread\n"); |
3015 | 1325 | return NPERR_INVALID_INSTANCE_ERROR; | 1599 | return NPERR_INVALID_INSTANCE_ERROR; |
3016 | 1326 | } | 1600 | } |
3017 | 1327 | 1601 | ||
3018 | @@ -1368,8 +1642,8 @@ | |||
3019 | 1368 | static void | 1642 | static void |
3020 | 1369 | g_NPN_Status(NPP instance, const char *message) | 1643 | g_NPN_Status(NPP instance, const char *message) |
3021 | 1370 | { | 1644 | { |
3024 | 1371 | if (!pid_check()) { | 1645 | if (!thread_check()) { |
3025 | 1372 | npw_printf("WARNING: NPN_Status called from the wrong process\n"); | 1646 | npw_printf("WARNING: NPN_Status not called from the main thread\n"); |
3026 | 1373 | return; | 1647 | return; |
3027 | 1374 | } | 1648 | } |
3028 | 1375 | 1649 | ||
3029 | @@ -1415,8 +1689,8 @@ | |||
3030 | 1415 | static const char * | 1689 | static const char * |
3031 | 1416 | g_NPN_UserAgent(NPP instance) | 1690 | g_NPN_UserAgent(NPP instance) |
3032 | 1417 | { | 1691 | { |
3035 | 1418 | if (!pid_check()) { | 1692 | if (!thread_check()) { |
3036 | 1419 | npw_printf("WARNING: NPN_UserAgent called from the wrong process\n"); | 1693 | npw_printf("WARNING: NPN_UserAgent not called from the main thread\n"); |
3037 | 1420 | return NULL; | 1694 | return NULL; |
3038 | 1421 | } | 1695 | } |
3039 | 1422 | 1696 | ||
3040 | @@ -1505,8 +1779,8 @@ | |||
3041 | 1505 | static NPError | 1779 | static NPError |
3042 | 1506 | g_NPN_NewStream(NPP instance, NPMIMEType type, const char *target, NPStream **stream) | 1780 | g_NPN_NewStream(NPP instance, NPMIMEType type, const char *target, NPStream **stream) |
3043 | 1507 | { | 1781 | { |
3046 | 1508 | if (!pid_check()) { | 1782 | if (!thread_check()) { |
3047 | 1509 | npw_printf("WARNING: NPN_NewStream called from the wrong process\n"); | 1783 | npw_printf("WARNING: NPN_NewStream not called from the main thread\n"); |
3048 | 1510 | return NPERR_INVALID_INSTANCE_ERROR; | 1784 | return NPERR_INVALID_INSTANCE_ERROR; |
3049 | 1511 | } | 1785 | } |
3050 | 1512 | 1786 | ||
3051 | @@ -1564,8 +1838,8 @@ | |||
3052 | 1564 | static NPError | 1838 | static NPError |
3053 | 1565 | g_NPN_DestroyStream(NPP instance, NPStream *stream, NPError reason) | 1839 | g_NPN_DestroyStream(NPP instance, NPStream *stream, NPError reason) |
3054 | 1566 | { | 1840 | { |
3057 | 1567 | if (!pid_check()) { | 1841 | if (!thread_check()) { |
3058 | 1568 | npw_printf("WARNING: NPN_DestroyStream called from the wrong process\n"); | 1842 | npw_printf("WARNING: NPN_DestroyStream not called from the main thread\n"); |
3059 | 1569 | return NPERR_INVALID_INSTANCE_ERROR; | 1843 | return NPERR_INVALID_INSTANCE_ERROR; |
3060 | 1570 | } | 1844 | } |
3061 | 1571 | 1845 | ||
3062 | @@ -1634,8 +1908,8 @@ | |||
3063 | 1634 | static int32 | 1908 | static int32 |
3064 | 1635 | g_NPN_Write(NPP instance, NPStream *stream, int32 len, void *buf) | 1909 | g_NPN_Write(NPP instance, NPStream *stream, int32 len, void *buf) |
3065 | 1636 | { | 1910 | { |
3068 | 1637 | if (!pid_check()) { | 1911 | if (!thread_check()) { |
3069 | 1638 | npw_printf("WARNING: NPN_Write called from the wrong process\n"); | 1912 | npw_printf("WARNING: NPN_Write not called from the main thread\n"); |
3070 | 1639 | return -1; | 1913 | return -1; |
3071 | 1640 | } | 1914 | } |
3072 | 1641 | 1915 | ||
3073 | @@ -1683,8 +1957,8 @@ | |||
3074 | 1683 | static void | 1957 | static void |
3075 | 1684 | g_NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) | 1958 | g_NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) |
3076 | 1685 | { | 1959 | { |
3079 | 1686 | if (!pid_check()) { | 1960 | if (!thread_check()) { |
3080 | 1687 | npw_printf("WARNING: NPN_PushPopupsEnabledState called from the wrong process\n"); | 1961 | npw_printf("WARNING: NPN_PushPopupsEnabledState not called from the main thread\n"); |
3081 | 1688 | return; | 1962 | return; |
3082 | 1689 | } | 1963 | } |
3083 | 1690 | 1964 | ||
3084 | @@ -1727,8 +2001,8 @@ | |||
3085 | 1727 | static void | 2001 | static void |
3086 | 1728 | g_NPN_PopPopupsEnabledState(NPP instance) | 2002 | g_NPN_PopPopupsEnabledState(NPP instance) |
3087 | 1729 | { | 2003 | { |
3090 | 1730 | if (!pid_check()) { | 2004 | if (!thread_check()) { |
3091 | 1731 | npw_printf("WARNING: NPN_PophPopupsEnabledState called from the wrong process\n"); | 2005 | npw_printf("WARNING: NPN_PophPopupsEnabledState not called from the main thread\n"); |
3092 | 1732 | return; | 2006 | return; |
3093 | 1733 | } | 2007 | } |
3094 | 1734 | 2008 | ||
3095 | @@ -1783,8 +2057,8 @@ | |||
3096 | 1783 | static NPObject * | 2057 | static NPObject * |
3097 | 1784 | g_NPN_CreateObject(NPP instance, NPClass *class) | 2058 | g_NPN_CreateObject(NPP instance, NPClass *class) |
3098 | 1785 | { | 2059 | { |
3101 | 1786 | if (!pid_check()) { | 2060 | if (!thread_check()) { |
3102 | 1787 | npw_printf("WARNING: NPN_CreateObject called from the wrong process\n"); | 2061 | npw_printf("WARNING: NPN_CreateObject not called from the main thread\n"); |
3103 | 1788 | return NULL; | 2062 | return NULL; |
3104 | 1789 | } | 2063 | } |
3105 | 1790 | 2064 | ||
3106 | @@ -1839,8 +2113,8 @@ | |||
3107 | 1839 | static NPObject * | 2113 | static NPObject * |
3108 | 1840 | g_NPN_RetainObject(NPObject *npobj) | 2114 | g_NPN_RetainObject(NPObject *npobj) |
3109 | 1841 | { | 2115 | { |
3112 | 1842 | if (!pid_check()) { | 2116 | if (!thread_check()) { |
3113 | 1843 | npw_printf("WARNING: NPN_RetainObject called from the wrong process\n"); | 2117 | npw_printf("WARNING: NPN_RetainObject not called from the main thread\n"); |
3114 | 1844 | return NULL; | 2118 | return NULL; |
3115 | 1845 | } | 2119 | } |
3116 | 1846 | 2120 | ||
3117 | @@ -1902,8 +2176,8 @@ | |||
3118 | 1902 | static void | 2176 | static void |
3119 | 1903 | g_NPN_ReleaseObject(NPObject *npobj) | 2177 | g_NPN_ReleaseObject(NPObject *npobj) |
3120 | 1904 | { | 2178 | { |
3123 | 1905 | if (!pid_check()) { | 2179 | if (!thread_check()) { |
3124 | 1906 | npw_printf("WARNING: NPN_ReleaseObject called from the wrong process\n"); | 2180 | npw_printf("WARNING: NPN_ReleaseObject not called from the main thread\n"); |
3125 | 1907 | return; | 2181 | return; |
3126 | 1908 | } | 2182 | } |
3127 | 1909 | 2183 | ||
3128 | @@ -1958,8 +2232,8 @@ | |||
3129 | 1958 | g_NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, | 2232 | g_NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, |
3130 | 1959 | const NPVariant *args, uint32_t argCount, NPVariant *result) | 2233 | const NPVariant *args, uint32_t argCount, NPVariant *result) |
3131 | 1960 | { | 2234 | { |
3134 | 1961 | if (!pid_check()) { | 2235 | if (!thread_check()) { |
3135 | 1962 | npw_printf("WARNING: NPN_Invoke called from the wrong process\n"); | 2236 | npw_printf("WARNING: NPN_Invoke not called from the main thread\n"); |
3136 | 1963 | return false; | 2237 | return false; |
3137 | 1964 | } | 2238 | } |
3138 | 1965 | 2239 | ||
3139 | @@ -2021,8 +2295,8 @@ | |||
3140 | 2021 | g_NPN_InvokeDefault(NPP instance, NPObject *npobj, | 2295 | g_NPN_InvokeDefault(NPP instance, NPObject *npobj, |
3141 | 2022 | const NPVariant *args, uint32_t argCount, NPVariant *result) | 2296 | const NPVariant *args, uint32_t argCount, NPVariant *result) |
3142 | 2023 | { | 2297 | { |
3145 | 2024 | if (!pid_check()) { | 2298 | if (!thread_check()) { |
3146 | 2025 | npw_printf("WARNING: NPN_InvokeDefault called from the wrong process\n"); | 2299 | npw_printf("WARNING: NPN_InvokeDefault not called from the main thread\n"); |
3147 | 2026 | return false; | 2300 | return false; |
3148 | 2027 | } | 2301 | } |
3149 | 2028 | 2302 | ||
3150 | @@ -2082,8 +2356,8 @@ | |||
3151 | 2082 | static bool | 2356 | static bool |
3152 | 2083 | g_NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result) | 2357 | g_NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result) |
3153 | 2084 | { | 2358 | { |
3156 | 2085 | if (!pid_check()) { | 2359 | if (!thread_check()) { |
3157 | 2086 | npw_printf("WARNING: NPN_Evaluate called from the wrong process\n"); | 2360 | npw_printf("WARNING: NPN_Evaluate not called from the main thread\n"); |
3158 | 2087 | return false; | 2361 | return false; |
3159 | 2088 | } | 2362 | } |
3160 | 2089 | 2363 | ||
3161 | @@ -2147,8 +2421,8 @@ | |||
3162 | 2147 | g_NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, | 2421 | g_NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, |
3163 | 2148 | NPVariant *result) | 2422 | NPVariant *result) |
3164 | 2149 | { | 2423 | { |
3167 | 2150 | if (!pid_check()) { | 2424 | if (!thread_check()) { |
3168 | 2151 | npw_printf("WARNING: NPN_GetProperty called from the wrong process\n"); | 2425 | npw_printf("WARNING: NPN_GetProperty not called from the main thread\n"); |
3169 | 2152 | return false; | 2426 | return false; |
3170 | 2153 | } | 2427 | } |
3171 | 2154 | 2428 | ||
3172 | @@ -2209,8 +2483,8 @@ | |||
3173 | 2209 | g_NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, | 2483 | g_NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, |
3174 | 2210 | const NPVariant *value) | 2484 | const NPVariant *value) |
3175 | 2211 | { | 2485 | { |
3178 | 2212 | if (!pid_check()) { | 2486 | if (!thread_check()) { |
3179 | 2213 | npw_printf("WARNING: NPN_SetProperty called from the wrong process\n"); | 2487 | npw_printf("WARNING: NPN_SetProperty not called from the main thread\n"); |
3180 | 2214 | return false; | 2488 | return false; |
3181 | 2215 | } | 2489 | } |
3182 | 2216 | 2490 | ||
3183 | @@ -2266,8 +2540,8 @@ | |||
3184 | 2266 | static bool | 2540 | static bool |
3185 | 2267 | g_NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName) | 2541 | g_NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName) |
3186 | 2268 | { | 2542 | { |
3189 | 2269 | if (!pid_check()) { | 2543 | if (!thread_check()) { |
3190 | 2270 | npw_printf("WARNING: NPN_RemoveProperty called from the wrong process\n"); | 2544 | npw_printf("WARNING: NPN_RemoveProperty not called from the main thread\n"); |
3191 | 2271 | return false; | 2545 | return false; |
3192 | 2272 | } | 2546 | } |
3193 | 2273 | 2547 | ||
3194 | @@ -2323,8 +2597,8 @@ | |||
3195 | 2323 | static bool | 2597 | static bool |
3196 | 2324 | g_NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName) | 2598 | g_NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName) |
3197 | 2325 | { | 2599 | { |
3200 | 2326 | if (!pid_check()) { | 2600 | if (!thread_check()) { |
3201 | 2327 | npw_printf("WARNING: NPN_HasProperty called from the wrong process\n"); | 2601 | npw_printf("WARNING: NPN_HasProperty not called from the main thread\n"); |
3202 | 2328 | return false; | 2602 | return false; |
3203 | 2329 | } | 2603 | } |
3204 | 2330 | 2604 | ||
3205 | @@ -2380,8 +2654,8 @@ | |||
3206 | 2380 | static bool | 2654 | static bool |
3207 | 2381 | g_NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName) | 2655 | g_NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName) |
3208 | 2382 | { | 2656 | { |
3211 | 2383 | if (!pid_check()) { | 2657 | if (!thread_check()) { |
3212 | 2384 | npw_printf("WARNING: NPN_HasMethod called from the wrong process\n"); | 2658 | npw_printf("WARNING: NPN_HasMethod not called from the main thread\n"); |
3213 | 2385 | return false; | 2659 | return false; |
3214 | 2386 | } | 2660 | } |
3215 | 2387 | 2661 | ||
3216 | @@ -2431,8 +2705,8 @@ | |||
3217 | 2431 | static void | 2705 | static void |
3218 | 2432 | g_NPN_SetException(NPObject *npobj, const NPUTF8 *message) | 2706 | g_NPN_SetException(NPObject *npobj, const NPUTF8 *message) |
3219 | 2433 | { | 2707 | { |
3222 | 2434 | if (!pid_check()) { | 2708 | if (!thread_check()) { |
3223 | 2435 | npw_printf("WARNING: NPN_SetException called from the wrong process\n"); | 2709 | npw_printf("WARNING: NPN_SetException not called from the main thread\n"); |
3224 | 2436 | return; | 2710 | return; |
3225 | 2437 | } | 2711 | } |
3226 | 2438 | 2712 | ||
3227 | @@ -2480,10 +2754,26 @@ | |||
3228 | 2480 | } | 2754 | } |
3229 | 2481 | 2755 | ||
3230 | 2482 | static NPIdentifier | 2756 | static NPIdentifier |
3231 | 2757 | cached_NPN_GetStringIdentifier(const NPUTF8 *name) | ||
3232 | 2758 | { | ||
3233 | 2759 | NPIdentifier ident; | ||
3234 | 2760 | if (!use_npidentifier_cache()) | ||
3235 | 2761 | ident = invoke_NPN_GetStringIdentifier(name); | ||
3236 | 2762 | #if USE_NPIDENTIFIER_CACHE | ||
3237 | 2763 | else if (!npidentifier_cache_has_string(name, &ident)) { | ||
3238 | 2764 | ident = invoke_NPN_GetStringIdentifier(name); | ||
3239 | 2765 | npidentifier_cache_reserve(1); | ||
3240 | 2766 | npidentifier_cache_add_string(ident, name); | ||
3241 | 2767 | } | ||
3242 | 2768 | #endif | ||
3243 | 2769 | return ident; | ||
3244 | 2770 | } | ||
3245 | 2771 | |||
3246 | 2772 | static NPIdentifier | ||
3247 | 2483 | g_NPN_GetStringIdentifier(const NPUTF8 *name) | 2773 | g_NPN_GetStringIdentifier(const NPUTF8 *name) |
3248 | 2484 | { | 2774 | { |
3251 | 2485 | if (!pid_check()) { | 2775 | if (!thread_check()) { |
3252 | 2486 | npw_printf("WARNING: NPN_GetStringIdentifier called from the wrong process\n"); | 2776 | npw_printf("WARNING: NPN_GetStringIdentifier not called from the main thread\n"); |
3253 | 2487 | return NULL; | 2777 | return NULL; |
3254 | 2488 | } | 2778 | } |
3255 | 2489 | 2779 | ||
3256 | @@ -2491,7 +2781,7 @@ | |||
3257 | 2491 | return NULL; | 2781 | return NULL; |
3258 | 2492 | 2782 | ||
3259 | 2493 | D(bugiI("NPN_GetStringIdentifier name='%s'\n", name)); | 2783 | D(bugiI("NPN_GetStringIdentifier name='%s'\n", name)); |
3261 | 2494 | NPIdentifier ret = invoke_NPN_GetStringIdentifier(name); | 2784 | NPIdentifier ret = cached_NPN_GetStringIdentifier(name); |
3262 | 2495 | D(bugiD("NPN_GetStringIdentifier return: %p\n", ret)); | 2785 | D(bugiD("NPN_GetStringIdentifier return: %p\n", ret)); |
3263 | 2496 | return ret; | 2786 | return ret; |
3264 | 2497 | } | 2787 | } |
3265 | @@ -2536,10 +2826,29 @@ | |||
3266 | 2536 | } | 2826 | } |
3267 | 2537 | 2827 | ||
3268 | 2538 | static void | 2828 | static void |
3269 | 2829 | cached_NPN_GetStringIdentifiers(const NPUTF8 **names, uint32_t nameCount, NPIdentifier *identifiers) | ||
3270 | 2830 | { | ||
3271 | 2831 | /* XXX: could be optimized further */ | ||
3272 | 2832 | invoke_NPN_GetStringIdentifiers(names, nameCount, identifiers); | ||
3273 | 2833 | |||
3274 | 2834 | #if USE_NPIDENTIFIER_CACHE | ||
3275 | 2835 | if (use_npidentifier_cache()) { | ||
3276 | 2836 | for (int i = 0; i < nameCount; i++) { | ||
3277 | 2837 | NPIdentifier ident = identifiers[i]; | ||
3278 | 2838 | if (npidentifier_cache_lookup(ident) == NULL) { | ||
3279 | 2839 | npidentifier_cache_reserve(1); | ||
3280 | 2840 | npidentifier_cache_add_string(ident, names[i]); | ||
3281 | 2841 | } | ||
3282 | 2842 | } | ||
3283 | 2843 | } | ||
3284 | 2844 | #endif | ||
3285 | 2845 | } | ||
3286 | 2846 | |||
3287 | 2847 | static void | ||
3288 | 2539 | g_NPN_GetStringIdentifiers(const NPUTF8 **names, uint32_t nameCount, NPIdentifier *identifiers) | 2848 | g_NPN_GetStringIdentifiers(const NPUTF8 **names, uint32_t nameCount, NPIdentifier *identifiers) |
3289 | 2540 | { | 2849 | { |
3292 | 2541 | if (!pid_check()) { | 2850 | if (!thread_check()) { |
3293 | 2542 | npw_printf("WARNING: NPN_GetStringIdentifiers called from the wrong process\n"); | 2851 | npw_printf("WARNING: NPN_GetStringIdentifiers not called from the main thread\n"); |
3294 | 2543 | return; | 2852 | return; |
3295 | 2544 | } | 2853 | } |
3296 | 2545 | 2854 | ||
3297 | @@ -2550,7 +2859,7 @@ | |||
3298 | 2550 | return; | 2859 | return; |
3299 | 2551 | 2860 | ||
3300 | 2552 | D(bugiI("NPN_GetStringIdentifiers names=%p\n", names)); | 2861 | D(bugiI("NPN_GetStringIdentifiers names=%p\n", names)); |
3302 | 2553 | invoke_NPN_GetStringIdentifiers(names, nameCount, identifiers); | 2862 | cached_NPN_GetStringIdentifiers(names, nameCount, identifiers); |
3303 | 2554 | D(bugiD("NPN_GetStringIdentifiers done\n")); | 2863 | D(bugiD("NPN_GetStringIdentifiers done\n")); |
3304 | 2555 | } | 2864 | } |
3305 | 2556 | 2865 | ||
3306 | @@ -2584,15 +2893,31 @@ | |||
3307 | 2584 | } | 2893 | } |
3308 | 2585 | 2894 | ||
3309 | 2586 | static NPIdentifier | 2895 | static NPIdentifier |
3310 | 2896 | cached_NPN_GetIntIdentifier(int32_t intid) | ||
3311 | 2897 | { | ||
3312 | 2898 | NPIdentifier ident; | ||
3313 | 2899 | if (!use_npidentifier_cache()) | ||
3314 | 2900 | ident = invoke_NPN_GetIntIdentifier(intid); | ||
3315 | 2901 | #if USE_NPIDENTIFIER_CACHE | ||
3316 | 2902 | else if (!npidentifier_cache_has_int(intid, &ident)) { | ||
3317 | 2903 | ident = invoke_NPN_GetIntIdentifier(intid); | ||
3318 | 2904 | npidentifier_cache_reserve(1); | ||
3319 | 2905 | npidentifier_cache_add_int(ident, intid); | ||
3320 | 2906 | } | ||
3321 | 2907 | #endif | ||
3322 | 2908 | return ident; | ||
3323 | 2909 | } | ||
3324 | 2910 | |||
3325 | 2911 | static NPIdentifier | ||
3326 | 2587 | g_NPN_GetIntIdentifier(int32_t intid) | 2912 | g_NPN_GetIntIdentifier(int32_t intid) |
3327 | 2588 | { | 2913 | { |
3330 | 2589 | if (!pid_check()) { | 2914 | if (!thread_check()) { |
3331 | 2590 | npw_printf("WARNING: NPN_GetIntIdentifier called from the wrong process\n"); | 2915 | npw_printf("WARNING: NPN_GetIntIdentifier not called from the main thread\n"); |
3332 | 2591 | return NULL; | 2916 | return NULL; |
3333 | 2592 | } | 2917 | } |
3334 | 2593 | 2918 | ||
3335 | 2594 | D(bugiI("NPN_GetIntIdentifier intid=%d\n", intid)); | 2919 | D(bugiI("NPN_GetIntIdentifier intid=%d\n", intid)); |
3337 | 2595 | NPIdentifier ret = invoke_NPN_GetIntIdentifier(intid); | 2920 | NPIdentifier ret = cached_NPN_GetIntIdentifier(intid); |
3338 | 2596 | D(bugiD("NPN_GetIntIdentifier return: %p\n", ret)); | 2921 | D(bugiD("NPN_GetIntIdentifier return: %p\n", ret)); |
3339 | 2597 | return ret; | 2922 | return ret; |
3340 | 2598 | } | 2923 | } |
3341 | @@ -2627,10 +2952,25 @@ | |||
3342 | 2627 | } | 2952 | } |
3343 | 2628 | 2953 | ||
3344 | 2629 | static bool | 2954 | static bool |
3345 | 2955 | cached_NPN_IdentifierIsString(NPIdentifier ident) | ||
3346 | 2956 | { | ||
3347 | 2957 | #if USE_NPIDENTIFIER_CACHE | ||
3348 | 2958 | if (use_npidentifier_cache()) { | ||
3349 | 2959 | NPIdentifierInfo *npi = npidentifier_cache_lookup(ident); | ||
3350 | 2960 | if (npi) | ||
3351 | 2961 | return npi->string_len > 0; | ||
3352 | 2962 | } | ||
3353 | 2963 | #endif | ||
3354 | 2964 | /* cache update is postponed to actual NPN_UTF8FromIdentifier() or | ||
3355 | 2965 | NPN_IntFromIdentifier() */ | ||
3356 | 2966 | return invoke_NPN_IdentifierIsString(ident); | ||
3357 | 2967 | } | ||
3358 | 2968 | |||
3359 | 2969 | static bool | ||
3360 | 2630 | g_NPN_IdentifierIsString(NPIdentifier identifier) | 2970 | g_NPN_IdentifierIsString(NPIdentifier identifier) |
3361 | 2631 | { | 2971 | { |
3364 | 2632 | if (!pid_check()) { | 2972 | if (!thread_check()) { |
3365 | 2633 | npw_printf("WARNING: NPN_IdentifierIsString called from the wrong process\n"); | 2973 | npw_printf("WARNING: NPN_IdentifierIsString not called from the main thread\n"); |
3366 | 2634 | return false; | 2974 | return false; |
3367 | 2635 | } | 2975 | } |
3368 | 2636 | 2976 | ||
3369 | @@ -2670,15 +3010,34 @@ | |||
3370 | 2670 | } | 3010 | } |
3371 | 2671 | 3011 | ||
3372 | 2672 | static NPUTF8 * | 3012 | static NPUTF8 * |
3373 | 3013 | cached_NPN_UTF8FromIdentifier(NPIdentifier identifier) | ||
3374 | 3014 | { | ||
3375 | 3015 | NPUTF8 *str; | ||
3376 | 3016 | if (!use_npidentifier_cache()) | ||
3377 | 3017 | str = invoke_NPN_UTF8FromIdentifier(identifier); | ||
3378 | 3018 | else { | ||
3379 | 3019 | #if USE_NPIDENTIFIER_CACHE | ||
3380 | 3020 | str = npidentifier_cache_get_string_copy(identifier); | ||
3381 | 3021 | if (str == NULL) { | ||
3382 | 3022 | str = invoke_NPN_UTF8FromIdentifier(identifier); | ||
3383 | 3023 | npidentifier_cache_reserve(1); | ||
3384 | 3024 | npidentifier_cache_add_string(identifier, str); | ||
3385 | 3025 | } | ||
3386 | 3026 | #endif | ||
3387 | 3027 | } | ||
3388 | 3028 | return str; | ||
3389 | 3029 | } | ||
3390 | 3030 | |||
3391 | 3031 | static NPUTF8 * | ||
3392 | 2673 | g_NPN_UTF8FromIdentifier(NPIdentifier identifier) | 3032 | g_NPN_UTF8FromIdentifier(NPIdentifier identifier) |
3393 | 2674 | { | 3033 | { |
3396 | 2675 | if (!pid_check()) { | 3034 | if (!thread_check()) { |
3397 | 2676 | npw_printf("WARNING: NPN_UTF8FromIdentifier called from the wrong process\n"); | 3035 | npw_printf("WARNING: NPN_UTF8FromIdentifier not called from the main thread\n"); |
3398 | 2677 | return NULL; | 3036 | return NULL; |
3399 | 2678 | } | 3037 | } |
3400 | 2679 | 3038 | ||
3401 | 2680 | D(bugiI("NPN_UTF8FromIdentifier identifier=%p\n", identifier)); | 3039 | D(bugiI("NPN_UTF8FromIdentifier identifier=%p\n", identifier)); |
3403 | 2681 | NPUTF8 *ret = invoke_NPN_UTF8FromIdentifier(identifier); | 3040 | NPUTF8 *ret = cached_NPN_UTF8FromIdentifier(identifier); |
3404 | 2682 | D(bugiD("NPN_UTF8FromIdentifier return: '%s'\n", ret)); | 3041 | D(bugiD("NPN_UTF8FromIdentifier return: '%s'\n", ret)); |
3405 | 2683 | return ret; | 3042 | return ret; |
3406 | 2684 | } | 3043 | } |
3407 | @@ -2714,15 +3073,38 @@ | |||
3408 | 2714 | } | 3073 | } |
3409 | 2715 | 3074 | ||
3410 | 2716 | static int32_t | 3075 | static int32_t |
3411 | 3076 | cached_NPN_IntFromIdentifier(NPIdentifier identifier) | ||
3412 | 3077 | { | ||
3413 | 3078 | int32_t value; | ||
3414 | 3079 | if (!use_npidentifier_cache()) | ||
3415 | 3080 | value = invoke_NPN_IntFromIdentifier(identifier); | ||
3416 | 3081 | else { | ||
3417 | 3082 | #if USE_NPIDENTIFIER_CACHE | ||
3418 | 3083 | NPIdentifierInfo *npi = npidentifier_cache_lookup(identifier); | ||
3419 | 3084 | if (npi) { | ||
3420 | 3085 | assert(npi->string_len == 0); | ||
3421 | 3086 | value = npi->u.value; | ||
3422 | 3087 | } | ||
3423 | 3088 | else { | ||
3424 | 3089 | value = invoke_NPN_IntFromIdentifier(identifier); | ||
3425 | 3090 | npidentifier_cache_reserve(1); | ||
3426 | 3091 | npidentifier_cache_add_int(identifier, value); | ||
3427 | 3092 | } | ||
3428 | 3093 | #endif | ||
3429 | 3094 | } | ||
3430 | 3095 | return value; | ||
3431 | 3096 | } | ||
3432 | 3097 | |||
3433 | 3098 | static int32_t | ||
3434 | 2717 | g_NPN_IntFromIdentifier(NPIdentifier identifier) | 3099 | g_NPN_IntFromIdentifier(NPIdentifier identifier) |
3435 | 2718 | { | 3100 | { |
3438 | 2719 | if (!pid_check()) { | 3101 | if (!thread_check()) { |
3439 | 2720 | npw_printf("WARNING: NPN_IntFromIdentifier called from the wrong process\n"); | 3102 | npw_printf("WARNING: NPN_IntFromIdentifier not called from the main thread\n"); |
3440 | 2721 | return 0; | 3103 | return 0; |
3441 | 2722 | } | 3104 | } |
3442 | 2723 | 3105 | ||
3443 | 2724 | D(bugiI("NPN_IntFromIdentifier identifier=%p\n", identifier)); | 3106 | D(bugiI("NPN_IntFromIdentifier identifier=%p\n", identifier)); |
3445 | 2725 | int32_t ret = invoke_NPN_IntFromIdentifier(identifier); | 3107 | int32_t ret = cached_NPN_IntFromIdentifier(identifier); |
3446 | 2726 | D(bugiD("NPN_IntFromIdentifier return: %d\n", ret)); | 3108 | D(bugiD("NPN_IntFromIdentifier return: %d\n", ret)); |
3447 | 2727 | return ret; | 3109 | return ret; |
3448 | 2728 | } | 3110 | } |
3449 | @@ -3006,6 +3388,13 @@ | |||
3450 | 3006 | plugin->use_xembed = supports_XEmbed && needs_XEmbed; | 3388 | plugin->use_xembed = supports_XEmbed && needs_XEmbed; |
3451 | 3007 | } | 3389 | } |
3452 | 3008 | } | 3390 | } |
3453 | 3391 | |||
3454 | 3392 | // assume Gtk plugin (no Xt event loop) if XEMBED is used | ||
3455 | 3393 | if (!plugin->use_xembed) { | ||
3456 | 3394 | if (xt_source_create() < 0) | ||
3457 | 3395 | return NPERR_GENERIC_ERROR; | ||
3458 | 3396 | } | ||
3459 | 3397 | |||
3460 | 3009 | return ret; | 3398 | return ret; |
3461 | 3010 | } | 3399 | } |
3462 | 3011 | 3400 | ||
3463 | @@ -3075,6 +3464,9 @@ | |||
3464 | 3075 | NPError ret = plugin_funcs.destroy(instance, sdata); | 3464 | NPError ret = plugin_funcs.destroy(instance, sdata); |
3465 | 3076 | D(bugiD("NPP_Destroy return: %d [%s]\n", ret, string_of_NPError(ret))); | 3465 | D(bugiD("NPP_Destroy return: %d [%s]\n", ret, string_of_NPError(ret))); |
3466 | 3077 | 3466 | ||
3467 | 3467 | if (!plugin->use_xembed) | ||
3468 | 3468 | xt_source_destroy(); | ||
3469 | 3469 | |||
3470 | 3078 | npw_plugin_instance_invalidate(plugin); | 3470 | npw_plugin_instance_invalidate(plugin); |
3471 | 3079 | npw_plugin_instance_unref(plugin); | 3471 | npw_plugin_instance_unref(plugin); |
3472 | 3080 | return ret; | 3472 | return ret; |
3473 | @@ -3723,19 +4115,205 @@ | |||
3474 | 3723 | typedef void (*GSourceFinalizeFunc)(GSource *); | 4115 | typedef void (*GSourceFinalizeFunc)(GSource *); |
3475 | 3724 | 4116 | ||
3476 | 3725 | // Xt events | 4117 | // Xt events |
3477 | 4118 | static GSource *xt_source = NULL; | ||
3478 | 4119 | static int xt_source_count = 0; | ||
3479 | 3726 | static GPollFD xt_event_poll_fd; | 4120 | static GPollFD xt_event_poll_fd; |
3480 | 4121 | static const int XT_DEFAULT_TIMEOUT = 25; | ||
3481 | 4122 | static const int XT_MAX_DISPATCH_EVENTS = 10; | ||
3482 | 4123 | |||
3483 | 4124 | static void xt_dummy_timeout_cb(XtPointer closure, XtIntervalId *id) | ||
3484 | 4125 | { | ||
3485 | 4126 | /* dummy function, never called */ | ||
3486 | 4127 | npw_printf("ERROR: xt_dummy_timeout_cb() should never be called\n"); | ||
3487 | 4128 | } | ||
3488 | 4129 | |||
3489 | 4130 | static int xt_has_compatible_appcontext_timerQueue(void) | ||
3490 | 4131 | { | ||
3491 | 4132 | int is_compatible; | ||
3492 | 4133 | XtIntervalId id; | ||
3493 | 4134 | TimerEventRec *tq, *tq_probe; | ||
3494 | 4135 | |||
3495 | 4136 | /* Try to determine where is the pointer to the next allocated | ||
3496 | 4137 | TimerEventRec. | ||
3497 | 4138 | |||
3498 | 4139 | Besides, XtAppAddTimeOut() shall not have been called already | ||
3499 | 4140 | because we want to be sure any (libXt internal) "free" | ||
3500 | 4141 | TimerEventRec pointer cache is empty. */ | ||
3501 | 4142 | tq = XtNew(TimerEventRec); | ||
3502 | 4143 | XtFree((char *)tq); | ||
3503 | 4144 | tq_probe = XtNew(TimerEventRec); | ||
3504 | 4145 | XtFree((char *)tq_probe); | ||
3505 | 4146 | if (tq != tq_probe) | ||
3506 | 4147 | return 0; | ||
3507 | 4148 | |||
3508 | 4149 | id = XtAppAddTimeOut(x_app_context, 0, | ||
3509 | 4150 | xt_dummy_timeout_cb, | ||
3510 | 4151 | GUINT_TO_POINTER(0xdeadbeef)); | ||
3511 | 4152 | |||
3512 | 4153 | tq = x_app_context->timerQueue; | ||
3513 | 4154 | is_compatible = tq == tq_probe | ||
3514 | 4155 | && tq->app == x_app_context | ||
3515 | 4156 | && tq->te_proc == xt_dummy_timeout_cb | ||
3516 | 4157 | && tq->te_closure == GUINT_TO_POINTER(0xdeadbeef) | ||
3517 | 4158 | ; | ||
3518 | 4159 | |||
3519 | 4160 | XtRemoveTimeOut(id); | ||
3520 | 4161 | return is_compatible; | ||
3521 | 4162 | } | ||
3522 | 4163 | |||
3523 | 4164 | static void xt_dummy_input_cb(XtPointer closure, int *source, XtInputId *id) | ||
3524 | 4165 | { | ||
3525 | 4166 | /* dummy function, never called */ | ||
3526 | 4167 | npw_printf("ERROR: xt_dummy_input_cb() should never be called\n"); | ||
3527 | 4168 | } | ||
3528 | 4169 | |||
3529 | 4170 | static inline int get_appcontext_input_count_at(int offset) | ||
3530 | 4171 | { | ||
3531 | 4172 | return *((short *)((char *)x_app_context + offset)); | ||
3532 | 4173 | } | ||
3533 | 4174 | |||
3534 | 4175 | static inline int add_appcontext_input(int fd, int n) | ||
3535 | 4176 | { | ||
3536 | 4177 | return XtAppAddInput(x_app_context, | ||
3537 | 4178 | fd, | ||
3538 | 4179 | GUINT_TO_POINTER(XtInputWriteMask), | ||
3539 | 4180 | xt_dummy_input_cb, | ||
3540 | 4181 | GUINT_TO_POINTER(0xdead0000)); | ||
3541 | 4182 | } | ||
3542 | 4183 | |||
3543 | 4184 | static int get_appcontext_input_count_offset(void) | ||
3544 | 4185 | { | ||
3545 | 4186 | #define low_offset offsetof(struct _XtAppStruct, __maxed__nfds) | ||
3546 | 4187 | #define high_offset offsetof(struct _XtAppStruct, __maybe__input_max) | ||
3547 | 4188 | #define n_offsets_max (high_offset - low_offset)/2 | ||
3548 | 4189 | int i, ofs, n_offsets = 0; | ||
3549 | 4190 | int offsets[n_offsets_max] = { 0, }; | ||
3550 | 4191 | |||
3551 | 4192 | #define n_inputs_max 4 /* number of refinements/input sources */ | ||
3552 | 4193 | int fd, id, n_inputs = 0; | ||
3553 | 4194 | struct { int fd, id; } inputs[n_inputs_max] = { 0, }; | ||
3554 | 4195 | |||
3555 | 4196 | if ((fd = open("/dev/null", O_WRONLY)) < 0) | ||
3556 | 4197 | return 0; | ||
3557 | 4198 | if ((id = add_appcontext_input(fd, 0)) < 0) { | ||
3558 | 4199 | close(fd); | ||
3559 | 4200 | return 0; | ||
3560 | 4201 | } | ||
3561 | 4202 | inputs[n_inputs].fd = fd; | ||
3562 | 4203 | inputs[n_inputs].id = id; | ||
3563 | 4204 | n_inputs++; | ||
3564 | 4205 | |||
3565 | 4206 | for (ofs = low_offset; ofs < high_offset; ofs += 2) { | ||
3566 | 4207 | if (get_appcontext_input_count_at(ofs) == 1) | ||
3567 | 4208 | offsets[n_offsets++] = ofs; | ||
3568 | 4209 | } | ||
3569 | 4210 | |||
3570 | 4211 | while (n_inputs < n_inputs_max) { | ||
3571 | 4212 | if ((fd = open("/dev/null", O_WRONLY)) < 0) | ||
3572 | 4213 | break; | ||
3573 | 4214 | if ((id = add_appcontext_input(fd, n_inputs)) < 0) { | ||
3574 | 4215 | close(fd); | ||
3575 | 4216 | break; | ||
3576 | 4217 | } | ||
3577 | 4218 | inputs[n_inputs].fd = fd; | ||
3578 | 4219 | inputs[n_inputs].id = id; | ||
3579 | 4220 | n_inputs++; | ||
3580 | 4221 | |||
3581 | 4222 | int n = 0; | ||
3582 | 4223 | for (i = 0; i < n_offsets; i++) { | ||
3583 | 4224 | if (get_appcontext_input_count_at(offsets[i]) == n_inputs) | ||
3584 | 4225 | offsets[n++] = offsets[i]; | ||
3585 | 4226 | } | ||
3586 | 4227 | for (i = n; i < n_offsets; i++) | ||
3587 | 4228 | offsets[i] = 0; | ||
3588 | 4229 | n_offsets = n; | ||
3589 | 4230 | } | ||
3590 | 4231 | |||
3591 | 4232 | for (i = 0; i < n_inputs; i++) { | ||
3592 | 4233 | XtRemoveInput(inputs[i].id); | ||
3593 | 4234 | close(inputs[i].fd); | ||
3594 | 4235 | } | ||
3595 | 4236 | |||
3596 | 4237 | if (n_offsets == 1) | ||
3597 | 4238 | return offsets[0]; | ||
3598 | 4239 | |||
3599 | 4240 | #undef n_fds_max | ||
3600 | 4241 | #undef n_offsets_max | ||
3601 | 4242 | #undef high_offset | ||
3602 | 4243 | #undef low_offset | ||
3603 | 4244 | return 0; | ||
3604 | 4245 | } | ||
3605 | 4246 | |||
3606 | 4247 | static int get_appcontext_input_count(void) | ||
3607 | 4248 | { | ||
3608 | 4249 | static int input_count_offset = -1; | ||
3609 | 4250 | if (input_count_offset < 0) | ||
3610 | 4251 | input_count_offset = get_appcontext_input_count_offset(); | ||
3611 | 4252 | if (input_count_offset == 0) | ||
3612 | 4253 | return 1; /* fake we have input to trigger timeout */ | ||
3613 | 4254 | return get_appcontext_input_count_at(input_count_offset); | ||
3614 | 4255 | } | ||
3615 | 4256 | |||
3616 | 4257 | static int xt_has_compatible_appcontext(void) | ||
3617 | 4258 | { | ||
3618 | 4259 | return xt_has_compatible_appcontext_timerQueue(); | ||
3619 | 4260 | } | ||
3620 | 4261 | |||
3621 | 4262 | static int xt_get_next_timeout(GSource *source) | ||
3622 | 4263 | { | ||
3623 | 4264 | static int has_compatible_appcontext = -1; | ||
3624 | 4265 | if (has_compatible_appcontext < 0) { | ||
3625 | 4266 | if ((has_compatible_appcontext = xt_has_compatible_appcontext()) == 0) | ||
3626 | 4267 | npw_printf("WARNING: xt_get_next_timeout() is not optimizable\n"); | ||
3627 | 4268 | } | ||
3628 | 4269 | int timeout = XT_DEFAULT_TIMEOUT; | ||
3629 | 4270 | if (has_compatible_appcontext) { | ||
3630 | 4271 | int input_timeout, timer_timeout; | ||
3631 | 4272 | /* Check there is any input source to process */ | ||
3632 | 4273 | if (get_appcontext_input_count() > 0) | ||
3633 | 4274 | input_timeout = XT_DEFAULT_TIMEOUT; | ||
3634 | 4275 | else | ||
3635 | 4276 | input_timeout = -1; | ||
3636 | 4277 | /* Check there is any timer to process */ | ||
3637 | 4278 | if (x_app_context->timerQueue == NULL) | ||
3638 | 4279 | timer_timeout = -1; | ||
3639 | 4280 | else { | ||
3640 | 4281 | /* Determine delay to next timeout. Zero means timeout already expired */ | ||
3641 | 4282 | struct timeval *next = &x_app_context->timerQueue->te_timer_value; | ||
3642 | 4283 | GTimeVal now; | ||
3643 | 4284 | int64_t diff; | ||
3644 | 4285 | g_source_get_current_time(source, &now); | ||
3645 | 4286 | if ((diff = (int64_t)next->tv_sec - (int64_t)now.tv_sec) < 0) | ||
3646 | 4287 | timer_timeout = 0; | ||
3647 | 4288 | else if ((diff = diff*1000 + ((int64_t)next->tv_usec - (int64_t)now.tv_usec)/1000) <= 0) | ||
3648 | 4289 | timer_timeout = 0; | ||
3649 | 4290 | else | ||
3650 | 4291 | timer_timeout = diff; | ||
3651 | 4292 | } | ||
3652 | 4293 | if (input_timeout < 0) | ||
3653 | 4294 | timeout = timer_timeout; | ||
3654 | 4295 | else if (timer_timeout < 0) | ||
3655 | 4296 | timeout = input_timeout; | ||
3656 | 4297 | else | ||
3657 | 4298 | timeout = MIN(input_timeout, timer_timeout); | ||
3658 | 4299 | } | ||
3659 | 4300 | return timeout; | ||
3660 | 4301 | } | ||
3661 | 3727 | 4302 | ||
3662 | 3728 | static gboolean xt_event_prepare(GSource *source, gint *timeout) | 4303 | static gboolean xt_event_prepare(GSource *source, gint *timeout) |
3663 | 3729 | { | 4304 | { |
3664 | 3730 | int mask = XtAppPending(x_app_context); | 4305 | int mask = XtAppPending(x_app_context); |
3666 | 3731 | return mask & XtIMXEvent; | 4306 | if (mask) |
3667 | 4307 | return TRUE; | ||
3668 | 4308 | /* XXX: create new GPollFD for input sources? */ | ||
3669 | 4309 | return (*timeout = xt_get_next_timeout(source)) == 0; | ||
3670 | 3732 | } | 4310 | } |
3671 | 3733 | 4311 | ||
3672 | 3734 | static gboolean xt_event_check(GSource *source) | 4312 | static gboolean xt_event_check(GSource *source) |
3673 | 3735 | { | 4313 | { |
3674 | 3736 | if (xt_event_poll_fd.revents & G_IO_IN) { | 4314 | if (xt_event_poll_fd.revents & G_IO_IN) { |
3675 | 3737 | int mask = XtAppPending(x_app_context); | 4315 | int mask = XtAppPending(x_app_context); |
3677 | 3738 | if (mask & XtIMXEvent) | 4316 | if (mask) |
3678 | 3739 | return TRUE; | 4317 | return TRUE; |
3679 | 3740 | } | 4318 | } |
3680 | 3741 | return FALSE; | 4319 | return FALSE; |
3681 | @@ -3744,11 +4322,11 @@ | |||
3682 | 3744 | static gboolean xt_event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) | 4322 | static gboolean xt_event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) |
3683 | 3745 | { | 4323 | { |
3684 | 3746 | int i; | 4324 | int i; |
3686 | 3747 | for (i = 0; i < 5; i++) { | 4325 | for (i = 0; i < XT_MAX_DISPATCH_EVENTS; i++) { |
3687 | 3748 | int mask = XtAppPending(x_app_context); | 4326 | int mask = XtAppPending(x_app_context); |
3689 | 3749 | if ((mask & XtIMXEvent) == 0) | 4327 | if (mask == 0) |
3690 | 3750 | break; | 4328 | break; |
3692 | 3751 | XtAppProcessEvent(x_app_context, XtIMXEvent); | 4329 | XtAppProcessEvent(x_app_context, XtIMAll); |
3693 | 3752 | } | 4330 | } |
3694 | 3753 | return TRUE; | 4331 | return TRUE; |
3695 | 3754 | } | 4332 | } |
3696 | @@ -3762,15 +4340,31 @@ | |||
3697 | 3762 | (GSourceDummyMarshal)NULL | 4340 | (GSourceDummyMarshal)NULL |
3698 | 3763 | }; | 4341 | }; |
3699 | 3764 | 4342 | ||
3709 | 3765 | static gboolean xt_event_polling_timer_callback(gpointer user_data) | 4343 | static int xt_source_create(void) |
3710 | 3766 | { | 4344 | { |
3711 | 3767 | int i; | 4345 | if (++xt_source_count > 1 && xt_source != NULL) |
3712 | 3768 | for (i = 0; i < 5; i++) { | 4346 | return 0; |
3713 | 3769 | if ((XtAppPending(x_app_context) & (XtIMAll & ~XtIMXEvent)) == 0) | 4347 | |
3714 | 3770 | break; | 4348 | if ((xt_source = g_source_new(&xt_event_funcs, sizeof(GSource))) == NULL) { |
3715 | 3771 | XtAppProcessEvent(x_app_context, XtIMAll & ~XtIMXEvent); | 4349 | npw_printf("ERROR: failed to initialize Xt events listener\n"); |
3716 | 3772 | } | 4350 | return -1; |
3717 | 3773 | return TRUE; | 4351 | } |
3718 | 4352 | g_source_set_priority(xt_source, GDK_PRIORITY_EVENTS); | ||
3719 | 4353 | g_source_set_can_recurse(xt_source, TRUE); | ||
3720 | 4354 | g_source_attach(xt_source, NULL); | ||
3721 | 4355 | xt_event_poll_fd.fd = ConnectionNumber(x_display); | ||
3722 | 4356 | xt_event_poll_fd.events = G_IO_IN; | ||
3723 | 4357 | xt_event_poll_fd.revents = 0; | ||
3724 | 4358 | g_source_add_poll(xt_source, &xt_event_poll_fd); | ||
3725 | 4359 | return 0; | ||
3726 | 4360 | } | ||
3727 | 4361 | |||
3728 | 4362 | static void xt_source_destroy(void) | ||
3729 | 4363 | { | ||
3730 | 4364 | if (--xt_source_count < 1 && xt_source) { | ||
3731 | 4365 | g_source_destroy(xt_source); | ||
3732 | 4366 | xt_source = NULL; | ||
3733 | 4367 | } | ||
3734 | 3774 | } | 4368 | } |
3735 | 3775 | 4369 | ||
3736 | 3776 | // RPC events | 4370 | // RPC events |
3737 | @@ -3825,10 +4419,11 @@ | |||
3738 | 3825 | return 1; | 4419 | return 1; |
3739 | 3826 | } | 4420 | } |
3740 | 3827 | D(bug(" Plugin connection: %s\n", connection_path)); | 4421 | D(bug(" Plugin connection: %s\n", connection_path)); |
3745 | 3828 | 4422 | D(bug(" Plugin viewer pid: %d\n", getpid())); | |
3746 | 3829 | pid_init(); | 4423 | |
3747 | 3830 | D(bug(" Plugin viewer pid: %d\n", g_viewer_pid)); | 4424 | thread_check_init(); |
3748 | 3831 | 4425 | D(bug(" Plugin main thread: %p\n", g_main_thread)); | |
3749 | 4426 | |||
3750 | 3832 | // Cleanup environment, the program may fork/exec a native shell | 4427 | // Cleanup environment, the program may fork/exec a native shell |
3751 | 3833 | // script and having 32-bit libraries in LD_PRELOAD is not right, | 4428 | // script and having 32-bit libraries in LD_PRELOAD is not right, |
3752 | 3834 | // though not a fatal error | 4429 | // though not a fatal error |
3753 | @@ -3886,24 +4481,6 @@ | |||
3754 | 3886 | 4481 | ||
3755 | 3887 | id_init(); | 4482 | id_init(); |
3756 | 3888 | 4483 | ||
3757 | 3889 | // Initialize Xt events listener (integrate X events into GTK events loop) | ||
3758 | 3890 | GSource *xt_source = g_source_new(&xt_event_funcs, sizeof(GSource)); | ||
3759 | 3891 | if (xt_source == NULL) { | ||
3760 | 3892 | npw_printf("ERROR: failed to initialize Xt events listener\n"); | ||
3761 | 3893 | return 1; | ||
3762 | 3894 | } | ||
3763 | 3895 | g_source_set_priority(xt_source, GDK_PRIORITY_EVENTS); | ||
3764 | 3896 | g_source_set_can_recurse(xt_source, TRUE); | ||
3765 | 3897 | g_source_attach(xt_source, NULL); | ||
3766 | 3898 | xt_event_poll_fd.fd = ConnectionNumber(x_display); | ||
3767 | 3899 | xt_event_poll_fd.events = G_IO_IN; | ||
3768 | 3900 | xt_event_poll_fd.revents = 0; | ||
3769 | 3901 | g_source_add_poll(xt_source, &xt_event_poll_fd); | ||
3770 | 3902 | |||
3771 | 3903 | gint xt_polling_timer_id = g_timeout_add(25, | ||
3772 | 3904 | xt_event_polling_timer_callback, | ||
3773 | 3905 | NULL); | ||
3774 | 3906 | |||
3775 | 3907 | // Initialize RPC events listener | 4484 | // Initialize RPC events listener |
3776 | 3908 | GSource *rpc_source = g_source_new(&rpc_event_funcs, sizeof(GSource)); | 4485 | GSource *rpc_source = g_source_new(&rpc_event_funcs, sizeof(GSource)); |
3777 | 3909 | if (rpc_source == NULL) { | 4486 | if (rpc_source == NULL) { |
3778 | @@ -3924,9 +4501,13 @@ | |||
3779 | 3924 | gtk_main(); | 4501 | gtk_main(); |
3780 | 3925 | D(bug("--- EXIT ---\n")); | 4502 | D(bug("--- EXIT ---\n")); |
3781 | 3926 | 4503 | ||
3783 | 3927 | g_source_remove(xt_polling_timer_id); | 4504 | #if USE_NPIDENTIFIER_CACHE |
3784 | 4505 | npidentifier_cache_destroy(); | ||
3785 | 4506 | #endif | ||
3786 | 4507 | |||
3787 | 3928 | g_source_destroy(rpc_source); | 4508 | g_source_destroy(rpc_source); |
3789 | 3929 | g_source_destroy(xt_source); | 4509 | if (xt_source) |
3790 | 4510 | g_source_destroy(xt_source); | ||
3791 | 3930 | 4511 | ||
3792 | 3931 | if (g_user_agent) | 4512 | if (g_user_agent) |
3793 | 3932 | free(g_user_agent); | 4513 | free(g_user_agent); |
3794 | 3933 | 4514 | ||
3795 | === modified file 'src/npw-viewer.sh' | |||
3796 | --- src/npw-viewer.sh 2008-12-27 02:10:20 +0000 | |||
3797 | +++ src/npw-viewer.sh 2009-08-11 00:38:42 +0000 | |||
3798 | @@ -2,9 +2,8 @@ | |||
3799 | 2 | # | 2 | # |
3800 | 3 | # nsplugin viewer wrapper script (C) 2005-2006 Gwenole Beauchesne | 3 | # nsplugin viewer wrapper script (C) 2005-2006 Gwenole Beauchesne |
3801 | 4 | # | 4 | # |
3803 | 5 | OS="`uname -s`" | 5 | OS="`uname -s | tr '[A-Z]' '[a-z]'`" |
3804 | 6 | ARCH="`uname -m`" | 6 | ARCH="`uname -m`" |
3805 | 7 | NPW_LIBDIR="%NPW_LIBDIR%" | ||
3806 | 8 | 7 | ||
3807 | 9 | if test -z "$TARGET_OS"; then | 8 | if test -z "$TARGET_OS"; then |
3808 | 10 | echo "*** NSPlugin Viewer *** error, TARGET_OS not initialized" | 9 | echo "*** NSPlugin Viewer *** error, TARGET_OS not initialized" |
3809 | @@ -16,7 +15,54 @@ | |||
3810 | 16 | exit 1 | 15 | exit 1 |
3811 | 17 | fi | 16 | fi |
3812 | 18 | 17 | ||
3814 | 19 | NPW_VIEWER_DIR=$NPW_LIBDIR/$TARGET_ARCH/$TARGET_OS | 18 | normalize_cpu() { |
3815 | 19 | local cpu="$1" | ||
3816 | 20 | case "$cpu" in | ||
3817 | 21 | arm*) | ||
3818 | 22 | cpu="arm" | ||
3819 | 23 | ;; | ||
3820 | 24 | i[3456]86|k[678]|i86pc|BePC) | ||
3821 | 25 | cpu="i386" | ||
3822 | 26 | ;; | ||
3823 | 27 | ia64) | ||
3824 | 28 | cpu="ia64" | ||
3825 | 29 | ;; | ||
3826 | 30 | "Power Macintosh"|ppc) | ||
3827 | 31 | cpu="ppc" | ||
3828 | 32 | ;; | ||
3829 | 33 | ppc64) | ||
3830 | 34 | cpu="ppc64" | ||
3831 | 35 | ;; | ||
3832 | 36 | sparc) | ||
3833 | 37 | cpu="sparc" | ||
3834 | 38 | ;; | ||
3835 | 39 | sparc64) | ||
3836 | 40 | cpu="sparc64" | ||
3837 | 41 | ;; | ||
3838 | 42 | x86_64|amd64) | ||
3839 | 43 | cpu="x86_64" | ||
3840 | 44 | ;; | ||
3841 | 45 | esac | ||
3842 | 46 | echo "$cpu" | ||
3843 | 47 | } | ||
3844 | 48 | |||
3845 | 49 | normalize_os() { | ||
3846 | 50 | local os="$1" | ||
3847 | 51 | case "$os" in | ||
3848 | 52 | sunos*) | ||
3849 | 53 | os="solaris" | ||
3850 | 54 | ;; | ||
3851 | 55 | esac | ||
3852 | 56 | echo "$os" | ||
3853 | 57 | } | ||
3854 | 58 | |||
3855 | 59 | ARCH=`normalize_cpu "$ARCH"` | ||
3856 | 60 | OS=`normalize_os "$OS"` | ||
3857 | 61 | TARGET_ARCH=`normalize_cpu "$TARGET_ARCH"` | ||
3858 | 62 | TARGET_OS=`normalize_os "$TARGET_OS"` | ||
3859 | 63 | |||
3860 | 64 | # Define where npviewer.bin is located | ||
3861 | 65 | NPW_VIEWER_DIR="%NPW_VIEWER_DIR%" | ||
3862 | 20 | 66 | ||
3863 | 21 | # Set a new LD_LIBRARY_PATH that is TARGET specific | 67 | # Set a new LD_LIBRARY_PATH that is TARGET specific |
3864 | 22 | export LD_LIBRARY_PATH=$NPW_VIEWER_DIR | 68 | export LD_LIBRARY_PATH=$NPW_VIEWER_DIR |
3865 | @@ -31,24 +77,15 @@ | |||
3866 | 31 | NPW_USE_VALGRIND=${NPW_USE_VALGRIND:-no} | 77 | NPW_USE_VALGRIND=${NPW_USE_VALGRIND:-no} |
3867 | 32 | can_use_valgrind="no" | 78 | can_use_valgrind="no" |
3868 | 33 | 79 | ||
3869 | 34 | case $ARCH in | ||
3870 | 35 | i?86|i86pc) | ||
3871 | 36 | ARCH=i386 | ||
3872 | 37 | ;; | ||
3873 | 38 | amd64) | ||
3874 | 39 | ARCH=x86_64 | ||
3875 | 40 | ;; | ||
3876 | 41 | esac | ||
3877 | 42 | |||
3878 | 43 | if test "$ARCH" != "$TARGET_ARCH"; then | 80 | if test "$ARCH" != "$TARGET_ARCH"; then |
3879 | 44 | case $TARGET_ARCH in | 81 | case $TARGET_ARCH in |
3880 | 45 | i386) | 82 | i386) |
3881 | 46 | if test "$ARCH" = "x86_64"; then | 83 | if test "$ARCH" = "x86_64"; then |
3882 | 47 | case "$OS" in | 84 | case "$OS" in |
3884 | 48 | Linux) | 85 | linux) |
3885 | 49 | LOADER=`which linux32` | 86 | LOADER=`which linux32` |
3886 | 50 | ;; | 87 | ;; |
3888 | 51 | FreeBSD | NetBSD) | 88 | freebsd | netbsd) |
3889 | 52 | # XXX check that COMPAT_LINUX is enabled or fail otherwise | 89 | # XXX check that COMPAT_LINUX is enabled or fail otherwise |
3890 | 53 | LOADER="none" | 90 | LOADER="none" |
3891 | 54 | ;; | 91 | ;; |
3892 | @@ -66,7 +103,7 @@ | |||
3893 | 66 | ppc) | 103 | ppc) |
3894 | 67 | if test "$ARCH" = "ppc64"; then | 104 | if test "$ARCH" = "ppc64"; then |
3895 | 68 | case "$OS" in | 105 | case "$OS" in |
3897 | 69 | Linux) | 106 | linux) |
3898 | 70 | LOADER=`which linux32` | 107 | LOADER=`which linux32` |
3899 | 71 | ;; | 108 | ;; |
3900 | 72 | esac | 109 | esac |
3901 | @@ -98,7 +135,7 @@ | |||
3902 | 98 | fi | 135 | fi |
3903 | 99 | 136 | ||
3904 | 100 | # Expand PATH for RealPlayer package on NetBSD (realplay) | 137 | # Expand PATH for RealPlayer package on NetBSD (realplay) |
3906 | 101 | if test "$OS" = "NetBSD"; then | 138 | if test "$OS" = "netbsd"; then |
3907 | 102 | REALPLAYER_HOME="/usr/pkg/lib/RealPlayer" | 139 | REALPLAYER_HOME="/usr/pkg/lib/RealPlayer" |
3908 | 103 | if test -x "$REALPLAYER_HOME/realplay"; then | 140 | if test -x "$REALPLAYER_HOME/realplay"; then |
3909 | 104 | export PATH=$PATH:$REALPLAYER_HOME | 141 | export PATH=$PATH:$REALPLAYER_HOME |
3910 | @@ -114,7 +151,7 @@ | |||
3911 | 114 | # XXX: detect QEMU target soundwrapper differently | 151 | # XXX: detect QEMU target soundwrapper differently |
3912 | 115 | case "$LOADER" in | 152 | case "$LOADER" in |
3913 | 116 | *linux32) | 153 | *linux32) |
3915 | 117 | if test "$OS" = "Linux"; then | 154 | if test "$OS" = "linux"; then |
3916 | 118 | soundwrapper=`which soundwrapper 2>/dev/null` | 155 | soundwrapper=`which soundwrapper 2>/dev/null` |
3917 | 119 | if test -x "$soundwrapper"; then | 156 | if test -x "$soundwrapper"; then |
3918 | 120 | LOADER="$LOADER $soundwrapper" | 157 | LOADER="$LOADER $soundwrapper" |
3919 | 121 | 158 | ||
3920 | === modified file 'src/npw-wrapper.c' | |||
3921 | --- src/npw-wrapper.c 2009-01-02 10:07:27 +0000 | |||
3922 | +++ src/npw-wrapper.c 2009-08-11 00:38:42 +0000 | |||
3923 | @@ -21,7 +21,6 @@ | |||
3924 | 21 | #define _GNU_SOURCE 1 /* RTLD_DEFAULT */ | 21 | #define _GNU_SOURCE 1 /* RTLD_DEFAULT */ |
3925 | 22 | #include "sysdeps.h" | 22 | #include "sysdeps.h" |
3926 | 23 | 23 | ||
3927 | 24 | #include <assert.h> | ||
3928 | 25 | #include <stdio.h> | 24 | #include <stdio.h> |
3929 | 26 | #include <stdlib.h> | 25 | #include <stdlib.h> |
3930 | 27 | #include <string.h> | 26 | #include <string.h> |
3931 | @@ -61,12 +60,17 @@ | |||
3932 | 61 | NPW_DEFAULT_PLUGIN_PATH, | 60 | NPW_DEFAULT_PLUGIN_PATH, |
3933 | 62 | 0, | 61 | 0, |
3934 | 63 | HOST_OS, | 62 | HOST_OS, |
3936 | 64 | HOST_ARCH | 63 | HOST_ARCH, |
3937 | 64 | NPW_PLUGIN_INFO_VERSION, | ||
3938 | 65 | "" | ||
3939 | 65 | }; | 66 | }; |
3940 | 66 | 67 | ||
3941 | 67 | // Path to plugin to use | 68 | // Path to plugin to use |
3942 | 68 | static const char *plugin_path = NPW_Plugin.path; | 69 | static const char *plugin_path = NPW_Plugin.path; |
3943 | 69 | 70 | ||
3944 | 71 | // Path to associated plugin viewer | ||
3945 | 72 | static const char *plugin_viewer_path = NPW_Plugin.viewer_path; | ||
3946 | 73 | |||
3947 | 70 | // Netscape exported functions | 74 | // Netscape exported functions |
3948 | 71 | static NPNetscapeFuncs mozilla_funcs; | 75 | static NPNetscapeFuncs mozilla_funcs; |
3949 | 72 | 76 | ||
3950 | @@ -2607,7 +2611,7 @@ | |||
3951 | 2607 | str = | 2611 | str = |
3952 | 2608 | "<a href=\"http://gwenole.beauchesne.info/projects/nspluginwrapper/\">nspluginwrapper</a> " | 2612 | "<a href=\"http://gwenole.beauchesne.info/projects/nspluginwrapper/\">nspluginwrapper</a> " |
3953 | 2609 | " is a cross-platform NPAPI plugin viewer, in particular for linux/i386 plugins.<br>" | 2613 | " is a cross-platform NPAPI plugin viewer, in particular for linux/i386 plugins.<br>" |
3955 | 2610 | "This software is available under the terms of the GNU General Public License.<br>" | 2614 | "This <b>beta</b> software is available under the terms of the GNU General Public License.<br>" |
3956 | 2611 | ; | 2615 | ; |
3957 | 2612 | ret = NPERR_NO_ERROR; | 2616 | ret = NPERR_NO_ERROR; |
3958 | 2613 | } | 2617 | } |
3959 | @@ -3348,15 +3352,13 @@ | |||
3960 | 3348 | 3352 | ||
3961 | 3349 | static int init_count = 0; | 3353 | static int init_count = 0; |
3962 | 3350 | ++init_count; | 3354 | ++init_count; |
3963 | 3351 | char viewer_path[PATH_MAX]; | ||
3964 | 3352 | sprintf(viewer_path, "%s/%s/%s/%s", NPW_LIBDIR, NPW_Plugin.target_arch, NPW_Plugin.target_os, NPW_VIEWER); | ||
3965 | 3353 | char connection_path[128]; | 3355 | char connection_path[128]; |
3966 | 3354 | sprintf(connection_path, "%s/%s/%d-%d", NPW_CONNECTION_PATH, plugin_file_name, getpid(), init_count); | 3356 | sprintf(connection_path, "%s/%s/%d-%d", NPW_CONNECTION_PATH, plugin_file_name, getpid(), init_count); |
3967 | 3355 | 3357 | ||
3968 | 3356 | // Cache MIME info and plugin name/description | 3358 | // Cache MIME info and plugin name/description |
3969 | 3357 | if (g_plugin.name == NULL && g_plugin.description == NULL && g_plugin.formats == NULL) { | 3359 | if (g_plugin.name == NULL && g_plugin.description == NULL && g_plugin.formats == NULL) { |
3970 | 3358 | char command[1024]; | 3360 | char command[1024]; |
3972 | 3359 | if (snprintf(command, sizeof(command), "%s --info --plugin %s", viewer_path, plugin_path) >= sizeof(command)) | 3361 | if (snprintf(command, sizeof(command), "%s --info --plugin %s", plugin_viewer_path, plugin_path) >= sizeof(command)) |
3973 | 3360 | return; | 3362 | return; |
3974 | 3361 | FILE *viewer_fp = popen(command, "r"); | 3363 | FILE *viewer_fp = popen(command, "r"); |
3975 | 3362 | if (viewer_fp == NULL) | 3364 | if (viewer_fp == NULL) |
3976 | @@ -3416,7 +3418,7 @@ | |||
3977 | 3416 | 3418 | ||
3978 | 3417 | npw_close_all_open_files(); | 3419 | npw_close_all_open_files(); |
3979 | 3418 | 3420 | ||
3981 | 3419 | execv(viewer_path, argv); | 3421 | execv(plugin_viewer_path, argv); |
3982 | 3420 | npw_printf("ERROR: failed to execute NSPlugin viewer\n"); | 3422 | npw_printf("ERROR: failed to execute NSPlugin viewer\n"); |
3983 | 3421 | _Exit(255); | 3423 | _Exit(255); |
3984 | 3422 | } | 3424 | } |
3985 | 3423 | 3425 | ||
3986 | === modified file 'src/rpc.c' | |||
3987 | --- src/rpc.c 2009-01-02 10:07:27 +0000 | |||
3988 | +++ src/rpc.c 2009-08-11 00:38:42 +0000 | |||
3989 | @@ -60,9 +60,11 @@ | |||
3990 | 60 | // build of the viewer can interoperate with non-Linux wrappers. Linux | 60 | // build of the viewer can interoperate with non-Linux wrappers. Linux |
3991 | 61 | // distributions can use this code though. | 61 | // distributions can use this code though. |
3992 | 62 | // XXX better clean-up dead sockets properly on failure... | 62 | // XXX better clean-up dead sockets properly on failure... |
3994 | 63 | #ifdef BUILD_LINUX_ONLY | 63 | #ifndef BUILD_GENERIC |
3995 | 64 | #if defined(__linux__) | ||
3996 | 64 | #define USE_ANONYMOUS_SOCKETS 1 | 65 | #define USE_ANONYMOUS_SOCKETS 1 |
3997 | 65 | #endif | 66 | #endif |
3998 | 67 | #endif | ||
3999 | 66 | 68 | ||
4000 | 67 | // Define the maximum amount of time (in seconds) to wait for a message | 69 | // Define the maximum amount of time (in seconds) to wait for a message |
4001 | 68 | #ifndef RPC_MESSAGE_TIMEOUT | 70 | #ifndef RPC_MESSAGE_TIMEOUT |
4002 | @@ -459,6 +461,8 @@ | |||
4003 | 459 | int status; | 461 | int status; |
4004 | 460 | int socket; | 462 | int socket; |
4005 | 461 | char *socket_path; | 463 | char *socket_path; |
4006 | 464 | struct sockaddr_un socket_addr; | ||
4007 | 465 | socklen_t socket_addr_len; | ||
4008 | 462 | int server_socket; | 466 | int server_socket; |
4009 | 463 | int server_thread_active; | 467 | int server_thread_active; |
4010 | 464 | pthread_t server_thread; | 468 | pthread_t server_thread; |
4011 | @@ -663,59 +667,131 @@ | |||
4012 | 663 | return n; | 667 | return n; |
4013 | 664 | } | 668 | } |
4014 | 665 | 669 | ||
4015 | 670 | // Create a new RPC connection (initialize common structure members) | ||
4016 | 671 | static rpc_connection_t *rpc_connection_new(int type, const char *ident) | ||
4017 | 672 | { | ||
4018 | 673 | rpc_connection_t *connection; | ||
4019 | 674 | |||
4020 | 675 | if (ident == NULL) | ||
4021 | 676 | return NULL; | ||
4022 | 677 | |||
4023 | 678 | if ((connection = (rpc_connection_t *)calloc(1, sizeof(*connection))) == NULL) | ||
4024 | 679 | return NULL; | ||
4025 | 680 | |||
4026 | 681 | connection->type = type; | ||
4027 | 682 | connection->refcnt = 1; | ||
4028 | 683 | connection->status = RPC_STATUS_CLOSED; | ||
4029 | 684 | connection->socket = -1; | ||
4030 | 685 | connection->server_socket = -1; | ||
4031 | 686 | connection->server_thread_active = 0; | ||
4032 | 687 | connection->error_callback = NULL; | ||
4033 | 688 | connection->error_callback_data = NULL; | ||
4034 | 689 | connection->dispatch_depth = 0; | ||
4035 | 690 | connection->invoke_depth = 0; | ||
4036 | 691 | connection->handle_depth = 0; | ||
4037 | 692 | connection->sync_depth = 0; | ||
4038 | 693 | connection->pending_sync_depth = 0; | ||
4039 | 694 | |||
4040 | 695 | if ((connection->types = rpc_map_new_full((free))) == NULL) { | ||
4041 | 696 | rpc_exit(connection); | ||
4042 | 697 | return NULL; | ||
4043 | 698 | } | ||
4044 | 699 | |||
4045 | 700 | if ((connection->methods = rpc_map_new()) == NULL) { | ||
4046 | 701 | rpc_exit(connection); | ||
4047 | 702 | return NULL; | ||
4048 | 703 | } | ||
4049 | 704 | |||
4050 | 705 | int fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0); | ||
4051 | 706 | if (fd < 0) { | ||
4052 | 707 | perror("socket"); | ||
4053 | 708 | rpc_exit(connection); | ||
4054 | 709 | return NULL; | ||
4055 | 710 | } | ||
4056 | 711 | |||
4057 | 712 | if (type == RPC_CONNECTION_SERVER) | ||
4058 | 713 | connection->server_socket = fd; | ||
4059 | 714 | else { | ||
4060 | 715 | connection->socket = fd; | ||
4061 | 716 | |||
4062 | 717 | if (rpc_set_non_blocking_io(fd) < 0) { | ||
4063 | 718 | perror("socket set non-blocking"); | ||
4064 | 719 | rpc_exit(connection); | ||
4065 | 720 | return NULL; | ||
4066 | 721 | } | ||
4067 | 722 | } | ||
4068 | 723 | |||
4069 | 724 | memset(&connection->socket_addr, 0, sizeof(connection->socket_addr)); | ||
4070 | 725 | connection->socket_addr.sun_family = AF_UNIX; | ||
4071 | 726 | connection->socket_path = NULL; | ||
4072 | 727 | connection->socket_addr_len = _rpc_socket_path(&connection->socket_path, ident); | ||
4073 | 728 | memcpy(&connection->socket_addr.sun_path[0], connection->socket_path, connection->socket_addr_len); | ||
4074 | 729 | connection->socket_addr_len += offsetof(struct sockaddr_un, sun_path); /* though POSIX says size of the actual sockaddr structure */ | ||
4075 | 730 | #ifdef HAVE_SOCKADDR_UN_SUN_LEN | ||
4076 | 731 | connection->socket_addr.sun_len = connection->socket_addr_len; | ||
4077 | 732 | #endif | ||
4078 | 733 | |||
4079 | 734 | return connection; | ||
4080 | 735 | } | ||
4081 | 736 | |||
4082 | 737 | // Destroy an RPC connection | ||
4083 | 738 | static void rpc_connection_destroy(rpc_connection_t *connection) | ||
4084 | 739 | { | ||
4085 | 740 | if (connection == NULL) | ||
4086 | 741 | return; | ||
4087 | 742 | |||
4088 | 743 | if (connection->socket_path) { | ||
4089 | 744 | if (connection->socket_path[0]) | ||
4090 | 745 | unlink(connection->socket_path); | ||
4091 | 746 | free(connection->socket_path); | ||
4092 | 747 | connection->socket_path = NULL; | ||
4093 | 748 | } | ||
4094 | 749 | |||
4095 | 750 | if (connection->type == RPC_CONNECTION_SERVER) { | ||
4096 | 751 | if (connection->server_thread_active) { | ||
4097 | 752 | pthread_cancel(connection->server_thread); | ||
4098 | 753 | pthread_join(connection->server_thread, NULL); | ||
4099 | 754 | connection->server_thread = 0; | ||
4100 | 755 | } | ||
4101 | 756 | if (connection->socket != -1) { | ||
4102 | 757 | close(connection->socket); | ||
4103 | 758 | connection->socket = -1; | ||
4104 | 759 | } | ||
4105 | 760 | if (connection->server_socket != -1) { | ||
4106 | 761 | close(connection->server_socket); | ||
4107 | 762 | connection->server_socket = -1; | ||
4108 | 763 | } | ||
4109 | 764 | } | ||
4110 | 765 | else { | ||
4111 | 766 | if (connection->socket != -1) { | ||
4112 | 767 | close(connection->socket); | ||
4113 | 768 | connection->socket = -1; | ||
4114 | 769 | } | ||
4115 | 770 | } | ||
4116 | 771 | |||
4117 | 772 | if (connection->types) { | ||
4118 | 773 | rpc_map_destroy(connection->types); | ||
4119 | 774 | connection->types = NULL; | ||
4120 | 775 | } | ||
4121 | 776 | if (connection->methods) { | ||
4122 | 777 | rpc_map_destroy(connection->methods); | ||
4123 | 778 | connection->methods = NULL; | ||
4124 | 779 | } | ||
4125 | 780 | |||
4126 | 781 | free(connection); | ||
4127 | 782 | } | ||
4128 | 783 | |||
4129 | 666 | // Initialize server-side RPC system | 784 | // Initialize server-side RPC system |
4130 | 667 | rpc_connection_t *rpc_init_server(const char *ident) | 785 | rpc_connection_t *rpc_init_server(const char *ident) |
4131 | 668 | { | 786 | { |
4132 | 669 | D(bug("rpc_init_server ident='%s'\n", ident)); | 787 | D(bug("rpc_init_server ident='%s'\n", ident)); |
4133 | 670 | 788 | ||
4134 | 671 | rpc_connection_t *connection; | 789 | rpc_connection_t *connection; |
4182 | 672 | struct sockaddr_un addr; | 790 | |
4183 | 673 | socklen_t addr_len; | 791 | if ((connection = rpc_connection_new(RPC_CONNECTION_SERVER, ident)) == NULL) |
4184 | 674 | 792 | return NULL; | |
4185 | 675 | if (ident == NULL) | 793 | |
4186 | 676 | return NULL; | 794 | if (bind(connection->server_socket, (struct sockaddr *)&connection->socket_addr, connection->socket_addr_len) < 0) { |
4140 | 677 | |||
4141 | 678 | connection = (rpc_connection_t *)calloc(1, sizeof(*connection)); | ||
4142 | 679 | if (connection == NULL) | ||
4143 | 680 | return NULL; | ||
4144 | 681 | connection->type = RPC_CONNECTION_SERVER; | ||
4145 | 682 | connection->refcnt = 1; | ||
4146 | 683 | connection->status = RPC_STATUS_CLOSED; | ||
4147 | 684 | connection->socket = -1; | ||
4148 | 685 | connection->server_thread_active = 0; | ||
4149 | 686 | connection->error_callback = NULL; | ||
4150 | 687 | connection->error_callback_data = NULL; | ||
4151 | 688 | connection->dispatch_depth = 0; | ||
4152 | 689 | connection->invoke_depth = 0; | ||
4153 | 690 | connection->handle_depth = 0; | ||
4154 | 691 | connection->sync_depth = 0; | ||
4155 | 692 | connection->pending_sync_depth = 0; | ||
4156 | 693 | if ((connection->types = rpc_map_new_full((free))) == NULL) { | ||
4157 | 694 | rpc_exit(connection); | ||
4158 | 695 | return NULL; | ||
4159 | 696 | } | ||
4160 | 697 | if ((connection->methods = rpc_map_new()) == NULL) { | ||
4161 | 698 | rpc_exit(connection); | ||
4162 | 699 | return NULL; | ||
4163 | 700 | } | ||
4164 | 701 | |||
4165 | 702 | if ((connection->server_socket = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0)) < 0) { | ||
4166 | 703 | perror("server socket"); | ||
4167 | 704 | rpc_exit(connection); | ||
4168 | 705 | return NULL; | ||
4169 | 706 | } | ||
4170 | 707 | |||
4171 | 708 | memset(&addr, 0, sizeof(addr)); | ||
4172 | 709 | addr.sun_family = AF_UNIX; | ||
4173 | 710 | connection->socket_path = NULL; | ||
4174 | 711 | addr_len = _rpc_socket_path(&connection->socket_path, ident); | ||
4175 | 712 | memcpy(&addr.sun_path[0], connection->socket_path, addr_len); | ||
4176 | 713 | addr_len += offsetof(struct sockaddr_un, sun_path); /* though POSIX says size of the actual sockaddr structure */ | ||
4177 | 714 | #ifdef HAVE_SOCKADDR_UN_SUN_LEN | ||
4178 | 715 | addr.sun_len = addr_len; | ||
4179 | 716 | #endif | ||
4180 | 717 | |||
4181 | 718 | if (bind(connection->server_socket, (struct sockaddr *)&addr, addr_len) < 0) { | ||
4187 | 719 | perror("server bind"); | 795 | perror("server bind"); |
4188 | 720 | rpc_exit(connection); | 796 | rpc_exit(connection); |
4189 | 721 | return NULL; | 797 | return NULL; |
4190 | @@ -737,56 +813,9 @@ | |||
4191 | 737 | D(bug("rpc_init_client ident='%s'\n", ident)); | 813 | D(bug("rpc_init_client ident='%s'\n", ident)); |
4192 | 738 | 814 | ||
4193 | 739 | rpc_connection_t *connection; | 815 | rpc_connection_t *connection; |
4244 | 740 | struct sockaddr_un addr; | 816 | |
4245 | 741 | socklen_t addr_len; | 817 | if ((connection = rpc_connection_new(RPC_CONNECTION_CLIENT, ident)) == NULL) |
4246 | 742 | 818 | return NULL; | |
4197 | 743 | if (ident == NULL) | ||
4198 | 744 | return NULL; | ||
4199 | 745 | |||
4200 | 746 | connection = (rpc_connection_t *)calloc(1, sizeof(*connection)); | ||
4201 | 747 | if (connection == NULL) | ||
4202 | 748 | return NULL; | ||
4203 | 749 | connection->type = RPC_CONNECTION_CLIENT; | ||
4204 | 750 | connection->refcnt = 1; | ||
4205 | 751 | connection->status = RPC_STATUS_CLOSED; | ||
4206 | 752 | connection->server_socket = -1; | ||
4207 | 753 | connection->error_callback = NULL; | ||
4208 | 754 | connection->error_callback_data = NULL; | ||
4209 | 755 | connection->dispatch_depth = 0; | ||
4210 | 756 | connection->invoke_depth = 0; | ||
4211 | 757 | connection->handle_depth = 0; | ||
4212 | 758 | connection->sync_depth = 0; | ||
4213 | 759 | connection->pending_sync_depth = 0; | ||
4214 | 760 | if ((connection->types = rpc_map_new_full((free))) == NULL) { | ||
4215 | 761 | rpc_exit(connection); | ||
4216 | 762 | return NULL; | ||
4217 | 763 | } | ||
4218 | 764 | if ((connection->methods = rpc_map_new()) == NULL) { | ||
4219 | 765 | rpc_exit(connection); | ||
4220 | 766 | return NULL; | ||
4221 | 767 | } | ||
4222 | 768 | |||
4223 | 769 | if ((connection->socket = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0)) < 0) { | ||
4224 | 770 | perror("client socket"); | ||
4225 | 771 | rpc_exit(connection); | ||
4226 | 772 | return NULL; | ||
4227 | 773 | } | ||
4228 | 774 | |||
4229 | 775 | if (rpc_set_non_blocking_io(connection->socket) < 0) { | ||
4230 | 776 | perror("client socket set non-blocking"); | ||
4231 | 777 | rpc_exit(connection); | ||
4232 | 778 | return NULL; | ||
4233 | 779 | } | ||
4234 | 780 | |||
4235 | 781 | memset(&addr, 0, sizeof(addr)); | ||
4236 | 782 | addr.sun_family = AF_UNIX; | ||
4237 | 783 | connection->socket_path = NULL; | ||
4238 | 784 | addr_len = _rpc_socket_path(&connection->socket_path, ident); | ||
4239 | 785 | memcpy(&addr.sun_path[0], connection->socket_path, addr_len); | ||
4240 | 786 | addr_len += offsetof(struct sockaddr_un, sun_path); /* though POSIX says size of the actual sockaddr structure */ | ||
4241 | 787 | #ifdef HAVE_SOCKADDR_UN_SUN_LEN | ||
4242 | 788 | addr.sun_len = addr_len; | ||
4243 | 789 | #endif | ||
4247 | 790 | 819 | ||
4248 | 791 | // Wait at most RPC_INIT_TIMEOUT seconds for server to initialize | 820 | // Wait at most RPC_INIT_TIMEOUT seconds for server to initialize |
4249 | 792 | const int N_CONNECT_WAIT_DELAY = 10; | 821 | const int N_CONNECT_WAIT_DELAY = 10; |
4250 | @@ -794,7 +823,7 @@ | |||
4251 | 794 | if (n_connect_attempts == 0) | 823 | if (n_connect_attempts == 0) |
4252 | 795 | n_connect_attempts = 1; | 824 | n_connect_attempts = 1; |
4253 | 796 | while (n_connect_attempts > 0) { | 825 | while (n_connect_attempts > 0) { |
4255 | 797 | if (connect(connection->socket, (struct sockaddr *)&addr, addr_len) == 0) | 826 | if (connect(connection->socket, (struct sockaddr *)&connection->socket_addr, connection->socket_addr_len) == 0) |
4256 | 798 | break; | 827 | break; |
4257 | 799 | if (n_connect_attempts > 1 && errno != ECONNREFUSED && errno != ENOENT) { | 828 | if (n_connect_attempts > 1 && errno != ECONNREFUSED && errno != ENOENT) { |
4258 | 800 | perror("client_connect"); | 829 | perror("client_connect"); |
4259 | @@ -821,45 +850,7 @@ | |||
4260 | 821 | if (connection == NULL) | 850 | if (connection == NULL) |
4261 | 822 | return RPC_ERROR_CONNECTION_NULL; | 851 | return RPC_ERROR_CONNECTION_NULL; |
4262 | 823 | 852 | ||
4302 | 824 | if (connection->socket_path) { | 853 | rpc_connection_destroy(connection); |
4264 | 825 | if (connection->socket_path[0]) | ||
4265 | 826 | unlink(connection->socket_path); | ||
4266 | 827 | free(connection->socket_path); | ||
4267 | 828 | connection->socket_path = NULL; | ||
4268 | 829 | } | ||
4269 | 830 | |||
4270 | 831 | if (connection->type == RPC_CONNECTION_SERVER) { | ||
4271 | 832 | if (connection->server_thread_active) { | ||
4272 | 833 | pthread_cancel(connection->server_thread); | ||
4273 | 834 | pthread_join(connection->server_thread, NULL); | ||
4274 | 835 | connection->server_thread = 0; | ||
4275 | 836 | } | ||
4276 | 837 | if (connection->socket != -1) { | ||
4277 | 838 | close(connection->socket); | ||
4278 | 839 | connection->socket = -1; | ||
4279 | 840 | } | ||
4280 | 841 | if (connection->server_socket != -1) { | ||
4281 | 842 | close(connection->server_socket); | ||
4282 | 843 | connection->server_socket = -1; | ||
4283 | 844 | } | ||
4284 | 845 | } | ||
4285 | 846 | else { | ||
4286 | 847 | if (connection->socket != -1) { | ||
4287 | 848 | close(connection->socket); | ||
4288 | 849 | connection->socket = -1; | ||
4289 | 850 | } | ||
4290 | 851 | } | ||
4291 | 852 | |||
4292 | 853 | if (connection->types) { | ||
4293 | 854 | rpc_map_destroy(connection->types); | ||
4294 | 855 | connection->types = NULL; | ||
4295 | 856 | } | ||
4296 | 857 | if (connection->methods) { | ||
4297 | 858 | rpc_map_destroy(connection->methods); | ||
4298 | 859 | connection->methods = NULL; | ||
4299 | 860 | } | ||
4300 | 861 | |||
4301 | 862 | free(connection); | ||
4303 | 863 | return RPC_ERROR_NO_ERROR; | 854 | return RPC_ERROR_NO_ERROR; |
4304 | 864 | } | 855 | } |
4305 | 865 | 856 | ||
4306 | 866 | 857 | ||
4307 | === modified file 'src/sysdeps.h' | |||
4308 | --- src/sysdeps.h 2009-01-02 10:07:27 +0000 | |||
4309 | +++ src/sysdeps.h 2009-08-11 00:38:42 +0000 | |||
4310 | @@ -45,9 +45,9 @@ | |||
4311 | 45 | #define NPW_VIEWER NPW_VIEWER_BASE | 45 | #define NPW_VIEWER NPW_VIEWER_BASE |
4312 | 46 | #define NPW_WRAPPER_BASE "npwrapper" | 46 | #define NPW_WRAPPER_BASE "npwrapper" |
4313 | 47 | #define NPW_WRAPPER NPW_WRAPPER_BASE ".so" | 47 | #define NPW_WRAPPER NPW_WRAPPER_BASE ".so" |
4317 | 48 | #define NPW_OLD_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" NPW_WRAPPER | 48 | #define NPW_DEFAULT_PLUGIN_PATH NPW_HOST_LIBDIR "/" NPW_WRAPPER |
4318 | 49 | #define NPW_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" HOST_OS "/" NPW_WRAPPER | 49 | #define NPW_PLUGIN_INFO_VERSION 2 |
4319 | 50 | #define NPW_PLUGIN_IDENT "NPW:" NPW_VERSION | 50 | #define NPW_PLUGIN_IDENT "NPW:X:" NPW_VERSION |
4320 | 51 | #define NPW_PLUGIN_IDENT_SIZE 32 | 51 | #define NPW_PLUGIN_IDENT_SIZE 32 |
4321 | 52 | typedef struct __attribute__((packed)) { | 52 | typedef struct __attribute__((packed)) { |
4322 | 53 | char ident[NPW_PLUGIN_IDENT_SIZE]; | 53 | char ident[NPW_PLUGIN_IDENT_SIZE]; |
4323 | @@ -55,6 +55,8 @@ | |||
4324 | 55 | time_t mtime; | 55 | time_t mtime; |
4325 | 56 | char target_arch[65]; | 56 | char target_arch[65]; |
4326 | 57 | char target_os[65]; | 57 | char target_os[65]; |
4327 | 58 | char struct_version; /* extended format "NPW:X:VERSION" */ | ||
4328 | 59 | char viewer_path[PATH_MAX]; | ||
4329 | 58 | } NPW_PluginInfo; | 60 | } NPW_PluginInfo; |
4330 | 59 | 61 | ||
4331 | 60 | #if defined(BUILD_XPCOM) | 62 | #if defined(BUILD_XPCOM) |