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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:54:30 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 2eac354069749c53a880e2eee66a369cd17e8e1e
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 22 07:51:55 2002 +0000

    Top level:
    	Turn off some borrowed classes, improve test coverage, and improve
    	build stability.
    
    	* borrowed-classes.txt: Turn off borrowed QArray, QBuffer,
    	QStringList and QStack.
    
    	# Add many new test cases for these classes, passed by both the old
    	and the new versions:
    
    	* Tests/qt/qarray-test.chk:
    	* Tests/qt/qarray-test.cpp: (main):
    	* Tests/qt/qbuffer-test.chk:
    	* Tests/qt/qbuffer-test.cpp: (main):
    	* Tests/qt/qstack-test.chk:
    	* Tests/qt/qstack-test.cpp: (main):
    	* Tests/qt/qstringlist-test.chk:
    	* Tests/qt/qstringlist-test.cpp: (main):
    	* Tests/test.list:
    	* Tests/qt/Makefile.am:
    
    	# Change how we define the USING defines a bit to make it more
    	generic. Also, be more paranoid abot the dreaded '$ln' problem.
    
    	* acconfig.h:
    	* autogen.sh:
    	* configure.in:
    
    WebCore:
    	Reimplemented QArray, QBuffer, QStack and QStringList; also fixed
    	some files for borrowed switchability, and fixed some bugs found
    	by my new test cases.
    
    	# Reimplement QArray:
    
    	* src/kwq/qt/qarray.h:
    	* src/kwq/KWQArrayImpl.h:
    	* src/kwq/KWQArrayImpl.mm: (KWQArrayImpl::KWQArrayPrivate::KWQArrayPrivate),
    	(KWQArrayImpl::KWQArrayPrivate::~KWQArrayPrivate), (KWQArrayImpl::KWQArrayImpl),
    	(KWQArrayImpl::~KWQArrayImpl), (KWQArrayImpl::operator=), (KWQArrayImpl::at),
    	(KWQArrayImpl::data), (KWQArrayImpl::size), (KWQArrayImpl::resize),
    	(KWQArrayImpl::duplicate), (KWQArrayImpl::fill), (KWQArrayImpl::operator==):
    
    	# Reimplement QBuffer:
    
    	* src/kwq/qt/qbuffer.h:
    	* src/kwq/KWQBuffer.mm: (QBuffer::QBuffer), (QBuffer::~QBuffer),
    	(QBuffer::buffer), (QBuffer::size), (QBuffer::isOpen), (QBuffer::open),
    	(QBuffer::close), (QBuffer::writeBlock):
    	* src/kwq/qt/qiodevice.h:
    
    	# Reimplement QStringList:
    
    	* src/kwq/KWQStringList.mm: (QStringToCFString), (QStringList::split),
    	(QStringList::QStringList), (QStringList::~QStringList), (QStringList::join),
    	(QStringList::operator=):
    
    	# Reimplement QStack:
    	* src/kwq/qt/qstack.h:
    
    	* src/kwq/Makefile.am: Add new files to build.
    
    	* src/kwq/KWQString.mm: (QString::find): Fix bug which returned
    	the very first occurence in the string even when the optional
    	starting point was passed in. Some of my new regression tests
    	picked this up.
    
    	# Temporarily work around uses of non-kwq APIs:
    
    	* src/kwq/WKPluginWidget.h:
    	* src/kwq/qt/_qfile.cpp
    	* src/kwq/qt/_qbuffer.cpp
    
    	# Guard contents of all these with the appropriate USING ifdef:
    
    	* src/kwq/KWQStrList.h:
    	* src/kwq/qt/_qarray.h:
    	* src/kwq/qt/_qgarray.h:
    	* src/kwq/qt/_qstrlist.h:
    
    WebFoundation:
    	* .cvsignore: Ignore generated files.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@553 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 51abc6b..d1d14a4 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,56 @@
+2002-01-21  Maciej Stachowiak  <mjs at apple.com>
+
+	Reimplemented QArray, QBuffer, QStack and QStringList; also fixed
+	some files for borrowed switchability, and fixed some bugs found
+	by my new test cases.
+
+	# Reimplement QArray:
+
+	* src/kwq/qt/qarray.h:
+	* src/kwq/KWQArrayImpl.h:
+	* src/kwq/KWQArrayImpl.mm: (KWQArrayImpl::KWQArrayPrivate::KWQArrayPrivate),
+	(KWQArrayImpl::KWQArrayPrivate::~KWQArrayPrivate), (KWQArrayImpl::KWQArrayImpl),
+	(KWQArrayImpl::~KWQArrayImpl), (KWQArrayImpl::operator=), (KWQArrayImpl::at),
+	(KWQArrayImpl::data), (KWQArrayImpl::size), (KWQArrayImpl::resize),
+	(KWQArrayImpl::duplicate), (KWQArrayImpl::fill), (KWQArrayImpl::operator==):
+
+	# Reimplement QBuffer:
+
+	* src/kwq/qt/qbuffer.h:
+	* src/kwq/KWQBuffer.mm: (QBuffer::QBuffer), (QBuffer::~QBuffer),
+	(QBuffer::buffer), (QBuffer::size), (QBuffer::isOpen), (QBuffer::open),
+	(QBuffer::close), (QBuffer::writeBlock):
+	* src/kwq/qt/qiodevice.h:
+
+	# Reimplement QStringList:
+
+	* src/kwq/KWQStringList.mm: (QStringToCFString), (QStringList::split),
+	(QStringList::QStringList), (QStringList::~QStringList), (QStringList::join),
+	(QStringList::operator=):
+
+	# Reimplement QStack:
+	* src/kwq/qt/qstack.h:
+
+	* src/kwq/Makefile.am: Add new files to build.
+
+	* src/kwq/KWQString.mm: (QString::find): Fix bug which returned
+	the very first occurence in the string even when the optional
+	starting point was passed in. Some of my new regression tests
+	picked this up.
+
+	# Temporarily work around uses of non-kwq APIs:
+	
+	* src/kwq/WKPluginWidget.h:
+	* src/kwq/qt/_qfile.cpp
+	* src/kwq/qt/_qbuffer.cpp
+	
+	# Guard contents of all these with the appropriate USING ifdef:
+	
+	* src/kwq/KWQStrList.h:
+	* src/kwq/qt/_qarray.h:
+	* src/kwq/qt/_qgarray.h:
+	* src/kwq/qt/_qstrlist.h:
+	
 2002-01-19  Maciej Stachowiak  <mjs at apple.com>
 
 	* src/kdelibs/kjs/Makefile.am: Fix testkjs build.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 51abc6b..d1d14a4 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,56 @@
+2002-01-21  Maciej Stachowiak  <mjs at apple.com>
+
+	Reimplemented QArray, QBuffer, QStack and QStringList; also fixed
+	some files for borrowed switchability, and fixed some bugs found
+	by my new test cases.
+
+	# Reimplement QArray:
+
+	* src/kwq/qt/qarray.h:
+	* src/kwq/KWQArrayImpl.h:
+	* src/kwq/KWQArrayImpl.mm: (KWQArrayImpl::KWQArrayPrivate::KWQArrayPrivate),
+	(KWQArrayImpl::KWQArrayPrivate::~KWQArrayPrivate), (KWQArrayImpl::KWQArrayImpl),
+	(KWQArrayImpl::~KWQArrayImpl), (KWQArrayImpl::operator=), (KWQArrayImpl::at),
+	(KWQArrayImpl::data), (KWQArrayImpl::size), (KWQArrayImpl::resize),
+	(KWQArrayImpl::duplicate), (KWQArrayImpl::fill), (KWQArrayImpl::operator==):
+
+	# Reimplement QBuffer:
+
+	* src/kwq/qt/qbuffer.h:
+	* src/kwq/KWQBuffer.mm: (QBuffer::QBuffer), (QBuffer::~QBuffer),
+	(QBuffer::buffer), (QBuffer::size), (QBuffer::isOpen), (QBuffer::open),
+	(QBuffer::close), (QBuffer::writeBlock):
+	* src/kwq/qt/qiodevice.h:
+
+	# Reimplement QStringList:
+
+	* src/kwq/KWQStringList.mm: (QStringToCFString), (QStringList::split),
+	(QStringList::QStringList), (QStringList::~QStringList), (QStringList::join),
+	(QStringList::operator=):
+
+	# Reimplement QStack:
+	* src/kwq/qt/qstack.h:
+
+	* src/kwq/Makefile.am: Add new files to build.
+
+	* src/kwq/KWQString.mm: (QString::find): Fix bug which returned
+	the very first occurence in the string even when the optional
+	starting point was passed in. Some of my new regression tests
+	picked this up.
+
+	# Temporarily work around uses of non-kwq APIs:
+	
+	* src/kwq/WKPluginWidget.h:
+	* src/kwq/qt/_qfile.cpp
+	* src/kwq/qt/_qbuffer.cpp
+	
+	# Guard contents of all these with the appropriate USING ifdef:
+	
+	* src/kwq/KWQStrList.h:
+	* src/kwq/qt/_qarray.h:
+	* src/kwq/qt/_qgarray.h:
+	* src/kwq/qt/_qstrlist.h:
+	
 2002-01-19  Maciej Stachowiak  <mjs at apple.com>
 
 	* src/kdelibs/kjs/Makefile.am: Fix testkjs build.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 51abc6b..d1d14a4 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,56 @@
