From 4bc88d46fa9859615521f436511d4f102f20eb67 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Jul 2012 14:11:28 +0000 Subject: databases are still static, but are controlled via classes git-svn-id: http://svn.miranda-ng.org/main/trunk@1014 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/dbcache.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'plugins/Db3x_mmap/dbcache.cpp') diff --git a/plugins/Db3x_mmap/dbcache.cpp b/plugins/Db3x_mmap/dbcache.cpp index f5b953f615..1e9369cc85 100644 --- a/plugins/Db3x_mmap/dbcache.cpp +++ b/plugins/Db3x_mmap/dbcache.cpp @@ -65,7 +65,7 @@ void ReMap(DWORD needed) } } else - dwFileSize += ChunkSize; + dwFileSize += ChunkSize; // FlushViewOfFile(pDbCache, 0); UnmapViewOfFile(pDbCache); @@ -97,7 +97,7 @@ void DBMoveChunk(DWORD ofsDest,DWORD ofsSource,int bytes) PBYTE DBRead(DWORD ofs,int bytesRequired,int *bytesAvail) { // buggy read - if (ofs>=dwFileSize) { + if (ofs>= dwFileSize) { log2("read from outside %d@%08x",bytesRequired,ofs); if (bytesAvail!=NULL) *bytesAvail = ChunkSize; return pNull; @@ -120,7 +120,7 @@ void DBWrite(DWORD ofs,PVOID pData,int bytes) void DBFill(DWORD ofs,int bytes) { log2("zerofill %d@%08x",bytes,ofs); - if (ofs+bytes<=dwFileSize) + if (ofs+bytes <= dwFileSize) ZeroMemory(pDbCache+ofs,bytes); logg(); } @@ -146,7 +146,7 @@ void DBFlush(int setting) { if (!setting) { log0("nflush1"); - if(safetyMode && pDbCache) { + if (safetyMode && pDbCache) { if (FlushViewOfFile(pDbCache, 0) == 0) { if (flushFailTick == 0) flushFailTick = GetTickCount(); @@ -160,13 +160,13 @@ void DBFlush(int setting) return; } KillTimer(NULL,flushBuffersTimerId); - flushBuffersTimerId=SetTimer(NULL,flushBuffersTimerId,50,DoBufferFlushTimerProc); + flushBuffersTimerId = SetTimer(NULL,flushBuffersTimerId,50,DoBufferFlushTimerProc); } static INT_PTR CacheSetSafetyMode(WPARAM wParam,LPARAM lParam) { EnterCriticalSection(&csDbAccess); - safetyMode=wParam; + safetyMode = wParam; LeaveCriticalSection(&csDbAccess); DBFlush(1); return 0; @@ -184,15 +184,12 @@ int InitCache(void) // Align to chunk x = dwFileSize % ChunkSize; - if (x) dwFileSize += ChunkSize - x; + if (x) dwFileSize += ChunkSize - x; Map(); // zero region for reads outside the file pNull = (PBYTE)calloc(ChunkSize, 1); - - CreateServiceFunction(MS_DB_SETSAFETYMODE, CacheSetSafetyMode); - return 0; } -- cgit v1.2.3