Closed Bug 551775 Opened 10 years ago Closed 10 years ago

"warning: comparison between signed and unsigned integer expressions" in NS_ColorNameToRGB

Categories

(Core :: Graphics, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla1.9.3a3

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(1 file)

Just noticed in compiler-spew:
> gfx/src/nsColor.cpp: In function 'PRBool NS_ColorNameToRGB(const nsAString_internal&, nscolor*)':
> gfx/src/nsColor.cpp:210: warning: comparison between signed and unsigned integer expressions

Code snippet:

208   PRInt32 id = gColorTable->Lookup(aColorName);
209   if (eColorName_UNKNOWN < id) {
210     NS_ASSERTION(id < eColorName_COUNT, "LookupName mess up");

I think the warning was introduced by bug 422637 (which made |id| a PRInt32 instead of an enum).

We just need a PRUint32 cast on |id| inside the assertion. (We know it's a non-negative value, since the line before checks that we're greater than eColorName_UNKNOWN, which is -1)
Attached patch fixSplinter Review
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #431956 - Flags: review?(roc)
Landed: http://hg.mozilla.org/mozilla-central/rev/8fc409b1e7b3
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
OS: Linux → All
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a3
You need to log in before you can comment on or make changes to this bug.