[OS/2] fix plugin build bustage following bug 453883 (and clean up whitespace)

This commit is contained in:
Peter Weilbacher 2008-09-17 00:12:14 +03:00
Родитель 3f5e944b02
Коммит 610d7e145d
2 изменённых файлов: 116 добавлений и 98 удалений

Просмотреть файл

@ -54,7 +54,7 @@ NPNetscapeFuncs* g_pNavigatorFuncs = 0;
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
// PLUGIN DLL entry points
// PLUGIN DLL entry points
//
// These are the Windows specific DLL entry points. They must be exoprted
//
@ -69,19 +69,19 @@ static NPPluginFuncs* g_pluginFuncs;
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
// NP_GetEntryPoints
//
// fills in the func table used by Navigator to call entry points in
// plugin DLL. Note that these entry points ensure that DS is loaded
// by using the NP_LOADDS macro, when compiling for Win16
// fills in the func table used by Navigator to call entry points in
// plugin DLL. Note that these entry points ensure that DS is loaded
// by using the NP_LOADDS macro, when compiling for Win16
//
NPError OSCALL NP_EXPORT
NP_GetEntryPoints(NPPluginFuncs* pFuncs)
{
// trap a NULL ptr
// trap a NULL ptr
if(pFuncs == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
// if the plugin's function table is smaller than the plugin expects,
// then they are incompatible, and should return an error
// then they are incompatible, and should return an error
pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
pFuncs->newp = NPP_New;
@ -93,9 +93,9 @@ NP_GetEntryPoints(NPPluginFuncs* pFuncs)
pFuncs->writeready = NPP_WriteReady;
pFuncs->write = NPP_Write;
pFuncs->print = NPP_Print;
pFuncs->event = 0; /// reserved
pFuncs->event = 0; /// reserved
g_pluginFuncs = pFuncs;
g_pluginFuncs = pFuncs;
return NPERR_NO_ERROR;
}
@ -104,32 +104,32 @@ NP_GetEntryPoints(NPPluginFuncs* pFuncs)
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
// NP_Initialize
//
// called immediately after the plugin DLL is loaded
// called immediately after the plugin DLL is loaded
//
NPError OSCALL NP_EXPORT
NPError OSCALL NP_EXPORT
NP_Initialize(NPNetscapeFuncs* pFuncs)
{
// trap a NULL ptr
// trap a NULL ptr
if(pFuncs == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
g_pNavigatorFuncs = pFuncs; // save it for future reference
g_pNavigatorFuncs = pFuncs; // save it for future reference
// if the plugin's major ver level is lower than the Navigator's,
// then they are incompatible, and should return an error
// then they are incompatible, and should return an error
if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
return NPERR_INCOMPATIBLE_VERSION_ERROR;
// We have to defer these assignments until g_pNavigatorFuncs is set
// We have to defer these assignments until g_pNavigatorFuncs is set
int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
g_pluginFuncs->urlnotify = NPP_URLNotify;
}
if( navMinorVers >= NPVERS_HAS_LIVECONNECT ) {
g_pluginFuncs->javaClass = NULL;
}
// NPP_Initialize is a standard (cross-platform) initialize function.
if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
g_pluginFuncs->urlnotify = NPP_URLNotify;
}
if( navMinorVers >= NPVERS_HAS_LIVECONNECT ) {
g_pluginFuncs->javaClass = NULL;
}
// NPP_Initialize is a standard (cross-platform) initialize function.
return NPP_Initialize();
}
@ -137,11 +137,11 @@ NP_Initialize(NPNetscapeFuncs* pFuncs)
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
// NP_Shutdown
//
// called immediately before the plugin DLL is unloaded.
// This function should check for some ref count on the dll to see if it is
// unloadable or it needs to stay in memory.
// called immediately before the plugin DLL is unloaded.
// This function should check for some ref count on the dll to see if it is
// unloadable or it needs to stay in memory.
//
NPError OSCALL NP_EXPORT
NPError OSCALL NP_EXPORT
NP_Shutdown()
{
NPP_Shutdown();
@ -149,17 +149,18 @@ NP_Shutdown()
return NPERR_NO_ERROR;
}
char * NP_GetMIMEDescription()
char*
NP_GetMIMEDescription()
{
static char mimetype[] = NS_PLUGIN_DEFAULT_MIME_DESCRIPTION;
return mimetype;
}
// END - PLUGIN DLL entry points
// END - PLUGIN DLL entry points
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
/* NAVIGATOR Entry points */
/* NAVIGATOR Entry points */
/* These entry points expect to be called from within the plugin. The
noteworthy assumption is that DS has already been set to point to the
@ -171,7 +172,9 @@ char * NP_GetMIMEDescription()
/* returns the major/minor version numbers of the Plugin API for the plugin
and the Navigator
*/
void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
void
NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major,
int* netscape_minor)
{
*plugin_major = NP_VERSION_MAJOR;
*plugin_minor = NP_VERSION_MINOR;
@ -179,7 +182,8 @@ void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int*
*netscape_minor = LOBYTE(g_pNavigatorFuncs->version);
}
NPError NPN_GetValue(NPP instance, NPNVariable variable, void *result)
NPError
NPN_GetValue(NPP instance, NPNVariable variable, void *result)
{
return g_pNavigatorFuncs->getvalue(instance, variable, result);
}
@ -187,41 +191,47 @@ NPError NPN_GetValue(NPP instance, NPNVariable variable, void *result)
/* causes the specified URL to be fetched and streamed in
*/
NPError NPN_GetURLNotify(NPP instance, const char *url, const char *target, void* notifyData)
NPError
NPN_GetURLNotify(NPP instance, const char *url, const char *target,
void* notifyData)
{
int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
NPError err;
if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
err = g_pNavigatorFuncs->geturlnotify(instance, url, target, notifyData);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
NPError err;
if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
err = g_pNavigatorFuncs->geturlnotify(instance, url, target, notifyData);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
}
NPError NPN_GetURL(NPP instance, const char *url, const char *target)
NPError
NPN_GetURL(NPP instance, const char *url, const char *target)
{
return g_pNavigatorFuncs->geturl(instance, url, target);
}
NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData)
NPError
NPN_PostURLNotify(NPP instance, const char* url, const char* window,
uint32_t len, const char* buf, NPBool file, void* notifyData)
{
int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
NPError err;
if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
err = g_pNavigatorFuncs->posturlnotify(instance, url, window, len, buf, file, notifyData);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
NPError err;
if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
err = g_pNavigatorFuncs->posturlnotify(instance, url, window, len, buf, file, notifyData);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
}
NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file)
NPError
NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len,
const char* buf, NPBool file)
{
return g_pNavigatorFuncs->posturl(instance, url, window, len, buf, file);
}
@ -230,7 +240,8 @@ NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32 le
this would be used if a stream was in "pull" mode. An optional
position can be provided for streams which are seekable.
*/
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
NPError
NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
{
return g_pNavigatorFuncs->requestread(stream, rangeList);
}
@ -238,65 +249,69 @@ NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
/* Creates a new stream of data from the plug-in to be interpreted
by Netscape in the current window.
*/
NPError NPN_NewStream(NPP instance, NPMIMEType type,
const char* target, NPStream** stream)
NPError
NPN_NewStream(NPP instance, NPMIMEType type, const char* target,
NPStream** stream)
{
int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
NPError err;
int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
NPError err;
if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
err = g_pNavigatorFuncs->newstream(instance, type, target, stream);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
err = g_pNavigatorFuncs->newstream(instance, type, target, stream);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
}
/* Provides len bytes of data.
*/
int32 NPN_Write(NPP instance, NPStream *stream,
int32 len, void *buffer)
int32_t
NPN_Write(NPP instance, NPStream *stream, int32_t len, void *buffer)
{
int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
int32 result;
int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
int32_t result;
if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
result = g_pNavigatorFuncs->write(instance, stream, len, buffer);
}
else {
result = -1;
}
return result;
if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
result = g_pNavigatorFuncs->write(instance, stream, len, buffer);
}
else {
result = -1;
}
return result;
}
/* Closes a stream object.
reason indicates why the stream was closed.
/* Closes a stream object.
reason indicates why the stream was closed.
*/
NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
NPError
NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
{
int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
NPError err;
int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
NPError err;
if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
err = g_pNavigatorFuncs->destroystream(instance, stream, reason);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
err = g_pNavigatorFuncs->destroystream(instance, stream, reason);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
}
/* Provides a text status message in the Netscape client user interface
*/
void NPN_Status(NPP instance, const char *message)
void
NPN_Status(NPP instance, const char *message)
{
g_pNavigatorFuncs->status(instance, message);
}
/* returns the user agent string of Navigator, which contains version info
*/
const char* NPN_UserAgent(NPP instance)
const char*
NPN_UserAgent(NPP instance)
{
return g_pNavigatorFuncs->uagent(instance);
}
@ -304,22 +319,24 @@ const char* NPN_UserAgent(NPP instance)
/* allocates memory from the Navigator's memory space. Necessary so that
saved instance data may be freed by Navigator when exiting.
*/
void* NPN_MemAlloc(uint32 size)
void*
NPN_MemAlloc(uint32_t size)
{
return g_pNavigatorFuncs->memalloc(size);
}
/* reciprocal of MemAlloc() above
*/
void NPN_MemFree(void* ptr)
void
NPN_MemFree(void* ptr)
{
g_pNavigatorFuncs->memfree(ptr);
}
/* private function to Netscape. do not use!
*/
void NPN_ReloadPlugins(NPBool reloadPages)
void
NPN_ReloadPlugins(NPBool reloadPages)
{
g_pNavigatorFuncs->reloadplugins(reloadPages);
}

Просмотреть файл

@ -243,7 +243,7 @@ NPP_NewStream(NPP pInstance,
//------------------------------------------------------------------------------------
// NPP_WriteReady:
//------------------------------------------------------------------------------------
int32 NP_LOADDS
int32_t NP_LOADDS
NPP_WriteReady(NPP pInstance, NPStream *stream)
{
dbgOut1("NPP_WriteReady");
@ -262,8 +262,9 @@ NPP_WriteReady(NPP pInstance, NPStream *stream)
//------------------------------------------------------------------------------------
// NPP_Write:
//------------------------------------------------------------------------------------
int32 NP_LOADDS
NPP_Write(NPP pInstance, NPStream *stream, int32 offset, int32 len, void *buffer)
int32_t NP_LOADDS
NPP_Write(NPP pInstance, NPStream *stream, int32_t offset, int32_t len,
void *buffer)
{
//dbgOut1("NPP_Write");
if(pInstance == NULL)