Changeset 9042 in webkit for trunk/JavaScriptCore/kjs/ustring.cpp


Ignore:
Timestamp:
Apr 22, 2005, 2:53:58 PM (20 years ago)
Author:
darin
Message:

Reviewed by Maciej.

  • kjs/ustring.cpp: (KJS::UString::UTF8String): Fix off-by-one error in surrogate pair logic.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r9033 r9042  
    13281328      *p++ = (char)((c >> 6) | 0xC0); // C0 is the 2-byte flag for UTF-8
    13291329      *p++ = (char)((c | 0x80) & 0xBF); // next 6 bits, with high bit set
    1330     } else if (c >= 0xD800 && c <= 0xDBFF && i < length && d[i+1].uc >= 0xDC00 && d[i+2].uc <= 0xDFFF) {
     1330    } else if (c >= 0xD800 && c <= 0xDBFF && i < length && d[i+1].uc >= 0xDC00 && d[i+1].uc <= 0xDFFF) {
    13311331      unsigned sc = 0x10000 + (((c & 0x3FF) << 10) | (d[i+1].uc & 0x3FF));
    13321332      *p++ = (char)((sc >> 18) | 0xF0); // F0 is the 4-byte flag for UTF-8
Note: See TracChangeset for help on using the changeset viewer.