From 4034b3054aaff28da1db5545063cf8b3c2e8aa24 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 20 May 2014 11:41:05 -0400 Subject: Add English language file which users can edit to modify language strings --- src/win32/windows.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/win32') diff --git a/src/win32/windows.cpp b/src/win32/windows.cpp index a9e0521d0..04eb2fae3 100644 --- a/src/win32/windows.cpp +++ b/src/win32/windows.cpp @@ -26,6 +26,7 @@ static struct WindowsLanguage {"ca_ES", LANG_CATALAN}, {"de_DE", LANG_GERMAN}, {"el_GR", LANG_GREEK}, + {"en_US", LANG_ENGLISH}, {"es_ES", LANG_SPANISH}, {"fr_FR", LANG_FRENCH}, {"hu_HU", LANG_HUNGARIAN}, -- cgit From e8ad509aa5b4bed4f61f32fd1ac7bfeb49685be5 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 27 May 2014 12:53:20 -0400 Subject: Fix dlerror() on Windows and do not abort if err is not set --- src/win32/dl/dl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/win32') diff --git a/src/win32/dl/dl.cpp b/src/win32/dl/dl.cpp index b7ffddaa3..5b19d7441 100644 --- a/src/win32/dl/dl.cpp +++ b/src/win32/dl/dl.cpp @@ -15,7 +15,8 @@ void *dlopen(const char *filename, int) char *dlerror(void) { - static Anope::string err = Anope::LastError(); + static Anope::string err; + err = Anope::LastError(); SetLastError(0); return err.empty() ? NULL : const_cast(err.c_str()); } -- cgit From 8066378471d5cecc5eeb3b9c2752fc684df33d50 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 10 Jun 2014 22:00:00 -0400 Subject: Fix WindowsGetLanguage() --- src/win32/anope_windows.h | 2 +- src/win32/windows.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/win32') diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h index ad561f9b3..e534d7927 100644 --- a/src/win32/anope_windows.h +++ b/src/win32/anope_windows.h @@ -68,7 +68,7 @@ namespace Anope extern CoreExport void OnStartup(); extern CoreExport void OnShutdown(); -extern CoreExport USHORT WindowsGetLanguage(const char *lang); +extern CoreExport USHORT WindowsGetLanguage(const Anope::string &lang); extern CoreExport int gettimeofday(timeval *tv, void *); extern CoreExport Anope::string GetWindowsVersion(); extern CoreExport bool SupportedWindowsVersion(); diff --git a/src/win32/windows.cpp b/src/win32/windows.cpp index 04eb2fae3..3ef1bcfa9 100644 --- a/src/win32/windows.cpp +++ b/src/win32/windows.cpp @@ -20,7 +20,7 @@ static struct WindowsLanguage { - const char *languageName; + Anope::string languageName; USHORT windowsLanguageName; } WindowsLanguages[] = { {"ca_ES", LANG_CATALAN}, @@ -36,7 +36,6 @@ static struct WindowsLanguage {"pt_PT", LANG_PORTUGUESE}, {"ru_RU", LANG_RUSSIAN}, {"tr_TR", LANG_TURKISH}, - {NULL, 0} }; static WSADATA wsa; @@ -52,11 +51,16 @@ void OnShutdown() WSACleanup(); } -USHORT WindowsGetLanguage(const char *lang) +USHORT WindowsGetLanguage(const Anope::string &lang) { - for (int i = 0; WindowsLanguages[i].languageName; ++i) - if (!strcmp(lang, WindowsLanguages[i].languageName)) - return WindowsLanguages[i].windowsLanguageName; + for (int i = 0; i < sizeof(WindowsLanguages) / sizeof(WindowsLanguage); ++i) + { + WindowsLanguage &l = WindowsLanguages[i]; + + if (lang == l.languageName || !lang.find(l.languageName + ".")) + return l.windowsLanguageName; + } + return LANG_NEUTRAL; } -- cgit