Skip to content

Commit

Permalink
SQLite plugin: use QString::unicode(), not utf16()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dangelog committed Jun 1, 2021
1 parent bc80067 commit c2c4266
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit c2c4266

Please sign in to comment.