summaryrefslogtreecommitdiff
path: root/plugins/Mir_core/langpack.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-27 08:54:36 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-27 08:54:36 +0000
commitd9da7f147fbe91d2e70721de96907ae1d273b591 (patch)
tree09eb8cb7934ab23a2c7a1588866b7c2ce21186be /plugins/Mir_core/langpack.cpp
parent76af3716fe56e728b2cad2df2bec7bb4a5b1c8df (diff)
- langpack returned back;
- fixes for the 64-bit compilation issues git-svn-id: http://svn.miranda-ng.org/main/trunk@651 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Mir_core/langpack.cpp')
-rw-r--r--plugins/Mir_core/langpack.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/Mir_core/langpack.cpp b/plugins/Mir_core/langpack.cpp
index d38dd6807d..140efb823a 100644
--- a/plugins/Mir_core/langpack.cpp
+++ b/plugins/Mir_core/langpack.cpp
@@ -133,6 +133,16 @@ MIR_CORE_DLL(unsigned int) mir_hash(const void * key, unsigned int len)
return h;
}
+static unsigned int __fastcall hashstrW(const char * key)
+{
+ if (key == NULL) return 0;
+ const unsigned int len = (unsigned int)wcslen((const wchar_t*)key);
+ char* buf = (char*)alloca(len + 1);
+ for (unsigned i = 0; i <= len ; ++i)
+ buf[i] = key[i << 1];
+ return mir_hash(buf, len);
+}
+
static int SortLangPackHashesProc(LangPackEntry *arg1, LangPackEntry *arg2)
{
if (arg1->englishHash < arg2->englishHash) return -1;
@@ -397,7 +407,7 @@ static char *LangPackTranslateString(LangPackMuuid* pUuid, const char *szEnglish
return (char*)szEnglish;
LangPackEntry key, *entry;
- key.englishHash = W ? mir_hashstrW((WCHAR*)szEnglish) : mir_hashstr(szEnglish);
+ key.englishHash = W ? hashstrW(szEnglish) : mir_hashstr(szEnglish);
entry = (LangPackEntry*)bsearch(&key, langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc2);
if (entry == NULL)
return (char*)szEnglish;