Changeset 172152 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Aug 6, 2014, 10:27:41 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r172129 r172152 662 662 static inline String stringFromUTF(const char* utf8) 663 663 { 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)); 678 665 } 679 666
Note:
See TracChangeset
for help on using the changeset viewer.