+2002-01-21  Maciej Stachowiak  <mjs at apple.com>
+
+	Reimplemented QArray, QBuffer, QStack and QStringList; also fixed
+	some files for borrowed switchability, and fixed some bugs found
+	by my new test cases.
+
+	# Reimplement QArray:
+
+	* src/kwq/qt/qarray.h:
+	* src/kwq/KWQArrayImpl.h:
+	* src/kwq/KWQArrayImpl.mm: (KWQArrayImpl::KWQArrayPrivate::KWQArrayPrivate),
+	(KWQArrayImpl::KWQArrayPrivate::~KWQArrayPrivate), (KWQArrayImpl::KWQArrayImpl),
+	(KWQArrayImpl::~KWQArrayImpl), (KWQArrayImpl::operator=), (KWQArrayImpl::at),
+	(KWQArrayImpl::data), (KWQArrayImpl::size), (KWQArrayImpl::resize),
+	(KWQArrayImpl::duplicate), (KWQArrayImpl::fill), (KWQArrayImpl::operator==):
+
+	# Reimplement QBuffer:
+
+	* src/kwq/qt/qbuffer.h:
+	* src/kwq/KWQBuffer.mm: (QBuffer::QBuffer), (QBuffer::~QBuffer),
+	(QBuffer::buffer), (QBuffer::size), (QBuffer::isOpen), (QBuffer::open),
+	(QBuffer::close), (QBuffer::writeBlock):
+	* src/kwq/qt/qiodevice.h:
+
+	# Reimplement QStringList:
+
+	* src/kwq/KWQStringList.mm: (QStringToCFString), (QStringList::split),
+	(QStringList::QStringList), (QStringList::~QStringList), (QStringList::join),
+	(QStringList::operator=):
+
+	# Reimplement QStack:
+	* src/kwq/qt/qstack.h:
+
+	* src/kwq/Makefile.am: Add new files to build.
+
+	* src/kwq/KWQString.mm: (QString::find): Fix bug which returned
+	the very first occurence in the string even when the optional
+	starting point was passed in. Some of my new regression tests
+	picked this up.
+
+	# Temporarily work around uses of non-kwq APIs:
+	
+	* src/kwq/WKPluginWidget.h:
+	* src/kwq/qt/_qfile.cpp
+	* src/kwq/qt/_qbuffer.cpp
+	
+	# Guard contents of all these with the appropriate USING ifdef:
+	
+	* src/kwq/KWQStrList.h:
+	* src/kwq/qt/_qarray.h:
+	* src/kwq/qt/_qgarray.h:
+	* src/kwq/qt/_qstrlist.h:
+	
 2002-01-19  Maciej Stachowiak  <mjs at apple.com>
 
 	* src/kdelibs/kjs/Makefile.am: Fix testkjs build.
diff --git a/WebCore/kwq/kio/kprinter.h b/WebCore/kwq/KWQArrayImpl.h
similarity index 66%
copy from WebCore/kwq/kio/kprinter.h
copy to WebCore/kwq/KWQArrayImpl.h
index 4562554..b588a8a 100644
--- a/WebCore/kwq/kio/kprinter.h
+++ b/WebCore/kwq/KWQArrayImpl.h
@@ -23,30 +23,41 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef KPRINTER_H_
-#define KPRINTER_H_
+#ifndef KWQ_ARRAY_IMPL_H
+#define KWQ_ARRAY_IMPL_H
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
+#include <KWQRefPtr.h>
+#include <KWQDef.h>
+#include <stddef.h>
+
+#ifndef USING_BORROWED_QARRAY
+
+class KWQArrayImpl
+{
+ public:
+    KWQArrayImpl(size_t itemSize);
+    KWQArrayImpl(size_t itemSize, size_t numItems);
+    KWQArrayImpl(const KWQArrayImpl &);
+    ~KWQArrayImpl();
+    
+    KWQArrayImpl &operator=(const KWQArrayImpl &);
+    
+    void *at(size_t pos) const;
+    void *data() const;
+    uint size() const;
+    bool resize(size_t size);
+    void duplicate(const void *data, size_t size);
+    bool fill(const void *item, int size = -1);
+    
+    bool operator==(const KWQArrayImpl &) const;
+ private:
+    class KWQArrayPrivate;
 
-#include <qpaintdevice.h>
-#include <qstring.h>
-#include <qwidget.h>
-#include <qsize.h>
-
-// NOTE: I stuck this file here rather than create a whole new 
-// kdeprint directory
-
-class KPrinter : public QPaintDevice {
-public:
-    bool setup(QWidget *parent=0);
-    bool newPage();
-    void setDocName(const QString &);
-    void setCreator(const QString &);
-    void setFullPage(bool);
-    QSize margins() const;
+    KWQRefPtr<KWQArrayPrivate> d;
 };
 
 #endif
 
+#endif
+
diff --git a/WebCore/kwq/KWQArrayImpl.mm b/WebCore/kwq/KWQArrayImpl.mm
new file mode 100644
index 0000000..f477ce7
--- /dev/null
+++ b/WebCore/kwq/KWQArrayImpl.mm
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include <KWQArrayImpl.h>
+
+#ifndef USING_BORROWED_QARRAY
+
+#include <cstring>
+#include <new>
+
+#define	MIN(a,b) (((a)<(b))?(a):(b))
+
+using namespace std;
+
+class KWQArrayImpl::KWQArrayPrivate
+{
+public:	
+    KWQArrayPrivate(size_t pNumItems, size_t pItemSize);
+    ~KWQArrayPrivate();
+    size_t numItems;
+    size_t itemSize;
+    void *data;
+    int refCount;
+};
+
+KWQArrayImpl::KWQArrayPrivate::KWQArrayPrivate(size_t pItemSize, size_t pNumItems) : 
+    numItems(pNumItems), 
+    itemSize(pItemSize), 
+    data(pNumItems > 0 ? (void *)new char[itemSize * numItems] : NULL), 
+    refCount(0)
+{
+}
+
+KWQArrayImpl::KWQArrayPrivate::~KWQArrayPrivate()
+{
+    if (data != NULL) {
+        delete[] (char *)data;
+    }
+}
+
+
+KWQArrayImpl::KWQArrayImpl(size_t itemSize) : 
+    d(new KWQArrayPrivate(itemSize, 0))
+{
+}
+
+KWQArrayImpl::KWQArrayImpl(size_t itemSize, size_t numItems) : 
+    d(new KWQArrayPrivate(itemSize, numItems))
+{
+}
+
+KWQArrayImpl::KWQArrayImpl(const KWQArrayImpl &a) : 
+    d(a.d)
+{
+}
+
+KWQArrayImpl::~KWQArrayImpl()
+{
+}
+
+KWQArrayImpl &KWQArrayImpl::operator=(const KWQArrayImpl &a)
+{
+    d = a.d;
+    return *this;
+}
+
+void *KWQArrayImpl::at(size_t pos) const
+{
+    return (void *)&((char *)d->data)[pos*d->itemSize];
+}
+
+void *KWQArrayImpl::data() const
+{
+    return d->data;
+}
+
+uint KWQArrayImpl::size() const
+{
+    return d->numItems;
+}
+
+bool KWQArrayImpl::resize(size_t newSize)
+{
+    if (newSize != d->numItems) {
+        void *newData;
+	if (newSize != 0) {
+	    newData= new(nothrow) char[newSize*d->itemSize];
+	    if (newData == NULL) {
+	        return false;
+	    }
+	} else {
+	    newData = NULL;
+	}
+
+	memcpy(newData, d->data, MIN(newSize, d->numItems)*d->itemSize);
+	if (d->data != NULL) {
+	    delete[] (char *)d->data;
+	}
+	d->data = newData;
+	d->numItems = newSize;
+    }
+
+    return true;
+}
+
+void KWQArrayImpl::duplicate(const void *data, size_t newSize)
+{
+    if (data == NULL) {
+	newSize = 0;
+    }
+
+    if (d->refCount > 1) {
+        d =  KWQRefPtr<KWQArrayImpl::KWQArrayPrivate>(new KWQArrayImpl::KWQArrayPrivate(d->itemSize, newSize));
+    }
+
+    if (d->numItems != newSize) {
+	resize(newSize);
+    }
+
+    memcpy(d->data, data, newSize*d->itemSize);
+}
+
+bool KWQArrayImpl::fill(const void *item, int numItems)
+{
+    if (numItems == -1) {
+        numItems = d->numItems;
+    }
+
+    if ((unsigned)numItems != d->numItems) {
+        if (!resize(numItems)) {
+	    return false;
+	}
+    }
+
+    for(int i = 0; i < numItems; i++) {
+        memcpy(&((char *)d->data)[i*d->itemSize], item, d->itemSize);
+    }
+
+    return true;
+}
+
+bool KWQArrayImpl::operator==(const KWQArrayImpl &a) const
+{
+    return d->numItems == a.d->numItems && d->itemSize == d->itemSize && (d->data == a.d->data || memcmp(d->data, a.d->data, d->itemSize*d->numItems) == 0);
+}
+
+#endif
diff --git a/WebCore/kwq/KWQBuffer.h b/WebCore/kwq/KWQBuffer.h
index d0ff927..f7dc289 100644
--- a/WebCore/kwq/KWQBuffer.h
+++ b/WebCore/kwq/KWQBuffer.h
@@ -38,8 +38,9 @@
 
 #include <KWQDef.h>
 
-#include "qarray.h"
-#include "qstring.h"
+#include <qarray.h>
+#include <qstring.h>
+#include <qiodevice.h>
 
 // class QBuffer ===============================================================
 
@@ -76,6 +77,9 @@ private:
     QBuffer(const QBuffer &);
     QBuffer &operator=(const QBuffer &);
 
+    bool opened;
+    QByteArray ba;
+    uint pos;
 }; // class QBuffer ============================================================
 
 #endif // USING_BORROWED_QBUFFER
