summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-03-31 01:27:27 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-03 00:22:27 +0200
commit97f251b8c3654ffdf0ea3df3c610935549a7eba9 (patch)
treea2dfb854f82de8bcdc98e0e68000dd2d99be1f92 /src/corelib/tools/qbytearray.cpp
parentccf25f1d2875645067066ffb1038d23c4c1c39c1 (diff)
Don't use qstrlen if string is not null
Change-Id: I4f9aec21af2ce24a1d27c6d140764e371bce5017 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r--src/corelib/tools/qbytearray.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 7f4d35d82c..574153fdaf 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -131,7 +131,7 @@ char *qstrcpy(char *dst, const char *src)
if (!src)
return 0;
#if defined(_MSC_VER) && _MSC_VER >= 1400
- int len = qstrlen(src);
+ int len = strlen(src);
// This is actually not secure!!! It will be fixed
// properly in a later release!
if (len >= 0 && strcpy_s(dst, len+1, src) == 0)
@@ -916,7 +916,7 @@ QByteArray &QByteArray::operator=(const char *str)
} else if (!*str) {
x = const_cast<Data *>(&shared_empty.ba);
} else {
- int len = qstrlen(str);
+ int len = strlen(str);
if (d->ref.isShared() || len > int(d->alloc) || (len < d->size && len < int(d->alloc) >> 1))
realloc(len);
x = d;
@@ -1650,7 +1650,7 @@ QByteArray &QByteArray::append(const QByteArray &ba)
QByteArray& QByteArray::append(const char *str)
{
if (str) {
- int len = qstrlen(str);
+ int len = strlen(str);
if (d->ref.isShared() || d->size + len > int(d->alloc))
realloc(qAllocMore(d->size + len, sizeof(Data)));
memcpy(d->data() + d->size, str, len + 1); // include null terminator
@@ -2534,7 +2534,7 @@ bool QByteArray::startsWith(const char *str) const
{
if (!str || !*str)
return true;
- int len = qstrlen(str);
+ int len = strlen(str);
if (d->size < len)
return false;
return qstrncmp(d->data(), str, len) == 0;
@@ -2579,7 +2579,7 @@ bool QByteArray::endsWith(const char *str) const
{
if (!str || !*str)
return true;
- int len = qstrlen(str);
+ int len = strlen(str);
if (d->size < len)
return false;
return qstrncmp(d->data() + d->size - len, str, len) == 0;