mirror of
https://github.com/zealdocs/zeal.git
synced 2024-11-23 14:26:12 +03:00
util: Fix Clang warnings in SQLiteDatabase
This commit is contained in:
parent
a5ef8e88c5
commit
01ffac5d34
@ -81,8 +81,8 @@ bool SQLiteDatabase::execute(const QString &queryStr)
|
||||
|
||||
sqlite3_mutex_enter(sqlite3_db_mutex(m_db));
|
||||
const void *pzTail = nullptr;
|
||||
const int res = sqlite3_prepare16_v2(m_db, queryStr.constData(),
|
||||
(queryStr.size() + 1) * sizeof(QChar), &m_stmt, &pzTail);
|
||||
const int res = sqlite3_prepare16_v2(m_db, queryStr.constData(), (queryStr.size() + 1) * 2,
|
||||
&m_stmt, &pzTail); // 2 = sizeof(QChar)
|
||||
sqlite3_mutex_leave(sqlite3_db_mutex(m_db));
|
||||
|
||||
if (res != SQLITE_OK) {
|
||||
@ -140,12 +140,16 @@ QVariant SQLiteDatabase::value(int index) const
|
||||
switch (type) {
|
||||
case SQLITE_INTEGER:
|
||||
ret = sqlite3_column_int64(m_stmt, index);
|
||||
break;
|
||||
case SQLITE_NULL:
|
||||
ret = QVariant(QVariant::String);
|
||||
break;
|
||||
default:
|
||||
ret = QString(reinterpret_cast<const QChar *>(sqlite3_column_text16(m_stmt, index)),
|
||||
sqlite3_column_bytes16(m_stmt, index) / sizeof(QChar));
|
||||
sqlite3_column_bytes16(m_stmt, index) / 2); // 2 = sizeof(QChar)
|
||||
break;
|
||||
}
|
||||
|
||||
sqlite3_mutex_leave(sqlite3_db_mutex(m_db));
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user