<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>27952</bug_id>
          
          <creation_ts>2009-08-03 13:53:38 -0700</creation_ts>
          <short_desc>cssgrammar.cpp fails to compile with RVCT compiler</short_desc>
          <delta_ts>2009-08-07 01:02:25 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>27065</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Laszlo Gombos">laszlo.gombos</reporter>
          <assigned_to name="Laszlo Gombos">laszlo.gombos</assigned_to>
          <cc>abarth</cc>
    
    <cc>darin</cc>
    
    <cc>hausmann</cc>
    
    <cc>norbert.leser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>136770</commentid>
    <comment_count>0</comment_count>
    <who name="Laszlo Gombos">laszlo.gombos</who>
    <bug_when>2009-08-03 13:53:38 -0700</bug_when>
    <thetext>The error message is the following:

armcc [...] cssgrammar.cpp

&quot;css\CSSGrammar.y&quot;, line 743: Error:  #171: invalid type conversion
          if (equalIgnoringCase(static_cast&lt;const String&amp;&gt;(str), &quot;from&quot;))
                                ^
&quot;css\CSSGrammar.y&quot;, line 745: Error:  #171: invalid type conversion
          else if (equalIgnoringCase(static_cast&lt;const String&amp;&gt;(str), &quot;to&quot;))
                                     ^
cssgrammar.cpp: 0 warnings, 2 errors

Few notes:
 - cssgrammar.cpp is a generated file from CSSGrammar.y.
 - CSSParserString (the type for str above) offers a cast operator to String but RVCT does not seems to be able to understand it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>136883</commentid>
    <comment_count>1</comment_count>
      <attachid>34033</attachid>
    <who name="Laszlo Gombos">laszlo.gombos</who>
    <bug_when>2009-08-03 18:56:53 -0700</bug_when>
    <thetext>Created attachment 34033
proposed patch.

Invoke the cast to String operator by hand.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>137006</commentid>
    <comment_count>2</comment_count>
      <attachid>34033</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-08-04 08:56:31 -0700</bug_when>
    <thetext>Comment on attachment 34033
proposed patch.

