summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-07-28 20:01:23 -0700
committerThiago Macieira <thiago.macieira@intel.com>2014-07-30 19:48:41 +0200
commit5d11688d02e1f56722dce809cbe7ab5c49fea590 (patch)
tree58fb91bb31e6ebfdcf9c4d98cbec49fc7f829eb4 /src
parent5aacc43e64811751bae6545bfd302f4590212868 (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')
-rw-r--r--src/corelib/tools/qbytearray.cpp6
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++;
}