Closed Bug 869091 Opened 7 years ago Closed 7 years ago

fix build warnings in Cocoa widgets

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: jaas, Assigned: jaas)

Details

Attachments

(1 file)

Attached patch fix v1.0Splinter Review
Fixes a couple of simple compiler warnings in Cocoa widgets.
Attachment #745970 - Attachment is patch: true
Attachment #745970 - Attachment mime type: text/x-patch → text/plain
Attachment #745970 - Flags: review?(smichaud)
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+
Assignee: nobody → joshmoz
https://hg.mozilla.org/mozilla-central/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.