diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-14 23:13:38 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-14 23:13:38 +0000 |
commit | bd49c3201234f447a4fc951ea652532d973c07b1 (patch) | |
tree | 9ee40ab3181612ff138197c679090577a0c173e8 /plugins/Db3x_mmap/src/dbcache.cpp | |
parent | 5056234c898e593ba71a01659dbbcd70ca519d89 (diff) |
Encryption: gathering all things together, part I
git-svn-id: http://svn.miranda-ng.org/main/trunk@6910 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbcache.cpp')
-rw-r--r-- | plugins/Db3x_mmap/src/dbcache.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/plugins/Db3x_mmap/src/dbcache.cpp b/plugins/Db3x_mmap/src/dbcache.cpp index 874a3b733e..8862c7192f 100644 --- a/plugins/Db3x_mmap/src/dbcache.cpp +++ b/plugins/Db3x_mmap/src/dbcache.cpp @@ -26,15 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CDb3Mmap::Map()
{
m_hMap = CreateFileMapping(m_hDbFile, NULL, PAGE_READWRITE, 0, m_dwFileSize, NULL);
-
- if (m_hMap)
- {
+ if (m_hMap) {
m_pDbCache = (PBYTE)MapViewOfFile(m_hMap, FILE_MAP_ALL_ACCESS/*FILE_MAP_WRITE*/, 0, 0 ,0);
if (!m_pDbCache)
DatabaseCorruption( _T("%s (MapViewOfFile failed. Code: %d)"));
}
- else
- DatabaseCorruption( _T("%s (CreateFileMapping failed. Code: %d)"));
+ else DatabaseCorruption( _T("%s (CreateFileMapping failed. Code: %d)"));
}
void CDb3Mmap::ReMap(DWORD needed)
@@ -43,18 +40,15 @@ void CDb3Mmap::ReMap(DWORD needed) log3("remapping %d + %d (file end: %d)",m_dwFileSize,needed,m_dbHeader.ofsFileEnd);
- if (needed > m_ChunkSize)
- {
+ if (needed > m_ChunkSize) {
if (needed + m_dwFileSize > m_dbHeader.ofsFileEnd + m_ChunkSize)
DatabaseCorruption( _T("%s (Too large increment)"));
- else
- {
+ else {
DWORD x = m_dbHeader.ofsFileEnd/m_ChunkSize;
m_dwFileSize = (x+1)*m_ChunkSize;
}
}
- else
- m_dwFileSize += m_ChunkSize;
+ else m_dwFileSize += m_ChunkSize;
// FlushViewOfFile(m_pDbCache, 0);
UnmapViewOfFile(m_pDbCache);
|