diff --git a/WebCore/kwq/KWQKProcess.mm b/WebCore/kwq/KWQBuffer.mm
similarity index 63%
copy from WebCore/kwq/KWQKProcess.mm
copy to WebCore/kwq/KWQBuffer.mm
index b1a5c5c..de9a4cb 100644
--- a/WebCore/kwq/KWQKProcess.mm
+++ b/WebCore/kwq/KWQBuffer.mm
@@ -22,65 +22,69 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
-
 #include <kwqdebug.h>
-#include <kprocess.h>
 
-KProcess::KProcess()
-{
-    _logNotYetImplemented();
-}
+#include <qbuffer.h>
 
+#ifndef USING_BORROWED_QBUFFER
 
-KProcess::~KProcess()
+#include <qiodevice.h>
+
+QBuffer::QBuffer() : opened(false), pos(0)
 {
-    _logNotYetImplemented();
 }
 
-
-QStrList *KProcess::args()
+QBuffer::~QBuffer()
 {
-    _logNotYetImplemented();
-    return new QStrList();
 }
 
 
-bool KProcess::isRunning() const
+QByteArray QBuffer::buffer() const
 {
-    _logNotYetImplemented();
-    return FALSE;    
+    return ba;
 }
 
-
-bool KProcess::writeStdin(const char *buffer, int buflen)
+uint QBuffer::size() const
 {
-    _logNotYetImplemented();
-    return FALSE;    
+    return ba.size();
 }
 
-
-bool KProcess::start(RunMode runmode, Communication comm)
+bool QBuffer::isOpen()
 {
-    _logNotYetImplemented();
-    return FALSE;    
+    return opened;
 }
 
-
-bool KProcess::kill(int signo=SIGTERM)
+bool QBuffer::open(int mode)
 {
-    _logNotYetImplemented();
-    return FALSE;    
+    if (mode == IO_WriteOnly) {
+        opened = true;
+	pos = 0;
+	return true;
+    } else {
+        return false;
+    }
 }
 
-
-void KProcess::resume()
+void QBuffer::close()
 {
-    _logNotYetImplemented();
+    opened = false;
 }
 
-
-KProcess &KProcess::operator<<(const QString& arg)
+int QBuffer::writeBlock(const char *data, uint len)
 {
-    _logNotYetImplemented();
-    return *this;
+    // FIXME: could easily be optimized a lot - leave extra space in
+    // buffer for amortized constant time growth
+
+    if (pos+len > ba.size()) {
+        if (!ba.resize(pos+len)) {
+	    return -1;
+	}
+    }
+    memcpy(ba.data()+pos, data, len);
+    pos += len;
+
+    return len;
 }
+
+
+#endif
diff --git a/WebCore/kwq/KWQIODevice.h b/WebCore/kwq/KWQIODevice.h
new file mode 100644
index 0000000..dbc0d20
--- /dev/null
+++ b/WebCore/kwq/KWQIODevice.h
@@ -0,0 +1,6 @@
+#ifndef QIODEVICE_H_
+#define QIODEVICE_H_
+
+#define IO_WriteOnly		0x0002		// writable device
+
+#endif
diff --git a/WebCore/kwq/KWQMemArray.h b/WebCore/kwq/KWQMemArray.h
index 37ab082..26df905 100644
--- a/WebCore/kwq/KWQMemArray.h
+++ b/WebCore/kwq/KWQMemArray.h
@@ -37,6 +37,8 @@
 #else
 
 #include <KWQDef.h>
+#include <KWQArrayImpl.h>
+#include <iostream>
 
 // class QArray ================================================================
 
@@ -50,33 +52,57 @@ public:
     
     // constructors, copy constructors, and destructors ------------------------
 
-    QArray() {}
-    QArray(int);
-    QArray(const QArray<T> &);
+    QArray() : impl(sizeof(T)) {}
+    QArray(int i) : impl(sizeof(T),i) {}
+    QArray(const QArray<T> &a) : impl(a.impl) {}
     ~QArray() {}
     
     // member functions --------------------------------------------------------
 
-    T &at(uint) const;
-    T *data() const;
-    uint size() const;
-    uint count() const;
-    bool resize(uint size);
-    QArray<T>& duplicate(const T*, int);
-    bool fill(const T &, int size=-1);
+    T &at(uint u) const {return *(T *)impl.at(u); }
+    T *data() const { return (T *)impl.data(); }
+    uint size() const { return impl.size(); }
+    uint count() const { return size(); }
+    bool resize(uint size) { return impl.resize(size); }
+    QArray<T>& duplicate(const T *data, int size) { impl.duplicate(data, size); return *this; }
+    void detach() { duplicate(data(), size()); }
+    bool fill(const T &item, int size=-1) { return impl.fill(&item, size); }
+    QArray<T>& assign(const QArray<T> &a) { return *this = a; }
+
 
     // operators ---------------------------------------------------------------
 
-    QArray<T> &operator=(const QArray<T> &);    
-    T &operator[](int) const;
-    bool operator==(const QArray<T> &);    
-    bool operator!=(const QArray<T> &);    
+    QArray<T> &operator=(const QArray<T> &a) { impl = a.impl; return *this; }    
+    T &operator[](int i) const { return at(i); }
+    bool operator==(const QArray<T> &a) const { return impl == a.impl; }
+    bool operator!=(const QArray<T> &a) const { return !(*this == a); }    
+    operator const T*() const { return data(); }
 
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
+ private:
+    KWQArrayImpl impl;
 
 }; // class QArray =============================================================
 
+#ifdef _KWQ_IOSTREAM_
+template<class T>
+inline ostream &operator<<(ostream &stream, const QArray<T>&a)
+{
+    stream << "QArray: [size: " << a.size() << "; items: ";
+    for (unsigned i = 0; i < a.size(); i++) {
+        stream << a[i];
+	if (i < a.size() - 1) {
+	    stream << ", ";
+	}
+    }
+    stream << "]";
+
+    return stream;
+}
+#endif
+
 #endif // USING_BORROWED_QARRAY
 
 #endif
+
diff --git a/WebCore/kwq/KWQPtrStack.h b/WebCore/kwq/KWQPtrStack.h
index 247832b..2a72bf2 100644
--- a/WebCore/kwq/KWQPtrStack.h
+++ b/WebCore/kwq/KWQPtrStack.h
@@ -36,6 +36,8 @@
 #include <_qstack.h>
 #else
 
+#include <qlist.h>
+
 // class QStack ================================================================
 
 template<class T> class QStack {
@@ -47,25 +49,51 @@ public:
     // static member functions -------------------------------------------------
     // constructors, copy constructors, and destructors ------------------------
 
-    QStack();
-    QStack(const QStack<T> &);
-    ~QStack();
+    QStack() : list() {}
+    QStack(const QStack<T> &s) : list(s.list) {}
+    ~QStack() {}
 
     // member functions --------------------------------------------------------
 
-    bool isEmpty() const;
-    void push(const T *);
-    T *pop();
+    bool isEmpty() const { return list.isEmpty(); }
+    void push(const T *item) { list.append (item); }
+    T *pop() { T *tmp = list.getLast(); list.removeLast(); return tmp; }
+    uint count() const { return list.count(); }
 
     // operators ---------------------------------------------------------------
 
-    QStack<T> &operator=(const QStack<T> &);
+    QStack<T> &operator=(const QStack<T> &s) { list = s.list; return *this; }
 
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
+ private:
+    QList<T> list;
 
 }; // class QStack =============================================================
 
