Closed
Bug 522779
Opened 16 years ago
Closed 16 years ago
Build warning: "nsCSSFrameConstructor.cpp:6976: warning: comparison between signed and unsigned integer expressions", from comparing nsTArray::IndexOf to kNotFound
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
People
(Reporter: dholbert, Assigned: dholbert)
References
Details
(Whiteboard: [build_warning])
Attachments
(1 file, 1 obsolete file)
3.00 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
Build warning:
/mozilla/layout/base/nsCSSFrameConstructor.cpp: In function ‘void DoDeletingFrameSubtree(nsFrameManager*, nsTArray<nsIFrame*>&, nsIFrame*, nsIFrame*)’:
/mozilla/layout/base/nsCSSFrameConstructor.cpp:6976: warning: comparison between signed and unsigned integer expressions
The line it refers to is:
> 6976 NS_ASSERTION(aDestroyQueue.IndexOf(outOfFlowFrame) == kNotFound,
http://mxr.mozilla.org/mozilla-central/source/layout/base/nsCSSFrameConstructor.cpp#6976
This comparison is bad, because nsTArray::IndexOf returns unsigned, whereas kNotFound is -1.
kNotFound is the sentinel value for strings -- it's in nsAString.h.
nsTArray, on the other hand, should use "NoIndex" -- or better, its "Contains()" method.
Assignee | ||
Comment 1•16 years ago
|
||
Attachment #406779 -
Flags: review?(dbaron)
Assignee | ||
Comment 2•16 years ago
|
||
Looks like this bug was caused by bug 474369, which switched aDestroyQueue from being a nsVoidArray (whose IndexOf returns signed values) to nsTArray (whose IndexOf returns unsigned values).
Blocks: 474369
Comment on attachment 406779 [details] [diff] [review]
fix: use nsTArray::Contains
r=dbaron
Attachment #406779 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 4•16 years ago
|
||
I did a quick MXR for usages of IndexOf in layout, to see if I could catch any more instances of this bug.
I didn't find any, but I did find two instances of comparing "IndexOf(foo)" to SomethingComplicated::NoIndex, which can be replaced with a simple "Contains" call. This patch cleans those up, too.
Attachment #406779 -
Attachment is obsolete: true
Assignee | ||
Comment 5•16 years ago
|
||
Comment on attachment 406784 [details] [diff] [review]
fix: use nsTArray::Contains
dbaron -- thanks for the fast review on the first patch!
Could you take a quick glance over the two related changes in the new version?
Attachment #406784 -
Flags: review?(dbaron)
Comment on attachment 406784 [details] [diff] [review]
fix: use nsTArray::Contains
r=dbaron
Attachment #406784 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 7•16 years ago
|
||
pushed attachment 406784 [details] [diff] [review]: http://hg.mozilla.org/mozilla-central/rev/8f9e84a49399
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•16 years ago
|
Assignee: nobody → dholbert
Assignee | ||
Updated•15 years ago
|
Whiteboard: [build_warning]
You need to log in
before you can comment on or make changes to this bug.
Description
•