summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-10-09 17:23:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-10-09 17:23:04 +0300
commit2828f80c86cf8bde114c7ba11bcce4b4d32e2af6 (patch)
tree7d8043ffd10dd1f931f78bffe6ad5e1b3261b4cd /plugins/Dbx_mdbx
parenta519d4617ed83a2167a693ae87934e56889fef05 (diff)
Dbx_mdbx: fix for new constants
Diffstat (limited to 'plugins/Dbx_mdbx')
-rw-r--r--plugins/Dbx_mdbx/src/dbcheck.cpp8
-rw-r--r--plugins/Dbx_mdbx/src/dbcontacts.cpp14
-rw-r--r--plugins/Dbx_mdbx/src/dbcrypt.cpp10
-rw-r--r--plugins/Dbx_mdbx/src/dbevents.cpp26
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp10
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.h8
-rw-r--r--plugins/Dbx_mdbx/src/dbmodulechain.cpp2
-rw-r--r--plugins/Dbx_mdbx/src/dbsettings.cpp2
-rw-r--r--plugins/Dbx_mdbx/src/dbutils.cpp6
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp4
10 files changed, 45 insertions, 45 deletions
diff --git a/plugins/Dbx_mdbx/src/dbcheck.cpp b/plugins/Dbx_mdbx/src/dbcheck.cpp
index 527e0dd9bb..c15b6aee4c 100644
--- a/plugins/Dbx_mdbx/src/dbcheck.cpp
+++ b/plugins/Dbx_mdbx/src/dbcheck.cpp
@@ -39,14 +39,14 @@ int CDbxMDBX::CheckEvents1(void)
if (pData->hContact != 0) {
auto *cc = m_cache->GetCachedContact(pData->hContact);
if (cc == nullptr) {
- mdbx_cursor_del(cursor, 0);
+ mdbx_cursor_del(cursor, MDBX_UPSERT);
cb->pfnAddLogMessage(STATUS_ERROR, CMStringW(FORMAT, TranslateT("Orphaned sorting event with wrong contact ID %d, deleting"), pData->hContact));
continue;
}
}
if (GetBlobSize(pData->hEvent) == -1) {
- mdbx_cursor_del(cursor, 0);
+ mdbx_cursor_del(cursor, MDBX_UPSERT);
cb->pfnAddLogMessage(STATUS_ERROR, CMStringW(FORMAT, TranslateT("Orphaned sorting event with wrong event ID %d:%08X, deleting"), pData->hContact, pData->hEvent));
continue;
}
@@ -68,7 +68,7 @@ int CDbxMDBX::CheckEvents2(void)
for (int ret = mdbx_cursor_get(cursor, &key, &data, MDBX_FIRST); ret == MDBX_SUCCESS; ret = mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT)) {
MEVENT hDbEvent = *(MEVENT *)data.iov_base;
if (GetBlobSize(hDbEvent) == -1) {
- mdbx_cursor_del(cursor, 0);
+ mdbx_cursor_del(cursor, MDBX_UPSERT);
cb->pfnAddLogMessage(STATUS_ERROR, CMStringW(FORMAT, TranslateT("Orphaned event id with wrong event ID %08X, deleting"), hDbEvent));
continue;
}
@@ -93,7 +93,7 @@ int CDbxMDBX::CheckEvents3(void)
if (pKey->hContact) {
auto *cc = m_cache->GetCachedContact(pKey->hContact);
if (cc == nullptr) {
- mdbx_cursor_del(cursor, 0);
+ mdbx_cursor_del(cursor, MDBX_UPSERT);
cb->pfnAddLogMessage(STATUS_ERROR, CMStringW(FORMAT, TranslateT("Orphaned setting with wrong contact ID %08X, deleting"), pKey->hContact));
continue;
}
diff --git a/plugins/Dbx_mdbx/src/dbcontacts.cpp b/plugins/Dbx_mdbx/src/dbcontacts.cpp
index 239cec81b9..3cfca21013 100644
--- a/plugins/Dbx_mdbx/src/dbcontacts.cpp
+++ b/plugins/Dbx_mdbx/src/dbcontacts.cpp
@@ -61,7 +61,7 @@ LONG CDbxMDBX::DeleteContact(MCONTACT contactID)
if (pKey->hContact != contactID)
break;
- if (mdbx_cursor_del(cursor, 0) != MDBX_SUCCESS)
+ if (mdbx_cursor_del(cursor, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
if (!cc->IsMeta() && !cc->IsSub()) {
@@ -88,7 +88,7 @@ LONG CDbxMDBX::DeleteContact(MCONTACT contactID)
if (pKey->hContact != contactID)
break;
- if (mdbx_cursor_del(cursor, 0) != MDBX_SUCCESS)
+ if (mdbx_cursor_del(cursor, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
}
@@ -123,7 +123,7 @@ MCONTACT CDbxMDBX::AddContact()
MDBX_val data = { &cc->dbc, sizeof(cc->dbc) };
txn_ptr trnlck(StartTran());
- if (mdbx_put(trnlck, m_dbContacts, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return 0;
if (trnlck.commit() != MDBX_SUCCESS)
return 0;
@@ -170,7 +170,7 @@ BOOL CDbxMDBX::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
DBEventSortingKey insVal = { ccMeta->contactID, EI->eventId, EI->ts };
MDBX_val key = { &insVal, sizeof(insVal) }, data = { (void*)"", 1 };
- if (mdbx_put(trnlck, m_dbEventsSort, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbEventsSort, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
if (trnlck.commit() != MDBX_SUCCESS)
@@ -181,7 +181,7 @@ BOOL CDbxMDBX::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
MDBX_val keyc = { &ccMeta->contactID, sizeof(MCONTACT) }, datac = { &ccMeta->dbc, sizeof(ccMeta->dbc) };
txn_ptr trnlck(StartTran());
- if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
if (trnlck.commit() != MDBX_SUCCESS)
return 1;
@@ -211,7 +211,7 @@ BOOL CDbxMDBX::MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
txn_ptr trnlck(StartTran());
MDBX_val keyc = { &ccMeta->contactID, sizeof(MCONTACT) }, datac = { &ccMeta->dbc, sizeof(ccMeta->dbc) };
- if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
if (trnlck.commit() != MDBX_SUCCESS)
return 1;
@@ -234,7 +234,7 @@ BOOL CDbxMDBX::MetaRemoveSubHistory(DBCachedContact *ccSub)
if (mdbx_get(trnlck, m_dbEvents, &key, &data) == MDBX_SUCCESS) {
DBEvent *pEvent = (DBEvent*)data.iov_base;
pEvent->dwContactID = ccSub->parentID;
- if (mdbx_put(trnlck, m_dbEvents, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbEvents, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
}
}
diff --git a/plugins/Dbx_mdbx/src/dbcrypt.cpp b/plugins/Dbx_mdbx/src/dbcrypt.cpp
index 037cd655dc..77aa233ff8 100644
--- a/plugins/Dbx_mdbx/src/dbcrypt.cpp
+++ b/plugins/Dbx_mdbx/src/dbcrypt.cpp
@@ -103,11 +103,11 @@ CRYPTO_PROVIDER* CDbxMDBX::SelectProvider()
{
txn_ptr trnlck(StartTran());
MDBX_val key = { DBKey_Crypto_Provider, sizeof(DBKey_Crypto_Provider) }, value = { pProv->pszName, mir_strlen(pProv->pszName) + 1 };
- if (mdbx_put(trnlck, m_dbCrypto, &key, &value, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbCrypto, &key, &value, MDBX_UPSERT) != MDBX_SUCCESS)
return nullptr;
key.iov_len = sizeof(DBKey_Crypto_IsEncrypted); key.iov_base = DBKey_Crypto_IsEncrypted; value.iov_len = sizeof(bool); value.iov_base = &bTotalCrypt;
- if (mdbx_put(trnlck, m_dbCrypto, &key, &value, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbCrypto, &key, &value, MDBX_UPSERT) != MDBX_SUCCESS)
return nullptr;
if (trnlck.commit() != MDBX_SUCCESS)
@@ -273,7 +273,7 @@ void CDbxMDBX::StoreKey()
{
txn_ptr trnlck(StartTran());
MDBX_val key = { DBKey_Crypto_Key, sizeof(DBKey_Crypto_Key) }, value = { pKey, iKeyLength };
- int rc = mdbx_put(trnlck, m_dbCrypto, &key, &value, 0);
+ int rc = mdbx_put(trnlck, m_dbCrypto, &key, &value, MDBX_UPSERT);
if (rc == MDBX_SUCCESS)
rc = trnlck.commit();
/* FIXME: throw an exception */
@@ -364,7 +364,7 @@ int CDbxMDBX::EnableEncryption(bool bEncrypted)
pNewDBEvent->flags = dwNewFlags;
memcpy(pNewDBEvent + 1, pNewBlob, nNewBlob);
- if (mdbx_put(trnlck, m_dbEvents, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbEvents, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
}
}
@@ -377,7 +377,7 @@ int CDbxMDBX::EnableEncryption(bool bEncrypted)
txn_ptr trnlck(StartTran());
MDBX_val key = { DBKey_Crypto_IsEncrypted, sizeof(DBKey_Crypto_IsEncrypted) }, value = { &bEncrypted, sizeof(bool) };
- if (mdbx_put(trnlck, m_dbCrypto, &key, &value, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbCrypto, &key, &value, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
if (trnlck.commit() != MDBX_SUCCESS)
return 1;
diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp
index 1f3e78e0e1..3114962438 100644
--- a/plugins/Dbx_mdbx/src/dbevents.cpp
+++ b/plugins/Dbx_mdbx/src/dbevents.cpp
@@ -87,7 +87,7 @@ BOOL CDbxMDBX::DeleteEvent(MEVENT hDbEvent)
MDBX_val keyc = { &dbe.dwContactID, sizeof(MCONTACT) };
data.iov_len = sizeof(DBContact); data.iov_base = &cc->dbc;
- if (mdbx_put(trnlck, m_dbContacts, &keyc, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &keyc, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
}
else {
@@ -97,7 +97,7 @@ BOOL CDbxMDBX::DeleteEvent(MEVENT hDbEvent)
uint32_t keyVal = 2;
MDBX_val keyc = { &keyVal, sizeof(keyVal) }, datac = { &m_ccDummy.dbc, sizeof(m_ccDummy.dbc) };
- if (mdbx_put(trnlck, m_dbGlobal, &keyc, &datac, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbGlobal, &keyc, &datac, MDBX_UPSERT) != MDBX_SUCCESS)
return 0;
}
@@ -113,7 +113,7 @@ BOOL CDbxMDBX::DeleteEvent(MEVENT hDbEvent)
MDBX_val keyc = { &cc2->contactID, sizeof(MCONTACT) };
data.iov_len = sizeof(DBContact); data.iov_base = &cc2->dbc;
- if (mdbx_put(trnlck, m_dbContacts, &keyc, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &keyc, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
}
@@ -228,39 +228,39 @@ bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO
{
txn_ptr trnlck(StartTran());
MDBX_val key = { &hDbEvent, sizeof(MEVENT) }, data = { recBuf, size_t(p - recBuf) };
- if (mdbx_put(trnlck, m_dbEvents, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbEvents, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
// add a sorting key
DBEventSortingKey key2 = { contactID, hDbEvent, dbe.timestamp };
key.iov_len = sizeof(key2); key.iov_base = &key2;
data.iov_len = 1; data.iov_base = (char*)("");
- if (mdbx_put(trnlck, m_dbEventsSort, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbEventsSort, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
cc->Advance(hDbEvent, dbe);
if (contactID != 0) {
MDBX_val keyc = { &contactID, sizeof(MCONTACT) }, datac = { &cc->dbc, sizeof(DBContact) };
- if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
// insert an event into a sub's history too
if (ccSub != nullptr) {
key2.hContact = ccSub->contactID;
- if (mdbx_put(trnlck, m_dbEventsSort, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbEventsSort, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
ccSub->Advance(hDbEvent, dbe);
datac.iov_base = &ccSub->dbc;
keyc.iov_base = &ccSub->contactID;
- if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
}
}
else {
uint32_t keyVal = 2;
MDBX_val keyc = { &keyVal, sizeof(keyVal) }, datac = { &m_ccDummy.dbc, sizeof(m_ccDummy.dbc) };
- if (mdbx_put(trnlck, m_dbGlobal, &keyc, &datac, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbGlobal, &keyc, &datac, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
}
@@ -270,7 +270,7 @@ bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO
strncpy_s(keyId.szEventId, dbei->szId, _TRUNCATE);
MDBX_val keyid = { &keyId, sizeof(MEVENT) + strlen(keyId.szEventId) + 1 }, dataid = { &hDbEvent, sizeof(hDbEvent) };
- if (mdbx_put(trnlck, m_dbEventIds, &keyid, &dataid, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbEventIds, &keyid, &dataid, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
}
@@ -429,14 +429,14 @@ BOOL CDbxMDBX::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
DBEvent *pNewEvent = (DBEvent*)data.iov_base;
wRetVal = (pNewEvent->flags |= DBEF_READ);
- if (mdbx_put(trnlck, m_dbEvents, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbEvents, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return -1;
DBEventSortingKey keyVal = { contactID, hDbEvent, cdbe.timestamp };
FindNextUnread(trnlck, cc, keyVal);
key.iov_len = sizeof(MCONTACT); key.iov_base = &contactID;
data.iov_base = &cc->dbc; data.iov_len = sizeof(cc->dbc);
- if (mdbx_put(trnlck, m_dbContacts, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return -1;
if (cc2 != nullptr) {
@@ -444,7 +444,7 @@ BOOL CDbxMDBX::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
FindNextUnread(trnlck, cc2, keyVal2);
key.iov_len = sizeof(MCONTACT); key.iov_base = &cc2->contactID;
data.iov_base = &cc2->dbc; data.iov_len = sizeof(cc2->dbc);
- if (mdbx_put(trnlck, m_dbContacts, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return -1;
}
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index 2fdffc7dd9..6626204834 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -59,7 +59,7 @@ CDbxMDBX::~CDbxMDBX()
int CDbxMDBX::Load()
{
- unsigned int defFlags = MDBX_CREATE;
+ MDBX_db_flags_t defFlags = MDBX_CREATE;
{
txn_ptr trnlck(StartTran());
if (trnlck == nullptr) {
@@ -96,7 +96,7 @@ int CDbxMDBX::Load()
m_header.dwSignature = DBHEADER_SIGNATURE;
m_header.dwVersion = DBHEADER_VERSION;
data.iov_base = &m_header; data.iov_len = sizeof(m_header);
- mdbx_put(trnlck, m_dbGlobal, &key, &data, 0);
+ mdbx_put(trnlck, m_dbGlobal, &key, &data, MDBX_UPSERT);
DBFlush();
}
@@ -107,7 +107,7 @@ int CDbxMDBX::Load()
trnlck.commit();
}
- mdbx_txn_begin(m_env, nullptr, MDBX_RDONLY, &m_txn_ro);
+ mdbx_txn_begin(m_env, nullptr, MDBX_TXN_RDONLY, &m_txn_ro);
mdbx_cursor_open(m_txn_ro, m_dbEvents, &m_curEvents);
mdbx_cursor_open(m_txn_ro, m_dbEventIds, &m_curEventIds);
mdbx_cursor_open(m_txn_ro, m_dbEventsSort, &m_curEventsSort);
@@ -218,7 +218,7 @@ void CDbxMDBX::SetCacheSafetyMode(BOOL bIsSet)
/////////////////////////////////////////////////////////////////////////////////////////
-static void assert_func(const MDBX_env*, const char *msg, const char *function, unsigned line)
+static void assert_func(const MDBX_env*, const char *msg, const char *function, unsigned line) MDBX_CXX17_NOEXCEPT
{
Netlib_Logf(nullptr, "MDBX: assertion failed (%s, %d): %s", function, line, msg);
@@ -255,7 +255,7 @@ int CDbxMDBX::Map()
if (rc != MDBX_SUCCESS)
return EGROKPRF_CANTREAD;
- unsigned int mode = MDBX_NOSUBDIR | MDBX_MAPASYNC | MDBX_WRITEMAP | MDBX_SAFE_NOSYNC | MDBX_COALESCE | MDBX_EXCLUSIVE;
+ MDBX_env_flags_t mode = MDBX_NOSUBDIR | MDBX_MAPASYNC | MDBX_WRITEMAP | MDBX_SAFE_NOSYNC | MDBX_COALESCE | MDBX_EXCLUSIVE;
if (m_bReadOnly)
mode |= MDBX_RDONLY;
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h
index 3c7efb03d7..9dadb8a8fc 100644
--- a/plugins/Dbx_mdbx/src/dbintf.h
+++ b/plugins/Dbx_mdbx/src/dbintf.h
@@ -75,7 +75,7 @@ struct DBEventSortingKey
MEVENT hEvent;
uint64_t ts;
- static int Compare(const MDBX_val*, const MDBX_val*);
+ static int Compare(const MDBX_val*, const MDBX_val*) MDBX_CXX17_NOEXCEPT;
};
struct DBEventIdKey
@@ -83,7 +83,7 @@ struct DBEventIdKey
uint32_t iModuleId; // offset to a DBModuleName struct of the name of
char szEventId[256]; // string id
- static int Compare(const MDBX_val*, const MDBX_val*);
+ static int Compare(const MDBX_val*, const MDBX_val*) MDBX_CXX17_NOEXCEPT;
};
struct DBSettingKey
@@ -92,7 +92,7 @@ struct DBSettingKey
uint32_t dwModuleId;
char szSettingName[1];
- static int Compare(const MDBX_val*, const MDBX_val*);
+ static int Compare(const MDBX_val*, const MDBX_val*) MDBX_CXX17_NOEXCEPT;
};
struct DBSettingValue
@@ -161,7 +161,7 @@ class CDbxMDBX : public MDatabaseCommon, public MIDatabaseChecker, public MZeroe
__forceinline MDBX_txn* StartTran()
{
MDBX_txn *res = 0;
- m_dbError = mdbx_txn_begin(m_env, nullptr, (m_bReadOnly) ? MDBX_RDONLY : 0, &res);
+ m_dbError = mdbx_txn_begin(m_env, nullptr, (m_bReadOnly) ? MDBX_TXN_RDONLY : MDBX_TXN_READWRITE, &res);
/* FIXME: throw an exception */
_ASSERT(m_dbError == MDBX_SUCCESS);
return res;
diff --git a/plugins/Dbx_mdbx/src/dbmodulechain.cpp b/plugins/Dbx_mdbx/src/dbmodulechain.cpp
index f67193066c..655937a0bc 100644
--- a/plugins/Dbx_mdbx/src/dbmodulechain.cpp
+++ b/plugins/Dbx_mdbx/src/dbmodulechain.cpp
@@ -48,7 +48,7 @@ uint32_t CDbxMDBX::GetModuleID(const char *szName)
MDBX_val key = { &iHash, sizeof(iHash) }, data = { (void*)szName, strlen(szName) + 1 };
{
txn_ptr trnlck(StartTran());
- if (mdbx_put(trnlck, m_dbModules, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbModules, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return -1;
if (trnlck.commit() != MDBX_SUCCESS)
return -1;
diff --git a/plugins/Dbx_mdbx/src/dbsettings.cpp b/plugins/Dbx_mdbx/src/dbsettings.cpp
index 5b031325ee..cc125a811f 100644
--- a/plugins/Dbx_mdbx/src/dbsettings.cpp
+++ b/plugins/Dbx_mdbx/src/dbsettings.cpp
@@ -340,7 +340,7 @@ LBL_WriteString:
{
txn_ptr trnlck(StartTran());
- if (mdbx_put(trnlck, m_dbSettings, &key, &data, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbSettings, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
if (trnlck.commit() != MDBX_SUCCESS)
diff --git a/plugins/Dbx_mdbx/src/dbutils.cpp b/plugins/Dbx_mdbx/src/dbutils.cpp
index ff41a35452..be0ad2ad4b 100644
--- a/plugins/Dbx_mdbx/src/dbutils.cpp
+++ b/plugins/Dbx_mdbx/src/dbutils.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CMP_UINT(x, y) { if ((x) != (y)) return (x) < (y) ? -1 : 1; }
-int DBEventIdKey::Compare(const MDBX_val *ax, const MDBX_val *bx)
+int DBEventIdKey::Compare(const MDBX_val *ax, const MDBX_val *bx) MDBX_CXX17_NOEXCEPT
{
const DBEventIdKey *a = (DBEventIdKey*)ax->iov_base;
const DBEventIdKey *b = (DBEventIdKey*)bx->iov_base;
@@ -33,7 +33,7 @@ int DBEventIdKey::Compare(const MDBX_val *ax, const MDBX_val *bx)
return strcmp(a->szEventId, b->szEventId);
}
-int DBEventSortingKey::Compare(const MDBX_val *ax, const MDBX_val *bx)
+int DBEventSortingKey::Compare(const MDBX_val *ax, const MDBX_val *bx) MDBX_CXX17_NOEXCEPT
{
const DBEventSortingKey *a = (DBEventSortingKey*)ax->iov_base;
const DBEventSortingKey *b = (DBEventSortingKey*)bx->iov_base;
@@ -44,7 +44,7 @@ int DBEventSortingKey::Compare(const MDBX_val *ax, const MDBX_val *bx)
return 0;
}
-int DBSettingKey::Compare(const MDBX_val *ax, const MDBX_val *bx)
+int DBSettingKey::Compare(const MDBX_val *ax, const MDBX_val *bx) MDBX_CXX17_NOEXCEPT
{
const DBSettingKey *a = (DBSettingKey*)ax->iov_base;
const DBSettingKey *b = (DBSettingKey*)bx->iov_base;
diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp
index d1fb5c9113..c91130f57f 100644
--- a/plugins/Dbx_mdbx/src/init.cpp
+++ b/plugins/Dbx_mdbx/src/init.cpp
@@ -51,7 +51,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABA
/////////////////////////////////////////////////////////////////////////////////////////
-static void logger(int type, const char *function, int line, const char *msg, va_list args)
+static void logger(MDBX_log_level_t type, const char *function, int line, const char *msg, va_list args) MDBX_CXX17_NOEXCEPT
{
char tmp[4096];
_vsnprintf_s(tmp, _countof(tmp), msg, args);
@@ -99,7 +99,7 @@ static DATABASELINK dblink =
int CMPlugin::Load()
{
- mdbx_setup_debug(MDBX_DBG_ASSERT, MDBX_LOG_WARN, &logger);
+ mdbx_setup_debug(MDBX_LOG_WARN, MDBX_DBG_ASSERT, &logger);
RegisterDatabasePlugin(&dblink);
return 0;
}