XP code changes required for mingw landing.

Add NS_STDCALL macros for functions that require stdcall declarations.
Add NS_STDCALL_FUNCPROTO macro for stdcall function prototype typedefs.
Bug #134113 r=dougt sr=dbaron
This commit is contained in:
cls%seawood.org 2003-03-07 06:07:56 +00:00
Родитель d28167021e
Коммит d1079607df
21 изменённых файлов: 51 добавлений и 40 удалений

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

@ -39,21 +39,11 @@
#ifndef __NS_SVGVALUE_H__
#define __NS_SVGVALUE_H__
#include "nscore.h"
#include "nsISVGValue.h"
#include "nsGenericElement.h" // for CheapVoidArray
#include "nsISVGValueObserver.h"
// XXX this should be somewhere else
#if defined(XP_PC) && !defined(XP_OS2)
#define STDCALL __stdcall
#else
#define STDCALL
#endif
typedef nsresult
(STDCALL nsISVGValueObserver::*SVGObserverNotifyFunction)(nsISVGValue*);
class nsSVGValue : public nsISVGValue
{
protected:
@ -69,6 +59,10 @@ public:
// Partial Implementation of nsISVGValue interface:
NS_IMETHOD AddObserver(nsISVGValueObserver* observer);
NS_IMETHOD RemoveObserver(nsISVGValueObserver* observer);
typedef nsresult
NS_STDCALL_FUNCPROTO(nsISVGValueObserver::*SVGObserverNotifyFunction,(nsISVGValue*));
protected:
// implementation helpers

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

@ -164,7 +164,7 @@ morkSearchRowCursor::MakeUniqCursor(morkEnv* ev)
return outCursor;
}
#ifdef NEEDED
#if 0
orkinTableRowCursor*
morkSearchRowCursor::AcquireUniqueRowCursorHandle(morkEnv* ev)
{

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

@ -116,8 +116,10 @@ public: // other search row cursor methods
virtual mork_bool CanHaveDupRowMembers(morkEnv* ev);
virtual mork_count GetMemberCount(morkEnv* ev);
#if 0
virtual orkinTableRowCursor* AcquireUniqueRowCursorHandle(morkEnv* ev);
#endif
// virtual mdb_pos NextRowOid(morkEnv* ev, mdbOid* outOid);
virtual morkRow* NextRow(morkEnv* ev, mdbOid* outOid, mdb_pos* outPos);

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

@ -622,7 +622,7 @@ nsAutoArray<T, sz>::GetArray(PRInt32 aMinCount)
typedef nsAutoArray<PRUint8, AUTO_FONTDATA_BUFFER_SIZE> nsAutoFontDataBuffer;
typedef nsAutoArray<char, CHAR_BUFFER_SIZE> nsAutoCharBuffer;
typedef nsAutoArray<PRUint16, CHAR_BUFFER_SIZE> nsAutoChar16Buffer;
typedef nsAutoArray<PRUnichar, CHAR_BUFFER_SIZE> nsAutoChar16Buffer;
static PRUint16
GetGlyphIndex(PRUint16 segCount, PRUint16* endCode, PRUint16* startCode,

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

@ -235,7 +235,7 @@ extern const char XPC_XPCONNECT_CONTRACTID[];
// Auto locking support class...
// We PROMISE to never screw this up.
#ifdef WIN32
#ifdef _MSC_VER
#pragma warning(disable : 4355) // OK to pass "this" in member initializer
#endif
@ -246,7 +246,7 @@ static inline void xpc_Wait(XPCLock* lock)
NS_ASSERTION(lock, "xpc_Wait called with null lock!");
#ifdef DEBUG
PRStatus result =
#endif
#endif
PR_Wait(lock, PR_INTERVAL_NO_TIMEOUT);
NS_ASSERTION(PR_SUCCESS == result, "bad result from PR_Wait!");
}

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

@ -700,7 +700,7 @@ nsHttpHandler::InitUserAgentComponents()
mOscpu.Adopt(nsCRT::strdup("Warp 4.5"));
#elif defined(XP_PC)
OSVERSIONINFO info = { sizeof OSVERSIONINFO };
OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
if (GetVersionEx(&info)) {
if (info.dwPlatformId == VER_PLATFORM_WIN32_NT) {
if (info.dwMajorVersion == 3)

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

@ -40,7 +40,7 @@
#include "nscore.h"
// for |PRUnichar|, |NS_REINTERPRET_CAST|
#ifdef XP_WIN
#ifdef _MSC_VER
// VC++ erroneously warns about incompatible linkage in these templates
// It's a lie, and it's bothersome. This |#pragma| quiets the warning.
#pragma warning( disable: 4251 )

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

@ -297,7 +297,7 @@ extern NS_COM nsresult
NS_ErrorAccordingToNSPR();
#if defined(XP_WIN)
#ifdef _MSC_VER
#pragma warning(disable: 4251) /* 'nsCOMPtr<class nsIInputStream>' needs to have dll-interface to be used by clients of class 'nsInputStream' */
#pragma warning(disable: 4275) /* non dll-interface class 'nsISupports' used as base for dll-interface class 'nsIRDFNode' */
#endif

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

@ -69,6 +69,7 @@
#define NS_IMETHODIMP_(type) type __stdcall
#define NS_METHOD_(type) type __stdcall
#define NS_CALLBACK_(_type, _name) _type (__stdcall * _name)
#define NS_STDCALL __stdcall
#elif defined(XP_MAC)
@ -80,6 +81,7 @@
#define NS_IMETHODIMP_(type) type
#define NS_METHOD_(type) type
#define NS_CALLBACK_(_type, _name) _type (* _name)
#define NS_STDCALL
#elif defined(XP_OS2)
@ -91,6 +93,7 @@
#define NS_IMETHODIMP_(type) type
#define NS_METHOD_(type) type
#define NS_CALLBACK_(_type, _name) _type (* _name)
#define NS_STDCALL
#else
@ -102,6 +105,17 @@
#define NS_IMETHODIMP_(type) type
#define NS_METHOD_(type) type
#define NS_CALLBACK_(_type, _name) _type (* _name)
#define NS_STDCALL
#endif
/**
* Macro for creating function protoypes which use stdcall
*/
#ifdef __GNUC__
#define NS_STDCALL_FUNCPROTO(func,args) (func) args NS_STDCALL
#else
#define NS_STDCALL_FUNCPROTO(func,args) (NS_STDCALL func) args
#endif
/**
@ -243,7 +257,9 @@ typedef PRUint32 nsresult;
/* unix and beos now determine this automatically */
#if ! defined XP_UNIX && ! defined XP_BEOS && !defined(XP_OS2)
#define HAVE_CPP_NEW_CASTS /* we'll be optimistic. */
#ifndef HAVE_CPP_NEW_CASTS
#define HAVE_CPP_NEW_CASTS 1 /* we'll be optimistic. */
#endif
#endif
#if defined(HAVE_CPP_NEW_CASTS)

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

@ -423,7 +423,7 @@ void nsDll::BreakAfterLoad(const char *nsprPath)
// Put your breakpoint here
fprintf(stderr, "...Loading module %s\n", nsprPath);
// Break in the debugger here.
#if defined(linux) && defined(__i386)
#if defined(__i386) && defined(__GNUC__)
asm("int $3");
#elif defined(VMS)
lib$signal(SS$_DEBUG);

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

@ -56,7 +56,7 @@
#include "nsTraceRefcnt.h"
#endif
#if defined(linux) && defined(__i386)
#if defined(__GNUC__) && defined(__i386)
# define DebugBreak() { asm("int $3"); }
#else
# define DebugBreak()

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

@ -301,7 +301,7 @@ PRBool nsFileSpec::IsSymlink() const
if (SUCCEEDED(hres))
{
WORD wsz[MAX_PATH];
WCHAR wsz[MAX_PATH];
// Ensure that the string is Unicode.
MultiByteToWideChar(CP_ACP, 0, mPath, -1, wsz, MAX_PATH);
@ -352,7 +352,7 @@ nsresult nsFileSpec::ResolveSymlink(PRBool& wasSymlink)
if (SUCCEEDED(hres))
{
WORD wsz[MAX_PATH];
WCHAR wsz[MAX_PATH];
// Ensure that the string is Unicode.
MultiByteToWideChar(CP_ACP, 0, mPath, -1, wsz, MAX_PATH);

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

@ -66,7 +66,7 @@ public:
virtual ~ShortcutResolver();
nsresult Init();
nsresult Resolve(const unsigned short* in, char* out);
nsresult Resolve(const WCHAR* in, char* out);
private:
PRLock* mLock;
@ -125,7 +125,7 @@ ShortcutResolver::Init()
// |out| must be an allocated buffer of size MAX_PATH
nsresult
ShortcutResolver::Resolve(const unsigned short* in, char* out)
ShortcutResolver::Resolve(const WCHAR* in, char* out)
{
nsAutoLock lock(mLock);

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

@ -38,7 +38,7 @@
// For older version (<6.0) of the VC Compiler
#if (_MSC_VER == 1100)
#include "objbase.h"
#include <objbase.h>
DEFINE_OLEGUID(IID_IPersistFile, 0x0000010BL, 0, 0);
#endif

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

@ -40,7 +40,7 @@
#include "nscore.h"
// for |PRUnichar|, |NS_REINTERPRET_CAST|
#ifdef XP_WIN
#ifdef _MSC_VER
// VC++ erroneously warns about incompatible linkage in these templates
// It's a lie, and it's bothersome. This |#pragma| quiets the warning.
#pragma warning( disable: 4251 )

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

@ -37,6 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include <windows.h>
#include <unknwn.h>
#include <iostream.h>
#include "nsISupports.h"
#include "nsIFactory.h"

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

@ -39,6 +39,7 @@
#ifndef nswindowshooks_h____
#define nswindowshooks_h____
#include "nscore.h"
#include "nsIWindowsHooks.h"
#ifndef MAX_BUF
@ -60,8 +61,8 @@ public:
NS_DECL_NSIWINDOWSHOOKSSETTINGS
// Typedef for nsIWindowsHooksSettings getter/setter member functions.
typedef nsresult (__stdcall nsIWindowsHooksSettings::*getter)( PRBool* );
typedef nsresult (__stdcall nsIWindowsHooksSettings::*setter)( PRBool );
typedef nsresult NS_STDCALL_FUNCPROTO(nsIWindowsHooksSettings::*getter,( PRBool* ));
typedef nsresult NS_STDCALL_FUNCPROTO(nsIWindowsHooksSettings::*setter, ( PRBool ));
protected:
// General purpose getter.
@ -71,15 +72,12 @@ protected:
private:
// Internet shortcut protocols.
struct {
PRBool mHandleHTTP;
PRBool mHandleHTTPS;
PRBool mHandleFTP;
PRBool mHandleCHROME;
PRBool mHandleGOPHER;
};
// File types.
struct {
PRBool mHandleHTML;
PRBool mHandleJPEG;
PRBool mHandleGIF;
@ -91,10 +89,9 @@ private:
PRBool mHandleXML;
PRBool mHandleXHTML;
PRBool mHandleXUL;
};
struct {
// Dialog
PRBool mShowDialog;
};
// Special member to handle initialization.
PRBool mHaveBeenSet;
NS_IMETHOD GetHaveBeenSet( PRBool * );

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

@ -294,7 +294,7 @@ nsInstall::GetInstallPlatform(nsCString& aPlatform)
// Gather OS/CPU.
#if defined(XP_WIN)
OSVERSIONINFO info = { sizeof OSVERSIONINFO };
OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
if (GetVersionEx(&info)) {
if ( info.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
if (info.dwMajorVersion == 3) {

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

@ -184,7 +184,7 @@ nsWinReg::EnumValueNames(const nsString& aSubkey, PRInt32 aIndex, nsString &aRet
LONG result;
DWORD namesize = sizeof(namebuf);
char subkeyCString[MAX_BUF];
unsigned short returnBuf[MAX_BUF];
WCHAR returnBuf[MAX_BUF];
PRInt32 rv = NS_ERROR_FAILURE;
subkeyCString[0] = 0;
@ -223,7 +223,7 @@ nsWinReg::EnumKeys(const nsString& aSubkey, PRInt32 aIndex, nsString &aReturn)
LONG result;
DWORD type = REG_SZ;
char subkeyCString[MAX_BUF];
unsigned short returnBuf[MAX_BUF];
WCHAR returnBuf[MAX_BUF];
PRInt32 rv = NS_ERROR_FAILURE;
subkeyCString[0] = 0;

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

@ -28,6 +28,7 @@
// stdlib.h and malloc.h are needed to build with WIN32_LEAN_AND_MEAN
#include <stdlib.h>
#include <malloc.h>
#include <ctype.h>
#include "resource.h"
#include "zlib.h"

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

@ -32,7 +32,7 @@ BOOL InitApplication(HINSTANCE hInstance, HINSTANCE hSetupRscInst);
BOOL InitInstance(HINSTANCE hInstance, DWORD dwCmdShow);
void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH);
void FreeMemory(void **vPointer);
void *NS_GlobalReAlloc(HGLOBAL hgMemory,
void *NS_GlobalReAlloc(HGLOBAL *hgMemory,
DWORD dwMemoryBufSize,
DWORD dwNewSize);
void *NS_GlobalAlloc(DWORD dwMaxBuf);