[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

barraclough at apple.com barraclough at apple.com
Wed Dec 22 12:05:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 99428fc03fc14bfa8dc7091c974708d5899f0c92
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Aug 14 01:28:27 2010 +0000

    Switch String::/UString::ascii() to return a CString.
    
    Rubber stamped by Sam Weinig.
    
    JavaScriptCore:
    
    * JavaScriptCore.exp:
    * JavaScriptCore.xcodeproj/project.pbxproj:
    * bytecode/CodeBlock.cpp:
    (JSC::CodeBlock::dump):
    * bytecode/SamplingTool.cpp:
    (JSC::SamplingTool::dump):
    * interpreter/CallFrame.cpp:
    (JSC::CallFrame::dumpCaller):
    * jsc.cpp:
    (runWithScripts):
    (runInteractive):
    * runtime/Identifier.h:
    (JSC::Identifier::ascii):
    * runtime/ScopeChain.cpp:
    (JSC::ScopeChainNode::print):
    * runtime/UString.cpp:
    (JSC::UString::ascii):
    (JSC::UString::latin1):
    * runtime/UString.h:
    * wtf/text/StringImpl.cpp:
    (WTF::StringImpl::asciiOLD):
    * wtf/text/StringImpl.h:
    * wtf/text/WTFString.cpp:
    (WTF::String::ascii):
    (WTF::String::latin1):
    * wtf/text/WTFString.h:
    
    WebCore:
    
    * WebCore.xcodeproj/project.pbxproj:
    * bridge/c/c_class.cpp:
    (JSC::Bindings::CClass::methodsNamed):
    (JSC::Bindings::CClass::fieldNamed):
    * bridge/jni/jsc/JNIBridgeJSC.cpp:
    (JavaField::valueFromInstance):
    (JavaField::setValueToInstance):
    * bridge/jni/jsc/JavaInstanceJSC.cpp:
    (JavaInstance::invokeMethod):
    * bridge/objc/objc_class.mm:
    (JSC::Bindings::ObjcClass::methodsNamed):
    (JSC::Bindings::ObjcClass::fieldNamed):
    * bridge/objc/objc_instance.mm:
    (ObjcInstance::setValueOfUndefinedField):
    (ObjcInstance::getValueOfUndefinedField):
    * loader/icon/IconRecord.cpp:
    * platform/sql/SQLiteDatabase.cpp:
    * platform/sql/SQLiteStatement.cpp:
    * storage/SQLStatement.cpp:
    
    WebKit:
    
    * WebKit.xcodeproj/project.pbxproj:
    
    WebKit/mac:
    
    * Plugins/Hosted/ProxyInstance.mm:
    (WebKit::ProxyInstance::methodsNamed):
    (WebKit::ProxyInstance::fieldNamed):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65344 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 024e68c..a73ffe7 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-08-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Rubber stamped by Sam Weinig.
+        Switch String::/UString::ascii() to return a CString.
+
+        * JavaScriptCore.exp:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::dump):
+        * bytecode/SamplingTool.cpp:
+        (JSC::SamplingTool::dump):
+        * interpreter/CallFrame.cpp:
+        (JSC::CallFrame::dumpCaller):
+        * jsc.cpp:
+        (runWithScripts):
+        (runInteractive):
+        * runtime/Identifier.h:
+        (JSC::Identifier::ascii):
+        * runtime/ScopeChain.cpp:
+        (JSC::ScopeChainNode::print):
+        * runtime/UString.cpp:
+        (JSC::UString::ascii):
+        (JSC::UString::latin1):
+        * runtime/UString.h:
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::asciiOLD):
+        * wtf/text/StringImpl.h:
+        * wtf/text/WTFString.cpp:
+        (WTF::String::ascii):
+        (WTF::String::latin1):
+        * wtf/text/WTFString.h:
+
 2010-08-13  Gabor Loki  <loki at webkit.org>
 
         Reviewed by Gavin Barraclough.
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 712f8fb..d4ebae6 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -333,7 +333,6 @@ __ZN3WTF10StringImpl4findEPKcib
 __ZN3WTF10StringImpl4findEPS0_ib
 __ZN3WTF10StringImpl4findEti
 __ZN3WTF10StringImpl5adoptERNS_12StringBufferE
