diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-07-28 20:01:23 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-07-30 19:48:41 +0200 |
commit | 5d11688d02e1f56722dce809cbe7ab5c49fea590 (patch) | |
tree | 58fb91bb31e6ebfdcf9c4d98cbec49fc7f829eb4 /src/corelib/tools/qbytearray.cpp | |
parent | 5aacc43e64811751bae6545bfd302f4590212868 (diff) |
Fix QByteArray::to{Upper,Lower} when the array contains embedded nulls
[ChangeLog][QtCore][QByteArray] Fixed a bug that would cause QByteArray
to stop converting toUpper or toLower at the first embedded null
character.
Change-Id: Ia369037206617813d86a8f1489589243c82aa51b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 52af67c86a..d57eeaf188 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -2697,8 +2697,9 @@ QByteArray QByteArray::toLower() const { QByteArray s(*this); uchar *p = reinterpret_cast<uchar *>(s.data()); + uchar *e = reinterpret_cast<uchar *>(s.end()); if (p) { - while (*p) { + while (p != e) { *p = QChar::toLower((ushort)*p); p++; } @@ -2720,8 +2721,9 @@ QByteArray QByteArray::toUpper() const { QByteArray s(*this); uchar *p = reinterpret_cast<uchar *>(s.data()); + uchar *e = reinterpret_cast<uchar *>(s.end()); if (p) { - while (*p) { + while (p != e) { *p = QChar::toUpper((ushort)*p); p++; } |