~ubuntu-branches/ubuntu/quantal/gecko-mediaplayer/quantal

« back to all changes in this revision

Viewing changes to .pc/91_svn421_disable_npp_initialize.patch/src/np_entry.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2011-07-17 22:24:37 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20110717222437-f0skmzay316o4rve
Tags: 1.0.4-0ubuntu1
* New upstream release.
* debian/patches:
 - 90_svn420_fix_null.patch: Remove, merged upstream.
 - 91_svn421_disable_npp_initialize.patch: Remove, merged upstream.
 - dont_use_libxul.patch: Remove, fixed upstream.
 - autotools.patch: Remove, not needed now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
 
/* ***** BEGIN LICENSE BLOCK *****
3
 
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
4
 
 *
5
 
 * The contents of this file are subject to the Netscape Public License
6
 
 * Version 1.1 (the "License"); you may not use this file except in
7
 
 * compliance with the License. You may obtain a copy of the License at
8
 
 * http://www.mozilla.org/NPL/
9
 
 *
10
 
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 
 * for the specific language governing rights and limitations under the
13
 
 * License.
14
 
 *
15
 
 * The Original Code is mozilla.org code.
16
 
 *
17
 
 * The Initial Developer of the Original Code is 
18
 
 * Netscape Communications Corporation.
19
 
 * Portions created by the Initial Developer are Copyright (C) 1998
20
 
 * the Initial Developer. All Rights Reserved.
21
 
 *
22
 
 * Contributor(s):
23
 
 *
24
 
 * Alternatively, the contents of this file may be used under the terms of
25
 
 * either the GNU General Public License Version 2 or later (the "GPL"), or 
26
 
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
 
 * in which case the provisions of the GPL or the LGPL are applicable instead
28
 
 * of those above. If you wish to allow use of your version of this file only
29
 
 * under the terms of either the GPL or the LGPL, and not to allow others to
30
 
 * use your version of this file under the terms of the NPL, indicate your
31
 
 * decision by deleting the provisions above and replace them with the notice
32
 
 * and other provisions required by the GPL or the LGPL. If you do not delete
33
 
 * the provisions above, a recipient may use your version of this file under
34
 
 * the terms of any one of the NPL, the GPL or the LGPL.
35
 
 *
36
 
 * ***** END LICENSE BLOCK ***** */
37
 
 
38
 
//////////////////////////////////////////////////////////////
39
 
//
40
 
// Main plugin entry point implementation
41
 
//
42
 
#include <npapi.h>
43
 
#include <npfunctions.h>
44
 
#include "npupp.h"
45
 
 
46
 
#ifndef HIBYTE
47
 
#define HIBYTE(x) ((((uint32_t)(x)) & 0xff00) >> 8)
48
 
#endif
49
 
 
50
 
NPNetscapeFuncs NPNFuncs;
51
 
 
52
 
#ifdef XP_WIN
53
 
 
54
 
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs * pFuncs)
55
 
{
56
 
    if (pFuncs == NULL)
57
 
        return NPERR_INVALID_FUNCTABLE_ERROR;
58
 
 
59
 
    if (pFuncs->size < sizeof(NPPluginFuncs))
60
 
        return NPERR_INVALID_FUNCTABLE_ERROR;
61
 
 
62
 
    pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
63
 
    pFuncs->newp = NPP_New;
64
 
    pFuncs->destroy = NPP_Destroy;
65
 
    pFuncs->setwindow = NPP_SetWindow;
66
 
    pFuncs->newstream = NPP_NewStream;
67
 
    pFuncs->destroystream = NPP_DestroyStream;
68
 
    pFuncs->asfile = NPP_StreamAsFile;
69
 
    pFuncs->writeready = NPP_WriteReady;
70
 
    pFuncs->write = NPP_Write;
71
 
    pFuncs->print = NPP_Print;
72
 
    pFuncs->event = NPP_HandleEvent;
73
 
    pFuncs->urlnotify = NPP_URLNotify;
74
 
    pFuncs->getvalue = NPP_GetValue;
75
 
    pFuncs->setvalue = NPP_SetValue;
76
 
    pFuncs->javaClass = NULL;
77
 
 
78
 
    return NPERR_NO_ERROR;
79
 
}
80
 
 
81
 
#endif                          /* XP_WIN */
82
 
 
83
 
char *NPP_GetMIMEDescription();
84
 
 
85
 
char *NP_GetMIMEDescription()
86
 
{
87
 
    return NPP_GetMIMEDescription();
88
 
}
89
 
 
90
 
NPError NP_GetValue(void *future, NPPVariable variable, void *value)
91
 
{
92
 
    return NPP_GetValue((NPP_t *) future, variable, value);
93
 
}
94
 
 
95
 
NPError OSCALL NP_Initialize(NPNetscapeFuncs * pFuncs
96
 
#ifdef XP_UNIX
97
 
                             , NPPluginFuncs * pluginFuncs
98
 
#endif
99
 
    )
100
 
