diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-23 20:43:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-23 20:43:18 +0000 |
commit | 5a4ec571583845e2c6e7d005b400309072690d07 (patch) | |
tree | fa875f92541c68fc7d65f692bf9db6f501f7912f /src/mir_core | |
parent | 908a56b91845eea1ffcdbd27458e2fa7c62c009f (diff) |
new setting in a mirandaboot.ini:DefaultLanguage
git-svn-id: http://svn.miranda-ng.org/main/trunk@8721 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/langpack.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp index 2fadf0f073..009185407a 100644 --- a/src/mir_core/langpack.cpp +++ b/src/mir_core/langpack.cpp @@ -359,11 +359,16 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack)
{
- lstrcpy(langPack.tszFileName, szLangPack);
- lstrcpy(langPack.tszFullPath, szLangPack);
+ if (!lstrcmp(szLangPack, langPack.tszFullPath))
+ return 0;
+
+ if (g_entryCount)
+ UnloadLangPackModule();
+
+ _tcsncpy_s(langPack.tszFullPath, SIZEOF(langPack.tszFullPath), szLangPack, _TRUNCATE);
TCHAR *p = _tcsrchr(langPack.tszFullPath, '\\');
- if (p)
- p[1] = 0;
+ _tcsncpy_s(langPack.tszFileName, SIZEOF(langPack.tszFullPath), (p == NULL) ? szLangPack : p + 1, _TRUNCATE);
+ CharLower(langPack.tszFileName);
FILE *fp = _tfopen(szLangPack, _T("rt"));
if (fp == NULL)
@@ -379,7 +384,6 @@ MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack) // body
fseek(fp, startOfLine, SEEK_SET);
- g_entriesAlloced = 0;
LoadLangPackFile(fp, line, fileCp);
fclose(fp);
@@ -640,7 +644,7 @@ void UnloadLangPackModule() if (g_entryCount) {
mir_free(g_pEntries);
g_pEntries = 0;
- g_entryCount = 0;
+ g_entryCount = g_entriesAlloced = 0;
}
}
|