summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx/src/dbsettings.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-22 22:26:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-22 22:26:25 +0300
commit23f676163a595018346050eccb5cc8b2571381e6 (patch)
tree09107aede495a3bebea5bed64a4483ffb3d148e5 /plugins/Dbx_mdbx/src/dbsettings.cpp
parent36b876e544afe74ce5f7463cdf9502d3b23f3ed6 (diff)
code cleaning
Diffstat (limited to 'plugins/Dbx_mdbx/src/dbsettings.cpp')
-rw-r--r--plugins/Dbx_mdbx/src/dbsettings.cpp32
1 files changed, 16 insertions, 16 deletions
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) {