summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src/dbcache.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-08-22 15:23:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-08-22 15:23:04 +0300
commit92fec1aa22df4c4f1213d33663637c00b753f451 (patch)
treecc80e435a189a5d4766bdffd08f9997e7fff51b9 /plugins/Db3x_mmap/src/dbcache.cpp
parent94dde7112f11c5963aa620c692170d02fe65a2a7 (diff)
code cleaning
Diffstat (limited to 'plugins/Db3x_mmap/src/dbcache.cpp')
-rw-r--r--plugins/Db3x_mmap/src/dbcache.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/plugins/Db3x_mmap/src/dbcache.cpp b/plugins/Db3x_mmap/src/dbcache.cpp
index 277ac5298b..ede7a56f26 100644
--- a/plugins/Db3x_mmap/src/dbcache.cpp
+++ b/plugins/Db3x_mmap/src/dbcache.cpp
@@ -33,7 +33,7 @@ void CDb3Mmap::Map()
else
dwProtectMode = PAGE_READWRITE, dwAccess = FILE_MAP_ALL_ACCESS;
- m_hMap = CreateFileMapping(m_hDbFile, NULL, dwProtectMode, 0, m_dwFileSize, NULL);
+ m_hMap = CreateFileMapping(m_hDbFile, nullptr, dwProtectMode, 0, m_dwFileSize, nullptr);
if (m_hMap) {
m_pDbCache = (PBYTE)MapViewOfFile(m_hMap, dwAccess, 0, 0, 0);
if (!m_pDbCache)
@@ -44,7 +44,7 @@ void CDb3Mmap::Map()
void CDb3Mmap::ReMap(DWORD needed)
{
- KillTimer(NULL, m_flushBuffersTimerId);
+ KillTimer(nullptr, m_flushBuffersTimerId);
log3("remapping %d + %d (file end: %d)", m_dwFileSize, needed, m_dbHeader.ofsFileEnd);
@@ -61,7 +61,7 @@ void CDb3Mmap::ReMap(DWORD needed)
}
UnmapViewOfFile(m_pDbCache);
- m_pDbCache = NULL;
+ m_pDbCache = nullptr;
CloseHandle(m_hMap);
Map();
@@ -92,12 +92,12 @@ PBYTE CDb3Mmap::DBRead(DWORD ofs, int *bytesAvail)
// buggy read
if (ofs >= m_dwFileSize) {
//log2("read from outside %d@%08x",bytesRequired,ofs);
- if (bytesAvail != NULL)
+ if (bytesAvail != nullptr)
*bytesAvail = m_ChunkSize;
return m_pNull;
}
//log3((ofs+bytesRequired > m_dwFileSize)?"read %d@%08x, only %d avaliable":"read %d@%08x",bytesRequired,ofs,m_dwFileSize-ofs);
- if (bytesAvail != NULL)
+ if (bytesAvail != nullptr)
*bytesAvail = m_dwFileSize - ofs;
return m_pDbCache + ofs;
}
@@ -131,13 +131,13 @@ static VOID CALLBACK DoBufferFlushTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
if (!db->m_pDbCache)
return;
- KillTimer(NULL, db->m_flushBuffersTimerId);
+ KillTimer(nullptr, db->m_flushBuffersTimerId);
log0("tflush1");
if (FlushViewOfFile(db->m_pDbCache, 0) == 0) {
if (db->m_flushFailTick == 0)
db->m_flushFailTick = GetTickCount();
else if (GetTickCount() - db->m_flushFailTick > 5000)
- db->DatabaseCorruption(NULL);
+ db->DatabaseCorruption(nullptr);
}
else db->m_flushFailTick = 0;
log0("tflush2");
@@ -153,20 +153,20 @@ void CDb3Mmap::DBFlush(int setting)
if (m_flushFailTick == 0)
m_flushFailTick = GetTickCount();
else if (GetTickCount() - m_flushFailTick > 5000)
- DatabaseCorruption(NULL);
+ DatabaseCorruption(nullptr);
}
else m_flushFailTick = 0;
}
log0("nflush2");
return;
}
- KillTimer(NULL, m_flushBuffersTimerId);
- m_flushBuffersTimerId = SetTimer(NULL, m_flushBuffersTimerId, 50, DoBufferFlushTimerProc);
+ KillTimer(nullptr, m_flushBuffersTimerId);
+ m_flushBuffersTimerId = SetTimer(nullptr, m_flushBuffersTimerId, 50, DoBufferFlushTimerProc);
}
int CDb3Mmap::InitMap(void)
{
- m_dwFileSize = GetFileSize(m_hDbFile, NULL);
+ m_dwFileSize = GetFileSize(m_hDbFile, nullptr);
// Align to chunk
if (!m_bReadOnly) {
@@ -186,8 +186,8 @@ DWORD CDb3Mmap::GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc, DWORD ofsModu
{
DWORD ofsThis = dbc->ofsFirstSettings;
while (ofsThis) {
- DBContactSettings *dbcs = (DBContactSettings*)DBRead(ofsThis, NULL);
- if (dbcs->signature != DBCONTACTSETTINGS_SIGNATURE) DatabaseCorruption(NULL);
+ DBContactSettings *dbcs = (DBContactSettings*)DBRead(ofsThis, nullptr);
+ if (dbcs->signature != DBCONTACTSETTINGS_SIGNATURE) DatabaseCorruption(nullptr);
if (dbcs->ofsModuleName == ofsModuleName)
return ofsThis;