diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-01-05 14:07:18 +0300 |
---|---|---|
committer | Matthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr> | 2021-05-06 10:35:59 +0300 |
commit | ea3d78aecf8b66d40dec9f3a177e36774ba28708 (patch) | |
tree | 8d01f0936a9cd334f4b31a369dc8d92bbae22d3d /src/common | |
parent | e04c6abcd5e87bf2e7733232cb760d4e2707ca8d (diff) |
Fix warning by using QByteArrayLiteral
Signed-off-by: Matthieu Gallien <matthieu_gallien@yahoo.fr>
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/ownsql.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/common/ownsql.cpp b/src/common/ownsql.cpp index e0db3ae05..8b683eef8 100644 --- a/src/common/ownsql.cpp +++ b/src/common/ownsql.cpp @@ -275,20 +275,19 @@ int SqlQuery::prepare(const QByteArray &sql, bool allow_failure) * There is no overloads to QByteArray::startWith that takes Qt::CaseInsensitive. * Returns true if 'a' starts with 'b' in a case insensitive way */ -static bool startsWithInsensitive(const QByteArray &a, const char *b) +static bool startsWithInsensitive(const QByteArray &a, const QByteArray &b) { - size_t len = strlen(b); - return a.size() >= len && qstrnicmp(a.constData(), b, Utility::convertSizeToUint(len)) == 0; + return a.size() >= b.size() && qstrnicmp(a.constData(), b.constData(), static_cast<uint>(b.size())) == 0; } bool SqlQuery::isSelect() { - return startsWithInsensitive(_sql, "SELECT"); + return startsWithInsensitive(_sql, QByteArrayLiteral("SELECT")); } bool SqlQuery::isPragma() { - return startsWithInsensitive(_sql, "PRAGMA"); + return startsWithInsensitive(_sql, QByteArrayLiteral("PRAGMA")); } bool SqlQuery::exec() |