From 9e0c64767759da86499f245083239575d947b5e9 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky <mataes2007@gmail.com> Date: Sat, 23 Jun 2012 18:27:01 +0000 Subject: Db3x: plusified git-svn-id: http://svn.miranda-ng.org/main/trunk@582 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x/commonheaders.cpp | 1 - plugins/Db3x/commonheaders.h | 17 +++++++++++++++-- plugins/Db3x/database.cpp | 1 - plugins/Db3x/db3x_10.vcxproj | 19 +++++++++---------- plugins/Db3x/db3x_10.vcxproj.filters | 21 +++++++++------------ plugins/Db3x/dbcache.cpp | 5 ----- plugins/Db3x/dbcontacts.cpp | 6 ------ plugins/Db3x/dbevents.cpp | 5 ----- plugins/Db3x/dbheaders.cpp | 4 ---- plugins/Db3x/dbmodulechain.cpp | 3 --- plugins/Db3x/dbsettings.cpp | 27 +++++++++++---------------- plugins/Db3x/encrypt.cpp | 1 - plugins/Db3x/encryption.h | 23 ----------------------- plugins/Db3x/init.cpp | 16 ++++++---------- 14 files changed, 50 insertions(+), 99 deletions(-) delete mode 100644 plugins/Db3x/commonheaders.cpp delete mode 100644 plugins/Db3x/encryption.h (limited to 'plugins/Db3x') diff --git a/plugins/Db3x/commonheaders.cpp b/plugins/Db3x/commonheaders.cpp deleted file mode 100644 index 14f99f7d71..0000000000 --- a/plugins/Db3x/commonheaders.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "commonheaders.h" diff --git a/plugins/Db3x/commonheaders.h b/plugins/Db3x/commonheaders.h index cd82b02679..4d31934ec9 100644 --- a/plugins/Db3x/commonheaders.h +++ b/plugins/Db3x/commonheaders.h @@ -37,16 +37,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <io.h> #include <string.h> #include <direct.h> -#include "resource.h" + #include <newpluginapi.h> #include <win2k.h> +#include <m_plugins.h> #include <m_system.h> #include <m_database.h> #include <m_langpack.h> + #include "version.h" +#include "database.h" +#include "resource.h" extern PLUGINLINK *pluginLink; - +extern HANDLE hDbFile; +extern CRITICAL_SECTION csDbAccess; +extern struct DBHeader dbHeader; +extern HANDLE hCacheHeap; +extern SortedList lContacts; +extern char szDbPath[MAX_PATH]; extern struct LIST_INTERFACE li; #ifdef __GNUC__ @@ -56,3 +65,7 @@ extern struct LIST_INTERFACE li; #endif #define NEWSTR_ALLOCA(A) (A==NULL)?NULL:strcpy((char*)alloca(strlen(A)+1),A) + +#ifndef MODULAR +void Encrypt(char*msg,BOOL up); +#endif \ No newline at end of file diff --git a/plugins/Db3x/database.cpp b/plugins/Db3x/database.cpp index 66148ecffe..0172bde5b2 100644 --- a/plugins/Db3x/database.cpp +++ b/plugins/Db3x/database.cpp @@ -21,7 +21,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -#include "database.h" int ProfileManager(char *szDbDest,int cbDbDest); int ShouldAutoCreate(void); diff --git a/plugins/Db3x/db3x_10.vcxproj b/plugins/Db3x/db3x_10.vcxproj index 67af429734..397f3748e9 100644 --- a/plugins/Db3x/db3x_10.vcxproj +++ b/plugins/Db3x/db3x_10.vcxproj @@ -201,18 +201,17 @@ </PreBuildEvent> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="commonheaders.c"> + <ClCompile Include="database.cpp" /> + <ClCompile Include="dbcache.cpp" /> + <ClCompile Include="dbcontacts.cpp" /> + <ClCompile Include="dbevents.cpp" /> + <ClCompile Include="dbheaders.cpp" /> + <ClCompile Include="dbmodulechain.cpp" /> + <ClCompile Include="dbsettings.cpp" /> + <ClCompile Include="encrypt.cpp" /> + <ClCompile Include="init.cpp"> <PrecompiledHeader>Create</PrecompiledHeader> </ClCompile> - <ClCompile Include="database.c" /> - <ClCompile Include="dbcache.c" /> - <ClCompile Include="dbcontacts.c" /> - <ClCompile Include="dbevents.c" /> - <ClCompile Include="dbheaders.c" /> - <ClCompile Include="dbmodulechain.c" /> - <ClCompile Include="dbsettings.c" /> - <ClCompile Include="encrypt.c" /> - <ClCompile Include="init.c" /> </ItemGroup> <ItemGroup> <ClInclude Include="commonheaders.h" /> diff --git a/plugins/Db3x/db3x_10.vcxproj.filters b/plugins/Db3x/db3x_10.vcxproj.filters index cd9abbcb11..444c119160 100644 --- a/plugins/Db3x/db3x_10.vcxproj.filters +++ b/plugins/Db3x/db3x_10.vcxproj.filters @@ -15,34 +15,31 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="commonheaders.c"> + <ClCompile Include="database.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="database.c"> + <ClCompile Include="dbcache.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="dbcache.c"> + <ClCompile Include="dbcontacts.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="dbcontacts.c"> + <ClCompile Include="dbevents.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="dbevents.c"> + <ClCompile Include="dbheaders.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="dbheaders.c"> + <ClCompile Include="dbmodulechain.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="dbmodulechain.c"> + <ClCompile Include="dbsettings.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="dbsettings.c"> + <ClCompile Include="encrypt.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="encrypt.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="init.c"> + <ClCompile Include="init.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/plugins/Db3x/dbcache.cpp b/plugins/Db3x/dbcache.cpp index 9e8cbc7a76..10d34e1ec3 100644 --- a/plugins/Db3x/dbcache.cpp +++ b/plugins/Db3x/dbcache.cpp @@ -22,15 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -#include "database.h" - #define CACHESECTIONSIZE 4096 #define CACHESECTIONCOUNT 32 -extern HANDLE hDbFile; -extern CRITICAL_SECTION csDbAccess; - static BOOL safetyMode=TRUE; static PBYTE pDbCache; static DWORD lastUseCounter; diff --git a/plugins/Db3x/dbcontacts.cpp b/plugins/Db3x/dbcontacts.cpp index 03f248457e..ba79325db8 100644 --- a/plugins/Db3x/dbcontacts.cpp +++ b/plugins/Db3x/dbcontacts.cpp @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -#include "database.h" static INT_PTR GetContactCount(WPARAM wParam,LPARAM lParam); static INT_PTR FindFirstContact(WPARAM wParam,LPARAM lParam); @@ -31,13 +30,8 @@ static INT_PTR DeleteContact(WPARAM wParam,LPARAM lParam); static INT_PTR AddContact(WPARAM wParam,LPARAM lParam); static INT_PTR IsDbContact(WPARAM wParam,LPARAM lParam); -extern CRITICAL_SECTION csDbAccess; -extern struct DBHeader dbHeader; static HANDLE hContactDeletedEvent,hContactAddedEvent; -extern HANDLE hCacheHeap; -extern SortedList lContacts; - int InitContacts(void) { CreateServiceFunction(MS_DB_CONTACT_GETCOUNT,GetContactCount); diff --git a/plugins/Db3x/dbevents.cpp b/plugins/Db3x/dbevents.cpp index aff845b76b..10d04c180e 100644 --- a/plugins/Db3x/dbevents.cpp +++ b/plugins/Db3x/dbevents.cpp @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -#include "database.h" - DWORD GetModuleNameOfs(const char *szName); char *GetModuleNameByOfs(DWORD ofs); @@ -41,9 +39,6 @@ static INT_PTR FindLastEvent(WPARAM wParam,LPARAM lParam); static INT_PTR FindNextEvent(WPARAM wParam,LPARAM lParam); static INT_PTR FindPrevEvent(WPARAM wParam,LPARAM lParam); -extern CRITICAL_SECTION csDbAccess; -extern struct DBHeader dbHeader; - static HANDLE hEventDeletedEvent,hEventAddedEvent,hEventFilterAddedEvent; int InitEvents(void) diff --git a/plugins/Db3x/dbheaders.cpp b/plugins/Db3x/dbheaders.cpp index da7cb6eb6d..8320102888 100644 --- a/plugins/Db3x/dbheaders.cpp +++ b/plugins/Db3x/dbheaders.cpp @@ -22,10 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -#include "database.h" - -extern struct DBHeader dbHeader; -extern HANDLE hDbFile; struct DBSignature { char name[15]; diff --git a/plugins/Db3x/dbmodulechain.cpp b/plugins/Db3x/dbmodulechain.cpp index 8b78b4dffa..f130937af2 100644 --- a/plugins/Db3x/dbmodulechain.cpp +++ b/plugins/Db3x/dbmodulechain.cpp @@ -22,9 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -#include "database.h" - -extern struct DBHeader dbHeader; static INT_PTR EnumModuleNames(WPARAM wParam,LPARAM lParam); diff --git a/plugins/Db3x/dbsettings.cpp b/plugins/Db3x/dbsettings.cpp index bda9b844aa..c9cd3d01f7 100644 --- a/plugins/Db3x/dbsettings.cpp +++ b/plugins/Db3x/dbsettings.cpp @@ -23,13 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -#include "database.h" - DWORD GetModuleNameOfs(const char *szName); -extern CRITICAL_SECTION csDbAccess; -extern struct DBHeader dbHeader; - HANDLE hCacheHeap = NULL; SortedList lContacts; @@ -199,7 +194,7 @@ static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllo if ( bAllocate != 1 ) return NULL; - V = HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedContactValue)); + V = (DBCachedContactValue *)HeapAlloc(hCacheHeap, HEAP_ZERO_MEMORY, sizeof(DBCachedContactValue)); V->next = VL->first; VL->first = V; V->name = szSetting; @@ -337,7 +332,7 @@ static __inline int GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING CopyMemory(dbcgs->pValue->pbVal,pBlob+3,dbcgs->pValue->cpbVal); } else { - dbcgs->pValue->pbVal=(char*)mir_alloc(*(PWORD)(pBlob+1)); + dbcgs->pValue->pbVal = (BYTE *)mir_alloc(*(PWORD)(pBlob + 1)); CopyMemory(dbcgs->pValue->pbVal,pBlob+3,*(PWORD)(pBlob+1)); } dbcgs->pValue->cpbVal=*(PWORD)(pBlob+1); @@ -398,7 +393,7 @@ static INT_PTR GetContactSetting(WPARAM wParam,LPARAM lParam) } else { dgs->pValue->type = DBVT_ASCIIZ; - dgs->pValue->pszVal = mir_alloc( result ); + dgs->pValue->pszVal = (char *)mir_alloc(result); WideCharToMultiByte( mirCp, WC_NO_BEST_FIT_CHARS, tmp, -1, dgs->pValue->pszVal, result, NULL, NULL ); mir_free( tmp ); } @@ -509,7 +504,7 @@ static INT_PTR SetSettingResident(WPARAM wParam,LPARAM lParam) if ( !li.List_GetIndex( &lSettings, szTemp, &idx )) szSetting = InsertCachedSetting( szTemp, cbSettingNameLen+2, idx ); else - szSetting = lSettings.items[ idx ]; + szSetting = (char *)lSettings.items[idx]; *szSetting = (char)wParam; @@ -960,13 +955,13 @@ int InitSettings(void) mirCp = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ); - hCacheHeap=HeapCreate(0,0,0); - lSettings.sortFunc=stringCompare; - lSettings.increment=50; - lContacts.sortFunc=HandleKeySort; - lContacts.increment=100; - lGlobalSettings.sortFunc=stringCompare2; - lGlobalSettings.increment=100; + hCacheHeap = HeapCreate(0, 0, 0); + lSettings.sortFunc = (FSortFunc)stringCompare; + lSettings.increment = 50; + lContacts.sortFunc = HandleKeySort; + lContacts.increment = 100; + lGlobalSettings.sortFunc = (FSortFunc)stringCompare2; + lGlobalSettings.increment = 100; return 0; } diff --git a/plugins/Db3x/encrypt.cpp b/plugins/Db3x/encrypt.cpp index 6e025337e5..7426a50cd7 100644 --- a/plugins/Db3x/encrypt.cpp +++ b/plugins/Db3x/encrypt.cpp @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -#include "database.h" //VERY VERY VERY BASIC ENCRYPTION FUNCTION diff --git a/plugins/Db3x/encryption.h b/plugins/Db3x/encryption.h deleted file mode 100644 index 73c2d7e13a..0000000000 --- a/plugins/Db3x/encryption.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -Miranda ICQ: the free icq client for MS Windows -Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef MODULAR -#include <windows.h> - -void Encrypt(char*msg,BOOL up); -#endif \ No newline at end of file diff --git a/plugins/Db3x/init.cpp b/plugins/Db3x/init.cpp index 2aceba5e6b..99740b93d0 100644 --- a/plugins/Db3x/init.cpp +++ b/plugins/Db3x/init.cpp @@ -22,16 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -#include "database.h" -#include <m_plugins.h> struct MM_INTERFACE mmi; struct LIST_INTERFACE li; struct UTF8_INTERFACE utfi; int hLangpack; -extern char szDbPath[MAX_PATH]; - HINSTANCE g_hInst=NULL; PLUGINLINK *pluginLink; @@ -124,7 +120,7 @@ static int grokHeader( char * profile, int * error ) // returns 0 if all the APIs are injected otherwise, 1 static int LoadDatabase( char * profile, void * plink ) { - PLUGINLINK *link = plink; + PLUGINLINK *link = (PLUGINLINK *)plink; #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif @@ -174,28 +170,28 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved) return TRUE; } -__declspec(dllexport) DATABASELINK* DatabasePluginInfo(void * reserved) +extern "C" __declspec(dllexport) DATABASELINK* DatabasePluginInfo(void * reserved) { return &dblink; } -__declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion) { return &pluginInfo; } static const MUUID interfaces[] = {MIID_DATABASE, MIID_LAST}; -__declspec(dllexport) const MUUID * MirandaPluginInterfaces(void) +extern "C" __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void) { return interfaces; } -int __declspec(dllexport) Load(PLUGINLINK * link) +extern "C" __declspec(dllexport) int Load(PLUGINLINK * link) { return 1; } -int __declspec(dllexport) Unload(void) +extern "C" __declspec(dllexport) int Unload(void) { return 0; } -- cgit v1.2.3