diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-06-16 17:42:08 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-06-16 17:42:08 +0000 |
commit | 5975b2d0903bd5df128d55e20cd27d7c13b4e46c (patch) | |
tree | 6696492511c591fa8bf3b65a64864245caa3e7c2 /plugins/SpellChecker | |
parent | 8617d7e00546f892c9084f7c382648b23d8bbb63 (diff) |
another portion of "#ifdef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@448 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SpellChecker')
-rw-r--r-- | plugins/SpellChecker/dictionary.cpp | 34 | ||||
-rw-r--r-- | plugins/SpellChecker/spellchecker.cpp | 27 |
2 files changed, 17 insertions, 44 deletions
diff --git a/plugins/SpellChecker/dictionary.cpp b/plugins/SpellChecker/dictionary.cpp index 8d65763a8a..ac24af66ea 100644 --- a/plugins/SpellChecker/dictionary.cpp +++ b/plugins/SpellChecker/dictionary.cpp @@ -116,25 +116,19 @@ protected: void toHunspell(char *hunspellWord, const TCHAR *word, size_t hunspellWordLen)
{
-#ifdef UNICODE
+
WideCharToMultiByte(codePage, 0, word, -1, hunspellWord, hunspellWordLen, NULL, NULL);
-#else
- // TODO
- strncpy(hunspellWord, word, hunspellWordLen);
-#endif
+
}
TCHAR * fromHunspell(const char *hunspellWord)
{
-#ifdef UNICODE
+
int len = MultiByteToWideChar(codePage, 0, hunspellWord, -1, NULL, 0);
WCHAR *ret = (WCHAR *) malloc((len + 1) * sizeof(WCHAR));
MultiByteToWideChar(codePage, 0, hunspellWord, -1, ret, len + 1);
return ret;
-#else
- // TODO
- return strdup(hunspellWord);
-#endif
+
}
TCHAR * fromHunspellAndFree(char *hunspellWord)
@@ -235,13 +229,10 @@ public: char dic[1024];
char aff[1024];
-#ifdef UNICODE
+
mir_snprintf(dic, MAX_REGS(dic), "%S.dic", fileWithoutExtension);
mir_snprintf(aff, MAX_REGS(aff), "%S.aff", fileWithoutExtension);
-#else
- mir_snprintf(dic, MAX_REGS(dic), "%s.dic", fileWithoutExtension);
- mir_snprintf(aff, MAX_REGS(aff), "%s.aff", fileWithoutExtension);
-#endif
+
hunspell = new Hunspell(aff, dic);
@@ -253,13 +244,10 @@ public: {
codePage = CP_UTF8;
-#ifdef UNICODE
+
int wcs_len;
hwordchars = fromHunspell((char *) hunspell->get_wordchars_utf16(&wcs_len));
-#else
- // No option
- hwordchars = NULL;
-#endif
+
}
else
{
@@ -525,13 +513,11 @@ void GetDictsInfo(LIST<Dictionary> &dicts) if (dict->full_name[0] == _T('\0'))
{
DBVARIANT dbv;
-#ifdef UNICODE
+
char lang[128];
WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL);
if (!DBGetContactSettingTString(NULL, MODULE_NAME, lang, &dbv))
-#else
- if (!DBGetContactSettingTString(NULL, MODULE_NAME, dict->language, &dbv))
-#endif
+
{
lstrcpyn(dict->localized_name, dbv.ptszVal, MAX_REGS(dict->localized_name));
DBFreeVariant(&dbv);
diff --git a/plugins/SpellChecker/spellchecker.cpp b/plugins/SpellChecker/spellchecker.cpp index fdccd20b49..7207f4a71a 100644 --- a/plugins/SpellChecker/spellchecker.cpp +++ b/plugins/SpellChecker/spellchecker.cpp @@ -129,13 +129,11 @@ DEFINE_GUIDXXX(IID_ITextDocument,0x8CC497C0,0xA1DF,0x11CE,0x80,0x98, HICON IcoLib_LoadIcon(Dictionary *dict, BOOL copy) { -#ifdef UNICODE + char lang[32]; WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL); return IcoLib_LoadIcon(lang, copy); -#else - return IcoLib_LoadIcon(dict->language, copy); -#endif + } @@ -212,14 +210,10 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/spellchecker64.%VERSION%.zip"; // upd.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id="; upd.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Spell Checker (x64) "; -#elif UNICODE +#else upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/spellcheckerW.%VERSION%.zip"; upd.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=3691"; upd.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Spell Checker (Unicode) "; -#else - upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/spellchecker.%VERSION%.zip"; - upd.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=3690"; - upd.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Spell Checker (Ansi) "; #endif upd.cpbVersionPrefix = (int)strlen((char *)upd.pbVersionPrefix); @@ -291,13 +285,11 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) for(int i = 0; i < languages.getCount(); i++) { sid.ptszDescription = languages[i]->full_name; -#ifdef UNICODE + char lang[32]; mir_snprintf(lang, MAX_REGS(lang), "%S", languages[i]->language); sid.pszName = lang; -#else - sid.pszName = languages[i]->language; -#endif + HICON hFlag = IcoLib_LoadIcon(sid.pszName); if (hFlag != NULL) @@ -2273,7 +2265,7 @@ TCHAR *lstrtrim(TCHAR *str) BOOL lstreq(TCHAR *a, TCHAR *b, size_t len) { -#ifdef UNICODE + a = CharLower(_tcsdup(a)); b = CharLower(_tcsdup(b)); BOOL ret; @@ -2284,12 +2276,7 @@ BOOL lstreq(TCHAR *a, TCHAR *b, size_t len) free(a); free(b); return ret; -#else - if (len > 0) - return !_tcsnicmp(a, b, len); - else - return !_tcsicmp(a, b); -#endif + } |