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

Patch v1 (620 bytes, patch)
2011-02-27 10:54 PST, :Ms2ger (⌚ UTC+1/+2)
no flags Details | Diff | Splinter 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 | Splinter Review

Description User image :Ms2ger (⌚ UTC+1/+2) 2011-02-27 10:54:39 PST
Created attachment 515491 [details] [diff] [review]
Patch v1
Comment 1 User image 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 User image 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 User image 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


> 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 User image :Ms2ger (⌚ UTC+1/+2) 2011-08-20 13:48:17 PDT
Comment on attachment 515491 [details] [diff] [review]
Patch v1

Thanks for taking this over!
Comment 5 User image Jonathan Kew (:jfkthame) 2011-08-23 05:37:34 PDT
Comment 6 User image Mounir Lamouri (:mounir) 2011-08-23 08:57:08 PDT

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