+#ifdef _KWQ_IOSTREAM_
+template<class T>
+inline ostream &operator<<(ostream &stream, const QStack<T>&s)
+{
+    stream << "QStack: [size: " << s.count() << "; items: ";
+
+    QStack<T> tmp(s);
+
+    while (!tmp.isEmpty()) {
+        stream << *tmp.pop();
+	if (tmp.count() > 0) {
+	    stream << ", ";
+	}
+    }
+
+    stream << "]";
+
+    return stream;
+}
+
+
+#endif
+
 #endif // USING_BORROWED_QSTACK
 
 #endif
diff --git a/WebCore/kwq/KWQStrList.h b/WebCore/kwq/KWQStrList.h
index b31f713..d718942 100644
--- a/WebCore/kwq/KWQStrList.h
+++ b/WebCore/kwq/KWQStrList.h
@@ -30,7 +30,11 @@
 #include <config.h>
 #endif
 
-#ifndef USING_BORROWED_QSTRINGLIST
+#ifdef USING_BORROWED_QSTRLIST
+
+#include <_qstrlist.h>
+
+#else
 
 #include <qstring.h>
 #include <qlist.h>
@@ -63,6 +67,6 @@ public:
 
 }; // class QStrList ===========================================================
 
-#endif // USING_BORROWED_QSTRINGLIST
+#endif // USING_BORROWED_QSTRLIST
 
 #endif
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 812d6c2..0853dab 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -466,8 +466,9 @@ int QString::find(const QString &qs, int index) const
             index += len;
         }
         if (len && (index >= 0) && (index < len)) {
-            CFRange r = CFStringFind(s, qs.s, 0);
-            if (r.location != kCFNotFound) {
+            CFRange r;
+	    CFRange start = CFRangeMake(index, len - index); 
+	    if (CFStringFindWithOptions(s, qs.s, start, 0, &r)) {
                 return r.location;
             }
         }
diff --git a/WebCore/kwq/KWQStringList.mm b/WebCore/kwq/KWQStringList.mm
new file mode 100644
index 0000000..3147deb
--- /dev/null
+++ b/WebCore/kwq/KWQStringList.mm
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#include <kwqdebug.h>
+
+#include <qstringlist.h>
+
+#ifndef USING_BORROWED_QSTRINGLIST
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <iostream>
+
+// No need to CFRelease return value
+static CFStringRef QStringToCFString(QString s)
+{
+    CFStringRef cfs = s.getCFMutableString();
+    if (cfs == NULL) {
+        cfs = CFSTR("");
+    }
+    return cfs;
+}
+
+QStringList QStringList::split(const QString &separator, const QString &s, 
+				      bool allowEmptyEntries = FALSE )
+{
+    CFArrayRef cfresult;
+    QStringList result;
+
+    cfresult = CFStringCreateArrayBySeparatingStrings(NULL, QStringToCFString(s), QStringToCFString(separator));
+    
+    CFIndex cfResultSize = CFArrayGetCount(cfresult);
+
+    for (CFIndex i = 0; i < cfResultSize; i++) {
+        QString entry = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(cfresult, i));
+	if (!entry.isEmpty() || allowEmptyEntries) {
+	    result.append(entry);
+	}
+    }
+
+    CFRelease(cfresult);
+
+    return result;
+}
+ 
+QStringList QStringList::split(const QChar &separator, const QString &s, 
+				      bool allowEmptyEntries = FALSE )
+{
+    return QStringList::split(QString(separator), s, allowEmptyEntries);
+}
+
+    
+QStringList::QStringList()
+{
+}
+
+QStringList::QStringList(const QStringList &l) : QValueList<QString>(l)
+{
+    
+}
+
+QStringList::~QStringList()
+{
+}
+
+QString QStringList::join(const QString &separator) const
+{
+    QString result;
+    
+    for (ConstIterator i = begin(), j = ++begin(); i != end(); ++i, ++j) {
+        result += *i;
+	if (j != end()) {
+	    result += separator;
+	}
+    }
+
+    return result;
+}
+
+QStringList &QStringList::operator=(const QStringList &l)
+{
+    (*this).QValueList<QString>::operator=(l);
+    return *this;
+}
+
+#endif
diff --git a/WebCore/kwq/Makefile.am b/WebCore/kwq/Makefile.am
index 42d33e7..a6a28e5 100644
--- a/WebCore/kwq/Makefile.am
+++ b/WebCore/kwq/Makefile.am
@@ -6,13 +6,15 @@ SUBDIRS = \
 	$(NULL)
 
 noinst_LIBRARIES = libkwq.o
-libkwq_o_LDFLAGS = -Wl,-r -nostdlib
-libkwq_o_AR = $(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) $(libkwq_o_LDFLAGS) -o
+libkwq_LDFLAGS = -Wl,-r -nostdlib
+libkwq_o_AR = $(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) $(libkwq_LDFLAGS) -o
 
 libkwq_o_SOURCES = \
 	KWQApplication.mm \
+	KWQArrayImpl.mm \
 	KWQBitmap.mm \
 	KWQBrush.mm \
+	KWQBuffer.mm \
 	KWQButton.mm \
 	KWQCString.mm \
 	KWQChar.mm \
@@ -99,6 +101,7 @@ libkwq_o_SOURCES = \
 	KWQRegion.mm \
 	KWQScrollView.mm \
 	KWQString.mm \
+	KWQStringList.mm \
 	KWQStyle.mm \
 	KWQTextArea.mm \
 	KWQTextContainer.mm \
diff --git a/WebCore/kwq/WKPluginWidget.h b/WebCore/kwq/WKPluginWidget.h
index 84aad37..7b7f96f 100644
--- a/WebCore/kwq/WKPluginWidget.h
+++ b/WebCore/kwq/WKPluginWidget.h
@@ -48,7 +48,7 @@ public:
     
     // constructors, copy constructors, and destructors ------------------------
 
-    WKPluginWidget(QWidget *parent=0, const QString &url=0, const QString &serviceType=0, const QStringList &args=0);
+    WKPluginWidget(QWidget *parent=0, const QString &url=0, const QString &serviceType=0, const QStringList &args=QStringList());
     ~WKPluginWidget();
 
     // member functions --------------------------------------------------------
diff --git a/WebCore/kwq/qt/_qarray.h b/WebCore/kwq/qt/_qarray.h
index ff3bf06..6b5b185 100644
--- a/WebCore/kwq/qt/_qarray.h
+++ b/WebCore/kwq/qt/_qarray.h
@@ -40,18 +40,14 @@
 
 // KWQ hacks ---------------------------------------------------------------
 
-#ifndef USING_BORROWED_QARRAY
-#define USING_BORROWED_QARRAY
-#endif
+#ifdef USING_BORROWED_QARRAY
 
 #include <KWQDef.h>
 #include <iostream>
 
 // -------------------------------------------------------------------------
 
-#ifndef QT_H
 #include "_qgarray.h"
-#endif // QT_H
 
 template<class type> class QArray : public QGArray
 {
@@ -137,4 +133,6 @@ inline ostream &operator<<(ostream &o, const QArray<T>&p)
 }
 #endif
 
+#endif
+
 #endif // QARRAY_H
diff --git a/WebCore/kwq/qt/_qbuffer.cpp b/WebCore/kwq/qt/_qbuffer.cpp
index 801e51b..2e308b6 100644
--- a/WebCore/kwq/qt/_qbuffer.cpp
+++ b/WebCore/kwq/qt/_qbuffer.cpp
@@ -345,13 +345,27 @@ int QBuffer::writeBlock( const char *p, uint len )
 	    return -1;
 	}
 	a_inc *= 2;				// double increment
+#ifdef USING_BORROWED_QARRAY
 	a_len = new_len;
+#else
+	a_len = (uint)ioIndex + len;
+#endif
+
+#ifdef USING_BORROWED_QARRAY
 	a.shd->len = (uint)ioIndex + len;
+#else
+	a.resize((uint)ioIndex + len);
+#endif
     }
     memcpy( a.data()+ioIndex, p, len );
     ioIndex += len;
+#ifdef USING_BORROWED_QARRAY
     if ( a.shd->len < (uint)ioIndex )
 	a.shd->len = (uint)ioIndex;		// fake (not alloc'd) length