-__ZN3WTF10StringImpl5asciiEv
 __ZN3WTF10StringImpl5emptyEv
 __ZN3WTF10StringImpl5lowerEv
 __ZN3WTF10StringImpl5toIntEPb
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index 511a7a0..e59fc7a 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -2326,6 +2326,7 @@
 			isa = PBXProject;
 			buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
 			compatibilityVersion = "Xcode 2.4";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp
index 266e682..289ffed 100644
--- a/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -353,7 +353,7 @@ void CodeBlock::dump(ExecState* exec) const
         printf("\nIdentifiers:\n");
         size_t i = 0;
         do {
-            printf("  id%u = %s\n", static_cast<unsigned>(i), m_identifiers[i].ascii());
+            printf("  id%u = %s\n", static_cast<unsigned>(i), m_identifiers[i].ustring().utf8().data());
             ++i;
         } while (i != m_identifiers.size());
     }
@@ -363,7 +363,7 @@ void CodeBlock::dump(ExecState* exec) const
         unsigned registerIndex = m_numVars;
         size_t i = 0;
         do {
-            printf("   k%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).ascii());
+            printf("   k%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).utf8().data());
             ++i;
             ++registerIndex;
         } while (i < m_constantRegisters.size());
@@ -373,7 +373,7 @@ void CodeBlock::dump(ExecState* exec) const
         printf("\nm_regexps:\n");
         size_t i = 0;
         do {
-            printf("  re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_rareData->m_regexps[i].get()).ascii());
+            printf("  re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_rareData->m_regexps[i].get()).utf8().data());
             ++i;
         } while (i < m_rareData->m_regexps.size());
     }
@@ -454,7 +454,7 @@ void CodeBlock::dump(ExecState* exec) const
                     continue;
                 ASSERT(!((i + m_rareData->m_characterSwitchJumpTables[i].min) & ~0xFFFF));
                 UChar ch = static_cast<UChar>(entry + m_rareData->m_characterSwitchJumpTables[i].min);
-                printf("\t\t\"%s\" => %04d\n", UString(&ch, 1).ascii(), *iter);
+                printf("\t\t\"%s\" => %04d\n", UString(&ch, 1).utf8().data(), *iter);
         }
             printf("      }\n");
             ++i;
@@ -468,7 +468,7 @@ void CodeBlock::dump(ExecState* exec) const
             printf("  %1d = {\n", i);
             StringJumpTable::StringOffsetTable::const_iterator end = m_rareData->m_stringSwitchJumpTables[i].offsetTable.end();
             for (StringJumpTable::StringOffsetTable::const_iterator iter = m_rareData->m_stringSwitchJumpTables[i].offsetTable.begin(); iter != end; ++iter)
-                printf("\t\t\"%s\" => %04d\n", UString(iter->first).ascii(), iter->second.branchOffset);
+                printf("\t\t\"%s\" => %04d\n", UString(iter->first).utf8().data(), iter->second.branchOffset);
             printf("      }\n");
             ++i;
         } while (i < m_rareData->m_stringSwitchJumpTables.size());
@@ -714,7 +714,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
             int r0 = (++it)->u.operand;
             JSValue scope = JSValue((++it)->u.jsCell);
             int id0 = (++it)->u.operand;
-            printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).data());
+            printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).utf8().data(), idName(id0, m_identifiers[id0]).data());
             it += 2;
             break;
         }
@@ -723,7 +723,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
             JSValue scope = JSValue((++it)->u.jsCell);
             int id0 = (++it)->u.operand;
             int depth = it[2].u.operand;
