From c2c4266c8c976ffdb53e7fa27836c3249edac878 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 28 May 2021 17:47:04 +0200 Subject: SQLite plugin: use QString::unicode(), not utf16() utf16() reallocates a QString if it was created from raw data, in order to ensure NUL termination. But here we don't need NUL termination anyways because we also pass the string size, so just use unicode() instead. Change-Id: I4a01ab9f4e53b94b80d3d00272cb0f0e35e30959 Reviewed-by: Andy Shaw --- src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/sqldrivers/sqlite') diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 91a1abaf98..d13fb1787c 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -540,7 +540,7 @@ bool QSQLiteResult::exec() case QMetaType::QString: { // lifetime of string == lifetime of its qvariant const QString *str = static_cast(value.constData()); - res = sqlite3_bind_text16(d->stmt, i + 1, str->utf16(), + res = sqlite3_bind_text16(d->stmt, i + 1, str->unicode(), int(str->size()) * sizeof(QChar), SQLITE_STATIC); break; } -- cgit v1.2.3