+#else
+    if ( a.size() < (uint)ioIndex )
+        a.resize(ioIndex);
+#endif
     return len;
 }
 
@@ -443,8 +457,13 @@ int QBuffer::putch( int ch )
 	    return -1;				// write error
     } else {
 	*(a.data() + ioIndex++) = (char)ch;
+#ifdef USING_BORROWED_QARRAY
 	if ( a.shd->len < (uint)ioIndex )
 	    a.shd->len = (uint)ioIndex;
+#else
+	if ( a.size () < (uint)ioIndex )
+	    a.resize ((uint)ioIndex);
+#endif 
     }
     return ch;
 }
diff --git a/WebCore/kwq/qt/_qfile.cpp b/WebCore/kwq/qt/_qfile.cpp
index 7d78a25..dbb8753 100644
--- a/WebCore/kwq/qt/_qfile.cpp
+++ b/WebCore/kwq/qt/_qfile.cpp
@@ -169,7 +169,11 @@ int QFile::readLine( QString& s, uint maxlen )
     QByteArray ba(maxlen);
     int l = readLine(ba.data(),maxlen);
     if ( l >= 0 ) {
+#ifdef USING_BORROWED_QARRAY
 	ba.truncate(l);
+#else
+	ba.resize(l);
+#endif
 	s = QString(ba);
     }
     return l;
diff --git a/WebCore/kwq/qt/_qgarray.h b/WebCore/kwq/qt/_qgarray.h
index 3157c89..e8e3316 100644
--- a/WebCore/kwq/qt/_qgarray.h
+++ b/WebCore/kwq/qt/_qgarray.h
@@ -15,9 +15,9 @@
 
 // KWQ hacks ---------------------------------------------------------------
 
-#ifndef USING_BORROWED_QARRAY
-#define USING_BORROWED_QARRAY
-#endif
+#include <config.h>
+
+#ifdef USING_BORROWED_QARRAY
 
 #include <KWQDef.h>
 
@@ -98,5 +98,6 @@ inline char *QGArray::at( uint index ) const
     return &shd->data[index];
 }
 
+#endif
 
 #endif 
diff --git a/WebCore/kwq/qt/_qstrlist.h b/WebCore/kwq/qt/_qstrlist.h
index 10ff372..83f88c0 100644
--- a/WebCore/kwq/qt/_qstrlist.h
+++ b/WebCore/kwq/qt/_qstrlist.h
@@ -44,9 +44,7 @@
 #include <config.h>
 #endif
 
-#ifndef USING_BORROWED_QSTRINGLIST
-#define USING_BORROWED_QSTRINGLIST
-#endif
+#ifdef USING_BORROWED_QSTRLIST
 
 #include <KWQDef.h>
 
@@ -130,5 +128,7 @@ inline QStrList::QStrList( const QStrList &strList )
     operator=(strList);
 }
 
+#endif
+
 
 #endif // QSTRLIST_H
diff --git a/WebCore/kwq/qt/qarray.h b/WebCore/kwq/qt/qarray.h
index 37ab082..26df905 100644
--- a/WebCore/kwq/qt/qarray.h
+++ b/WebCore/kwq/qt/qarray.h
@@ -37,6 +37,8 @@
 #else
 
 #include <KWQDef.h>
+#include <KWQArrayImpl.h>
+#include <iostream>
 
 // class QArray ================================================================
 
@@ -50,33 +52,57 @@ public:
     
     // constructors, copy constructors, and destructors ------------------------
 
-    QArray() {}
-    QArray(int);
-    QArray(const QArray<T> &);
+    QArray() : impl(sizeof(T)) {}
+    QArray(int i) : impl(sizeof(T),i) {}
+    QArray(const QArray<T> &a) : impl(a.impl) {}
     ~QArray() {}
     
     // member functions --------------------------------------------------------
 
-    T &at(uint) const;
-    T *data() const;
-    uint size() const;
-    uint count() const;
-    bool resize(uint size);
-    QArray<T>& duplicate(const T*, int);
-    bool fill(const T &, int size=-1);
+    T &at(uint u) const {return *(T *)impl.at(u); }
+    T *data() const { return (T *)impl.data(); }
+    uint size() const { return impl.size(); }
+    uint count() const { return size(); }
+    bool resize(uint size) { return impl.resize(size); }
+    QArray<T>& duplicate(const T *data, int size) { impl.duplicate(data, size); return *this; }
+    void detach() { duplicate(data(), size()); }
+    bool fill(const T &item, int size=-1) { return impl.fill(&item, size); }
+    QArray<T>& assign(const QArray<T> &a) { return *this = a; }
+
 
     // operators ---------------------------------------------------------------
 
-    QArray<T> &operator=(const QArray<T> &);    
-    T &operator[](int) const;
-    bool operator==(const QArray<T> &);    
-    bool operator!=(const QArray<T> &);    
+    QArray<T> &operator=(const QArray<T> &a) { impl = a.impl; return *this; }    
+    T &operator[](int i) const { return at(i); }
+    bool operator==(const QArray<T> &a) const { return impl == a.impl; }
+    bool operator!=(const QArray<T> &a) const { return !(*this == a); }    
+    operator const T*() const { return data(); }
 
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
+ private:
+    KWQArrayImpl impl;
 
 }; // class QArray =============================================================
 
+#ifdef _KWQ_IOSTREAM_
+template<class T>
+inline ostream &operator<<(ostream &stream, const QArray<T>&a)
+{
+    stream << "QArray: [size: " << a.size() << "; items: ";
+    for (unsigned i = 0; i < a.size(); i++) {
+        stream << a[i];
+	if (i < a.size() - 1) {
+	    stream << ", ";
+	}
+    }
+    stream << "]";
+
+    return stream;
+}
+#endif
+
 #endif // USING_BORROWED_QARRAY
 
 #endif
+
diff --git a/WebCore/kwq/qt/qbuffer.h b/WebCore/kwq/qt/qbuffer.h
index d0ff927..f7dc289 100644
--- a/WebCore/kwq/qt/qbuffer.h
+++ b/WebCore/kwq/qt/qbuffer.h
@@ -38,8 +38,9 @@
 
 #include <KWQDef.h>
 
-#include "qarray.h"
-#include "qstring.h"
+#include <qarray.h>
+#include <qstring.h>
+#include <qiodevice.h>
 
 // class QBuffer ===============================================================
 
@@ -76,6 +77,9 @@ private:
     QBuffer(const QBuffer &);
     QBuffer &operator=(const QBuffer &);
 
+    bool opened;
+    QByteArray ba;
+    uint pos;
 }; // class QBuffer ============================================================
 
 #endif // USING_BORROWED_QBUFFER
diff --git a/WebCore/kwq/qt/qiodevice.h b/WebCore/kwq/qt/qiodevice.h
new file mode 100644
index 0000000..dbc0d20
--- /dev/null
+++ b/WebCore/kwq/qt/qiodevice.h
@@ -0,0 +1,6 @@
+#ifndef QIODEVICE_H_
+#define QIODEVICE_H_
+
+#define IO_WriteOnly		0x0002		// writable device
+
+#endif
diff --git a/WebCore/kwq/qt/qstack.h b/WebCore/kwq/qt/qstack.h
index 247832b..2a72bf2 100644
--- a/WebCore/kwq/qt/qstack.h
+++ b/WebCore/kwq/qt/qstack.h
@@ -36,6 +36,8 @@
 #include <_qstack.h>
 #else
 
+#include <qlist.h>
+
 // class QStack ================================================================
 
 template<class T> class QStack {
@@ -47,25 +49,51 @@ public:
     // static member functions -------------------------------------------------
     // constructors, copy constructors, and destructors ------------------------
 
-    QStack();
-    QStack(const QStack<T> &);
-    ~QStack();
+    QStack() : list() {}
+    QStack(const QStack<T> &s) : list(s.list) {}
+    ~QStack() {}
 
     // member functions --------------------------------------------------------
 
-    bool isEmpty() const;
-    void push(const T *);
-    T *pop();
+    bool isEmpty() const { return list.isEmpty(); }
+    void push(const T *item) { list.append (item); }
+    T *pop() { T *tmp = list.getLast(); list.removeLast(); return tmp; }
+    uint count() const { return list.count(); }
 
     // operators ---------------------------------------------------------------
 
-    QStack<T> &operator=(const QStack<T> &);
+    QStack<T> &operator=(const QStack<T> &s) { list = s.list; return *this; }
 
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
+ private:
+    QList<T> list;
 
 }; // class QStack =============================================================
 
+#ifdef _KWQ_IOSTREAM_
+template<class T>
+inline ostream &operator<<(ostream &stream, const QStack<T>&s)
+{
+    stream << "QStack: [size: " << s.count() << "; items: ";
+
+    QStack<T> tmp(s);
+
+    while (!tmp.isEmpty()) {
+        stream << *tmp.pop();
+	if (tmp.count() > 0) {
+	    stream << ", ";
+	}
+    }
+
+    stream << "]";
+
+    return stream;
+}
+
+
+#endif
+
 #endif // USING_BORROWED_QSTACK
 
 #endif
