Bug 82793 - Add a compile assert for the size of BidiContext
Summary: Add a compile assert for the size of BidiContext
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-30 15:42 PDT by Ryosuke Niwa
Modified: 2012-03-30 21:43 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.28 KB, patch)
2012-03-30 15:47 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch (3.07 KB, patch)
2012-03-30 16:11 PDT, Ryosuke Niwa
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2012-03-30 15:42:59 PDT
Add a compile assert for the size of BidiContext
Comment 1 Ryosuke Niwa 2012-03-30 15:47:22 PDT
Created attachment 134903 [details]
Patch
Comment 2 Ryosuke Niwa 2012-03-30 15:48:13 PDT
Unfortunately, very few people can review changes to this file :(
Comment 3 Eric Seidel (no email) 2012-03-30 15:55:26 PDT
Comment on attachment 134903 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=134903&action=review

> Source/WebCore/platform/text/BidiContext.h:62
> -    unsigned char m_level;
> +    unsigned m_level : 6;

You should add a comment which explains that we only need to handle 64 bidi-levels.  Do we have tests for overflow of this value?
Comment 4 Ryosuke Niwa 2012-03-30 15:56:30 PDT
(In reply to comment #3)
> (From update of attachment 134903 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=134903&action=review
> 
> > Source/WebCore/platform/text/BidiContext.h:62
> > -    unsigned char m_level;
> > +    unsigned m_level : 6;
> 
> You should add a comment which explains that we only need to handle 64 bidi-levels.  Do we have tests for overflow of this value?

Maybe we should define numBidiLevelBits?
Comment 5 Ryosuke Niwa 2012-03-30 16:11:34 PDT
Created attachment 134910 [details]
Patch
Comment 6 Eric Seidel (no email) 2012-03-30 16:17:44 PDT
Comment on attachment 134910 [details]
Patch

OK.  LGTM.
Comment 7 Ryosuke Niwa 2012-03-30 16:27:56 PDT
Committed r112742: <http://trac.webkit.org/changeset/112742>
Comment 8 Darin Adler 2012-03-30 18:25:18 PDT
Comment on attachment 134910 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=134910&action=review

> Source/WebCore/platform/text/BidiContext.cpp:31
> +    uint32_t bitfields : 16;

Tiny style question. Why use uint32_t here instead of unsigned?
Comment 9 Ryosuke Niwa 2012-03-30 21:43:49 PDT
(In reply to comment #8)
> (From update of attachment 134910 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=134910&action=review
> 
> > Source/WebCore/platform/text/BidiContext.cpp:31
> > +    uint32_t bitfields : 16;
> 
> Tiny style question. Why use uint32_t here instead of unsigned?

I was just following the pattern used elsewhere. We can change all of them to use unsigned instead.