Ignore:
Timestamp:
Jan 23, 2007, 2:23:09 PM (18 years ago)
Author:
ggaren
Message:

Reviewed by Maciej Stachowiak.


Fixed <rdar://problem/4885131> Move CFString function declarations from
JSStringRef.h to JSStringRefCF.h


Also removed remaining API FIXMEs and changed them into Radars.

  • API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Added Radar numbers for UTF8 conversion.
  • API/JSContextRef.cpp: (JSGlobalContextCreate): Replaced FIXME for NULL JSContextRef with Radar number.
  • API/JSObjectRef.h: Removed FIXME, which is unprofessional in a public header.
  • API/JSStringRef.cpp: Moved CF related implementations to JSStringRefCF.cpp. (JSStringCreateWithUTF8CString): Replaced FIXME with Radar number.
  • API/JSStringRef.h: Moved CF related declarations to JSStringRefCF.h. Added #include of JSStringRefCF.h as a stopgap until clients start #including it as needed by themselves.
  • API/JSStringRefCF.cpp: Added. (JSStringCreateWithCFString): (JSStringCopyCFString): Replaced JSChar cast with UniChar cast, which is more appropriate for a CF call.
  • API/JSStringRefCF.h: Added.
  • JavaScriptCore.xcodeproj/project.pbxproj:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSStringRef.cpp

    r17372 r19059  
    4747{
    4848    JSLock lock;
    49     // FIXME: Only works with ASCII
    50     // Use decodeUTF8Sequence or http://www.unicode.org/Public/PROGRAMS/CVTUTF/ instead
     49    // FIXME: <rdar://problem/4949018>
    5150    return toRef(UString(string).rep()->ref());
    5251}
     
    112111    return result;
    113112}
    114 
    115 #if defined(__APPLE__)
    116 JSStringRef JSStringCreateWithCFString(CFStringRef string)
    117 {
    118     JSLock lock;
    119     CFIndex length = CFStringGetLength(string);
    120    
    121     // Optimized path for when CFString backing store is a UTF16 buffer
    122     if (const UniChar* buffer = CFStringGetCharactersPtr(string)) {
    123         UString::Rep* rep = UString(reinterpret_cast<const UChar*>(buffer), length).rep()->ref();
    124         return toRef(rep);
    125     }
    126 
    127     UniChar* buffer = static_cast<UniChar*>(fastMalloc(sizeof(UniChar) * length));
    128     CFStringGetCharacters(string, CFRangeMake(0, length), buffer);
    129     UString::Rep* rep = UString(reinterpret_cast<UChar*>(buffer), length, false).rep()->ref();
    130     return toRef(rep);
    131 }
    132 
    133 CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string)
    134 {
    135     UString::Rep* rep = toJS(string);
    136     return CFStringCreateWithCharacters(alloc, reinterpret_cast<const JSChar*>(rep->data()), rep->size());
    137 }
    138 
    139 #endif // __APPLE__
Note: See TracChangeset for help on using the changeset viewer.