Closed Bug 822804 Opened 8 years ago Closed 8 years ago

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

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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.
Attached 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: 8 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.