Last Comment Bug 637179 - Signed-unsigned comparison in CharacterIterator::ClusterLength
: Signed-unsigned comparison in CharacterIterator::ClusterLength
Status: RESOLVED FIXED
[build_warning]
:
Product: Core
Classification: Components
Component: SVG (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla9
Assigned To: Jonathan Kew (:jfkthame)
:
Mentors:
Depends on:
Blocks: buildwarning 621918
  Show dependency treegraph
 
Reported: 2011-02-27 10:54 PST by :Ms2ger
Modified: 2011-08-23 08:57 PDT (History)
2 users (show)
Ms2ger: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (620 bytes, patch)
2011-02-27 10:54 PST, :Ms2ger
no flags Details | Diff | Review
alternative patch - use PRUint32 for character/cluster indexes (9.49 KB, patch)
2011-08-20 08:51 PDT, Jonathan Kew (:jfkthame)
jwatt: review+
Details | Diff | Review

Description :Ms2ger 2011-02-27 10:54:39 PST
Created attachment 515491 [details] [diff] [review]
Patch v1
Comment 1 Jonathan Kew (:jfkthame) 2011-03-02 11:54:35 PST
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.
Comment 2 Jonathan Kew (:jfkthame) 2011-08-20 08:51:58 PDT
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.
Comment 3 Jonathan Watt [:jwatt] 2011-08-20 11:31:17 PDT
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.
Comment 4 :Ms2ger 2011-08-20 13:48:17 PDT
Comment on attachment 515491 [details] [diff] [review]
Patch v1

Thanks for taking this over!
Comment 5 Jonathan Kew (:jfkthame) 2011-08-23 05:37:34 PDT
http://hg.mozilla.org/integration/mozilla-inbound/rev/aa9f34f40b16
Comment 6 Mounir Lamouri (:mounir) 2011-08-23 08:57:08 PDT
http://hg.mozilla.org/mozilla-central/rev/aa9f34f40b16

Note You need to log in before you can comment on or make changes to this bug.