summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-18 11:45:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-18 11:45:19 +0000
commit758cf835f21b2f73da541857afac0f3b226ea20e (patch)
tree0f57bf33503bfcbcad53285bbf9b5fb40aa62ffe
parentce2529939b498acc2be8c3c09c897c6f96eee9f7 (diff)
- naming conflict;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14983 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/SpellChecker/src/RichEdit.cpp110
-rw-r--r--plugins/SpellChecker/src/RichEdit.h28
-rw-r--r--plugins/SpellChecker/src/autoreplace.cpp32
-rw-r--r--plugins/SpellChecker/src/autoreplace.h12
-rw-r--r--plugins/SpellChecker/src/dictionary.cpp24
-rw-r--r--plugins/SpellChecker/src/spellchecker.cpp10
-rw-r--r--plugins/SpellChecker/src/utils.cpp10
7 files changed, 112 insertions, 114 deletions
diff --git a/plugins/SpellChecker/src/RichEdit.cpp b/plugins/SpellChecker/src/RichEdit.cpp
index 8b37bcedd9..b6b0f7ba73 100644
--- a/plugins/SpellChecker/src/RichEdit.cpp
+++ b/plugins/SpellChecker/src/RichEdit.cpp
@@ -6,8 +6,12 @@
DEFINE_GUIDXXX(IID_ITextDocument,0x8CC497C0,0xA1DF,0x11CE,0x80,0x98,0x00,0xAA,0x00,0x47,0xBE,0x5D);
-RichEdit::RichEdit(HWND hwnd)
- : hwnd(NULL), ole(NULL), textDocument(NULL), stopped(0), undoEnabled(TRUE)
+RichEdit::RichEdit(HWND hwnd) :
+ m_hwnd(NULL),
+ m_ole(NULL),
+ m_textDocument(NULL),
+ m_stopped(0),
+ m_undoEnabled(TRUE)
{
SetHWND(hwnd);
}
@@ -19,114 +23,114 @@ RichEdit::~RichEdit()
bool RichEdit::IsValid() const
{
- return ole != NULL;
+ return m_ole != NULL;
}
HWND RichEdit::GetHWND() const
{
- return hwnd;
+ return m_hwnd;
}
void RichEdit::SetHWND(HWND hwnd)
{
- if (textDocument != NULL) {
- textDocument->Release();
- textDocument = NULL;
+ if (m_textDocument != NULL) {
+ m_textDocument->Release();
+ m_textDocument = NULL;
}
- if (ole != NULL) {
- ole->Release();
- ole = NULL;
+ if (m_ole != NULL) {
+ m_ole->Release();
+ m_ole = NULL;
}
- this->hwnd = hwnd;
+ m_hwnd = hwnd;
if (hwnd == NULL)
return;
- SendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&ole);
- if (ole == NULL)
+ SendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&m_ole);
+ if (m_ole == NULL)
return;
- if (ole->QueryInterface(IID_ITextDocument, (void**)&textDocument) != S_OK)
- textDocument = NULL;
+ if (m_ole->QueryInterface(IID_ITextDocument, (void**)&m_textDocument) != S_OK)
+ m_textDocument = NULL;
}
LRESULT RichEdit::SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam) const
{
- return ::SendMessage(hwnd, Msg, wParam, lParam);
+ return ::SendMessage(m_hwnd, Msg, wParam, lParam);
}
bool RichEdit::IsReadOnly() const
{
- return (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY) == ES_READONLY;
+ return (GetWindowLongPtr(m_hwnd, GWL_STYLE) & ES_READONLY) == ES_READONLY;
}
void RichEdit::SuspendUndo()
{
- if (textDocument != NULL) {
- textDocument->Undo(tomSuspend, NULL);
- undoEnabled = FALSE;
+ if (m_textDocument != NULL) {
+ m_textDocument->Undo(tomSuspend, NULL);
+ m_undoEnabled = FALSE;
}
}
void RichEdit::ResumeUndo()
{
- if (textDocument != NULL) {
- textDocument->Undo(tomResume, NULL);
- undoEnabled = TRUE;
+ if (m_textDocument != NULL) {
+ m_textDocument->Undo(tomResume, NULL);
+ m_undoEnabled = TRUE;
}
}
void RichEdit::Stop()
{
- stopped++;
- if (stopped != 1)
+ m_stopped++;
+ if (m_stopped != 1)
return;
SuspendUndo();
SendMessage(WM_SETREDRAW, FALSE, 0);
- SendMessage(EM_GETSCROLLPOS, 0, (LPARAM)&old_scroll_pos);
- SendMessage(EM_EXGETSEL, 0, (LPARAM)&old_sel);
- GetCaretPos(&caretPos);
+ SendMessage(EM_GETSCROLLPOS, 0, (LPARAM)&m_old_scroll_pos);
+ SendMessage(EM_EXGETSEL, 0, (LPARAM)&m_old_sel);
+ GetCaretPos(&m_caretPos);
- old_mask = SendMessage(EM_GETEVENTMASK, 0, 0);
- SendMessage(EM_SETEVENTMASK, 0, old_mask & ~ENM_CHANGE);
+ m_old_mask = SendMessage(EM_GETEVENTMASK, 0, 0);
+ SendMessage(EM_SETEVENTMASK, 0, m_old_mask & ~ENM_CHANGE);
- inverse = (old_sel.cpMin >= LOWORD(SendMessage(EM_CHARFROMPOS, 0, (LPARAM)&caretPos)));
+ m_inverse = (m_old_sel.cpMin >= LOWORD(SendMessage(EM_CHARFROMPOS, 0, (LPARAM)&m_caretPos)));
}
void RichEdit::Start()
{
- stopped--;
+ m_stopped--;
- if (stopped < 0) {
- stopped = 0;
+ if (m_stopped < 0) {
+ m_stopped = 0;
return;
}
- if (stopped > 0)
+ if (m_stopped > 0)
return;
- if (inverse) {
- LONG tmp = old_sel.cpMin;
- old_sel.cpMin = old_sel.cpMax;
- old_sel.cpMax = tmp;
+ if (m_inverse) {
+ LONG tmp = m_old_sel.cpMin;
+ m_old_sel.cpMin = m_old_sel.cpMax;
+ m_old_sel.cpMax = tmp;
}
- SendMessage(EM_SETEVENTMASK, 0, old_mask);
- SendMessage(EM_EXSETSEL, 0, (LPARAM)&old_sel);
- SendMessage(EM_SETSCROLLPOS, 0, (LPARAM)&old_scroll_pos);
+ SendMessage(EM_SETEVENTMASK, 0, m_old_mask);
+ SendMessage(EM_EXSETSEL, 0, (LPARAM)&m_old_sel);
+ SendMessage(EM_SETSCROLLPOS, 0, (LPARAM)&m_old_scroll_pos);
SendMessage(WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(m_hwnd, NULL, FALSE);
ResumeUndo();
}
BOOL RichEdit::IsStopped()
{
- return stopped > 0;
+ return m_stopped > 0;
}
int RichEdit::GetCharFromPos(const POINT &pt)
@@ -186,7 +190,7 @@ void RichEdit::SetSel(const CHARRANGE &sel)
int RichEdit::GetTextLength() const
{
- return GetWindowTextLength(hwnd);
+ return GetWindowTextLength(m_hwnd);
}
TCHAR* RichEdit::GetText(int start, int end) const
@@ -194,9 +198,9 @@ TCHAR* RichEdit::GetText(int start, int end) const
if (end <= start)
end = GetTextLength();
- if (textDocument != NULL) {
+ if (m_textDocument != NULL) {
ITextRange *range;
- if (textDocument->Range(start, end, &range) != S_OK)
+ if (m_textDocument->Range(start, end, &range) != S_OK)
return mir_tstrdup(_T(""));
BSTR text = NULL;
@@ -215,7 +219,7 @@ TCHAR* RichEdit::GetText(int start, int end) const
int len = (GetTextLength() + 1);
TCHAR *tmp = (TCHAR *)mir_alloc(len * sizeof(TCHAR));
- GetWindowText(hwnd, tmp, len);
+ GetWindowText(m_hwnd, tmp, len);
tmp[len] = 0;
TCHAR *ret = (TCHAR *)mir_alloc((end - start + 1) * sizeof(TCHAR));
@@ -228,21 +232,21 @@ TCHAR* RichEdit::GetText(int start, int end) const
void RichEdit::ReplaceSel(const TCHAR *new_text)
{
- if (stopped) {
+ if (m_stopped) {
CHARRANGE sel = GetSel();
ResumeUndo();
- SendMessage(EM_REPLACESEL, undoEnabled, (LPARAM)new_text);
+ SendMessage(EM_REPLACESEL, m_undoEnabled, (LPARAM)new_text);
SuspendUndo();
- FixSel(&old_sel, sel, mir_tstrlen(new_text));
+ FixSel(&m_old_sel, sel, mir_tstrlen(new_text));
SendMessage(WM_SETREDRAW, FALSE, 0);
- SendMessage(EM_SETEVENTMASK, 0, old_mask & ~ENM_CHANGE);
+ SendMessage(EM_SETEVENTMASK, 0, m_old_mask & ~ENM_CHANGE);
}
- else SendMessage(EM_REPLACESEL, undoEnabled, (LPARAM)new_text);
+ else SendMessage(EM_REPLACESEL, m_undoEnabled, (LPARAM)new_text);
}
int RichEdit::Replace(int start, int end, const TCHAR *new_text)
diff --git a/plugins/SpellChecker/src/RichEdit.h b/plugins/SpellChecker/src/RichEdit.h
index 8d8b25f6bf..4556369c31 100644
--- a/plugins/SpellChecker/src/RichEdit.h
+++ b/plugins/SpellChecker/src/RichEdit.h
@@ -3,17 +3,17 @@
class RichEdit
{
- HWND hwnd;
- IRichEditOle *ole;
- ITextDocument *textDocument;
-
- int stopped;
- BOOL undoEnabled;
- POINT old_scroll_pos;
- CHARRANGE old_sel;
- POINT caretPos;
- DWORD old_mask;
- BOOL inverse;
+ HWND m_hwnd;
+ IRichEditOle *m_ole;
+ ITextDocument *m_textDocument;
+
+ int m_stopped;
+ BOOL m_undoEnabled;
+ POINT m_old_scroll_pos;
+ CHARRANGE m_old_sel;
+ POINT m_caretPos;
+ DWORD m_old_mask;
+ BOOL m_inverse;
public:
RichEdit(HWND hwnd);
@@ -44,7 +44,7 @@ public:
void SetSel(int start, int end);
void SetSel(const CHARRANGE &sel);
- TCHAR *GetText(int start, int end) const;
+ TCHAR* GetText(int start, int end) const;
int GetTextLength() const;
void ReplaceSel(const TCHAR *new_text);
@@ -58,8 +58,4 @@ private:
int FixSel(CHARRANGE *to_fix, CHARRANGE sel_changed, int new_len);
};
-
-
-
-
#endif // __RICHEDIT_H__
diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp
index 283a1ea6db..e1ca9737c3 100644
--- a/plugins/SpellChecker/src/autoreplace.cpp
+++ b/plugins/SpellChecker/src/autoreplace.cpp
@@ -32,14 +32,14 @@ AutoReplacement::AutoReplacement(const TCHAR *replace, BOOL useVariables)
AutoReplaceMap::AutoReplaceMap(TCHAR *aFilename, Dictionary *dict)
{
- this->dict = dict;
- mir_tstrncpy(filename, aFilename, _countof(filename));
+ m_dict = dict;
+ mir_tstrncpy(m_filename, aFilename, _countof(m_filename));
loadAutoReplaceMap();
}
void AutoReplaceMap::loadAutoReplaceMap()
{
- FILE *file = _tfopen(filename, _T("rb"));
+ FILE *file = _tfopen(m_filename, _T("rb"));
if (file == NULL)
return;
@@ -73,7 +73,7 @@ void AutoReplaceMap::loadAutoReplaceMap()
lstrtrim(replace);
if (find[0] != 0 && replace[0] != 0)
- replacements[find.get()] = AutoReplacement(replace, useVars);
+ m_replacements[find.get()] = AutoReplacement(replace, useVars);
}
}
@@ -90,18 +90,18 @@ void AutoReplaceMap::loadAutoReplaceMap()
void AutoReplaceMap::writeAutoReplaceMap()
{
// Create path
- TCHAR *p = _tcsrchr(filename, _T('\\'));
+ TCHAR *p = _tcsrchr(m_filename, _T('\\'));
if (p != NULL) {
*p = 0;
- CreateDirectoryTreeT(filename);
+ CreateDirectoryTreeT(m_filename);
*p = _T('\\');
}
// Write it
- FILE *file = _tfopen(filename, _T("wb"));
+ FILE *file = _tfopen(m_filename, _T("wb"));
if (file != NULL) {
- map<tstring, AutoReplacement>::iterator it = replacements.begin();
- for (; it != replacements.end(); it++) {
+ map<tstring, AutoReplacement>::iterator it = m_replacements.begin();
+ for (; it != m_replacements.end(); it++) {
AutoReplacement &ar = it->second;
TcharToUtf8 find(it->first.c_str());
@@ -125,7 +125,7 @@ BOOL AutoReplaceMap::isWordChar(TCHAR c)
if (_tcschr(_T("-_.!@#$%&*()[]{}<>:?/\\=+"), c) != NULL)
return TRUE;
- return dict->isWordChar(c);
+ return m_dict->isWordChar(c);
}
@@ -133,10 +133,10 @@ TCHAR* AutoReplaceMap::autoReplace(const TCHAR * word)
{
scoped_free<TCHAR> from = _tcslwr(_tcsdup(word));
- if (replacements.find(from.get()) == replacements.end())
+ if (m_replacements.find(from.get()) == m_replacements.end())
return NULL;
- AutoReplacement &ar = replacements[from.get()];
+ AutoReplacement &ar = m_replacements[from.get()];
TCHAR *to;
if (ar.useVariables)
@@ -182,24 +182,24 @@ void AutoReplaceMap::add(const TCHAR * aFrom, const TCHAR * to, BOOL useVariable
{
scoped_free<TCHAR> from = filterText(aFrom);
- replacements[from.get()] = AutoReplacement(to, useVariables);
+ m_replacements[from.get()] = AutoReplacement(to, useVariables);
writeAutoReplaceMap();
}
void AutoReplaceMap::copyMap(map<tstring, AutoReplacement> *replacements)
{
- *replacements = this->replacements;
+ *replacements = m_replacements;
}
void AutoReplaceMap::setMap(const map<tstring, AutoReplacement> &replacements)
{
- this->replacements.clear();
+ m_replacements.clear();
map<tstring, AutoReplacement>::const_iterator it = replacements.begin();
for (; it != replacements.end(); it++) {
scoped_free<TCHAR> from = filterText(it->first.c_str());
- this->replacements[from.get()] = it->second;
+ m_replacements[from.get()] = it->second;
}
writeAutoReplaceMap();
diff --git a/plugins/SpellChecker/src/autoreplace.h b/plugins/SpellChecker/src/autoreplace.h
index e7e2efbb55..8a81fdfcbf 100644
--- a/plugins/SpellChecker/src/autoreplace.h
+++ b/plugins/SpellChecker/src/autoreplace.h
@@ -38,9 +38,9 @@ class Dictionary;
class AutoReplaceMap
{
private:
- TCHAR filename[1024];
- Dictionary *dict;
- map<tstring, AutoReplacement> replacements;
+ TCHAR m_filename[1024];
+ Dictionary *m_dict;
+ map<tstring, AutoReplacement> m_replacements;
void loadAutoReplaceMap();
void writeAutoReplaceMap();
@@ -48,15 +48,15 @@ private:
public:
AutoReplaceMap(TCHAR *filename, Dictionary *dict);
- TCHAR *filterText(const TCHAR *find);
+ TCHAR* filterText(const TCHAR *find);
BOOL isWordChar(TCHAR c);
/// Return an auto replacement to a word or NULL if none exists.
/// You have to free the item.
- TCHAR * autoReplace(const TCHAR * word);
+ TCHAR* autoReplace(const TCHAR *word);
/// Add a word to the list of auto-replaced words
- void add(const TCHAR * from, const TCHAR * to, BOOL useVariables = FALSE);
+ void add(const TCHAR *from, const TCHAR *to, BOOL useVariables = FALSE);
/// Make a copy of the auto replace map
void copyMap(map<tstring, AutoReplacement> *replacements);
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp
index 9a7ae1775c..7c074fd159 100644
--- a/plugins/SpellChecker/src/dictionary.cpp
+++ b/plugins/SpellChecker/src/dictionary.cpp
@@ -365,7 +365,7 @@ protected:
void loadCustomDict()
{
TCHAR filename[1024];
- mir_sntprintf(filename, _countof(filename), _T("%s\\%s.cdic"), userPath, language);
+ mir_sntprintf(filename, _T("%s\\%s.cdic"), userPath, language);
FILE *file = _tfopen(filename, _T("rb"));
if (file != NULL) {
@@ -395,7 +395,7 @@ protected:
CreateDirectoryTreeT(userPath);
TCHAR filename[1024];
- mir_sntprintf(filename, _countof(filename), _T("%s\\%s.cdic"), userPath, language);
+ mir_sntprintf(filename, _T("%s\\%s.cdic"), userPath, language);
FILE *file = _tfopen(filename, _T("ab"));
if (file != NULL) {
@@ -737,7 +737,7 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString)
GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SISO3166CTRYNAME, end, _countof(end));
TCHAR name[64];
- mir_sntprintf(name, _countof(name), _T("%s_%s"), ini, end);
+ mir_sntprintf(name, _T("%s_%s"), ini, end);
for (int i = 0; i < tmp_dicts->getCount(); i++) {
Dictionary *dict = (*tmp_dicts)[i];
@@ -753,13 +753,13 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString)
TCHAR country[1024];
GetLocaleInfo(MAKELCID(langID, 0), LOCALE_SENGCOUNTRY, country, _countof(country));
- TCHAR name[1024];
+ TCHAR localName[1024];
if (country[0] != 0)
- mir_sntprintf(name, _countof(name), _T("%s (%s)"), dict->english_name, country);
+ mir_sntprintf(localName, _T("%s (%s)"), dict->english_name, country);
else
- mir_tstrncpy(name, dict->english_name, _countof(name));
+ mir_tstrncpy(localName, dict->english_name, _countof(localName));
- mir_tstrncpy(dict->localized_name, TranslateTS(name), _countof(dict->localized_name));
+ mir_tstrncpy(dict->localized_name, TranslateTS(localName), _countof(dict->localized_name));
}
if (dict->localized_name[0] != 0) {
@@ -801,7 +801,7 @@ void GetDictsInfo(LIST<Dictionary> &dicts)
}
if (dict->localized_name[0] != _T('\0')) {
- mir_sntprintf(dict->full_name, _countof(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language);
+ mir_sntprintf(dict->full_name, _T("%s [%s]"), dict->localized_name, dict->language);
}
else {
mir_tstrncpy(dict->full_name, dict->language, _countof(dict->full_name));
@@ -815,7 +815,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH
{
// Load the language files and create an array with then
TCHAR file[1024];
- mir_sntprintf(file, _countof(file), _T("%s\\*.dic"), path);
+ mir_sntprintf(file, _T("%s\\*.dic"), path);
BOOL found = FALSE;
@@ -823,7 +823,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH
HANDLE hFFD = FindFirstFile(file, &ffd);
if (hFFD != INVALID_HANDLE_VALUE) {
do {
- mir_sntprintf(file, _countof(file), _T("%s\\%s"), path, ffd.cFileName);
+ mir_sntprintf(file, _T("%s\\%s"), path, ffd.cFileName);
// Check .dic
DWORD attrib = GetFileAttributes(file);
@@ -873,7 +873,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa
// Get other apps dicts
for (int i = 0; i < _countof(otherHunspellApps); i++) {
TCHAR key[1024];
- mir_sntprintf(key, _countof(key), APPPATH, otherHunspellApps[i].key);
+ mir_sntprintf(key, APPPATH, otherHunspellApps[i].key);
HKEY hKey = 0;
LONG lResult = 0;
@@ -911,7 +911,7 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa
if (ERROR_SUCCESS == lResult) {
TCHAR folder[1024];
- mir_sntprintf(folder, _countof(folder), _T("%s\\Dictionaries"), key);
+ mir_sntprintf(folder, _T("%s\\Dictionaries"), key);
GetHunspellDictionariesFromFolder(languages, folder, user_path, otherHunspellApps[i].name);
}
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp
index 69f26fee80..832379eab5 100644
--- a/plugins/SpellChecker/src/spellchecker.cpp
+++ b/plugins/SpellChecker/src/spellchecker.cpp
@@ -80,8 +80,7 @@ static int IconsChanged(WPARAM, LPARAM)
sid.dwId = i;
TCHAR tmp[128];
- mir_sntprintf(tmp, _countof(tmp), _T("%s - %s"),
- TranslateT("Spell Checker"), languages[i]->full_name);
+ mir_sntprintf(tmp, _T("%s - %s"), TranslateT("Spell Checker"), languages[i]->full_name);
sid.tszTooltip = tmp;
HICON hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled");
@@ -135,7 +134,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
if (opts.use_flags) {
// Load flags dll
TCHAR flag_file[MAX_PATH];
- mir_sntprintf(flag_file, _countof(flag_file), _T("%s\\flags_icons.dll"), flagsDllFolder);
+ mir_sntprintf(flag_file, _T("%s\\flags_icons.dll"), flagsDllFolder);
HMODULE hFlagsDll = LoadLibraryEx(flag_file, NULL, LOAD_LIBRARY_AS_DATAFILE);
TCHAR path[MAX_PATH];
@@ -185,7 +184,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
Dictionary *dict = languages[j];
TCHAR filename[MAX_PATH];
- mir_sntprintf(filename, _countof(filename), _T("%s\\%s.ar"), customDictionariesFolder, dict->language);
+ mir_sntprintf(filename, _T("%s\\%s.ar"), customDictionariesFolder, dict->language);
dict->autoReplace = new AutoReplaceMap(filename, dict);
if (mir_tstrcmp(dict->language, opts.default_language) == 0)
@@ -206,8 +205,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
sid.dwId = i;
TCHAR tmp[128];
- mir_sntprintf(tmp, _countof(tmp), _T("%s - %s"),
- TranslateT("Spell Checker"), languages[i]->full_name);
+ mir_sntprintf(tmp, _T("%s - %s"), TranslateT("Spell Checker"), languages[i]->full_name);
sid.tszTooltip = tmp;
sid.hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled");
Srmm_AddIcon(&sid);
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp
index 0baf6bc842..a53953991e 100644
--- a/plugins/SpellChecker/src/utils.cpp
+++ b/plugins/SpellChecker/src/utils.cpp
@@ -454,7 +454,7 @@ void LoadDictFromKbdl(Dialog *dlg)
// Use default input language
HKL hkl = GetKeyboardLayout(0);
- mir_sntprintf(szKLName, _countof(szKLName), _T("%x"), (int)LOWORD(hkl));
+ mir_sntprintf(szKLName, _T("%x"), (int)LOWORD(hkl));
ToLocaleID(szKLName, _countof(szKLName));
int d = GetClosestLanguage(szKLName);
@@ -691,10 +691,10 @@ int GetClosestLanguage(TCHAR *lang_name)
// Try searching by the prefix only
TCHAR lang[128];
mir_tstrncpy(lang, lang_name, _countof(lang));
-
- TCHAR *p = _tcschr(lang, _T('_'));
- if (p != NULL)
- *p = _T('\0');
+ {
+ TCHAR *p = _tcschr(lang, _T('_'));
+ if (p != NULL) *p = _T('\0');
+ }
// First check if there is a language that is only the prefix
for (i = 0; i < languages.getCount(); i++)