This is going to copy the string.  that&apos;s an extra malloc during parsing, and likely a slowdown. :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>137047</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-08-04 10:24:42 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 34033 [details])
&gt; This is going to copy the string.  that&apos;s an extra malloc during parsing, and
&gt; likely a slowdown. :(

The old code already copies the string. This is bad. The best fix that fixes both compiling and improves performance is to create a charactersEqualIgnoringCase function that works with a character pointer and length. This would be like the other &quot;characters&quot; functions in PlatformString.h.

We could also overload equalIgnoringCase for CSSParserString; that would just be a convenience that would make it slightly easier to read.

Code to do this is already present in StringImpl.cpp; it should be relatively straightforward to refactor it.

In the mean time I actually see nothing wrong with Laszlo&apos;s initial patch, except that there is a stray space after &quot;selector&quot;. But I&apos;d love it if we could get rid of the stray memory allocation here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>137532</commentid>
    <comment_count>4</comment_count>
      <attachid>34201</attachid>
    <who name="Laszlo Gombos">laszlo.gombos</who>
    <bug_when>2009-08-05 23:38:10 -0700</bug_when>
    <thetext>Created attachment 34201
second try.

Darin, thanks for the detailed recommendation. As you suggested I get rid of the stray allocation by working directly with characters.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>137575</commentid>
    <comment_count>5</comment_count>
      <attachid>34201</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-08-06 08:16:07 -0700</bug_when>
    <thetext>Comment on attachment 34201
second try.

I think this change is OK.

I&apos;d prefer that function declarations that don&apos;t need argument names don&apos;t have them. And the one for equalIgnoringCase uses &quot;a&quot; and &quot;b&quot; even though those don&apos;t add any information.

I&apos;d prefer it if all the string-like functions that operate on runs of characters were grouped together. At this point, the others are in PlatformString.h, but these new ones are in StringImpl.h.

I&apos;d prefer it if the functions that work with characters were as consistent as possible. The ones in PlatformString.h use size_t for length, but this one uses unsigned. The ones in PlatformString.h use &quot;characters&quot; as a prefix on the function name, but this one uses overloading instead. The ones in PlatformString.h put the UChar* and length first, and other arguments afterward, but these new ones do not.

Finally, I think tis function should be more clear on how it handles the const char*. If that&apos;s intended to be a null-terminated C string, then we need to check for the null character, because otherwise if the UChar contains a 0 in just the right place we could walk off the end of the passed in const char*. Alternatively, if we want to pass in the length then I think we&apos;d need a second length argument for the const char*. I don&apos;t think the function definition makes it clear how it&apos;s intended to be used.

But I don&apos;t think any of these concerns should prevent you from landing this. I just think they would be things to improve in the future.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>137582</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Hausmann">hausmann</who>
    <bug_when>2009-08-06 08:59:32 -0700</bug_when>
    <thetext>Fix landed in r46846

/me agrees with Darins comments</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>137819</commentid>
    <comment_count>7</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2009-08-07 01:02:25 -0700</bug_when>
    <thetext>This patch claims to have been landed.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>34033</attachid>
            <date>2009-08-03 18:56:53 -0700</date>
            <delta_ts>2009-08-05 23:38:10 -0700</delta_ts>
            <desc>proposed patch.</desc>
            <filename>pending_patch_27952.txt</filename>
            <type>text/plain</type>
            <size>1307</size>
            <attacher name="Laszlo Gombos">laszlo.gombos</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0Njc0MikKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTIgQEAKKzIwMDktMDgtMDMgIExhc3psbyBHb21ib3MgIDxsYXN6bG8uMS5nb21i
b3NAbm9raWEuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisg
ICAgICAgIGNzc2dyYW1tYXIuY3BwIGZhaWxzIHRvIGNvbXBpbGUgd2l0aCBSVkNUIGNvbXBpbGVy
CisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0yNzk1Mgor
CisgICAgICAgICogY3NzL0NTU0dyYW1tYXIueTogSW52b2tlIHRoZSBjYXN0IHRvIFN0cmluZyBv
cGVyYXRvciBieSBoYW5kCisKIDIwMDktMDgtMDMgIEplcmVteSBPcmxvdyAgPGpvcmxvd0BjaHJv
bWl1bS5vcmc+CiAKICAgICAgICAgUmV2aWV3ZWQgYnkgRGFyaW4gRmlzaGVyLgpJbmRleDogV2Vi
Q29yZS9jc3MvQ1NTR3JhbW1hci55Cj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvY3NzL0NTU0dyYW1t
YXIueQkocmV2aXNpb24gNDY3MjYpCisrKyBXZWJDb3JlL2Nzcy9DU1NHcmFtbWFyLnkJKHdvcmtp
bmcgY29weSkKQEAgLTc0MCw5ICs3NDAsMTAgQEAga2V5OgogICAgIHwgSURFTlQgewogICAgICAg
ICAkJC5pZCA9IDA7ICQkLmlzSW50ID0gZmFsc2U7ICQkLnVuaXQgPSBDU1NQcmltaXRpdmVWYWx1
ZTo6Q1NTX05VTUJFUjsKICAgICAgICAgQ1NTUGFyc2VyU3RyaW5nJiBzdHIgPSAkMTsKLSAgICAg
ICAgaWYgKGVxdWFsSWdub3JpbmdDYXNlKHN0YXRpY19jYXN0PGNvbnN0IFN0cmluZyY+KHN0ciks
ICJmcm9tIikpCisgICAgICAgIFN0cmluZyBzZWxlY3RvciAoc3RyLmNoYXJhY3RlcnMsIHN0ci5s
ZW5ndGgpOworICAgICAgICBpZiAoZXF1YWxJZ25vcmluZ0Nhc2Uoc2VsZWN0b3IsICJmcm9tIikp
CiAgICAgICAgICAgICAkJC5mVmFsdWUgPSAwOwotICAgICAgICBlbHNlIGlmIChlcXVhbElnbm9y
aW5nQ2FzZShzdGF0aWNfY2FzdDxjb25zdCBTdHJpbmcmPihzdHIpLCAidG8iKSkKKyAgICAgICAg
ZWxzZSBpZiAoZXF1YWxJZ25vcmluZ0Nhc2Uoc2VsZWN0b3IsICJ0byIpKQogICAgICAgICAgICAg
JCQuZlZhbHVlID0gMTAwOwogICAgICAgICBlbHNlCiAgICAgICAgICAgICBZWUVSUk9SOwo=
</data>
<flag name="review"
          id="18196"
          type_id="1"
          status="-"
          setter="eric"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>34201</attachid>
            <date>2009-08-05 23:38:10 -0700</date>
            <delta_ts>2009-08-06 08:16:07 -0700</delta_ts>
            <desc>second try.</desc>
            <filename>patch_27952_2.txt</filename>
            <type>text/plain</type>
            <size>2874</size>
            <attacher name="Laszlo Gombos">laszlo.gombos</attacher>
            
              <data encoding="base64">SW5kZXg6I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gICAgICBVbnJldmlld2VkLCBidWlsZCBmaXgu
CkluZGV4OiBXZWJDb3JlL2Nzcy9DU1NHcmFtbWFyLnkKPT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gV2ViQ29yZS9j
c3MvQ1NTR3JhbW1hci55CShyZXZpc2lvbiA0NjcyNikKKysrIFdlYkNvcmUvY3NzL0NTU0dyYW1t
YXIueQkod29ya2luZyBjb3B5KQpAQCAtNzQwLDkgKzc0MCw5IEBAIGtleToKICAgICB8IElERU5U
IHsKICAgICAgICAgJCQuaWQgPSAwOyAkJC5pc0ludCA9IGZhbHNlOyAkJC51bml0ID0gQ1NTUHJp
bWl0aXZlVmFsdWU6OkNTU19OVU1CRVI7CiAgICAgICAgIENTU1BhcnNlclN0cmluZyYgc3RyID0g
JDE7Ci0gICAgICAgIGlmIChlcXVhbElnbm9yaW5nQ2FzZShzdGF0aWNfY2FzdDxjb25zdCBTdHJp
bmcmPihzdHIpLCAiZnJvbSIpKQorICAgICAgICBpZiAoZXF1YWxJZ25vcmluZ0Nhc2UoImZyb20i
LCBzdHIuY2hhcmFjdGVycywgc3RyLmxlbmd0aCkpCiAgICAgICAgICAgICAkJC5mVmFsdWUgPSAw
OwotICAgICAgICBlbHNlIGlmIChlcXVhbElnbm9yaW5nQ2FzZShzdGF0aWNfY2FzdDxjb25zdCBT
dHJpbmcmPihzdHIpLCAidG8iKSkKKyAgICAgICAgZWxzZSBpZiAoZXF1YWxJZ25vcmluZ0Nhc2Uo
InRvIiwgc3RyLmNoYXJhY3RlcnMsIHN0ci5sZW5ndGgpKQogICAgICAgICAgICAgJCQuZlZhbHVl
ID0gMTAwOwogICAgICAgICBlbHNlCiAgICAgICAgICAgICBZWUVSUk9SOwpJbmRleDogV2ViQ29y
ZS9wbGF0Zm9ybS90ZXh0L1N0cmluZ0ltcGwuY3BwCj09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09P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XIqKTsKIGlubGluZSBib29sIGVxdWFsSWdub3JpbmdDYXNlKGNv
bnN0IGNoYXIqIGEsIFN0cmluZ0ltcGwqIGIpIHsgcmV0dXJuIGVxdWFsSWdub3JpbmdDYXNlKGIs
IGEpOyB9Citib29sIGVxdWFsSWdub3JpbmdDYXNlKGNvbnN0IFVDaGFyKiBhLCBjb25zdCBjaGFy
KiBiLCB1bnNpZ25lZCBsZW5ndGgpOworaW5saW5lIGJvb2wgZXF1YWxJZ25vcmluZ0Nhc2UoY29u
c3QgY2hhciogYSwgY29uc3QgVUNoYXIqIGIsIHVuc2lnbmVkIGxlbmd0aCkgeyByZXR1cm4gZXF1
YWxJZ25vcmluZ0Nhc2UoYiwgYSwgbGVuZ3RoKTsgfQogCiAvLyBHb2xkZW4gcmF0aW8gLSBhcmJp
dHJhcnkgc3RhcnQgdmFsdWUgdG8gYXZvaWQgbWFwcGluZyBhbGwgMCdzIHRvIGFsbCAwJ3MKIC8v
IG9yIGFueXRoaW5nIGxpa2UgdGhhdC4K
</data>
<flag name="review"
          id="18360"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>