diff --git a/WebCore/kwq/kio/kprinter.h b/WebCore/src/kwq/KWQArrayImpl.h
similarity index 66%
copy from WebCore/kwq/kio/kprinter.h
copy to WebCore/src/kwq/KWQArrayImpl.h
index 4562554..b588a8a 100644
--- a/WebCore/kwq/kio/kprinter.h
+++ b/WebCore/src/kwq/KWQArrayImpl.h
@@ -23,30 +23,41 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef KPRINTER_H_
-#define KPRINTER_H_
+#ifndef KWQ_ARRAY_IMPL_H
+#define KWQ_ARRAY_IMPL_H
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
+#include <KWQRefPtr.h>
+#include <KWQDef.h>
+#include <stddef.h>
+
+#ifndef USING_BORROWED_QARRAY
+
+class KWQArrayImpl
+{
+ public:
+    KWQArrayImpl(size_t itemSize);
+    KWQArrayImpl(size_t itemSize, size_t numItems);
+    KWQArrayImpl(const KWQArrayImpl &);
+    ~KWQArrayImpl();
+    
+    KWQArrayImpl &operator=(const KWQArrayImpl &);
+    
+    void *at(size_t pos) const;
+    void *data() const;
+    uint size() const;
+    bool resize(size_t size);
+    void duplicate(const void *data, size_t size);
+    bool fill(const void *item, int size = -1);
+    
+    bool operator==(const KWQArrayImpl &) const;
+ private:
+    class KWQArrayPrivate;
 
-#include <qpaintdevice.h>
-#include <qstring.h>
-#include <qwidget.h>
-#include <qsize.h>
-
-// NOTE: I stuck this file here rather than create a whole new 
-// kdeprint directory
-
-class KPrinter : public QPaintDevice {
-public:
-    bool setup(QWidget *parent=0);
-    bool newPage();
-    void setDocName(const QString &);
-    void setCreator(const QString &);
-    void setFullPage(bool);
-    QSize margins() const;
+    KWQRefPtr<KWQArrayPrivate> d;
 };
 
 #endif
 
+#endif
+
diff --git a/WebCore/src/kwq/KWQArrayImpl.mm b/WebCore/src/kwq/KWQArrayImpl.mm
new file mode 100644
index 0000000..f477ce7
--- /dev/null
+++ b/WebCore/src/kwq/KWQArrayImpl.mm
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include <KWQArrayImpl.h>
+
+#ifndef USING_BORROWED_QARRAY
+
+#include <cstring>
+#include <new>
+
+#define	MIN(a,b) (((a)<(b))?(a):(b))
+
+using namespace std;
+
+class KWQArrayImpl::KWQArrayPrivate
+{
+public:	
+    KWQArrayPrivate(size_t pNumItems, size_t pItemSize);
+    ~KWQArrayPrivate();
+    size_t numItems;
+    size_t itemSize;
+    void *data;
+    int refCount;
+};
+
+KWQArrayImpl::KWQArrayPrivate::KWQArrayPrivate(size_t pItemSize, size_t pNumItems) : 
+    numItems(pNumItems), 
+    itemSize(pItemSize), 
+    data(pNumItems > 0 ? (void *)new char[itemSize * numItems] : NULL), 
+    refCount(0)
+{
+}
+
+KWQArrayImpl::KWQArrayPrivate::~KWQArrayPrivate()
+{
+    if (data != NULL) {
+        delete[] (char *)data;
+    }
+}
+
+
+KWQArrayImpl::KWQArrayImpl(size_t itemSize) : 
+    d(new KWQArrayPrivate(itemSize, 0))
+{
+}
+
+KWQArrayImpl::KWQArrayImpl(size_t itemSize, size_t numItems) : 
+    d(new KWQArrayPrivate(itemSize, numItems))
+{
+}
+
+KWQArrayImpl::KWQArrayImpl(const KWQArrayImpl &a) : 
+    d(a.d)
+{
+}
+
+KWQArrayImpl::~KWQArrayImpl()
+{
+}
+
+KWQArrayImpl &KWQArrayImpl::operator=(const KWQArrayImpl &a)
+{
+    d = a.d;
+    return *this;
+}
+
+void *KWQArrayImpl::at(size_t pos) const
+{
+    return (void *)&((char *)d->data)[pos*d->itemSize];
+}
+
+void *KWQArrayImpl::data() const
+{
+    return d->data;
+}
+
+uint KWQArrayImpl::size() const
+{
+    return d->numItems;
+}
+
+bool KWQArrayImpl::resize(size_t newSize)
+{
+    if (newSize != d->numItems) {
+        void *newData;
+	if (newSize != 0) {
+	    newData= new(nothrow) char[newSize*d->itemSize];
+	    if (newData == NULL) {
+	        return false;
+	    }
+	} else {
+	    newData = NULL;
+	}
+
+	memcpy(newData, d->data, MIN(newSize, d->numItems)*d->itemSize);
+	if (d->data != NULL) {
+	    delete[] (char *)d->data;
+	}
+	d->data = newData;
+	d->numItems = newSize;
+    }
+
+    return true;
+}
+
+void KWQArrayImpl::duplicate(const void *data, size_t newSize)
+{
+    if (data == NULL) {
+	newSize = 0;
+    }
+
+    if (d->refCount > 1) {
+        d =  KWQRefPtr<KWQArrayImpl::KWQArrayPrivate>(new KWQArrayImpl::KWQArrayPrivate(d->itemSize, newSize));
+    }
+
+    if (d->numItems != newSize) {
+	resize(newSize);
+    }
+
+    memcpy(d->data, data, newSize*d->itemSize);
+}
+
+bool KWQArrayImpl::fill(const void *item, int numItems)
+{
+    if (numItems == -1) {
+        numItems = d->numItems;
+    }
+
+    if ((unsigned)numItems != d->numItems) {
+        if (!resize(numItems)) {
+	    return false;
+	}
+    }
+
+    for(int i = 0; i < numItems; i++) {
+        memcpy(&((char *)d->data)[i*d->itemSize], item, d->itemSize);
+    }
+
+    return true;
+}
+
+bool KWQArrayImpl::operator==(const KWQArrayImpl &a) const
+{
+    return d->numItems == a.d->numItems && d->itemSize == d->itemSize && (d->data == a.d->data || memcmp(d->data, a.d->data, d->itemSize*d->numItems) == 0);
+}
+
+#endif
diff --git a/WebCore/kwq/KWQKProcess.mm b/WebCore/src/kwq/KWQBuffer.mm
similarity index 63%
copy from WebCore/kwq/KWQKProcess.mm
copy to WebCore/src/kwq/KWQBuffer.mm
index b1a5c5c..de9a4cb 100644
--- a/WebCore/kwq/KWQKProcess.mm
+++ b/WebCore/src/kwq/KWQBuffer.mm
@@ -22,65 +22,69 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
-
 #include <kwqdebug.h>
-#include <kprocess.h>
 
-KProcess::KProcess()
-{
-    _logNotYetImplemented();
-}
+#include <qbuffer.h>
 
+#ifndef USING_BORROWED_QBUFFER
 
-KProcess::~KProcess()
+#include <qiodevice.h>
+
+QBuffer::QBuffer() : opened(false), pos(0)
 {
-    _logNotYetImplemented();
 }
 
-
-QStrList *KProcess::args()
+QBuffer::~QBuffer()
 {
-    _logNotYetImplemented();
-    return new QStrList();
 }
 
 
-bool KProcess::isRunning() const
+QByteArray QBuffer::buffer() const
 {
-    _logNotYetImplemented();
-    return FALSE;    
+    return ba;
 }
 
-
-bool KProcess::writeStdin(const char *buffer, int buflen)
+uint QBuffer::size() const
 {
-    _logNotYetImplemented();
-    return FALSE;    
+    return ba.size();
 }
 
-
-bool KProcess::start(RunMode runmode, Communication comm)
+bool QBuffer::isOpen()
 {
-    _logNotYetImplemented();
-    return FALSE;    
+    return opened;
 }
 
-
-bool KProcess::kill(int signo=SIGTERM)
+bool QBuffer::open(int mode)
 {
-    _logNotYetImplemented();
-    return FALSE;    
+    if (mode == IO_WriteOnly) {
+        opened = true;
+	pos = 0;
+	return true;
+    } else {
+        return false;
+    }
 }
 
-
-void KProcess::resume()
+void QBuffer::close()
 {
-    _logNotYetImplemented();
+    opened = false;
 }
 
-
-KProcess &KProcess::operator<<(const QString& arg)
+int QBuffer::writeBlock(const char *data, uint len)
 {
-    _logNotYetImplemented();
-    return *this;
+    // FIXME: could easily be optimized a lot - leave extra space in
+    // buffer for amortized constant time growth
+
+    if (pos+len > ba.size()) {
+        if (!ba.resize(pos+len)) {
+	    return -1;
+	}
+    }
+    memcpy(ba.data()+pos, data, len);
+    pos += len;
+
+    return len;
 }
+
+
+#endif
diff --git a/WebCore/src/kwq/KWQStrList.h b/WebCore/src/kwq/KWQStrList.h
index b31f713..d718942 100644
--- a/WebCore/src/kwq/KWQStrList.h
+++ b/WebCore/src/kwq/KWQStrList.h
@@ -30,7 +30,11 @@
 #include <config.h>
 #endif
 
-#ifndef USING_BORROWED_QSTRINGLIST
+#ifdef USING_BORROWED_QSTRLIST
+
+#include <_qstrlist.h>
+
+#else
 
 #include <qstring.h>
 #include <qlist.h>
@@ -63,6 +67,6 @@ public:
 
 }; // class QStrList ===========================================================
 
