From bdead69dd3c947743907681c8a2f16ca1f50cd9c Mon Sep 17 00:00:00 2001 From: Tomas Chvatal Date: Sun, 6 Nov 2011 17:44:11 +0100 Subject: Add switch for system/internal npapi.h This commit also update the internal includes to latest mozilla ones including the .c{,pp} file updates. The ldap check is also simplified from 2 check into plain one. --- np_sdk/mozsrc/makefile.mk | 8 + np_sdk/mozsrc/npapi.h | 587 ---------------------------------------------- np_sdk/mozsrc/npunix.c | 30 ++- np_sdk/mozsrc/npupp.h | 78 +++--- np_sdk/mozsrc/npwin.cpp | 23 +- 5 files changed, 69 insertions(+), 657 deletions(-) delete mode 100644 np_sdk/mozsrc/npapi.h (limited to 'np_sdk/mozsrc') diff --git a/np_sdk/mozsrc/makefile.mk b/np_sdk/mozsrc/makefile.mk index 248cb6d5091c..c0722548ec06 100644 --- a/np_sdk/mozsrc/makefile.mk +++ b/np_sdk/mozsrc/makefile.mk @@ -39,6 +39,14 @@ EXTERNAL_WARNINGS_NOT_ERRORS := TRUE .IF "$(L10N_framework)"=="" JDKINCS= +.IF "$(SYSTEM_MOZILLA_HEADERS)" = "YES" +CFLAGS+= $(MOZILLA_HEADERS_CFLAGS) +CXXFLAGS+= $(MOZILLA_HEADERS_CFLAGS) +.ELSE +CFLAGS+= -I..$/inc +CXXFLAGS+= -I..$/inc +.ENDIF + # --- Files -------------------------------------------------------- .IF "$(GUI)" == "WNT" diff --git a/np_sdk/mozsrc/npapi.h b/np_sdk/mozsrc/npapi.h deleted file mode 100644 index c89b70a95cfb..000000000000 --- a/np_sdk/mozsrc/npapi.h +++ /dev/null @@ -1,587 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -/* - * npapi.h $Revision: 1.2 $ - * Netscape client plug-in API spec - */ - -#if !defined(_NPAPI_H_) && !defined(npapi_h_) -#define _NPAPI_H_ -#define npapi_h_ - -#include "jri.h" /* Java Runtime Interface */ - -#ifdef _WINDOWS -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* XP_WIN */ -#endif /* _WINDOWS */ - -#ifdef __MWERKS__ -# define _declspec __declspec -# ifdef macintosh -# ifndef XP_MAC -# define XP_MAC 1 -# endif /* XP_MAC */ -# endif /* macintosh */ -# ifdef __INTEL__ -# undef NULL -# ifndef XP_WIN -# define XP_WIN 1 -# endif /* __INTEL__ */ -# endif /* XP_PC */ -#endif /* __MWERKS__ */ - -#ifdef XP_MAC - #include - #include -#endif - -#if defined(XP_UNIX) && !defined(NO_X11) - #include - #include -#endif - -/*----------------------------------------------------------------------*/ -/* Plugin Version Constants */ -/*----------------------------------------------------------------------*/ - -#define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 13 - - -/* The OS/2 version of Netscape uses RC_DATA to define the - mime types, file extentions, etc that are required. - Use a vertical bar to seperate types, end types with \0. - FileVersion and ProductVersion are 32bit ints, all other - entries are strings the MUST be terminated wwith a \0. - -AN EXAMPLE: - -RCDATA NP_INFO_ProductVersion { 1,0,0,1,} - -RCDATA NP_INFO_MIMEType { "video/x-video|", - "video/x-flick\0" } -RCDATA NP_INFO_FileExtents { "avi|", - "flc\0" } -RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", - "MMOS2 Flc/Fli player(*.flc)\0" } - -RCDATA NP_INFO_FileVersion { 1,0,0,1 } -RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } -RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" -RCDATA NP_INFO_InternalName { "NPAVI32\0" ) -RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" -RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } -RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } - -*/ - - -/* RC_DATA types for version info - required */ -#define NP_INFO_ProductVersion 1 -#define NP_INFO_MIMEType 2 -#define NP_INFO_FileOpenName 3 -#define NP_INFO_FileExtents 4 - -/* RC_DATA types for version info - used if found */ -#define NP_INFO_FileDescription 5 -#define NP_INFO_ProductName 6 - -/* RC_DATA types for version info - optional */ -#define NP_INFO_CompanyName 7 -#define NP_INFO_FileVersion 8 -#define NP_INFO_InternalName 9 -#define NP_INFO_LegalCopyright 10 -#define NP_INFO_OriginalFilename 11 - -#ifndef RC_INVOKED - - - -/*----------------------------------------------------------------------*/ -/* Definition of Basic Types */ -/*----------------------------------------------------------------------*/ - -#ifndef _UINT16 -typedef unsigned short uint16; -#endif - -#ifndef _UINT32 -# if defined(__alpha) -typedef unsigned int uint32; -# else /* __alpha */ -typedef unsigned long uint32; -# endif /* __alpha */ -#endif - -/* - * AIX defines these in sys/inttypes.h included from sys/types.h - */ -#ifndef AIX -#ifndef _INT16 -typedef short int16; -#endif - -#ifndef _INT32 -# if defined(__alpha) -typedef int int32; -# else /* __alpha */ -typedef long int32; -# endif /* __alpha */ -#endif -#endif - -#ifndef FALSE -#define FALSE (0) -#endif -#ifndef TRUE -#define TRUE (1) -#endif -#ifndef NULL -#define NULL (0L) -#endif - -typedef unsigned char NPBool; -typedef int16 NPError; -typedef int16 NPReason; -typedef char* NPMIMEType; - - - -/*----------------------------------------------------------------------*/ -/* Structures and definitions */ -/*----------------------------------------------------------------------*/ - -#ifdef XP_MAC -#pragma options align=mac68k -#endif - -/* - * NPP is a plug-in's opaque instance handle - */ -typedef struct _NPP -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ -} NPP_t; - -typedef NPP_t* NPP; - - -typedef struct _NPStream -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ - const char* url; - uint32 end; - uint32 lastmodified; - void* notifyData; -} NPStream; - - -typedef struct _NPByteRange -{ - int32 offset; /* negative offset means from the end */ - uint32 length; - struct _NPByteRange* next; -} NPByteRange; - - -typedef struct _NPSavedData -{ - int32 len; - void* buf; -} NPSavedData; - - -typedef struct _NPRect -{ - uint16 top; - uint16 left; - uint16 bottom; - uint16 right; -} NPRect; - -typedef struct _NPSize -{ - int32 width; - int32 height; -} NPSize; - -#ifdef XP_UNIX -/* - * Unix specific structures and definitions - */ - -/* - * Callback Structures. - * - * These are used to pass additional platform specific information. - */ -enum { - NP_SETWINDOW = 1, - NP_PRINT -}; - -typedef struct -{ - int32 type; -} NPAnyCallbackStruct; - -typedef struct -{ - int32 type; -#ifndef NO_X11 - Display* display; - Visual* visual; - Colormap colormap; - unsigned int depth; -#endif -} NPSetWindowCallbackStruct; - -typedef struct -{ - int32 type; - FILE* fp; -} NPPrintCallbackStruct; - -#endif /* XP_UNIX */ - -/* - * List of variable names for which NPP_GetValue shall be implemented - */ -typedef enum { - NPPVpluginNameString = 1, - NPPVpluginDescriptionString, - NPPVpluginWindowBool, - NPPVpluginTransparentBool, - NPPVjavaClass, /* Not implemented in Mozilla 1.0 */ - NPPVpluginWindowSize, - NPPVpluginTimerInterval, - - NPPVpluginScriptableInstance = 10, - NPPVpluginScriptableIID = 11, - - /* 12 and over are available on Mozilla builds starting with 0.9.9 */ - NPPVjavascriptPushCallerBool = 12, - NPPVpluginKeepLibraryInMemory = 13 /* available in Mozilla 1.0 */ -} NPPVariable; - -/* - * List of variable names for which NPN_GetValue is implemented by Mozilla - */ -typedef enum { - NPNVxDisplay = 1, - NPNVxtAppContext, - NPNVnetscapeWindow, - NPNVjavascriptEnabledBool, - NPNVasdEnabledBool, - NPNVisOfflineBool, - - /* 10 and over are available on Mozilla builds starting with 0.9.4 */ - NPNVserviceManager = 10 -} NPNVariable; - -/* - * The type of a NPWindow - it specifies the type of the data structure - * returned in the window field. - */ -typedef enum { - NPWindowTypeWindow = 1, - NPWindowTypeDrawable -} NPWindowType; - -typedef struct _NPWindow -{ - void* window; /* Platform specific window handle */ - /* OS/2: x - Position of bottom left corner */ - /* OS/2: y - relative to visible netscape window */ - int32 x; /* Position of top left corner relative */ - int32 y; /* to a netscape page. */ - uint32 width; /* Maximum window size */ - uint32 height; - NPRect clipRect; /* Clipping rectangle in port coordinates */ - /* Used by MAC only. */ -#ifdef XP_UNIX - void * ws_info; /* Platform-dependent additonal data */ -#endif /* XP_UNIX */ - NPWindowType type; /* Is this a window or a drawable? */ -} NPWindow; - - -typedef struct _NPFullPrint -{ - NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ - NPBool printOne; /* TRUE if plugin should print one copy to default printer */ - void* platformPrint; /* Platform-specific printing info */ -} NPFullPrint; - -typedef struct _NPEmbedPrint -{ - NPWindow window; - void* platformPrint; /* Platform-specific printing info */ -} NPEmbedPrint; - -typedef struct _NPPrint -{ - uint16 mode; /* NP_FULL or NP_EMBED */ - union - { - NPFullPrint fullPrint; /* if mode is NP_FULL */ - NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ - } print; -} NPPrint; - -#ifdef XP_MAC -typedef EventRecord NPEvent; -#elif defined(XP_WIN) -typedef struct _NPEvent -{ - uint16 event; - uint32 wParam; - uint32 lParam; -} NPEvent; -#elif defined (XP_UNIX) && !defined(NO_X11) -typedef XEvent NPEvent; -#else -typedef void* NPEvent; -#endif /* XP_MAC */ - -#ifdef XP_MAC -typedef RgnHandle NPRegion; -#elif defined(XP_WIN) -typedef HRGN NPRegion; -#elif defined(XP_UNIX) && !defined(NO_X11) -typedef Region NPRegion; -#else -typedef void *NPRegion; -#endif /* XP_MAC */ - -#ifdef XP_MAC -/* - * Mac-specific structures and definitions. - */ - -typedef struct NP_Port -{ - CGrafPtr port; /* Grafport */ - int32 portx; /* position inside the topmost window */ - int32 porty; -} NP_Port; - -/* - * Non-standard event types that can be passed to HandleEvent - */ - -enum NPEventType { - NPEventType_GetFocusEvent = (osEvt + 16), - NPEventType_LoseFocusEvent, - NPEventType_AdjustCursorEvent, - NPEventType_MenuCommandEvent, - NPEventType_ClippingChangedEvent, - NPEventType_ScrollingBeginsEvent = 1000, - NPEventType_ScrollingEndsEvent -}; - -#ifdef OBSOLETE -#define getFocusEvent (osEvt + 16) -#define loseFocusEvent (osEvt + 17) -#define adjustCursorEvent (osEvt + 18) -#endif -#endif /* XP_MAC */ - -/* - * Values for mode passed to NPP_New: - */ -#define NP_EMBED 1 -#define NP_FULL 2 - -/* - * Values for stream type passed to NPP_NewStream: - */ -#define NP_NORMAL 1 -#define NP_SEEK 2 -#define NP_ASFILE 3 -#define NP_ASFILEONLY 4 - -#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) - -#ifdef XP_MAC -#pragma options align=reset -#endif - - -/*----------------------------------------------------------------------*/ -/* Error and Reason Code definitions */ -/*----------------------------------------------------------------------*/ - -/* - * Values of type NPError: - */ -#define NPERR_BASE 0 -#define NPERR_NO_ERROR (NPERR_BASE + 0) -#define NPERR_GENERIC_ERROR (NPERR_BASE + 1) -#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) -#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) -#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) -#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) -#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) -#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) -#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) -#define NPERR_INVALID_PARAM (NPERR_BASE + 9) -#define NPERR_INVALID_URL (NPERR_BASE + 10) -#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) -#define NPERR_NO_DATA (NPERR_BASE + 12) -#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) - -/* - * Values of type NPReason: - */ -#define NPRES_BASE 0 -#define NPRES_DONE (NPRES_BASE + 0) -#define NPRES_NETWORK_ERR (NPRES_BASE + 1) -#define NPRES_USER_BREAK (NPRES_BASE + 2) - -/* - * Don't use these obsolete error codes any more. - */ -#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR -#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR -#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK - -/* - * Version feature information - */ -#define NPVERS_HAS_STREAMOUTPUT 8 -#define NPVERS_HAS_NOTIFICATION 9 -#define NPVERS_HAS_LIVECONNECT 9 -#define NPVERS_WIN16_HAS_LIVECONNECT 9 -#define NPVERS_68K_HAS_LIVECONNECT 11 -#define NPVERS_HAS_WINDOWLESS 11 -#define NPVERS_HAS_XPCONNECT_SCRIPTING 13 - -/*----------------------------------------------------------------------*/ -/* Function Prototypes */ -/*----------------------------------------------------------------------*/ - -#if defined(_WINDOWS) && !defined(WIN32) -#define NP_LOADDS _loadds -#else -#define NP_LOADDS -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * NPP_* functions are provided by the plugin and called by the navigator. - */ - -char* NPP_GetMIMEDescription(void); - -NPError NP_LOADDS NPP_Initialize(void); -void NP_LOADDS NPP_Shutdown(void); -NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, - uint16 mode, int16 argc, char* argn[], - char* argv[], NPSavedData* saved); -NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); -NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); -NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, - NPStream* stream, NPBool seekable, - uint16* stype); -NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, - NPReason reason); -int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); -int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, - int32 len, void* buffer); -void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, - const char* fname); -void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); -int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event); -void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, - NPReason reason, void* notifyData); -jref NP_LOADDS NPP_GetJavaClass(void); -NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); -NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); - -/* - * NPN_* functions are provided by the navigator and called by the plugin. - */ -void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, - int* netscape_major, int* netscape_minor); -NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, - const char* target, void* notifyData); -NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, - const char* target); -NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, - const char* target, uint32 len, - const char* buf, NPBool file, - void* notifyData); -NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, - const char* target, uint32 len, - const char* buf, NPBool file); -NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); -NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, - const char* target, NPStream** stream); -int32 NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer); -NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -void NP_LOADDS NPN_Status(NPP instance, const char* message); -const char* NP_LOADDS NPN_UserAgent(NPP instance); -void* NP_LOADDS NPN_MemAlloc(uint32 size); -void NP_LOADDS NPN_MemFree(void* ptr); -uint32 NP_LOADDS NPN_MemFlush(uint32 size); -void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); -JRIEnv* NP_LOADDS NPN_GetJavaEnv(void); -jref NP_LOADDS NPN_GetJavaPeer(NPP instance); -NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, void *value); -NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, void *value); -void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); -void NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion); -void NP_LOADDS NPN_ForceRedraw(NPP instance); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* RC_INVOKED */ - -#endif /* _NPAPI_H_ */ diff --git a/np_sdk/mozsrc/npunix.c b/np_sdk/mozsrc/npunix.c index 55d0fa5316d2..19ae47a6f0c5 100644 --- a/np_sdk/mozsrc/npunix.c +++ b/np_sdk/mozsrc/npunix.c @@ -130,14 +130,14 @@ NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notify NPError NPN_PostURL(NPP instance, const char* url, const char* window, - uint32 len, const char* buf, NPBool file) + uint32_t len, const char* buf, NPBool file) { return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance, url, window, len, buf, file); } NPError -NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, +NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData) { return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify, @@ -159,8 +159,8 @@ NPN_NewStream(NPP instance, NPMIMEType type, const char *window, type, window, stream_ptr); } -int32 -NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer) +int32_t +NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer) { return CallNPN_WriteProc(gNetscapeFuncs.write, instance, stream, len, buffer); @@ -186,7 +186,7 @@ NPN_UserAgent(NPP instance) } void* -NPN_MemAlloc(uint32 size) +NPN_MemAlloc(uint32_t size) { return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size); } @@ -196,7 +196,7 @@ void NPN_MemFree(void* ptr) CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr); } -uint32 NPN_MemFlush(uint32 size) +uint32_t NPN_MemFlush(uint32_t size) { return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size); } @@ -251,8 +251,8 @@ NPN_ForceRedraw(NPP instance) ***********************************************************************/ NPError -Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, - int16 argc, char* argn[], char* argv[], NPSavedData* saved) +Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode, + int16_t argc, char* argn[], char* argv[], NPSavedData* saved) { NPError ret; PLUGINDEBUGSTR("New"); @@ -278,7 +278,7 @@ Private_SetWindow(NPP instance, NPWindow* window) NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16* stype) + NPBool seekable, uint16_t* stype) { NPError err; PLUGINDEBUGSTR("NewStream"); @@ -286,7 +286,7 @@ Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, return err; } -int32 +int32_t Private_WriteReady(NPP instance, NPStream* stream) { unsigned int result; @@ -295,8 +295,8 @@ Private_WriteReady(NPP instance, NPStream* stream) return result; } -int32 -Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, +int32_t +Private_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer) { unsigned int result; @@ -483,7 +483,7 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs) pluginFuncs->javaClass = Private_GetJavaClass(); #endif - err = NPP_Initialize(); + err = NPERR_NO_ERROR; } return err; @@ -496,10 +496,8 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs) * the last object of this kind has been destroyed. * */ -NPError +void NP_Shutdown(void) { PLUGINDEBUGSTR("NP_Shutdown"); - NPP_Shutdown(); - return NPERR_NO_ERROR; } diff --git a/np_sdk/mozsrc/npupp.h b/np_sdk/mozsrc/npupp.h index 58ce6c8d4e57..e6e452ba49f5 100644 --- a/np_sdk/mozsrc/npupp.h +++ b/np_sdk/mozsrc/npupp.h @@ -131,8 +131,8 @@ enum { uppNPP_NewProcInfo = kThinkCStackBased | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16))) + | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16_t))) + | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16_t))) | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **))) | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **))) | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *))) @@ -146,7 +146,7 @@ enum { (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) #else -typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); +typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); #define NewNPP_NewProc(FUNC) \ ((NPP_NewUPP) (FUNC)) #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ @@ -219,7 +219,7 @@ enum { | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType))) | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *))) | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16 *))) + | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16_t *))) | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) }; #define NewNPP_NewStreamProc(FUNC) \ @@ -228,7 +228,7 @@ enum { (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5)) #else -typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); +typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); #define NewNPP_NewStreamProc(FUNC) \ ((NPP_NewStreamUPP) (FUNC)) #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \ @@ -273,16 +273,16 @@ enum { uppNPP_WriteReadyProcInfo = kThinkCStackBased | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) + | RESULT_SIZE(SIZE_CODE(sizeof(int32_t))) }; #define NewNPP_WriteReadyProc(FUNC) \ (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture()) #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr)) + (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr)) #else -typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream); +typedef int32_t (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream); #define NewNPP_WriteReadyProc(FUNC) \ ((NPP_WriteReadyUPP) (FUNC)) #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \ @@ -300,19 +300,19 @@ enum { uppNPP_WriteProcInfo = kThinkCStackBased | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32))) + | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32_t))) + | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32_t))) | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) + | RESULT_SIZE(SIZE_CODE(sizeof(int32_t))) }; #define NewNPP_WriteProc(FUNC) \ (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture()) #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr)) + (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr)) #else -typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); +typedef int32_t (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); #define NewNPP_WriteProc(FUNC) \ ((NPP_WriteUPP) (FUNC)) #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \ @@ -384,16 +384,16 @@ enum { uppNPP_HandleEventProcInfo = kThinkCStackBased | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(int16))) + | RESULT_SIZE(SIZE_CODE(sizeof(int16_t))) }; #define NewNPP_HandleEventProc(FUNC) \ (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture()) #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \ - (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr)) + (int16_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr)) #else -typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event); +typedef int16_t (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event); #define NewNPP_HandleEventProc(FUNC) \ ((NPP_HandleEventUPP) (FUNC)) #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \ @@ -579,7 +579,7 @@ enum { | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32))) + | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32_t))) | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*))) | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool))) | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(void*))) @@ -591,7 +591,7 @@ enum { (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) #else -typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData); +typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData); #define NewNPN_PostURLNotifyProc(FUNC) \ ((NPN_PostURLNotifyUPP) (FUNC)) #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ @@ -635,7 +635,7 @@ enum { | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32))) + | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32_t))) | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*))) | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool))) | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) @@ -646,7 +646,7 @@ enum { (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) #else -typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file); +typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file); #define NewNPN_PostURLProc(FUNC) \ ((NPN_PostURLUPP) (FUNC)) #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ @@ -719,18 +719,18 @@ enum { uppNPN_WriteProcInfo = kThinkCStackBased | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32))) + | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32_t))) | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) + | RESULT_SIZE(SIZE_CODE(sizeof(int32_t))) }; #define NewNPN_WriteProc(FUNC) \ (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture()) #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer)) + (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer)) #else -typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer); +typedef int32_t (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32_t len, void* buffer); #define NewNPN_WriteProc(FUNC) \ ((NPN_WriteUPP) (FUNC)) #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \ @@ -826,7 +826,7 @@ typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance); typedef UniversalProcPtr NPN_MemAllocUPP; enum { uppNPN_MemAllocProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32))) + | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32_t))) | RESULT_SIZE(SIZE_CODE(sizeof(void *))) }; @@ -837,7 +837,7 @@ enum { #else -typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size); +typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32_t size); #define NewNPN_MemAllocProc(FUNC) \ ((NPN_MemAllocUPP) (FUNC)) #define CallNPN_MemAllocProc(FUNC, ARG1) \ @@ -879,18 +879,18 @@ typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr); typedef UniversalProcPtr NPN_MemFlushUPP; enum { uppNPN_MemFlushProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32))) - | RESULT_SIZE(SIZE_CODE(sizeof(uint32))) + | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32_t))) + | RESULT_SIZE(SIZE_CODE(sizeof(uint32_t))) }; #define NewNPN_MemFlushProc(FUNC) \ (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture()) #define CallNPN_MemFlushProc(FUNC, ARG1) \ - (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1)) + (uint32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1)) #else -typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size); +typedef uint32_t (* NP_LOADDS NPN_MemFlushUPP)(uint32_t size); #define NewNPN_MemFlushProc(FUNC) \ ((NPN_MemFlushUPP) (FUNC)) #define CallNPN_MemFlushProc(FUNC, ARG1) \ @@ -1072,8 +1072,8 @@ typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance); #endif typedef struct _NPPluginFuncs { - uint16 size; - uint16 version; + uint16_t size; + uint16_t version; NPP_NewUPP newp; NPP_DestroyUPP destroy; NPP_SetWindowUPP setwindow; @@ -1091,8 +1091,8 @@ typedef struct _NPPluginFuncs { } NPPluginFuncs; typedef struct _NPNetscapeFuncs { - uint16 size; - uint16 version; + uint16_t size; + uint16_t version; NPN_GetURLUPP geturl; NPN_PostURLUPP posturl; NPN_RequestReadUPP requestread; @@ -1230,11 +1230,11 @@ extern "C" { /* plugin meta member functions */ -NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs); +NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs); -NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs); +NPError WINAPI NP_Initialize(NPNetscapeFuncs *aNPNFuncs); -NPError OSCALL NP_Shutdown(); +void WINAPI NP_Shutdown(); char* NP_GetMIMEDescription(); @@ -1253,8 +1253,8 @@ extern "C" { /* plugin meta member functions */ char* NP_GetMIMEDescription(void); -NPError NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*); -NPError NP_Shutdown(void); +NPError NP_Initialize(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs); +void NP_Shutdown(void); #ifdef __cplusplus } diff --git a/np_sdk/mozsrc/npwin.cpp b/np_sdk/mozsrc/npwin.cpp index b8f3407aaf9d..f31b621e37ee 100644 --- a/np_sdk/mozsrc/npwin.cpp +++ b/np_sdk/mozsrc/npwin.cpp @@ -35,12 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef _NPAPI_H_ #include "npapi.h" -#endif -#ifndef _NPUPP_H_ #include "npupp.h" -#endif //\\// DEFINE #define NP_EXPORT @@ -153,8 +149,7 @@ NP_Initialize(NPNetscapeFuncs* pFuncs) } #endif - // NPP_Initialize is a standard (cross-platform) initialize function. - return NPP_Initialize(); + return NPERR_NO_ERROR; } //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\. @@ -165,12 +160,10 @@ NP_Initialize(NPNetscapeFuncs* pFuncs) // This functio shuold check for some ref count on the dll to see if it is // unloadable or it needs to stay in memory. // -NPError WINAPI NP_EXPORT +void WINAPI NP_EXPORT NP_Shutdown() { - NPP_Shutdown(); g_pNavigatorFuncs = NULL; - return NPERR_NO_ERROR; } char * NP_GetMIMEDescription() @@ -230,7 +223,7 @@ 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; @@ -244,7 +237,7 @@ NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uin } -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); } @@ -278,11 +271,11 @@ NPError NPN_NewStream(NPP instance, NPMIMEType type, /* 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; + int32_t result; if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) { result = g_pNavigatorFuncs->write(instance, stream, len, buffer); @@ -329,7 +322,7 @@ const char* NPN_UserAgent(NPP instance) */ -void* NPN_MemAlloc(uint32 size) +void* NPN_MemAlloc(uint32_t size) { return g_pNavigatorFuncs->memalloc(size); } -- cgit