Closed Bug 637179 Opened 9 years ago Closed 8 years ago

Signed-unsigned comparison in CharacterIterator::ClusterLength

Categories

(Core :: SVG, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: Ms2ger, Assigned: jfkthame)

References

(Blocks 1 open bug)

Details

(Whiteboard: [build_warning])

Attachments

(2 files)

Attached patch Patch v1Splinter Review
No description provided.
Attachment #515491 - Flags: review?(jfkthame)
Flags: in-testsuite-
Comment on attachment 515491 [details] [diff] [review]
Patch v1

Rather than just cast away the warning, what I think we should really do here is rewrite the CharacterIterator in such a way that it uses PRUint32 for offsets, rather than PRInt32, so that it can handle the maximum possible length of a textRun. That will need some care, though, as the code currently relies on initializing the offset to -1 before the iterator has been advanced to the first cluster.
Whiteboard: [build_warning][needs review] → [build_warning][needs patch]
Rather than just suppressing the warning with a typecast, this revises the CharacterIterator to use unsigned indexes, which seems a cleaner approach to me.
Attachment #554639 - Flags: review?(jwatt)
Comment on attachment 554639 [details] [diff] [review]
alternative patch - use PRUint32 for character/cluster indexes

r=jwatt

> CharacterIterator::CharacterIterator(nsSVGGlyphFrame *aSource,
>         PRBool aForceGlobalTransform)
>-  : mSource(aSource), mCurrentAdvance(0), mCurrentChar(-1),
>+  : mSource(aSource), mCurrentAdvance(0),
>+    mCurrentChar(PRUint32(-1)),
>     mInError(PR_FALSE)
> {

I think most of the SVG code has now standardized on putting the commas under the colon, and having each member initializer on a separate line. You don't need to do that, but if you don't mind doing it, that would be cool.
Attachment #554639 - Flags: review?(jwatt) → review+
Comment on attachment 515491 [details] [diff] [review]
Patch v1

Thanks for taking this over!
Attachment #515491 - Flags: review?(jfkthame)
Assignee: Ms2ger → jfkthame
Whiteboard: [build_warning][needs patch] → [build_warning]
http://hg.mozilla.org/integration/mozilla-inbound/rev/aa9f34f40b16
Whiteboard: [build_warning] → [build_warning] [inbound]
http://hg.mozilla.org/mozilla-central/rev/aa9f34f40b16
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
OS: Linux → All
Hardware: x86 → All
Resolution: --- → FIXED
Whiteboard: [build_warning] [inbound] → [build_warning]
Target Milestone: --- → mozilla9
You need to log in before you can comment on or make changes to this bug.