-            printf("[%4d] resolve_global_dynamic\t %s, %s, %s, %d\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).data(), depth);
+            printf("[%4d] resolve_global_dynamic\t %s, %s, %s, %d\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).utf8().data(), idName(id0, m_identifiers[id0]).data(), depth);
             it += 3;
             break;
         }
@@ -745,14 +745,14 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
             int r0 = (++it)->u.operand;
             JSValue scope = JSValue((++it)->u.jsCell);
             int index = (++it)->u.operand;
-            printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).ascii(), index);
+            printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).utf8().data(), index);
             break;
         }
         case op_put_global_var: {
             JSValue scope = JSValue((++it)->u.jsCell);
             int index = (++it)->u.operand;
             int r0 = (++it)->u.operand;
-            printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).ascii(), index, registerName(exec, r0).data());
+            printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).utf8().data(), index, registerName(exec, r0).data());
             break;
         }
         case op_resolve_base: {
diff --git a/JavaScriptCore/bytecode/SamplingTool.cpp b/JavaScriptCore/bytecode/SamplingTool.cpp
index 7191e38..4614776 100644
--- a/JavaScriptCore/bytecode/SamplingTool.cpp
+++ b/JavaScriptCore/bytecode/SamplingTool.cpp
@@ -337,7 +337,7 @@ void SamplingTool::dump(ExecState* exec)
 
         if (blockPercent >= 1) {
             //Instruction* code = codeBlock->instructions().begin();
-            printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_executable->sourceURL().ascii(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent);
+            printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_executable->sourceURL().utf8().data(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent);
             if (i < 10) {
                 HashMap<unsigned,unsigned> lineCounts;
                 codeBlock->dump(exec);
diff --git a/JavaScriptCore/interpreter/CallFrame.cpp b/JavaScriptCore/interpreter/CallFrame.cpp
index ff061db..5819875 100644
--- a/JavaScriptCore/interpreter/CallFrame.cpp
+++ b/JavaScriptCore/interpreter/CallFrame.cpp
@@ -40,7 +40,7 @@ void CallFrame::dumpCaller()
     JSValue function;
     
     interpreter()->retrieveLastCaller(this, signedLineNumber, sourceID, urlString, function);
-    printf("Callpoint => %s:%d\n", urlString.ascii(), signedLineNumber);
+    printf("Callpoint => %s:%d\n", urlString.utf8().data(), signedLineNumber);
 }
 
 RegisterFile* CallFrame::registerFile()
diff --git a/JavaScriptCore/jsc.cpp b/JavaScriptCore/jsc.cpp
index 316f346..8b535a9 100644
--- a/JavaScriptCore/jsc.cpp
+++ b/JavaScriptCore/jsc.cpp
@@ -392,9 +392,9 @@ static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scr
         success = success && completion.complType() != Throw;
         if (dump) {
             if (completion.complType() == Throw)
-                printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).ascii());
+                printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
             else
-                printf("End: %s\n", completion.value().toString(globalObject->globalExec()).ascii());
+                printf("End: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
         }
 
         globalData->stopSampling();
@@ -440,7 +440,7 @@ static void runInteractive(GlobalObject* globalObject)
         Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(line.data(), interpreterName));
 #endif
         if (completion.complType() == Throw)
