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

Use a helper for getMinorVersion()

parent e4054fd6
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
static NPNetscapeFuncs *gNetscapeFuncs; /* Netscape Function table */ static NPNetscapeFuncs *gNetscapeFuncs; /* Netscape Function table */
static const char *gUserAgent; /* User agent string */ static const char *gUserAgent; /* User agent string */
static inline int getMinorVersion() { return gNetscapeFuncs->version & 0xFF; }
/*********************************************************************** /***********************************************************************
* *
* Wrapper functions : plugin calling Netscape Navigator * Wrapper functions : plugin calling Netscape Navigator
...@@ -106,7 +106,7 @@ NPN_Version(int* plugin_major, int* plugin_minor, ...@@ -106,7 +106,7 @@ NPN_Version(int* plugin_major, int* plugin_minor,
/* Major version is in high byte */ /* Major version is in high byte */
*netscape_major = gNetscapeFuncs->version >> 8; *netscape_major = gNetscapeFuncs->version >> 8;
/* Minor version is in low byte */ /* Minor version is in low byte */
*netscape_minor = gNetscapeFuncs->version & 0xFF; *netscape_minor = getMinorVersion();
} }
...@@ -136,7 +136,7 @@ NPN_PluginThreadAsyncCall(NPP plugin, ...@@ -136,7 +136,7 @@ NPN_PluginThreadAsyncCall(NPP plugin,
{ {
bool workaround = false; bool workaround = false;
const int minor = gNetscapeFuncs->version & 0xFF; const int minor = getMinorVersion();
if (gUserAgent && (strstr(gUserAgent, "Opera"))) if (gUserAgent && (strstr(gUserAgent, "Opera")))
workaround = true; workaround = true;
...@@ -298,7 +298,7 @@ void NPN_PopPopupsEnabledState(NPP instance) ...@@ -298,7 +298,7 @@ void NPN_PopPopupsEnabledState(NPP instance)
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
{ {
return CALL_NPN(CallNPN_GetStringIdentifierProc, return CALL_NPN(CallNPN_GetStringIdentifierProc,
...@@ -310,7 +310,7 @@ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) ...@@ -310,7 +310,7 @@ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers) NPIdentifier *identifiers)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
{ {
CALL_NPN(CallNPN_GetStringIdentifiersProc,gNetscapeFuncs->getstringidentifiers, CALL_NPN(CallNPN_GetStringIdentifiersProc,gNetscapeFuncs->getstringidentifiers,
...@@ -320,7 +320,7 @@ void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, ...@@ -320,7 +320,7 @@ void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier NPN_GetIntIdentifier(int32_t intid) NPIdentifier NPN_GetIntIdentifier(int32_t intid)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
{ {
return CALL_NPN(CallNPN_GetIntIdentifierProc,gNetscapeFuncs->getintidentifier, intid); return CALL_NPN(CallNPN_GetIntIdentifierProc,gNetscapeFuncs->getintidentifier, intid);
...@@ -330,7 +330,7 @@ NPIdentifier NPN_GetIntIdentifier(int32_t intid) ...@@ -330,7 +330,7 @@ NPIdentifier NPN_GetIntIdentifier(int32_t intid)
bool NPN_IdentifierIsString(NPIdentifier identifier) bool NPN_IdentifierIsString(NPIdentifier identifier)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
{ {
return CALL_NPN(CallNPN_IdentifierIsStringProc, return CALL_NPN(CallNPN_IdentifierIsStringProc,
...@@ -342,7 +342,7 @@ bool NPN_IdentifierIsString(NPIdentifier identifier) ...@@ -342,7 +342,7 @@ bool NPN_IdentifierIsString(NPIdentifier identifier)
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier) NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
{ {
return CALL_NPN(CallNPN_UTF8FromIdentifierProc, return CALL_NPN(CallNPN_UTF8FromIdentifierProc,
...@@ -354,7 +354,7 @@ NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier) ...@@ -354,7 +354,7 @@ NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
int32_t NPN_IntFromIdentifier(NPIdentifier identifier) int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
{ {
return CALL_NPN(CallNPN_IntFromIdentifierProc, return CALL_NPN(CallNPN_IntFromIdentifierProc,
...@@ -366,7 +366,7 @@ int32_t NPN_IntFromIdentifier(NPIdentifier identifier) ...@@ -366,7 +366,7 @@ int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) NPObject *NPN_CreateObject(NPP npp, NPClass *aClass)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_CreateObjectProc,gNetscapeFuncs->createobject, npp, aClass); return CALL_NPN(CallNPN_CreateObjectProc,gNetscapeFuncs->createobject, npp, aClass);
return NULL; return NULL;
...@@ -374,7 +374,7 @@ NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) ...@@ -374,7 +374,7 @@ NPObject *NPN_CreateObject(NPP npp, NPClass *aClass)
NPObject *NPN_RetainObject(NPObject *obj) NPObject *NPN_RetainObject(NPObject *obj)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_RetainObjectProc,gNetscapeFuncs->retainobject, obj); return CALL_NPN(CallNPN_RetainObjectProc,gNetscapeFuncs->retainobject, obj);
return NULL; return NULL;
...@@ -382,7 +382,7 @@ NPObject *NPN_RetainObject(NPObject *obj) ...@@ -382,7 +382,7 @@ NPObject *NPN_RetainObject(NPObject *obj)
void NPN_ReleaseObject(NPObject *obj) void NPN_ReleaseObject(NPObject *obj)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
CALL_NPN(CallNPN_ReleaseObjectProc,gNetscapeFuncs->releaseobject, obj); CALL_NPN(CallNPN_ReleaseObjectProc,gNetscapeFuncs->releaseobject, obj);
} }
...@@ -390,7 +390,7 @@ void NPN_ReleaseObject(NPObject *obj) ...@@ -390,7 +390,7 @@ void NPN_ReleaseObject(NPObject *obj)
bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName, bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName,
const NPVariant *args, uint32_t argCount, NPVariant *result) const NPVariant *args, uint32_t argCount, NPVariant *result)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_InvokeProc,gNetscapeFuncs->invoke, npp, obj, methodName, return CALL_NPN(CallNPN_InvokeProc,gNetscapeFuncs->invoke, npp, obj, methodName,
args, argCount, result); args, argCount, result);
...@@ -400,7 +400,7 @@ bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName, ...@@ -400,7 +400,7 @@ bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName,
bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args, bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args,
uint32_t argCount, NPVariant *result) uint32_t argCount, NPVariant *result)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_InvokeDefaultProc,gNetscapeFuncs->invokeDefault, npp, obj, return CALL_NPN(CallNPN_InvokeDefaultProc,gNetscapeFuncs->invokeDefault, npp, obj,
args, argCount, result); args, argCount, result);
...@@ -410,7 +410,7 @@ bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args, ...@@ -410,7 +410,7 @@ bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args,
bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script, bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script,
NPVariant *result) NPVariant *result)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_EvaluateProc,gNetscapeFuncs->evaluate, npp, obj, return CALL_NPN(CallNPN_EvaluateProc,gNetscapeFuncs->evaluate, npp, obj,
script, result); script, result);
...@@ -420,7 +420,7 @@ bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script, ...@@ -420,7 +420,7 @@ bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script,
bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
NPVariant *result) NPVariant *result)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_GetPropertyProc,gNetscapeFuncs->getproperty, npp, obj, return CALL_NPN(CallNPN_GetPropertyProc,gNetscapeFuncs->getproperty, npp, obj,
propertyName, result); propertyName, result);
...@@ -430,7 +430,7 @@ bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, ...@@ -430,7 +430,7 @@ bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
const NPVariant *value) const NPVariant *value)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_SetPropertyProc,gNetscapeFuncs->setproperty, npp, obj, return CALL_NPN(CallNPN_SetPropertyProc,gNetscapeFuncs->setproperty, npp, obj,
propertyName, value); propertyName, value);
...@@ -439,7 +439,7 @@ bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, ...@@ -439,7 +439,7 @@ bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_RemovePropertyProc,gNetscapeFuncs->removeproperty, npp, obj, return CALL_NPN(CallNPN_RemovePropertyProc,gNetscapeFuncs->removeproperty, npp, obj,
propertyName); propertyName);
...@@ -448,7 +448,7 @@ bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) ...@@ -448,7 +448,7 @@ bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_HasPropertyProc,gNetscapeFuncs->hasproperty, npp, obj, return CALL_NPN(CallNPN_HasPropertyProc,gNetscapeFuncs->hasproperty, npp, obj,
propertyName); propertyName);
...@@ -457,7 +457,7 @@ bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) ...@@ -457,7 +457,7 @@ bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName) bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
return CALL_NPN(CallNPN_HasMethodProc,gNetscapeFuncs->hasmethod, npp, return CALL_NPN(CallNPN_HasMethodProc,gNetscapeFuncs->hasmethod, npp,
obj, methodName); obj, methodName);
...@@ -466,14 +466,14 @@ bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName) ...@@ -466,14 +466,14 @@ bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName)
void NPN_ReleaseVariantValue(NPVariant *variant) void NPN_ReleaseVariantValue(NPVariant *variant)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
CALL_NPN(CallNPN_ReleaseVariantValueProc,gNetscapeFuncs->releasevariantvalue, variant); CALL_NPN(CallNPN_ReleaseVariantValueProc,gNetscapeFuncs->releasevariantvalue, variant);
} }
void NPN_SetException(NPObject* obj, const NPUTF8 *message) void NPN_SetException(NPObject* obj, const NPUTF8 *message)
{ {
int minor = gNetscapeFuncs->version & 0xFF; int minor = getMinorVersion();
if( minor >= 14 ) if( minor >= 14 )
CALL_NPN(CallNPN_SetExceptionProc,gNetscapeFuncs->setexception, obj, message); CALL_NPN(CallNPN_SetExceptionProc,gNetscapeFuncs->setexception, obj, message);
} }
......
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