Commit 6d46ff32 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

More similarities between Mac and Unix version

parent 2e7f8878
......@@ -54,21 +54,32 @@ static inline int getMinorVersion() { return gNetscapeFuncs->version & 0xFF; }
#pragma mark -
#pragma mark Wrapper Functions
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;
*netscape_major = gNetscapeFuncs->version >> 8; // Major version is in high byte
*netscape_minor = getMinorVersion(); // Minor version is in low byte
/* Major version is in high byte */
*netscape_major = gNetscapeFuncs->version >> 8;
/* Minor version is in low byte */
*netscape_minor = getMinorVersion();
}
NPError
NPN_GetURL(NPP instance, const char* url, const char* window)
{
return CALL_NPN(CallNPN_GetURLProc, gNetscapeFuncs->geturl, instance, url, window);
}
NPError
NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
{
int navMinorVers = getMinorVersion();
int minor = getMinorVersion();
NPError err;
if (navMinorVers >= NPVERS_HAS_NOTIFICATION)
if (minor >= NPVERS_HAS_NOTIFICATION)
err = CALL_NPN(CallNPN_GetURLNotifyProc, gNetscapeFuncs->geturlnotify, instance, url, window, notifyData);
else
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
......@@ -77,18 +88,21 @@ NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notify
}
NPError
NPN_GetURL(NPP instance, const char* url, const char* window)
NPN_PostURL(NPP instance, const char* url, const char* window,
uint32_t len, const char* buf, NPBool file)
{
return CALL_NPN(CallNPN_GetURLProc, gNetscapeFuncs->geturl, instance, url, window);
return CALL_NPN(CallNPN_PostURLProc, gNetscapeFuncs->posturl, instance,
url, window, len, buf, file);
}
NPError
NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData)
NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
const char* buf, NPBool file, void* notifyData)
{
int navMinorVers = getMinorVersion();
int minor = getMinorVersion();
NPError err;
if (navMinorVers >= NPVERS_HAS_NOTIFICATION) {
if (minor >= NPVERS_HAS_NOTIFICATION) {
err = CALL_NPN(CallNPN_PostURLNotifyProc, gNetscapeFuncs->posturlnotify, instance, url,
window, len, buf, file, notifyData);
}
......@@ -98,40 +112,36 @@ NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t le
return err;
}
NPError
NPN_PostURL(NPP instance, const char* url, const char* window,
uint32_t len, const char* buf, NPBool file)
{
return CALL_NPN(CallNPN_PostURLProc, gNetscapeFuncs->posturl, instance,
url, window, len, buf, file);
}
NPError
NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
{
return CALL_NPN(CallNPN_RequestReadProc, gNetscapeFuncs->requestread, stream, rangeList);
return CALL_NPN(CallNPN_RequestReadProc, gNetscapeFuncs->requestread,
stream, rangeList);
}
NPError
NPN_NewStream(NPP instance, NPMIMEType type, const char* window, NPStream** stream)
NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
NPStream** stream)
{
int navMinorVers = getMinorVersion();
int minor = getMinorVersion();
NPError err;
if (navMinorVers >= NPVERS_HAS_STREAMOUTPUT)
err = CALL_NPN(CallNPN_NewStreamProc, gNetscapeFuncs->newstream, instance, type, window, stream);
if (minor >= NPVERS_HAS_STREAMOUTPUT)
err = CALL_NPN(CallNPN_NewStreamProc, gNetscapeFuncs->newstream,
instance, type, window, stream);
else
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
return err;
}
int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
int32_t
NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
{
int navMinorVers = getMinorVersion();
int minor = getMinorVersion();
NPError err;
if (navMinorVers >= NPVERS_HAS_STREAMOUTPUT)
if (minor >= NPVERS_HAS_STREAMOUTPUT)
err = CALL_NPN(CallNPN_WriteProc, gNetscapeFuncs->write, instance, stream, len, buffer);
else
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
......@@ -142,10 +152,10 @@ int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
NPError
NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
{
int navMinorVers = getMinorVersion();
int minor = getMinorVersion();
NPError err;
if (navMinorVers >= NPVERS_HAS_STREAMOUTPUT)
if (minor >= NPVERS_HAS_STREAMOUTPUT)
err = CALL_NPN(CallNPN_DestroyStreamProc, gNetscapeFuncs->destroystream, instance, stream, reason);
else
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
......@@ -153,17 +163,20 @@ NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
return err;
}
void NPN_Status(NPP instance, const char* message)
void
NPN_Status(NPP instance, const char* message)
{
CALL_NPN(CallNPN_StatusProc, gNetscapeFuncs->status, instance, message);
}
const char* NPN_UserAgent(NPP instance)
const char*
NPN_UserAgent(NPP instance)
{
return CALL_NPN(CallNPN_UserAgentProc, gNetscapeFuncs->uagent, instance);
}
void* NPN_MemAlloc(uint32_t size)
void*
NPN_MemAlloc(uint32_t size)
{
return CALL_NPN(CallNPN_MemAllocProc, gNetscapeFuncs->memalloc, size);
}
......@@ -200,12 +213,14 @@ NPN_SetValue(NPP instance, NPPVariable variable, void *value)
return CALL_NPN(CallNPN_SetValueProc, gNetscapeFuncs->setvalue, instance, variable, value);
}
void NPN_InvalidateRect(NPP instance, NPRect *rect)
void
NPN_InvalidateRect(NPP instance, NPRect *rect)
{
CALL_NPN(CallNPN_InvalidateRectProc, gNetscapeFuncs->invalidaterect, instance, rect);
}
void NPN_InvalidateRegion(NPP instance, NPRegion region)
void
NPN_InvalidateRegion(NPP instance, NPRegion region)
{
CALL_NPN(CallNPN_InvalidateRegionProc, gNetscapeFuncs->invalidateregion, instance, region);
}
......@@ -217,8 +232,8 @@ void NPN_ForceRedraw(NPP instance)
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_GetStringIdentifierProc, gNetscapeFuncs->getstringidentifier, name);
return NULL;
......@@ -226,15 +241,15 @@ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
CALL_NPN(CallNPN_GetStringIdentifiersProc, gNetscapeFuncs->getstringidentifiers, names, nameCount, identifiers);
}
NPIdentifier NPN_GetIntIdentifier(int32_t intid)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_GetIntIdentifierProc, gNetscapeFuncs->getintidentifier, intid);
return NULL;
......@@ -242,8 +257,8 @@ NPIdentifier NPN_GetIntIdentifier(int32_t intid)
bool NPN_IdentifierIsString(NPIdentifier identifier)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_IdentifierIsStringProc, gNetscapeFuncs->identifierisstring, identifier);
return false;
......@@ -251,8 +266,8 @@ bool NPN_IdentifierIsString(NPIdentifier identifier)
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_UTF8FromIdentifierProc, gNetscapeFuncs->utf8fromidentifier, identifier);
return NULL;
......@@ -260,8 +275,8 @@ NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_IntFromIdentifierProc, gNetscapeFuncs->intfromidentifier, identifier);
return 0;
......@@ -269,8 +284,8 @@ int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
NPObject *NPN_CreateObject(NPP instance, NPClass *aClass)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_CreateObjectProc, gNetscapeFuncs->createobject, instance, aClass);
return NULL;
......@@ -278,8 +293,8 @@ NPObject *NPN_CreateObject(NPP instance, NPClass *aClass)
NPObject *NPN_RetainObject(NPObject *npobj)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_RetainObjectProc, gNetscapeFuncs->retainobject, npobj);
return NULL;
......@@ -287,15 +302,15 @@ NPObject *NPN_RetainObject(NPObject *npobj)
void NPN_ReleaseObject(NPObject *npobj)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
CALL_NPN(CallNPN_ReleaseObjectProc, gNetscapeFuncs->releaseobject, npobj);
}
bool NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_InvokeProc, gNetscapeFuncs->invoke, instance, npobj, methodName, args, argCount, result);
return false;
......@@ -303,8 +318,8 @@ bool NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, const NP
bool NPN_InvokeDefault(NPP instance, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_InvokeDefaultProc, gNetscapeFuncs->invokeDefault, instance, npobj, args, argCount, result);
return false;
......@@ -312,8 +327,8 @@ bool NPN_InvokeDefault(NPP instance, NPObject *npobj, const NPVariant *args, uin
bool NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_EvaluateProc, gNetscapeFuncs->evaluate, instance, npobj, script, result);
return false;
......@@ -321,8 +336,8 @@ bool NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *re
bool NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, NPVariant *result)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_GetPropertyProc, gNetscapeFuncs->getproperty, instance, npobj, propertyName, result);
return false;
......@@ -330,8 +345,8 @@ bool NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, N
bool NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_SetPropertyProc, gNetscapeFuncs->setproperty, instance, npobj, propertyName, value);
return false;
......@@ -339,8 +354,8 @@ bool NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, c
bool NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_RemovePropertyProc, gNetscapeFuncs->removeproperty, instance, npobj, propertyName);
return false;
......@@ -348,8 +363,8 @@ bool NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName
bool NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_HasPropertyProc, gNetscapeFuncs->hasproperty, instance, npobj, propertyName);
return false;
......@@ -357,8 +372,8 @@ bool NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
bool NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
return CALL_NPN(CallNPN_HasMethodProc, gNetscapeFuncs->hasmethod, instance, npobj, methodName);
return false;
......@@ -366,15 +381,15 @@ bool NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
void NPN_ReleaseVariantValue(NPVariant *variant)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
CALL_NPN(CallNPN_ReleaseVariantValueProc, gNetscapeFuncs->releasevariantvalue, variant);
}
void NPN_SetException(NPObject *npobj, const NPUTF8 *message)
{
int navMinorVers = getMinorVersion();
if (navMinorVers >= 14)
int minor = getMinorVersion();
if (minor >= 14)
CALL_NPN(CallNPN_SetExceptionProc, gNetscapeFuncs->setexception, npobj, message);
}
......@@ -639,7 +654,7 @@ NP_Initialize(NPNetscapeFuncs* nsTable)
NPError
NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
{
int navMinorVers = getMinorVersion();
int minor = getMinorVersion();
if (pluginFuncs == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
......@@ -669,7 +684,7 @@ NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
pluginFuncs->getvalue = (NPP_GetValueProcPtr)(Private_GetValue);
pluginFuncs->setvalue = (NPP_SetValueProcPtr)(Private_SetValue);
if (navMinorVers >= NPVERS_HAS_NOTIFICATION)
if (minor >= NPVERS_HAS_NOTIFICATION)
pluginFuncs->urlnotify = Private_URLNotify;
pluginFuncs->javaClass = NULL;
......
......@@ -158,7 +158,15 @@ NPN_GetURL(NPP instance, const char* url, const char* window)
NPError
NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
{
return CALL_NPN(CallNPN_GetURLNotifyProc, gNetscapeFuncs->geturlnotify, instance, url, window, notifyData);
int minor = getMinorVersion();
NPError err;
if (minor >= NPVERS_HAS_NOTIFICATION)
err = CALL_NPN(CallNPN_GetURLNotifyProc, gNetscapeFuncs->geturlnotify, instance, url, window, notifyData);
else
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
return err;
}
NPError
......@@ -173,23 +181,40 @@ NPError
NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
const char* buf, NPBool file, void* notifyData)
{
return CALL_NPN(CallNPN_PostURLNotifyProc, gNetscapeFuncs->posturlnotify,
instance, url, window, len, buf, file, notifyData);
int minor = getMinorVersion();
NPError err;
if (minor >= NPVERS_HAS_NOTIFICATION) {
err = CALL_NPN(CallNPN_PostURLNotifyProc, gNetscapeFuncs->posturlnotify, instance, url,
window, len, buf, file, notifyData);
}
else
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
return err;
}
NPError
NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
{
return CALL_NPN(CallNPN_RequestReadProc,gNetscapeFuncs->requestread,
return CALL_NPN(CallNPN_RequestReadProc, gNetscapeFuncs->requestread,
stream, rangeList);
}
NPError
NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
NPStream** stream_ptr)
NPStream** stream)
{
return CALL_NPN(CallNPN_NewStreamProc, gNetscapeFuncs->newstream, instance,
type, window, stream_ptr);
int minor = getMinorVersion();
NPError err;
if (minor >= NPVERS_HAS_STREAMOUTPUT)
err = CALL_NPN(CallNPN_NewStreamProc, gNetscapeFuncs->newstream,
instance, type, window, stream);
else
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
return err;
}
int32_t
......@@ -209,33 +234,34 @@ NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
void
NPN_Status(NPP instance, const char* message)
{
CALL_NPN(CallNPN_StatusProc,gNetscapeFuncs->status, instance, message);
CALL_NPN(CallNPN_StatusProc, gNetscapeFuncs->status, instance, message);
}
const char*
NPN_UserAgent(NPP instance)
{
return CALL_NPN(CallNPN_UserAgentProc,gNetscapeFuncs->uagent, instance);
return CALL_NPN(CallNPN_UserAgentProc, gNetscapeFuncs->uagent, instance);
}
void *NPN_MemAlloc(uint32_t size)
void*
NPN_MemAlloc(uint32_t size)
{
return CALL_NPN(CallNPN_MemAllocProc,gNetscapeFuncs->memalloc, size);
return CALL_NPN(CallNPN_MemAllocProc, gNetscapeFuncs->memalloc, size);
}
void NPN_MemFree(void* ptr)
{
CALL_NPN(CallNPN_MemFreeProc,gNetscapeFuncs->memfree, ptr);
CALL_NPN(CallNPN_MemFreeProc, gNetscapeFuncs->memfree, ptr);
}
uint32_t NPN_MemFlush(uint32_t size)
{
return CALL_NPN(CallNPN_MemFlushProc,gNetscapeFuncs->memflush, size);
return CALL_NPN(CallNPN_MemFlushProc, gNetscapeFuncs->memflush, size);
}
void NPN_ReloadPlugins(NPBool reloadPages)
{
CALL_NPN(CallNPN_ReloadPluginsProc,gNetscapeFuncs->reloadplugins, reloadPages);
CALL_NPN(CallNPN_ReloadPluginsProc, gNetscapeFuncs->reloadplugins, reloadPages);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment