RESOLVED FIXED 65807
Should not use C-style cast in CSSParser.cpp
https://bugs.webkit.org/show_bug.cgi?id=65807
Summary Should not use C-style cast in CSSParser.cpp
Kenichi Ishibashi
Reported 2011-08-05 19:41:13 PDT
I submitted r92528, which adds a C-style cast to fix build failure. However, I should have used C++-style cast.
Attachments
Patch (2.87 KB, patch)
2011-08-05 19:44 PDT, Kenichi Ishibashi
no flags
Patch V1 (2.54 KB, patch)
2011-08-07 23:28 PDT, Kenichi Ishibashi
no flags
Patch V2 (2.59 KB, patch)
2011-08-07 23:48 PDT, Kenichi Ishibashi
no flags
Patch V3 (2.42 KB, patch)
2011-08-07 23:56 PDT, Kenichi Ishibashi
no flags
Kenichi Ishibashi
Comment 1 2011-08-05 19:44:39 PDT
Kenichi Ishibashi
Comment 2 2011-08-05 19:47:51 PDT
(Cc'ed Mark just in a case) Hamaji-san, this is a trivial patch. Could you take a look when you have time? Thanks,
Shinichiro Hamaji
Comment 3 2011-08-05 23:20:52 PDT
Comment on attachment 103140 [details] Patch OK
WebKit Review Bot
Comment 4 2011-08-06 03:02:52 PDT
Comment on attachment 103140 [details] Patch Clearing flags on attachment: 103140 Committed r92549: <http://trac.webkit.org/changeset/92549>
WebKit Review Bot
Comment 5 2011-08-06 03:02:57 PDT
All reviewed patches have been landed. Closing bug.
Alexey Proskuryakov
Comment 6 2011-08-06 18:42:21 PDT
Comment on attachment 103140 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103140&action=review > Source/WebCore/css/CSSParser.cpp:3287 > + numSteps = static_cast<int>(min(v->fValue, (double)INT_MAX)); (double) is still a C-style cast.
Kent Tamura
Comment 7 2011-08-07 17:40:22 PDT
Comment on attachment 103140 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103140&action=review > Source/WebCore/css/CSSParser.cpp:3287 > - numSteps = (int) min(v->fValue, (double)INT_MAX); > + numSteps = static_cast<int>(min(v->fValue, (double)INT_MAX)); You might want to use clampToInteger() in wtf/MathExtras.h.
Kenichi Ishibashi
Comment 8 2011-08-07 23:22:54 PDT
(In reply to comment #7) > (From update of attachment 103140 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=103140&action=review > > > Source/WebCore/css/CSSParser.cpp:3287 > > - numSteps = (int) min(v->fValue, (double)INT_MAX); > > + numSteps = static_cast<int>(min(v->fValue, (double)INT_MAX)); > > You might want to use clampToInteger() in wtf/MathExtras.h. Thank you for pointing this out. Reopening this bug and will fix it with clampToInteger().
Kenichi Ishibashi
Comment 9 2011-08-07 23:28:08 PDT
Created attachment 103204 [details] Patch V1
Kent Tamura
Comment 10 2011-08-07 23:35:36 PDT
Comment on attachment 103204 [details] Patch V1 View in context: https://bugs.webkit.org/attachment.cgi?id=103204&action=review > Source/WebCore/css/CSSParser.cpp:6336 > - tagValue = static_cast<int>(value->fValue); > - if (tagValue < 0) > - return false; > + tagValue = clampToInteger(value->fValue); Do you mean clampToPositiveInteger()?
Kent Tamura
Comment 11 2011-08-07 23:37:01 PDT
Comment on attachment 103204 [details] Patch V1 View in context: https://bugs.webkit.org/attachment.cgi?id=103204&action=review >> Source/WebCore/css/CSSParser.cpp:6336 >> + tagValue = clampToInteger(value->fValue); > > Do you mean clampToPositiveInteger()? Is it ok not to return false in a case of negative value?
Kenichi Ishibashi
Comment 12 2011-08-07 23:48:31 PDT
Created attachment 103207 [details] Patch V2
Kenichi Ishibashi
Comment 13 2011-08-07 23:56:32 PDT
Created attachment 103209 [details] Patch V3
Kenichi Ishibashi
Comment 14 2011-08-07 23:58:05 PDT
(In reply to comment #11) > (From update of attachment 103204 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=103204&action=review > > >> Source/WebCore/css/CSSParser.cpp:6336 > >> + tagValue = clampToInteger(value->fValue); > > > > Do you mean clampToPositiveInteger()? > > Is it ok not to return false in a case of negative value? Should return false in a case of negative value. Revised the patch. Thanks!
Kent Tamura
Comment 15 2011-08-08 00:05:22 PDT
Comment on attachment 103209 [details] Patch V3 ok
WebKit Review Bot
Comment 16 2011-08-08 01:42:31 PDT
Comment on attachment 103209 [details] Patch V3 Clearing flags on attachment: 103209 Committed r92588: <http://trac.webkit.org/changeset/92588>
WebKit Review Bot
Comment 17 2011-08-08 01:42:37 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.