[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:34:02 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 2fc5cf73243b9818bd78a1edac9510118b307704
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 22 23:50:58 2002 +0000

            New faster char * append (actually insert) for mjs.
    
            * kwq/KWQString.mm:
            (QString::insert):
            * kwq/qt/qstring.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1903 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 210afde..43f5343 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,11 @@
+2002-08-22  Richard Williamson (Local)  <rjw at apple.com>
+
+        New faster char * append (actually insert) for mjs.
+        
+        * kwq/KWQString.mm:
+        (QString::insert):
+        * kwq/qt/qstring.h:
+
 2002-08-22  Darin Adler  <darin at apple.com>
 
 	Some small QString improvements.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 210afde..43f5343 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,11 @@
+2002-08-22  Richard Williamson (Local)  <rjw at apple.com>
+
+        New faster char * append (actually insert) for mjs.
+        
+        * kwq/KWQString.mm:
+        (QString::insert):
+        * kwq/qt/qstring.h:
+
 2002-08-22  Darin Adler  <darin at apple.com>
 
 	Some small QString improvements.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 210afde..43f5343 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,11 @@
+2002-08-22  Richard Williamson (Local)  <rjw at apple.com>
+
+        New faster char * append (actually insert) for mjs.
+        
+        * kwq/KWQString.mm:
+        (QString::insert):
+        * kwq/qt/qstring.h:
+
 2002-08-22  Darin Adler  <darin at apple.com>
 
 	Some small QString improvements.
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index bf84308..288aadc 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -441,6 +441,7 @@ public:
     QString &insert(uint, const QString &);
     QString &insert(uint, QChar);
     QString &insert(uint, char);
+    QString &insert(uint index, const char *insertChars, uint insertLength);
     QString &remove(uint, uint);
     QString &replace( uint index, uint len, const QString &s );
     //QString &replace( uint index, uint len, const QChar* s, uint slen );
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 4e247ec..cc030c9 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -2040,20 +2040,16 @@ QString &QString::append(const QString &qs)
     return insert(dataHandle[0]->_length, qs);
 }
 
-QString &QString::insert(uint index, const QString &qs)
+
+QString &QString::insert(uint index, const char *insertChars, uint insertLength)
 {
     detach();
     
-    if (qs.data()->_length == 0)
+    if (insertLength == 0)
         return *this;
         
-#ifdef QSTRING_DEBUG_UNICODE
-    forceUnicode();
-#endif
-    if (dataHandle[0]->_isAsciiValid && qs.data()->_isAsciiValid){
-        uint insertLength = qs.data()->_length;
+    if (dataHandle[0]->_isAsciiValid){
         uint originalLength = dataHandle[0]->_length;
-        char *insertChars = (char *)qs.ascii();
         char *targetChars;
         
         // Ensure that we have enough space.
@@ -2066,6 +2062,44 @@ QString &QString::insert(uint index, const QString &qs)
         // Insert characters.
         memcpy (targetChars+index, insertChars, insertLength);
     }
+    else if (dataHandle[0]->_isUnicodeValid){
+        uint originalLength = dataHandle[0]->_length;
+        QChar *targetChars;
+        
+        // Ensure that we have enough space.
+        setLength (originalLength + insertLength);
+        targetChars = (QChar *)unicode();
+        
+        // Move tail to make space for inserted characters.
+        memmove (targetChars+(index+insertLength), targetChars+index, (originalLength-index)*sizeof(QChar));
+
+        // Insert characters.
+        uint i = insertLength;
+        QChar *target = targetChars+index;
+        
+        while (i--)
+            *target++ = *insertChars++;        
+    }
+    else
+        QSTRING_FAILURE("invalid character cache");
+    
+    return *this;
+}
+
+
+QString &QString::insert(uint index, const QString &qs)
+{
+    detach();
+    
+    if (qs.data()->_length == 0)
+        return *this;
+        
+#ifdef QSTRING_DEBUG_UNICODE
+    forceUnicode();
+#endif
+    if (dataHandle[0]->_isAsciiValid && qs.data()->_isAsciiValid){
+        insert (index, qs.ascii(), qs.length());
+    }
     else {
         uint insertLength = qs.data()->_length;
         uint originalLength = dataHandle[0]->_length;
diff --git a/WebCore/kwq/qt/qstring.h b/WebCore/kwq/qt/qstring.h
index bf84308..288aadc 100644
--- a/WebCore/kwq/qt/qstring.h
+++ b/WebCore/kwq/qt/qstring.h
@@ -441,6 +441,7 @@ public:
     QString &insert(uint, const QString &);
     QString &insert(uint, QChar);
     QString &insert(uint, char);
+    QString &insert(uint index, const char *insertChars, uint insertLength);
     QString &remove(uint, uint);
     QString &replace( uint index, uint len, const QString &s );
     //QString &replace( uint index, uint len, const QChar* s, uint slen );

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list