diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-07-30 01:15:39 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-07-30 04:54:44 (GMT) |
commit | c1a90a535206e0a146e13c60d981a855178e69ca (patch) | |
tree | bcfce35bebe38e858d99f2fdd91fdf3c4c78f4d5 /src/testlib/qtestxunitstreamer.cpp | |
parent | 79ed97b8298e3c7e3c7d266c905024affeba7258 (diff) | |
download | Qt-c1a90a535206e0a146e13c60d981a855178e69ca.zip Qt-c1a90a535206e0a146e13c60d981a855178e69ca.tar.gz Qt-c1a90a535206e0a146e13c60d981a855178e69ca.tar.bz2 |
Convert all testlib loggers to use dynamically allocated strings.
Most log elements in all loggers can now be of (more or less)
arbitrary length. Selftests pass and are memcheck-clean. The
increase in heap usage seems negligible (it's below the default
minimum threshold of massif).
Task: 253861
Reviewed-by: Michael Goddard
Diffstat (limited to 'src/testlib/qtestxunitstreamer.cpp')
-rw-r--r-- | src/testlib/qtestxunitstreamer.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp index f59c0f5..d5d2631 100644 --- a/src/testlib/qtestxunitstreamer.cpp +++ b/src/testlib/qtestxunitstreamer.cpp @@ -135,9 +135,9 @@ 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_asprintf(formatted, " %s=\"%s\"", key, quotedValue); + QTestCharBuffer quotedValue; + QXmlTestLogger::xmlQuote(quotedValue, attribute->value()); + QTest::qt_asprintf(formatted, " %s=\"%s\"", key, quotedValue.constData()); } else { QTest::qt_asprintf(formatted, ""); @@ -168,9 +168,7 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char 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); } |