Merge lp:~jazzva/nspluginwrapper/1.3.0 into lp:nspluginwrapper

Proposed by Saša Bodiroža
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
Reviewer Review Type Date Requested Status
Alexander Sack Pending
Review via email: mp+9961@code.launchpad.net
To post a comment you must log in.
lp:~jazzva/nspluginwrapper/1.3.0 updated
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzr-builddeb/default.conf'
--- .bzr-builddeb/default.conf 2009-01-02 10:12:06 +0000
+++ .bzr-builddeb/default.conf 2009-08-11 01:33:30 +0000
@@ -1,5 +1,5 @@
1[BUILDDEB]1[BUILDDEB]
2merge=True2merge=True
3export-upstream = .3export-upstream = .
4export-upstream-revision = revid:jazzva@gmail.com-20090102100727-yx8scdwpkmh9xace4export-upstream-revision = revid:jazzva@gmail.com-20090811003842-htca2u6z7nfh10w3
55
66
=== modified file 'ChangeLog'
--- ChangeLog 2009-01-02 10:07:27 +0000
+++ ChangeLog 2009-08-11 00:38:42 +0000
@@ -1,8 +1,58 @@
12009-01-01 07:36 Gwenole Beauchesne <gb.public@free.fr>12009-01-02 08:50 Gwenole Beauchesne <gb.public@free.fr>
22
3 * NEWS, nspluginwrapper.spec: Updates for 1.2.2.3 * NEWS, nspluginwrapper.spec: Fix spelling.
44
52009-01-01 07:34 Gwenole Beauchesne <gb.public@free.fr>52009-01-01 20:51 Gwenole Beauchesne <gb.public@free.fr>
6
7 * src/rpc.c: Factor our socket creation.
8
92009-01-01 20:26 Gwenole Beauchesne <gb.public@free.fr>
10
11 * src/npruntime-impl.h, src/npruntime.c, src/npw-viewer.c: Make it
12 possible to disable NPIdentifier cache with
13 NPW_NPRUNTIME_CACHE=no too.
14
152009-01-01 17:58 Gwenole Beauchesne <gb.public@free.fr>
16
17 * NEWS, nspluginwrapper.spec: Updates for 1.3.0.
18
192009-01-01 17:56 Gwenole Beauchesne <gb.public@free.fr>
20
21 * configure, lsb-build/headers/glib-2.0/glib.h,
22 lsb-build/stub_libs/libglib-2.0.c: Add g_hash_table_find() and
23 g_hash_table_remove_all() thunks. Besides, for bi-arch builds,
24 it's assumed that 32-/64-bit glib versions are the same and
25 exports the same functions.
26
272009-01-01 17:46 Gwenole Beauchesne <gb.public@free.fr>
28
29 * src/npw-viewer.c: Add NPIdentifier cache.
30
312009-01-01 15:13 Gwenole Beauchesne <gb.public@free.fr>
32
33 * src/npruntime-impl.h, src/npruntime.c: Add NPClass::HasMethod
34 cache so that to lower RPC round-trip.
35
362009-01-01 13:54 Gwenole Beauchesne <gb.public@free.fr>
37
38 * src/npw-viewer.c: Forcibly destroy the Xt source on exit.
39
402009-01-01 11:02 Gwenole Beauchesne <gb.public@free.fr>
41
42 * NEWS: Updates.
43
442009-01-01 10:58 Gwenole Beauchesne <gb.public@free.fr>
45
46 * src/npw-viewer.c: Don't create Xt polling sources if we know the
47 plug-in uses Gtk (XEMBED).
48
492009-01-01 10:33 Gwenole Beauchesne <gb.public@free.fr>
50
51 * src/npw-viewer.c: Get rid of the extra 25ms timer. The Xt timers
52 & input sources are now
53 checked in the X events source ::prepare() function.
54
552009-01-01 07:31 Gwenole Beauchesne <gb.public@free.fr>
656
7 * Makefile, NEWS, README, configure, src/cxxabi-compat.cpp,57 * Makefile, NEWS, README, configure, src/cxxabi-compat.cpp,
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,
@@ -17,85 +67,186 @@
17 utils/getdeps.sh, utils/mkruntime.sh, utils/repackage.sh: Update67 utils/getdeps.sh, utils/mkruntime.sh, utils/repackage.sh: Update
18 copyright notices.68 copyright notices.
1969
202008-12-28 11:36 Gwenole Beauchesne <gb.public@free.fr>702008-12-29 15:14 Gwenole Beauchesne <gb.public@free.fr>
2171
22 * NEWS, src/npw-malloc.c, src/npw-malloc.h, src/npw-viewer.c:72 * src/npw-config.c: Fix upgrades from previous versions.
23 Backport from trunk:73
24 742008-12-29 14:53 Gwenole Beauchesne <gb.public@free.fr>
25 Make sure NPWindow::ws_info points to a unique location for the75
26 lifetime of the window. This fixes support for the VLC plugin76 * Makefile, nspluginwrapper.spec: Rename loader script to
27 that makes a local copy of NPWindow but doesn't bother about77 npviewer.sh.
28 making an NPWindow::ws_info copy.78
29792008-12-29 14:52 Gwenole Beauchesne <gb.public@free.fr>
302008-12-26 23:37 Gwenole Beauchesne <gb.public@free.fr>80
3181 * Makefile, configure, src/npw-config.c, src/npw-wrapper.c,
32 * NEWS: Updates with "hot" fixes.82 src/sysdeps.h: Make it possible to use alternate viewer paths
3383 with --viewer-paths configure option. By default,
342008-12-26 23:33 Gwenole Beauchesne <gb.public@free.fr>84 pkglibdir/%ARCH%/%OS% is used. If no viewer path includes an
3585 ARCH/OS expansion, then nspluginwrapper files are installed in a
36 * src/npw-wrapper.c: Backport from trunk:86 "flat" hierarchy. NPW_PluginInfo format is now extended to
37 87 include the viewer_path[] too.
38 Fix NPN_GetStringIdentifiers() to free identifiers with88
39 NPW_MemFree().892008-12-29 10:48 Gwenole Beauchesne <gb.public@free.fr>
40 * src/npw-player.c: Backport from trunk:90
41 91 * src/npw-viewer.sh: Move down NPW_VIEWER_DIR, after
42 Fix stream_new() to return NULL if an error occurred.92 TARGET_ARCH/TARGET_OS were normalised. Also fix uses of
4393 normalized ARCH/OS variables.
442008-12-26 13:42 Gwenole Beauchesne <gb.public@free.fr>94
45952008-12-29 09:47 Gwenole Beauchesne <gb.public@free.fr>
46 * nspluginwrapper.spec: Bump release for development.96
4797 * src/npw-viewer.sh: Normalize ARCH/OS variables here too.
482008-12-25 21:43 Gwenole Beauchesne <gb.public@free.fr>98
49992008-12-28 18:16 Gwenole Beauchesne <gb.public@free.fr>
50 * nspluginwrapper.spec: Fix day-of-week.100
51101 * Makefile, src/npw-viewer.sh: Factor out install paths.
522008-12-25 21:40 Gwenole Beauchesne <gb.public@free.fr>102
531032008-12-28 17:18 Gwenole Beauchesne <gb.public@free.fr>
54 * NEWS, nspluginwrapper.spec: Updates for real 1.2.0 release.104
55105 * configure: Improve biarch-build check.
562008-12-25 21:37 Gwenole Beauchesne <gb.public@free.fr>106
571072008-12-28 17:03 Gwenole Beauchesne <gb.public@free.fr>
58 * ChangeLog, Makefile: Fix ChangeLog generation for the branch.108
59109 * Makefile, configure, src/rpc.c: Normalize CPU and OS values for
602008-12-25 21:29 Gwenole Beauchesne <gb.public@free.fr>110 both hosts and targets. Cleanup a few internal configure option
61111 names. Rephrase --enable-generic.
62 * ChangeLog: Generated by svn2cl.112
631132008-12-28 11:25 Gwenole Beauchesne <gb.public@free.fr>
642008-12-25 21:29 Gwenole Beauchesne <gb.public@free.fr>114
65115 * src/npw-viewer.c: Make sure NPWindow::ws_info points to a unique
66 * ChangeLog: Generated by svn2cl.116 location for the lifetime of the window. This fixes support for
67117 the VLC plugin that makes a local copy of NPWindow but doesn't
682008-12-21 21:43 Gwenole Beauchesne <gb.public@free.fr>118 bother about making an NPWindow::ws_info copy.
69119
70 * src/debug.h: Fix npw_return_if_fail() definition in !DEBUG mode.1202008-12-28 11:21 Gwenole Beauchesne <gb.public@free.fr>
71121
722008-12-21 14:02 Gwenole Beauchesne <gb.public@free.fr>122 * src/npw-malloc.c, src/npw-malloc.h: Add NPW_MemAllocCopy() and
73123 NPW_MemClone() functions.
74 * src/npw-viewer.c: Destroy the plugin window in NPP_Destroy().124
75 NPAPI docs mention plugin shall not use graphics operations1252008-12-27 15:19 Gwenole Beauchesne <gb.public@free.fr>
76 beyond that call. So, don't bother with broken plugins, we126
77 already have our own bugs to bother with...127 * src/npw-viewer.c: Minor clean-ups.
78128
792008-12-21 12:14 Gwenole Beauchesne <gb.public@free.fr>1292008-12-27 14:56 Gwenole Beauchesne <gb.public@free.fr>
80130
81 * .: Create nspluginwrapper-1.2-branch from rev 837.131 * configure: Enable main-thread checks by default for all builds
132 from snapshots.
133
1342008-12-27 14:54 Gwenole Beauchesne <gb.public@free.fr>
135
136 * configure, src/npruntime.c, src/npw-viewer.c: Rework configure
137 option. Use NPW_THREAD_CHECK=yes (or "1") at run-time.
138
1392008-12-27 14:45 Gwenole Beauchesne <gb.public@free.fr>
140
141 * configure, src/npruntime.c, src/npw-viewer.c: Convert the PID
142 check to a main-thread check.
143
1442008-12-27 12:19 Gwenole Beauchesne <gb.public@free.fr>
145
146 * src/npw-malloc.c: Simplify memory allocation code further.
147
1482008-12-27 12:07 Gwenole Beauchesne <gb.public@free.fr>
149
150 * src/npw-malloc.c: Allow malloc-checks for the libc memory
151 allocation hooks too. This also simplifies/clarifies the
152 different memory allocation backends.
153
1542008-12-27 11:45 Gwenole Beauchesne <gb.public@free.fr>
155
156 * Makefile, configure, src/npw-malloc.c: Enable malloc-checks by
157 default for all builds from snapshots.
158
1592008-12-27 11:16 Gwenole Beauchesne <gb.public@free.fr>
160
161 * configure, src/npw-malloc.c, src/npw-malloc.h: Add basic malloc
162 check routines to detect possible buffer overflows or
163 underflows. This is enabled at run-time with
164 NPW_MALLOC_CHECK=yes (or "1").
165
1662008-12-26 23:31 Gwenole Beauchesne <gb.public@free.fr>
167
168 * src/npw-wrapper.c: Fix NPN_GetStringIdentifiers() to free
169 identifiers with NPW_MemFree().
170
1712008-12-26 23:24 Gwenole Beauchesne <gb.public@free.fr>
172
173 * src/npw-player.c: Fix stream_new() to return NULL if an error
174 occurred.
175
1762008-12-26 21:34 Gwenole Beauchesne <gb.public@free.fr>
177
178 * NEWS, nspluginwrapper.spec: Merge documentation updates from
179 1.2-branch.
180
1812008-12-26 21:26 Gwenole Beauchesne <gb.public@free.fr>
182
183 * src/npruntime.c: Use NPW_MemAlloc() instead of NPW_MemAlloc0()
184 since all struct members are initialized manually.
185
1862008-12-26 21:24 Gwenole Beauchesne <gb.public@free.fr>
187
188 * src/npw-malloc.c: Report an error instead of a debug-warning for
189 NPW_MemFree()'ing a pointer that was not allocated with
190 NPW_MemAlloc().
191
1922008-12-25 21:23 Gwenole Beauchesne <gb.public@free.fr>
193
194 * src/debug.h: Merge from 1.2-branch:
195
196 Fix npw_return_if_fail() definition in !DEBUG mode.
197
1982008-12-25 21:22 Gwenole Beauchesne <gb.public@free.fr>
199
200 * src/npw-viewer.c: Merge from 1.2-branch:
201
202 Destroy the plugin window in NPP_Destroy(). NPAPI docs mention
203 plugin shall not use graphics operations beyond that call. So,
204 don't bother with broken plugins, we already have our own bugs
205 to bother with...
206
2072008-12-25 21:21 Gwenole Beauchesne <gb.public@free.fr>
208
209 * src/npw-rpc.h, src/npw-viewer.c, src/npw-wrapper.c: Revert RPC
210 sync and silent X errors commits. They didn't fix anything in a
211 useful way. IOW, don't bother fixing bugs that are not
212 nspluginwrapper related and that could actually degrade its
213 stability.
214
2152008-12-21 12:19 Gwenole Beauchesne <gb.public@free.fr>
216
217 * nspluginwrapper.spec, src/npw-wrapper.c: Bump release for
218 development.
219
2202008-12-21 09:32 Gwenole Beauchesne <gb.public@free.fr>
221
222 * src/npw-rpc.h, src/npw-viewer.c, src/npw-wrapper.c: Try to
223 improve the RPC flush mechanism. Flash doesn't like "cancelled"
224 NPN_GetURLNotify() with an NPERR_INVALID_INSTANCE_ERROR return.
225 So, we try our best to honour that call prior to sending
226 NPP_Destroy().
227
2282008-12-21 08:19 Gwenole Beauchesne <gb.public@free.fr>
229
230 * src/npw-wrapper.c: Purge all incoming RPC prior to calling
231 NPP_Destroy().
232
2332008-12-21 08:16 Gwenole Beauchesne <gb.public@free.fr>
234
235 * src/npw-viewer.c: Don't kill the application on X errors. That
236 is, we ignore all X errors that could arise between the
237 completion of NPP_Destroy() and plugin_instance_finalize(). This
238 is not fully correct as other plugins can be created and then
239 destroyed in the while.
240
241 XXX: this is a hack to debug later because in the presence of
242 Firefox 3.0 (i.e. neither 3.1b2 nor 2.x are affected, it seems),
243 the toplevel window receives an "unexpected GDK_DESTROY from the
244 outside". Native plugins often get that without nspluginwrapper
245 too but the application is not killed either.
82246
832008-12-20 22:24 Gwenole Beauchesne <gb.public@free.fr>2472008-12-20 22:24 Gwenole Beauchesne <gb.public@free.fr>
84248
85 * gwenole/projects/nspluginwrapper/trunk/ChangeLog: Generated by249 * ChangeLog: Generated by svn2cl.
86 svn2cl.
87
882008-12-20 22:22 Gwenole Beauchesne <gb.public@free.fr>
89
90 * gwenole/projects/nspluginwrapper/trunk/NEWS,
91 gwenole/projects/nspluginwrapper/trunk/nspluginwrapper.spec:
92 1.2.0.
93
942008-12-20 21:32 Gwenole Beauchesne <gb.public@free.fr>
95
96 * gwenole/projects/nspluginwrapper/trunk/src/npw-config.c:
97 Suppress error messages in non-verbose mode when exec()'ing
98 npviewer.bin (Stanislav Brabec).
99250
1002008-12-20 22:22 Gwenole Beauchesne <gb.public@free.fr>2512008-12-20 22:22 Gwenole Beauchesne <gb.public@free.fr>
101252
102253
=== modified file 'Makefile'
--- Makefile 2009-01-02 10:07:27 +0000
+++ Makefile 2009-08-11 00:38:42 +0000
@@ -23,10 +23,10 @@
23ifeq ($(SNAPSHOT),)23ifeq ($(SNAPSHOT),)
24SNAPSHOT := $(shell echo "$(RELEASE)" | grep "^0")24SNAPSHOT := $(shell echo "$(RELEASE)" | grep "^0")
25ifeq ($(SNAPSHOT),$(RELEASE))25ifeq ($(SNAPSHOT),$(RELEASE))
26SNAPSHOT := 126SNAPSHOT := 2
27endif27endif
28endif28endif
29ifeq ($(SNAPSHOT),1)29ifeq ($(SNAPSHOT),2)
30VERSION_SUFFIX = -$(SVNDATE)30VERSION_SUFFIX = -$(SVNDATE)
31endif31endif
3232
@@ -77,7 +77,7 @@
77endif77endif
7878
79ARCH_32 = $(ARCH)79ARCH_32 = $(ARCH)
80ifeq ($(biarch), yes)80ifeq ($(build_biarch), yes)
81ARCH_32 = $(TARGET_ARCH)81ARCH_32 = $(TARGET_ARCH)
82LSB_LIBS = $(LSB_OBJ_DIR)/libc.so $(LSB_OBJ_DIR)/libgcc_s_32.so82LSB_LIBS = $(LSB_OBJ_DIR)/libc.so $(LSB_OBJ_DIR)/libgcc_s_32.so
83LSB_LIBS += $(LSB_CORE_STUBS:%=$(LSB_OBJ_DIR)/%.so)83LSB_LIBS += $(LSB_CORE_STUBS:%=$(LSB_OBJ_DIR)/%.so)
@@ -114,7 +114,7 @@
114npviewer_RAWSRCS = npw-viewer.c npw-common.c npw-malloc.c npw-rpc.c rpc.c debug.c utils.c npruntime.c114npviewer_RAWSRCS = npw-viewer.c npw-common.c npw-malloc.c npw-rpc.c rpc.c debug.c utils.c npruntime.c
115npviewer_SOURCES = $(npviewer_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)115npviewer_SOURCES = $(npviewer_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
116npviewer_OBJECTS = $(npviewer_RAWSRCS:%.c=npviewer-%.o)116npviewer_OBJECTS = $(npviewer_RAWSRCS:%.c=npviewer-%.o)
117ifeq ($(biarch),yes)117ifeq ($(build_biarch),yes)
118npviewer_CFLAGS = $(CFLAGS_32)118npviewer_CFLAGS = $(CFLAGS_32)
119npviewer_CFLAGS += -I$(LSB_INC_DIR)119npviewer_CFLAGS += -I$(LSB_INC_DIR)
120npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0120npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0
@@ -155,7 +155,7 @@
155libxpcom_SOURCES = $(libxpcom_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)155libxpcom_SOURCES = $(libxpcom_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
156libxpcom_OBJECTS = $(libxpcom_RAWSRCS:%.c=libxpcom-%.o)156libxpcom_OBJECTS = $(libxpcom_RAWSRCS:%.c=libxpcom-%.o)
157libxpcom_CFLAGS = $(PIC_CFLAGS)157libxpcom_CFLAGS = $(PIC_CFLAGS)
158ifeq ($(biarch),yes)158ifeq ($(build_biarch),yes)
159libxpcom_CFLAGS += -I$(LSB_INC_DIR)159libxpcom_CFLAGS += -I$(LSB_INC_DIR)
160libxpcom_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR)160libxpcom_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR)
161endif161endif
@@ -182,7 +182,7 @@
182npconfig_LDFLAGS += $(libpthread_LDFLAGS)182npconfig_LDFLAGS += $(libpthread_LDFLAGS)
183endif183endif
184184
185nploader_PROGRAM = npviewer185nploader_PROGRAM = npviewer.sh
186nploader_RAWSRCS = npw-viewer.sh186nploader_RAWSRCS = npw-viewer.sh
187nploader_SOURCES = $(nploader_RAWSRCS:%.sh=$(SRC_PATH)/src/%.sh)187nploader_SOURCES = $(nploader_RAWSRCS:%.sh=$(SRC_PATH)/src/%.sh)
188188
@@ -255,51 +255,43 @@
255255
256uninstall: uninstall.player uninstall.wrapper uninstall.viewer uninstall.libxpcom uninstall.libnoxshm uninstall.loader uninstall.config uninstall.dirs256uninstall: uninstall.player uninstall.wrapper uninstall.viewer uninstall.libxpcom uninstall.libnoxshm uninstall.loader uninstall.config uninstall.dirs
257uninstall.dirs:257uninstall.dirs:
258 rmdir $(DESTDIR)$(pkglibdir)/noarch258 rmdir -p $(DESTDIR)$(nptargetdir) || :
259 rmdir $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)259 rmdir -p $(DESTDIR)$(nphostdir) || :
260 rmdir $(DESTDIR)$(pkglibdir)/$(ARCH)260 rmdir -p $(DESTDIR)$(npcommondir) || :
261ifneq ($(ARCH),$(ARCH_32))
262 rmdir $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)
263 rmdir $(DESTDIR)$(pkglibdir)/$(ARCH_32)
264endif
265uninstall.player:261uninstall.player:
266 rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM)262 rm -f $(DESTDIR)$(nphostdir)/$(npplayer_PROGRAM)
267uninstall.wrapper:263uninstall.wrapper:
268 rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npwrapper_LIBRARY)264 rm -f $(DESTDIR)$(nphostdir)/$(npwrapper_LIBRARY)
269uninstall.viewer:265uninstall.viewer:
270 rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM)266 rm -f $(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM)
271 rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM:%.bin=%)267 rm -f $(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM:%.bin=%)
272uninstall.libxpcom:268uninstall.libxpcom:
273 rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libxpcom_LIBRARY)269 rm -f $(DESTDIR)$(nptargetdir)/$(libxpcom_LIBRARY)
274uninstall.libnoxshm:270uninstall.libnoxshm:
275 rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libnoxshm_LIBRARY)271 rm -f $(DESTDIR)$(nptargetdir)/$(libnoxshm_LIBRARY)
276uninstall.loader:272uninstall.loader:
277 rm -f $(DESTDIR)$(pkglibdir)/noarch/$(nploader_PROGRAM)273 rm -f $(DESTDIR)$(npcommondir)/$(nploader_PROGRAM)
278uninstall.config:274uninstall.config:
279 rm -f $(DESTDIR)$(bindir)/nspluginwrapper275 rm -f $(DESTDIR)$(bindir)/nspluginwrapper
280 rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM)276 rm -f $(DESTDIR)$(nphostdir)/$(npconfig_PROGRAM)
281uninstall.mkruntime:277uninstall.mkruntime:
282 rm -f $(DESTDIR)$(pkglibdir)/noarch/mkruntime278 rm -f $(DESTDIR)$(npcommondir)/mkruntime
283279
284install: install.dirs install.player install.wrapper install.viewer install.libxpcom install.libnoxshm install.loader install.config280install: install.dirs install.player install.wrapper install.viewer install.libxpcom install.libnoxshm install.loader install.config
285install.dirs:281install.dirs:
286 mkdir -p $(DESTDIR)$(pkglibdir)/noarch282 mkdir -p $(DESTDIR)$(npcommondir) || :
287 mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH)283 mkdir -p $(DESTDIR)$(nphostdir) || :
288 mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)284 mkdir -p $(DESTDIR)$(nptargetdir) || :
289ifneq ($(ARCH),$(ARCH_32))
290 mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH_32)
291 mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)
292endif
293ifeq ($(build_player),yes)285ifeq ($(build_player),yes)
294install.player: $(npplayer_PROGRAM)286install.player: $(npplayer_PROGRAM)
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)
296 mkdir -p $(DESTDIR)$(bindir)288 mkdir -p $(DESTDIR)$(bindir)
297 $(LN_S) $(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM) $(DESTDIR)$(bindir)/nspluginplayer289 $(LN_S) $(nphostdir)/$(npplayer_PROGRAM) $(DESTDIR)$(bindir)/nspluginplayer
298else290else
299install.player:291install.player:
300endif292endif
301install.wrapper: $(npwrapper_LIBRARY)293install.wrapper: $(npwrapper_LIBRARY)
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)
303ifeq ($(build_viewer),yes)295ifeq ($(build_viewer),yes)
304install.viewer: install.viewer.bin install.viewer.glue296install.viewer: install.viewer.bin install.viewer.glue
305install.libxpcom: do.install.libxpcom297install.libxpcom: do.install.libxpcom
@@ -310,26 +302,26 @@
310install.libnoxshm:302install.libnoxshm:
311endif303endif
312install.viewer.bin: $(npviewer_PROGRAM)304install.viewer.bin: $(npviewer_PROGRAM)
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)
314install.viewer.glue::306install.viewer.glue::
315 p=$(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM:%.bin=%); \307 p=$(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM:%.bin=%); \
316 echo "#!/bin/sh" > $$p; \308 echo "#!/bin/sh" > $$p; \
317 echo "TARGET_OS=$(TARGET_OS)" >> $$p; \309 echo "TARGET_OS=$(TARGET_OS)" >> $$p; \
318 echo "TARGET_ARCH=$(TARGET_ARCH)" >> $$p; \310 echo "TARGET_ARCH=$(TARGET_ARCH)" >> $$p; \
319 echo ". $(pkglibdir)/noarch/$(nploader_PROGRAM)" >> $$p; \311 echo ". $(npcommondir)/$(nploader_PROGRAM)" >> $$p; \
320 chmod 755 $$p312 chmod 755 $$p
321do.install.libxpcom: $(libxpcom_LIBRARY)313do.install.libxpcom: $(libxpcom_LIBRARY)
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)
323do.install.libnoxshm: $(libnoxshm_LIBRARY)315do.install.libnoxshm: $(libnoxshm_LIBRARY)
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)
325install.config: $(npconfig_PROGRAM)317install.config: $(npconfig_PROGRAM)
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)
327 mkdir -p $(DESTDIR)$(bindir)319 mkdir -p $(DESTDIR)$(bindir)
328 $(LN_S) $(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM) $(DESTDIR)$(bindir)/nspluginwrapper320 $(LN_S) $(nphostdir)/$(npconfig_PROGRAM) $(DESTDIR)$(bindir)/nspluginwrapper
329install.loader: $(nploader_PROGRAM)321install.loader: $(nploader_PROGRAM)
330 $(INSTALL) -m 755 $(nploader_PROGRAM) $(DESTDIR)$(pkglibdir)/noarch/$(nploader_PROGRAM)322 $(INSTALL) -m 755 $(nploader_PROGRAM) $(DESTDIR)$(npcommondir)/$(nploader_PROGRAM)
331install.mkruntime: $(SRC_PATH)/utils/mkruntime.sh323install.mkruntime: $(SRC_PATH)/utils/mkruntime.sh
332 $(INSTALL) -m 755 $< $(DESTDIR)$(pkglibdir)/noarch/mkruntime324 $(INSTALL) -m 755 $< $(DESTDIR)$(npcommondir)/mkruntime
333325
334$(archivedir)::326$(archivedir)::
335 [ -d $(archivedir) ] || mkdir $(archivedir) > /dev/null 2>&1327 [ -d $(archivedir) ] || mkdir $(archivedir) > /dev/null 2>&1
@@ -342,7 +334,7 @@
342 BUILDDIR=`mktemp -d /tmp/buildXXXXXXXX` ; \334 BUILDDIR=`mktemp -d /tmp/buildXXXXXXXX` ; \
343 mkdir -p $$BUILDDIR/$(PACKAGE)-$(VERSION) ; \335 mkdir -p $$BUILDDIR/$(PACKAGE)-$(VERSION) ; \
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) ; \
345 [ "$(SNAPSHOT)" = "1" ] && svndate_def="%" || svndate_def="#" ; \337 [ "$(SNAPSHOT)" = "2" ] && svndate_def="%" || svndate_def="#" ; \
346 sed -e "s/^[%#]define svndate.*/$${svndate_def}define svndate $(SVNDATE)/" \338 sed -e "s/^[%#]define svndate.*/$${svndate_def}define svndate $(SVNDATE)/" \
347 < $(SRC_PATH)/nspluginwrapper.spec \339 < $(SRC_PATH)/nspluginwrapper.spec \
348 > $$BUILDDIR/$(PACKAGE)-$(VERSION)/nspluginwrapper.spec ; \340 > $$BUILDDIR/$(PACKAGE)-$(VERSION)/nspluginwrapper.spec ; \
@@ -367,7 +359,7 @@
367359
368changelog: ../common/authors.xml360changelog: ../common/authors.xml
369 svn_prefix=`svn info .|sed -n '/^URL *: .*\/svn\/\(.*\)$$/s//\1\//p'`; \361 svn_prefix=`svn info .|sed -n '/^URL *: .*\/svn\/\(.*\)$$/s//\1\//p'`; \
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 || :
371changelog.commit: changelog363changelog.commit: changelog
372 svn commit -m "Generated by svn2cl." ChangeLog364 svn commit -m "Generated by svn2cl." ChangeLog
373365
@@ -413,7 +405,7 @@
413 $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS)405 $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS)
414406
415$(nploader_PROGRAM): $(nploader_SOURCES)407$(nploader_PROGRAM): $(nploader_SOURCES)
416 sed -e "s|%NPW_LIBDIR%|$(pkglibdir)|" $< > $@408 sed -e 's|%NPW_VIEWER_DIR%|$(nptargetdir_var)|' $< > $@
417 chmod 755 $@409 chmod 755 $@
418410
419$(LSB_OBJ_DIR)::411$(LSB_OBJ_DIR)::
420412
=== modified file 'NEWS'
--- NEWS 2009-01-02 10:07:27 +0000
+++ NEWS 2009-08-11 00:38:42 +0000
@@ -1,6 +1,14 @@
1nspluginwrapper NEWS -- history of user-visible changes. 2009-01-021nspluginwrapper NEWS -- history of user-visible changes. 2009-01-02
2Copyright (C) 2005-2009 Gwenole Beauchesne2Copyright (C) 2005-2009 Gwenole Beauchesne
33
4Version 1.3.0 (BETA) - 02.Jan.2009
5* Don't poll for Xt events in Gtk (XEMBED) plug-ins
6* Use 40 Hz timer for Xt events only when necessary (Xt input sources)
7* Add NPIdentifier and NPClass::HasMethod caches, i.e. lower RPC traffic
8* Add support for multiple viewer paths, see --viewer-paths=PATH-EXPR
9* Add basic checks for malloc()'ed buffer underflow/overflow
10* Add checks for single-threaded calls into the browser (NPN_*() functions)
11
4Version 1.2.2 - 02.Jan.200912Version 1.2.2 - 02.Jan.2009
5* Fix support for the VLC plug-in13* Fix support for the VLC plug-in
6* Fix memory deallocation in NPN_GetStringIdentifiers()14* Fix memory deallocation in NPN_GetStringIdentifiers()
@@ -12,7 +20,8 @@
12* Add support for SunStudio compilers20* Add support for SunStudio compilers
13* Add support for Flash Player 10 on OpenSolaris 2008.1121* Add support for Flash Player 10 on OpenSolaris 2008.11
14* Fix build on non-Linux platforms22* Fix build on non-Linux platforms
15* Fix NPP_Destroy() to keep NPP instances longer, but destroy window immediately23* Fix NPP_Destroy() to keep NPP instances longer
24* Fix NPP_Destroy() to destroy the plugin window immediately
1625
17Version 1.1.10 (BETA) - 08.Dec.200826Version 1.1.10 (BETA) - 08.Dec.2008
18* Fix NPPVpluginScriptableNPObject::Invalidate()27* Fix NPPVpluginScriptableNPObject::Invalidate()
1928
=== modified file 'configure'
--- configure 2009-01-02 10:07:27 +0000
+++ configure 2009-08-11 00:38:42 +0000
@@ -19,15 +19,63 @@
19TMPE="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}"19TMPE="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}"
20TMPS="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}.S"20TMPS="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}.S"
2121
22# find source path
23# XXX: we assume an absolute path is given when launching configure,
24# except in './configure' case.
25source_path=${0%configure}
26source_path=${source_path%/}
27source_path_used="yes"
28if test -z "$source_path" -o "$source_path" = "." ; then
29 source_path=`pwd`
30 source_path_used="no"
31fi
32
33# determine versions
34VERSION=`sed < $source_path/$PACKAGE.spec -n '/^\%define version[ ]*/s///p'`
35RELEASE=`sed < $source_path/$PACKAGE.spec -n '/^\%define release[ ]*/s///p'`
36SVNDATE=`sed < $source_path/$PACKAGE.spec -n '/^\%define svndate[ ]*/s///p'`
37if test -z "$SVNDATE"; then
38 SVNDATE=`date '+%Y%m%d'`
39fi
40
41MAJOR_VERSION=`echo "$VERSION"|cut -d'.' -f1`
42MINOR_VERSION=`echo "$VERSION"|cut -d'.' -f2`
43MICRO_VERSION=`echo "$VERSION"|cut -d'.' -f3`
44
45# development snapshots are officially generated tarballs for testing
46# ("odd" minor and micro versions)
47is_odd() {
48 local rem=`expr "$1" % 2`
49 test $rem -eq 1 && return 0 || return 1
50}
51
52if is_odd $MINOR_VERSION || is_odd $MICRO_VERSION; then
53 SNAPSHOT=1
54else
55 SNAPSHOT=0
56fi
57
58# snapshots can also be unofficially generated tarballs
59# (Release: 0.1 in specfile)
60if echo "$RELEASE" | grep -q ^0; then
61 SNAPSHOT=2
62fi
63
64if test $SNAPSHOT -ge 1; then
65 yes_for_snapshots="yes"
66else
67 yes_for_snapshots="no"
68fi
69
22# default parameters70# default parameters
23prefix="/usr"71prefix="/usr"
24lib32=""72lib32=""
25lib64=""73lib64=""
26x_base_dirs=""74x_base_dirs=""
27biarch="guess"
28build_viewer="guess"75build_viewer="guess"
29build_player="yes"76build_player="yes"
30linux_only="guess"77build_generic="guess"
78build_biarch="guess"
31strip="no"79strip="no"
32cc="gcc"80cc="gcc"
33cxx="g++"81cxx="g++"
@@ -37,52 +85,49 @@
37target_cpu="i386"85target_cpu="i386"
38rpc_init_timeout=586rpc_init_timeout=5
39malloc_hooks="glib,libc"87malloc_hooks="glib,libc"
40use_pid_check="no"88enable_malloc_check="$yes_for_snapshots"
41case "$host_cpu" in89enable_thread_check="$yes_for_snapshots"
90
91normalize_cpu() {
92local cpu="$1"
93case "$cpu" in
42arm*)94arm*)
43 host_cpu="arm"95 cpu="arm"
44 ;;96 ;;
45i386|i486|i586|i686|i86pc|BePC)97i[3456]86|k[678]|i86pc|BePC)
46 host_cpu="i386"98 cpu="i386"
47 ;;99 ;;
48ia64)100ia64)
49 host_cpu="ia64"101 cpu="ia64"
50 ;;102 ;;
51"Power Macintosh"|ppc)103"Power Macintosh"|ppc)
52 host_cpu="ppc"104 cpu="ppc"
53 ;;105 ;;
54ppc64)106ppc64)
55 host_cpu="ppc64"107 cpu="ppc64"
56 ;;108 ;;
57sparc)109sparc)
58 host_cpu="sparc"110 cpu="sparc"
59 ;;111 ;;
60sparc64)112sparc64)
61 host_cpu="sparc64"113 cpu="sparc64"
62 ;;114 ;;
63x86_64|amd64)115x86_64|amd64)
64 host_cpu="x86_64"116 cpu="x86_64"
65 ;;
66*)
67 host_cpu="unknown"
68 ;;117 ;;
69esac118esac
70case "$host_os" in119echo "$cpu"
120}
121
122normalize_os() {
123local os="$1"
124case "$os" in
71sunos*)125sunos*)
72 host_os="solaris"126 os="solaris"
73 ;;127 ;;
74esac128esac
75129echo "$os"
76# find source path130}
77# XXX: we assume an absolute path is given when launching configure,
78# except in './configure' case.
79source_path=${0%configure}
80source_path=${source_path%/}
81source_path_used="yes"
82if test -z "$source_path" -o "$source_path" = "." ; then
83 source_path=`pwd`
84 source_path_used="no"
85fi
86131
87for opt do132for opt do
88case "$opt" in133case "$opt" in
@@ -92,14 +137,20 @@
92--pkglibdir=*)137--pkglibdir=*)
93 pkglibdir=`echo "$opt" | cut -d '=' -f 2`138 pkglibdir=`echo "$opt" | cut -d '=' -f 2`
94 ;;139 ;;
140--viewer-paths=*)
141 viewer_paths=`echo "$opt" | cut -d '=' -f 2`
142 ;;
95--target-os=*)143--target-os=*)
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]'`
97 ;;145 ;;
98--target-cpu=*)146--target-cpu=*)
99 target_cpu=`echo "$opt" | cut -d '=' -f 2 | sed -e 's/^i.86$/i386/'`147 target_cpu=`echo "$opt" | cut -d '=' -f 2`
100 ;;148 ;;
101--enable-generic)149--enable-generic)
102 linux_only="no"150 build_generic="yes"
151 ;;
152--disable-generic)
153 build_generic="no"
103 ;;154 ;;
104--enable-strip)155--enable-strip)
105 strip="yes"156 strip="yes"
@@ -108,10 +159,10 @@
108 strip="no"159 strip="no"
109 ;;160 ;;
110--enable-biarch)161--enable-biarch)
111 biarch="yes"162 build_biarch="yes"
112 ;;163 ;;
113--disable-biarch)164--disable-biarch)
114 biarch="no"165 build_biarch="no"
115 ;;166 ;;
116--enable-viewer)167--enable-viewer)
117 build_viewer="yes"168 build_viewer="yes"
@@ -125,11 +176,17 @@
125--disable-player)176--disable-player)
126 build_player="no"177 build_player="no"
127 ;;178 ;;
128--enable-pid-check)179--enable-thread-check)
129 use_pid_check="yes"180 enable_thread_check="yes"
130 ;;181 ;;
131--disable-pid-check)182--disable-thread-check)
132 use_pid_check="no"183 enable_thread_check="no"
184 ;;
185--enable-malloc-check)
186 enable_malloc_check="yes"
187 ;;
188--disable-malloc-check)
189 enable_malloc_check="no"
133 ;;190 ;;
134--with-lib32=*)191--with-lib32=*)
135 lib32=`echo "$opt" | cut -d '=' -f 2`192 lib32=`echo "$opt" | cut -d '=' -f 2`
@@ -155,34 +212,45 @@
155esac212esac
156done213done
157214
215host_cpu=`normalize_cpu "$host_cpu"`
216host_os=`normalize_os "$host_os"`
217target_cpu=`normalize_cpu "$target_cpu"`
218target_os=`normalize_os "$target_os"`
219
158# check for linux only build220# check for linux only build
159if test "$linux_only" = "guess"; then221if test "$build_generic" = "guess"; then
160 if test "$host_os" = "linux" -a "$target_os" = "linux"; then222 if test "$host_os" = "linux" -a "$target_os" = "linux"; then
161 linux_only="yes"223 build_generic="no"
162 else224 else
163 linux_only="no"225 build_generic="yes"
164 fi226 fi
165fi227fi
166228
167# check for biarch build (Linux only)229# check for biarch build (Linux only)
168if test "$biarch" = "guess"; then230# XXX: biarch builds require LSB headers for now
169 # XXX: biarch builds require LSB headers for now231build_biarch_possible="no"
170 biarch="no"232if test "$host_os" = "linux" -a "$target_os" = "linux"; then
171 case $host_cpu:$target_cpu in233 case $host_cpu:$target_cpu in
172 x86_64:i386 | ppc64:ppc)234 x86_64:i386 | ppc64:ppc)
173 if test "$host_os" = "linux"; then235 build_biarch_possible="yes"
174 biarch="yes"
175 fi
176 ;;236 ;;
177 esac237 esac
178fi238fi
239if test "$build_biarch" = "guess"; then
240 build_biarch="$build_biarch_possible"
241elif test "$build_biarch" = "yes"; then
242 if test "$build_biarch_possible" = "no"; then
243 echo "WARNING: bi-arch build is not possible, disabling"
244 build_biarch="no"
245 fi
246fi
179247
180# check for viewer build248# check for viewer build
181if test "$build_viewer" = "guess"; then249if test "$build_viewer" = "guess"; then
182 build_viewer="no"250 build_viewer="no"
183 case $host_os in251 case $host_os in
184 linux)252 linux)
185 if test "$host_cpu" = "$target_cpu" -o "$biarch" = "yes"; then253 if test "$host_cpu" = "$target_cpu" -o "$build_biarch" = "yes"; then
186 build_viewer="yes"254 build_viewer="yes"
187 fi255 fi
188 ;;256 ;;
@@ -224,6 +292,12 @@
224 pkglibdir="$prefix/lib/$PACKAGE"292 pkglibdir="$prefix/lib/$PACKAGE"
225fi293fi
226294
295# check for viewer paths
296default_viewer_paths="$pkglibdir/%ARCH%/%OS%"
297if test -z "$viewer_paths"; then
298 viewer_paths="$default_viewer_paths"
299fi
300
227# check for __attribute__((visibility())) support301# check for __attribute__((visibility())) support
228cat > $TMPC << EOF302cat > $TMPC << EOF
229int foo __attribute__((visibility("hidden"))) = 1;303int foo __attribute__((visibility("hidden"))) = 1;
@@ -280,7 +354,7 @@
280fi354fi
281355
282# check for __stack_chk_fail() in target GNU C library356# check for __stack_chk_fail() in target GNU C library
283if test "$biarch" = "yes"; then357if test "$build_biarch" = "yes"; then
284 glibc_header_dir="/usr/include"358 glibc_header_dir="/usr/include"
285 libc_provides_ssp=no359 libc_provides_ssp=no
286 if test -f $glibc_header_dir/features.h \360 if test -f $glibc_header_dir/features.h \
@@ -370,7 +444,7 @@
370 CFLAGS="$CFLAGS -mtune=generic"444 CFLAGS="$CFLAGS -mtune=generic"
371 fi445 fi
372 fi446 fi
373 if test "$biarch" = "yes" -a -z "$CFLAGS_32"; then447 if test "$build_biarch" = "yes" -a -z "$CFLAGS_32"; then
374 CFLAGS_32="-m32 -O2 -g"448 CFLAGS_32="-m32 -O2 -g"
375 if check_cc_option -mtune=generic $CFLAGS_32; then449 if check_cc_option -mtune=generic $CFLAGS_32; then
376 CFLAGS_32="$CFLAGS_32 -mtune=generic"450 CFLAGS_32="$CFLAGS_32 -mtune=generic"
@@ -596,7 +670,7 @@
596 is_ok="yes"670 is_ok="yes"
597 ;;671 ;;
598 glib)672 glib)
599 if test "x$linux_only" = "xno"; then673 if test "x$build_generic" = "xyes"; then
600 echo "WARNING: disabling glib memory hooks with --enable-generic"674 echo "WARNING: disabling glib memory hooks with --enable-generic"
601 elif ! $pkgconfig --atleast-version=2.10 glib-2.0; then675 elif ! $pkgconfig --atleast-version=2.10 glib-2.0; then
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)"
@@ -631,6 +705,7 @@
631echo " --help print this message"705echo " --help print this message"
632echo " --prefix=PREFIX install in PREFIX [$prefix]"706echo " --prefix=PREFIX install in PREFIX [$prefix]"
633echo " --pkglibdir=ROOT install private files in ROOT [$pkglibdir]"707echo " --pkglibdir=ROOT install private files in ROOT [$pkglibdir]"
708echo " --viewer-paths=PATH allowed viewer lookup PATH [$viewer_paths]"
634echo " --target-os=OS build plugin support for target OS [$target_os]"709echo " --target-os=OS build plugin support for target OS [$target_os]"
635echo " --target-cpu=CPU build plugin support for target CPU [$target_cpu]"710echo " --target-cpu=CPU build plugin support for target CPU [$target_cpu]"
636echo " --enable-viewer build viewer [$build_viewer]"711echo " --enable-viewer build viewer [$build_viewer]"
@@ -639,9 +714,10 @@
639echo "Advanced options (experts only):"714echo "Advanced options (experts only):"
640echo " --source-path=PATH path of source code [$source_path]"715echo " --source-path=PATH path of source code [$source_path]"
641echo " --enable-strip strip resulting binaries and libraries [$strip]"716echo " --enable-strip strip resulting binaries and libraries [$strip]"
642echo " --enable-generic don't use system-specific additions"717echo " --enable-generic build with generic APIs [$build_generic]"
643echo " --enable-biarch build both 32-bit and 64-bit components at once"718echo " --enable-biarch build both 32-bit and 64-bit components at once [$build_biarch]"
644echo " --enable-pid-check enable PID check (DEBUG) [$use_pid_check]"719echo " --enable-thread-check enable main thread checks (DEBUG) [$enable_thread_check]"
720echo " --enable-malloc-check enable memory allocation checks (DEBUG) [$enable_malloc_check]"
645echo " --with-lib32=NAME use NAME as the 32-bit library dir name [$lib32]"721echo " --with-lib32=NAME use NAME as the 32-bit library dir name [$lib32]"
646echo " --with-lib64=NAME use NAME as the 64-bit library dir name [$lib64]"722echo " --with-lib64=NAME use NAME as the 64-bit library dir name [$lib64]"
647echo " --with-x11-prefix=PREFIX use PREFIX as the X11 base dir [autodetect]"723echo " --with-x11-prefix=PREFIX use PREFIX as the X11 base dir [autodetect]"
@@ -654,18 +730,19 @@
654exit 1730exit 1
655fi731fi
656732
733echo "Source path $source_path"
657echo "Install prefix $prefix"734echo "Install prefix $prefix"
658echo "nspluginwrapper root dir $pkglibdir"735echo "nspluginwrapper root dir $pkglibdir"
659echo "Strip binaries $strip"736echo "Viewer paths $viewer_paths"
660echo "Bi-arch build $biarch"
661echo "Build viewer $build_viewer"737echo "Build viewer $build_viewer"
662echo "Build for Linux only $linux_only"
663echo "Build standalone player $build_player"738echo "Build standalone player $build_player"
739echo "Build 32-/64-bit at once $build_biarch"
740echo "Build with generic APIs $build_generic"
664echo "32-bit library dir name $lib32"741echo "32-bit library dir name $lib32"
665echo "64-bit library dir name $lib64"742echo "64-bit library dir name $lib64"
666echo "Source path $source_path"
667echo "C compiler $cc"743echo "C compiler $cc"
668echo "C++ compiler $cxx"744echo "C++ compiler $cxx"
745echo "Strip binaries $strip"
669echo "Host OS $host_os"746echo "Host OS $host_os"
670echo "Host CPU $host_cpu"747echo "Host CPU $host_cpu"
671echo "Host big endian $bigendian"748echo "Host big endian $bigendian"
@@ -673,7 +750,8 @@
673echo "Target CPU $target_cpu"750echo "Target CPU $target_cpu"
674echo "RPC init timeout $rpc_init_timeout secs"751echo "RPC init timeout $rpc_init_timeout secs"
675echo "Memory allocation hooks $malloc_hooks"752echo "Memory allocation hooks $malloc_hooks"
676echo "Use PID check (DEBUG) $use_pid_check"753echo "Use thread checks (DEBUG) $enable_thread_check"
754echo "Use malloc checks (DEBUG) $enable_malloc_check"
677755
678config_mak="config-host.mak"756config_mak="config-host.mak"
679echo "# Automatically generated by configure - do not modify" > $config_mak757echo "# Automatically generated by configure - do not modify" > $config_mak
@@ -691,7 +769,7 @@
691echo "GTK_LDFLAGS=$GTK_LDFLAGS" >> $config_mak769echo "GTK_LDFLAGS=$GTK_LDFLAGS" >> $config_mak
692echo "CURL_CFLAGS=$CURL_CFLAGS" >> $config_mak770echo "CURL_CFLAGS=$CURL_CFLAGS" >> $config_mak
693echo "CURL_LDFLAGS=$CURL_LDFLAGS" >> $config_mak771echo "CURL_LDFLAGS=$CURL_LDFLAGS" >> $config_mak
694if test "$biarch" = "yes"; then772if test "$build_biarch" = "yes"; then
695echo "LDFLAGS_32=-m32" >> $config_mak773echo "LDFLAGS_32=-m32" >> $config_mak
696echo "CFLAGS_32=$CFLAGS_32" >> $config_mak774echo "CFLAGS_32=$CFLAGS_32" >> $config_mak
697else775else
@@ -768,7 +846,7 @@
768echo "SRC_PATH=$source_path" >> $config_mak846echo "SRC_PATH=$source_path" >> $config_mak
769echo "build_viewer=$build_viewer" >> $config_mak847echo "build_viewer=$build_viewer" >> $config_mak
770echo "build_player=$build_player" >> $config_mak848echo "build_player=$build_player" >> $config_mak
771echo "biarch=$biarch" >> $config_mak849echo "build_biarch=$build_biarch" >> $config_mak
772echo "lib32=$lib32" >> $config_mak850echo "lib32=$lib32" >> $config_mak
773echo "lib64=$lib64" >> $config_mak851echo "lib64=$lib64" >> $config_mak
774echo "prefix=$prefix" >> $config_mak852echo "prefix=$prefix" >> $config_mak
@@ -780,21 +858,11 @@
780echo "x11prefix=$x_base_dir" >> $config_mak858echo "x11prefix=$x_base_dir" >> $config_mak
781echo "ALLOW_STRIP=$strip" >> $config_mak859echo "ALLOW_STRIP=$strip" >> $config_mak
782860
783VERSION=`sed < $source_path/$PACKAGE.spec -n '/^\%define version[ ]*/s///p'`
784RELEASE=`sed < $source_path/$PACKAGE.spec -n '/^\%define release[ ]*/s///p'`
785SVNDATE=`sed < $source_path/$PACKAGE.spec -n '/^\%define svndate[ ]*/s///p'`
786if test -z "$SVNDATE"; then
787 SVNDATE=`date '+%Y%m%d'`
788fi
789SNAPSHOT=0
790if echo "$RELEASE" | grep -q ^0; then
791 SNAPSHOT=1
792fi
793echo "VERSION=$VERSION" >> $config_mak861echo "VERSION=$VERSION" >> $config_mak
794echo "SVNDATE=$SVNDATE" >> $config_mak862echo "SVNDATE=$SVNDATE" >> $config_mak
795echo "SNAPSHOT=$SNAPSHOT" >> $config_mak863echo "SNAPSHOT=$SNAPSHOT" >> $config_mak
796echo "#define NPW_SNAPSHOT $SNAPSHOT" >> $config_h864echo "#define NPW_SNAPSHOT $SNAPSHOT" >> $config_h
797if test "$SNAPSHOT" = "1"; then865if test $SNAPSHOT -ge 2; then
798 echo "#define NPW_VERSION \"$VERSION-Pre ($SVNDATE)\"" >> $config_h866 echo "#define NPW_VERSION \"$VERSION-Pre ($SVNDATE)\"" >> $config_h
799else867else
800 echo "#define NPW_VERSION \"$VERSION\"" >> $config_h868 echo "#define NPW_VERSION \"$VERSION\"" >> $config_h
@@ -803,6 +871,26 @@
803echo "pkglibdir=$pkglibdir" >> $config_mak871echo "pkglibdir=$pkglibdir" >> $config_mak
804echo "#define NPW_LIBDIR \"$pkglibdir\"" >> $config_h872echo "#define NPW_LIBDIR \"$pkglibdir\"" >> $config_h
805873
874# check if we want to install files in ARCH/OS specific locations
875if echo ":$viewer_paths" | $EGREP -q ":$pkglibdir/%(ARCH|OS)%"; then
876 npw_common_libdir="$pkglibdir/noarch"
877 npw_host_libdir="$pkglibdir/$host_cpu/$host_os"
878 npw_target_libdir="$pkglibdir/$target_cpu/$target_os"
879 npw_target_libdir_var="$pkglibdir/\\\$\$TARGET_ARCH/\\\$\$TARGET_OS"
880else
881 npw_common_libdir="$pkglibdir"
882 npw_host_libdir="$npw_common_libdir"
883 npw_target_libdir="$npw_common_libdir"
884 npw_target_libdir_var="$npw_common_libdir"
885fi
886echo "npcommondir=$npw_common_libdir" >> $config_mak
887echo "nphostdir=$npw_host_libdir" >> $config_mak
888echo "nptargetdir=$npw_target_libdir" >> $config_mak
889echo "nptargetdir_var=$npw_target_libdir_var" >> $config_mak
890echo "#define NPW_HOST_LIBDIR \"$npw_host_libdir\"" >> $config_h
891echo "#define NPW_TARGET_LIBDIR \"$npw_target_libdir\"" >> $config_h
892echo "#define NPW_VIEWER_PATHS \"$viewer_paths\"" >> $config_h
893
806echo "#define RPC_INIT_TIMEOUT $rpc_init_timeout" >> $config_h894echo "#define RPC_INIT_TIMEOUT $rpc_init_timeout" >> $config_h
807895
808for mh in $malloc_hooks; do896for mh in $malloc_hooks; do
@@ -832,11 +920,29 @@
832else920else
833 echo "#undef TARGET_LIBC_PROVIDES_SSP" >> $config_h921 echo "#undef TARGET_LIBC_PROVIDES_SSP" >> $config_h
834fi922fi
835if test "$use_pid_check" = "yes"; then923if test "$enable_thread_check" = "yes"; then
836 echo "#define USE_PID_CHECK 1" >> $config_h924 echo "#define ENABLE_THREAD_CHECK 1" >> $config_h
837else925else
838 echo "#define USE_PID_CHECK 0" >> $config_h926 echo "#undef ENABLE_THREAD_CHECK" >> $config_h
839fi927fi
928if test "$enable_malloc_check" = "yes"; then
929 echo "#define ENABLE_MALLOC_CHECK 1" >> $config_h
930else
931 echo "#undef ENABLE_MALLOC_CHECK" >> $config_h
932fi
933
934# check for functions in <glib.h>
935for func in g_hash_table_remove_all g_hash_table_find; do
936 cat > $TMPC << EOF
937extern void $func(void);
938int main(void) { $func(); return 0; }
939EOF
940 if $cc $TMPC -o $TMPE $GLIB_CFLAGS $GLIB_LDFLAGS > /dev/null 2>&1; then
941 func_def=`echo "$func" | tr '[:lower:]./-' '[:upper:]___'`
942 echo "#define HAVE_$func_def 1" >> $config_h
943 fi
944 rm -f $TMPC $TMPE
945done
840946
841config_mak="config.mak"947config_mak="config.mak"
842echo "# Automatically generated by configure - do not modify" > $config_mak948echo "# Automatically generated by configure - do not modify" > $config_mak
@@ -846,8 +952,10 @@
846echo "/* Automatically generated by configure - do not modify */" > $config_h952echo "/* Automatically generated by configure - do not modify */" > $config_h
847echo "#include \"config-host.h\"" >> $config_h953echo "#include \"config-host.h\"" >> $config_h
848954
849if test "$linux_only" = "yes"; then955if test "$build_generic" = "yes"; then
850 echo "#define BUILD_LINUX_ONLY 1" >> $config_h956 echo "#define BUILD_GENERIC 1" >> $config_h
957else
958 echo "#undef BUILD_GENERIC" >> $config_h
851fi959fi
852960
853if test "$target_os" = "linux"; then961if test "$target_os" = "linux"; then
854962
=== modified file 'debian/changelog'
--- debian/changelog 2009-04-08 18:38:27 +0000
+++ debian/changelog 2009-08-11 01:50:22 +0000
@@ -1,3 +1,30 @@
1nspluginwrapper (1.3.0-0ubuntu1) karmic; urgency=low
2
3 * New upstream release 1.3.0 (LP: #411740)
4 * Update Maintainer field in debian/control, as proposed by
5 DebianMaintainerField spec
6 * Update debian/patches/000_debian_make_symlinks.diff
7 - change short option for "nosymlinks" from "n" to "x" to avoid collision
8 with option "native"
9 - add option "nosymlinks" to print_usage()
10 * Update debian/patches/003_update_help_info.diff because of change in
11 debian/patches/000_debian_make_symlinks.diff
12 * Update debian/patches/use_syslsb.patch because of different Makefile
13 * Add patch debian/patches/004_system_only_update.diff from Debian
14 version 1.2.2-1
15 * Refresh patches
16
17 -- Sasa Bodiroza <jazzva@gmail.com> Tue, 11 Aug 2009 03:49:59 +0200
18
19nspluginwrapper (1.2.2-0ubuntu6) karmic; urgency=low
20
21 * debian/patches/use_syslsb.patch; dont build LSB libs on our own;
22 this should unbreak flash+nspluginwrapper after latest ia32-libs
23 update
24 + use USE_SYSTEM_LSB accordingly in debian/rules
25
26 -- Alexander Sack <asac@ubuntu.com> Sun, 09 Aug 2009 14:31:49 +0200
27
1nspluginwrapper (1.2.2-0ubuntu5) jaunty; urgency=low28nspluginwrapper (1.2.2-0ubuntu5) jaunty; urgency=low
229
3 * Add iceweasel dir to debian/nspluginwrapper.postinst for removal of30 * Add iceweasel dir to debian/nspluginwrapper.postinst for removal of
431
=== modified file 'debian/control'
--- debian/control 2008-08-27 17:19:36 +0000
+++ debian/control 2009-08-11 00:41:22 +0000
@@ -1,7 +1,7 @@
1Source: nspluginwrapper1Source: nspluginwrapper
2Section: utils2Section: utils
3Priority: optional3Priority: optional
4Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5XSBC-Original-Maintainer: Rob Andrews <rob@choralone.org>5XSBC-Original-Maintainer: Rob Andrews <rob@choralone.org>
6Build-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-dev6Build-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
7Standards-Version: 3.8.07Standards-Version: 3.8.0
88
=== modified file 'debian/patches/000_debian_make_symlinks.diff'
--- debian/patches/000_debian_make_symlinks.diff 2009-03-07 17:43:52 +0000
+++ debian/patches/000_debian_make_symlinks.diff 2009-08-11 01:31:54 +0000
@@ -7,10 +7,10 @@
77
8 -- Rob Andrews <rob@choralone.org> Fri, 29 Jun 2007 21:59:49 +01008 -- Rob Andrews <rob@choralone.org> Fri, 29 Jun 2007 21:59:49 +0100
99
10Index: ubuntu.1.2.2-0ubuntu1/src/npw-config.c10Index: ubuntu/src/npw-config.c
11===================================================================11===================================================================
12--- ubuntu.1.2.2-0ubuntu1.orig/src/npw-config.c 2009-01-03 16:26:07.000000000 +010012--- ubuntu.orig/src/npw-config.c 2009-08-11 01:53:50.000000000 +0200
13+++ ubuntu.1.2.2-0ubuntu1/src/npw-config.c 2009-03-07 18:38:14.000000000 +010013+++ ubuntu/src/npw-config.c 2009-08-11 01:59:54.000000000 +0200
14@@ -44,6 +44,16 @@14@@ -44,6 +44,16 @@
15 static bool g_allow_native = false;15 static bool g_allow_native = false;
16 static const char NPW_CONFIG[] = "nspluginwrapper";16 static const char NPW_CONFIG[] = "nspluginwrapper";
@@ -28,7 +28,7 @@
28 static void error(const char *format, ...)28 static void error(const char *format, ...)
29 {29 {
30 va_list args;30 va_list args;
31@@ -161,7 +171,7 @@31@@ -226,7 +236,7 @@
32 }32 }
33 else if (access("/etc/debian_version", F_OK) == 0) {33 else if (access("/etc/debian_version", F_OK) == 0) {
34 static const char *debian_dirs[] = {34 static const char *debian_dirs[] = {
@@ -37,7 +37,7 @@
37 };37 };
38 dirs = debian_dirs;38 dirs = debian_dirs;
39 }39 }
40@@ -812,6 +822,49 @@40@@ -941,6 +951,49 @@
41 printf(" into %s\n", d_plugin_path);41 printf(" into %s\n", d_plugin_path);
42 42
43 free(plugin_data);43 free(plugin_data);
@@ -87,7 +87,7 @@
87 return 0;87 return 0;
88 }88 }
89 89
90@@ -871,6 +924,48 @@90@@ -1000,6 +1053,48 @@
91 if (unlink(plugin_path) < 0)91 if (unlink(plugin_path) < 0)
92 return 1;92 return 1;
93 93
@@ -136,7 +136,15 @@
136 return 0;136 return 0;
137 }137 }
138 138
139@@ -1033,6 +1128,12 @@139@@ -1141,6 +1236,7 @@
140 printf(" -a --auto flag: set automatic mode for plugins discovery\n");
141 printf(" -n --native flag: allow native plugin(s) to be wrapped\n");
142 printf(" -l --list list plugins currently installed\n");
143+ printf(" -x --nosymlinks do not create symlinks to the installed plugin\n");
144 printf(" -u --update update plugin(s) currently installed\n");
145 printf(" -i --install [FILE(S)] install plugin(s)\n");
146 printf(" -r --remove [FILE(S)] remove plugin(s)\n");
147@@ -1171,6 +1267,12 @@
140 return 0;148 return 0;
141 }149 }
142 150
@@ -149,11 +157,11 @@
149 static int process_list(int argvc, char *argv[])157 static int process_list(int argvc, char *argv[])
150 {158 {
151 const char **plugin_dirs = get_mozilla_plugin_dirs();159 const char **plugin_dirs = get_mozilla_plugin_dirs();
152@@ -1152,6 +1253,7 @@160@@ -1294,6 +1396,7 @@
153 { 'a', "auto", process_auto, 0 },161 { 'a', "auto", process_auto, 0 },
154 { 'n', "native", process_native, 0 },162 { 'n', "native", process_native, 0 },
155 { 'l', "list", process_list, 1 },163 { 'l', "list", process_list, 1 },
156+ { 'n', "nosymlinks", process_nolink, 0 },164+ { 'x', "nosymlinks", process_nolink, 0 },
157 { 'u', "update", process_update, 1 },165 { 'u', "update", process_update, 1 },
158 { 'i', "install", process_install, 1 },166 { 'i', "install", process_install, 1 },
159 { 'r', "remove", process_remove, 1 },167 { 'r', "remove", process_remove, 1 },
160168
=== modified file 'debian/patches/001_remove_bashisms.diff'
--- debian/patches/001_remove_bashisms.diff 2009-03-07 17:43:52 +0000
+++ debian/patches/001_remove_bashisms.diff 2009-08-11 01:00:52 +0000
@@ -3,10 +3,10 @@
33
4 -- Rob Andrews <rob@choralone.org> Thu, 28 Jun 2007 18:08:54 +01004 -- Rob Andrews <rob@choralone.org> Thu, 28 Jun 2007 18:08:54 +0100
55
6Index: ubuntu.1.2.2-0ubuntu1/utils/mkruntime.sh6Index: nspluginwrapper/utils/mkruntime.sh
7===================================================================7===================================================================
8--- ubuntu.1.2.2-0ubuntu1.orig/utils/mkruntime.sh 2009-01-02 11:19:18.000000000 +01008--- nspluginwrapper.orig/utils/mkruntime.sh 2009-08-11 02:41:59.000000000 +0200
9+++ ubuntu.1.2.2-0ubuntu1/utils/mkruntime.sh 2009-03-07 18:38:19.000000000 +01009+++ nspluginwrapper/utils/mkruntime.sh 2009-08-11 02:45:41.000000000 +0200
10@@ -12,15 +12,15 @@10@@ -12,15 +12,15 @@
11 # - Check acroread5, something is missing while loading a PDF11 # - Check acroread5, something is missing while loading a PDF
12 # - Enough for Flash Player & PluginSDK npsimple.so12 # - Enough for Flash Player & PluginSDK npsimple.so
1313
=== modified file 'debian/patches/002_install_to_NSPLUGINDIR.diff'
--- debian/patches/002_install_to_NSPLUGINDIR.diff 2009-03-19 20:47:09 +0000
+++ debian/patches/002_install_to_NSPLUGINDIR.diff 2009-08-11 01:00:52 +0000
@@ -5,11 +5,11 @@
55
6 -- Rob Andrews <rob@choralone.org> Sat, 14 Jul 2007 18:45:00 +01006 -- Rob Andrews <rob@choralone.org> Sat, 14 Jul 2007 18:45:00 +0100
77
8Index: ubuntu.1.2.2-0ubuntu2/src/npw-config.c8Index: nspluginwrapper/src/npw-config.c
9===================================================================9===================================================================
10--- ubuntu.1.2.2-0ubuntu2.orig/src/npw-config.c 2009-03-19 21:33:48.000000000 +010010--- nspluginwrapper.orig/src/npw-config.c 2009-08-11 02:45:38.000000000 +0200
11+++ ubuntu.1.2.2-0ubuntu2/src/npw-config.c 2009-03-19 21:34:02.000000000 +010011+++ nspluginwrapper/src/npw-config.c 2009-08-11 02:45:50.000000000 +0200
12@@ -124,6 +124,10 @@12@@ -189,6 +189,10 @@
13 static const char default_dir[] = LIBDIR "/mozilla/plugins";13 static const char default_dir[] = LIBDIR "/mozilla/plugins";
14 static const char *dir = NULL;14 static const char *dir = NULL;
15 15
@@ -20,7 +20,7 @@
20 if (dir == NULL) {20 if (dir == NULL) {
21 const char **dirs = NULL;21 const char **dirs = NULL;
22 22
23@@ -826,7 +830,8 @@23@@ -955,7 +959,8 @@
24 /* Install symlinks on Debian systems */24 /* Install symlinks on Debian systems */
25 if (has_system_wide_wrapper_plugin(plugin_path, true)25 if (has_system_wide_wrapper_plugin(plugin_path, true)
26 && (access("/etc/debian_version", F_OK) == 0)26 && (access("/etc/debian_version", F_OK) == 0)
2727
=== modified file 'debian/patches/003_update_help_info.diff'
--- debian/patches/003_update_help_info.diff 2009-03-07 17:43:52 +0000
+++ debian/patches/003_update_help_info.diff 2009-08-11 01:31:54 +0000
@@ -2,14 +2,14 @@
22
3 -- Rob Andrews <rob@choralone.org> Sun, 02 Sep 2007 11:58:27 +01003 -- Rob Andrews <rob@choralone.org> Sun, 02 Sep 2007 11:58:27 +0100
44
5Index: ubuntu.1.2.2-0ubuntu1/src/npw-config.c5Index: nspluginwrapper/src/npw-config.c
6===================================================================6===================================================================
7--- ubuntu.1.2.2-0ubuntu1.orig/src/npw-config.c 2009-03-07 18:38:23.000000000 +01007--- nspluginwrapper.orig/src/npw-config.c 2009-08-11 02:46:48.000000000 +0200
8+++ ubuntu.1.2.2-0ubuntu1/src/npw-config.c 2009-03-07 18:38:28.000000000 +01008+++ nspluginwrapper/src/npw-config.c 2009-08-11 02:47:57.000000000 +0200
9@@ -1102,7 +1102,7 @@9@@ -1242,7 +1242,7 @@
10 printf(" -a --auto flag: set automatic mode for plugins discovery\n");
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");
12 printf(" -l --list list plugins currently installed\n");11 printf(" -l --list list plugins currently installed\n");
12 printf(" -x --nosymlinks do not create symlinks to the installed plugin\n");
13- printf(" -u --update update plugin(s) currently installed\n");13- printf(" -u --update update plugin(s) currently installed\n");
14+ printf(" -u --update [FILE(S)] update plugin(s) currently installed\n");14+ printf(" -u --update [FILE(S)] update plugin(s) currently installed\n");
15 printf(" -i --install [FILE(S)] install plugin(s)\n");15 printf(" -i --install [FILE(S)] install plugin(s)\n");
1616
=== modified file 'debian/patches/004_fix_threading.diff'
--- debian/patches/004_fix_threading.diff 2009-03-07 17:43:52 +0000
+++ debian/patches/004_fix_threading.diff 2009-08-11 01:00:52 +0000
@@ -2,10 +2,10 @@
22
3 -- Rob Andrews <rob@choralone.org> Sat, 26 Jan 2008 03:01:31 +00003 -- Rob Andrews <rob@choralone.org> Sat, 26 Jan 2008 03:01:31 +0000
44
5Index: ubuntu.1.2.2-0ubuntu1/Makefile5Index: nspluginwrapper/Makefile
6===================================================================6===================================================================
7--- ubuntu.1.2.2-0ubuntu1.orig/Makefile 2009-01-02 11:19:18.000000000 +01007--- nspluginwrapper.orig/Makefile 2009-08-11 02:41:59.000000000 +0200
8+++ ubuntu.1.2.2-0ubuntu1/Makefile 2009-03-07 18:38:33.000000000 +01008+++ nspluginwrapper/Makefile 2009-08-11 02:49:12.000000000 +0200
9@@ -120,7 +120,7 @@9@@ -120,7 +120,7 @@
10 npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.010 npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0
11 npviewer_CFLAGS += -I$(LSB_INC_DIR)/gtk-2.011 npviewer_CFLAGS += -I$(LSB_INC_DIR)/gtk-2.0
1212
=== added file 'debian/patches/004_system_only_update.diff'
--- debian/patches/004_system_only_update.diff 1970-01-01 00:00:00 +0000
+++ debian/patches/004_system_only_update.diff 2009-08-11 01:31:54 +0000
@@ -0,0 +1,63 @@
1Force npconfig to only update system mozilla plugin dir if requested.
2
3 -- Rob Andrews <rob@choralone.org> Mon, 09 Mar 2009 22:59:45 +0000
4
5Index: nspluginwrapper/src/npw-config.c
6===================================================================
7--- nspluginwrapper.orig/src/npw-config.c 2009-08-11 03:22:31.000000000 +0200
8+++ nspluginwrapper/src/npw-config.c 2009-08-11 03:22:31.000000000 +0200
9@@ -42,6 +42,7 @@
10 static bool g_auto = false;
11 static bool g_verbose = false;
12 static bool g_allow_native = false;
13+static bool g_systemonly = false;
14 static const char NPW_CONFIG[] = "nspluginwrapper";
15
16 /* On Debian systems, we install/remove symlinks from these paths.
17@@ -1239,6 +1240,7 @@
18 printf(" -h --help print this message\n");
19 printf(" -v --verbose flag: set verbose mode\n");
20 printf(" -a --auto flag: set automatic mode for plugins discovery\n");
21+ printf(" -s --systemonly when auto updating, only process the system plugin directory\n");
22 printf(" -n --native flag: allow native plugin(s) to be wrapped\n");
23 printf(" -l --list list plugins currently installed\n");
24 printf(" -x --nosymlinks do not create symlinks to the installed plugin\n");
25@@ -1298,9 +1300,16 @@
26 {
27 int i;
28
29- if (g_auto)
30+ if (g_auto && !g_systemonly)
31 return auto_update_plugins();
32
33+ if (g_auto && g_systemonly)
34+ {
35+ if (g_verbose)
36+ printf("Auto-updating system plugin path.\n");
37+ return process_plugin_dir(get_system_mozilla_plugin_dir(), (is_plugin_cb)is_wrapper_plugin_0, (process_plugin_cb)update_plugin);
38+ }
39+
40 if (argc < 1)
41 error("expected plugin(s) file name to update");
42
43@@ -1371,6 +1380,12 @@
44 return 0;
45 }
46
47+static int process_system_only(int argc, char *argv[])
48+{
49+ g_systemonly = true;
50+ return 0;
51+}
52+
53 int main(int argc, char *argv[])
54 {
55 char **args;
56@@ -1399,6 +1414,7 @@
57 { 'h', "help", process_help, 1 },
58 { 'v', "verbose", process_verbose, 0 },
59 { 'a', "auto", process_auto, 0 },
60+ { 's', "systemonly", process_system_only, 0 },
61 { 'n', "native", process_native, 0 },
62 { 'l', "list", process_list, 1 },
63 { 'x', "nosymlinks", process_nolink, 0 },
064
=== modified file 'debian/patches/005_process_env_dirs.diff'
--- debian/patches/005_process_env_dirs.diff 2009-04-02 14:37:55 +0000
+++ debian/patches/005_process_env_dirs.diff 2009-08-11 01:28:09 +0000
@@ -4,10 +4,10 @@
4Adjust npconfig_CFLAGS in Makefile to include glib during compile.4Adjust npconfig_CFLAGS in Makefile to include glib during compile.
55
6 -- Sasa Bodiroza <jazzva@gmail.com> Wed, 01 Apr 2009 21:50:00 +02006 -- Sasa Bodiroza <jazzva@gmail.com> Wed, 01 Apr 2009 21:50:00 +0200
7Index: ubuntu.1.2.2-0ubuntu3/src/npw-config.c7Index: nspluginwrapper/src/npw-config.c
8===================================================================8===================================================================
9--- ubuntu.1.2.2-0ubuntu3.orig/src/npw-config.c 2009-04-02 16:29:55.000000000 +02009--- nspluginwrapper.orig/src/npw-config.c 2009-08-11 03:22:49.000000000 +0200
10+++ ubuntu.1.2.2-0ubuntu3/src/npw-config.c 2009-04-02 16:32:56.000000000 +020010+++ nspluginwrapper/src/npw-config.c 2009-08-11 03:22:49.000000000 +0200
11@@ -38,6 +38,7 @@11@@ -38,6 +38,7 @@
12 #include <pwd.h>12 #include <pwd.h>
13 #include <dirent.h>13 #include <dirent.h>
@@ -16,7 +16,7 @@
16 16
17 static bool g_auto = false;17 static bool g_auto = false;
18 static bool g_verbose = false;18 static bool g_verbose = false;
19@@ -213,6 +214,21 @@19@@ -279,6 +280,21 @@
20 return plugin_path;20 return plugin_path;
21 }21 }
22 22
@@ -38,7 +38,7 @@
38 static const char **get_mozilla_plugin_dirs(void)38 static const char **get_mozilla_plugin_dirs(void)
39 {39 {
40 static const char *default_dirs[] = {40 static const char *default_dirs[] = {
41@@ -257,13 +273,23 @@41@@ -323,13 +339,23 @@
42 };42 };
43 43
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]));
@@ -63,10 +63,10 @@
63 dirs[j++] = get_user_mozilla_plugin_dir();63 dirs[j++] = get_user_mozilla_plugin_dir();
64 dirs[j] = NULL;64 dirs[j] = NULL;
65 return dirs;65 return dirs;
66Index: ubuntu.1.2.2-0ubuntu3/Makefile66Index: nspluginwrapper/Makefile
67===================================================================67===================================================================
68--- ubuntu.1.2.2-0ubuntu3.orig/Makefile 2009-04-02 16:29:55.000000000 +020068--- nspluginwrapper.orig/Makefile 2009-08-11 03:22:48.000000000 +0200
69+++ ubuntu.1.2.2-0ubuntu3/Makefile 2009-04-02 16:29:55.000000000 +020069+++ nspluginwrapper/Makefile 2009-08-11 03:22:49.000000000 +0200
70@@ -174,7 +174,8 @@70@@ -174,7 +174,8 @@
71 npconfig_RAWSRCS = npw-config.c71 npconfig_RAWSRCS = npw-config.c
72 npconfig_SOURCES = $(npconfig_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)72 npconfig_SOURCES = $(npconfig_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
@@ -77,7 +77,7 @@
77 ifneq (,$(findstring $(OS),netbsd dragonfly))77 ifneq (,$(findstring $(OS),netbsd dragonfly))
78 # We will try to dlopen() the native plugin library. If that lib is78 # We will try to dlopen() the native plugin library. If that lib is
79 # linked against libpthread, then so must our program too.79 # linked against libpthread, then so must our program too.
80@@ -410,7 +411,7 @@80@@ -402,7 +403,7 @@
81 $(CC) -o $@ $(npconfig_OBJECTS) $(npconfig_LDFLAGS)81 $(CC) -o $@ $(npconfig_OBJECTS) $(npconfig_LDFLAGS)
82 82
83 npconfig-%.o: $(SRC_PATH)/src/%.c83 npconfig-%.o: $(SRC_PATH)/src/%.c
@@ -85,4 +85,4 @@
85+ $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS) $(npconfig_CFLAGS)85+ $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS) $(npconfig_CFLAGS)
86 86
87 $(nploader_PROGRAM): $(nploader_SOURCES)87 $(nploader_PROGRAM): $(nploader_SOURCES)
88 sed -e "s|%NPW_LIBDIR%|$(pkglibdir)|" $< > $@88 sed -e 's|%NPW_VIEWER_DIR%|$(nptargetdir_var)|' $< > $@
8989
=== modified file 'debian/patches/series'
--- debian/patches/series 2009-04-01 20:10:03 +0000
+++ debian/patches/series 2009-08-11 01:28:09 +0000
@@ -3,4 +3,6 @@
3002_install_to_NSPLUGINDIR.diff3002_install_to_NSPLUGINDIR.diff
4003_update_help_info.diff4003_update_help_info.diff
5004_fix_threading.diff5004_fix_threading.diff
6004_system_only_update.diff
6005_process_env_dirs.diff7005_process_env_dirs.diff
8use_syslsb.patch
79
=== added file 'debian/patches/use_syslsb.patch'
--- debian/patches/use_syslsb.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/use_syslsb.patch 2009-08-11 01:11:02 +0000
@@ -0,0 +1,126 @@
1---
2 Makefile | 36 ++++++++++++++++++++++++++++++++++++
3 1 file changed, 36 insertions(+)
4
5Index: nspluginwrapper/Makefile
6===================================================================
7--- nspluginwrapper.orig/Makefile 2009-08-11 03:03:59.000000000 +0200
8+++ nspluginwrapper/Makefile 2009-08-11 03:10:00.000000000 +0200
9@@ -79,11 +79,13 @@
10 ARCH_32 = $(ARCH)
11 ifeq ($(build_biarch), yes)
12 ARCH_32 = $(TARGET_ARCH)
13+ifeq (,$(USE_SYSTEM_LSB))
14 LSB_LIBS = $(LSB_OBJ_DIR)/libc.so $(LSB_OBJ_DIR)/libgcc_s_32.so
15 LSB_LIBS += $(LSB_CORE_STUBS:%=$(LSB_OBJ_DIR)/%.so)
16 LSB_LIBS += $(LSB_CORE_STATIC_STUBS:%=$(LSB_OBJ_DIR)/%.a)
17 LSB_LIBS += $(LSB_DESKTOP_STUBS:%=$(LSB_OBJ_DIR)/%.so)
18 endif
19+endif
20
21 LSB_TOP_DIR = $(SRC_PATH)/lsb-build
22 LSB_INC_DIR = $(LSB_TOP_DIR)/headers
23@@ -119,7 +121,11 @@
24 npviewer_CFLAGS += -I$(LSB_INC_DIR)
25 npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0
26 npviewer_CFLAGS += -I$(LSB_INC_DIR)/gtk-2.0
27+ifeq (,$(USE_SYSTEM_LSB))
28 npviewer_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR)
29+else
30+npviewer_LDFLAGS = $(LDFLAGS_32) -L/usr/lib32/
31+endif
32 npviewer_LDFLAGS += -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -ldl -lglib-2.0 -lgthread-2.0 -lX11 -lXt
33 else
34 npviewer_CFLAGS += $(GTK_CFLAGS)
35@@ -157,7 +163,11 @@
36 libxpcom_CFLAGS = $(PIC_CFLAGS)
37 ifeq ($(build_biarch),yes)
38 libxpcom_CFLAGS += -I$(LSB_INC_DIR)
39+ifeq (,$(USE_SYSTEM_LSB))
40 libxpcom_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR)
41+else
42+libxpcom_LDFLAGS = $(LDFLAGS_32) -L/usr/lib32/
43+endif
44 endif
45
46 libnoxshm_LIBRARY = libnoxshm.so
47@@ -167,7 +177,11 @@
48 libnoxshm_CFLAGS = $(PIC_CFLAGS)
49 ifeq ($(biarch),yes)
50 libnoxshm_CFLAGS += -I$(LSB_INC_DIR)
51+ifeq (,$(USE_SYSTEM_LSB))
52 libnoxshm_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR)
53+else
54+libxpcom_LDFLAGS = $(LDFLAGS_32) -L/usr/lib32/
55+endif
56 endif
57
58 npconfig_PROGRAM = npconfig
59@@ -235,6 +249,7 @@
60 FILES += $(addprefix $(LSB_TOP_DIR)/headers/,$(shell cat $(LSB_TOP_DIR)/headers/core_filelist))
61 FILES += $(LSB_TOP_DIR)/headers/desktop_filelist
62 FILES += $(addprefix $(LSB_TOP_DIR)/headers/,$(shell cat $(LSB_TOP_DIR)/headers/desktop_filelist))
63+ifeq (,$(USE_SYSTEM_LSB))
64 FILES += $(LSB_SRC_DIR)/LibNameMap.txt
65 FILES += $(LSB_SRC_DIR)/core_filelist
66 FILES += $(LSB_SRC_DIR)/core_static_filelist
67@@ -244,6 +259,7 @@
68 FILES += $(patsubst %,$(LSB_SRC_DIR)/%.c,$(LSB_CORE_STATIC_STUBS))
69 FILES += $(patsubst %,$(LSB_SRC_DIR)/%.c,$(LSB_DESKTOP_STUBS))
70 FILES += $(patsubst %,$(LSB_SRC_DIR)/%.Version,$(LSB_DESKTOP_STUBS))
71+endif
72
73 all: $(TARGETS)
74
75@@ -370,8 +386,13 @@
76 npwrapper-%.os: $(SRC_PATH)/src/%.c
77 $(CC) -o $@ -c $< $(PIC_CFLAGS) $(CPPFLAGS) $(npwrapper_CFLAGS) -DBUILD_WRAPPER
78
79+ifeq (,$(USE_SYSTEM_LSB))
80 $(npviewer_PROGRAM): $(npviewer_OBJECTS) $(npviewer_MAPFILE) $(LSB_OBJ_DIR) $(LSB_LIBS)
81 $(CC) $(LDFLAGS_32) -o $@ $(npviewer_OBJECTS) $(npviewer_LDFLAGS)
82+else
83+$(npviewer_PROGRAM): $(npviewer_OBJECTS) $(npviewer_MAPFILE)
84+ $(CC) $(LDFLAGS_32) -o $@ $(npviewer_OBJECTS) $(npviewer_LDFLAGS)
85+endif
86
87 npviewer-%.o: $(SRC_PATH)/src/%.c
88 $(CC) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(npviewer_CFLAGS) -DBUILD_VIEWER
89@@ -379,22 +400,37 @@
90 npviewer-%.o: $(SRC_PATH)/src/%.cpp
91 $(CXX) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(npviewer_CFLAGS) -DBUILD_VIEWER
92
93+ifeq (,$(USE_SYSTEM_LSB))
94 $(npplayer_PROGRAM): $(npplayer_OBJECTS) $(npplayer_MAPFILE) $(LSB_OBJ_DIR) $(LSB_LIBS)
95 $(CC) $(LDFLAGS) -o $@ $(npplayer_OBJECTS) $(npplayer_LDFLAGS)
96+else
97+$(npplayer_PROGRAM): $(npplayer_OBJECTS) $(npplayer_MAPFILE)
98+ $(CC) $(LDFLAGS) -o $@ $(npplayer_OBJECTS) $(npplayer_LDFLAGS)
99+endif
100
101 npplayer-%.o: $(SRC_PATH)/src/%.c
102 $(CC) $(CFLAGS) -o $@ -c $< $(CPPFLAGS) $(npplayer_CFLAGS) -DBUILD_PLAYER
103 npplayer-%.o: $(SRC_PATH)/src/tidy/%.c
104 $(CC) $(CFLAGS) -o $@ -c $< $(CPPFLAGS) $(npplayer_CFLAGS) -DBUILD_PLAYER
105
106+ifeq (,$(USE_SYSTEM_LSB))
107 $(libxpcom_LIBRARY): $(libxpcom_OBJECTS) $(LSB_OBJ_DIR) $(LSB_LIBS)
108 $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libxpcom_OBJECTS) $(libxpcom_LDFLAGS) -Wl,$(LD_soname),libxpcom.so
109+else
110+$(libxpcom_LIBRARY): $(libxpcom_OBJECTS)
111+ $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libxpcom_OBJECTS) $(libxpcom_LDFLAGS) -Wl,$(LD_soname),libxpcom.so
112+endif
113
114 libxpcom-%.o: $(SRC_PATH)/src/%.c
115 $(CC) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(libxpcom_CFLAGS) -DBUILD_XPCOM
116
117+ifeq (,$(USE_SYSTEM_LSB))
118 $(libnoxshm_LIBRARY): $(libnoxshm_OBJECTS) $(LSB_OBJ_DIR) $(LSB_LIBS)
119 $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libnoxshm_OBJECTS) $(libnoxshm_LDFLAGS) -Wl,$(LD_soname),libnoxshm.so
120+else
121+$(libnoxshm_LIBRARY): $(libnoxshm_OBJECTS)
122+ $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libnoxshm_OBJECTS) $(libnoxshm_LDFLAGS) -Wl,$(LD_soname),libnoxshm.so
123+endif
124
125 libnoxshm-%.o: $(SRC_PATH)/src/%.c
126 $(CC) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(libnoxshm_CFLAGS)
0127
=== modified file 'debian/rules' (properties changed: +x to -x)
--- debian/rules 2008-08-27 01:07:14 +0000
+++ debian/rules 2009-08-11 00:37:05 +0000
@@ -49,7 +49,7 @@
49build: configure build-stamp49build: configure build-stamp
50build-stamp:50build-stamp:
51 dh_testdir51 dh_testdir
52 $(MAKE)52 $(MAKE) USE_SYSTEM_LSB=1
53 touch $@53 touch $@
5454
55clean: clean-patched unpatch55clean: clean-patched unpatch
@@ -65,7 +65,7 @@
65 dh_testroot65 dh_testroot
66 dh_clean -k66 dh_clean -k
67 dh_installdirs67 dh_installdirs
68 $(MAKE) DESTDIR=$(CURDIR)/debian/nspluginwrapper install68 $(MAKE) USE_SYSTEM_LSB=1 DESTDIR=$(CURDIR)/debian/nspluginwrapper install
6969
7070
71# Build architecture-independent files here.71# Build architecture-independent files here.
7272
=== modified file 'lsb-build/headers/glib-2.0/glib.h'
--- lsb-build/headers/glib-2.0/glib.h 2008-10-15 15:29:08 +0000
+++ lsb-build/headers/glib-2.0/glib.h 2009-08-11 00:38:42 +0000
@@ -2642,6 +2642,7 @@
2642 extern GHashTable *g_hash_table_new(GHashFunc, GEqualFunc);2642 extern GHashTable *g_hash_table_new(GHashFunc, GEqualFunc);
2643 extern const gchar *g_dir_read_name(GDir *);2643 extern const gchar *g_dir_read_name(GDir *);
2644 extern gboolean g_hash_table_remove(GHashTable *, gconstpointer);2644 extern gboolean g_hash_table_remove(GHashTable *, gconstpointer);
2645 extern void g_hash_table_remove_all(GHashTable *);
2645 extern gchar *g_utf8_strdown(const gchar *, gssize);2646 extern gchar *g_utf8_strdown(const gchar *, gssize);
2646 extern GIOCondition g_io_channel_get_buffer_condition(GIOChannel *);2647 extern GIOCondition g_io_channel_get_buffer_condition(GIOChannel *);
2647 extern GSource *g_child_watch_source_new(GPid);2648 extern GSource *g_child_watch_source_new(GPid);
26482649
=== modified file 'lsb-build/stub_libs/libglib-2.0.c'
--- lsb-build/stub_libs/libglib-2.0.c 2008-10-15 15:29:08 +0000
+++ lsb-build/stub_libs/libglib-2.0.c 2009-08-11 00:38:42 +0000
@@ -195,6 +195,7 @@
195void g_hash_table_new() {} ;195void g_hash_table_new() {} ;
196void g_hash_table_new_full() {} ;196void g_hash_table_new_full() {} ;
197void g_hash_table_remove() {} ;197void g_hash_table_remove() {} ;
198void g_hash_table_remove_all() {} ;
198void g_hash_table_replace() {} ;199void g_hash_table_replace() {} ;
199void g_hash_table_size() {} ;200void g_hash_table_size() {} ;
200void g_hash_table_steal() {} ;201void g_hash_table_steal() {} ;
201202
=== modified file 'nspluginwrapper.spec'
--- nspluginwrapper.spec 2009-01-02 10:07:27 +0000
+++ nspluginwrapper.spec 2009-08-11 00:38:42 +0000
@@ -1,7 +1,7 @@
1%define name nspluginwrapper1%define name nspluginwrapper
2%define version 1.2.22%define version 1.3.0
3%define release 13%define release 1
4#define svndate DATE4#define svndate 20090102
55
6# define 32-bit arch of multiarch platforms6# define 32-bit arch of multiarch platforms
7%define arch_32 %{nil}7%define arch_32 %{nil}
@@ -159,7 +159,7 @@
159%{plugindir}/npwrapper.so159%{plugindir}/npwrapper.so
160%dir %{pkglibdir}160%dir %{pkglibdir}
161%dir %{pkglibdir}/noarch161%dir %{pkglibdir}/noarch
162%{pkglibdir}/noarch/npviewer162%{pkglibdir}/noarch/npviewer.sh
163%dir %{pkglibdir}/%{_arch}163%dir %{pkglibdir}/%{_arch}
164%dir %{pkglibdir}/%{_arch}/%{_os}164%dir %{pkglibdir}/%{_arch}/%{_os}
165%{pkglibdir}/%{_arch}/%{_os}/npconfig165%{pkglibdir}/%{_arch}/%{_os}/npconfig
@@ -191,6 +191,14 @@
191%endif191%endif
192192
193%changelog193%changelog
194* Fri Jan 02 2009 Gwenole Beauchesne <gb.public@free.fr> 1.3.0-1
195- don't poll for Xt events in Gtk (XEMBED) plug-ins
196- use 40 Hz timer for Xt events only when necessary (Xt input sources)
197- add NPIdentifier and NPClass::HasMethod caches, i.e. lower RPC traffic
198- add support for multiple viewer paths, see --viewer-paths=PATH-EXPR
199- add basic checks for malloc()'ed buffer underflow/overflow
200- add checks for single-threaded calls into the browser (NPN_*() functions)
201
194* Fri Jan 02 2009 Gwenole Beauchesne <gb.public@free.fr> 1.2.2-1202* Fri Jan 02 2009 Gwenole Beauchesne <gb.public@free.fr> 1.2.2-1
195- fix support for the VLC plug-in203- fix support for the VLC plug-in
196- fix memory deallocation in NPN_GetStringIdentifiers()204- fix memory deallocation in NPN_GetStringIdentifiers()
197205
=== modified file 'src/npruntime-impl.h'
--- src/npruntime-impl.h 2009-01-02 10:07:27 +0000
+++ src/npruntime-impl.h 2009-08-11 00:38:42 +0000
@@ -27,6 +27,7 @@
27 uint32_t npobj_id;27 uint32_t npobj_id;
28 bool is_valid;28 bool is_valid;
29 void *plugin;29 void *plugin;
30 void *hasMethod_cache;
30} NPObjectInfo;31} NPObjectInfo;
3132
32extern NPObjectInfo *npobject_info_new(NPObject *npobj) attribute_hidden;33extern NPObjectInfo *npobject_info_new(NPObject *npobj) attribute_hidden;
@@ -59,6 +60,10 @@
59extern void print_npvariant_args(const struct _NPVariant *args, uint32_t nargs) attribute_hidden;60extern void print_npvariant_args(const struct _NPVariant *args, uint32_t nargs) attribute_hidden;
6061
61// Deactivate all NPObject instances62// Deactivate all NPObject instances
62extern void npruntime_deactivate(void);63extern void npruntime_deactivate(void) attribute_hidden;
64
65// Check whether to use NPRuntime data caching
66// (on by default, disabled with NPW_NPRUNTIME_CACHE=0|no)
67extern bool npruntime_use_cache(void) attribute_hidden;
6368
64#endif /* NPRUNTIME_IMPL_H */69#endif /* NPRUNTIME_IMPL_H */
6570
=== modified file 'src/npruntime.c'
--- src/npruntime.c 2009-01-02 10:07:27 +0000
+++ src/npruntime.c 2009-08-11 00:38:42 +0000
@@ -30,15 +30,55 @@
30#include "debug.h"30#include "debug.h"
3131
3232
33// Define to enable NPClass::HasMethod cache
34#define USE_NPCLASS_HAS_METHOD_CACHE 1
35
36// Define to enable NPClass::HasProperty cache (derived from ::HasMethod cache)
37#define USE_NPCLASS_HAS_PROPERTY_CACHE 1
38
33// Defined in npw-{wrapper,viewer}.c39// Defined in npw-{wrapper,viewer}.c
34extern rpc_connection_t *g_rpc_connection attribute_hidden;40extern rpc_connection_t *g_rpc_connection attribute_hidden;
3541
36// Defined in npw-viewer.c42// Defined in npw-viewer.c
37#if USE_PID_CHECK && NPW_IS_PLUGIN43#if defined(ENABLE_THREAD_CHECK) && NPW_IS_PLUGIN
38extern bool pid_check(void);44extern bool thread_check(void);
39#else45#else
40#define pid_check() true46#define thread_check() true
41#endif47#endif
48
49
50/* ====================================================================== */
51/* === Helpers === */
52/* ====================================================================== */
53
54static inline bool get_use_npruntime_cache_env(void)
55{
56 const gchar *env = getenv("NPW_NPRUNTIME_CACHE");
57 return env == NULL || (strcmp(env, "no") != 0 && strcmp(env, "0") != 0);
58}
59
60bool npruntime_use_cache(void)
61{
62 static int use_cache = -1;
63 if (G_UNLIKELY(use_cache < 0))
64 use_cache = get_use_npruntime_cache_env();
65 return use_cache;
66}
67
68static inline bool use_npclass_has_method_cache(void)
69{
70#if USE_NPCLASS_HAS_METHOD_CACHE
71 return npruntime_use_cache();
72#else
73 return false;
74#endif
75}
76
77static inline bool use_npclass_has_property_cache(void)
78{
79 /* this depends on the NPClass::HasMethod cache */
80 return use_npclass_has_method_cache();
81}
4282
4383
44/* ====================================================================== */84/* ====================================================================== */
@@ -131,8 +171,8 @@
131 if (!is_valid_npobject_class(npobj))171 if (!is_valid_npobject_class(npobj))
132 return;172 return;
133173
134 if (!pid_check()) {174 if (!thread_check()) {
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");
136 return;176 return;
137 }177 }
138178
@@ -196,18 +236,34 @@
196 return ret;236 return ret;
197}237}
198238
239static bool npclass_cached_HasMethod(NPObject *npobj, NPIdentifier name)
240{
241 NPObjectInfo *npobj_info = npobject_info_lookup(npobj);
242 if (use_npclass_has_method_cache() && npobj_info) {
243 if (G_UNLIKELY(npobj_info->hasMethod_cache == NULL))
244 npobj_info->hasMethod_cache = g_hash_table_new(NULL, NULL);
245 gpointer hasMethod = NULL;
246 if (g_hash_table_lookup_extended(npobj_info->hasMethod_cache, name, NULL, &hasMethod))
247 return GPOINTER_TO_UINT(hasMethod);
248 }
249 bool hasMethod = npclass_invoke_HasMethod(npobj, name);
250 if (use_npclass_has_method_cache() && npobj_info)
251 g_hash_table_insert(npobj_info->hasMethod_cache, name, GUINT_TO_POINTER(hasMethod));
252 return hasMethod;
253}
254
199bool g_NPClass_HasMethod(NPObject *npobj, NPIdentifier name)255bool g_NPClass_HasMethod(NPObject *npobj, NPIdentifier name)
200{256{
201 if (!is_valid_npobject_class(npobj))257 if (!is_valid_npobject_class(npobj))
202 return false;258 return false;
203259
204 if (!pid_check()) {260 if (!thread_check()) {
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");
206 return false;262 return false;
207 }263 }
208264
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));
210 bool ret = npclass_invoke_HasMethod(npobj, name);266 bool ret = npclass_cached_HasMethod(npobj, name);
211 D(bugiD("NPClass::HasMethod return: %d\n", ret));267 D(bugiD("NPClass::HasMethod return: %d\n", ret));
212 return ret;268 return ret;
213}269}
@@ -300,8 +356,8 @@
300 if (!is_valid_npobject_class(npobj))356 if (!is_valid_npobject_class(npobj))
301 return false;357 return false;
302358
303 if (!pid_check()) {359 if (!thread_check()) {
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");
305 return false;361 return false;
306 }362 }
307363
@@ -399,8 +455,8 @@
399 if (!is_valid_npobject_class(npobj))455 if (!is_valid_npobject_class(npobj))
400 return false;456 return false;
401457
402 if (!pid_check()) {458 if (!thread_check()) {
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");
404 return false;460 return false;
405 }461 }
406462
@@ -468,18 +524,29 @@
468 return ret;524 return ret;
469}525}
470526
527static bool npclass_cached_HasProperty(NPObject *npobj, NPIdentifier name)
528{
529 NPObjectInfo *npobj_info = npobject_info_lookup(npobj);
530 if (use_npclass_has_property_cache() && npobj_info && npobj_info->hasMethod_cache) {
531 /* If the NPIdentifier references a method, it can't be a property */
532 if (g_hash_table_lookup_extended(npobj_info->hasMethod_cache, name, NULL, NULL))
533 return false;
534 }
535 return npclass_invoke_HasProperty(npobj, name);
536}
537
471bool g_NPClass_HasProperty(NPObject *npobj, NPIdentifier name)538bool g_NPClass_HasProperty(NPObject *npobj, NPIdentifier name)
472{539{
473 if (!is_valid_npobject_class(npobj))540 if (!is_valid_npobject_class(npobj))
474 return false;541 return false;
475542
476 if (!pid_check()) {543 if (!thread_check()) {
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");
478 return false;545 return false;
479 }546 }
480547
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));
482 bool ret = npclass_invoke_HasProperty(npobj, name);549 bool ret = npclass_cached_HasProperty(npobj, name);
483 D(bugiD("NPClass::HasProperty return: %d\n", ret));550 D(bugiD("NPClass::HasProperty return: %d\n", ret));
484 return ret;551 return ret;
485}552}
@@ -559,8 +626,8 @@
559 if (!is_valid_npobject_class(npobj))626 if (!is_valid_npobject_class(npobj))
560 return false;627 return false;
561628
562 if (!pid_check()) {629 if (!thread_check()) {
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");
564 return false;631 return false;
565 }632 }
566633
@@ -645,8 +712,8 @@
645 if (!is_valid_npobject_class(npobj))712 if (!is_valid_npobject_class(npobj))
646 return false;713 return false;
647714
648 if (!pid_check()) {715 if (!thread_check()) {
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");
650 return false;717 return false;
651 }718 }
652719
@@ -716,8 +783,8 @@
716 if (!is_valid_npobject_class(npobj))783 if (!is_valid_npobject_class(npobj))
717 return false;784 return false;
718785
719 if (!pid_check()) {786 if (!thread_check()) {
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");
721 return false;788 return false;
722 }789 }
723 790
@@ -734,22 +801,31 @@
734801
735NPObjectInfo *npobject_info_new(NPObject *npobj)802NPObjectInfo *npobject_info_new(NPObject *npobj)
736{803{
737 NPObjectInfo *npobj_info = NPW_MemNew0(NPObjectInfo, 1);804 NPObjectInfo *npobj_info = NPW_MemNew(NPObjectInfo, 1);
738 if (npobj_info) {805 if (npobj_info) {
739 static uint32_t id;806 static uint32_t id;
740 npobj_info->npobj = npobj;807 npobj_info->npobj = npobj;
741 npobj_info->npobj_id = ++id;808 npobj_info->npobj_id = ++id;
742 npobj_info->is_valid = true;809 npobj_info->is_valid = true;
810 npobj_info->plugin = NULL;
811 npobj_info->hasMethod_cache = NULL;
743 }812 }
744 return npobj_info;813 return npobj_info;
745}814}
746815
747void npobject_info_destroy(NPObjectInfo *npobj_info)816void npobject_info_destroy(NPObjectInfo *npobj_info)
748{817{
749 if (npobj_info) {818 if (npobj_info == NULL)
750 npw_plugin_instance_unref(npobj_info->plugin);819 return;
751 NPW_MemFree(npobj_info);820
821 npw_plugin_instance_unref(npobj_info->plugin);
822
823 if (npobj_info->hasMethod_cache) {
824 g_hash_table_destroy(npobj_info->hasMethod_cache);
825 npobj_info->hasMethod_cache = NULL;
752 }826 }
827
828 NPW_MemFree(npobj_info);
753}829}
754830
755831
756832
=== modified file 'src/npw-config.c'
--- src/npw-config.c 2009-01-02 10:12:06 +0000
+++ src/npw-config.c 2009-08-11 00:40:05 +0000
@@ -71,6 +71,71 @@
71 return 1;71 return 1;
72}72}
7373
74static const char *strnstr(const char *str, int len, const char *substr)
75{
76 const char *match = strstr(str, substr);
77 if (len > 0 && (match + strlen(substr) > str + len))
78 match = NULL;
79 return match;
80}
81
82typedef struct {
83 const char *name;
84 const char *value;
85} Var;
86
87static int strexpand(char *dst, int dstlen, const char *src, int srclen, const Var *vars)
88{
89 if (dst == NULL || dstlen < 1 || src == NULL)
90 return -1;
91
92 if (srclen <= 0)
93 srclen = strlen(src);
94
95 int n = 0;
96 for (int i = 0; i < srclen; i++) {
97 char ch = src[i];
98 if (ch != '%') {
99 dst[n++] = ch;
100 if (n >= dstlen - 1)
101 return -1;
102 }
103 else {
104 char var[16];
105 const char *str = &src[i + 1];
106 const char *end = strchr(str, '%');
107 if (end == NULL)
108 error("unterminated var '%s'", str);
109
110 int len = end - str;
111 if (len >= sizeof(var) - 1) {
112 len = sizeof(var) - 1;
113 memcpy(var, str, len);
114 var[len] = '\0';
115 error("unsupported var '%s...'", var);
116 }
117 memcpy(var, str, len);
118 var[len] = '\0';
119
120 str = NULL;
121 for (int j = 0; vars[j].name != NULL; j++) {
122 if (strcmp(vars[j].name, var) == 0) {
123 str = vars[j].value;
124 break;
125 }
126 }
127 if (str == NULL)
128 error("could not expand var '%s'", var);
129 i += len + 1;
130 len = strlen(str);
131 memcpy(&dst[n], str, len);
132 n += len;
133 }
134 }
135 dst[n] = '\0';
136 return 0;
137}
138
74/* Implement mkdir -p with default permissions (derived from busybox code) */139/* Implement mkdir -p with default permissions (derived from busybox code) */
75static int mkdir_p(const char *path)140static int mkdir_p(const char *path)
76{141{
@@ -489,6 +554,30 @@
489 EXIT_VIEWER_NATIVE = 20554 EXIT_VIEWER_NATIVE = 20
490};555};
491556
557static bool is_plugin_viewer_ok(const char *viewer_path, const char *filename)
558{
559 int pid = fork();
560 if (pid < 0)
561 return false;
562 if (pid == 0) {
563 if (!g_verbose) {
564 // don't spit out errors in non-verbose mode, we only need
565 // to know whether there is a valid viewer or not
566 freopen("/dev/null", "w", stderr);
567 }
568 execl(viewer_path, NPW_VIEWER, "--test", "--plugin", filename, NULL);
569 exit(1);
570 }
571 else {
572 int status;
573 while (waitpid(pid, &status, 0) != pid)
574 ;
575 if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
576 return true;
577 }
578 return false;
579}
580
492static int detect_plugin_viewer(const char *filename, NPW_PluginInfo *out_plugin_info)581static int detect_plugin_viewer(const char *filename, NPW_PluginInfo *out_plugin_info)
493{582{
494 static const char *target_arch_table[] = {583 static const char *target_arch_table[] = {
@@ -522,52 +611,60 @@
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)
523 return EXIT_VIEWER_NATIVE;612 return EXIT_VIEWER_NATIVE;
524613
525 for (int i = 0; i < target_arch_table_size; i++) {614 enum { VAR_ARCH, VAR_OS, VAR_COUNT };
526 const char *target_arch = target_arch_table[i];615 Var vars[VAR_COUNT+1];
527 if (target_arch == NULL)616 vars[VAR_ARCH].name = "ARCH";
528 continue;617 vars[VAR_OS].name = "OS";
529 char viewer_arch_path[PATH_MAX];618 vars[VAR_COUNT].name = NULL;
530 sprintf(viewer_arch_path, "%s/%s", NPW_LIBDIR, target_arch);619 vars[VAR_COUNT].value = NULL;
531 if (access(viewer_arch_path, F_OK) != 0) {620
532 target_arch_table[i] = NULL; // this target ARCH is not available, skip it for good621 char viewer_path[sizeof(out_plugin_info->viewer_path)];
533 continue;622 const int viewer_path_len = sizeof(viewer_path) - strlen(NPW_VIEWER) - 1;
534 }623 const char viewer_paths[] = NPW_VIEWER_PATHS;
535 for (int j = 0; j < target_os_table_size; j++) {624 const char *viewer_path_spec_end, *viewer_path_spec = viewer_paths;
536 const char *target_os = target_os_table[j];625 do {
537 if (target_os == NULL)626 int len;
538 continue;627 if ((viewer_path_spec_end = strchr(viewer_path_spec, ':')) != NULL)
539 char viewer_path[PATH_MAX];628 len = viewer_path_spec_end - viewer_path_spec;
540 sprintf(viewer_path, "%s/%s/%s", viewer_arch_path, target_os, NPW_VIEWER);629 else
541 if (access(viewer_path, F_OK) != 0)630 len = strchr(viewer_path_spec, '\0') - viewer_path_spec;
542 continue;631
543 int pid = fork();632 for (int i = 0; i < target_arch_table_size; i++) {
544 if (pid < 0)633 const char *target_arch = target_arch_table[i];
545 continue;634 if (target_arch == NULL)
546 else if (pid == 0) {635 continue;
547 if (!g_verbose) {636 vars[VAR_ARCH].value = target_arch;
548 // don't spit out errors in non-verbose mode, we only need637
549 // to know whether there is a valid viewer or not638 for (int j = 0; j < target_os_table_size; j++) {
550 freopen("/dev/null", "w", stderr);639 const char *target_os = target_os_table[j];
551 }640 if (target_os == NULL)
552 execl(viewer_path, NPW_VIEWER, "--test", "--plugin", filename, NULL);641 continue;
553 exit(1);642 vars[VAR_OS].value = target_os;
554 }643
555 else {644 if (strexpand(viewer_path, viewer_path_len, viewer_path_spec, len, vars) < 0)
556 int status;645 continue;
557 while (waitpid(pid, &status, 0) != pid)646 strcat(viewer_path, "/" NPW_VIEWER);
558 ;647 if (access(viewer_path, F_OK) != 0)
559 if (WIFEXITED(status)) {648 continue;
560 status = WEXITSTATUS(status);649
561 if (status == EXIT_VIEWER_OK && out_plugin_info) {650 if (is_plugin_viewer_ok(viewer_path, filename)) {
562 strcpy(out_plugin_info->target_arch, target_arch);651 strcpy(out_plugin_info->target_arch, target_arch);
563 strcpy(out_plugin_info->target_os, target_os);652 strcpy(out_plugin_info->target_os, target_os);
564 }653 strcpy(out_plugin_info->viewer_path, viewer_path);
565 return status;654 return EXIT_VIEWER_OK;
566 }655 }
567 return EXIT_VIEWER_ERROR;656
568 }657 if (strnstr(viewer_path_spec, len, "%OS%") == NULL)
569 }658 break; // don't iterate over OS table if there is no "%OS%" pattern
570 }659 }
660
661 if (strnstr(viewer_path_spec, len, "%ARCH%") == NULL)
662 break; // don't iterate over ARCH table if there is no "%ARCH%" pattern
663 }
664
665 viewer_path_spec += len + 1;
666 } while (viewer_path_spec_end != NULL);
667
571 return EXIT_VIEWER_NOT_FOUND;668 return EXIT_VIEWER_NOT_FOUND;
572}669}
573670
@@ -604,15 +701,27 @@
604 if ((pi = (NPW_PluginInfo *)dlsym(handle, "NPW_Plugin")) == NULL)701 if ((pi = (NPW_PluginInfo *)dlsym(handle, "NPW_Plugin")) == NULL)
605 return false;702 return false;
606 if (out_plugin_info) {703 if (out_plugin_info) {
704 int plugin_info_version = 0;
705 if (strncmp(pi->ident, "NPW:0.9.90", 10) != 0)
706 plugin_info_version = 1;
707 if (strncmp(pi->ident, "NPW:X:", 6) == 0)
708 plugin_info_version = pi->struct_version;
709 out_plugin_info->struct_version = plugin_info_version;
607 strcpy(out_plugin_info->ident, pi->ident);710 strcpy(out_plugin_info->ident, pi->ident);
608 strcpy(out_plugin_info->path, pi->path);711 strcpy(out_plugin_info->path, pi->path);
609 out_plugin_info->mtime = pi->mtime;712 out_plugin_info->mtime = pi->mtime;
610 out_plugin_info->target_arch[0] = '\0';713 if (plugin_info_version >= 1) { // additional members in 0.9.91+
611 out_plugin_info->target_os[0] = '\0';
612 if (strncmp(pi->ident, "NPW:0.9.90", 10) != 0) { // additional members in 0.9.91+
613 strcpy(out_plugin_info->target_arch, pi->target_arch);714 strcpy(out_plugin_info->target_arch, pi->target_arch);
614 strcpy(out_plugin_info->target_os, pi->target_os);715 strcpy(out_plugin_info->target_os, pi->target_os);
615 }716 }
717 else {
718 out_plugin_info->target_arch[0] = '\0';
719 out_plugin_info->target_os[0] = '\0';
720 }
721 if (plugin_info_version >= 2) // additional members in 1.3.0+
722 strcpy(out_plugin_info->viewer_path, pi->viewer_path);
723 else
724 out_plugin_info->viewer_path[0] = '\0';
616 }725 }
617 return true;726 return true;
618}727}
@@ -628,12 +737,26 @@
628 return ret;737 return ret;
629}738}
630739
740static bool is_master_wrapper_plugin(const char *plugin_path)
741{
742 static const char *master_plugin_paths[] = {
743 NPW_LIBDIR "/" HOST_ARCH "/" NPW_WRAPPER,
744 NPW_LIBDIR "/" HOST_ARCH "/" HOST_OS "/" NPW_WRAPPER,
745 NPW_DEFAULT_PLUGIN_PATH,
746 NULL
747 };
748 for (int i = 0; master_plugin_paths[i] != NULL; i++) {
749 if (strcmp(master_plugin_paths[i], plugin_path) == 0)
750 return true;
751 }
752 return false;
753}
754
631static bool is_wrapper_plugin_0(const char *plugin_path)755static bool is_wrapper_plugin_0(const char *plugin_path)
632{756{
633 NPW_PluginInfo plugin_info;757 NPW_PluginInfo plugin_info;
634 return is_wrapper_plugin(plugin_path, &plugin_info)758 return is_wrapper_plugin(plugin_path, &plugin_info)
635 && strcmp(plugin_info.path, NPW_DEFAULT_PLUGIN_PATH) != 0 // exclude OS/ARCH npwrapper.so759 && !is_master_wrapper_plugin(plugin_path);
636 && strcmp(plugin_info.path, NPW_OLD_DEFAULT_PLUGIN_PATH) != 0; // exclude ARCH npwrapper.so
637}760}
638761
639static bool has_system_wide_wrapper_plugin(const char *plugin_path, bool check_ident)762static bool has_system_wide_wrapper_plugin(const char *plugin_path, bool check_ident)
@@ -789,11 +912,17 @@
789 if (!is_plugin_viewer_available(plugin_path, plugin_info))912 if (!is_plugin_viewer_available(plugin_path, plugin_info))
790 return 15;913 return 15;
791 }914 }
915 if (plugin_info->viewer_path[0] == '\0') {
916 if (!is_plugin_viewer_available(plugin_path, plugin_info))
917 return 16;
918 }
792919
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);
794 pi->mtime = st.st_mtime;921 pi->mtime = st.st_mtime;
795 strcpy(pi->target_arch, plugin_info->target_arch);922 strcpy(pi->target_arch, plugin_info->target_arch);
796 strcpy(pi->target_os, plugin_info->target_os);923 strcpy(pi->target_os, plugin_info->target_os);
924 pi->struct_version = w_plugin_info.struct_version;
925 strcpy(pi->viewer_path, plugin_info->viewer_path);
797926
798 int mode = 0700;927 int mode = 0700;
799 if (!is_user_home_path(d_plugin_path) &&928 if (!is_user_home_path(d_plugin_path) &&
@@ -902,6 +1031,7 @@
9021031
903 int ret = 0;1032 int ret = 0;
904 NPW_PluginInfo plugin_info;1033 NPW_PluginInfo plugin_info;
1034 memset(&plugin_info, 0, sizeof(plugin_info));
905 is_wrapper_plugin(plugin_path, &plugin_info);1035 is_wrapper_plugin(plugin_path, &plugin_info);
9061036
907 struct stat st;1037 struct stat st;
@@ -968,13 +1098,21 @@
968static int list_plugin(const char *plugin_path)1098static int list_plugin(const char *plugin_path)
969{1099{
970 NPW_PluginInfo plugin_info;1100 NPW_PluginInfo plugin_info;
1101 memset(&plugin_info, 0, sizeof(plugin_info));
971 is_wrapper_plugin(plugin_path, &plugin_info);1102 is_wrapper_plugin(plugin_path, &plugin_info);
9721103
973 printf("%s\n", plugin_path);1104 printf("%s\n", plugin_path);
974 printf(" Original plugin: %s\n", plugin_info.path);1105 printf(" Original plugin: %s\n", plugin_info.path);
1106 if (plugin_info.struct_version >= 2 && plugin_info.viewer_path[0] != '\0')
1107 printf(" Plugin viewer: %s\n", plugin_info.viewer_path);
975 char *str = strtok(plugin_info.ident, ":");1108 char *str = strtok(plugin_info.ident, ":");
976 if (str && strcmp(str, "NPW") == 0) {1109 if (str && strcmp(str, "NPW") == 0) {
977 str = strtok(NULL, ":");1110 str = strtok(NULL, ":");
1111 if (plugin_info.struct_version >= 2) { /* skip 'X' */
1112 if (str[0] != 'X')
1113 error("invalid NPW_PluginInfo format");
1114 str = strtok(NULL, ":");
1115 }
978 if (str) {1116 if (str) {
979 printf(" Wrapper version string: %s", str);1117 printf(" Wrapper version string: %s", str);
980 str = strtok(NULL, ":");1118 str = strtok(NULL, ":");
@@ -1083,15 +1221,19 @@
10831221
1084 for (i = 0; i < argc; i++) {1222 for (i = 0; i < argc; i++) {
1085 NPW_PluginInfo plugin_info;1223 NPW_PluginInfo plugin_info;
1224 memset(&plugin_info, 0, sizeof(plugin_info));
1225
1086 const char *plugin_path = argv[i];1226 const char *plugin_path = argv[i];
1087 if (!is_plugin(plugin_path, &plugin_info))1227 if (!is_plugin(plugin_path, &plugin_info))
1088 error("%s is not a valid NPAPI plugin", plugin_path);1228 error("%s is not a valid NPAPI plugin", plugin_path);
1229
1089 ret = detect_plugin_viewer(plugin_path, &plugin_info);1230 ret = detect_plugin_viewer(plugin_path, &plugin_info);
1090 if (ret != EXIT_VIEWER_OK) {1231 if (ret != EXIT_VIEWER_OK) {
1091 if (ret == EXIT_VIEWER_NATIVE)1232 if (ret == EXIT_VIEWER_NATIVE)
1092 return 0; /* silently ignore exit status */1233 return 0; /* silently ignore exit status */
1093 error("no appropriate viewer found for %s", plugin_path);1234 error("no appropriate viewer found for %s", plugin_path);
1094 }1235 }
1236
1095 ret = install_plugin(plugin_path, &plugin_info);1237 ret = install_plugin(plugin_path, &plugin_info);
1096 if (ret != 0)1238 if (ret != 0)
1097 return ret;1239 return ret;
10981240
=== modified file 'src/npw-malloc.c'
--- src/npw-malloc.c 2009-01-02 10:07:27 +0000
+++ src/npw-malloc.c 2009-08-11 00:38:42 +0000
@@ -23,17 +23,33 @@
23#define DEBUG 123#define DEBUG 1
24#include "debug.h"24#include "debug.h"
2525
26typedef void *(*NPW_MemAllocProcPtr) (uint32_t);26typedef void *(*NPW_MemAllocProcPtr) (uint32_t);
27typedef void *(*NPW_MemAlloc0ProcPtr) (uint32_t);27typedef void (*NPW_MemFreeProcPtr) (void *, uint32_t);
28typedef void (*NPW_MemFreeProcPtr) (void *);
2928
30typedef struct _NPW_MallocHooks NPW_MallocHooks;29typedef struct _NPW_MallocHooks NPW_MallocHooks;
31struct _NPW_MallocHooks30struct _NPW_MallocHooks
32{31{
33 NPW_MemAllocProcPtr memalloc;32 NPW_MemAllocProcPtr memalloc;
34 NPW_MemAlloc0ProcPtr memalloc0;33 NPW_MemAllocProcPtr memalloc0;
35 NPW_MemFreeProcPtr memfree;34 NPW_MemFreeProcPtr memfree;
36};35};
36
37#define NPW_MALLOC_MAGIC 0x4e50574d /* 'NPWM' */
38
39typedef struct _NPW_MemBlock NPW_MemBlock;
40struct _NPW_MemBlock
41{
42 uint32_t magic;
43 uint32_t real_size;
44 uint32_t alloc_size;
45 uint32_t alloc_lineno;
46 const char *alloc_file;
47};
48
49static void *npw_mem_alloc (uint32_t size, const char *file, int lineno);
50static void *npw_mem_alloc0 (uint32_t size, const char *file, int lineno);
51static void *npw_mem_alloc_copy (uint32_t size, const void *ptr, const char *file, int lineno);
52static void npw_mem_free (void *ptr, const char *file, int lineno);
3753
38/* ====================================================================== */54/* ====================================================================== */
39/* === Standard C library === */55/* === Standard C library === */
@@ -59,7 +75,7 @@
59}75}
6076
61static void77static void
62NPW_Libc_MemFree (void *ptr)78NPW_Libc_MemFree (void *ptr, uint32_t size)
63{79{
64 free (ptr);80 free (ptr);
65}81}
@@ -82,57 +98,22 @@
82#if USE_MALLOC_GLIB98#if USE_MALLOC_GLIB
83#include <glib.h>99#include <glib.h>
84100
85#define NPW_GLIB_MALLOC_MAGIC 0x476c6962 /* 'Glib' */
86
87typedef struct _NPW_Glib_MemBlock NPW_Glib_MemBlock;
88struct _NPW_Glib_MemBlock
89{
90 uint32_t magic;
91 uint32_t real_size;
92 char data[];
93};
94
95static void *101static void *
96NPW_Glib_MemAlloc (uint32_t size)102NPW_Glib_MemAlloc (uint32_t size)
97{103{
98 uint32_t real_size;104 return g_slice_alloc (size);
99 NPW_Glib_MemBlock *mem;
100
101 real_size = sizeof (*mem) + size;
102 if ((mem = g_slice_alloc (real_size)) == NULL)
103 return NULL;
104 mem->magic = NPW_GLIB_MALLOC_MAGIC;
105 mem->real_size = real_size;
106 return &mem->data[0];
107}105}
108106
109static void *107static void *
110NPW_Glib_MemAlloc0 (uint32_t size)108NPW_Glib_MemAlloc0 (uint32_t size)
111{109{
112 uint32_t real_size;110 return g_slice_alloc0 (size);
113 NPW_Glib_MemBlock *mem;
114
115 real_size = sizeof (*mem) + size;
116 if ((mem = g_slice_alloc0 (real_size)) == NULL)
117 return NULL;
118 mem->magic = NPW_GLIB_MALLOC_MAGIC;
119 mem->real_size = real_size;
120 return &mem->data[0];
121}111}
122112
123static void113static void
124NPW_Glib_MemFree (void *ptr)114NPW_Glib_MemFree (void *ptr, uint32_t size)
125{115{
126 if (ptr == NULL)116 g_slice_free1 (size, ptr);
127 return;
128 NPW_Glib_MemBlock *mem = (NPW_Glib_MemBlock *)((char *)ptr - sizeof (*mem));
129 if (mem->magic == NPW_GLIB_MALLOC_MAGIC)
130 g_slice_free1 (mem->real_size, mem);
131 else
132 {
133 D(bug("WARNING: block %p was not allocated with NPN_MemAlloc(), reverting to libc free()\n", ptr));
134 free (ptr);
135 }
136}117}
137118
138static const NPW_MallocHooks g_glib_hooks = {119static const NPW_MallocHooks g_glib_hooks = {
@@ -190,26 +171,200 @@
190void *171void *
191NPW_MemAlloc (uint32_t size)172NPW_MemAlloc (uint32_t size)
192{173{
193 return get_malloc_hooks ()->memalloc (size);174 return npw_mem_alloc (size, NULL, 0);
194}175}
195176
196void *177void *
197NPW_MemAlloc0 (uint32_t size)178NPW_MemAlloc0 (uint32_t size)
198{179{
199 return get_malloc_hooks ()->memalloc0 (size);180 return npw_mem_alloc0 (size, NULL, 0);
200}181}
201182
202void *183void *
203NPW_MemAllocCopy (uint32_t size, const void *src)184NPW_MemAllocCopy (uint32_t size, const void *ptr)
204{185{
205 void *ptr = NPW_MemAlloc (size);186 return npw_mem_alloc_copy (size, ptr, NULL, 0);
187}
188
189void
190NPW_MemFree (void *ptr)
191{
192 npw_mem_free (ptr, NULL, 0);
193}
194
195void *
196NPW_Debug_MemAlloc (uint32_t size, const char *file, int lineno)
197{
198 return npw_mem_alloc (size, file, lineno);
199}
200
201void *
202NPW_Debug_MemAlloc0 (uint32_t size, const char *file, int lineno)
203{
204 return npw_mem_alloc0 (size, file, lineno);
205}
206
207void *
208NPW_Debug_MemAllocCopy (uint32_t size, const void *ptr, const char *file, int lineno)
209{
210 return npw_mem_alloc_copy (size, ptr, file, lineno);
211}
212
213void
214NPW_Debug_MemFree (void *ptr, const char *file, int lineno)
215{
216 npw_mem_free (ptr, file, lineno);
217}
218
219/* ====================================================================== */
220/* === Implementation allowing basic underflow/overflow checks === */
221/* ====================================================================== */
222
223#ifdef ENABLE_MALLOC_CHECK
224static bool
225is_malloc_check_enabled_1 (void)
226{
227 const char *malloc_check_str;
228 if ((malloc_check_str = getenv ("NPW_MALLOC_CHECK")) != NULL)
229 return ((strcmp (malloc_check_str, "yes") == 0) ||
230 (strcmp (malloc_check_str, "1") == 0));
231
232 /* enable malloc-checks by default for all builds from snapshots */
233 return NPW_SNAPSHOT > 0;
234}
235#endif
236
237#define MALLOC_CHECK_GUARD_MARK 'E'
238#define MALLOC_CHECK_GUARD_SIZE malloc_check_guards_size ()
239
240static inline bool
241is_malloc_check_enabled (void)
242{
243#ifdef ENABLE_MALLOC_CHECK
244 static int malloc_check = -1;
245 if (malloc_check < 0)
246 malloc_check = is_malloc_check_enabled_1 ();
247 return malloc_check;
248#else
249 return false;
250#endif
251}
252
253static inline uint32_t
254malloc_check_guards_size (void)
255{
256 return is_malloc_check_enabled () ? 16 : 0;
257}
258
259static void
260malloc_check_guards_init (uint8_t *ptr, uint32_t size)
261{
262 if (!is_malloc_check_enabled ())
263 return;
264
265 memset (ptr - MALLOC_CHECK_GUARD_SIZE,
266 MALLOC_CHECK_GUARD_MARK,
267 MALLOC_CHECK_GUARD_SIZE);
268 memset (ptr + size,
269 MALLOC_CHECK_GUARD_MARK,
270 MALLOC_CHECK_GUARD_SIZE);
271}
272
273static bool
274malloc_check_guards_ok (uint8_t *ptr, uint32_t size, int *punderflow, int *poverflow)
275{
276 if (!is_malloc_check_enabled ())
277 return true;
278
279 int i, underflow = 0, overflow = 0;
280 for (i = 0; i < MALLOC_CHECK_GUARD_SIZE; i++)
281 {
282 if (ptr[-(1 + i)] != MALLOC_CHECK_GUARD_MARK)
283 ++underflow;
284 if (ptr[size + i] != MALLOC_CHECK_GUARD_MARK)
285 ++overflow;
286 }
287 if (punderflow)
288 *punderflow = underflow;
289 if (poverflow)
290 *poverflow = overflow;
291 return !underflow && !overflow;
292}
293
294static inline void *
295npw_do_mem_alloc (NPW_MemAllocProcPtr mem_alloc_func, uint32_t size, const char *file, int lineno)
296{
297 uint32_t real_size;
298 NPW_MemBlock *mem;
299
300 real_size = sizeof (*mem) + size + 2 * MALLOC_CHECK_GUARD_SIZE;
301 if ((mem = mem_alloc_func (real_size)) == NULL)
302 return NULL;
303
304 mem->magic = NPW_MALLOC_MAGIC;
305 mem->real_size = real_size;
306 mem->alloc_size = size;
307 mem->alloc_file = file;
308 mem->alloc_lineno = lineno;
309
310 uint8_t *ptr = (uint8_t *)mem + sizeof (*mem) + MALLOC_CHECK_GUARD_SIZE;
311 malloc_check_guards_init (ptr, size);
312 return ptr;
313}
314
315static void *
316npw_mem_alloc (uint32_t size, const char *file, int lineno)
317{
318 return npw_do_mem_alloc (get_malloc_hooks ()->memalloc, size, file, lineno);
319}
320
321static void *
322npw_mem_alloc0 (uint32_t size, const char *file, int lineno)
323{
324 return npw_do_mem_alloc (get_malloc_hooks ()->memalloc0, size, file, lineno);
325}
326
327static void *
328npw_mem_alloc_copy (uint32_t size, const void *src, const char *file, int lineno)
329{
330 void *ptr = npw_mem_alloc (size, file, lineno);
206 if (ptr)331 if (ptr)
207 memcpy (ptr, src, size);332 memcpy (ptr, src, size);
208 return ptr;333 return ptr;
209}334}
210335
211void336static void
212NPW_MemFree (void *ptr)337npw_mem_free (void *ptr, const char *file, int lineno)
213{338{
214 get_malloc_hooks ()->memfree (ptr);339 if (ptr == NULL)
340 return;
341
342 NPW_MemBlock *mem = (NPW_MemBlock *)((char *)ptr - (sizeof (*mem) + MALLOC_CHECK_GUARD_SIZE));
343 if (mem->magic == NPW_MALLOC_MAGIC)
344 {
345 int underflow, overflow;
346 if (!malloc_check_guards_ok (ptr, mem->alloc_size, &underflow, &overflow))
347 {
348 if (underflow)
349 npw_printf ("ERROR: detected underflow of %d bytes\n"
350 " for block allocated at %s:%d\n"
351 " and released at %s:%d\n",
352 underflow,
353 mem->alloc_file, mem->alloc_lineno,
354 file, lineno);
355 if (overflow)
356 npw_printf ("ERROR: detected overflow of %d bytes\n"
357 " for block allocated at %s:%d\n"
358 " and released at %s:%d\n",
359 overflow,
360 mem->alloc_file, mem->alloc_lineno,
361 file, lineno);
362 }
363 get_malloc_hooks ()->memfree (mem, mem->real_size);
364 }
365 else
366 {
367 npw_printf("ERROR: block %p was not allocated with NPW_MemAlloc(), reverting to libc free()\n", ptr);
368 free (ptr);
369 }
215}370}
216371
=== modified file 'src/npw-malloc.h'
--- src/npw-malloc.h 2009-01-02 10:07:27 +0000
+++ src/npw-malloc.h 2009-08-11 00:38:42 +0000
@@ -33,6 +33,18 @@
33void33void
34NPW_MemFree (void *ptr);34NPW_MemFree (void *ptr);
3535
36void *
37NPW_Debug_MemAlloc (uint32_t size, const char *file, int lineno);
38
39void *
40NPW_Debug_MemAlloc0 (uint32_t size, const char *file, int lineno);
41
42void *
43NPW_Debug_MemAllocCopy (uint32_t size, const void *ptr, const char *file, int lineno);
44
45void
46NPW_Debug_MemFree (void *ptr, const char *file, int lineno);
47
36#define NPW_MemNew(type, n) \48#define NPW_MemNew(type, n) \
37 ((type *) NPW_MemAlloc ((n) * sizeof (type)))49 ((type *) NPW_MemAlloc ((n) * sizeof (type)))
3850
@@ -42,4 +54,11 @@
42#define NPW_MemClone(type, ptr) \54#define NPW_MemClone(type, ptr) \
43 ((type *) NPW_MemAllocCopy (sizeof (type), ptr))55 ((type *) NPW_MemAllocCopy (sizeof (type), ptr))
4456
57#ifdef ENABLE_MALLOC_CHECK
58# define NPW_MemAlloc(SIZE) NPW_Debug_MemAlloc(SIZE, __FILE__, __LINE__)
59# define NPW_MemAlloc0(SIZE) NPW_Debug_MemAlloc0(SIZE, __FILE__, __LINE__)
60# define NPW_MemAllocCopy(SIZE, PTR) NPW_Debug_MemAllocCopy(SIZE, PTR, __FILE__, __LINE__)
61# define NPW_MemFree(PTR) NPW_Debug_MemFree(PTR, __FILE__, __LINE__)
62#endif
63
45#endif /* NPW_MALLOC_H */64#endif /* NPW_MALLOC_H */
4665
=== modified file 'src/npw-viewer.c'
--- src/npw-viewer.c 2009-01-02 10:07:27 +0000
+++ src/npw-viewer.c 2009-08-11 00:38:42 +0000
@@ -28,6 +28,8 @@
28#include <dlfcn.h>28#include <dlfcn.h>
29#include <unistd.h>29#include <unistd.h>
30#include <errno.h>30#include <errno.h>
31#include <pthread.h>
32#include <fcntl.h>
3133
32#include <X11/X.h>34#include <X11/X.h>
33#include <X11/Xlib.h>35#include <X11/Xlib.h>
@@ -58,11 +60,15 @@
58// Define to allow windowless plugins60// Define to allow windowless plugins
59#define ALLOW_WINDOWLESS_PLUGINS 161#define ALLOW_WINDOWLESS_PLUGINS 1
6062
63// Define to use NPIdentifier cache
64#define USE_NPIDENTIFIER_CACHE 1
65#define NPIDENTIFIER_CACHE_SIZE 256
66
61// RPC global connections67// RPC global connections
62rpc_connection_t *g_rpc_connection attribute_hidden = NULL;68rpc_connection_t *g_rpc_connection attribute_hidden = NULL;
6369
64// Viewer orignal pid - check against incorrect plugins70// Viewer main thread - make sure we call into the browser from the main thread
65static pid_t g_viewer_pid = 0;71static pthread_t g_main_thread = 0;
6672
67// Instance state information about the plugin73// Instance state information about the plugin
68typedef struct _PluginInstance {74typedef struct _PluginInstance {
@@ -101,6 +107,8 @@
101107
102// Prototypes108// Prototypes
103static void destroy_window(PluginInstance *plugin);109static void destroy_window(PluginInstance *plugin);
110static int xt_source_create(void);
111static void xt_source_destroy(void);
104112
105113
106/* ====================================================================== */114/* ====================================================================== */
@@ -162,16 +170,38 @@
162 }170 }
163}171}
164172
165// Pid support routines173// Thread support routines
166static void pid_init(void)174static void thread_check_init(void)
167{175{
168 g_viewer_pid = getpid();176 g_main_thread = pthread_self();
169}177}
170178
171bool pid_check(void)179#ifdef ENABLE_THREAD_CHECK
172{180static bool is_thread_check_enabled_1(void)
173#if USE_PID_CHECK181{
174 return (g_viewer_pid == getpid());182 const char *thread_check_str;
183 if ((thread_check_str = getenv("NPW_THREAD_CHECK")) != NULL)
184 return ((strcmp(thread_check_str, "yes") == 0) ||
185 (strcmp(thread_check_str, "1") == 0));
186
187 /* enable main-thread checks by default for all builds from snapshots */
188 return NPW_SNAPSHOT > 0;
189}
190
191static inline bool is_thread_check_enabled(void)
192{
193 static int thread_check = -1;
194 if (thread_check < 0)
195 thread_check = is_thread_check_enabled_1();
196 return thread_check;
197}
198#endif
199
200bool thread_check(void)
201{
202#ifdef ENABLE_THREAD_CHECK
203 if (is_thread_check_enabled())
204 return (g_main_thread == pthread_self());
175#endif205#endif
176 return true;206 return true;
177}207}
@@ -180,8 +210,7 @@
180// XXX: use a pipe, this should be faster (avoids GSource creation and210// XXX: use a pipe, this should be faster (avoids GSource creation and
181// explicit memory allocation)211// explicit memory allocation)
182enum {212enum {
183 RPC_DELAYED_NPN_RELEASE_OBJECT = 1,213 RPC_DELAYED_NPN_RELEASE_OBJECT = 1
184 RPC_DELAYED_NPN_INVALIDATE_RECT,
185};214};
186215
187typedef struct _DelayedCall {216typedef struct _DelayedCall {
@@ -251,6 +280,200 @@
251 return delayed_calls_process(NULL, FALSE);280 return delayed_calls_process(NULL, FALSE);
252}281}
253282
283// NPIdentifier cache
284static inline bool use_npidentifier_cache(void)
285{
286 return USE_NPIDENTIFIER_CACHE && npruntime_use_cache();
287}
288
289#if USE_NPIDENTIFIER_CACHE
290/* XXX: NPIdentifierInfo could become the NPIdentifier, thus avoiding
291 the global hash table, if there is a garbage collector. Otherwise,
292 we will be leaking memory since there is no function that kills an
293 NPIdentifier. */
294typedef struct _NPIdentifierInfo {
295 guint string_len; /* >0 implies 1+strlen(string), =0 implies an integer */
296 union {
297 gchar *string;
298 int32_t value;
299 } u;
300} NPIdentifierInfo;
301
302static GHashTable *g_npidentifier_cache = NULL;
303
304
305static inline NPIdentifierInfo *npidentifier_info_new(void)
306{
307 return NPW_MemNew(NPIdentifierInfo, 1);
308}
309
310static inline void npidentifier_info_destroy(NPIdentifierInfo *npi)
311{
312 if (G_UNLIKELY(npi == NULL))
313 return;
314 if (npi->string_len > 0) {
315 NPW_MemFree(npi->u.string);
316 npi->u.string = NULL;
317 }
318 NPW_MemFree(npi);
319}
320
321static inline void npidentifier_cache_create(void)
322{
323 g_npidentifier_cache =
324 g_hash_table_new_full(NULL, NULL, NULL,
325 (GDestroyNotify)npidentifier_info_destroy);
326}
327
328static inline void npidentifier_cache_destroy(void)
329{
330 if (g_npidentifier_cache) {
331 g_hash_table_destroy(g_npidentifier_cache);
332 g_npidentifier_cache = NULL;
333 }
334}
335
336static void npidentifier_cache_invalidate(void)
337{
338#if defined(HAVE_G_HASH_TABLE_REMOVE_ALL) && !defined(BUILD_GENERIC)
339 if (g_npidentifier_cache)
340 g_hash_table_remove_all(g_npidentifier_cache);
341#else
342 npidentifier_cache_destroy();
343 npidentifier_cache_create();
344#endif
345}
346
347static void npidentifier_cache_reserve(int n_entries)
348{
349 if (G_UNLIKELY(g_npidentifier_cache == NULL))
350 npidentifier_cache_create();
351 if (g_hash_table_size(g_npidentifier_cache) + n_entries > NPIDENTIFIER_CACHE_SIZE)
352 npidentifier_cache_invalidate();
353}
354
355static inline NPIdentifierInfo *npidentifier_cache_lookup(NPIdentifier ident)
356{
357 if (G_UNLIKELY(g_npidentifier_cache == NULL))
358 return NULL;
359 return g_hash_table_lookup(g_npidentifier_cache, ident);
360}
361
362static void npidentifier_cache_add_int(NPIdentifier ident, int32_t value)
363{
364 if (G_UNLIKELY(g_npidentifier_cache == NULL))
365 return;
366 NPIdentifierInfo *npi = npidentifier_info_new();
367 if (G_UNLIKELY(npi == NULL))
368 return;
369 npi->string_len = 0;
370 npi->u.value = value;
371 g_hash_table_insert(g_npidentifier_cache, ident, npi);
372}
373
374typedef struct _NPIdentifierFindArgs {
375 NPIdentifierInfo info; /* in */
376 NPIdentifier ident; /* out */
377} NPIdentifierFindArgs;
378
379static gboolean npidentifier_cache_find_info(gpointer key, gpointer value, gpointer user_data)
380{
381 NPIdentifier *ident = (NPIdentifier)key;
382 NPIdentifierInfo *npi = (NPIdentifierInfo *)value;
383 NPIdentifierFindArgs *args = (NPIdentifierFindArgs *)user_data;
384#if !defined(HAVE_G_HASH_TABLE_FIND) || defined(BUILD_GENERIC)
385 if (args->ident)
386 return FALSE;
387#endif
388 if (npi->string_len != args->info.string_len)
389 return FALSE;
390 if (args->info.string_len > 0) { /* a string */
391 if (memcmp(args->info.u.string, npi->u.string, args->info.string_len) == 0) {
392 args->ident = ident;
393 return TRUE;
394 }
395 }
396 else { /* an integer */
397 if (args->info.u.value == npi->u.value) {
398 args->ident = ident;
399 return TRUE;
400 }
401 }
402 return FALSE;
403}
404
405static inline bool npidentifier_cache_find(NPIdentifierFindArgs *args, NPIdentifier *pident)
406{
407 args->ident = NULL;
408#if defined(HAVE_G_HASH_TABLE_FIND) && !defined(BUILD_GENERIC)
409 if (!g_hash_table_find(g_npidentifier_cache, npidentifier_cache_find_info, args))
410 return false;
411#else
412 g_hash_table_foreach(g_npidentifier_cache, (GHFunc)npidentifier_cache_find_info, args);
413 if (args->ident == NULL)
414 return false;
415#endif
416
417 if (pident)
418 *pident = args->ident;
419 return true;
420}
421
422static inline bool npidentifier_cache_has_int(int32_t value, NPIdentifier *pident)
423{
424 if (G_UNLIKELY(g_npidentifier_cache == NULL))
425 return false;
426
427 NPIdentifierFindArgs args;
428 args.info.string_len = 0;
429 args.info.u.value = value;
430 return npidentifier_cache_find(&args, pident);
431}
432
433static inline int32_t npidentifier_cache_get_int(NPIdentifier ident)
434{
435 NPIdentifierInfo *npi = npidentifier_cache_lookup(ident);
436 if (G_UNLIKELY(npi == NULL || npi->string_len > 0))
437 return 0;
438 return npi->u.value;
439}
440
441static void npidentifier_cache_add_string(NPIdentifier ident, const gchar *str)
442{
443 if (G_UNLIKELY(g_npidentifier_cache == NULL))
444 return;
445 NPIdentifierInfo *npi = npidentifier_info_new();
446 if (G_UNLIKELY(npi == NULL))
447 return;
448 npi->string_len = strlen(str) + 1;
449 if ((npi->u.string = NPW_MemAlloc(npi->string_len)) == NULL) {
450 npidentifier_info_destroy(npi);
451 return;
452 }
453 memcpy(npi->u.string, str, npi->string_len);
454 g_hash_table_insert(g_npidentifier_cache, ident, npi);
455}
456
457static inline bool npidentifier_cache_has_string(const gchar *str, NPIdentifier *pident)
458{
459 if (G_UNLIKELY(g_npidentifier_cache == NULL))
460 return false;
461
462 NPIdentifierFindArgs args;
463 args.info.string_len = strlen(str) + 1;
464 args.info.u.string = (gchar *)str;
465 return npidentifier_cache_find(&args, pident);
466}
467
468static inline NPUTF8 *npidentifier_cache_get_string_copy(NPIdentifier ident)
469{
470 NPIdentifierInfo *npi = npidentifier_cache_lookup(ident);
471 if (G_UNLIKELY(npi == NULL || npi->string_len == 0))
472 return NULL;
473 return NPW_MemAllocCopy(npi->string_len, npi->u.string);
474}
475#endif
476
254477
255/* ====================================================================== */478/* ====================================================================== */
256/* === X Toolkit glue === */479/* === X Toolkit glue === */
@@ -302,6 +525,57 @@
302 CorePart core;525 CorePart core;
303} WidgetRec, CoreRec;526} WidgetRec, CoreRec;
304527
528typedef struct _TimerEventRec {
529 struct timeval te_timer_value;
530 struct _TimerEventRec *te_next;
531 XtTimerCallbackProc te_proc;
532 XtAppContext app;
533 XtPointer te_closure;
534} TimerEventRec;
535
536typedef struct _InputEvent {
537 XtInputCallbackProc ie_proc;
538 XtPointer ie_closure;
539 struct _InputEvent *ie_next;
540 struct _InputEvent *ie_oq;
541 XtAppContext app;
542 int ie_source;
543 XtInputMask ie_condition;
544} InputEvent;
545
546typedef struct _SignalEventRec {
547 XtSignalCallbackProc se_proc;
548 XtPointer se_closure;
549 struct _SignalEventRec *se_next;
550 XtAppContext app;
551 Boolean se_notice;
552} SignalEventRec;
553
554struct _XtAppStruct {
555 XtAppContext next; /* link to next app in process context */
556 void *process; /* back pointer to our process context */
557 void *destroy_callbacks;
558 Display **list;
559 TimerEventRec *timerQueue;
560 void *workQueue;
561 InputEvent **input_list;
562 InputEvent *outstandingQueue;
563 SignalEventRec *signalQueue;
564 XrmDatabase errorDB;
565 XtErrorMsgHandler errorMsgHandler, warningMsgHandler;
566 XtErrorHandler errorHandler, warningHandler;
567 struct _ActionListRec *action_table;
568 void *converterTable;
569 unsigned long selectionTimeout;
570 char __maxed__nfds[3*sizeof(fd_set)+4];
571 short __maybe__count; /* num of assigned entries in list */
572 short __maybe__max; /* allocate size of list */
573 short __maybe__last;
574 short __maybe__input_count;
575 short __maybe__input_max; /* elts input_list init'd with */
576 /* ... don't care about other members */
577};
578
305extern void XtResizeWidget(579extern void XtResizeWidget(
306 Widget /* widget */,580 Widget /* widget */,
307 _XtDimension /* width */,581 _XtDimension /* width */,
@@ -780,8 +1054,8 @@
780static NPError1054static NPError
781g_NPN_GetURL(NPP instance, const char *url, const char *target)1055g_NPN_GetURL(NPP instance, const char *url, const char *target)
782{1056{
783 if (!pid_check()) {1057 if (!thread_check()) {
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");
785 return NPERR_INVALID_INSTANCE_ERROR;1059 return NPERR_INVALID_INSTANCE_ERROR;
786 }1060 }
7871061
@@ -834,8 +1108,8 @@
834static NPError1108static NPError
835g_NPN_GetURLNotify(NPP instance, const char *url, const char *target, void *notifyData)1109g_NPN_GetURLNotify(NPP instance, const char *url, const char *target, void *notifyData)
836{1110{
837 if (!pid_check()) {1111 if (!thread_check()) {
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");
839 return NPERR_INVALID_INSTANCE_ERROR;1113 return NPERR_INVALID_INSTANCE_ERROR;
840 }1114 }
841 1115
@@ -933,8 +1207,8 @@
933{1207{
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)));
9351209
936 if (!pid_check()) {1210 if (!thread_check()) {
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");
938 return NPERR_INVALID_INSTANCE_ERROR;1212 return NPERR_INVALID_INSTANCE_ERROR;
939 }1213 }
9401214
@@ -1038,8 +1312,8 @@
1038static void1312static void
1039g_NPN_InvalidateRect(NPP instance, NPRect *invalidRect)1313g_NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
1040{1314{
1041 if (!pid_check()) {1315 if (!thread_check()) {
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");
1043 return;1317 return;
1044 }1318 }
10451319
@@ -1132,8 +1406,8 @@
1132static NPError1406static NPError
1133g_NPN_PostURL(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file)1407g_NPN_PostURL(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file)
1134{1408{
1135 if (!pid_check()) {1409 if (!thread_check()) {
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");
1137 return NPERR_INVALID_INSTANCE_ERROR;1411 return NPERR_INVALID_INSTANCE_ERROR;
1138 }1412 }
11391413
@@ -1188,8 +1462,8 @@
1188static NPError1462static NPError
1189g_NPN_PostURLNotify(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file, void *notifyData)1463g_NPN_PostURLNotify(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file, void *notifyData)
1190{1464{
1191 if (!pid_check()) {1465 if (!thread_check()) {
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");
1193 return NPERR_INVALID_INSTANCE_ERROR;1467 return NPERR_INVALID_INSTANCE_ERROR;
1194 }1468 }
1195 1469
@@ -1267,8 +1541,8 @@
1267static NPError1541static NPError
1268g_NPN_RequestRead(NPStream *stream, NPByteRange *rangeList)1542g_NPN_RequestRead(NPStream *stream, NPByteRange *rangeList)
1269{1543{
1270 if (!pid_check()) {1544 if (!thread_check()) {
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");
1272 return NPERR_INVALID_INSTANCE_ERROR;1546 return NPERR_INVALID_INSTANCE_ERROR;
1273 }1547 }
12741548
@@ -1320,8 +1594,8 @@
1320static NPError1594static NPError
1321g_NPN_SetValue(NPP instance, NPPVariable variable, void *value)1595g_NPN_SetValue(NPP instance, NPPVariable variable, void *value)
1322{1596{
1323 if (!pid_check()) {1597 if (!thread_check()) {
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");
1325 return NPERR_INVALID_INSTANCE_ERROR;1599 return NPERR_INVALID_INSTANCE_ERROR;
1326 }1600 }
13271601
@@ -1368,8 +1642,8 @@
1368static void1642static void
1369g_NPN_Status(NPP instance, const char *message)1643g_NPN_Status(NPP instance, const char *message)
1370{1644{
1371 if (!pid_check()) {1645 if (!thread_check()) {
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");
1373 return;1647 return;
1374 }1648 }
13751649
@@ -1415,8 +1689,8 @@
1415static const char *1689static const char *
1416g_NPN_UserAgent(NPP instance)1690g_NPN_UserAgent(NPP instance)
1417{1691{
1418 if (!pid_check()) {1692 if (!thread_check()) {
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");
1420 return NULL;1694 return NULL;
1421 }1695 }
14221696
@@ -1505,8 +1779,8 @@
1505static NPError1779static NPError
1506g_NPN_NewStream(NPP instance, NPMIMEType type, const char *target, NPStream **stream)1780g_NPN_NewStream(NPP instance, NPMIMEType type, const char *target, NPStream **stream)
1507{1781{
1508 if (!pid_check()) {1782 if (!thread_check()) {
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");
1510 return NPERR_INVALID_INSTANCE_ERROR;1784 return NPERR_INVALID_INSTANCE_ERROR;
1511 }1785 }
15121786
@@ -1564,8 +1838,8 @@
1564static NPError1838static NPError
1565g_NPN_DestroyStream(NPP instance, NPStream *stream, NPError reason)1839g_NPN_DestroyStream(NPP instance, NPStream *stream, NPError reason)
1566{1840{
1567 if (!pid_check()) {1841 if (!thread_check()) {
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");
1569 return NPERR_INVALID_INSTANCE_ERROR;1843 return NPERR_INVALID_INSTANCE_ERROR;
1570 }1844 }
1571 1845
@@ -1634,8 +1908,8 @@
1634static int321908static int32
1635g_NPN_Write(NPP instance, NPStream *stream, int32 len, void *buf)1909g_NPN_Write(NPP instance, NPStream *stream, int32 len, void *buf)
1636{1910{
1637 if (!pid_check()) {1911 if (!thread_check()) {
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");
1639 return -1;1913 return -1;
1640 }1914 }
1641 1915
@@ -1683,8 +1957,8 @@
1683static void1957static void
1684g_NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)1958g_NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
1685{1959{
1686 if (!pid_check()) {1960 if (!thread_check()) {
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");
1688 return;1962 return;
1689 }1963 }
16901964
@@ -1727,8 +2001,8 @@
1727static void2001static void
1728g_NPN_PopPopupsEnabledState(NPP instance)2002g_NPN_PopPopupsEnabledState(NPP instance)
1729{2003{
1730 if (!pid_check()) {2004 if (!thread_check()) {
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");
1732 return;2006 return;
1733 }2007 }
17342008
@@ -1783,8 +2057,8 @@
1783static NPObject *2057static NPObject *
1784g_NPN_CreateObject(NPP instance, NPClass *class)2058g_NPN_CreateObject(NPP instance, NPClass *class)
1785{2059{
1786 if (!pid_check()) {2060 if (!thread_check()) {
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");
1788 return NULL;2062 return NULL;
1789 }2063 }
1790 2064
@@ -1839,8 +2113,8 @@
1839static NPObject *2113static NPObject *
1840g_NPN_RetainObject(NPObject *npobj)2114g_NPN_RetainObject(NPObject *npobj)
1841{2115{
1842 if (!pid_check()) {2116 if (!thread_check()) {
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");
1844 return NULL;2118 return NULL;
1845 }2119 }
1846 2120
@@ -1902,8 +2176,8 @@
1902static void2176static void
1903g_NPN_ReleaseObject(NPObject *npobj)2177g_NPN_ReleaseObject(NPObject *npobj)
1904{2178{
1905 if (!pid_check()) {2179 if (!thread_check()) {
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");
1907 return;2181 return;
1908 }2182 }
1909 2183
@@ -1958,8 +2232,8 @@
1958g_NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName,2232g_NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName,
1959 const NPVariant *args, uint32_t argCount, NPVariant *result)2233 const NPVariant *args, uint32_t argCount, NPVariant *result)
1960{2234{
1961 if (!pid_check()) {2235 if (!thread_check()) {
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");
1963 return false;2237 return false;
1964 }2238 }
19652239
@@ -2021,8 +2295,8 @@
2021g_NPN_InvokeDefault(NPP instance, NPObject *npobj,2295g_NPN_InvokeDefault(NPP instance, NPObject *npobj,
2022 const NPVariant *args, uint32_t argCount, NPVariant *result)2296 const NPVariant *args, uint32_t argCount, NPVariant *result)
2023{2297{
2024 if (!pid_check()) {2298 if (!thread_check()) {
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");
2026 return false;2300 return false;
2027 }2301 }
20282302
@@ -2082,8 +2356,8 @@
2082static bool2356static bool
2083g_NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result)2357g_NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result)
2084{2358{
2085 if (!pid_check()) {2359 if (!thread_check()) {
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");
2087 return false;2361 return false;
2088 }2362 }
20892363
@@ -2147,8 +2421,8 @@
2147g_NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName,2421g_NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName,
2148 NPVariant *result)2422 NPVariant *result)
2149{2423{
2150 if (!pid_check()) {2424 if (!thread_check()) {
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");
2152 return false;2426 return false;
2153 }2427 }
21542428
@@ -2209,8 +2483,8 @@
2209g_NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName,2483g_NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName,
2210 const NPVariant *value)2484 const NPVariant *value)
2211{2485{
2212 if (!pid_check()) {2486 if (!thread_check()) {
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");
2214 return false;2488 return false;
2215 }2489 }
22162490
@@ -2266,8 +2540,8 @@
2266static bool2540static bool
2267g_NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)2541g_NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
2268{2542{
2269 if (!pid_check()) {2543 if (!thread_check()) {
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");
2271 return false;2545 return false;
2272 }2546 }
22732547
@@ -2323,8 +2597,8 @@
2323static bool2597static bool
2324g_NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)2598g_NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
2325{2599{
2326 if (!pid_check()) {2600 if (!thread_check()) {
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");
2328 return false;2602 return false;
2329 }2603 }
23302604
@@ -2380,8 +2654,8 @@
2380static bool2654static bool
2381g_NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)2655g_NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
2382{2656{
2383 if (!pid_check()) {2657 if (!thread_check()) {
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");
2385 return false;2659 return false;
2386 }2660 }
23872661
@@ -2431,8 +2705,8 @@
2431static void2705static void
2432g_NPN_SetException(NPObject *npobj, const NPUTF8 *message)2706g_NPN_SetException(NPObject *npobj, const NPUTF8 *message)
2433{2707{
2434 if (!pid_check()) {2708 if (!thread_check()) {
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");
2436 return;2710 return;
2437 }2711 }
24382712
@@ -2480,10 +2754,26 @@
2480}2754}
24812755
2482static NPIdentifier2756static NPIdentifier
2757cached_NPN_GetStringIdentifier(const NPUTF8 *name)
2758{
2759 NPIdentifier ident;
2760 if (!use_npidentifier_cache())
2761 ident = invoke_NPN_GetStringIdentifier(name);
2762#if USE_NPIDENTIFIER_CACHE
2763 else if (!npidentifier_cache_has_string(name, &ident)) {
2764 ident = invoke_NPN_GetStringIdentifier(name);
2765 npidentifier_cache_reserve(1);
2766 npidentifier_cache_add_string(ident, name);
2767 }
2768#endif
2769 return ident;
2770}
2771
2772static NPIdentifier
2483g_NPN_GetStringIdentifier(const NPUTF8 *name)2773g_NPN_GetStringIdentifier(const NPUTF8 *name)
2484{2774{
2485 if (!pid_check()) {2775 if (!thread_check()) {
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");
2487 return NULL;2777 return NULL;
2488 }2778 }
24892779
@@ -2491,7 +2781,7 @@
2491 return NULL;2781 return NULL;
24922782
2493 D(bugiI("NPN_GetStringIdentifier name='%s'\n", name));2783 D(bugiI("NPN_GetStringIdentifier name='%s'\n", name));
2494 NPIdentifier ret = invoke_NPN_GetStringIdentifier(name);2784 NPIdentifier ret = cached_NPN_GetStringIdentifier(name);
2495 D(bugiD("NPN_GetStringIdentifier return: %p\n", ret));2785 D(bugiD("NPN_GetStringIdentifier return: %p\n", ret));
2496 return ret;2786 return ret;
2497}2787}
@@ -2536,10 +2826,29 @@
2536}2826}
25372827
2538static void2828static void
2829cached_NPN_GetStringIdentifiers(const NPUTF8 **names, uint32_t nameCount, NPIdentifier *identifiers)
2830{
2831 /* XXX: could be optimized further */
2832 invoke_NPN_GetStringIdentifiers(names, nameCount, identifiers);
2833
2834#if USE_NPIDENTIFIER_CACHE
2835 if (use_npidentifier_cache()) {
2836 for (int i = 0; i < nameCount; i++) {
2837 NPIdentifier ident = identifiers[i];
2838 if (npidentifier_cache_lookup(ident) == NULL) {
2839 npidentifier_cache_reserve(1);
2840 npidentifier_cache_add_string(ident, names[i]);
2841 }
2842 }
2843 }
2844#endif
2845}
2846
2847static void
2539g_NPN_GetStringIdentifiers(const NPUTF8 **names, uint32_t nameCount, NPIdentifier *identifiers)2848g_NPN_GetStringIdentifiers(const NPUTF8 **names, uint32_t nameCount, NPIdentifier *identifiers)
2540{2849{
2541 if (!pid_check()) {2850 if (!thread_check()) {
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");
2543 return;2852 return;
2544 }2853 }
25452854
@@ -2550,7 +2859,7 @@
2550 return;2859 return;
25512860
2552 D(bugiI("NPN_GetStringIdentifiers names=%p\n", names));2861 D(bugiI("NPN_GetStringIdentifiers names=%p\n", names));
2553 invoke_NPN_GetStringIdentifiers(names, nameCount, identifiers);2862 cached_NPN_GetStringIdentifiers(names, nameCount, identifiers);
2554 D(bugiD("NPN_GetStringIdentifiers done\n"));2863 D(bugiD("NPN_GetStringIdentifiers done\n"));
2555}2864}
25562865
@@ -2584,15 +2893,31 @@
2584}2893}
25852894
2586static NPIdentifier2895static NPIdentifier
2896cached_NPN_GetIntIdentifier(int32_t intid)
2897{
2898 NPIdentifier ident;
2899 if (!use_npidentifier_cache())
2900 ident = invoke_NPN_GetIntIdentifier(intid);
2901#if USE_NPIDENTIFIER_CACHE
2902 else if (!npidentifier_cache_has_int(intid, &ident)) {
2903 ident = invoke_NPN_GetIntIdentifier(intid);
2904 npidentifier_cache_reserve(1);
2905 npidentifier_cache_add_int(ident, intid);
2906 }
2907#endif
2908 return ident;
2909}
2910
2911static NPIdentifier
2587g_NPN_GetIntIdentifier(int32_t intid)2912g_NPN_GetIntIdentifier(int32_t intid)
2588{2913{
2589 if (!pid_check()) {2914 if (!thread_check()) {
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");
2591 return NULL;2916 return NULL;
2592 }2917 }
25932918
2594 D(bugiI("NPN_GetIntIdentifier intid=%d\n", intid));2919 D(bugiI("NPN_GetIntIdentifier intid=%d\n", intid));
2595 NPIdentifier ret = invoke_NPN_GetIntIdentifier(intid);2920 NPIdentifier ret = cached_NPN_GetIntIdentifier(intid);
2596 D(bugiD("NPN_GetIntIdentifier return: %p\n", ret));2921 D(bugiD("NPN_GetIntIdentifier return: %p\n", ret));
2597 return ret;2922 return ret;
2598}2923}
@@ -2627,10 +2952,25 @@
2627}2952}
26282953
2629static bool2954static bool
2955cached_NPN_IdentifierIsString(NPIdentifier ident)
2956{
2957#if USE_NPIDENTIFIER_CACHE
2958 if (use_npidentifier_cache()) {
2959 NPIdentifierInfo *npi = npidentifier_cache_lookup(ident);
2960 if (npi)
2961 return npi->string_len > 0;
2962 }
2963#endif
2964 /* cache update is postponed to actual NPN_UTF8FromIdentifier() or
2965 NPN_IntFromIdentifier() */
2966 return invoke_NPN_IdentifierIsString(ident);
2967}
2968
2969static bool
2630g_NPN_IdentifierIsString(NPIdentifier identifier)2970g_NPN_IdentifierIsString(NPIdentifier identifier)
2631{2971{
2632 if (!pid_check()) {2972 if (!thread_check()) {
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");
2634 return false;2974 return false;
2635 }2975 }
2636 2976
@@ -2670,15 +3010,34 @@
2670}3010}
26713011
2672static NPUTF8 *3012static NPUTF8 *
3013cached_NPN_UTF8FromIdentifier(NPIdentifier identifier)
3014{
3015 NPUTF8 *str;
3016 if (!use_npidentifier_cache())
3017 str = invoke_NPN_UTF8FromIdentifier(identifier);
3018 else {
3019#if USE_NPIDENTIFIER_CACHE
3020 str = npidentifier_cache_get_string_copy(identifier);
3021 if (str == NULL) {
3022 str = invoke_NPN_UTF8FromIdentifier(identifier);
3023 npidentifier_cache_reserve(1);
3024 npidentifier_cache_add_string(identifier, str);
3025 }
3026#endif
3027 }
3028 return str;
3029}
3030
3031static NPUTF8 *
2673g_NPN_UTF8FromIdentifier(NPIdentifier identifier)3032g_NPN_UTF8FromIdentifier(NPIdentifier identifier)
2674{3033{
2675 if (!pid_check()) {3034 if (!thread_check()) {
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");
2677 return NULL;3036 return NULL;
2678 }3037 }
26793038
2680 D(bugiI("NPN_UTF8FromIdentifier identifier=%p\n", identifier));3039 D(bugiI("NPN_UTF8FromIdentifier identifier=%p\n", identifier));
2681 NPUTF8 *ret = invoke_NPN_UTF8FromIdentifier(identifier);3040 NPUTF8 *ret = cached_NPN_UTF8FromIdentifier(identifier);
2682 D(bugiD("NPN_UTF8FromIdentifier return: '%s'\n", ret));3041 D(bugiD("NPN_UTF8FromIdentifier return: '%s'\n", ret));
2683 return ret;3042 return ret;
2684}3043}
@@ -2714,15 +3073,38 @@
2714}3073}
27153074
2716static int32_t3075static int32_t
3076cached_NPN_IntFromIdentifier(NPIdentifier identifier)
3077{
3078 int32_t value;
3079 if (!use_npidentifier_cache())
3080 value = invoke_NPN_IntFromIdentifier(identifier);
3081 else {
3082#if USE_NPIDENTIFIER_CACHE
3083 NPIdentifierInfo *npi = npidentifier_cache_lookup(identifier);
3084 if (npi) {
3085 assert(npi->string_len == 0);
3086 value = npi->u.value;
3087 }
3088 else {
3089 value = invoke_NPN_IntFromIdentifier(identifier);
3090 npidentifier_cache_reserve(1);
3091 npidentifier_cache_add_int(identifier, value);
3092 }
3093#endif
3094 }
3095 return value;
3096}
3097
3098static int32_t
2717g_NPN_IntFromIdentifier(NPIdentifier identifier)3099g_NPN_IntFromIdentifier(NPIdentifier identifier)
2718{3100{
2719 if (!pid_check()) {3101 if (!thread_check()) {
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");
2721 return 0;3103 return 0;
2722 }3104 }
2723 3105
2724 D(bugiI("NPN_IntFromIdentifier identifier=%p\n", identifier));3106 D(bugiI("NPN_IntFromIdentifier identifier=%p\n", identifier));
2725 int32_t ret = invoke_NPN_IntFromIdentifier(identifier);3107 int32_t ret = cached_NPN_IntFromIdentifier(identifier);
2726 D(bugiD("NPN_IntFromIdentifier return: %d\n", ret));3108 D(bugiD("NPN_IntFromIdentifier return: %d\n", ret));
2727 return ret;3109 return ret;
2728}3110}
@@ -3006,6 +3388,13 @@
3006 plugin->use_xembed = supports_XEmbed && needs_XEmbed;3388 plugin->use_xembed = supports_XEmbed && needs_XEmbed;
3007 }3389 }
3008 }3390 }
3391
3392 // assume Gtk plugin (no Xt event loop) if XEMBED is used
3393 if (!plugin->use_xembed) {
3394 if (xt_source_create() < 0)
3395 return NPERR_GENERIC_ERROR;
3396 }
3397
3009 return ret;3398 return ret;
3010}3399}
30113400
@@ -3075,6 +3464,9 @@
3075 NPError ret = plugin_funcs.destroy(instance, sdata);3464 NPError ret = plugin_funcs.destroy(instance, sdata);
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)));
30773466
3467 if (!plugin->use_xembed)
3468 xt_source_destroy();
3469
3078 npw_plugin_instance_invalidate(plugin);3470 npw_plugin_instance_invalidate(plugin);
3079 npw_plugin_instance_unref(plugin);3471 npw_plugin_instance_unref(plugin);
3080 return ret;3472 return ret;
@@ -3723,19 +4115,205 @@
3723typedef void (*GSourceFinalizeFunc)(GSource *);4115typedef void (*GSourceFinalizeFunc)(GSource *);
37244116
3725// Xt events4117// Xt events
4118static GSource *xt_source = NULL;
4119static int xt_source_count = 0;
3726static GPollFD xt_event_poll_fd;4120static GPollFD xt_event_poll_fd;
4121static const int XT_DEFAULT_TIMEOUT = 25;
4122static const int XT_MAX_DISPATCH_EVENTS = 10;
4123
4124static void xt_dummy_timeout_cb(XtPointer closure, XtIntervalId *id)
4125{
4126 /* dummy function, never called */
4127 npw_printf("ERROR: xt_dummy_timeout_cb() should never be called\n");
4128}
4129
4130static int xt_has_compatible_appcontext_timerQueue(void)
4131{
4132 int is_compatible;
4133 XtIntervalId id;
4134 TimerEventRec *tq, *tq_probe;
4135
4136 /* Try to determine where is the pointer to the next allocated
4137 TimerEventRec.
4138
4139 Besides, XtAppAddTimeOut() shall not have been called already
4140 because we want to be sure any (libXt internal) "free"
4141 TimerEventRec pointer cache is empty. */
4142 tq = XtNew(TimerEventRec);
4143 XtFree((char *)tq);
4144 tq_probe = XtNew(TimerEventRec);
4145 XtFree((char *)tq_probe);
4146 if (tq != tq_probe)
4147 return 0;
4148
4149 id = XtAppAddTimeOut(x_app_context, 0,
4150 xt_dummy_timeout_cb,
4151 GUINT_TO_POINTER(0xdeadbeef));
4152
4153 tq = x_app_context->timerQueue;
4154 is_compatible = tq == tq_probe
4155 && tq->app == x_app_context
4156 && tq->te_proc == xt_dummy_timeout_cb
4157 && tq->te_closure == GUINT_TO_POINTER(0xdeadbeef)
4158 ;
4159
4160 XtRemoveTimeOut(id);
4161 return is_compatible;
4162}
4163
4164static void xt_dummy_input_cb(XtPointer closure, int *source, XtInputId *id)
4165{
4166 /* dummy function, never called */
4167 npw_printf("ERROR: xt_dummy_input_cb() should never be called\n");
4168}
4169
4170static inline int get_appcontext_input_count_at(int offset)
4171{
4172 return *((short *)((char *)x_app_context + offset));
4173}
4174
4175static inline int add_appcontext_input(int fd, int n)
4176{
4177 return XtAppAddInput(x_app_context,
4178 fd,
4179 GUINT_TO_POINTER(XtInputWriteMask),
4180 xt_dummy_input_cb,
4181 GUINT_TO_POINTER(0xdead0000));
4182}
4183
4184static int get_appcontext_input_count_offset(void)
4185{
4186#define low_offset offsetof(struct _XtAppStruct, __maxed__nfds)
4187#define high_offset offsetof(struct _XtAppStruct, __maybe__input_max)
4188#define n_offsets_max (high_offset - low_offset)/2
4189 int i, ofs, n_offsets = 0;
4190 int offsets[n_offsets_max] = { 0, };
4191
4192#define n_inputs_max 4 /* number of refinements/input sources */
4193 int fd, id, n_inputs = 0;
4194 struct { int fd, id; } inputs[n_inputs_max] = { 0, };
4195
4196 if ((fd = open("/dev/null", O_WRONLY)) < 0)
4197 return 0;
4198 if ((id = add_appcontext_input(fd, 0)) < 0) {
4199 close(fd);
4200 return 0;
4201 }
4202 inputs[n_inputs].fd = fd;
4203 inputs[n_inputs].id = id;
4204 n_inputs++;
4205
4206 for (ofs = low_offset; ofs < high_offset; ofs += 2) {
4207 if (get_appcontext_input_count_at(ofs) == 1)
4208 offsets[n_offsets++] = ofs;
4209 }
4210
4211 while (n_inputs < n_inputs_max) {
4212 if ((fd = open("/dev/null", O_WRONLY)) < 0)
4213 break;
4214 if ((id = add_appcontext_input(fd, n_inputs)) < 0) {
4215 close(fd);
4216 break;
4217 }
4218 inputs[n_inputs].fd = fd;
4219 inputs[n_inputs].id = id;
4220 n_inputs++;
4221
4222 int n = 0;
4223 for (i = 0; i < n_offsets; i++) {
4224 if (get_appcontext_input_count_at(offsets[i]) == n_inputs)
4225 offsets[n++] = offsets[i];
4226 }
4227 for (i = n; i < n_offsets; i++)
4228 offsets[i] = 0;
4229 n_offsets = n;
4230 }
4231
4232 for (i = 0; i < n_inputs; i++) {
4233 XtRemoveInput(inputs[i].id);
4234 close(inputs[i].fd);
4235 }
4236
4237 if (n_offsets == 1)
4238 return offsets[0];
4239
4240#undef n_fds_max
4241#undef n_offsets_max
4242#undef high_offset
4243#undef low_offset
4244 return 0;
4245}
4246
4247static int get_appcontext_input_count(void)
4248{
4249 static int input_count_offset = -1;
4250 if (input_count_offset < 0)
4251 input_count_offset = get_appcontext_input_count_offset();
4252 if (input_count_offset == 0)
4253 return 1; /* fake we have input to trigger timeout */
4254 return get_appcontext_input_count_at(input_count_offset);
4255}
4256
4257static int xt_has_compatible_appcontext(void)
4258{
4259 return xt_has_compatible_appcontext_timerQueue();
4260}
4261
4262static int xt_get_next_timeout(GSource *source)
4263{
4264 static int has_compatible_appcontext = -1;
4265 if (has_compatible_appcontext < 0) {
4266 if ((has_compatible_appcontext = xt_has_compatible_appcontext()) == 0)
4267 npw_printf("WARNING: xt_get_next_timeout() is not optimizable\n");
4268 }
4269 int timeout = XT_DEFAULT_TIMEOUT;
4270 if (has_compatible_appcontext) {
4271 int input_timeout, timer_timeout;
4272 /* Check there is any input source to process */
4273 if (get_appcontext_input_count() > 0)
4274 input_timeout = XT_DEFAULT_TIMEOUT;
4275 else
4276 input_timeout = -1;
4277 /* Check there is any timer to process */
4278 if (x_app_context->timerQueue == NULL)
4279 timer_timeout = -1;
4280 else {
4281 /* Determine delay to next timeout. Zero means timeout already expired */
4282 struct timeval *next = &x_app_context->timerQueue->te_timer_value;
4283 GTimeVal now;
4284 int64_t diff;
4285 g_source_get_current_time(source, &now);
4286 if ((diff = (int64_t)next->tv_sec - (int64_t)now.tv_sec) < 0)
4287 timer_timeout = 0;
4288 else if ((diff = diff*1000 + ((int64_t)next->tv_usec - (int64_t)now.tv_usec)/1000) <= 0)
4289 timer_timeout = 0;
4290 else
4291 timer_timeout = diff;
4292 }
4293 if (input_timeout < 0)
4294 timeout = timer_timeout;
4295 else if (timer_timeout < 0)
4296 timeout = input_timeout;
4297 else
4298 timeout = MIN(input_timeout, timer_timeout);
4299 }
4300 return timeout;
4301}
37274302
3728static gboolean xt_event_prepare(GSource *source, gint *timeout)4303static gboolean xt_event_prepare(GSource *source, gint *timeout)
3729{4304{
3730 int mask = XtAppPending(x_app_context);4305 int mask = XtAppPending(x_app_context);
3731 return mask & XtIMXEvent;4306 if (mask)
4307 return TRUE;
4308 /* XXX: create new GPollFD for input sources? */
4309 return (*timeout = xt_get_next_timeout(source)) == 0;
3732}4310}
37334311
3734static gboolean xt_event_check(GSource *source)4312static gboolean xt_event_check(GSource *source)
3735{4313{
3736 if (xt_event_poll_fd.revents & G_IO_IN) {4314 if (xt_event_poll_fd.revents & G_IO_IN) {
3737 int mask = XtAppPending(x_app_context);4315 int mask = XtAppPending(x_app_context);
3738 if (mask & XtIMXEvent)4316 if (mask)
3739 return TRUE;4317 return TRUE;
3740 }4318 }
3741 return FALSE;4319 return FALSE;
@@ -3744,11 +4322,11 @@
3744static gboolean xt_event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)4322static gboolean xt_event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
3745{4323{
3746 int i;4324 int i;
3747 for (i = 0; i < 5; i++) {4325 for (i = 0; i < XT_MAX_DISPATCH_EVENTS; i++) {
3748 int mask = XtAppPending(x_app_context);4326 int mask = XtAppPending(x_app_context);
3749 if ((mask & XtIMXEvent) == 0)4327 if (mask == 0)
3750 break;4328 break;
3751 XtAppProcessEvent(x_app_context, XtIMXEvent);4329 XtAppProcessEvent(x_app_context, XtIMAll);
3752 }4330 }
3753 return TRUE;4331 return TRUE;
3754}4332}
@@ -3762,15 +4340,31 @@
3762 (GSourceDummyMarshal)NULL4340 (GSourceDummyMarshal)NULL
3763};4341};
37644342
3765static gboolean xt_event_polling_timer_callback(gpointer user_data)4343static int xt_source_create(void)
3766{4344{
3767 int i;4345 if (++xt_source_count > 1 && xt_source != NULL)
3768 for (i = 0; i < 5; i++) {4346 return 0;
3769 if ((XtAppPending(x_app_context) & (XtIMAll & ~XtIMXEvent)) == 0)4347
3770 break;4348 if ((xt_source = g_source_new(&xt_event_funcs, sizeof(GSource))) == NULL) {
3771 XtAppProcessEvent(x_app_context, XtIMAll & ~XtIMXEvent);4349 npw_printf("ERROR: failed to initialize Xt events listener\n");
3772 }4350 return -1;
3773 return TRUE;4351 }
4352 g_source_set_priority(xt_source, GDK_PRIORITY_EVENTS);
4353 g_source_set_can_recurse(xt_source, TRUE);
4354 g_source_attach(xt_source, NULL);
4355 xt_event_poll_fd.fd = ConnectionNumber(x_display);
4356 xt_event_poll_fd.events = G_IO_IN;
4357 xt_event_poll_fd.revents = 0;
4358 g_source_add_poll(xt_source, &xt_event_poll_fd);
4359 return 0;
4360}
4361
4362static void xt_source_destroy(void)
4363{
4364 if (--xt_source_count < 1 && xt_source) {
4365 g_source_destroy(xt_source);
4366 xt_source = NULL;
4367 }
3774}4368}
37754369
3776// RPC events4370// RPC events
@@ -3825,10 +4419,11 @@
3825 return 1;4419 return 1;
3826 }4420 }
3827 D(bug(" Plugin connection: %s\n", connection_path));4421 D(bug(" Plugin connection: %s\n", connection_path));
38284422 D(bug(" Plugin viewer pid: %d\n", getpid()));
3829 pid_init();4423
3830 D(bug(" Plugin viewer pid: %d\n", g_viewer_pid));4424 thread_check_init();
3831 4425 D(bug(" Plugin main thread: %p\n", g_main_thread));
4426
3832 // Cleanup environment, the program may fork/exec a native shell4427 // Cleanup environment, the program may fork/exec a native shell
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,
3834 // though not a fatal error4429 // though not a fatal error
@@ -3886,24 +4481,6 @@
38864481
3887 id_init();4482 id_init();
38884483
3889 // Initialize Xt events listener (integrate X events into GTK events loop)
3890 GSource *xt_source = g_source_new(&xt_event_funcs, sizeof(GSource));
3891 if (xt_source == NULL) {
3892 npw_printf("ERROR: failed to initialize Xt events listener\n");
3893 return 1;
3894 }
3895 g_source_set_priority(xt_source, GDK_PRIORITY_EVENTS);
3896 g_source_set_can_recurse(xt_source, TRUE);
3897 g_source_attach(xt_source, NULL);
3898 xt_event_poll_fd.fd = ConnectionNumber(x_display);
3899 xt_event_poll_fd.events = G_IO_IN;
3900 xt_event_poll_fd.revents = 0;
3901 g_source_add_poll(xt_source, &xt_event_poll_fd);
3902
3903 gint xt_polling_timer_id = g_timeout_add(25,
3904 xt_event_polling_timer_callback,
3905 NULL);
3906
3907 // Initialize RPC events listener4484 // Initialize RPC events listener
3908 GSource *rpc_source = g_source_new(&rpc_event_funcs, sizeof(GSource));4485 GSource *rpc_source = g_source_new(&rpc_event_funcs, sizeof(GSource));
3909 if (rpc_source == NULL) {4486 if (rpc_source == NULL) {
@@ -3924,9 +4501,13 @@
3924 gtk_main();4501 gtk_main();
3925 D(bug("--- EXIT ---\n"));4502 D(bug("--- EXIT ---\n"));
39264503
3927 g_source_remove(xt_polling_timer_id);4504#if USE_NPIDENTIFIER_CACHE
4505 npidentifier_cache_destroy();
4506#endif
4507
3928 g_source_destroy(rpc_source);4508 g_source_destroy(rpc_source);
3929 g_source_destroy(xt_source);4509 if (xt_source)
4510 g_source_destroy(xt_source);
39304511
3931 if (g_user_agent)4512 if (g_user_agent)
3932 free(g_user_agent);4513 free(g_user_agent);
39334514
=== modified file 'src/npw-viewer.sh'
--- src/npw-viewer.sh 2008-12-27 02:10:20 +0000
+++ src/npw-viewer.sh 2009-08-11 00:38:42 +0000
@@ -2,9 +2,8 @@
2#2#
3# nsplugin viewer wrapper script (C) 2005-2006 Gwenole Beauchesne3# nsplugin viewer wrapper script (C) 2005-2006 Gwenole Beauchesne
4#4#
5OS="`uname -s`"5OS="`uname -s | tr '[A-Z]' '[a-z]'`"
6ARCH="`uname -m`"6ARCH="`uname -m`"
7NPW_LIBDIR="%NPW_LIBDIR%"
87
9if test -z "$TARGET_OS"; then8if test -z "$TARGET_OS"; then
10 echo "*** NSPlugin Viewer *** error, TARGET_OS not initialized"9 echo "*** NSPlugin Viewer *** error, TARGET_OS not initialized"
@@ -16,7 +15,54 @@
16 exit 115 exit 1
17fi16fi
1817
19NPW_VIEWER_DIR=$NPW_LIBDIR/$TARGET_ARCH/$TARGET_OS18normalize_cpu() {
19local cpu="$1"
20case "$cpu" in
21arm*)
22 cpu="arm"
23 ;;
24i[3456]86|k[678]|i86pc|BePC)
25 cpu="i386"
26 ;;
27ia64)
28 cpu="ia64"
29 ;;
30"Power Macintosh"|ppc)
31 cpu="ppc"
32 ;;
33ppc64)
34 cpu="ppc64"
35 ;;
36sparc)
37 cpu="sparc"
38 ;;
39sparc64)
40 cpu="sparc64"
41 ;;
42x86_64|amd64)
43 cpu="x86_64"
44 ;;
45esac
46echo "$cpu"
47}
48
49normalize_os() {
50local os="$1"
51case "$os" in
52sunos*)
53 os="solaris"
54 ;;
55esac
56echo "$os"
57}
58
59ARCH=`normalize_cpu "$ARCH"`
60OS=`normalize_os "$OS"`
61TARGET_ARCH=`normalize_cpu "$TARGET_ARCH"`
62TARGET_OS=`normalize_os "$TARGET_OS"`
63
64# Define where npviewer.bin is located
65NPW_VIEWER_DIR="%NPW_VIEWER_DIR%"
2066
21# Set a new LD_LIBRARY_PATH that is TARGET specific67# Set a new LD_LIBRARY_PATH that is TARGET specific
22export LD_LIBRARY_PATH=$NPW_VIEWER_DIR68export LD_LIBRARY_PATH=$NPW_VIEWER_DIR
@@ -31,24 +77,15 @@
31NPW_USE_VALGRIND=${NPW_USE_VALGRIND:-no}77NPW_USE_VALGRIND=${NPW_USE_VALGRIND:-no}
32can_use_valgrind="no"78can_use_valgrind="no"
3379
34case $ARCH in
35i?86|i86pc)
36 ARCH=i386
37 ;;
38amd64)
39 ARCH=x86_64
40 ;;
41esac
42
43if test "$ARCH" != "$TARGET_ARCH"; then80if test "$ARCH" != "$TARGET_ARCH"; then
44 case $TARGET_ARCH in81 case $TARGET_ARCH in
45 i386)82 i386)
46 if test "$ARCH" = "x86_64"; then83 if test "$ARCH" = "x86_64"; then
47 case "$OS" in84 case "$OS" in
48 Linux)85 linux)
49 LOADER=`which linux32`86 LOADER=`which linux32`
50 ;;87 ;;
51 FreeBSD | NetBSD)88 freebsd | netbsd)
52 # XXX check that COMPAT_LINUX is enabled or fail otherwise89 # XXX check that COMPAT_LINUX is enabled or fail otherwise
53 LOADER="none"90 LOADER="none"
54 ;;91 ;;
@@ -66,7 +103,7 @@
66 ppc)103 ppc)
67 if test "$ARCH" = "ppc64"; then104 if test "$ARCH" = "ppc64"; then
68 case "$OS" in105 case "$OS" in
69 Linux)106 linux)
70 LOADER=`which linux32`107 LOADER=`which linux32`
71 ;;108 ;;
72 esac109 esac
@@ -98,7 +135,7 @@
98fi135fi
99136
100# Expand PATH for RealPlayer package on NetBSD (realplay)137# Expand PATH for RealPlayer package on NetBSD (realplay)
101if test "$OS" = "NetBSD"; then138if test "$OS" = "netbsd"; then
102 REALPLAYER_HOME="/usr/pkg/lib/RealPlayer"139 REALPLAYER_HOME="/usr/pkg/lib/RealPlayer"
103 if test -x "$REALPLAYER_HOME/realplay"; then140 if test -x "$REALPLAYER_HOME/realplay"; then
104 export PATH=$PATH:$REALPLAYER_HOME141 export PATH=$PATH:$REALPLAYER_HOME
@@ -114,7 +151,7 @@
114 # XXX: detect QEMU target soundwrapper differently151 # XXX: detect QEMU target soundwrapper differently
115 case "$LOADER" in152 case "$LOADER" in
116 *linux32)153 *linux32)
117 if test "$OS" = "Linux"; then154 if test "$OS" = "linux"; then
118 soundwrapper=`which soundwrapper 2>/dev/null`155 soundwrapper=`which soundwrapper 2>/dev/null`
119 if test -x "$soundwrapper"; then156 if test -x "$soundwrapper"; then
120 LOADER="$LOADER $soundwrapper"157 LOADER="$LOADER $soundwrapper"
121158
=== modified file 'src/npw-wrapper.c'
--- src/npw-wrapper.c 2009-01-02 10:07:27 +0000
+++ src/npw-wrapper.c 2009-08-11 00:38:42 +0000
@@ -21,7 +21,6 @@
21#define _GNU_SOURCE 1 /* RTLD_DEFAULT */21#define _GNU_SOURCE 1 /* RTLD_DEFAULT */
22#include "sysdeps.h"22#include "sysdeps.h"
2323
24#include <assert.h>
25#include <stdio.h>24#include <stdio.h>
26#include <stdlib.h>25#include <stdlib.h>
27#include <string.h>26#include <string.h>
@@ -61,12 +60,17 @@
61 NPW_DEFAULT_PLUGIN_PATH,60 NPW_DEFAULT_PLUGIN_PATH,
62 0,61 0,
63 HOST_OS,62 HOST_OS,
64 HOST_ARCH63 HOST_ARCH,
64 NPW_PLUGIN_INFO_VERSION,
65 ""
65};66};
6667
67// Path to plugin to use68// Path to plugin to use
68static const char *plugin_path = NPW_Plugin.path;69static const char *plugin_path = NPW_Plugin.path;
6970
71// Path to associated plugin viewer
72static const char *plugin_viewer_path = NPW_Plugin.viewer_path;
73
70// Netscape exported functions74// Netscape exported functions
71static NPNetscapeFuncs mozilla_funcs;75static NPNetscapeFuncs mozilla_funcs;
7276
@@ -2607,7 +2611,7 @@
2607 str =2611 str =
2608 "<a href=\"http://gwenole.beauchesne.info/projects/nspluginwrapper/\">nspluginwrapper</a> "2612 "<a href=\"http://gwenole.beauchesne.info/projects/nspluginwrapper/\">nspluginwrapper</a> "
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>"
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>"
2611 ;2615 ;
2612 ret = NPERR_NO_ERROR;2616 ret = NPERR_NO_ERROR;
2613 }2617 }
@@ -3348,15 +3352,13 @@
33483352
3349 static int init_count = 0;3353 static int init_count = 0;
3350 ++init_count;3354 ++init_count;
3351 char viewer_path[PATH_MAX];
3352 sprintf(viewer_path, "%s/%s/%s/%s", NPW_LIBDIR, NPW_Plugin.target_arch, NPW_Plugin.target_os, NPW_VIEWER);
3353 char connection_path[128];3355 char connection_path[128];
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);
33553357
3356 // Cache MIME info and plugin name/description3358 // Cache MIME info and plugin name/description
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) {
3358 char command[1024];3360 char command[1024];
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))
3360 return;3362 return;
3361 FILE *viewer_fp = popen(command, "r");3363 FILE *viewer_fp = popen(command, "r");
3362 if (viewer_fp == NULL)3364 if (viewer_fp == NULL)
@@ -3416,7 +3418,7 @@
34163418
3417 npw_close_all_open_files();3419 npw_close_all_open_files();
34183420
3419 execv(viewer_path, argv);3421 execv(plugin_viewer_path, argv);
3420 npw_printf("ERROR: failed to execute NSPlugin viewer\n");3422 npw_printf("ERROR: failed to execute NSPlugin viewer\n");
3421 _Exit(255);3423 _Exit(255);
3422 }3424 }
34233425
=== modified file 'src/rpc.c'
--- src/rpc.c 2009-01-02 10:07:27 +0000
+++ src/rpc.c 2009-08-11 00:38:42 +0000
@@ -60,9 +60,11 @@
60// build of the viewer can interoperate with non-Linux wrappers. Linux60// build of the viewer can interoperate with non-Linux wrappers. Linux
61// distributions can use this code though.61// distributions can use this code though.
62// XXX better clean-up dead sockets properly on failure...62// XXX better clean-up dead sockets properly on failure...
63#ifdef BUILD_LINUX_ONLY63#ifndef BUILD_GENERIC
64#if defined(__linux__)
64#define USE_ANONYMOUS_SOCKETS 165#define USE_ANONYMOUS_SOCKETS 1
65#endif66#endif
67#endif
6668
67// Define the maximum amount of time (in seconds) to wait for a message69// Define the maximum amount of time (in seconds) to wait for a message
68#ifndef RPC_MESSAGE_TIMEOUT70#ifndef RPC_MESSAGE_TIMEOUT
@@ -459,6 +461,8 @@
459 int status;461 int status;
460 int socket;462 int socket;
461 char *socket_path;463 char *socket_path;
464 struct sockaddr_un socket_addr;
465 socklen_t socket_addr_len;
462 int server_socket;466 int server_socket;
463 int server_thread_active;467 int server_thread_active;
464 pthread_t server_thread;468 pthread_t server_thread;
@@ -663,59 +667,131 @@
663 return n;667 return n;
664}668}
665669
670// Create a new RPC connection (initialize common structure members)
671static rpc_connection_t *rpc_connection_new(int type, const char *ident)
672{
673 rpc_connection_t *connection;
674
675 if (ident == NULL)
676 return NULL;
677
678 if ((connection = (rpc_connection_t *)calloc(1, sizeof(*connection))) == NULL)
679 return NULL;
680
681 connection->type = type;
682 connection->refcnt = 1;
683 connection->status = RPC_STATUS_CLOSED;
684 connection->socket = -1;
685 connection->server_socket = -1;
686 connection->server_thread_active = 0;
687 connection->error_callback = NULL;
688 connection->error_callback_data = NULL;
689 connection->dispatch_depth = 0;
690 connection->invoke_depth = 0;
691 connection->handle_depth = 0;
692 connection->sync_depth = 0;
693 connection->pending_sync_depth = 0;
694
695 if ((connection->types = rpc_map_new_full((free))) == NULL) {
696 rpc_exit(connection);
697 return NULL;
698 }
699
700 if ((connection->methods = rpc_map_new()) == NULL) {
701 rpc_exit(connection);
702 return NULL;
703 }
704
705 int fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
706 if (fd < 0) {
707 perror("socket");
708 rpc_exit(connection);
709 return NULL;
710 }
711
712 if (type == RPC_CONNECTION_SERVER)
713 connection->server_socket = fd;
714 else {
715 connection->socket = fd;
716
717 if (rpc_set_non_blocking_io(fd) < 0) {
718 perror("socket set non-blocking");
719 rpc_exit(connection);
720 return NULL;
721 }
722 }
723
724 memset(&connection->socket_addr, 0, sizeof(connection->socket_addr));
725 connection->socket_addr.sun_family = AF_UNIX;
726 connection->socket_path = NULL;
727 connection->socket_addr_len = _rpc_socket_path(&connection->socket_path, ident);
728 memcpy(&connection->socket_addr.sun_path[0], connection->socket_path, connection->socket_addr_len);
729 connection->socket_addr_len += offsetof(struct sockaddr_un, sun_path); /* though POSIX says size of the actual sockaddr structure */
730#ifdef HAVE_SOCKADDR_UN_SUN_LEN
731 connection->socket_addr.sun_len = connection->socket_addr_len;
732#endif
733
734 return connection;
735}
736
737// Destroy an RPC connection
738static void rpc_connection_destroy(rpc_connection_t *connection)
739{
740 if (connection == NULL)
741 return;
742
743 if (connection->socket_path) {
744 if (connection->socket_path[0])
745 unlink(connection->socket_path);
746 free(connection->socket_path);
747 connection->socket_path = NULL;
748 }
749
750 if (connection->type == RPC_CONNECTION_SERVER) {
751 if (connection->server_thread_active) {
752 pthread_cancel(connection->server_thread);
753 pthread_join(connection->server_thread, NULL);
754 connection->server_thread = 0;
755 }
756 if (connection->socket != -1) {
757 close(connection->socket);
758 connection->socket = -1;
759 }
760 if (connection->server_socket != -1) {
761 close(connection->server_socket);
762 connection->server_socket = -1;
763 }
764 }
765 else {
766 if (connection->socket != -1) {
767 close(connection->socket);
768 connection->socket = -1;
769 }
770 }
771
772 if (connection->types) {
773 rpc_map_destroy(connection->types);
774 connection->types = NULL;
775 }
776 if (connection->methods) {
777 rpc_map_destroy(connection->methods);
778 connection->methods = NULL;
779 }
780
781 free(connection);
782}
783
666// Initialize server-side RPC system784// Initialize server-side RPC system
667rpc_connection_t *rpc_init_server(const char *ident)785rpc_connection_t *rpc_init_server(const char *ident)
668{786{
669 D(bug("rpc_init_server ident='%s'\n", ident));787 D(bug("rpc_init_server ident='%s'\n", ident));
670788
671 rpc_connection_t *connection;789 rpc_connection_t *connection;
672 struct sockaddr_un addr;790
673 socklen_t addr_len;791 if ((connection = rpc_connection_new(RPC_CONNECTION_SERVER, ident)) == NULL)
674792 return NULL;
675 if (ident == NULL)793
676 return NULL;794 if (bind(connection->server_socket, (struct sockaddr *)&connection->socket_addr, connection->socket_addr_len) < 0) {
677
678 connection = (rpc_connection_t *)calloc(1, sizeof(*connection));
679 if (connection == NULL)
680 return NULL;
681 connection->type = RPC_CONNECTION_SERVER;
682 connection->refcnt = 1;
683 connection->status = RPC_STATUS_CLOSED;
684 connection->socket = -1;
685 connection->server_thread_active = 0;
686 connection->error_callback = NULL;
687 connection->error_callback_data = NULL;
688 connection->dispatch_depth = 0;
689 connection->invoke_depth = 0;
690 connection->handle_depth = 0;
691 connection->sync_depth = 0;
692 connection->pending_sync_depth = 0;
693 if ((connection->types = rpc_map_new_full((free))) == NULL) {
694 rpc_exit(connection);
695 return NULL;
696 }
697 if ((connection->methods = rpc_map_new()) == NULL) {
698 rpc_exit(connection);
699 return NULL;
700 }
701
702 if ((connection->server_socket = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0)) < 0) {
703 perror("server socket");
704 rpc_exit(connection);
705 return NULL;
706 }
707
708 memset(&addr, 0, sizeof(addr));
709 addr.sun_family = AF_UNIX;
710 connection->socket_path = NULL;
711 addr_len = _rpc_socket_path(&connection->socket_path, ident);
712 memcpy(&addr.sun_path[0], connection->socket_path, addr_len);
713 addr_len += offsetof(struct sockaddr_un, sun_path); /* though POSIX says size of the actual sockaddr structure */
714#ifdef HAVE_SOCKADDR_UN_SUN_LEN
715 addr.sun_len = addr_len;
716#endif
717
718 if (bind(connection->server_socket, (struct sockaddr *)&addr, addr_len) < 0) {
719 perror("server bind");795 perror("server bind");
720 rpc_exit(connection);796 rpc_exit(connection);
721 return NULL;797 return NULL;
@@ -737,56 +813,9 @@
737 D(bug("rpc_init_client ident='%s'\n", ident));813 D(bug("rpc_init_client ident='%s'\n", ident));
738814
739 rpc_connection_t *connection;815 rpc_connection_t *connection;
740 struct sockaddr_un addr;816
741 socklen_t addr_len;817 if ((connection = rpc_connection_new(RPC_CONNECTION_CLIENT, ident)) == NULL)
742818 return NULL;
743 if (ident == NULL)
744 return NULL;
745
746 connection = (rpc_connection_t *)calloc(1, sizeof(*connection));
747 if (connection == NULL)
748 return NULL;
749 connection->type = RPC_CONNECTION_CLIENT;
750 connection->refcnt = 1;
751 connection->status = RPC_STATUS_CLOSED;
752 connection->server_socket = -1;
753 connection->error_callback = NULL;
754 connection->error_callback_data = NULL;
755 connection->dispatch_depth = 0;
756 connection->invoke_depth = 0;
757 connection->handle_depth = 0;
758 connection->sync_depth = 0;
759 connection->pending_sync_depth = 0;
760 if ((connection->types = rpc_map_new_full((free))) == NULL) {
761 rpc_exit(connection);
762 return NULL;
763 }
764 if ((connection->methods = rpc_map_new()) == NULL) {
765 rpc_exit(connection);
766 return NULL;
767 }
768
769 if ((connection->socket = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0)) < 0) {
770 perror("client socket");
771 rpc_exit(connection);
772 return NULL;
773 }
774
775 if (rpc_set_non_blocking_io(connection->socket) < 0) {
776 perror("client socket set non-blocking");
777 rpc_exit(connection);
778 return NULL;
779 }
780
781 memset(&addr, 0, sizeof(addr));
782 addr.sun_family = AF_UNIX;
783 connection->socket_path = NULL;
784 addr_len = _rpc_socket_path(&connection->socket_path, ident);
785 memcpy(&addr.sun_path[0], connection->socket_path, addr_len);
786 addr_len += offsetof(struct sockaddr_un, sun_path); /* though POSIX says size of the actual sockaddr structure */
787#ifdef HAVE_SOCKADDR_UN_SUN_LEN
788 addr.sun_len = addr_len;
789#endif
790819
791 // Wait at most RPC_INIT_TIMEOUT seconds for server to initialize820 // Wait at most RPC_INIT_TIMEOUT seconds for server to initialize
792 const int N_CONNECT_WAIT_DELAY = 10;821 const int N_CONNECT_WAIT_DELAY = 10;
@@ -794,7 +823,7 @@
794 if (n_connect_attempts == 0)823 if (n_connect_attempts == 0)
795 n_connect_attempts = 1;824 n_connect_attempts = 1;
796 while (n_connect_attempts > 0) {825 while (n_connect_attempts > 0) {
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)
798 break;827 break;
799 if (n_connect_attempts > 1 && errno != ECONNREFUSED && errno != ENOENT) {828 if (n_connect_attempts > 1 && errno != ECONNREFUSED && errno != ENOENT) {
800 perror("client_connect");829 perror("client_connect");
@@ -821,45 +850,7 @@
821 if (connection == NULL)850 if (connection == NULL)
822 return RPC_ERROR_CONNECTION_NULL;851 return RPC_ERROR_CONNECTION_NULL;
823852
824 if (connection->socket_path) {853 rpc_connection_destroy(connection);
825 if (connection->socket_path[0])
826 unlink(connection->socket_path);
827 free(connection->socket_path);
828 connection->socket_path = NULL;
829 }
830
831 if (connection->type == RPC_CONNECTION_SERVER) {
832 if (connection->server_thread_active) {
833 pthread_cancel(connection->server_thread);
834 pthread_join(connection->server_thread, NULL);
835 connection->server_thread = 0;
836 }
837 if (connection->socket != -1) {
838 close(connection->socket);
839 connection->socket = -1;
840 }
841 if (connection->server_socket != -1) {
842 close(connection->server_socket);
843 connection->server_socket = -1;
844 }
845 }
846 else {
847 if (connection->socket != -1) {
848 close(connection->socket);
849 connection->socket = -1;
850 }
851 }
852
853 if (connection->types) {
854 rpc_map_destroy(connection->types);
855 connection->types = NULL;
856 }
857 if (connection->methods) {
858 rpc_map_destroy(connection->methods);
859 connection->methods = NULL;
860 }
861
862 free(connection);
863 return RPC_ERROR_NO_ERROR;854 return RPC_ERROR_NO_ERROR;
864}855}
865856
866857
=== modified file 'src/sysdeps.h'
--- src/sysdeps.h 2009-01-02 10:07:27 +0000
+++ src/sysdeps.h 2009-08-11 00:38:42 +0000
@@ -45,9 +45,9 @@
45#define NPW_VIEWER NPW_VIEWER_BASE45#define NPW_VIEWER NPW_VIEWER_BASE
46#define NPW_WRAPPER_BASE "npwrapper"46#define NPW_WRAPPER_BASE "npwrapper"
47#define NPW_WRAPPER NPW_WRAPPER_BASE ".so"47#define NPW_WRAPPER NPW_WRAPPER_BASE ".so"
48#define NPW_OLD_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" NPW_WRAPPER48#define NPW_DEFAULT_PLUGIN_PATH NPW_HOST_LIBDIR "/" NPW_WRAPPER
49#define NPW_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" HOST_OS "/" NPW_WRAPPER49#define NPW_PLUGIN_INFO_VERSION 2
50#define NPW_PLUGIN_IDENT "NPW:" NPW_VERSION50#define NPW_PLUGIN_IDENT "NPW:X:" NPW_VERSION
51#define NPW_PLUGIN_IDENT_SIZE 3251#define NPW_PLUGIN_IDENT_SIZE 32
52typedef struct __attribute__((packed)) {52typedef struct __attribute__((packed)) {
53 char ident[NPW_PLUGIN_IDENT_SIZE];53 char ident[NPW_PLUGIN_IDENT_SIZE];
@@ -55,6 +55,8 @@
55 time_t mtime;55 time_t mtime;
56 char target_arch[65];56 char target_arch[65];
57 char target_os[65];57 char target_os[65];
58 char struct_version; /* extended format "NPW:X:VERSION" */
59 char viewer_path[PATH_MAX];
58} NPW_PluginInfo;60} NPW_PluginInfo;
5961
60#if defined(BUILD_XPCOM)62#if defined(BUILD_XPCOM)

Subscribers

People subscribed via source and target branches

to all changes: