Last Comment Bug 652139 - C++0x narrowing conversion inside {} compilation error in nsDocumentViewer.cpp
: C++0x narrowing conversion inside {} compilation error in nsDocumentViewer.cpp
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Layout (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla6
Assigned To: Mike Hommey [:glandium]
:
:
Mentors:
Depends on:
Blocks: 650304
  Show dependency treegraph
 
Reported: 2011-04-22 09:08 PDT by Mike Hommey [:glandium]
Modified: 2011-04-22 23:51 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (987 bytes, patch)
2011-04-22 09:08 PDT, Mike Hommey [:glandium]
dbaron: review-
Details | Diff | Splinter Review
Patch (1.63 KB, patch)
2011-04-22 10:19 PDT, Mike Hommey [:glandium]
dbaron: review+
Details | Diff | Splinter Review
Patch v3 (3.84 KB, patch)
2011-04-22 11:03 PDT, Mike Hommey [:glandium]
dbaron: review+
Details | Diff | Splinter Review

Description Mike Hommey [:glandium] 2011-04-22 09:08:23 PDT
Created attachment 527783 [details] [diff] [review]
Patch

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.
Comment 1 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2011-04-22 09:21:33 PDT
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.
Comment 2 Mike Hommey [:glandium] 2011-04-22 10:12:58 PDT
Note this also affects aurora.
Comment 3 Mike Hommey [:glandium] 2011-04-22 10:19:23 PDT
Created attachment 527804 [details] [diff] [review]
Patch

This should work, and is how e.g. SetChildHintCharacterSetSource does it.
Comment 4 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2011-04-22 10:34:19 PDT
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.
Comment 5 Mike Hommey [:glandium] 2011-04-22 10:39:40 PDT
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 ?
Comment 6 Mike Hommey [:glandium] 2011-04-22 10:52:33 PDT
Arg, I missed the mDocument->EnumerateExternalResources(SetExtResourceMinFontSize, &ZoomInfo); a few lines later.
Comment 7 Mike Hommey [:glandium] 2011-04-22 11:03:49 PDT
Created attachment 527810 [details] [diff] [review]
Patch v3

Changing other similar void* casts, and fixing EnumerateExternalResources call.
Comment 8 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2011-04-22 11:26:53 PDT
Comment on attachment 527810 [details] [diff] [review]
Patch v3

r=dbaron
Comment 9 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2011-04-22 11:27:50 PDT
(Do you have a good reason this ought to be fixed on Aurora?)
Comment 10 Mike Hommey [:glandium] 2011-04-22 11:37:05 PDT
(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.
Comment 11 Mike Hommey [:glandium] 2011-04-22 23:51:31 PDT
http://hg.mozilla.org/mozilla-central/rev/503696b78379

Note You need to log in before you can comment on or make changes to this bug.