Closed Bug 744464 Opened 8 years ago Closed 8 years ago

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

Categories

(Core :: General, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #614056 - Flags: review?(bugs)
Attachment #614056 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/165ec2dea412
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.