summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/dbcache.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-21 08:10:36 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-21 08:10:36 +0000
commitcbd39236065544d5f5ac914dfd1099f740b27476 (patch)
treee00f408cffb82ab6bb9b15d5051f134d119831b2 /plugins/Db3x_mmap/dbcache.cpp
parent9550917a49f7046389cfdd8158061477106289bd (diff)
no more direct access to critsecs in mmap
git-svn-id: http://svn.miranda-ng.org/main/trunk@1089 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/dbcache.cpp')
-rw-r--r--plugins/Db3x_mmap/dbcache.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/Db3x_mmap/dbcache.cpp b/plugins/Db3x_mmap/dbcache.cpp
index 03fcc7d7d0..466aa7a00d 100644
--- a/plugins/Db3x_mmap/dbcache.cpp
+++ b/plugins/Db3x_mmap/dbcache.cpp
@@ -54,7 +54,7 @@ void CDdxMmap::ReMap(DWORD needed)
}
}
else
- m_dwFileSize += m_ChunkSize;
+ m_dwFileSize += m_ChunkSize;
// FlushViewOfFile(m_pDbCache, 0);
UnmapViewOfFile(m_pDbCache);
@@ -68,8 +68,8 @@ void CDdxMmap::DBMoveChunk(DWORD ofsDest,DWORD ofsSource,int bytes)
{
int x = 0;
log3("move %d %08x->%08x",bytes,ofsSource,ofsDest);
- if (ofsDest+bytes>m_dwFileSize) ReMap(ofsDest+bytes-m_dwFileSize);
- if (ofsSource+bytes>m_dwFileSize) {
+ if (ofsDest+bytes > m_dwFileSize) ReMap(ofsDest+bytes-m_dwFileSize);
+ if (ofsSource+bytes > m_dwFileSize) {
x = ofsSource+bytes-m_dwFileSize;
log0("buggy move!");
_ASSERT(0);
@@ -100,7 +100,7 @@ PBYTE CDdxMmap::DBRead(DWORD ofs,int bytesRequired,int *bytesAvail)
void CDdxMmap::DBWrite(DWORD ofs,PVOID pData,int bytes)
{
log2("write %d@%08x",bytes,ofs);
- if (ofs+bytes>m_dwFileSize) ReMap(ofs+bytes-m_dwFileSize);
+ if (ofs+bytes > m_dwFileSize) ReMap(ofs+bytes-m_dwFileSize);
MoveMemory(m_pDbCache+ofs,pData,bytes);
logg();
}
@@ -160,13 +160,12 @@ void CDdxMmap::DBFlush(int setting)
int CDdxMmap::InitCache(void)
{
- DWORD x;
-
m_dwFileSize = GetFileSize(m_hDbFile, NULL);
// Align to chunk
- x = m_dwFileSize % m_ChunkSize;
- if (x) m_dwFileSize += m_ChunkSize - x;
+ DWORD x = m_dwFileSize % m_ChunkSize;
+ if (x)
+ m_dwFileSize += m_ChunkSize - x;
Map();