summaryrefslogtreecommitdiff
path: root/src/mir_core/src/langpack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir_core/src/langpack.cpp')
-rw-r--r--src/mir_core/src/langpack.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp
index cfc656afd2..9f048b21ec 100644
--- a/src/mir_core/src/langpack.cpp
+++ b/src/mir_core/src/langpack.cpp
@@ -219,7 +219,7 @@ static void LoadLangPackFile(FILE *fp, char *line)
TCHAR *p = _tcsrchr(langPack.tszFullPath, '\\');
if (p)
*p = 0;
- mir_sntprintf(tszFileName, SIZEOF(tszFileName), _T("%s\\%S"), langPack.tszFullPath, ltrim(line + 9));
+ mir_sntprintf(tszFileName, _countof(tszFileName), _T("%s\\%S"), langPack.tszFullPath, ltrim(line + 9));
if (p)
*p = '\\';
@@ -361,9 +361,9 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start
lpinfo.szAuthors = szAuthors;
- MultiByteToWideChar(lpinfo.codepage, 0, szLanguage, -1, lpinfo.tszLanguage, SIZEOF(lpinfo.tszLanguage));
+ MultiByteToWideChar(lpinfo.codepage, 0, szLanguage, -1, lpinfo.tszLanguage, _countof(lpinfo.tszLanguage));
- if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, SIZEOF(lpinfo.tszLanguage))) {
+ if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, _countof(lpinfo.tszLanguage))) {
TCHAR *p = _tcschr(lpinfo.tszFileName, '_');
_tcsncpy_s(lpinfo.tszLanguage, ((p != NULL) ? (p + 1) : lpinfo.tszFileName), _TRUNCATE);
p = _tcsrchr(lpinfo.tszLanguage, _T('.'));
@@ -380,7 +380,7 @@ MIR_CORE_DLL(int) LoadLangPack(const TCHAR *ptszLangPack)
// ensure that a lang's name is a full file name
TCHAR tszFullPath[MAX_PATH];
if (!PathIsAbsoluteT(ptszLangPack))
- mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\%s"), g_tszRoot, ptszLangPack);
+ mir_sntprintf(tszFullPath, _countof(tszFullPath), _T("%s\\%s"), g_tszRoot, ptszLangPack);
else
_tcsncpy_s(tszFullPath, ptszLangPack, _TRUNCATE);
@@ -527,7 +527,7 @@ MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int hLangpack)
TCHAR str[256];
mii.fMask = MIIM_TYPE | MIIM_SUBMENU;
mii.dwTypeData = (TCHAR*)str;
- mii.cch = SIZEOF(str);
+ mii.cch = _countof(str);
GetMenuItemInfo(hMenu, i, TRUE, &mii);
if (mii.cch && mii.dwTypeData) {
@@ -547,7 +547,7 @@ MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int hLangpack)
static void TranslateWindow(MUUID *pUuid, HWND hwnd)
{
TCHAR title[2048];
- GetWindowText(hwnd, title, SIZEOF(title));
+ GetWindowText(hwnd, title, _countof(title));
TCHAR *result = (TCHAR*)LangPackTranslateString(pUuid, (const char*)title, TRUE);
if (result != title)
@@ -566,7 +566,7 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam)
MUUID *uuid = Langpack_LookupUuid(hLangpack);
TCHAR szClass[32];
- GetClassName(hwnd, szClass, SIZEOF(szClass));
+ GetClassName(hwnd, szClass, _countof(szClass));
if (!mir_tstrcmpi(szClass, _T("static")) || !mir_tstrcmpi(szClass, _T("hyperlink")) || !mir_tstrcmpi(szClass, _T("button")) || !mir_tstrcmpi(szClass, _T("MButtonClass")) || !mir_tstrcmpi(szClass, _T("MHeaderbarCtrl")))
TranslateWindow(uuid, hwnd);
else if (!mir_tstrcmpi(szClass, _T("edit"))) {
@@ -643,7 +643,7 @@ void GetDefaultLang()
// look into mirandaboot.ini
TCHAR tszPath[MAX_PATH], tszLangName[256];
PathToAbsoluteT(_T("\\mirandaboot.ini"), tszPath);
- GetPrivateProfileString(_T("Language"), _T("DefaultLanguage"), _T(""), tszLangName, SIZEOF(tszLangName), tszPath);
+ GetPrivateProfileString(_T("Language"), _T("DefaultLanguage"), _T(""), tszLangName, _countof(tszLangName), tszPath);
if (tszLangName[0]) {
if (!mir_tstrcmpi(tszLangName, _T("default"))) {
db_set_ts(NULL, "Langpack", "Current", _T("default"));
@@ -656,8 +656,8 @@ void GetDefaultLang()
}
// try to load langpack that matches UserDefaultUILanguage
- if (GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, tszLangName, SIZEOF(tszLangName))) {
- mir_sntprintf(tszPath, SIZEOF(tszPath), _T("langpack_%s.txt"), _tcslwr(tszLangName));
+ if (GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, tszLangName, _countof(tszLangName))) {
+ mir_sntprintf(tszPath, _countof(tszPath), _T("langpack_%s.txt"), _tcslwr(tszLangName));
if (!LoadLangPack(tszPath)) {
db_set_ts(NULL, "Langpack", "Current", tszPath);
return;
@@ -665,7 +665,7 @@ void GetDefaultLang()
}
// finally try to load first file
- mir_sntprintf(tszPath, SIZEOF(tszPath), _T("%s\\langpack_*.txt"), g_tszRoot);
+ mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\langpack_*.txt"), g_tszRoot);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(tszPath, &fd);