summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src/database.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-21 15:04:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-21 15:04:18 +0000
commitf9e33a21e734d927f224cf93fd7be05dce3f7391 (patch)
tree12e52da87181c0725aa9d7740c09d7315d4fb533 /plugins/Db3x_mmap/src/database.cpp
parent310cdd11d658f232ab9b05a7b39cc9c3d9a00436 (diff)
- CDb3Mmap::FillContacts(): returned support for the old contact's format;
- CDb3Mmap::AdaptEvent: fast enough method to unify old & new event's formats; - CDb3Mmap::m_csDbAccess finally switched to mir_cs; - code cleaning; - pre-release version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@11556 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/database.cpp')
-rw-r--r--plugins/Db3x_mmap/src/database.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/Db3x_mmap/src/database.cpp b/plugins/Db3x_mmap/src/database.cpp
index 8d4cddfb4c..c4d9788879 100644
--- a/plugins/Db3x_mmap/src/database.cpp
+++ b/plugins/Db3x_mmap/src/database.cpp
@@ -78,23 +78,20 @@ DWORD CDb3Mmap::ReallocSpace(DWORD ofs, int oldSize, int newSize)
static DWORD DatabaseCorrupted = 0;
static TCHAR *msg = NULL;
static DWORD dwErr = 0;
+static TCHAR tszPanic[] = LPGENT("Miranda has detected corruption in your database. This corruption may be fixed by DbChecker plugin. Please download it from http://miranda-ng.org/p/DbChecker/. Miranda will now shut down.");
void __cdecl dbpanic(void *)
{
- if (msg)
- {
- TCHAR err[256];
-
+ if (msg) {
if (dwErr == ERROR_DISK_FULL)
msg = TranslateT("Disk is full. Miranda will now shut down.");
+ TCHAR err[256];
mir_sntprintf(err, SIZEOF(err), msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);
MessageBox(0, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
}
- else
- MessageBox(0, TranslateT("Miranda has detected corruption in your database. This corruption may be fixed by DbChecker plugin. Please download it from http://miranda-ng.org/p/DbChecker/. Miranda will now shut down."),
- TranslateT("Database Panic"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
+ else MessageBox(0, TranslateTS(tszPanic), TranslateT("Database Panic"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
TerminateProcess(GetCurrentProcess(), 255);
}
@@ -102,7 +99,7 @@ void CDb3Mmap::DatabaseCorruption(TCHAR *text)
{
int kill = 0;
- EnterCriticalSection(&m_csDbAccess);
+ mir_cslockfull lck(m_csDbAccess);
if (DatabaseCorrupted == 0) {
DatabaseCorrupted++;
kill++;
@@ -112,11 +109,11 @@ void CDb3Mmap::DatabaseCorruption(TCHAR *text)
else {
/* db is already corrupted, someone else is dealing with it, wait here
so that we don't do any more damage */
- LeaveCriticalSection(&m_csDbAccess);
Sleep(INFINITE);
return;
}
- LeaveCriticalSection(&m_csDbAccess);
+ lck.unlock();
+
if (kill) {
_beginthread(dbpanic, 0, NULL);
Sleep(INFINITE);