The default bug view has changed. See this FAQ.

nsPlainTextSerializer.cpp:414:30: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

RESOLVED FIXED in mozilla14

Status

()

Core
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks: 1 bug)

Trunk
mozilla14
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
GCC 4.6.3 build warning:

nsPlainTextSerializer.cpp:414:30: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

from this chunk:
> 412   if (id == nsGkAtoms::head) {
> 413     --mHeadLevel;
> 414     NS_ASSERTION(mHeadLevel >= 0, "mHeadLevel < 0");

where mHeadLevel is a PRUint32 (and was when that assertion was added, in bug 418727)

Looks like the purpose here is to be sure we don't decrement a value that is at zero. We should probably be asserting that our value is nonzero before we decrement it.
(Assignee)

Comment 1

5 years ago
MXR link to this chunk in the source:
http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsPlainTextSerializer.cpp?mark=414-415#412
(Assignee)

Comment 2

5 years ago
Created attachment 614056 [details] [diff] [review]
fix: assert before we decrement
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
(Assignee)

Updated

5 years ago
Attachment #614056 - Flags: review?(bugs)

Updated

5 years ago
Attachment #614056 - Flags: review?(bugs) → review+
(Assignee)

Comment 3

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/165ec2dea412
Target Milestone: --- → mozilla14
https://hg.mozilla.org/mozilla-central/rev/165ec2dea412
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.