Last Comment Bug 658516 - nsHTMLEditRules.cpp:5810:52: warning: comparison between signed and unsigned integer expressions
: nsHTMLEditRules.cpp:5810:52: warning: comparison between signed and unsigned ...
Status: VERIFIED FIXED
[build_warning]
:
Product: Core
Classification: Components
Component: Editor (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla7
Assigned To: :Ehsan Akhgari
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-20 05:52 PDT by Daniel Holbert [:dholbert]
Modified: 2011-08-23 08:31 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (v1) (1.14 KB, patch)
2011-05-20 14:52 PDT, :Ehsan Akhgari
roc: review+
Details | Diff | Splinter Review

Description Daniel Holbert [:dholbert] 2011-05-20 05:52:49 PDT
Filing bug on this warning:
editor/libeditor/html/nsHTMLEditRules.cpp:5810:52: warning: comparison between signed and unsigned integer expressions

Flagged code is:
>   NS_ASSERTION(rangeCount == rangeItemArray.Length(), "How did that happen?");
where rangeCount is a signed int.

The contextual code already assumes it's non-negative[1], so it should be fine to just cast it to an unsigned value here.

[1] At this point in the code, we've just called  rangeItemArray.AppendElements(rangeCount), which would fail horribly if rangeCount were negative.
http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/html/nsHTMLEditRules.cpp#5806
Comment 1 :Ehsan Akhgari 2011-05-20 14:52:57 PDT
Created attachment 534119 [details] [diff] [review]
Patch (v1)
Comment 2 Robert O'Callahan (:roc) (email my personal email if necessary) 2011-05-21 05:13:33 PDT
Comment on attachment 534119 [details] [diff] [review]
Patch (v1)

Review of attachment 534119 [details] [diff] [review]:
-----------------------------------------------------------------
Comment 3 Dão Gottwald [:dao] 2011-05-25 01:27:01 PDT
http://hg.mozilla.org/mozilla-central/rev/3fa9d9b92de8
Comment 4 Trif Andrei-Alin[:AlinT] 2011-08-23 06:50:27 PDT
Is this issue fixed?
Thanks.
Comment 5 Daniel Holbert [:dholbert] 2011-08-23 08:31:16 PDT
Yes. (link to patched chunk of source: http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/html/nsHTMLEditRules.cpp?mark=5848-5849#5848 )

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