summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-05-28 17:47:04 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-06-01 20:21:49 +0200
commitc2c4266c8c976ffdb53e7fa27836c3249edac878 (patch)
tree5f545d402f607c9e41342dfe8daf08c697ba4457 /src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
parentbc80067266625db3ce05564e27ffcedfc0092ca3 (diff)
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 <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp')
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp2
1 files changed, 1 insertions, 1 deletions
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<const QString*>(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; }