gcc 4 fixes for Mac OS X. part 1 of the landing. Patch by Mark Mentovai. b=294244 r=josh sr=darin a=dbaron

This commit is contained in:
joshmoz%gmail.com 2005-06-15 03:49:26 +00:00
parent 260c7973f6
commit e55715ea0a
5 changed files with 32 additions and 25 deletions

View File

@ -915,7 +915,7 @@ bool nsDeviceContextMac :: GetMacFontNumber(const nsString& aFontName, short &aF
// fontNum, nsFontMetricsMac::SetFont() wouldn't need to call this at all.
InitFontInfoList();
FontNameKey key(aFontName);
aFontNum = (short)gFontInfoList->Get(&key);
aFontNum = (short) NS_PTR_TO_INT32(gFontInfoList->Get(&key));
return (aFontNum != 0);
}
@ -1116,7 +1116,7 @@ EnumerateFont(nsHashKey *aKey, void *aData, void* closure)
PRBool match = PR_FALSE;
#if TARGET_CARBON
// we need to match the cast of FMFontFamily in nsDeviceContextMac :: InitFontInfoList()
FMFontFamily fontFamily = (FMFontFamily) aData;
FMFontFamily fontFamily = (FMFontFamily) NS_PTR_TO_INT32(aData);
TextEncoding fontEncoding;
OSStatus status = ::FMGetFontFamilyTextEncoding(fontFamily, &fontEncoding);
if (noErr == status) {

View File

@ -111,7 +111,7 @@ nsFontUtils::GetNativeTextStyle(nsIFontMetrics& inMetrics,
RGBColor black = {0};
outStyle.tsFont = (short)fontNum;
outStyle.tsFont = (short) NS_PTR_TO_INT32(fontNum);
outStyle.tsFace = textFace;
outStyle.tsSize = textSize;
outStyle.tsColor = black;

View File

@ -66,7 +66,8 @@ public:
inline PRBool Get(PRUnichar aChar, ScriptCode& oScript)
{
ScriptCode ret = (ScriptCode)PL_HashTableLookup(mTable, (void*)aChar);
ScriptCode ret = (ScriptCode)
NS_PTR_TO_INT32(PL_HashTableLookup(mTable, (void*)aChar));
oScript = 0x00FF & ret ;
return 0x00 != (0xFF00 & ret);
};
@ -86,17 +87,19 @@ public:
private:
inline static PR_CALLBACK PLHashNumber HashKey(const void *aKey)
{
return (PRUnichar)aKey;
return (PRUnichar) NS_PTR_TO_INT32(aKey);
};
inline static PR_CALLBACK PRIntn CompareKeys(const void *v1, const void *v2)
{
return (((PRUnichar ) v1) == ((PRUnichar ) v2));
return (((PRUnichar ) NS_PTR_TO_INT32(v1)) ==
((PRUnichar ) NS_PTR_TO_INT32(v2)));
};
inline static PR_CALLBACK PRIntn CompareValues(const void *v1, const void *v2)
{
return (((ScriptCode)v1) == ((ScriptCode)v2));
return (((ScriptCode) NS_PTR_TO_INT32(v1)) ==
((ScriptCode) NS_PTR_TO_INT32(v2)));
};
inline static PR_CALLBACK PRIntn FreeHashEntries(PLHashEntry *he, PRIntn italic, void *arg)
{

View File

@ -191,8 +191,10 @@ PR_END_EXTERN_C
#ifdef XP_MACOSX
#define TV2FP(tvp) _TV2FP((void *)tvp)
static void*
TV2FP(void *tvp)
_TV2FP(void *tvp)
{
static uint32 glue[6] = {
0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420
@ -211,8 +213,10 @@ TV2FP(void *tvp)
return newGlue;
}
#define FP2TV(fp) _FP2TV((void *)fp)
static void*
FP2TV(void *fp)
_FP2TV(void *fp)
{
void **newGlue = NULL;
if (fp != NULL) {
@ -474,29 +478,29 @@ ns4xPlugin::~ns4xPlugin(void)
#if defined(XP_MACOSX)
// release all wrapped plugin entry points.
if (fCallbacks.newp)
free(fCallbacks.newp);
free((void *)fCallbacks.newp);
if (fCallbacks.destroy)
free(fCallbacks.destroy);
free((void *)fCallbacks.destroy);
if (fCallbacks.setwindow)
free(fCallbacks.setwindow);
free((void *)fCallbacks.setwindow);
if (fCallbacks.newstream)
free(fCallbacks.newstream);
free((void *)fCallbacks.newstream);
if (fCallbacks.asfile)
free(fCallbacks.asfile);
free((void *)fCallbacks.asfile);
if (fCallbacks.writeready)
free(fCallbacks.writeready);
free((void *)fCallbacks.writeready);
if (fCallbacks.write)
free(fCallbacks.write);
free((void *)fCallbacks.write);
if (fCallbacks.print)
free(fCallbacks.print);
free((void *)fCallbacks.print);
if (fCallbacks.event)
free(fCallbacks.event);
free((void *)fCallbacks.event);
if (fCallbacks.urlnotify)
free(fCallbacks.urlnotify);
free((void *)fCallbacks.urlnotify);
if (fCallbacks.getvalue)
free(fCallbacks.getvalue);
free((void *)fCallbacks.getvalue);
if (fCallbacks.setvalue)
free(fCallbacks.setvalue);
free((void *)fCallbacks.setvalue);
#endif
memset((void*) &fCallbacks, 0, sizeof(fCallbacks));
}
@ -839,7 +843,7 @@ ns4xPlugin::Shutdown(void)
#if defined(XP_MACOSX)
// release the wrapped plugin function.
free(fShutdownEntry);
free((void *)fShutdownEntry);
#endif
fShutdownEntry = nsnull;
}

View File

@ -64,9 +64,9 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL)
CFBundleRef bundle =
::CFBundleGetBundleWithIdentifier(CFSTR("com.apple.Carbon"));
if (bundle) {
fpKLGetCurrentKeyboardLayout =
fpKLGetCurrentKeyboardLayout = (fpKLGetCurrentKeyboardLayout_type)
::CFBundleGetFunctionPointerForName(bundle, CFSTR("KLGetCurrentKeyboardLayout"));
fpKLGetKeyboardLayoutProperty =
fpKLGetKeyboardLayoutProperty = (fpKLGetKeyboardLayoutProperty_type)
::CFBundleGetFunctionPointerForName(bundle, CFSTR("KLGetKeyboardLayoutProperty"));
}
@ -76,7 +76,7 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL)
if (fpKLGetCurrentKeyboardLayout) {
OSStatus err;
KeyboardLayoutRef currentKeyboard;
const void* currentKeyboardResID;
void* currentKeyboardResID;
err = fpKLGetCurrentKeyboardLayout(&currentKeyboard);
if (err == noErr)