{
101
 
    if (pFuncs == NULL)
102
 
        return NPERR_INVALID_FUNCTABLE_ERROR;
103
 
 
104
 
    if (HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
105
 
        return NPERR_INCOMPATIBLE_VERSION_ERROR;
106
 
 
107
 
    if (pFuncs->size < sizeof(NPNetscapeFuncs))
108
 
        return NPERR_INVALID_FUNCTABLE_ERROR;
109
 
 
110
 
    NPNFuncs.size = pFuncs->size;
111
 
    NPNFuncs.version = pFuncs->version;
112
 
    NPNFuncs.geturlnotify = pFuncs->geturlnotify;
113
 
    NPNFuncs.geturl = pFuncs->geturl;
114
 
    NPNFuncs.posturlnotify = pFuncs->posturlnotify;
115
 
    NPNFuncs.posturl = pFuncs->posturl;
116
 
    NPNFuncs.requestread = pFuncs->requestread;
117
 
    NPNFuncs.newstream = pFuncs->newstream;
118
 
    NPNFuncs.write = pFuncs->write;
119
 
    NPNFuncs.destroystream = pFuncs->destroystream;
120
 
    NPNFuncs.status = pFuncs->status;
121
 
    NPNFuncs.uagent = pFuncs->uagent;
122
 
    NPNFuncs.memalloc = pFuncs->memalloc;
123
 
    NPNFuncs.memfree = pFuncs->memfree;
124
 
    NPNFuncs.memflush = pFuncs->memflush;
125
 
    NPNFuncs.reloadplugins = pFuncs->reloadplugins;
126
 
    NPNFuncs.getJavaEnv = pFuncs->getJavaEnv;
127
 
    NPNFuncs.getJavaPeer = pFuncs->getJavaPeer;
128
 
    NPNFuncs.getvalue = pFuncs->getvalue;
129
 
    NPNFuncs.setvalue = pFuncs->setvalue;
130
 
    NPNFuncs.invalidaterect = pFuncs->invalidaterect;
131
 
    NPNFuncs.invalidateregion = pFuncs->invalidateregion;
132
 
    NPNFuncs.forceredraw = pFuncs->forceredraw;
133
 
    NPNFuncs.getstringidentifier = pFuncs->getstringidentifier;
134
 
    NPNFuncs.getstringidentifiers = pFuncs->getstringidentifiers;
135
 
    NPNFuncs.getintidentifier = pFuncs->getintidentifier;
136
 
    NPNFuncs.identifierisstring = pFuncs->identifierisstring;
137
 
    NPNFuncs.utf8fromidentifier = pFuncs->utf8fromidentifier;
138
 
    NPNFuncs.intfromidentifier = pFuncs->intfromidentifier;
139
 
    NPNFuncs.createobject = pFuncs->createobject;
140
 
    NPNFuncs.retainobject = pFuncs->retainobject;
141
 
    NPNFuncs.releaseobject = pFuncs->releaseobject;
142
 
    NPNFuncs.invoke = pFuncs->invoke;
143
 
    NPNFuncs.invokeDefault = pFuncs->invokeDefault;
144
 
    NPNFuncs.evaluate = pFuncs->evaluate;
145
 
    NPNFuncs.getproperty = pFuncs->getproperty;
146
 
    NPNFuncs.setproperty = pFuncs->setproperty;
147
 
    NPNFuncs.removeproperty = pFuncs->removeproperty;
148
 
    NPNFuncs.hasproperty = pFuncs->hasproperty;
149
 
    NPNFuncs.hasmethod = pFuncs->hasmethod;
150
 
    NPNFuncs.releasevariantvalue = pFuncs->releasevariantvalue;
151
 
    NPNFuncs.setexception = pFuncs->setexception;
152
 
 
153
 
#ifdef XP_UNIX
154
 
    /*
155
 
     * Set up the plugin function table that Netscape will use to
156
 
     * call us.  Netscape needs to know about our version and size
157
 
     * and have a UniversalProcPointer for every function we
158
 
     * implement.
159
 
     */
160
 
    pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
161
 
    pluginFuncs->size = sizeof(NPPluginFuncs);
162
 
    pluginFuncs->newp = NewNPP_NewProc(NPP_New);
163
 
    pluginFuncs->destroy = NewNPP_DestroyProc(NPP_Destroy);
164
 
    pluginFuncs->setwindow = NewNPP_SetWindowProc(NPP_SetWindow);
165
 
    pluginFuncs->newstream = NewNPP_NewStreamProc(NPP_NewStream);
166
 
    pluginFuncs->destroystream = NewNPP_DestroyStreamProc(NPP_DestroyStream);
167
 
    pluginFuncs->asfile = NewNPP_StreamAsFileProc(NPP_StreamAsFile);
168
 
    pluginFuncs->writeready = NewNPP_WriteReadyProc(NPP_WriteReady);
169
 
    pluginFuncs->write = NewNPP_WriteProc(NPP_Write);
170
 
    pluginFuncs->print = NewNPP_PrintProc(NPP_Print);
171
 
    pluginFuncs->urlnotify = NewNPP_URLNotifyProc(NPP_URLNotify);
172
 
    pluginFuncs->event = NULL;
173
 
    pluginFuncs->getvalue = NewNPP_GetValueProc(NPP_GetValue);
174
 
#ifdef OJI
175
 
    pluginFuncs->javaClass = NPP_GetJavaClass();
176
 
#endif
177
 
 
178
 
    NPP_Initialize();
179
 
#endif
180
 
 
181
 
    return NPERR_NO_ERROR;
182
 
}
183
 
 
184
 
NPError OSCALL NP_Shutdown()
185
 
{
186
 
    return NPERR_NO_ERROR;
187
 
}