Closed Bug 924749 Opened 6 years ago Closed 6 years ago

Signed/unsigned comparison build warnings PathCairo.cpp

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Three build warnings in PathCairo.cpp:
{
gfx/2d/PathCairo.cpp:273:31 [-Wsign-compare] comparison between signed and unsigned integer expressions
gfx/2d/PathCairo.cpp:277:27 [-Wsign-compare] comparison between signed and unsigned integer expressions
gfx/2d/PathCairo.cpp:287:40 [-Wsign-compare] comparison between signed and unsigned integer expressions
}
Attached patch fix v1Splinter Review
The first and third loop variables are compared against vector::size(), which returns vector<foo>::size_type;  the second loop var is compared against 'uint32_t pointCount', so I made that one a uint32_t.  So I changed the loop vars' types to match.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #814718 - Flags: review?(jmuizelaar)
oops; forgot to qref. That first patch used size_t instead of the more-pedantically-correct std::vector<cairo_path_data_t>::size_type (which this version uses)

(I'm happy with either; feel free to reject this and r+ the other patch if you'd prefer the concise version)
Attachment #814718 - Attachment is obsolete: true
Attachment #814718 - Flags: review?(jmuizelaar)
Attachment #814719 - Flags: review?(jmuizelaar)
Comment on attachment 814719 [details] [diff] [review]
fix v2 (using std::vector<cairo_path_data_t>::size_type) [Nope, this is too ugly]

Actually, looks like Jeff's on vacation. Bas, could you review?

(If you're put off by the vector<...>::size_type cruft, see other patch for a prettier size_t version)
Attachment #814719 - Flags: review?(jmuizelaar) → review?(bas)
Comment on attachment 814718 [details] [diff] [review]
fix v1

Review of attachment 814718 [details] [diff] [review]:
-----------------------------------------------------------------

I sadly have to admit I prefer this even though it's strictly a tiny bit less correct :).
Attachment #814718 - Flags: review+
Attachment #814718 - Attachment is obsolete: false
Thanks!

(I prefer size_t, too; and IIRC, it's guaranteed to be equivalent as long as we're not instantiating vector<> with a custom allocator)
Attachment #814719 - Attachment description: fix v2 (using std::vector<cairo_path_data_t>::size_type) → fix v2 (using std::vector<cairo_path_data_t>::size_type) [Nope, this is too ugly]
Attachment #814719 - Flags: review?(bas)
https://hg.mozilla.org/mozilla-central/rev/b4c3caf8f741
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.