Closed Bug 658516 Opened 10 years ago Closed 10 years ago

nsHTMLEditRules.cpp:5810:52: warning: comparison between signed and unsigned integer expressions

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla7

People

(Reporter: dholbert, Assigned: ehsan.akhgari)

Details

(Whiteboard: [build_warning])

Attachments

(1 file)

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
Attached patch Patch (v1)Splinter Review
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Attachment #534119 - Flags: review?(roc)
Comment on attachment 534119 [details] [diff] [review]
Patch (v1)

Review of attachment 534119 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #534119 - Flags: review?(roc) → review+
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/3fa9d9b92de8
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Is this issue fixed?
Thanks.
Yes. (link to patched chunk of source: http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/html/nsHTMLEditRules.cpp?mark=5848-5849#5848 )
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.