Closed Bug 652139 Opened 13 years ago Closed 13 years ago

C++0x narrowing conversion inside {} compilation error in nsDocumentViewer.cpp

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla6

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch Patch (obsolete) — Splinter Review
This is similar to bug 502301.

The failure looks like the following:
../../../layout/base/nsDocumentViewer.cpp: In member function 'virtual nsresult DocumentViewerImpl::SetMinFontSize(PRInt32)':
../../../layout/base/nsDocumentViewer.cpp:2870:45: error: narrowing conversion of 'aMinFontSize' from 'PRInt32' to 'float' inside { }

See https://bugzilla.mozilla.org/show_bug.cgi?id=502301#c4 as to why this is invalid C++0x.
Attachment #527783 - Flags: review?
Attachment #527783 - Flags: review? → review?(dbaron)
Comment on attachment 527783 [details] [diff] [review]
Patch

Oops, this shouldn't be using ZoomInfo at all.  Instead it should have its own struct that has a PRInt32 member.
Attachment #527783 - Flags: review?(dbaron) → review-
Note this also affects aurora.
Attached patch Patch (obsolete) — Splinter Review
This should work, and is how e.g. SetChildHintCharacterSetSource does it.
Attachment #527783 - Attachment is obsolete: true
Attachment #527804 - Flags: review?(dbaron)
Comment on attachment 527804 [details] [diff] [review]
Patch

Use NS_INT32_TO_PTR() at the incoming end instead of just a void* cast, and r=dbaron.
Attachment #527804 - Flags: review?(dbaron) → review+
Two questions:
- do you want other similar void* casts changed at the same time? (there's SetChildHintCharacterSetSource and SetChildBidiOptions)
- do you want this fix on aurora ?
Arg, I missed the mDocument->EnumerateExternalResources(SetExtResourceMinFontSize, &ZoomInfo); a few lines later.
Attached patch Patch v3Splinter Review
Changing other similar void* casts, and fixing EnumerateExternalResources call.
Assignee: nobody → mh+mozilla
Attachment #527804 - Attachment is obsolete: true
Attachment #527810 - Flags: review?(dbaron)
Comment on attachment 527810 [details] [diff] [review]
Patch v3

r=dbaron
Attachment #527810 - Flags: review?(dbaron) → review+
(Do you have a good reason this ought to be fixed on Aurora?)
(In reply to comment #9)
> (Do you have a good reason this ought to be fixed on Aurora?)

None particularly, I can apply the patch locally. I merely asked if you had a wish to fix this on aurora.
http://hg.mozilla.org/mozilla-central/rev/503696b78379
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: