From 24ac894538d15c8fd43d1159436a7a55148189e3 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Thu, 17 Jan 2019 08:39:53 +0100 Subject: [PATCH] Utils: Enable to construct Utf8String with the string literal It does not make any sense to specify the number of letters and it is passed to QByteArray anyways which also accepts -1. Change-Id: If3a9d8cb039853c7b29ea9c73828fb1983e2f584 Reviewed-by: Nikolai Kosjar --- src/libs/sqlite/utf8string.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libs/sqlite/utf8string.h b/src/libs/sqlite/utf8string.h index 4d843c2f5fe..6e8e469595f 100644 --- a/src/libs/sqlite/utf8string.h +++ b/src/libs/sqlite/utf8string.h @@ -33,6 +33,7 @@ #include #include +#include #include class Utf8StringVector; @@ -45,10 +46,13 @@ class Utf8String public: Utf8String() = default; + explicit Utf8String(const char *utf8Text) + : byteArray(utf8Text, utf8Text ? static_cast(std::strlen(utf8Text)) : -1) + {} + explicit Utf8String(const char *utf8Text, int size) : byteArray(utf8Text, size) - { - } + {} Utf8String(const QString &text) : byteArray(text.toUtf8())