-#endif // USING_BORROWED_QSTRINGLIST
+#endif // USING_BORROWED_QSTRLIST
 
 #endif
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index 812d6c2..0853dab 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -466,8 +466,9 @@ int QString::find(const QString &qs, int index) const
             index += len;
         }
         if (len && (index >= 0) && (index < len)) {
-            CFRange r = CFStringFind(s, qs.s, 0);
-            if (r.location != kCFNotFound) {
+            CFRange r;
+	    CFRange start = CFRangeMake(index, len - index); 
+	    if (CFStringFindWithOptions(s, qs.s, start, 0, &r)) {
                 return r.location;
             }
         }
diff --git a/WebCore/src/kwq/KWQStringList.mm b/WebCore/src/kwq/KWQStringList.mm
new file mode 100644
index 0000000..3147deb
--- /dev/null
+++ b/WebCore/src/kwq/KWQStringList.mm
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#include <kwqdebug.h>
+
+#include <qstringlist.h>
+
+#ifndef USING_BORROWED_QSTRINGLIST
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <iostream>
+
+// No need to CFRelease return value
+static CFStringRef QStringToCFString(QString s)
+{
+    CFStringRef cfs = s.getCFMutableString();
+    if (cfs == NULL) {
+        cfs = CFSTR("");
+    }
+    return cfs;
+}
+
+QStringList QStringList::split(const QString &separator, const QString &s, 
+				      bool allowEmptyEntries = FALSE )
+{
+    CFArrayRef cfresult;
+    QStringList result;
+
+    cfresult = CFStringCreateArrayBySeparatingStrings(NULL, QStringToCFString(s), QStringToCFString(separator));
+    
+    CFIndex cfResultSize = CFArrayGetCount(cfresult);
+
+    for (CFIndex i = 0; i < cfResultSize; i++) {
+        QString entry = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(cfresult, i));
+	if (!entry.isEmpty() || allowEmptyEntries) {
+	    result.append(entry);
+	}
+    }
+
+    CFRelease(cfresult);
+
+    return result;
+}
+ 
+QStringList QStringList::split(const QChar &separator, const QString &s, 
+				      bool allowEmptyEntries = FALSE )
+{
+    return QStringList::split(QString(separator), s, allowEmptyEntries);
+}
+
+    
+QStringList::QStringList()
+{
+}
+
+QStringList::QStringList(const QStringList &l) : QValueList<QString>(l)
+{
+    
+}
+
+QStringList::~QStringList()
+{
+}
+
+QString QStringList::join(const QString &separator) const
+{
+    QString result;
+    
+    for (ConstIterator i = begin(), j = ++begin(); i != end(); ++i, ++j) {
+        result += *i;
+	if (j != end()) {
+	    result += separator;
+	}
+    }
+
+    return result;
+}
+
+QStringList &QStringList::operator=(const QStringList &l)
+{
+    (*this).QValueList<QString>::operator=(l);
+    return *this;
+}
+
+#endif
diff --git a/WebCore/src/kwq/Makefile.am b/WebCore/src/kwq/Makefile.am
index 42d33e7..a6a28e5 100644
--- a/WebCore/src/kwq/Makefile.am
+++ b/WebCore/src/kwq/Makefile.am
@@ -6,13 +6,15 @@ SUBDIRS = \
 	$(NULL)
 
 noinst_LIBRARIES = libkwq.o
-libkwq_o_LDFLAGS = -Wl,-r -nostdlib
-libkwq_o_AR = $(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) $(libkwq_o_LDFLAGS) -o
+libkwq_LDFLAGS = -Wl,-r -nostdlib
+libkwq_o_AR = $(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) $(libkwq_LDFLAGS) -o
 
 libkwq_o_SOURCES = \
 	KWQApplication.mm \
+	KWQArrayImpl.mm \
 	KWQBitmap.mm \
 	KWQBrush.mm \
+	KWQBuffer.mm \
 	KWQButton.mm \
 	KWQCString.mm \
 	KWQChar.mm \
@@ -99,6 +101,7 @@ libkwq_o_SOURCES = \
 	KWQRegion.mm \
 	KWQScrollView.mm \
 	KWQString.mm \
+	KWQStringList.mm \
 	KWQStyle.mm \
 	KWQTextArea.mm \
 	KWQTextContainer.mm \
diff --git a/WebCore/src/kwq/WKPluginWidget.h b/WebCore/src/kwq/WKPluginWidget.h
index 84aad37..7b7f96f 100644
--- a/WebCore/src/kwq/WKPluginWidget.h
+++ b/WebCore/src/kwq/WKPluginWidget.h
@@ -48,7 +48,7 @@ public:
     
     // constructors, copy constructors, and destructors ------------------------
 
-    WKPluginWidget(QWidget *parent=0, const QString &url=0, const QString &serviceType=0, const QStringList &args=0);
+    WKPluginWidget(QWidget *parent=0, const QString &url=0, const QString &serviceType=0, const QStringList &args=QStringList());
     ~WKPluginWidget();
 
     // member functions --------------------------------------------------------
diff --git a/WebCore/src/kwq/qt/_qarray.h b/WebCore/src/kwq/qt/_qarray.h
index ff3bf06..6b5b185 100644
--- a/WebCore/src/kwq/qt/_qarray.h
+++ b/WebCore/src/kwq/qt/_qarray.h
@@ -40,18 +40,14 @@
 
 // KWQ hacks ---------------------------------------------------------------
 
-#ifndef USING_BORROWED_QARRAY
-#define USING_BORROWED_QARRAY
-#endif
+#ifdef USING_BORROWED_QARRAY
 
 #include <KWQDef.h>
 #include <iostream>
 
 // -------------------------------------------------------------------------
 
-#ifndef QT_H
 #include "_qgarray.h"
-#endif // QT_H
 
 template<class type> class QArray : public QGArray
 {
@@ -137,4 +133,6 @@ inline ostream &operator<<(ostream &o, const QArray<T>&p)
 }
 #endif
 
+#endif
+
 #endif // QARRAY_H
diff --git a/WebCore/src/kwq/qt/_qbuffer.cpp b/WebCore/src/kwq/qt/_qbuffer.cpp
index 801e51b..2e308b6 100644
--- a/WebCore/src/kwq/qt/_qbuffer.cpp
+++ b/WebCore/src/kwq/qt/_qbuffer.cpp
@@ -345,13 +345,27 @@ int QBuffer::writeBlock( const char *p, uint len )
 	    return -1;
 	}
 	a_inc *= 2;				// double increment
+#ifdef USING_BORROWED_QARRAY
 	a_len = new_len;
+#else
+	a_len = (uint)ioIndex + len;
+#endif
+
+#ifdef USING_BORROWED_QARRAY
 	a.shd->len = (uint)ioIndex + len;
+#else
+	a.resize((uint)ioIndex + len);
+#endif
     }
     memcpy( a.data()+ioIndex, p, len );
     ioIndex += len;
+#ifdef USING_BORROWED_QARRAY
     if ( a.shd->len < (uint)ioIndex )
 	a.shd->len = (uint)ioIndex;		// fake (not alloc'd) length
+#else
+    if ( a.size() < (uint)ioIndex )
+        a.resize(ioIndex);
+#endif
     return len;
 }
 
@@ -443,8 +457,13 @@ int QBuffer::putch( int ch )
 	    return -1;				// write error
     } else {
 	*(a.data() + ioIndex++) = (char)ch;
+#ifdef USING_BORROWED_QARRAY
 	if ( a.shd->len < (uint)ioIndex )
 	    a.shd->len = (uint)ioIndex;
+#else
+	if ( a.size () < (uint)ioIndex )
+	    a.resize ((uint)ioIndex);
+#endif 
     }
     return ch;
 }
