Changeset 172152 in webkit


Ignore:
Timestamp:
Aug 6, 2014 10:27:41 AM (10 years ago)
Author:
Dániel Bátyai
Message:

[ARM] Incorrect handling of Unicode characters
https://bugs.webkit.org/show_bug.cgi?id=135380

Reviewed by Darin Adler.

Removed erroneous fast case from stringFromUTF(), since it assumed that
char is always implemented as signed.

  • jsc.cpp:

(stringFromUTF):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r172149 r172152  
     12014-08-06  Dániel Bátyai  <dbatyai.u-szeged@partner.samsung.com>
     2
     3        [ARM] Incorrect handling of Unicode characters
     4        https://bugs.webkit.org/show_bug.cgi?id=135380
     5
     6        Reviewed by Darin Adler.
     7
     8        Removed erroneous fast case from stringFromUTF(), since it assumed that
     9        char is always implemented as signed.
     10
     11        * jsc.cpp:
     12        (stringFromUTF):
     13
    1142014-08-06  Dániel Bátyai  <dbatyai.u-szeged@partner.samsung.com>
    215
  • trunk/Source/JavaScriptCore/jsc.cpp

    r172129 r172152  
    662662static inline String stringFromUTF(const char* utf8)
    663663{
    664     // Find the the first non-ascii character, or nul.
    665     const char* pos = utf8;
    666     while (*pos > 0)
    667         pos++;
    668     size_t asciiLength = pos - utf8;
    669    
    670     // Fast case - string is all ascii.
    671     if (!*pos)
    672         return String(utf8, asciiLength);
    673    
    674     // Slow case - contains non-ascii characters, use fromUTF8WithLatin1Fallback.
    675     ASSERT(*pos < 0);
    676     ASSERT(strlen(utf8) == asciiLength + strlen(pos));
    677     return String::fromUTF8WithLatin1Fallback(utf8, asciiLength + strlen(pos));
     664    return String::fromUTF8WithLatin1Fallback(utf8, strlen(utf8));
    678665}
    679666
Note: See TracChangeset for help on using the changeset viewer.