Bug 729246: Fix clang warnings in Cocoa widgets. r=smichaud

This commit is contained in:
Josh Aas 2012-02-21 20:44:40 -05:00
parent be847bb9bd
commit 9179ab11a7
7 changed files with 30 additions and 22 deletions

View File

@ -298,8 +298,8 @@ static const nsCursor sCustomCursor = eCursorCount;
} }
// if the hotspot is nonsensical, make it 0,0 // if the hotspot is nonsensical, make it 0,0
aHotspotX = (aHotspotX < 0 || aHotspotX > (PRUint32) width - 1) ? 0 :aHotspotX; aHotspotX = (aHotspotX > (PRUint32)width - 1) ? 0 : aHotspotX;
aHotspotY = (aHotspotY < 0 || aHotspotY > (PRUint32) height - 1) ? 0 :aHotspotY; aHotspotY = (aHotspotY > (PRUint32)height - 1) ? 0 : aHotspotY;
NSPoint hotSpot = ::NSMakePoint(aHotspotX, aHotspotY); NSPoint hotSpot = ::NSMakePoint(aHotspotX, aHotspotY);
[self setMacCursor:[nsMacCursor cursorWithCursor:[[NSCursor alloc] initWithImage:cursorImage hotSpot:hotSpot] type:sCustomCursor]]; [self setMacCursor:[nsMacCursor cursorWithCursor:[[NSCursor alloc] initWithImage:cursorImage hotSpot:hotSpot] type:sCustomCursor]];

View File

@ -44,6 +44,9 @@ class nsIdleServiceX : public nsIdleService
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
nsIdleServiceX() {}
virtual ~nsIdleServiceX() {}
bool PollIdleTime(PRUint32* aIdleTime); bool PollIdleTime(PRUint32* aIdleTime);
protected: protected:

View File

@ -566,6 +566,8 @@ nsLookAndFeel::GetFontImpl(FontID aID, nsString &aFontName,
case eFont_Widget: case eFont_Widget:
font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
break; break;
default:
break;
} }
if (!font) { if (!font) {

View File

@ -59,6 +59,10 @@ class nsNativeMenuServiceX : public nsINativeMenuService
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
nsNativeMenuServiceX() {}
virtual ~nsNativeMenuServiceX() {}
NS_IMETHOD CreateNativeMenuBar(nsIWidget* aParent, nsIContent* aMenuBarNode); NS_IMETHOD CreateNativeMenuBar(nsIWidget* aParent, nsIContent* aMenuBarNode);
}; };

View File

@ -60,7 +60,7 @@ public:
nsIContent* aContent, nsIContent* aContent,
NSMenuItem* aNativeMenuItem); NSMenuItem* aNativeMenuItem);
private: private:
~nsMenuItemIconX(); virtual ~nsMenuItemIconX();
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS

View File

@ -1859,12 +1859,12 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
break; break;
case NS_THEME_MENUPOPUP: { case NS_THEME_MENUPOPUP: {
HIThemeMenuDrawInfo mdi = { HIThemeMenuDrawInfo mdi;
version: 0, memset(&mdi, 0, sizeof(mdi));
menuType: IsDisabled(aFrame, eventState) ? mdi.version = 0;
static_cast<ThemeMenuType>(kThemeMenuTypeInactive) : mdi.menuType = IsDisabled(aFrame, eventState) ?
static_cast<ThemeMenuType>(kThemeMenuTypePopUp) static_cast<ThemeMenuType>(kThemeMenuTypeInactive) :
}; static_cast<ThemeMenuType>(kThemeMenuTypePopUp);
bool isLeftOfParent = false; bool isLeftOfParent = false;
if (IsSubmenu(aFrame, &isLeftOfParent) && !isLeftOfParent) { if (IsSubmenu(aFrame, &isLeftOfParent) && !isLeftOfParent) {
@ -1883,14 +1883,15 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
CGContextClearRect(cgContext, macRect); CGContextClearRect(cgContext, macRect);
// maybe use kThemeMenuItemHierBackground or PopUpBackground instead of just Plain? // maybe use kThemeMenuItemHierBackground or PopUpBackground instead of just Plain?
HIThemeMenuItemDrawInfo drawInfo = { HIThemeMenuItemDrawInfo drawInfo;
version: 0, memset(&drawInfo, 0, sizeof(drawInfo));
itemType: kThemeMenuItemPlain, drawInfo.version = 0;
state: (IsDisabled(aFrame, eventState) ? static_cast<ThemeMenuState>(kThemeMenuDisabled) : drawInfo.itemType = kThemeMenuItemPlain;
CheckBooleanAttr(aFrame, nsGkAtoms::menuactive) ? drawInfo.state = (IsDisabled(aFrame, eventState) ?
static_cast<ThemeMenuState>(kThemeMenuSelected) : static_cast<ThemeMenuState>(kThemeMenuDisabled) :
static_cast<ThemeMenuState>(kThemeMenuActive)) CheckBooleanAttr(aFrame, nsGkAtoms::menuactive) ?
}; static_cast<ThemeMenuState>(kThemeMenuSelected) :
static_cast<ThemeMenuState>(kThemeMenuActive));
// XXX pass in the menu rect instead of always using the item rect // XXX pass in the menu rect instead of always using the item rect
HIRect ignored; HIRect ignored;

View File

@ -49,17 +49,15 @@
class nsScreenManagerCocoa : public nsIScreenManager class nsScreenManagerCocoa : public nsIScreenManager
{ {
public: public:
nsScreenManagerCocoa (); nsScreenManagerCocoa();
~nsScreenManagerCocoa (); virtual ~nsScreenManagerCocoa();
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSISCREENMANAGER NS_DECL_NSISCREENMANAGER
private: private:
nsScreenCocoa *ScreenForCocoaScreen (NSScreen *screen); nsScreenCocoa *ScreenForCocoaScreen(NSScreen *screen);
nsTArray< nsRefPtr<nsScreenCocoa> > mScreenList; nsTArray< nsRefPtr<nsScreenCocoa> > mScreenList;
}; };