Signed-unsigned comparison in CharacterIterator::ClusterLength

RESOLVED FIXED in mozilla9

Status

()

Core
SVG
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Ms2ger, Assigned: jfkthame)

Tracking

(Blocks: 1 bug)

Trunk
mozilla9
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [build_warning])

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
Created attachment 515491 [details] [diff] [review]
Patch v1
Attachment #515491 - Flags: review?(jfkthame)
Flags: in-testsuite-
(Assignee)

Comment 1

6 years ago
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.
(Reporter)

Updated

6 years ago
Whiteboard: [build_warning][needs review] → [build_warning][needs patch]

Updated

6 years ago
Blocks: 187528
(Assignee)

Comment 2

6 years ago
Created attachment 554639 [details] [diff] [review]
alternative patch - use PRUint32 for character/cluster indexes

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+
(Reporter)

Comment 4

6 years ago
Comment on attachment 515491 [details] [diff] [review]
Patch v1

Thanks for taking this over!
Attachment #515491 - Flags: review?(jfkthame)
(Reporter)

Updated

6 years ago
Assignee: Ms2ger → jfkthame
Whiteboard: [build_warning][needs patch] → [build_warning]
(Assignee)

Comment 5

6 years ago
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
Last Resolved: 6 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.