Build warning: TiledLayerBuffer.h:368:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

RESOLVED FIXED in mozilla18

Status

()

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks 1 bug)

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

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Assignee

Description

7 years ago
{
Warning: -Wsign-compare in /mozilla/gfx/layers/TiledLayerBuffer.h: comparison between signed and unsigned integer expressions
/mozilla/gfx/layers/TiledLayerBuffer.h:368:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
}

for this line:
> NS_ABORT_IF_FALSE(index >= 0 && index < newRetainedTiles.Length(), "index out of range"); 

I think we want to just cast index to unsigned before we compare it to .Length().  (We know it's safe to do that cast, because we've just checked that it's >= 0.)

Note that jdm posted a patch that includes a different fix for this over in bug 755031, but I don't think the strategy is right (making index unsigned), because index is set from a number of other signed variables.  Also, that other bug seems to have gone silent, and this warning is bugging me, so I'm filing a one-off for just this particular warning.
Assignee

Comment 1

7 years ago
Posted patch fixSplinter Review
Attachment #667784 - Flags: review?(bgirard)
Attachment #667784 - Flags: review?(bgirard) → review+
Assignee

Comment 2

7 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/2b80eca0f4fb
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/2b80eca0f4fb
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.