diff --git a/WebCore/src/kwq/qt/_qfile.cpp b/WebCore/src/kwq/qt/_qfile.cpp
index 7d78a25..dbb8753 100644
--- a/WebCore/src/kwq/qt/_qfile.cpp
+++ b/WebCore/src/kwq/qt/_qfile.cpp
@@ -169,7 +169,11 @@ int QFile::readLine( QString& s, uint maxlen )
     QByteArray ba(maxlen);
     int l = readLine(ba.data(),maxlen);
     if ( l >= 0 ) {
+#ifdef USING_BORROWED_QARRAY
 	ba.truncate(l);
+#else
+	ba.resize(l);
+#endif
 	s = QString(ba);
     }
     return l;
diff --git a/WebCore/src/kwq/qt/_qgarray.h b/WebCore/src/kwq/qt/_qgarray.h
index 3157c89..e8e3316 100644
--- a/WebCore/src/kwq/qt/_qgarray.h
+++ b/WebCore/src/kwq/qt/_qgarray.h
@@ -15,9 +15,9 @@
 
 // KWQ hacks ---------------------------------------------------------------
 
-#ifndef USING_BORROWED_QARRAY
-#define USING_BORROWED_QARRAY
-#endif
+#include <config.h>
+
+#ifdef USING_BORROWED_QARRAY
 
 #include <KWQDef.h>
 
@@ -98,5 +98,6 @@ inline char *QGArray::at( uint index ) const
     return &shd->data[index];
 }
 
+#endif
 
 #endif 
diff --git a/WebCore/src/kwq/qt/_qstrlist.h b/WebCore/src/kwq/qt/_qstrlist.h
index 10ff372..83f88c0 100644
--- a/WebCore/src/kwq/qt/_qstrlist.h
+++ b/WebCore/src/kwq/qt/_qstrlist.h
@@ -44,9 +44,7 @@
 #include <config.h>
 #endif
 
-#ifndef USING_BORROWED_QSTRINGLIST
-#define USING_BORROWED_QSTRINGLIST
-#endif
+#ifdef USING_BORROWED_QSTRLIST
 
 #include <KWQDef.h>
 
@@ -130,5 +128,7 @@ inline QStrList::QStrList( const QStrList &strList )
     operator=(strList);
 }
 
+#endif
+
 
 #endif // QSTRLIST_H
diff --git a/WebCore/src/kwq/qt/qarray.h b/WebCore/src/kwq/qt/qarray.h
index 37ab082..26df905 100644
--- a/WebCore/src/kwq/qt/qarray.h
+++ b/WebCore/src/kwq/qt/qarray.h
@@ -37,6 +37,8 @@
 #else
 
 #include <KWQDef.h>
+#include <KWQArrayImpl.h>
+#include <iostream>
 
 // class QArray ================================================================
 
@@ -50,33 +52,57 @@ public:
     
     // constructors, copy constructors, and destructors ------------------------
 
-    QArray() {}
-    QArray(int);
-    QArray(const QArray<T> &);
+    QArray() : impl(sizeof(T)) {}
+    QArray(int i) : impl(sizeof(T),i) {}
+    QArray(const QArray<T> &a) : impl(a.impl) {}
     ~QArray() {}
     
     // member functions --------------------------------------------------------
 
-    T &at(uint) const;
-    T *data() const;
-    uint size() const;
-    uint count() const;
-    bool resize(uint size);
-    QArray<T>& duplicate(const T*, int);
-    bool fill(const T &, int size=-1);
+    T &at(uint u) const {return *(T *)impl.at(u); }
+    T *data() const { return (T *)impl.data(); }
+    uint size() const { return impl.size(); }
+    uint count() const { return size(); }
+    bool resize(uint size) { return impl.resize(size); }
+    QArray<T>& duplicate(const T *data, int size) { impl.duplicate(data, size); return *this; }
+    void detach() { duplicate(data(), size()); }
+    bool fill(const T &item, int size=-1) { return impl.fill(&item, size); }
+    QArray<T>& assign(const QArray<T> &a) { return *this = a; }
+
 
     // operators ---------------------------------------------------------------
 
-    QArray<T> &operator=(const QArray<T> &);    
-    T &operator[](int) const;
-    bool operator==(const QArray<T> &);    
-    bool operator!=(const QArray<T> &);    
+    QArray<T> &operator=(const QArray<T> &a) { impl = a.impl; return *this; }    
+    T &operator[](int i) const { return at(i); }
+    bool operator==(const QArray<T> &a) const { return impl == a.impl; }
+    bool operator!=(const QArray<T> &a) const { return !(*this == a); }    
+    operator const T*() const { return data(); }
 
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
+ private:
+    KWQArrayImpl impl;
 
 }; // class QArray =============================================================
 
+#ifdef _KWQ_IOSTREAM_
+template<class T>
+inline ostream &operator<<(ostream &stream, const QArray<T>&a)
+{
+    stream << "QArray: [size: " << a.size() << "; items: ";
+    for (unsigned i = 0; i < a.size(); i++) {
+        stream << a[i];
+	if (i < a.size() - 1) {
+	    stream << ", ";
+	}
+    }
+    stream << "]";
+
+    return stream;
+}
+#endif
+
 #endif // USING_BORROWED_QARRAY
 
 #endif
+
diff --git a/WebCore/src/kwq/qt/qbuffer.h b/WebCore/src/kwq/qt/qbuffer.h
index d0ff927..f7dc289 100644
--- a/WebCore/src/kwq/qt/qbuffer.h
+++ b/WebCore/src/kwq/qt/qbuffer.h
@@ -38,8 +38,9 @@
 
 #include <KWQDef.h>
 
-#include "qarray.h"
-#include "qstring.h"
+#include <qarray.h>
+#include <qstring.h>
+#include <qiodevice.h>
 
 // class QBuffer ===============================================================
 
@@ -76,6 +77,9 @@ private:
     QBuffer(const QBuffer &);
     QBuffer &operator=(const QBuffer &);
 
+    bool opened;
+    QByteArray ba;
+    uint pos;
 }; // class QBuffer ============================================================
 
 #endif // USING_BORROWED_QBUFFER
diff --git a/WebCore/src/kwq/qt/qiodevice.h b/WebCore/src/kwq/qt/qiodevice.h
new file mode 100644
index 0000000..dbc0d20
--- /dev/null
+++ b/WebCore/src/kwq/qt/qiodevice.h
@@ -0,0 +1,6 @@
+#ifndef QIODEVICE_H_
+#define QIODEVICE_H_
+
+#define IO_WriteOnly		0x0002		// writable device
+
+#endif
diff --git a/WebCore/src/kwq/qt/qstack.h b/WebCore/src/kwq/qt/qstack.h
index 247832b..2a72bf2 100644
--- a/WebCore/src/kwq/qt/qstack.h
+++ b/WebCore/src/kwq/qt/qstack.h
@@ -36,6 +36,8 @@
 #include <_qstack.h>
 #else
 
+#include <qlist.h>
+
 // class QStack ================================================================
 
 template<class T> class QStack {
@@ -47,25 +49,51 @@ public:
     // static member functions -------------------------------------------------
     // constructors, copy constructors, and destructors ------------------------
 
-    QStack();
-    QStack(const QStack<T> &);
-    ~QStack();
+    QStack() : list() {}
+    QStack(const QStack<T> &s) : list(s.list) {}
+    ~QStack() {}
 
     // member functions --------------------------------------------------------
 
-    bool isEmpty() const;
-    void push(const T *);
-    T *pop();
+    bool isEmpty() const { return list.isEmpty(); }
+    void push(const T *item) { list.append (item); }
+    T *pop() { T *tmp = list.getLast(); list.removeLast(); return tmp; }
+    uint count() const { return list.count(); }
 
     // operators ---------------------------------------------------------------
 
-    QStack<T> &operator=(const QStack<T> &);
+    QStack<T> &operator=(const QStack<T> &s) { list = s.list; return *this; }
 
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
+ private:
+    QList<T> list;
 
 }; // class QStack =============================================================
 
+#ifdef _KWQ_IOSTREAM_
+template<class T>
+inline ostream &operator<<(ostream &stream, const QStack<T>&s)
+{
+    stream << "QStack: [size: " << s.count() << "; items: ";
+
+    QStack<T> tmp(s);
+
+    while (!tmp.isEmpty()) {
+        stream << *tmp.pop();
+	if (tmp.count() > 0) {
+	    stream << ", ";
+	}
+    }
+
+    stream << "]";
+
+    return stream;
+}
+
+
+#endif
+
 #endif // USING_BORROWED_QSTACK
 
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list