Closed Bug 797666 Opened 8 years ago Closed 8 years ago

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

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

{
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.
Attached patch fixSplinter Review
Attachment #667784 - Flags: review?(bgirard)
Attachment #667784 - Flags: review?(bgirard) → review+
https://hg.mozilla.org/mozilla-central/rev/2b80eca0f4fb
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.