diff options
author | George Hazan <george.hazan@gmail.com> | 2015-04-10 21:41:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-04-10 21:41:21 +0000 |
commit | 2ca49d1d8f694b763fde90fad9a3c9898132f8e9 (patch) | |
tree | 6a97c8fb8a9a1a11049c880293dd3147cd93f81c /src/modules/database | |
parent | 771ccdb89c2ec0733cf16104709ad8670fc34c55 (diff) |
more fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12760 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/database')
-rw-r--r-- | src/modules/database/database.cpp | 28 | ||||
-rw-r--r-- | src/modules/database/dbini.cpp | 1 | ||||
-rw-r--r-- | src/modules/database/mdatabasecache.cpp | 4 |
3 files changed, 18 insertions, 15 deletions
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 3ae83a71c0..c39a7eb434 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -116,7 +116,7 @@ bool shouldAutoCreate(TCHAR *szProfile) return _tcsicmp(ac, _T("yes")) == 0;
}
-static void getDefaultProfile(TCHAR *szProfile, size_t cch, TCHAR *profiledir)
+static void getDefaultProfile(TCHAR *szProfile, size_t cch)
{
TCHAR defaultProfile[MAX_PATH];
GetPrivateProfileString(_T("Database"), _T("DefaultProfile"), _T(""), defaultProfile, SIZEOF(defaultProfile), mirandabootini);
@@ -126,13 +126,13 @@ static void getDefaultProfile(TCHAR *szProfile, size_t cch, TCHAR *profiledir) VARST res(defaultProfile);
if (res)
- mir_sntprintf(szProfile, cch, _T("%s\\%s\\%s%s"), profiledir, (TCHAR*)res, (TCHAR*)res, isValidProfileName(res) ? _T("") : _T(".dat"));
+ mir_sntprintf(szProfile, cch, _T("%s\\%s\\%s%s"), g_profileDir, (TCHAR*)res, (TCHAR*)res, isValidProfileName(res) ? _T("") : _T(".dat"));
else
szProfile[0] = 0;
}
// returns 1 if something that looks like a profile is there
-static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cch, TCHAR *profiledir)
+static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cch)
{
TCHAR buf[MAX_PATH];
_tcsncpy(buf, src, SIZEOF(buf));
@@ -149,14 +149,14 @@ static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cc _tcscpy(profileName, p);
p = _tcsrchr(profileName, '.'); if (p) *p = 0;
- mir_sntprintf(newProfileDir, cch, _T("%s\\%s\\"), profiledir, profileName);
+ mir_sntprintf(newProfileDir, cch, _T("%s\\%s\\"), g_profileDir, profileName);
PathToAbsoluteT(buf, szProfile, newProfileDir);
if ( _tcschr(buf, '\\')) {
- _tcscpy(profiledir, szProfile);
+ _tcsncpy_s(g_profileDir, szProfile, _TRUNCATE);
if (profileName[0]) {
- p = _tcsrchr(profiledir, '\\'); *p = 0;
- p = _tcsrchr(profiledir, '\\');
+ p = _tcsrchr(g_profileDir, '\\'); *p = 0;
+ p = _tcsrchr(g_profileDir, '\\');
if (p && _tcsicmp(p + 1, profileName) == 0)
*p = 0;
}
@@ -164,17 +164,17 @@ static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cc }
}
-void getProfileCmdLine(TCHAR *szProfile, size_t cch, TCHAR *profiledir)
+void getProfileCmdLine(TCHAR *szProfile, size_t cch)
{
LPCTSTR ptszProfileName = CmdLine_GetOption( _T("profile"));
if (ptszProfileName != NULL)
- loadProfileByShortName(ptszProfileName, szProfile, cch, profiledir);
+ loadProfileByShortName(ptszProfileName, szProfile, cch);
}
-void getProfileDefault(TCHAR *szProfile, size_t cch, TCHAR *profiledir)
+void getProfileDefault(TCHAR *szProfile, size_t cch)
{
if (g_defaultProfile != NULL) {
- loadProfileByShortName(g_defaultProfile, szProfile, cch, profiledir);
+ loadProfileByShortName(g_defaultProfile, szProfile, cch);
mir_free(g_defaultProfile);
}
}
@@ -302,9 +302,9 @@ static int getProfile(TCHAR *szProfile, size_t cch) if (WritePrivateProfileString(_T("Database"), _T("ProfileDir"), _T(""), mirandabootini))
getProfilePath(g_profileDir, SIZEOF(g_profileDir));
- getDefaultProfile(szProfile, cch, g_profileDir);
- getProfileCmdLine(szProfile, cch, g_profileDir);
- getProfileDefault(szProfile, cch, g_profileDir);
+ getDefaultProfile(szProfile, cch);
+ getProfileCmdLine(szProfile, cch);
+ getProfileDefault(szProfile, cch);
if (IsInsideRootDir(g_profileDir, true)) {
MessageBox(NULL,
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index 19915ce51c..4bd9c42f96 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -130,6 +130,7 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg, UINT message, WPARAM switch (LOWORD(wParam)) {
case IDCANCEL:
warnInfo->cancel = 1;
+ // fall through
case IDYES:
case IDNO:
warnInfo->warnNoMore = IsDlgButtonChecked(hwndDlg, IDC_WARNNOMORE);
diff --git a/src/modules/database/mdatabasecache.cpp b/src/modules/database/mdatabasecache.cpp index 27283ebb8d..c864394261 100644 --- a/src/modules/database/mdatabasecache.cpp +++ b/src/modules/database/mdatabasecache.cpp @@ -38,7 +38,9 @@ MDatabaseCache::MDatabaseCache(size_t _size) : m_contactSize(_size),
m_lSettings(100, stringCompare),
m_lContacts(50, NumericKeySortT),
- m_lGlobalSettings(50, compareGlobals)
+ m_lGlobalSettings(50, compareGlobals),
+ m_lastSetting(NULL),
+ m_lastVL(NULL)
{
m_hCacheHeap = HeapCreate(0, 0, 0);
}
|