Changeset 27406 in webkit for trunk/JavaScriptCore/kjs/ustring.cpp
- Timestamp:
- Nov 3, 2007, 9:40:32 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ustring.cpp
r27201 r27406 1348 1348 if (c >= 0xD800 && c <= 0xDFFF) 1349 1349 return -1; 1350 // Backwards BOM and U+FFFF should never appear in UTF-8 data.1351 if (c == 0xFFFE || c == 0xFFFF)1352 return -1;1353 1350 return c; 1354 1351 } … … 1370 1367 } 1371 1368 1372 CString UString::UTF8String() const 1373 { 1369 CString UString::UTF8String(bool* utf16WasGood) const 1370 { 1371 if (utf16WasGood) 1372 *utf16WasGood = true; 1373 1374 1374 // Allocate a buffer big enough to hold all the characters. 1375 1375 const int length = size(); … … 1394 1394 ++i; 1395 1395 } else { 1396 if (utf16WasGood && c >= 0xD800 && c <= 0xDFFF) 1397 *utf16WasGood = false; 1396 1398 *p++ = (char)((c >> 12) | 0xE0); // E0 is the 3-byte flag for UTF-8 1397 1399 *p++ = (char)(((c >> 6) | 0x80) & 0xBF); // next 6 bits, with high bit set … … 1406 1408 } 1407 1409 1410 CString UString::UTF8String() const 1411 { 1412 return UTF8String(0); 1413 } 1414 1415 1408 1416 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.