fix build against new npapi.h

This commit is contained in:
Caolán McNamara 2011-11-08 10:01:22 +00:00
parent 69a8f89cb9
commit cfe3d74c60
7 changed files with 34 additions and 37 deletions

View file

@ -37,7 +37,6 @@ INCPRE+=-I$(SOLARINCDIR)$/mozilla$/plugin
.IF "$(SOLAR_JAVA)" != ""
INCPRE+=-I$(SOLARINCDIR)$/mozilla$/java
INCPRE+=-I$(SOLARINCDIR)$/mozilla$/nspr
CDEFS+=-DOJI
.ENDIF
.IF "$(WITH_MOZILLA)" != "NO"

View file

@ -96,6 +96,24 @@ using ::rtl::OUString;
using ::rtl::OString;
using ::rtl::OStringToOUString;
// Move deprecated functions which no longer appear in npapi.h before
// their use to avoid errors that they're undeclared at point of use
extern "C"
{
const JRIEnvInterface** SAL_CALL NP_LOADDS NPN_GetJavaEnv()
{
TRACE( "NPN_GetJavaEnv" );
// no java in this program
return NULL;
}
jref SAL_CALL NP_LOADDS NPN_GetJavaPeer( NPP /*instance*/ )
{
TRACE( "NPN_GetJavaPeer" );
return NULL;
}
}
NPNetscapeFuncs aNPNFuncs =
{
sizeof( NPNetscapeFuncs ),
@ -112,13 +130,8 @@ NPNetscapeFuncs aNPNFuncs =
NPN_MemFree,
NPN_MemFlush,
NPN_ReloadPlugins,
#ifdef OJI
NPN_GetJavaEnv,
NPN_GetJavaPeer,
#else
0,
0,
#endif
NPN_GetURLNotify,
NPN_PostURLNotify,
NPN_GetValue,
@ -238,21 +251,6 @@ extern "C" {
return NPERR_NO_ERROR;
}
#ifdef OJI
const JRIEnvInterface** SAL_CALL NP_LOADDS NPN_GetJavaEnv()
{
TRACE( "NPN_GetJavaEnv" );
// no java in this program
return NULL;
}
jref SAL_CALL NP_LOADDS NPN_GetJavaPeer( NPP /*instance*/ )
{
TRACE( "NPN_GetJavaPeer" );
return NULL;
}
#endif
NPError SAL_CALL NP_LOADDS NPN_GetURL( NPP instance, const char* url, const char* window )
{
TRACES( "NPN_GetURL", url );

View file

@ -562,7 +562,7 @@ void XPlugin_Impl::loadPlugin()
m_aEncoding).getStr(),
getNPPInstance(),
m_aPluginMode == PluginMode::FULL ? NP_FULL : NP_EMBED,
::sal::static_int_cast< int16, int >( m_nArgs ),
::sal::static_int_cast< int16_t, int >( m_nArgs ),
(char**)(m_nArgs ? m_pArgn : NULL),
(char**)(m_nArgs ? m_pArgv : NULL),
NULL );
@ -595,8 +595,8 @@ void XPlugin_Impl::loadPlugin()
m_aNPWindow.clipRect.top = 0;
m_aNPWindow.clipRect.left = 0;
m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16, sal_Int32 >( aPosSize.Height );
m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16, sal_Int32 >( aPosSize.Width );
m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16_t, sal_Int32 >( aPosSize.Height );
m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16_t, sal_Int32 >( aPosSize.Width );
m_aNPWindow.type = NPWindowTypeWindow;
m_aNPWindow.x = 0;
@ -742,7 +742,7 @@ sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype,
if( iter != m_aPEventListeners.end() )
pStream->getStream()->notifyData = (*iter)->getNotifyData();
uint16 stype = 0;
uint16_t stype = 0;
// special handling acrobat reader
// presenting a seekable stream to it does not seem to work correctly
@ -876,8 +876,8 @@ void XPlugin_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_,
m_aNPWindow.height = nHeight_;
m_aNPWindow.clipRect.top = 0;
m_aNPWindow.clipRect.left = 0;
m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16, sal_Int32 >( nWidth_ );
m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16, sal_Int32 >( nHeight_ );
m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16_t, sal_Int32 >( nWidth_ );
m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16_t, sal_Int32 >( nHeight_ );
if( getPluginComm() )
getPluginComm()->NPP_SetWindow( this );

View file

@ -59,12 +59,12 @@ public:
virtual void* NPP_GetJavaClass() = 0;
virtual NPError NPP_Initialize() = 0;
virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc,
uint16_t mode, int16_t argc,
char* argn[], char* argv[],
NPSavedData *saved ) = 0;
virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
NPStream* stream,
NPBool seekable, uint16* stype ) = 0;
NPBool seekable, uint16_t* stype ) = 0;
virtual void NPP_Print( NPP instance, NPPrint* platformPrint ) = 0;
virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ) = 0;
virtual void NPP_Shutdown() = 0;

View file

@ -56,11 +56,11 @@ public:
virtual void* NPP_GetJavaClass();
virtual NPError NPP_Initialize();
virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc,
uint16_t mode, int16_t argc,
char* argn[], char* argv[], NPSavedData *saved );
virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
NPStream* stream,
NPBool seekable, uint16* stype );
NPBool seekable, uint16_t* stype );
virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
using PluginComm::NPP_SetWindow;

View file

@ -608,7 +608,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ )
pStream->pdata = pStream->ndata = pStream->notifyData = NULL;
NPBool* pSeekable = (NPBool*)pMessage->GetBytes();
m_aNPWrapStreams.push_back( pStream );
uint16 nStype = NP_ASFILE;
uint16_t nStype = NP_ASFILE;
NPError aRet = aPluginFuncs.newstream( instance, pType, pStream,
*pSeekable, &nStype );
medDebug( 1, "pluginapp: NPP_NewStream( %p, %s, %p, %s, %p ) returns %d\n"
@ -626,8 +626,8 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ )
case eNPP_New:
{
char* pType = pMessage->GetString();
uint16* pMode = (uint16*)pMessage->GetBytes();
int16* pArgc = (int16*)pMessage->GetBytes();
uint16_t* pMode = (uint16_t*)pMessage->GetBytes();
int16_t* pArgc = (int16_t*)pMessage->GetBytes();
NPP instance = new NPP_t;
instance->pdata = instance->ndata = NULL;
sal_uLong nArgnBytes, nArgvBytes;

View file

@ -411,7 +411,7 @@ NPError UnxPluginComm::NPP_Initialize()
return aRet;
}
NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc,
char* argn[], char* argv[], NPSavedData *saved )
{
m_aInstances.push_back(
@ -473,7 +473,7 @@ NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode
}
NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
NPBool seekable, uint16* stype )
NPBool seekable, uint16_t* stype )
{
NPError aRet = NPERR_GENERIC_ERROR;
GET_INSTANCE_RET( aRet );
@ -493,7 +493,7 @@ NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* s
return NPERR_GENERIC_ERROR;
aRet = GetNPError( pMes );
uint16* pSType = (uint16*)pMes->GetBytes();
uint16_t* pSType = (uint16_t*)pMes->GetBytes();
*stype = *pSType;
delete [] pSType;