diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-04 08:33:52 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-04 09:02:17 (GMT) |
commit | 4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1 (patch) | |
tree | b34985c5716d98f01b9f36fd4a98f2ac9710099f /src/testlib | |
parent | a0df97c03f26a38af17a42fb44ad6910536c8857 (diff) | |
parent | 2076f150995e541308b1d8da936b3e12ab68b886 (diff) | |
download | Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.zip Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.tar.gz Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.tar.bz2 |
Merge commit 'qt/master-stable'
Conflicts:
config.tests/unix/openssl/openssl.pri
demos/embedded/embedded.pro
examples/itemviews/chart/chart.pro
examples/network/network.pro
examples/painting/painterpaths/painterpaths.pro
examples/threads/mandelbrot/mandelbrot.pro
qmake/project.cpp
src/3rdparty/libtiff/libtiff/tif_config.h
src/corelib/arch/arch.pri
src/corelib/global/qglobal.cpp
src/corelib/kernel/kernel.pri
src/corelib/kernel/qcore_unix_p.h
src/corelib/kernel/qobject.cpp
src/corelib/thread/qthread_unix.cpp
src/corelib/tools/qsharedpointer_impl.h
src/corelib/tools/tools.pri
src/gui/kernel/qaction.h
src/gui/kernel/qapplication.cpp
src/gui/painting/qregion.h
src/gui/widgets/qlineedit.cpp
src/gui/widgets/qlineedit_p.h
src/network/socket/qnativesocketengine_unix.cpp
tests/auto/qdir/tst_qdir.cpp
tests/auto/qdiriterator/tst_qdiriterator.cpp
tests/auto/qhttp/qhttp.pro
tests/auto/qline/qline.pro
tests/auto/qnetworkreply/tst_qnetworkreply.cpp
tests/auto/qresourceengine/qresourceengine.pro
tests/auto/qsharedpointer/qsharedpointer.pro
tests/auto/qstring/qstring.pro
tests/auto/qtcpsocket/qtcpsocket.pro
tests/auto/qtcpsocket/tst_qtcpsocket.cpp
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qabstracttestlogger_p.h | 36 | ||||
-rw-r--r-- | src/testlib/qplaintestlogger.cpp | 8 | ||||
-rw-r--r-- | src/testlib/qtest_global.h | 1 | ||||
-rw-r--r-- | src/testlib/qtestbasicstreamer.cpp | 24 | ||||
-rw-r--r-- | src/testlib/qtestbasicstreamer.h | 10 | ||||
-rw-r--r-- | src/testlib/qtestcase.cpp | 62 | ||||
-rw-r--r-- | src/testlib/qtestlightxmlstreamer.cpp | 93 | ||||
-rw-r--r-- | src/testlib/qtestlightxmlstreamer.h | 6 | ||||
-rw-r--r-- | src/testlib/qtestxmlstreamer.cpp | 119 | ||||
-rw-r--r-- | src/testlib/qtestxmlstreamer.h | 6 | ||||
-rw-r--r-- | src/testlib/qtestxunitstreamer.cpp | 42 | ||||
-rw-r--r-- | src/testlib/qtestxunitstreamer.h | 8 | ||||
-rw-r--r-- | src/testlib/qxmltestlogger.cpp | 187 | ||||
-rw-r--r-- | src/testlib/qxmltestlogger_p.h | 6 |
14 files changed, 364 insertions, 244 deletions
diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h index a0e8a1e..588184e 100644 --- a/src/testlib/qabstracttestlogger_p.h +++ b/src/testlib/qabstracttestlogger_p.h @@ -99,6 +99,42 @@ public: static bool isTtyOutput(); }; +struct QTestCharBuffer +{ + inline QTestCharBuffer() + : buf(0) + {} + + inline ~QTestCharBuffer() + { + delete[] buf; + buf = 0; + } + + inline operator void*() + { + return buf; + } + + inline operator char*() + { + return buf; + } + + inline operator char**() + { + return &buf; + } + + inline const char* constData() const + { + return buf; + } + +private: + char* buf; +}; + QT_END_NAMESPACE #endif diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 3560331..db221dd 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -178,7 +178,7 @@ namespace QTest { QTEST_ASSERT(type); QTEST_ASSERT(msg); - char buf[1024]; + QTestCharBuffer buf; const char *fn = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction() : "UnknownTestFunc"; @@ -188,7 +188,7 @@ namespace QTest { : ""; const char *filler = (tag[0] && gtag[0]) ? ":" : ""; if (file) { - QTest::qt_snprintf(buf, sizeof(buf), "%s: %s::%s(%s%s%s)%s%s\n" + QTest::qt_asprintf(buf, "%s: %s::%s(%s%s%s)%s%s\n" #ifdef Q_OS_WIN "%s(%d) : failure location\n" #else @@ -197,10 +197,12 @@ namespace QTest { , type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag, msg[0] ? " " : "", msg, file, line); } else { - QTest::qt_snprintf(buf, sizeof(buf), "%s: %s::%s(%s%s%s)%s%s\n", + QTest::qt_asprintf(buf, "%s: %s::%s(%s%s%s)%s%s\n", type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag, msg[0] ? " " : "", msg); } + // In colored mode, printf above stripped our nonprintable control characters. + // Put them back. memcpy(buf, type, strlen(type)); outputMessage(buf); } diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h index 5bb2e43..24dae2e 100644 --- a/src/testlib/qtest_global.h +++ b/src/testlib/qtest_global.h @@ -83,6 +83,7 @@ namespace QTest enum TestFailMode { Abort = 1, Continue = 2 }; int Q_TESTLIB_EXPORT qt_snprintf(char *str, int size, const char *format, ...); + int qt_asprintf(char **str, const char *format, ...); } QT_END_NAMESPACE diff --git a/src/testlib/qtestbasicstreamer.cpp b/src/testlib/qtestbasicstreamer.cpp index 5fe9d4d..aac57ba 100644 --- a/src/testlib/qtestbasicstreamer.cpp +++ b/src/testlib/qtestbasicstreamer.cpp @@ -68,39 +68,39 @@ QTestBasicStreamer::QTestBasicStreamer() QTestBasicStreamer::~QTestBasicStreamer() {} -void QTestBasicStreamer::formatStart(const QTestElement *element, char *formatted) const +void QTestBasicStreamer::formatStart(const QTestElement *element, char **formatted) const { if(!element || !formatted ) return; - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } -void QTestBasicStreamer::formatEnd(const QTestElement *element, char *formatted) const +void QTestBasicStreamer::formatEnd(const QTestElement *element, char **formatted) const { if(!element || !formatted ) return; - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } -void QTestBasicStreamer::formatBeforeAttributes(const QTestElement *element, char *formatted) const +void QTestBasicStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const { if(!element || !formatted ) return; - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } -void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, char *formatted) const +void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, char **formatted) const { if(!element || !formatted ) return; - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } -void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, char *formatted) const +void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, char **formatted) const { if(!attribute || !formatted ) return; - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } void QTestBasicStreamer::output(QTestElement *element) const @@ -113,7 +113,7 @@ void QTestBasicStreamer::output(QTestElement *element) const void QTestBasicStreamer::outputElements(QTestElement *element, bool) const { - char buf[1024]; + QTestCharBuffer buf; bool hasChildren; /* Elements are in reverse order of occurrence, so start from the end and work @@ -148,7 +148,7 @@ void QTestBasicStreamer::outputElements(QTestElement *element, bool) const void QTestBasicStreamer::outputElementAttributes(const QTestElement* element, QTestElementAttribute *attribute) const { - char buf[1024]; + QTestCharBuffer buf; while(attribute){ formatAttributes(element, attribute, buf); outputString(buf); diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h index 84d1bce..432dd22 100644 --- a/src/testlib/qtestbasicstreamer.h +++ b/src/testlib/qtestbasicstreamer.h @@ -71,11 +71,11 @@ class QTestBasicStreamer const QTestLogger *logger() const; protected: - virtual void formatStart(const QTestElement *element = 0, char *formatted = 0) const; - virtual void formatEnd(const QTestElement *element = 0, char *formatted = 0) const; - virtual void formatBeforeAttributes(const QTestElement *element = 0, char *formatted = 0) const; - virtual void formatAfterAttributes(const QTestElement *element = 0, char *formatted = 0) const; - virtual void formatAttributes(const QTestElement *element = 0, const QTestElementAttribute *attribute = 0, char *formatted = 0) const; + virtual void formatStart(const QTestElement *element, char **formatted) const; + virtual void formatEnd(const QTestElement *element, char **formatted) const; + virtual void formatBeforeAttributes(const QTestElement *element, char **formatted) const; + virtual void formatAfterAttributes(const QTestElement *element, char **formatted) const; + virtual void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, char **formatted) const; virtual void outputElements(QTestElement *element, bool isChildElement = false) const; virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const; diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index e2e385a..e6508f2 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -690,6 +690,13 @@ QT_BEGIN_NAMESPACE Returns a textual representation of the given \a rectangle. */ +/*! + \fn char *QTest::toString(const QVariant &variant) + \overload + + Returns a textual representation of the given \a variant. +*/ + /*! \fn void QTest::qWait(int ms) Waits for \a ms milliseconds. While waiting, events will be processed and @@ -806,6 +813,53 @@ namespace QTest static int eventDelay = -1; static int keyVerbose = -1; +void filter_unprintable(char *str) +{ + char *idx = str; + while (*idx) { + if (((*idx < 0x20 && *idx != '\n' && *idx != '\t') || *idx > 0x7e)) + *idx = '?'; + ++idx; + } +} + +/*! \internal + */ +int qt_asprintf(char **str, const char *format, ...) +{ + static const int MAXSIZE = 1024*1024*2; + + int size = 32; + delete[] *str; + *str = new char[size]; + + va_list ap; + int res = 0; + + for (;;) { + va_start(ap, format); + res = qvsnprintf(*str, size, format, ap); + va_end(ap); + (*str)[size - 1] = '\0'; + if (res >= 0 && res < size) { + // We succeeded + break; + } + // buffer wasn't big enough, try again. + // Note, we're assuming that a result of -1 is always due to running out of space. + size *= 2; + if (size > MAXSIZE) { + break; + } + delete[] *str; + *str = new char[size]; + } + + filter_unprintable(*str); + + return res; +} + /*! \internal */ int qt_snprintf(char *str, int size, const char *format, ...) @@ -818,12 +872,8 @@ int qt_snprintf(char *str, int size, const char *format, ...) va_end(ap); str[size - 1] = '\0'; - char *idx = str; - while (*idx) { - if (((*idx < 0x20 && *idx != '\n' && *idx != '\t') || *idx > 0x7e)) - *idx = '?'; - ++idx; - } + filter_unprintable(str); + return res; } diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp index 170938a..e176201 100644 --- a/src/testlib/qtestlightxmlstreamer.cpp +++ b/src/testlib/qtestlightxmlstreamer.cpp @@ -59,61 +59,55 @@ QTestLightXmlStreamer::QTestLightXmlStreamer() QTestLightXmlStreamer::~QTestLightXmlStreamer() {} -void QTestLightXmlStreamer::formatStart(const QTestElement *element, char *formatted) const +void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **formatted) const { if(!element || !formatted) return; switch(element->elementType()){ case QTest::LET_TestCase: { - char quotedTf[950]; - QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name), - sizeof(quotedTf)); + QTestCharBuffer quotedTf; + QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name)); - QTest::qt_snprintf(formatted, 1024, "<TestFunction name=\"%s\">\n", quotedTf); + QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData()); break; } case QTest::LET_Failure: { - char cdataDesc[900]; - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description), - sizeof(cdataDesc)); + QTestCharBuffer cdataDesc; + QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); - QTest::qt_snprintf(formatted, 1024, " <Description><![CDATA[%s]]></Description>\n", - cdataDesc); + QTest::qt_asprintf(formatted, " <Description><![CDATA[%s]]></Description>\n", + cdataDesc.constData()); break; } case QTest::LET_Error: { // assuming type and attribute names don't need quoting - char quotedFile[128]; - char cdataDesc[700]; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File), - sizeof(quotedFile)); - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description), - sizeof(cdataDesc)); - - QTest::qt_snprintf(formatted, 1024, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", + QTestCharBuffer quotedFile; + QTestCharBuffer cdataDesc; + QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); + QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); + + QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", element->attributeValue(QTest::AI_Type), element->attributeName(QTest::AI_File), - quotedFile, + quotedFile.constData(), element->attributeName(QTest::AI_Line), element->attributeValue(QTest::AI_Line), - cdataDesc); + cdataDesc.constData()); break; } case QTest::LET_Benchmark: { // assuming value and iterations don't need quoting - char quotedMetric[256]; - char quotedTag[256]; - QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric), - sizeof(quotedMetric)); - QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag), - sizeof(quotedTag)); - - QTest::qt_snprintf(formatted, 1024, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", + QTestCharBuffer quotedMetric; + QTestCharBuffer quotedTag; + QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric)); + QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag)); + + QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", element->attributeName(QTest::AI_Metric), - quotedMetric, + quotedMetric.constData(), element->attributeName(QTest::AI_Tag), - quotedTag, + quotedTag.constData(), element->attributeName(QTest::AI_Value), element->attributeValue(QTest::AI_Value), element->attributeName(QTest::AI_Iterations), @@ -121,61 +115,60 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char *forma break; } default: - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } } -void QTestLightXmlStreamer::formatEnd(const QTestElement *element, char *formatted) const +void QTestLightXmlStreamer::formatEnd(const QTestElement *element, char **formatted) const { if(!element || !formatted) return; if (element->elementType() == QTest::LET_TestCase) { if( element->attribute(QTest::AI_Result) && element->childElements()) - QTest::qt_snprintf(formatted, 1024, "</Incident>\n</TestFunction>\n"); + QTest::qt_asprintf(formatted, "</Incident>\n</TestFunction>\n"); else - QTest::qt_snprintf(formatted, 1024, "</TestFunction>\n"); + QTest::qt_asprintf(formatted, "</TestFunction>\n"); } else - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } -void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, char *formatted) const +void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const { if(!element || !formatted) return; if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)){ - char buf[900]; - char quotedFile[700]; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File), - sizeof(quotedFile)); + QTestCharBuffer buf; + QTestCharBuffer quotedFile; + QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); - QTest::qt_snprintf(buf, sizeof(buf), "%s=\"%s\" %s=\"%s\"", + QTest::qt_asprintf(buf, "%s=\"%s\" %s=\"%s\"", element->attributeName(QTest::AI_File), - quotedFile, + quotedFile.constData(), element->attributeName(QTest::AI_Line), element->attributeValue(QTest::AI_Line)); if( !element->childElements() ) - QTest::qt_snprintf(formatted, 1024, "<Incident type=\"%s\" %s/>\n", - element->attributeValue(QTest::AI_Result), buf); + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", + element->attributeValue(QTest::AI_Result), buf.constData()); else - QTest::qt_snprintf(formatted, 1024, "<Incident type=\"%s\" %s>\n", - element->attributeValue(QTest::AI_Result), buf); + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n", + element->attributeValue(QTest::AI_Result), buf.constData()); }else{ - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } } void QTestLightXmlStreamer::output(QTestElement *element) const { - char buf[1024]; - QTest::qt_snprintf(buf, sizeof(buf), "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", + QTestCharBuffer buf; + QTest::qt_asprintf(buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", qVersion(), QTEST_VERSION_STR ); outputString(buf); - QTest::qt_snprintf(buf, sizeof(buf), "</Environment>\n"); + QTest::qt_asprintf(buf, "</Environment>\n"); outputString(buf); QTestBasicStreamer::output(element); diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h index 5a16327..6dafdcc 100644 --- a/src/testlib/qtestlightxmlstreamer.h +++ b/src/testlib/qtestlightxmlstreamer.h @@ -59,9 +59,9 @@ class QTestLightXmlStreamer: public QTestBasicStreamer QTestLightXmlStreamer(); ~QTestLightXmlStreamer(); - void formatStart(const QTestElement *element = 0, char *formatted = 0) const; - void formatEnd(const QTestElement *element = 0, char *formatted = 0) const; - void formatBeforeAttributes(const QTestElement *element = 0, char *formatted = 0) const; + void formatStart(const QTestElement *element, char **formatted) const; + void formatEnd(const QTestElement *element, char **formatted) const; + void formatBeforeAttributes(const QTestElement *element, char **formatted) const; void output(QTestElement *element) const; }; diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp index 5172bcd..1b6e674 100644 --- a/src/testlib/qtestxmlstreamer.cpp +++ b/src/testlib/qtestxmlstreamer.cpp @@ -60,86 +60,78 @@ QTestXmlStreamer::QTestXmlStreamer() QTestXmlStreamer::~QTestXmlStreamer() {} -void QTestXmlStreamer::formatStart(const QTestElement *element, char *formatted) const +void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted) const { if(!element || !formatted) return; switch(element->elementType()){ case QTest::LET_TestCase: { - char quotedTf[950]; - QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name), - sizeof(quotedTf)); + QTestCharBuffer quotedTf; + QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name)); - QTest::qt_snprintf(formatted, 1024, "<TestFunction name=\"%s\">\n", quotedTf); + QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData()); break; } case QTest::LET_Failure: { - char cdataDesc[800]; - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description), - sizeof(cdataDesc)); + QTestCharBuffer cdataDesc; + QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); - char location[100]; - char quotedFile[70]; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File), - sizeof(quotedFile)); + QTestCharBuffer location; + QTestCharBuffer quotedFile; + QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); - QTest::qt_snprintf(location, sizeof(location), "%s=\"%s\" %s=\"%s\"", + QTest::qt_asprintf(location, "%s=\"%s\" %s=\"%s\"", element->attributeName(QTest::AI_File), - quotedFile, + quotedFile.constData(), element->attributeName(QTest::AI_Line), element->attributeValue(QTest::AI_Line)); if (element->attribute(QTest::AI_Tag)) { - char cdataTag[100]; - QXmlTestLogger::xmlCdata(cdataTag, element->attributeValue(QTest::AI_Tag), - sizeof(cdataTag)); - QTest::qt_snprintf(formatted, 1024, "<Incident type=\"%s\" %s>\n" + QTestCharBuffer cdataTag; + QXmlTestLogger::xmlCdata(cdataTag, element->attributeValue(QTest::AI_Tag)); + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n" " <DataTag><![CDATA[%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Incident>\n", element->attributeValue(QTest::AI_Result), - location, cdataTag, cdataDesc); + location.constData(), cdataTag.constData(), cdataDesc.constData()); } else { - QTest::qt_snprintf(formatted, 1024, "<Incident type=\"%s\" %s>\n" + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n" " <Description><![CDATA[%s]]></Description>\n" "</Incident>\n", element->attributeValue(QTest::AI_Result), - location, cdataDesc); + location.constData(), cdataDesc.constData()); } break; } case QTest::LET_Error: { // assuming type and attribute names don't need quoting - char quotedFile[128]; - char cdataDesc[700]; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File), - sizeof(quotedFile)); - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description), - sizeof(cdataDesc)); - - QTest::qt_snprintf(formatted, 1024, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", + QTestCharBuffer quotedFile; + QTestCharBuffer cdataDesc; + QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); + QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); + + QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", element->attributeValue(QTest::AI_Type), element->attributeName(QTest::AI_File), - quotedFile, + quotedFile.constData(), element->attributeName(QTest::AI_Line), element->attributeValue(QTest::AI_Line), - cdataDesc); + cdataDesc.constData()); break; } case QTest::LET_Benchmark: { // assuming value and iterations don't need quoting - char quotedMetric[256]; - char quotedTag[256]; - QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric), - sizeof(quotedMetric)); - QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag), - sizeof(quotedTag)); - - QTest::qt_snprintf(formatted, 1024, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", + QTestCharBuffer quotedMetric; + QTestCharBuffer quotedTag; + QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric)); + QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag)); + + QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", element->attributeName(QTest::AI_Metric), - quotedMetric, + quotedMetric.constData(), element->attributeName(QTest::AI_Tag), - quotedTag, + quotedTag.constData(), element->attributeName(QTest::AI_Value), element->attributeValue(QTest::AI_Value), element->attributeName(QTest::AI_Iterations), @@ -147,71 +139,70 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char *formatted) break; } default: - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } } -void QTestXmlStreamer::formatEnd(const QTestElement *element, char *formatted) const +void QTestXmlStreamer::formatEnd(const QTestElement *element, char **formatted) const { if(!element || !formatted) return; if (element->elementType() == QTest::LET_TestCase) { - QTest::qt_snprintf(formatted, 1024, "</TestFunction>\n"); + QTest::qt_asprintf(formatted, "</TestFunction>\n"); } else - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } -void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, char *formatted) const +void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const { if(!element || !formatted) return; if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)){ - char buf[900]; - char quotedFile[700]; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File), - sizeof(quotedFile)); + QTestCharBuffer buf; + QTestCharBuffer quotedFile; + QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); - QTest::qt_snprintf(buf, sizeof(buf), "%s=\"%s\" %s=\"%s\"", + QTest::qt_asprintf(buf, "%s=\"%s\" %s=\"%s\"", element->attributeName(QTest::AI_File), - quotedFile, + quotedFile.constData(), element->attributeName(QTest::AI_Line), element->attributeValue(QTest::AI_Line)); if( !element->childElements() ) { - QTest::qt_snprintf(formatted, 1024, "<Incident type=\"%s\" %s/>\n", - element->attributeValue(QTest::AI_Result), buf); + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", + element->attributeValue(QTest::AI_Result), buf.constData()); } else { - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } }else{ - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } } void QTestXmlStreamer::output(QTestElement *element) const { - char buf[1024]; - char quotedTc[800]; - QXmlTestLogger::xmlQuote(quotedTc, QTestResult::currentTestObjectName(), sizeof(quotedTc)); + QTestCharBuffer buf; + QTestCharBuffer quotedTc; + QXmlTestLogger::xmlQuote(quotedTc, QTestResult::currentTestObjectName()); - QTest::qt_snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<TestCase name=\"%s\">\n", - quotedTc); + QTest::qt_asprintf(buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<TestCase name=\"%s\">\n", + quotedTc.constData()); outputString(buf); - QTest::qt_snprintf(buf, sizeof(buf), "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", + QTest::qt_asprintf(buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", qVersion(), QTEST_VERSION_STR ); outputString(buf); - QTest::qt_snprintf(buf, sizeof(buf), "</Environment>\n"); + QTest::qt_asprintf(buf, "</Environment>\n"); outputString(buf); QTestBasicStreamer::output(element); - QTest::qt_snprintf(buf, sizeof(buf), "</TestCase>\n"); + QTest::qt_asprintf(buf, "</TestCase>\n"); outputString(buf); } diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h index 3cb1c60..a601f60 100644 --- a/src/testlib/qtestxmlstreamer.h +++ b/src/testlib/qtestxmlstreamer.h @@ -59,9 +59,9 @@ class QTestXmlStreamer: public QTestBasicStreamer QTestXmlStreamer(); ~QTestXmlStreamer(); - void formatStart(const QTestElement *element = 0, char *formatted = 0) const; - void formatEnd(const QTestElement *element = 0, char *formatted = 0) const; - void formatBeforeAttributes(const QTestElement *element = 0, char *formatted = 0) const; + void formatStart(const QTestElement *element, char **formatted) const; + void formatEnd(const QTestElement *element, char **formatted) const; + void formatBeforeAttributes(const QTestElement *element, char **formatted) const; void output(QTestElement *element) const; }; diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp index 6690cec..d5d2631 100644 --- a/src/testlib/qtestxunitstreamer.cpp +++ b/src/testlib/qtestxunitstreamer.cpp @@ -73,7 +73,7 @@ void QTestXunitStreamer::indentForElement(const QTestElement* element, char* buf } } -void QTestXunitStreamer::formatStart(const QTestElement *element, char *formatted) const +void QTestXunitStreamer::formatStart(const QTestElement *element, char **formatted) const { if(!element || !formatted ) return; @@ -84,34 +84,34 @@ void QTestXunitStreamer::formatStart(const QTestElement *element, char *formatte // Errors are written as CDATA within system-err, comments elsewhere if (element->elementType() == QTest::LET_Error) { if (element->parentElement()->elementType() == QTest::LET_SystemError) { - QTest::qt_snprintf(formatted, 1024, "<![CDATA["); + QTest::qt_asprintf(formatted, "<![CDATA["); } else { - QTest::qt_snprintf(formatted, 1024, "%s<!--", indent); + QTest::qt_asprintf(formatted, "%s<!--", indent); } return; } - QTest::qt_snprintf(formatted, 1024, "%s<%s", indent, element->elementName()); + QTest::qt_asprintf(formatted, "%s<%s", indent, element->elementName()); } -void QTestXunitStreamer::formatEnd(const QTestElement *element, char *formatted) const +void QTestXunitStreamer::formatEnd(const QTestElement *element, char **formatted) const { if(!element || !formatted ) return; if(!element->childElements()){ - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); return; } char indent[20]; indentForElement(element, indent, sizeof(indent)); - QTest::qt_snprintf(formatted, 1024, "%s</%s>\n", indent, element->elementName()); + QTest::qt_asprintf(formatted, "%s</%s>\n", indent, element->elementName()); } -void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, char *formatted) const +void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, char **formatted) const { if(!attribute || !formatted ) return; @@ -124,7 +124,7 @@ void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTe if (attrindex != QTest::AI_Description) return; - QXmlTestLogger::xmlCdata(formatted, attribute->value(), 1024); + QXmlTestLogger::xmlCdata(formatted, attribute->value()); return; } @@ -135,16 +135,16 @@ void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTe key = attribute->name(); if (key) { - char quotedValue[900]; - QXmlTestLogger::xmlQuote(quotedValue, attribute->value(), sizeof(quotedValue)); - QTest::qt_snprintf(formatted, 1024, " %s=\"%s\"", key, quotedValue); + QTestCharBuffer quotedValue; + QXmlTestLogger::xmlQuote(quotedValue, attribute->value()); + QTest::qt_asprintf(formatted, " %s=\"%s\"", key, quotedValue.constData()); } else { - QTest::qt_snprintf(formatted, 10, ""); + QTest::qt_asprintf(formatted, ""); } } -void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char *formatted) const +void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char **formatted) const { if(!element || !formatted ) return; @@ -152,31 +152,29 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char // Errors are written as CDATA within system-err, comments elsewhere if (element->elementType() == QTest::LET_Error) { if (element->parentElement()->elementType() == QTest::LET_SystemError) { - QTest::qt_snprintf(formatted, 1024, "]]>\n"); + QTest::qt_asprintf(formatted, "]]>\n"); } else { - QTest::qt_snprintf(formatted, 1024, " -->\n"); + QTest::qt_asprintf(formatted, " -->\n"); } return; } if(!element->childElements()) - QTest::qt_snprintf(formatted, 10, "/>\n"); + QTest::qt_asprintf(formatted, "/>\n"); else - QTest::qt_snprintf(formatted, 10, ">\n"); + QTest::qt_asprintf(formatted, ">\n"); } void QTestXunitStreamer::output(QTestElement *element) const { - char buf[1024]; - QTest::qt_snprintf(buf, sizeof(buf), "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); - outputString(buf); + outputString("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); QTestBasicStreamer::output(element); } void QTestXunitStreamer::outputElements(QTestElement *element, bool) const { - char buf[1024]; + QTestCharBuffer buf; bool hasChildren; /* Elements are in reverse order of occurrence, so start from the end and work diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h index 9817fd3..044307f 100644 --- a/src/testlib/qtestxunitstreamer.h +++ b/src/testlib/qtestxunitstreamer.h @@ -58,10 +58,10 @@ class QTestXunitStreamer: public QTestBasicStreamer QTestXunitStreamer(); ~QTestXunitStreamer(); - void formatStart(const QTestElement *element = 0, char *formatted = 0) const; - void formatEnd(const QTestElement *element = 0, char *formatted = 0) const; - void formatAfterAttributes(const QTestElement *element = 0, char *formatted = 0) const; - void formatAttributes(const QTestElement *element = 0, const QTestElementAttribute *attribute = 0, char *formatted = 0) const; + void formatStart(const QTestElement *element, char **formatted) const; + void formatEnd(const QTestElement *element, char **formatted) const; + void formatAfterAttributes(const QTestElement *element, char **formatted) const; + void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, char **formatted) const; void output(QTestElement *element) const; void outputElements(QTestElement *element, bool isChildElement = false) const; diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index 85eb0dd..fca7bfc 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -104,18 +104,18 @@ QXmlTestLogger::~QXmlTestLogger() void QXmlTestLogger::startLogging() { QAbstractTestLogger::startLogging(); - char buf[1024]; + QTestCharBuffer buf; if (xmlmode == QXmlTestLogger::Complete) { - char quotedTc[900]; - xmlQuote(quotedTc, QTestResult::currentTestObjectName(), sizeof(quotedTc)); - QTest::qt_snprintf(buf, sizeof(buf), + QTestCharBuffer quotedTc; + xmlQuote(quotedTc, QTestResult::currentTestObjectName()); + QTest::qt_asprintf(buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" - "<TestCase name=\"%s\">\n", quotedTc); + "<TestCase name=\"%s\">\n", quotedTc.constData()); outputString(buf); } - QTest::qt_snprintf(buf, sizeof(buf), + QTest::qt_asprintf(buf, "<Environment>\n" " <QtVersion>%s</QtVersion>\n" " <QTestVersion>"QTEST_VERSION_STR"</QTestVersion>\n" @@ -134,10 +134,10 @@ void QXmlTestLogger::stopLogging() void QXmlTestLogger::enterTestFunction(const char *function) { - char buf[1024]; - char quotedFunction[950]; - xmlQuote(quotedFunction, function, sizeof(quotedFunction)); - QTest::qt_snprintf(buf, sizeof(buf), "<TestFunction name=\"%s\">\n", quotedFunction); + QTestCharBuffer buf; + QTestCharBuffer quotedFunction; + xmlQuote(quotedFunction, function); + QTest::qt_asprintf(buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData()); outputString(buf); } @@ -208,51 +208,49 @@ static const char *messageFormatString(bool noDescription, bool noTag) void QXmlTestLogger::addIncident(IncidentTypes type, const char *description, const char *file, int line) { - // buffer must be large enough to hold all quoted/cdata buffers plus the format string itself - char buf[5000]; + QTestCharBuffer buf; const char *tag = QTestResult::currentDataTag(); const char *gtag = QTestResult::currentGlobalDataTag(); const char *filler = (tag && gtag) ? ":" : ""; const bool notag = QTest::isEmpty(tag) && QTest::isEmpty(gtag); - char quotedFile[1024]; - char cdataGtag[1024]; - char cdataTag[1024]; - char cdataDescription[1024]; + QTestCharBuffer quotedFile; + QTestCharBuffer cdataGtag; + QTestCharBuffer cdataTag; + QTestCharBuffer cdataDescription; - xmlQuote(quotedFile, file, sizeof(quotedFile)); - xmlCdata(cdataGtag, gtag, sizeof(cdataGtag)); - xmlCdata(cdataTag, tag, sizeof(cdataTag)); - xmlCdata(cdataDescription, description, sizeof(cdataDescription)); + xmlQuote(quotedFile, file); + xmlCdata(cdataGtag, gtag); + xmlCdata(cdataTag, tag); + xmlCdata(cdataDescription, description); - QTest::qt_snprintf(buf, sizeof(buf), + QTest::qt_asprintf(buf, QTest::incidentFormatString(QTest::isEmpty(description), notag), QTest::xmlIncidentType2String(type), - quotedFile, line, - cdataGtag, + quotedFile.constData(), line, + cdataGtag.constData(), filler, - cdataTag, - cdataDescription); + cdataTag.constData(), + cdataDescription.constData()); outputString(buf); } void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result) { - char buf[1536]; - char quotedMetric[64]; - char quotedTag[1024]; + QTestCharBuffer buf; + QTestCharBuffer quotedMetric; + QTestCharBuffer quotedTag; xmlQuote(quotedMetric, - QBenchmarkGlobalData::current->measurer->metricText().toAscii().constData(), - sizeof(quotedMetric)); - xmlQuote(quotedTag, result.context.tag.toAscii().constData(), sizeof(quotedTag)); + QBenchmarkGlobalData::current->measurer->metricText().toAscii().constData()); + xmlQuote(quotedTag, result.context.tag.toAscii().constData()); - QTest::qt_snprintf( - buf, sizeof(buf), + QTest::qt_asprintf( + buf, QTest::benchmarkResultFormatString(), - quotedMetric, - quotedTag, + quotedMetric.constData(), + quotedTag.constData(), QByteArray::number(result.value).constData(), //no 64-bit qt_snprintf support result.iterations); outputString(buf); @@ -261,30 +259,30 @@ void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result) void QXmlTestLogger::addMessage(MessageTypes type, const char *message, const char *file, int line) { - char buf[5000]; + QTestCharBuffer buf; const char *tag = QTestResult::currentDataTag(); const char *gtag = QTestResult::currentGlobalDataTag(); const char *filler = (tag && gtag) ? ":" : ""; const bool notag = QTest::isEmpty(tag) && QTest::isEmpty(gtag); - char quotedFile[1024]; - char cdataGtag[1024]; - char cdataTag[1024]; - char cdataDescription[1024]; + QTestCharBuffer quotedFile; + QTestCharBuffer cdataGtag; + QTestCharBuffer cdataTag; + QTestCharBuffer cdataDescription; - xmlQuote(quotedFile, file, sizeof(quotedFile)); - xmlCdata(cdataGtag, gtag, sizeof(cdataGtag)); - xmlCdata(cdataTag, tag, sizeof(cdataTag)); - xmlCdata(cdataDescription, message, sizeof(cdataDescription)); + xmlQuote(quotedFile, file); + xmlCdata(cdataGtag, gtag); + xmlCdata(cdataTag, tag); + xmlCdata(cdataDescription, message); - QTest::qt_snprintf(buf, sizeof(buf), + QTest::qt_asprintf(buf, QTest::messageFormatString(QTest::isEmpty(message), notag), QTest::xmlMessageType2String(type), - quotedFile, line, - cdataGtag, + quotedFile.constData(), line, + cdataGtag.constData(), filler, - cdataTag, - cdataDescription); + cdataTag.constData(), + cdataDescription.constData()); outputString(buf); } @@ -294,29 +292,30 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message, XML characters as necessary so that dest is suitable for use in an XML quoted attribute string. */ -void QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n) +int QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n) { - if (n == 0) return; + if (n == 0) return 0; *dest = 0; - if (!src) return; + if (!src) return 0; + char* begin = dest; char* end = dest + n; while (dest < end) { switch (*src) { #define MAP_ENTITY(chr, ent) \ - case chr: \ - if (dest + sizeof(ent) < end) { \ - strcpy(dest, ent); \ - dest += sizeof(ent) - 1; \ - } \ - else { \ - *dest = 0; \ - return; \ - } \ - ++src; \ + case chr: \ + if (dest + sizeof(ent) < end) { \ + strcpy(dest, ent); \ + dest += sizeof(ent) - 1; \ + } \ + else { \ + *dest = 0; \ + return (dest+sizeof(ent)-begin); \ + } \ + ++src; \ break; MAP_ENTITY('>', ">"); @@ -333,7 +332,7 @@ void QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n) case 0: *dest = 0; - return; + return (dest-begin); default: *dest = *src; @@ -345,29 +344,31 @@ void QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n) // If we get here, dest was completely filled (dest == end) *(dest-1) = 0; + return (dest-begin); } /* Copy up to n characters from the src string into dest, escaping any special strings such that dest is suitable for use in an XML CDATA section. */ -void QXmlTestLogger::xmlCdata(char* dest, char const* src, size_t n) +int QXmlTestLogger::xmlCdata(char* dest, char const* src, size_t n) { - if (!n) return; + if (!n) return 0; if (!src || n == 1) { *dest = 0; - return; + return 0; } - char const CDATA_END[] = "]]>"; - char const CDATA_END_ESCAPED[] = "]]]><![CDATA[]>"; + static char const CDATA_END[] = "]]>"; + static char const CDATA_END_ESCAPED[] = "]]]><![CDATA[]>"; + char* begin = dest; char* end = dest + n; while (dest < end) { if (!*src) { *dest = 0; - return; + return (dest-begin); } if (!strncmp(src, CDATA_END, sizeof(CDATA_END)-1)) { @@ -378,7 +379,7 @@ void QXmlTestLogger::xmlCdata(char* dest, char const* src, size_t n) } else { *dest = 0; - return; + return (dest+sizeof(CDATA_END_ESCAPED)-begin); } continue; } @@ -390,6 +391,52 @@ void QXmlTestLogger::xmlCdata(char* dest, char const* src, size_t n) // If we get here, dest was completely filled (dest == end) *(dest-1) = 0; + return (dest-begin); +} + +typedef int (*StringFormatFunction)(char*,char const*,size_t); + +/* + A wrapper for string functions written to work with a fixed size buffer so they can be called + with a dynamically allocated buffer. +*/ +int allocateStringFn(char** str, char const* src, StringFormatFunction func) +{ + static const int MAXSIZE = 1024*1024*2; + + int size = 32; + delete[] *str; + *str = new char[size]; + + int res = 0; + + for (;;) { + res = func(*str, src, size); + (*str)[size - 1] = '\0'; + if (res < size) { + // We succeeded or fatally failed + break; + } + // buffer wasn't big enough, try again + size *= 2; + if (size > MAXSIZE) { + break; + } + delete[] *str; + *str = new char[size]; + } + + return res; +} + +int QXmlTestLogger::xmlQuote(char** str, char const* src) +{ + return allocateStringFn(str, src, QXmlTestLogger::xmlQuote); +} + +int QXmlTestLogger::xmlCdata(char** str, char const* src) +{ + return allocateStringFn(str, src, QXmlTestLogger::xmlCdata); } QT_END_NAMESPACE diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h index 526b471..a7cc00a 100644 --- a/src/testlib/qxmltestlogger_p.h +++ b/src/testlib/qxmltestlogger_p.h @@ -79,8 +79,10 @@ public: void addMessage(MessageTypes type, const char *message, const char *file = 0, int line = 0); - static void xmlCdata(char* dest, char const* src, size_t n); - static void xmlQuote(char* dest, char const* src, size_t n); + static int xmlCdata(char** dest, char const* src); + static int xmlQuote(char** dest, char const* src); + static int xmlCdata(char* dest, char const* src, size_t n); + static int xmlQuote(char* dest, char const* src, size_t n); private: XmlMode xmlmode; |