-            printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).ascii());
+            printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
         else
             printf("%s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
 
diff --git a/JavaScriptCore/runtime/Identifier.h b/JavaScriptCore/runtime/Identifier.h
index e24f1b4..5120697 100644
--- a/JavaScriptCore/runtime/Identifier.h
+++ b/JavaScriptCore/runtime/Identifier.h
@@ -50,7 +50,7 @@ namespace JSC {
         const UChar* characters() const { return m_string.characters(); }
         int length() const { return m_string.length(); }
         
-        const char* ascii() const { return m_string.ascii(); }
+        CString ascii() const { return m_string.ascii(); }
         
         static Identifier from(ExecState* exec, unsigned y);
         static Identifier from(ExecState* exec, int y);
diff --git a/JavaScriptCore/runtime/ScopeChain.cpp b/JavaScriptCore/runtime/ScopeChain.cpp
index 981794b..54c5082 100644
--- a/JavaScriptCore/runtime/ScopeChain.cpp
+++ b/JavaScriptCore/runtime/ScopeChain.cpp
@@ -43,7 +43,7 @@ void ScopeChainNode::print() const
         fprintf(stderr, "----- [scope %p] -----\n", o);
         for (PropertyNameArray::const_iterator propIter = propertyNames.begin(); propIter != propEnd; propIter++) {
             Identifier name = *propIter;
-            fprintf(stderr, "%s, ", name.ascii());
+            fprintf(stderr, "%s, ", name.ustring().utf8().data());
         }
         fprintf(stderr, "\n");
     }
diff --git a/JavaScriptCore/runtime/UString.cpp b/JavaScriptCore/runtime/UString.cpp
index a06fd04..86e1cbf 100644
--- a/JavaScriptCore/runtime/UString.cpp
+++ b/JavaScriptCore/runtime/UString.cpp
@@ -204,28 +204,6 @@ UString UString::number(double d)
     return UString(buffer, length);
 }
 
-char* UString::ascii() const
-{
-    static char* asciiBuffer = 0;
-
-    unsigned len = length();
-    unsigned neededSize = len + 1;
-    delete[] asciiBuffer;
-    asciiBuffer = new char[neededSize];
-
-    const UChar* p = characters();
-    char* q = asciiBuffer;
-    const UChar* limit = p + len;
-    while (p != limit) {
-        *q = static_cast<char>(p[0]);
-        ++p;
-        ++q;
-    }
-    *q = '\0';
-
-    return asciiBuffer;
-}
-
 static inline bool isInfinity(double number)
 {
     return number == Inf || number == -Inf;
@@ -583,6 +561,44 @@ bool operator>(const UString& s1, const UString& s2)
     return (l1 > l2);
 }
 
+CString UString::ascii() const
+{
+    // Basic Latin1 (ISO) encoding - Unicode characters 0..255 are
+    // preserved, characters outside of this range are converted to '?'.
+
+    unsigned length = this->length();
+    const UChar* characters = this->characters();
+
+    char* characterBuffer;
+    CString result = CString::newUninitialized(length, characterBuffer);
+
+    for (unsigned i = 0; i < length; ++i) {
+        UChar ch = characters[i];
+        characterBuffer[i] = ch && (ch < 0x20 || ch >= 0x7f) ? '?' : ch;
+    }
+
+    return result;
+}
+
+CString UString::latin1() const
+{
+    // Basic Latin1 (ISO) encoding - Unicode characters 0..255 are
+    // preserved, characters outside of this range are converted to '?'.
+
+    unsigned length = this->length();
+    const UChar* characters = this->characters();
+
+    char* characterBuffer;
+    CString result = CString::newUninitialized(length, characterBuffer);
+
+    for (unsigned i = 0; i < length; ++i) {
+        UChar ch = characters[i];
+        characterBuffer[i] = ch > 0xff ? '?' : ch;
+    }
+
+    return result;
+}
+
 // Helper to write a three-byte UTF-8 code point to the buffer, caller must check room is available.
 static inline void putUTF8Triple(char*& buffer, UChar ch)
 {
diff --git a/JavaScriptCore/runtime/UString.h b/JavaScriptCore/runtime/UString.h
index 8d1b5c2..6303baf 100644
--- a/JavaScriptCore/runtime/UString.h
+++ b/JavaScriptCore/runtime/UString.h
@@ -87,6 +87,8 @@ public:
         return m_impl->characters();
     }
 
+    CString ascii() const;
+    CString latin1() const;
     CString utf8(bool strict = false) const;
 
     UChar operator[](unsigned index) const
@@ -120,10 +122,6 @@ public:
 
     UString substr(unsigned pos = 0, unsigned len = 0xFFFFFFFF) const;
 
-    // NOTE: This method should only be used for *debugging* purposes as it
-    // is neither Unicode safe nor free from side effects nor thread-safe.
-    char* ascii() const;
-
 private:
     RefPtr<StringImpl> m_impl;
 };
