diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-22 22:26:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-22 22:26:25 +0300 |
commit | 23f676163a595018346050eccb5cc8b2571381e6 (patch) | |
tree | 09107aede495a3bebea5bed64a4483ffb3d148e5 /plugins/Dbx_mdbx/src | |
parent | 36b876e544afe74ce5f7463cdf9502d3b23f3ed6 (diff) |
code cleaning
Diffstat (limited to 'plugins/Dbx_mdbx/src')
-rw-r--r-- | plugins/Dbx_mdbx/src/dbcontacts.cpp | 11 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbcrypt.cpp | 4 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbevents.cpp | 30 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbintf.cpp | 62 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbintf.h | 4 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbsettings.cpp | 32 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/init.cpp | 12 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/stdafx.h | 2 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/ui.cpp | 2 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/ui.h | 2 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/version.h | 2 |
11 files changed, 52 insertions, 111 deletions
diff --git a/plugins/Dbx_mdbx/src/dbcontacts.cpp b/plugins/Dbx_mdbx/src/dbcontacts.cpp index e639ae1de3..39d5c2ed27 100644 --- a/plugins/Dbx_mdbx/src/dbcontacts.cpp +++ b/plugins/Dbx_mdbx/src/dbcontacts.cpp @@ -103,7 +103,7 @@ STDMETHODIMP_(MCONTACT) CDbxMDBX::AddContact() STDMETHODIMP_(BOOL) CDbxMDBX::IsDbContact(MCONTACT contactID)
{
DBCachedContact *cc = m_cache->GetCachedContact(contactID);
- return (cc != NULL);
+ return (cc != nullptr);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -134,11 +134,12 @@ BOOL CDbxMDBX::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub) EventItem *EI = list[i];
{
txn_ptr trnlck(m_env);
+
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)
return 1;
+
if (trnlck.commit() != MDBX_SUCCESS)
return 1;
}
@@ -179,7 +180,7 @@ BOOL CDbxMDBX::MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub) txn_ptr trnlck(m_env);
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, 0) != MDBX_SUCCESS)
return 1;
if (trnlck.commit() != MDBX_SUCCESS)
return 1;
@@ -237,10 +238,10 @@ void CDbxMDBX::FillContacts() for (int k = 0; k < cc->nSubs; k++) {
char setting[100];
mir_snprintf(setting, _countof(setting), "Handle%d", k);
- cc->pSubs[k] = (0 != GetContactSetting(cc->contactID, META_PROTO, setting, &dbv)) ? NULL : dbv.dVal;
+ cc->pSubs[k] = (0 != GetContactSetting(cc->contactID, META_PROTO, setting, &dbv)) ? 0 : dbv.dVal;
}
}
cc->nDefault = (0 != GetContactSetting(cc->contactID, META_PROTO, "Default", &dbv)) ? -1 : dbv.dVal;
- cc->parentID = (0 != GetContactSetting(cc->contactID, META_PROTO, "ParentMeta", &dbv)) ? NULL : dbv.dVal;
+ cc->parentID = (0 != GetContactSetting(cc->contactID, META_PROTO, "ParentMeta", &dbv)) ? 0 : dbv.dVal;
}
}
diff --git a/plugins/Dbx_mdbx/src/dbcrypt.cpp b/plugins/Dbx_mdbx/src/dbcrypt.cpp index 590cf8494a..77c1f1c59b 100644 --- a/plugins/Dbx_mdbx/src/dbcrypt.cpp +++ b/plugins/Dbx_mdbx/src/dbcrypt.cpp @@ -141,9 +141,9 @@ void CDbxMDBX::StoreKey() void CDbxMDBX::SetPassword(const wchar_t *ptszPassword)
{
- if (ptszPassword == NULL || *ptszPassword == 0) {
+ if (ptszPassword == nullptr || *ptszPassword == 0) {
m_bUsesPassword = false;
- m_crypto->setPassword(NULL);
+ m_crypto->setPassword(nullptr);
}
else {
m_bUsesPassword = true;
diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp index 4d4c76794d..43d8e788f1 100644 --- a/plugins/Dbx_mdbx/src/dbevents.cpp +++ b/plugins/Dbx_mdbx/src/dbevents.cpp @@ -26,12 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. STDMETHODIMP_(LONG) CDbxMDBX::GetEventCount(MCONTACT contactID)
{
DBCachedContact *cc = m_cache->GetCachedContact(contactID);
- return (cc == NULL) ? 0 : cc->dbc.dwEventCount;
+ return (cc == nullptr) ? 0 : cc->dbc.dwEventCount;
}
STDMETHODIMP_(MEVENT) CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
{
- if (dbei == NULL) return 0;
+ if (dbei == nullptr) return 0;
if (dbei->timestamp == 0) return 0;
DBEvent dbe;
@@ -39,13 +39,13 @@ STDMETHODIMP_(MEVENT) CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) dbe.iModuleId = GetModuleID(dbei->szModule);
MCONTACT contactNotifyID = contactID;
- DBCachedContact *cc, *ccSub = NULL;
- if ((cc = m_cache->GetCachedContact(contactID)) == NULL)
+ DBCachedContact *cc, *ccSub = nullptr;
+ if ((cc = m_cache->GetCachedContact(contactID)) == nullptr)
return 0;
if (cc->IsSub()) {
ccSub = cc;
- if ((cc = m_cache->GetCachedContact(cc->parentID)) == NULL)
+ if ((cc = m_cache->GetCachedContact(cc->parentID)) == nullptr)
return 0;
// set default sub to the event's source
@@ -58,7 +58,7 @@ STDMETHODIMP_(MEVENT) CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) if (m_safetyMode)
if (NotifyEventHooks(hEventFilterAddedEvent, contactNotifyID, (LPARAM)dbei))
- return NULL;
+ return 0;
dbe.timestamp = dbei->timestamp;
dbe.flags = dbei->flags;
@@ -70,7 +70,7 @@ STDMETHODIMP_(MEVENT) CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) if (m_bEncrypted) {
size_t len;
BYTE *pResult = m_crypto->encodeBuffer(pBlob, dbe.cbBlob, &len);
- if (pResult != NULL) {
+ if (pResult != nullptr) {
pCryptBlob = pBlob = pResult;
dbe.cbBlob = (uint16_t)len;
dbe.flags |= DBEF_ENCRYPTED;
@@ -81,7 +81,7 @@ STDMETHODIMP_(MEVENT) CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) {
txn_ptr txn(m_env);
- MDBX_val key = { &dwEventId, sizeof(MEVENT) }, data = { NULL, sizeof(DBEvent) + dbe.cbBlob };
+ MDBX_val key = { &dwEventId, sizeof(MEVENT) }, data = { nullptr, sizeof(DBEvent) + dbe.cbBlob };
if (mdbx_put(txn, m_dbEvents, &key, &data, MDBX_RESERVE) != MDBX_SUCCESS)
return 0;
@@ -102,7 +102,7 @@ STDMETHODIMP_(MEVENT) CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) return 0;
// insert an event into a sub's history too
- if (ccSub != NULL) {
+ if (ccSub != nullptr) {
key2.hContact = ccSub->contactID;
if (mdbx_put(txn, m_dbEventsSort, &key, &data, 0) != MDBX_SUCCESS)
return 0;
@@ -128,7 +128,7 @@ STDMETHODIMP_(MEVENT) CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) STDMETHODIMP_(BOOL) CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
{
DBCachedContact *cc = m_cache->GetCachedContact(contactID), *cc2 = nullptr;
- if (cc == NULL || cc->dbc.dwEventCount == 0)
+ if (cc == nullptr || cc->dbc.dwEventCount == 0)
return 1;
DBEvent dbe;
@@ -202,8 +202,8 @@ STDMETHODIMP_(LONG) CDbxMDBX::GetBlobSize(MEVENT hDbEvent) STDMETHODIMP_(BOOL) CDbxMDBX::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei)
{
- if (dbei == NULL) return 1;
- if (dbei->cbBlob > 0 && dbei->pBlob == NULL) {
+ if (dbei == nullptr) return 1;
+ if (dbei->cbBlob > 0 && dbei->pBlob == nullptr) {
dbei->cbBlob = 0;
return 1;
}
@@ -228,7 +228,7 @@ STDMETHODIMP_(BOOL) CDbxMDBX::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) dbei->flags &= ~DBEF_ENCRYPTED;
size_t len;
BYTE* pBlob = (BYTE*)m_crypto->decodeBuffer(pSrc, dbe->cbBlob, &len);
- if (pBlob == NULL)
+ if (pBlob == nullptr)
return 1;
memcpy(dbei->pBlob, pBlob, bytesToCopy);
@@ -266,7 +266,7 @@ STDMETHODIMP_(BOOL) CDbxMDBX::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) if (hDbEvent == 0) return -1;
DBCachedContact *cc = m_cache->GetCachedContact(contactID);
- if (cc == NULL)
+ if (cc == nullptr)
return -1;
uint32_t wRetVal = -1;
@@ -339,7 +339,7 @@ STDMETHODIMP_(MEVENT) CDbxMDBX::FindFirstEvent(MCONTACT contactID) STDMETHODIMP_(MEVENT) CDbxMDBX::FindFirstUnreadEvent(MCONTACT contactID)
{
DBCachedContact *cc = m_cache->GetCachedContact(contactID);
- return (cc == NULL) ? 0 : cc->dbc.evFirstUnread;
+ return (cc == nullptr) ? 0 : cc->dbc.evFirstUnread;
}
STDMETHODIMP_(MEVENT) CDbxMDBX::FindLastEvent(MCONTACT contactID)
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp index 5fa6220a58..7bdfa8b7d1 100644 --- a/plugins/Dbx_mdbx/src/dbintf.cpp +++ b/plugins/Dbx_mdbx/src/dbintf.cpp @@ -35,7 +35,6 @@ CDbxMDBX::CDbxMDBX(const TCHAR *tszFileName, int iMode) : mdbx_env_create(&m_env);
mdbx_env_set_maxdbs(m_env, 10);
mdbx_env_set_userctx(m_env, this);
- // mdbx_env_set_assert(m_env, MDBX_FailAssert);
}
CDbxMDBX::~CDbxMDBX()
@@ -170,7 +169,7 @@ int CDbxMDBX::Check(void) return (memcmp(buf, bDefHeader, _countof(bDefHeader))) ? EGROKPRF_UNKHEADER : 0;
}
-int CDbxMDBX::PrepareCheck(int*)
+int CDbxMDBX::PrepareCheck()
{
InitModules();
return InitCrypt();
@@ -198,65 +197,6 @@ int CDbxMDBX::Map() return mdbx_env_open(m_env, _T2A(m_tszProfileName), mode, 0664);
}
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static DWORD DatabaseCorrupted = 0;
-static const TCHAR *msg = NULL;
-static DWORD dwErr = 0;
-static wchar_t tszPanic[] = LPGENW("Miranda has detected corruption in your database. This corruption may be fixed by DbChecker plugin. Please download it from https://miranda-ng.org/p/DbChecker/. Miranda will now shut down.");
-
-EXTERN_C void __cdecl dbpanic(void *)
-{
- if (msg) {
- if (dwErr == ERROR_DISK_FULL)
- msg = TranslateT("Disk is full. Miranda will now shut down.");
-
- TCHAR err[256];
- mir_snwprintf(err, msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
-
- MessageBox(0, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
- }
- else MessageBox(0, TranslateW(tszPanic), TranslateT("Database Panic"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
- TerminateProcess(GetCurrentProcess(), 255);
-}
-
-
-EXTERN_C void MDBX_FailAssert(MDBX_env *env, const char *text)
-{
- ((CDbxMDBX*)mdbx_env_get_userctx(env))->DatabaseCorruption(_A2T(text));
-}
-
-EXTERN_C void MDBX_Log(const char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- Netlib_Log(0, CMStringA().FormatV(fmt, args));
- va_end(args);
-}
-
-void CDbxMDBX::DatabaseCorruption(const TCHAR *text)
-{
- int kill = 0;
-
- if (DatabaseCorrupted == 0) {
- DatabaseCorrupted++;
- kill++;
- msg = text;
- dwErr = GetLastError();
- }
- else {
- /* db is already corrupted, someone else is dealing with it, wait here
- so that we don't do any more damage */
- Sleep(INFINITE);
- return;
- }
-
- if (kill) {
- _beginthread(dbpanic, 0, NULL);
- Sleep(INFINITE);
- }
-}
-
///////////////////////////////////////////////////////////////////////////////
// MIDatabaseChecker
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h index 6c1de8cd0b..25ff6d07e3 100644 --- a/plugins/Dbx_mdbx/src/dbintf.h +++ b/plugins/Dbx_mdbx/src/dbintf.h @@ -135,13 +135,11 @@ struct CDbxMDBX : public MDatabaseCommon, public MIDatabaseChecker, public MZero int Create(void);
int Check(void);
- void DatabaseCorruption(const TCHAR *ptszText);
-
void StoreKey(void);
void SetPassword(const wchar_t *ptszPassword);
void UpdateMenuItem(void);
- int PrepareCheck(int*);
+ int PrepareCheck();
__forceinline LPSTR GetMenuTitle() const { return m_bUsesPassword ? (char*)LPGEN("Change/remove password") : (char*)LPGEN("Set password"); }
diff --git a/plugins/Dbx_mdbx/src/dbsettings.cpp b/plugins/Dbx_mdbx/src/dbsettings.cpp index 567f02b89e..fe7b40626b 100644 --- a/plugins/Dbx_mdbx/src/dbsettings.cpp +++ b/plugins/Dbx_mdbx/src/dbsettings.cpp @@ -38,7 +38,7 @@ static bool ValidLookupName(LPCSTR szModule, LPCSTR szSetting) int CDbxMDBX::GetContactSettingWorker(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic)
{
- if (szSetting == NULL || szModule == NULL)
+ if (szSetting == nullptr || szModule == nullptr)
return 1;
size_t settingNameLen = strlen(szSetting);
@@ -48,14 +48,14 @@ LBL_Seek: char *szCachedSettingName = m_cache->GetCachedSetting(szModule, szSetting, moduleNameLen, settingNameLen);
DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(contactID, szCachedSettingName, 0);
- if (pCachedValue != NULL) {
+ if (pCachedValue != nullptr) {
if (pCachedValue->type == DBVT_ASCIIZ || pCachedValue->type == DBVT_UTF8) {
int cbOrigLen = dbv->cchVal;
char *cbOrigPtr = dbv->pszVal;
memcpy(dbv, pCachedValue, sizeof(DBVARIANT));
if (isStatic) {
int cbLen = 0;
- if (pCachedValue->pszVal != NULL)
+ if (pCachedValue->pszVal != nullptr)
cbLen = (int)strlen(pCachedValue->pszVal);
cbOrigLen--;
@@ -80,7 +80,7 @@ LBL_Seek: if (szCachedSettingName[-1] != 0)
return 1;
- DBCachedContact *cc = (contactID) ? m_cache->GetCachedContact(contactID) : NULL;
+ DBCachedContact *cc = (contactID) ? m_cache->GetCachedContact(contactID) : nullptr;
txn_ptr_ro trnlck(m_txn);
@@ -154,7 +154,7 @@ LBL_Seek: break;
case DBVT_ENCRYPTED:
- if (m_crypto == NULL)
+ if (m_crypto == nullptr)
return 1;
varLen = *(WORD*)pBlob;
@@ -162,7 +162,7 @@ LBL_Seek: size_t realLen;
ptrA decoded(m_crypto->decodeString(pBlob, varLen, &realLen));
- if (decoded == NULL)
+ if (decoded == nullptr)
return 1;
varLen = (WORD)realLen;
@@ -186,7 +186,7 @@ LBL_Seek: /**** add to cache **********************/
if (iType != DBVT_BLOB && iType != DBVT_ENCRYPTED) {
pCachedValue = m_cache->GetCachedValuePtr(contactID, szCachedSettingName, 1);
- if (pCachedValue != NULL)
+ if (pCachedValue != nullptr)
m_cache->SetCachedVariant(dbv, pCachedValue);
}
@@ -195,7 +195,7 @@ LBL_Seek: STDMETHODIMP_(BOOL) CDbxMDBX::WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws)
{
- if (dbcws == NULL || dbcws->szSetting == NULL || dbcws->szModule == NULL || m_bReadOnly)
+ if (dbcws == nullptr || dbcws->szSetting == nullptr || dbcws->szModule == nullptr || m_bReadOnly)
return 1;
// the db format can't tolerate more than 255 bytes of space (incl. null) for settings+module name
@@ -205,9 +205,9 @@ STDMETHODIMP_(BOOL) CDbxMDBX::WriteContactSetting(MCONTACT contactID, DBCONTACTW // used for notifications
DBCONTACTWRITESETTING dbcwNotif = *dbcws;
if (dbcwNotif.value.type == DBVT_WCHAR) {
- if (dbcwNotif.value.pszVal != NULL) {
+ if (dbcwNotif.value.pszVal != nullptr) {
T2Utf val(dbcwNotif.value.pwszVal);
- if (val == NULL)
+ if (!val)
return 1;
dbcwNotif.value.pszVal = NEWSTR_ALLOCA(val);
@@ -216,12 +216,12 @@ STDMETHODIMP_(BOOL) CDbxMDBX::WriteContactSetting(MCONTACT contactID, DBCONTACTW else return 1;
}
- if (dbcwNotif.szModule == NULL || dbcwNotif.szSetting == NULL)
+ if (dbcwNotif.szModule == nullptr || dbcwNotif.szSetting == nullptr)
return 1;
DBCONTACTWRITESETTING dbcwWork = dbcwNotif;
- mir_ptr<BYTE> pEncoded(NULL);
+ mir_ptr<BYTE> pEncoded(nullptr);
bool bIsEncrypted = false;
switch (dbcwWork.value.type) {
case DBVT_BYTE: case DBVT_WORD: case DBVT_DWORD:
@@ -230,13 +230,13 @@ STDMETHODIMP_(BOOL) CDbxMDBX::WriteContactSetting(MCONTACT contactID, DBCONTACTW case DBVT_ASCIIZ: case DBVT_UTF8:
bIsEncrypted = m_bEncrypted || IsSettingEncrypted(dbcws->szModule, dbcws->szSetting);
LBL_WriteString:
- if (dbcwWork.value.pszVal == NULL)
+ if (dbcwWork.value.pszVal == nullptr)
return 1;
dbcwWork.value.cchVal = (WORD)strlen(dbcwWork.value.pszVal);
if (bIsEncrypted) {
size_t len;
BYTE *pResult = m_crypto->encodeString(dbcwWork.value.pszVal, &len);
- if (pResult != NULL) {
+ if (pResult != nullptr) {
pEncoded = dbcwWork.value.pbVal = pResult;
dbcwWork.value.cpbVal = (WORD)len;
dbcwWork.value.type = DBVT_ENCRYPTED;
@@ -249,7 +249,7 @@ LBL_WriteString: goto LBL_WriteString;
case DBVT_BLOB: case DBVT_ENCRYPTED:
- if (dbcwWork.value.pbVal == NULL)
+ if (dbcwWork.value.pbVal == nullptr)
return 1;
break;
default:
@@ -261,7 +261,7 @@ LBL_WriteString: // we don't cache blobs and passwords
if (dbcwWork.value.type != DBVT_BLOB && dbcwWork.value.type != DBVT_ENCRYPTED && !bIsEncrypted) {
DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(contactID, szCachedSettingName, 1);
- if (pCachedValue != NULL) {
+ if (pCachedValue != nullptr) {
bool bIsIdentical = false;
if (pCachedValue->type == dbcwWork.value.type) {
switch (dbcwWork.value.type) {
diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp index bd73b6e1db..75b5585924 100644 --- a/plugins/Dbx_mdbx/src/init.cpp +++ b/plugins/Dbx_mdbx/src/init.cpp @@ -41,7 +41,7 @@ static PLUGININFOEX pluginInfo = { 0x7c3d0a33, 0x2646, 0x4001, { 0x91, 0x7, 0xf3, 0x5e, 0xa2, 0x99, 0xd2, 0x92 } }
};
-HINSTANCE g_hInst = NULL;
+HINSTANCE g_hInst = nullptr;
LIST<CDbxMDBX> g_Dbs(1, HandleKeySortT);
@@ -69,7 +69,7 @@ static MIDatabase* LoadDatabase(const TCHAR *profile, BOOL bReadOnly) std::unique_ptr<CDbxMDBX> db(new CDbxMDBX(profile, (bReadOnly) ? DBMODE_READONLY : 0));
if (db->Load(false) != ERROR_SUCCESS)
- return NULL;
+ return nullptr;
g_Dbs.insert(db.get());
return db.release();
@@ -87,11 +87,13 @@ MIDatabaseChecker* CheckDb(const TCHAR *profile, int *error) std::unique_ptr<CDbxMDBX> db(new CDbxMDBX(profile, DBMODE_READONLY));
if (db->Load(true) != ERROR_SUCCESS) {
*error = ERROR_ACCESS_DENIED;
- return NULL;
+ return nullptr;
}
- if (db->PrepareCheck(error))
- return NULL;
+ if (db->PrepareCheck()) {
+ *error = ERROR_BAD_FORMAT;
+ return nullptr;
+ }
return db.release();
}
diff --git a/plugins/Dbx_mdbx/src/stdafx.h b/plugins/Dbx_mdbx/src/stdafx.h index caa3ea2725..f7f0ea0391 100644 --- a/plugins/Dbx_mdbx/src/stdafx.h +++ b/plugins/Dbx_mdbx/src/stdafx.h @@ -57,7 +57,7 @@ class txn_ptr public:
__forceinline txn_ptr(MDBX_env *pEnv)
{
- int rc = mdbx_txn_begin(pEnv, NULL, 0, &m_txn);
+ int rc = mdbx_txn_begin(pEnv, nullptr, 0, &m_txn);
/* FIXME: throw an exception */
_ASSERT(rc == MDBX_SUCCESS);
UNREFERENCED_PARAMETER(rc);
diff --git a/plugins/Dbx_mdbx/src/ui.cpp b/plugins/Dbx_mdbx/src/ui.cpp index 6cf2f6bee8..767bc03562 100644 --- a/plugins/Dbx_mdbx/src/ui.cpp +++ b/plugins/Dbx_mdbx/src/ui.cpp @@ -72,7 +72,7 @@ static INT_PTR CALLBACK sttChangePassword(HWND hwndDlg, UINT uMsg, WPARAM wParam SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
oldLangID = 0;
- SetTimer(hwndDlg, 1, 200, NULL);
+ SetTimer(hwndDlg, 1, 200, nullptr);
LanguageChanged(hwndDlg);
return TRUE;
diff --git a/plugins/Dbx_mdbx/src/ui.h b/plugins/Dbx_mdbx/src/ui.h index 704c380cfa..08c9ac9059 100644 --- a/plugins/Dbx_mdbx/src/ui.h +++ b/plugins/Dbx_mdbx/src/ui.h @@ -158,7 +158,7 @@ class CEnterPasswordDialog : public CDlgBase {
m_header.SetText(TranslateT("Please type in your password"));
}
- SetTimer(m_hwnd, 1, 200, NULL);
+ SetTimer(m_hwnd, 1, 200, nullptr);
}
void OnOK(CCtrlButton*)
diff --git a/plugins/Dbx_mdbx/src/version.h b/plugins/Dbx_mdbx/src/version.h index a4d8e7ef7b..cef7f37b48 100644 --- a/plugins/Dbx_mdbx/src/version.h +++ b/plugins/Dbx_mdbx/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 95
#define __RELEASE_NUM 8
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>
|