Fix misc build issues for mingw gcc 3.3.1:

* Link non-component libs using -Wl,-enable-runtime-psuedo-relocs to workaround auto-import issues
* the last element of an enum cannot end with a comma
* PRUint16 is not interchangable with PRUnichar nor WCHAR
* cannot take the address of or call ::main() from another c++ function
* Functions declared within |class foo {};| block do not need extra |foo::| qualification
* GCC no longer implements <varargs.h>. Use <stdarg.h> instead
Bug #217009 sr=dbaron
This commit is contained in:
cls%seawood.org 2003-09-18 17:22:33 +00:00
Родитель 854e18e642
Коммит bfca537521
15 изменённых файлов: 28 добавлений и 25 удалений

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

@ -521,7 +521,7 @@ endif
ifeq ($(OS_ARCH),WINNT)
ifdef GNU_CC
ifndef IS_COMPONENT
DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -Wl,-enable-runtime-pseudo-reloc
endif
endif
endif

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

@ -309,7 +309,7 @@ ChangeCase(JSContext *cx, JSString *src, jsval *rval,
nsAutoString result;
changeCaseFnc(str, result);
JSString *ucstr = JS_NewUCStringCopyN(cx, result.get(), result.Length());
JSString *ucstr = JS_NewUCStringCopyN(cx, (jschar*)result.get(), result.Length());
if (!ucstr) {
return JS_FALSE;
}

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

@ -1476,7 +1476,7 @@ enum {
eTTFormat6TrimmedTableMapping = 6,
eTTFormat8Mixed16bitAnd32bitCoverage = 8,
eTTFormat10TrimmedArray = 10,
eTTFormat12SegmentedCoverage = 12,
eTTFormat12SegmentedCoverage = 12
};
static void
@ -1939,7 +1939,7 @@ GetGlyphIndices(HDC aDC,
PRUint16* idDelta = startCode + segCount;
PRUint16* idRangeOffset = idDelta + segCount;
PRUint16* result = aResult.GetArray(aLength);
PRUnichar* result = aResult.GetArray(aLength);
if (!result) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -4255,7 +4255,7 @@ nsFontWinNonUnicode::GetBoundingMetrics(HDC aDC,
if (gGlyphAgent.GetState() != eGlyphAgent_UNICODE) {
// we are on a platform that doesn't implement GetGlyphOutlineW()
// we need to use glyph indices
rv = GetGlyphIndices(aDC, &mCMAP, (PRUint16*) buffer.GetArray(), destLength / 2, buf);
rv = GetGlyphIndices(aDC, &mCMAP, (PRUnichar*)buffer.GetArray(), destLength / 2, buf);
if (NS_FAILED(rv)) {
return rv;
}
@ -4263,7 +4263,7 @@ nsFontWinNonUnicode::GetBoundingMetrics(HDC aDC,
// buffer.mBuffer is now a pseudo-Unicode string so that we can use
// GetBoundingMetricsCommon() also used by nsFontWinUnicode.
return GetBoundingMetricsCommon(aDC, mOverhangCorrection, (PRUint16*) buffer.GetArray(),
return GetBoundingMetricsCommon(aDC, mOverhangCorrection, (PRUnichar*)buffer.GetArray(),
destLength / 2, aBoundingMetrics, buf.GetArray());
}
@ -4437,7 +4437,7 @@ GenerateSingleByte(nsCharsetInfo* aSelf)
{
PRUint32 map[UCS2_MAP_LEN];
PRUint8 mb[256];
PRUint16 wc[256];
WCHAR wc[256];
int i;
memset(map, 0, sizeof(map));
@ -4485,7 +4485,7 @@ GenerateMultiByte(nsCharsetInfo* aSelf)
{
PRUint32 map[UCS2_MAP_LEN];
memset(map, 0, sizeof(map));
for (PRUint16 c = 0; c < 0xFFFF; ++c) {
for (WCHAR c = 0; c < 0xFFFF; ++c) {
BOOL defaulted = FALSE;
WideCharToMultiByte(aSelf->mCodePage, 0, &c, 1, nsnull, 0, nsnull,
&defaulted);
@ -4499,7 +4499,7 @@ GenerateMultiByte(nsCharsetInfo* aSelf)
static int
HaveConverterFor(PRUint8 aCharset)
{
PRUint16 wc = 'a';
WCHAR wc = 'a';
char mb[8];
if (WideCharToMultiByte(gCharsetInfo[gCharsetToIndex[aCharset]].mCodePage, 0,
&wc, 1, mb, sizeof(mb), nsnull, nsnull)) {

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

@ -44,7 +44,7 @@
enum eFontType {
eFontType_UNKNOWN = -1,
eFontType_Unicode,
eFontType_NonUnicode,
eFontType_NonUnicode
};
struct nsCharacterMap {

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

@ -454,7 +454,7 @@ nsMessengerWinIntegration::Init()
// get application path
char appPath[_MAX_PATH] = {0};
GetModuleFileName(nsnull, appPath, sizeof(appPath));
WORD wideFormatAppPath[_MAX_PATH*2] = {0};
WCHAR wideFormatAppPath[_MAX_PATH*2] = {0};
MultiByteToWideChar(CP_ACP, 0, appPath, strlen(appPath), wideFormatAppPath, _MAX_PATH*2);
mAppName.Assign((PRUnichar *)wideFormatAppPath);

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

@ -167,8 +167,8 @@ private:
static tRASGETAUTODIALENABLE mpRasGetAutodialEnable;
static tRASGETAUTODIALPARAM mpRasGetAutodialParam;
PRBool nsRASAutodial::LoadRASapi32DLL();
PRBool nsRASAutodial::LoadRASdlgDLL();
PRBool LoadRASapi32DLL();
PRBool LoadRASdlgDLL();
public:

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

@ -318,11 +318,11 @@ nsHttpNTLMAuth::GenerateCredentials(nsIHttpChannel *httpChannel,
pIdent = &identA;
}
else {
identW.User = (PRUnichar *) user;
identW.User = (unsigned short *) user;
identW.UserLength = nsCRT::strlen(user);
identW.Domain = (PRUnichar *) domain;
identW.Domain = (unsigned short *) domain;
identW.DomainLength = nsCRT::strlen(domain);
identW.Password = (PRUnichar *) pass;
identW.Password = (unsigned short *) pass;
identW.PasswordLength = nsCRT::strlen(pass);
identW.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
pIdent = &identW;

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

@ -41,7 +41,7 @@
#define LOG(args) PR_LOG(mLog, PR_LOG_DEBUG, args)
// helper methods: forward declarations...
BYTE * GetValueBytes( HKEY hKey, const char *pValueName, DWORD *pLen=0);
static BYTE * GetValueBytes( HKEY hKey, const char *pValueName, DWORD *pLen=0);
nsresult GetExtensionFrom4xRegistryInfo(const char * aMimeType, nsCString& aFileExtension);
nsresult GetExtensionFromWindowsMimeDatabase(const char * aMimeType, nsCString& aFileExtension);

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

@ -160,6 +160,7 @@ int main(int argc, char **argv)
return result;
}
#ifndef __GNUC__
int PASCAL
WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
int nCmdShow)
@ -168,3 +169,4 @@ WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
gPrevInstance = prevInstance;
return main(0, nsnull);
}
#endif

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

@ -6598,7 +6598,8 @@ nsWindow::HandleMouseActionOfIME(int aAction, POINT *ptPos)
// Note: hitText has been done, so no check of mIMECompCharPos
// and composing char maximum limit is necessary.
for (PRInt32 i = 0; i < mIMECompUnicode->Length(); i++) {
PRInt32 i = 0;
for (i = 0; i < mIMECompUnicode->Length(); i++) {
if (PT_IN_RECT(*ptPos, mIMECompCharPos[i]))
break;
}

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

@ -1680,7 +1680,7 @@ int main(int argc, char* argv[])
return TranslateReturnValue(mainResult);
}
#if defined( XP_WIN ) && defined( WIN32 )
#if defined( XP_WIN ) && defined( WIN32 ) && !defined(__GNUC__)
// We need WinMain in order to not be a console app. This function is
// unused if we are a console application.
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR args, int)

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

@ -1062,7 +1062,7 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) {
PRBool
nsNativeAppSupportWin::InitTopicStrings() {
for ( int i = 0; i < topicCount; i++ ) {
if ( !( mTopics[ i ] = DdeCreateStringHandle( mInstance, topicNames[ i ], CP_WINANSI ) ) ) {
if ( !( mTopics[ i ] = DdeCreateStringHandle( mInstance, NS_CONST_CAST(char *,topicNames[ i ]), CP_WINANSI ) ) ) {
return PR_FALSE;
}
}

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

@ -891,8 +891,8 @@ nsGlobalHistory::SwapBytes(const PRUnichar *source, PRUnichar *dest,
PRInt32 aLen)
{
PRUint16 c;
const PRUint16 *inp;
PRUint16 *outp;
const PRUnichar *inp;
PRUnichar *outp;
PRInt32 i;
inp = source;

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

@ -1256,7 +1256,7 @@ nsInstall::LoadResources(JSContext* cx, const nsString& aBaseName, jsval* aRetur
JSString* propValJSStr = JS_NewUCStringCopyZ(cx, NS_REINTERPRET_CAST(const jschar*, pVal.get()));
jsval propValJSVal = STRING_TO_JSVAL(propValJSStr);
nsString UCKey = NS_ConvertUTF8toUCS2(pKey);
JS_SetUCProperty(cx, res, UCKey.get(), UCKey.Length(), &propValJSVal);
JS_SetUCProperty(cx, res, (jschar*)UCKey.get(), UCKey.Length(), &propValJSVal);
}
}

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

@ -43,7 +43,7 @@
#include "nsAppDirectoryServiceDefs.h"
#ifdef XP_WIN
#include <varargs.h>
#include <stdarg.h>
#include <winbase.h>
#include <winreg.h>
#endif
@ -401,7 +401,7 @@ nsInstallFolder::SetDirectoryPath(const nsAString& aFolderID, const nsString& aR
BYTE path[_MAX_PATH + 1] = { 0 };
DWORD type;
DWORD pathlen = sizeof(path);
char *value = (dirID==WIN_PROGRAM_FILES) ?
const char *value = (dirID==WIN_PROGRAM_FILES) ?
"ProgramFilesDir" :
"CommonFilesDir";
result = RegQueryValueEx( key, value, 0, &type, path, &pathlen );