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>
This commit is contained in:
parent
bc80067266
commit
c2c4266c8c
@ -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; }
|
||||
|
Loading…
Reference in New Issue
Block a user