diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-18 14:11:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-18 14:11:28 +0000 |
commit | 4bc88d46fa9859615521f436511d4f102f20eb67 (patch) | |
tree | 3a6ee91b74be2a4f5e60520885aa601c74bc3fa7 /plugins/Db3x_mmap/dbcache.cpp | |
parent | 4f8f5427687792492ee49e06cafb9bd50cfc53d4 (diff) |
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
Diffstat (limited to 'plugins/Db3x_mmap/dbcache.cpp')
-rw-r--r-- | plugins/Db3x_mmap/dbcache.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
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;
}
|