diff --git a/JavaScriptCore/wtf/text/StringImpl.cpp b/JavaScriptCore/wtf/text/StringImpl.cpp
index 3669628..a7f69df 100644
--- a/JavaScriptCore/wtf/text/StringImpl.cpp
+++ b/JavaScriptCore/wtf/text/StringImpl.cpp
@@ -883,20 +883,6 @@ bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
     return false;
 }
 
-Vector<char> StringImpl::ascii()
-{
-    Vector<char> buffer(m_length + 1);
-    for (unsigned i = 0; i != m_length; ++i) {
-        UChar c = m_data[i];
-        if ((c >= 0x20 && c < 0x7F) || c == 0x00)
-            buffer[i] = static_cast<char>(c);
-        else
-            buffer[i] = '?';
-    }
-    buffer[m_length] = '\0';
-    return buffer;
-}
-
 WTF::Unicode::Direction StringImpl::defaultWritingDirection()
 {
     for (unsigned i = 0; i < m_length; ++i) {
diff --git a/JavaScriptCore/wtf/text/StringImpl.h b/JavaScriptCore/wtf/text/StringImpl.h
index 6080474..acf9d66 100644
--- a/JavaScriptCore/wtf/text/StringImpl.h
+++ b/JavaScriptCore/wtf/text/StringImpl.h
@@ -306,8 +306,6 @@ public:
     PassRefPtr<StringImpl> replace(StringImpl*, StringImpl*);
     PassRefPtr<StringImpl> replace(unsigned index, unsigned len, StringImpl*);
 
-    Vector<char> ascii();
-
     WTF::Unicode::Direction defaultWritingDirection();
 
 #if PLATFORM(CF)
diff --git a/JavaScriptCore/wtf/text/WTFString.cpp b/JavaScriptCore/wtf/text/WTFString.cpp
index 94b95c5..c632c4e 100644
--- a/JavaScriptCore/wtf/text/WTFString.cpp
+++ b/JavaScriptCore/wtf/text/WTFString.cpp
@@ -612,18 +612,23 @@ void String::split(UChar separator, Vector<String>& result) const
     return split(String(&separator, 1), false, result);
 }
 
-Vector<char> String::ascii() const
+CString String::ascii() const
 {
-    if (m_impl) 
-        return m_impl->ascii();
-    
-    const char* nullMsg = "(null impl)";
-    Vector<char, 2048> buffer;
-    for (int i = 0; nullMsg[i]; ++i)
-        buffer.append(nullMsg[i]);
-    
-    buffer.append('\0');
-    return buffer;
+    // Basic Latin1 (ISO) encoding - Unicode characters 0..255 are
+    // preserved, characters outside of this range are converted to '?'.
+
+    unsigned length = this->length();
+    const UChar* characters = this->characters();
+
+    char* characterBuffer;
+    CString result = CString::newUninitialized(length, characterBuffer);
+
+    for (unsigned i = 0; i < length; ++i) {
+        UChar ch = characters[i];
+        characterBuffer[i] = ch && (ch < 0x20 || ch > 0x7f) ? '?' : ch;
+    }
+
+    return result;
 }
 
 CString String::latin1() const
@@ -639,7 +644,7 @@ CString String::latin1() const
 
     for (unsigned i = 0; i < length; ++i) {
         UChar ch = characters[i];
-        characterBuffer[i] = ch > 255 ? '?' : ch;
+        characterBuffer[i] = ch > 0xff ? '?' : ch;
     }
 
     return result;
diff --git a/JavaScriptCore/wtf/text/WTFString.h b/JavaScriptCore/wtf/text/WTFString.h
index f79cc5d..288468e 100644
--- a/JavaScriptCore/wtf/text/WTFString.h
+++ b/JavaScriptCore/wtf/text/WTFString.h
@@ -125,6 +125,7 @@ public:
         return m_impl->characters();
     }
 
+    CString ascii() const;
     CString latin1() const;
     CString utf8(bool strict = false) const;
 
