Ignore:
Timestamp:
Jul 10, 2006, 10:37:00 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Darin.


  • Changed public header includes to the <JavaScriptCore/ style.
  • Changed instances of 'buffer' to 'string' since we decided on JSInternalString instead of JSStringBuffer.
  • API/JSContextRef.h:
  • API/JSInternalStringRef.cpp: (JSStringMake): (JSInternalStringRetain): (JSInternalStringRelease): (JSValueCopyStringValue): (JSInternalStringGetLength): (JSInternalStringGetCharactersPtr): (JSInternalStringGetCharacters): (JSInternalStringGetMaxLengthUTF8): (JSInternalStringGetCharactersUTF8): (CFStringCreateWithJSInternalString):
  • API/JSInternalStringRef.h:
  • API/JSNode.c: (JSNodePrototype_appendChild): (JSNode_getNodeType):
  • API/JSObjectRef.cpp: (JSObjectCallAsConstructor):
  • API/JSValueRef.h:
  • API/JavaScriptCore.h:
  • API/minidom.c: (main): (print):
  • API/testapi.c: (MyObject_getPropertyList): (myConstructor_callAsConstructor): (main): I noticed that we were prematurely releasing some string buffers, so I moved their release calls to the end of main(). I got rid of 'Buf' in *Buf (sometimes changing to 'IString', when necessary to differentiate a variable) to match the buffer->string change.
File:
1 edited

Legend:

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

    r15307 r15328  
    3737using namespace KJS;
    3838
    39 JSValueRef JSStringMake(JSInternalStringRef buffer)
     39JSValueRef JSStringMake(JSInternalStringRef string)
    4040{
    4141    JSLock lock;
    42     UString::Rep* rep = toJS(buffer);
     42    UString::Rep* rep = toJS(string);
    4343    return toRef(jsString(UString(rep)));
    4444}
     
    5858}
    5959
    60 JSInternalStringRef JSInternalStringRetain(JSInternalStringRef buffer)
     60JSInternalStringRef JSInternalStringRetain(JSInternalStringRef string)
    6161{
    62     UString::Rep* rep = toJS(buffer);
     62    UString::Rep* rep = toJS(string);
    6363    return toRef(rep->ref());
    6464}
    6565
    66 void JSInternalStringRelease(JSInternalStringRef buffer)
     66void JSInternalStringRelease(JSInternalStringRef string)
    6767{
    6868    JSLock lock;
    69     UString::Rep* rep = toJS(buffer);
     69    UString::Rep* rep = toJS(string);
    7070    rep->deref();
    7171}
     
    7777    ExecState* exec = toJS(context);
    7878
    79     JSInternalStringRef charBufferRef = toRef(jsValue->toString(exec).rep()->ref());
     79    JSInternalStringRef stringRef = toRef(jsValue->toString(exec).rep()->ref());
    8080    if (exec->hadException())
    8181        exec->clearException();
    82     return charBufferRef;
     82    return stringRef;
    8383}
    8484
    85 size_t JSInternalStringGetLength(JSInternalStringRef buffer)
     85size_t JSInternalStringGetLength(JSInternalStringRef string)
    8686{
    87     UString::Rep* rep = toJS(buffer);
     87    UString::Rep* rep = toJS(string);
    8888    return rep->size();
    8989}
    9090
    91 const JSChar* JSInternalStringGetCharactersPtr(JSInternalStringRef buffer)
     91const JSChar* JSInternalStringGetCharactersPtr(JSInternalStringRef string)
    9292{
    93     UString::Rep* rep = toJS(buffer);
     93    UString::Rep* rep = toJS(string);
    9494    return reinterpret_cast<const JSChar*>(rep->data());
    9595}
    9696
    97 void JSInternalStringGetCharacters(JSInternalStringRef inBuffer, JSChar* outBuffer, size_t numChars)
     97void JSInternalStringGetCharacters(JSInternalStringRef string, JSChar* buffer, size_t numChars)
    9898{
    99     UString::Rep* rep = toJS(inBuffer);
     99    UString::Rep* rep = toJS(string);
    100100    const JSChar* data = reinterpret_cast<const JSChar*>(rep->data());
    101101   
    102     memcpy(outBuffer, data, numChars * sizeof(JSChar));
     102    memcpy(buffer, data, numChars * sizeof(JSChar));
    103103}
    104104
    105 size_t JSInternalStringGetMaxLengthUTF8(JSInternalStringRef buffer)
     105size_t JSInternalStringGetMaxLengthUTF8(JSInternalStringRef string)
    106106{
    107     UString::Rep* rep = toJS(buffer);
     107    UString::Rep* rep = toJS(string);
    108108   
    109109    // Any UTF8 character > 3 bytes encodes as a UTF16 surrogate pair.
     
    111111}
    112112
    113 size_t JSInternalStringGetCharactersUTF8(JSInternalStringRef inBuffer, char* outBuffer, size_t bufferSize)
     113size_t JSInternalStringGetCharactersUTF8(JSInternalStringRef string, char* buffer, size_t bufferSize)
    114114{
    115115    JSLock lock;
    116     UString::Rep* rep = toJS(inBuffer);
     116    UString::Rep* rep = toJS(string);
    117117    CString cString = UString(rep).UTF8String();
    118118
    119119    size_t length = std::min(bufferSize, cString.size() + 1); // + 1 for terminating '\0'
    120     memcpy(outBuffer, cString.c_str(), length);
     120    memcpy(buffer, cString.c_str(), length);
    121121    return length;
    122122}
     
    157157}
    158158
    159 CFStringRef CFStringCreateWithJSInternalString(CFAllocatorRef alloc, JSInternalStringRef buffer)
     159CFStringRef CFStringCreateWithJSInternalString(CFAllocatorRef alloc, JSInternalStringRef string)
    160160{
    161     UString::Rep* rep = toJS(buffer);
     161    UString::Rep* rep = toJS(string);
    162162    return CFStringCreateWithCharacters(alloc, reinterpret_cast<const JSChar*>(rep->data()), rep->size());
    163163}
Note: See TracChangeset for help on using the changeset viewer.