From d9da7f147fbe91d2e70721de96907ae1d273b591 Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Wed, 27 Jun 2012 08:54:36 +0000
Subject: - 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
---
 plugins/AVS/avs_10.vcxproj                                |  2 +-
 plugins/FingerPrintModPlus/fingerprint_mod_vs2010.vcxproj |  4 ++--
 plugins/Mir_core/langpack.cpp                             | 12 +++++++++++-
 plugins/Mir_core/miranda.h                                |  1 -
 plugins/TipperYM/tipper_ym_10.vcxproj                     |  2 +-
 5 files changed, 15 insertions(+), 6 deletions(-)

(limited to 'plugins')

diff --git a/plugins/AVS/avs_10.vcxproj b/plugins/AVS/avs_10.vcxproj
index 4cedba910d..2530deed9d 100644
--- a/plugins/AVS/avs_10.vcxproj
+++ b/plugins/AVS/avs_10.vcxproj
@@ -107,7 +107,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;UNICODE;_USRDLL;LOADAVATARS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;UNICODE;_USRDLL;LOADAVATARS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
diff --git a/plugins/FingerPrintModPlus/fingerprint_mod_vs2010.vcxproj b/plugins/FingerPrintModPlus/fingerprint_mod_vs2010.vcxproj
index 6d02028081..1645c14abf 100644
--- a/plugins/FingerPrintModPlus/fingerprint_mod_vs2010.vcxproj
+++ b/plugins/FingerPrintModPlus/fingerprint_mod_vs2010.vcxproj
@@ -130,7 +130,7 @@
       <StringPooling>true</StringPooling>
       <PrecompiledHeader>Use</PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
-      <PreprocessorDefinitions>FULL;_FULL;_WIN64;NDEBUG;_WINDOWS;_USRDLL;FINGERPRINT_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>FULL;_FULL;WIN64;NDEBUG;_WINDOWS;_USRDLL;FINGERPRINT_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderFile>global.h</PrecompiledHeaderFile>
       <FunctionLevelLinking>true</FunctionLevelLinking>
     </ClCompile>
@@ -152,7 +152,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>FULL;_FULL;_WIN64;_DEBUG;_WINDOWS;_USRDLL;FINGERPRINT_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>FULL;_FULL;WIN64;_DEBUG;_WINDOWS;_USRDLL;FINGERPRINT_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
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;
diff --git a/plugins/Mir_core/miranda.h b/plugins/Mir_core/miranda.h
index 8a03e4111c..9faa569eff 100644
--- a/plugins/Mir_core/miranda.h
+++ b/plugins/Mir_core/miranda.h
@@ -34,7 +34,6 @@ MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo);
 
 MIR_CORE_DLL(LangPackMuuid*) LangPackLookupUuid(WPARAM wParam);
 
-int LoadLangPackModule(void);
 void UnloadLangPackModule(void);
 
 int InitialiseModularEngine(void);
diff --git a/plugins/TipperYM/tipper_ym_10.vcxproj b/plugins/TipperYM/tipper_ym_10.vcxproj
index c1848e171a..9f1780e597 100644
--- a/plugins/TipperYM/tipper_ym_10.vcxproj
+++ b/plugins/TipperYM/tipper_ym_10.vcxproj
@@ -100,7 +100,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-- 
cgit v1.2.3