@@ -278,8 +279,6 @@ public:
     operator BString() const;
 #endif
 
-    Vector<char> ascii() const;
-
     static String fromUTF8(const char*, size_t);
     static String fromUTF8(const char*);
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b820ecf..91d8205 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-08-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Rubber stamped by Sam Weinig.
+        Switch String::/UString::ascii() to return a CString.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bridge/c/c_class.cpp:
+        (JSC::Bindings::CClass::methodsNamed):
+        (JSC::Bindings::CClass::fieldNamed):
+        * bridge/jni/jsc/JNIBridgeJSC.cpp:
+        (JavaField::valueFromInstance):
+        (JavaField::setValueToInstance):
+        * bridge/jni/jsc/JavaInstanceJSC.cpp:
+        (JavaInstance::invokeMethod):
+        * bridge/objc/objc_class.mm:
+        (JSC::Bindings::ObjcClass::methodsNamed):
+        (JSC::Bindings::ObjcClass::fieldNamed):
+        * bridge/objc/objc_instance.mm:
+        (ObjcInstance::setValueOfUndefinedField):
+        (ObjcInstance::getValueOfUndefinedField):
+        * loader/icon/IconRecord.cpp:
+        * platform/sql/SQLiteDatabase.cpp:
+        * platform/sql/SQLiteStatement.cpp:
+        * storage/SQLStatement.cpp:
+
 2010-08-13  Mihai Parparita  <mihaip at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index f12bcc2..dbb89fe 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -20222,6 +20222,7 @@
 			isa = PBXProject;
 			buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
 			compatibilityVersion = "Xcode 2.4";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,
diff --git a/WebCore/bridge/c/c_class.cpp b/WebCore/bridge/c/c_class.cpp
index 694b887..f4ae5ca 100644
--- a/WebCore/bridge/c/c_class.cpp
+++ b/WebCore/bridge/c/c_class.cpp
@@ -81,7 +81,7 @@ MethodList CClass::methodsNamed(const Identifier& identifier, Instance* instance
         return methodList;
     }
 
-    NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii());
+    NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii().data());
     const CInstance* inst = static_cast<const CInstance*>(instance);
     NPObject* obj = inst->getObject();
     if (_isa->hasMethod && _isa->hasMethod(obj, ident)){
@@ -102,7 +102,7 @@ Field* CClass::fieldNamed(const Identifier& identifier, Instance* instance) cons
     if (aField)
         return aField;
     
-    NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii());
+    NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii().data());
     const CInstance* inst = static_cast<const CInstance*>(instance);
     NPObject* obj = inst->getObject();
     if (_isa->hasProperty && _isa->hasProperty(obj, ident)){
diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
index 966d946..8a34ced 100644
--- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
+++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
@@ -150,7 +150,7 @@ JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const
         break;
     }
 
-    LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).utf8().data(), jsresult.toString(exec).ascii());
+    LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).utf8().data(), jsresult.toString(exec).ascii().data());
 
     return jsresult;
 }
@@ -186,7 +186,7 @@ void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue a
     const JavaInstance* instance = static_cast<const JavaInstance*>(i);
     jvalue javaValue = convertValueToJValue(exec, i->rootObject(), aValue, m_JNIType, type());
 
-    LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).utf8().data(), aValue.toString(exec).ascii());
+    LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).utf8().data(), aValue.toString(exec).ascii().data());
 
     switch (m_JNIType) {
     case array_type:
diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
index 699dd8e..7218688 100644
--- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
+++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
@@ -169,7 +169,7 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod
     for (i = 0; i < count; i++) {
         JavaParameter* aParameter = jMethod->parameterAt(i);
         jArgs[i] = convertValueToJValue(exec, m_rootObject.get(), exec->argument(i), aParameter->getJNIType(), aParameter->type());
-        LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, exec->argument(i).toString(exec).ascii());
+        LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, exec->argument(i).toString(exec).ascii().data());
     }
 
     jvalue result;
