summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-06 14:34:26 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-06 15:20:57 (GMT)
commit68423a4642917122c3902dca4ee2710b95c9fa51 (patch)
treeb8944faa6707feb25ad38f077c64067879b6d84a /src
parent2aeaf16a1e31856a3051e6727c5ff2695fec9625 (diff)
downloadQt-68423a4642917122c3902dca4ee2710b95c9fa51.zip
Qt-68423a4642917122c3902dca4ee2710b95c9fa51.tar.gz
Qt-68423a4642917122c3902dca4ee2710b95c9fa51.tar.bz2
fixing outputMessage in qplaintestlogger.cpp for Windows CE
There's a restriction to output only 255 characters per line. The loop we had before was wrong and did some read operations somewhere behinde the end of the message string. Reviewed-by: thartman
Diffstat (limited to 'src')
-rw-r--r--src/testlib/qplaintestlogger.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index 7bebaa1..e075b36 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -148,11 +148,13 @@ namespace QTest {
static void outputMessage(const char *str)
{
#if defined(Q_OS_WINCE)
- int length = strlen(str);
- for (int pos = 0; pos < length; pos +=255) {
- QString uniText = QString::fromLatin1(str + pos, 255);
- OutputDebugString((wchar_t*)uniText.utf16());
- }
+ QString strUtf16 = QString::fromLatin1(str);
+ const int maxOutputLength = 255;
+ do {
+ QString tmp = strUtf16.left(maxOutputLength);
+ OutputDebugString((wchar_t*)tmp.utf16());
+ strUtf16.remove(0, maxOutputLength);
+ } while (!strUtf16.isEmpty());
if (QTestLog::outputFileName())
#elif defined(Q_OS_WIN)
EnterCriticalSection(&outputCriticalSection);