Closed Bug 885596 Opened 11 years ago Closed 11 years ago

nsWebBrowser.cpp(706) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation

Categories

(Core Graveyard :: Embedding: APIs, defect)

All
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla25

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We currently spam these build warnings when compiling nsWebBrowser.cpp on windows: { e:/builds/moz2_slave/m-cen-w32-d-000000000000000000/build/embedding/browser/webBrowser/nsWebBrowser.cpp(706) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation e:/builds/moz2_slave/m-cen-w32-d-000000000000000000/build/embedding/browser/webBrowser/nsWebBrowser.cpp(713) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation e:/builds/moz2_slave/m-cen-w32-d-000000000000000000/build/embedding/browser/webBrowser/nsWebBrowser.cpp(720) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation e:/builds/moz2_slave/m-cen-w32-d-000000000000000000/build/embedding/browser/webBrowser/nsWebBrowser.cpp(727) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation e:/builds/moz2_slave/m-cen-w32-d-000000000000000000/build/embedding/browser/webBrowser/nsWebBrowser.cpp(734) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation e:/builds/moz2_slave/m-cen-w32-d-000000000000000000/build/embedding/browser/webBrowser/nsWebBrowser.cpp(741) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation e:/builds/moz2_slave/m-cen-w32-d-000000000000000000/build/embedding/browser/webBrowser/nsWebBrowser.cpp(748) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation e:/builds/moz2_slave/m-cen-w32-d-000000000000000000/build/embedding/browser/webBrowser/nsWebBrowser.cpp(760) : warning C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation } https://tbpl.mozilla.org/php/getParsedLog.php?id=24383470&tree=Mozilla-Central These warnings are from a series of sanity-checks like the following one, to make sure that a uint32_t has the exact value 'true' or 'false' and nothing else: > 697 NS_IMETHODIMP nsWebBrowser::SetProperty(uint32_t aId, uint32_t aValue) > 698 { [...] > 706 NS_ENSURE_TRUE((aValue == true || aValue == false), NS_ERROR_INVALID_ARG); This code's been like this since bug 46847, which dougt reviewed (in 2000, at which point we had PR_TRUE instead of 'true'), so I'll be tagging him for review here. :) I think we want to just static_cast 'true' and 'false' to uint32_t for the sake of these comparisons. That's what happens under the hood anyway, IIRC. (The bool values get promoted to be 32-bit values, if they aren't already, so that they can be compared to uint32_t.)
Attached patch fix v1 (deleted) — Splinter Review
Attachment #765705 - Flags: review?(doug.turner)
Blocks: 885598
Status: NEW → ASSIGNED
OS: Linux → Windows 7
Hardware: x86_64 → All
Attachment #765705 - Flags: review?(doug.turner) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Blocks: buildwarning
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: