GfxDriverInfo.h:156: warning: comparison between signed and unsigned integer expressions

RESOLVED FIXED in mozilla20

Status

()

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks 1 bug)

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

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Just hit these build warnings while building B2G:
{
In file included from gecko/widget/xpwidgets/GfxDriverInfo.cpp:7:

gecko/widget/xpwidgets/GfxDriverInfo.h: In function 'bool mozilla::widget::SplitDriverVersion(const char*, char*, char*, char*, char*)':

gecko/widget/xpwidgets/GfxDriverInfo.h:156: warning: comparison between signed and unsigned integer expressions

gecko/widget/xpwidgets/GfxDriverInfo.h:179: warning: comparison between signed and unsigned integer expressions
}

This is for the variable "int destIdx", which is initialized to 0 and then incremented from there (and never modified in any other way).  Looks like it can just be an unsigned variable.
Posted patch fixSplinter Review
This fixes it.

Technically we only need destIdx to be unsigned to fix the warning -- but for consistency, I tweaked destPos, too, since it's used the same way (set to 0, incremented from there) and is declared right next to destIdx.

Here's the chunk of code in MXR, for reference:
https://mxr.mozilla.org/mozilla-central/source/widget/xpwidgets/GfxDriverInfo.h#152
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #693583 - Flags: review?(bas)
(I'm pretty sure "len" and "i" can also be unsigned, or perhaps size_t, because strlen returns size_t.  I'm happy to change those, too, but I left them as-is for now to keep the patch minimal, & since "len" and "i" aren't not causing problems.)
er s/aren't not/aren't/ :)
Attachment #693583 - Flags: review?(bas) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/84320dffec6e
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.