uploading multiple messages fix, some warnings fix

This commit is contained in:
Blue 2019-11-17 13:24:12 +03:00
parent 0c33d81c59
commit fe27955689
14 changed files with 51 additions and 56 deletions

View file

@ -74,18 +74,18 @@ void Core::Archive::open(const QString& account)
mdb_txn_begin(environment, NULL, 0, &txn);
try {
fromTheBeginning = getStatBoolValue("beginning", txn);
} catch (NotFound e) {
} catch (const NotFound& e) {
fromTheBeginning = false;
}
try {
hasAvatar = getStatBoolValue("hasAvatar", txn);
} catch (NotFound e) {
} catch (const NotFound& e) {
hasAvatar = false;
}
if (hasAvatar) {
try {
avatarAutoGenerated = getStatBoolValue("avatarAutoGenerated", txn);
} catch (NotFound e) {
} catch (const NotFound& e) {
avatarAutoGenerated = false;
}
@ -346,8 +346,7 @@ long unsigned int Core::Archive::size() const
throw Closed("size", jid.toStdString());
}
MDB_txn *txn;
int rc;
rc = mdb_txn_begin(environment, NULL, MDB_RDONLY, &txn);
mdb_txn_begin(environment, NULL, MDB_RDONLY, &txn);
MDB_stat stat;
mdb_stat(txn, order, &stat);
mdb_txn_abort(txn);
@ -473,13 +472,12 @@ void Core::Archive::printOrder()
{
qDebug() << "Printing order";
MDB_txn *txn;
int rc;
rc = mdb_txn_begin(environment, NULL, MDB_RDONLY, &txn);
mdb_txn_begin(environment, NULL, MDB_RDONLY, &txn);
MDB_cursor* cursor;
rc = mdb_cursor_open(txn, order, &cursor);
mdb_cursor_open(txn, order, &cursor);
MDB_val lmdbKey, lmdbData;
rc = mdb_cursor_get(cursor, &lmdbKey, &lmdbData, MDB_FIRST);
mdb_cursor_get(cursor, &lmdbKey, &lmdbData, MDB_FIRST);
do {
std::string sId((char*)lmdbData.mv_data, lmdbData.mv_size);
@ -493,13 +491,12 @@ void Core::Archive::printOrder()
void Core::Archive::printKeys()
{
MDB_txn *txn;
int rc;
rc = mdb_txn_begin(environment, NULL, MDB_RDONLY, &txn);
mdb_txn_begin(environment, NULL, MDB_RDONLY, &txn);
MDB_cursor* cursor;
rc = mdb_cursor_open(txn, main, &cursor);
mdb_cursor_open(txn, main, &cursor);
MDB_val lmdbKey, lmdbData;
rc = mdb_cursor_get(cursor, &lmdbKey, &lmdbData, MDB_FIRST);
mdb_cursor_get(cursor, &lmdbKey, &lmdbData, MDB_FIRST);
do {
std::string sId((char*)lmdbKey.mv_data, lmdbKey.mv_size);
@ -540,7 +537,6 @@ bool Core::Archive::getStatBoolValue(const std::string& id, MDB_txn* txn)
std::string Core::Archive::getStatStringValue(const std::string& id, MDB_txn* txn)
{
MDB_cursor* cursor;
MDB_val lmdbKey, lmdbData;
lmdbKey.mv_size = id.size();
lmdbKey.mv_data = (char*)id.c_str();