From 68423a4642917122c3902dca4ee2710b95c9fa51 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 6 Aug 2009 16:34:26 +0200 Subject: 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 --- src/testlib/qplaintestlogger.cpp | 12 +++++++----- 1 file 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); -- cgit v0.12