diff --git a/WebCore/bridge/objc/objc_class.mm b/WebCore/bridge/objc/objc_class.mm
index 62f0a34..2d29499 100644
--- a/WebCore/bridge/objc/objc_class.mm
+++ b/WebCore/bridge/objc/objc_class.mm
@@ -78,11 +78,11 @@ MethodList ObjcClass::methodsNamed(const Identifier& identifier, Instance*) cons
     MethodList methodList;
     char fixedSizeBuffer[1024];
     char* buffer = fixedSizeBuffer;
-    const char* JSName = identifier.ascii();
-    if (!convertJSMethodNameToObjc(JSName, buffer, sizeof(fixedSizeBuffer))) {
-        int length = strlen(JSName) + 1;
+    CString jsName = identifier.ascii();
+    if (!convertJSMethodNameToObjc(jsName.data(), buffer, sizeof(fixedSizeBuffer))) {
+        int length = jsName.length() + 1;
         buffer = new char[length];
-        if (!buffer || !convertJSMethodNameToObjc(JSName, buffer, length))
+        if (!buffer || !convertJSMethodNameToObjc(jsName.data(), buffer, length))
             return methodList;
     }
 
@@ -153,8 +153,8 @@ Field* ObjcClass::fieldNamed(const Identifier& identifier, Instance* instance) c
 {
     ClassStructPtr thisClass = _isa;
 
-    const char* name = identifier.ascii();
-    RetainPtr<CFStringRef> fieldName(AdoptCF, CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII));
+    CString jsName = identifier.ascii();
+    RetainPtr<CFStringRef> fieldName(AdoptCF, CFStringCreateWithCString(NULL, jsName.data(), kCFStringEncodingASCII));
     Field* aField = (Field*)CFDictionaryGetValue(_fields.get(), fieldName.get());
     if (aField)
         return aField;
@@ -220,7 +220,7 @@ Field* ObjcClass::fieldNamed(const Identifier& identifier, Instance* instance) c
                     if ([thisClass respondsToSelector:@selector(webScriptNameForKey:)])
                         mappedName = [thisClass webScriptNameForKey:objcIvarName];
 
-                    if ((mappedName && [mappedName isEqual:(NSString*)fieldName.get()]) || strcmp(objcIvarName, name) == 0) {
+                    if ((mappedName && [mappedName isEqual:(NSString*)fieldName.get()]) || strcmp(objcIvarName, jsName.data()) == 0) {
                         aField = new ObjcField(objcIVar); // deleted when the dictionary is destroyed
                         CFDictionaryAddValue(_fields.get(), fieldName.get(), aField);
                         break;
diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm
index 2b518b1..6c56458 100644
--- a/WebCore/bridge/objc/objc_instance.mm
+++ b/WebCore/bridge/objc/objc_instance.mm
@@ -391,7 +391,7 @@ bool ObjcInstance::setValueOfUndefinedField(ExecState* exec, const Identifier& p
         ObjcValue objcValue = convertValueToObjcValue(exec, aValue, ObjcObjectType);
 
         @try {
-            [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString:property.ascii() encoding:NSASCIIStringEncoding]];
+            [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString:property.ascii().data() encoding:NSASCIIStringEncoding]];
         } @catch(NSException* localException) {
             // Do nothing.  Class did not override valueForUndefinedKey:.
         }
@@ -417,7 +417,7 @@ JSValue ObjcInstance::getValueOfUndefinedField(ExecState* exec, const Identifier
         setGlobalException(nil);
     
         @try {
-            id objcValue = [targetObject valueForUndefinedKey:[NSString stringWithCString:property.ascii() encoding:NSASCIIStringEncoding]];
+            id objcValue = [targetObject valueForUndefinedKey:[NSString stringWithCString:property.ascii().data() encoding:NSASCIIStringEncoding]];
             result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, m_rootObject.get());
         } @catch(NSException* localException) {
             // Do nothing.  Class did not override valueForUndefinedKey:.
diff --git a/WebCore/loader/icon/IconRecord.cpp b/WebCore/loader/icon/IconRecord.cpp
index ffea318..7e90d8e 100644
--- a/WebCore/loader/icon/IconRecord.cpp
+++ b/WebCore/loader/icon/IconRecord.cpp
@@ -34,6 +34,7 @@
 #include "Logging.h"
 #include "SQLiteStatement.h"
 #include "SQLiteTransaction.h"
+#include <wtf/text/CString.h>
 
 #include <limits.h>
 
diff --git a/WebCore/platform/sql/SQLiteDatabase.cpp b/WebCore/platform/sql/SQLiteDatabase.cpp
index 05a2a22..084f6b1 100644
--- a/WebCore/platform/sql/SQLiteDatabase.cpp
+++ b/WebCore/platform/sql/SQLiteDatabase.cpp
@@ -33,6 +33,7 @@
 #include "SQLiteStatement.h"
 #include <sqlite3.h>
 #include <wtf/Threading.h>
+#include <wtf/text/CString.h>
 
 namespace WebCore {
 
diff --git a/WebCore/platform/sql/SQLiteStatement.cpp b/WebCore/platform/sql/SQLiteStatement.cpp
index ac467a6..4dc80fb 100644
--- a/WebCore/platform/sql/SQLiteStatement.cpp
+++ b/WebCore/platform/sql/SQLiteStatement.cpp
@@ -30,6 +30,7 @@
 #include "SQLValue.h"
 #include <sqlite3.h>
 #include <wtf/Assertions.h>
+#include <wtf/text/CString.h>
 
 namespace WebCore {
 
diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp
index 3973157..19e9e38 100644
--- a/WebCore/storage/SQLStatement.cpp
+++ b/WebCore/storage/SQLStatement.cpp
@@ -39,6 +39,7 @@
 #include "SQLStatementErrorCallback.h"
 #include "SQLTransaction.h"
 #include "SQLValue.h"
+#include <wtf/text/CString.h>
 
 namespace WebCore {
 
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 92976db..91f2e5a 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-13  Gavin Barraclough  <barraclough at apple.com>
+
+        Rubber stamped by Sam Weinig.
+        Switch String::/UString::ascii() to return a CString.
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2010-08-06  Gavin Barraclough  <barraclough at apple.com>
 
         Rubber stamped by Sam Weinig
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index 52d5b6c..bad03b6 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -1616,6 +1616,7 @@
 			isa = PBXProject;
 			buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
 			compatibilityVersion = "Xcode 2.4";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 2d36a37..7b6f5c5 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,5 +1,14 @@
 2010-08-13  Gavin Barraclough  <barraclough at apple.com>
 
+        Rubber stamped by Sam Weinig.
+        Switch String::/UString::ascii() to return a CString.
+
+        * Plugins/Hosted/ProxyInstance.mm:
+        (WebKit::ProxyInstance::methodsNamed):
+        (WebKit::ProxyInstance::fieldNamed):
+
+2010-08-13  Gavin Barraclough  <barraclough at apple.com>
+
         Reviewed by Sam Weinig
 
         Unify UString::UTF8String() & String::utf8() methods,
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index fe95120..306d2e5 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -337,7 +337,7 @@ MethodList ProxyInstance::methodsNamed(const Identifier& identifier)
         return methodList;
     }
     
-    uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ascii()));
+    uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ascii().data()));
     uint32_t requestID = m_instanceProxy->nextRequestID();
     
     if (_WKPHNPObjectHasMethod(m_instanceProxy->hostProxy()->port(),
@@ -373,7 +373,7 @@ Field* ProxyInstance::fieldNamed(const Identifier& identifier)
     if (existingMapEntry != m_fields.end())
         return existingMapEntry->second;
     
-    uint64_t propertyName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ascii()));
+    uint64_t propertyName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(identifier.ascii().data()));
     uint32_t requestID = m_instanceProxy->nextRequestID();
     
     if (_WKPHNPObjectHasProperty(m_instanceProxy->hostProxy()->port(),

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list