Closed Bug 869091 Opened 7 years ago Closed 7 years ago
fix build warnings in Cocoa widgets
Fixes a couple of simple compiler warnings in Cocoa widgets.
Does the current code in -[ChildView maybeDrawInTitlebar:] trigger any warnings? It really shouldn't. Your change to nsChildView::WillPaint() makes sense, though.
Just looked at a log for a recent build. Only the "[mView maybeDrawInTitlebar]" in nsChildView::WillPaint() triggers a warning. The code you've changed in -[ChildView maybeDrawInTitlebar] is actually correct, if a little counterintuitive.
This is what my patch fixes on OS X 10.8 using clang: nsChildView.mm /Users/josh/src/mozilla/ff_trunk_debug/widget/cocoa/nsChildView.mm:710:3: warning: instance method '-maybeDrawInTitlebar' not found (return type defaults to 'id') [mView maybeDrawInTitlebar]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/josh/src/mozilla/ff_trunk_debug/widget/cocoa/nsChildView.mm:2684:24: warning: incompatible pointer types initializing 'ToolbarWindow *' with an expression of type 'NSWindow *' [-Wincompatible-pointer-types] ToolbarWindow* win = [self window]; ^~~~~
Comment on attachment 745970 [details] [diff] [review] fix v1.0 I've been building with clang on OS X 10.7.5. > ToolbarWindow* win = [self window]; And now that I think about it, this *is* incorrect, but could easily be fixed as follows: ToolbarWindow* win = (ToolbarWindow*) [self window]; But frankly I don't care that much about the syntax I used. I think it looks better to have a single 'win' variable of type ToolbarWindow*, on which I do a runtime check to see if it really is a ToolbarWindow* (instead of some other kind of NSWindow*). But it works just as well to have two 'win' variables -- one an NSWindow* and the other a ToolbarWindow*.
Attachment #745970 - Flags: review?(smichaud) → review+
pushed to mozilla-inbound https://hg.mozilla.org/integration/mozilla-inbound/rev/c94459e9a0d7
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.