summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mmap_SA
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-06-23 17:52:37 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-06-23 17:52:37 +0000
commit00c758611455ee1a978d4644a2897dbfa17a420a (patch)
tree3edbe20e1497adf6f672a69837e9e0f70a4fdf07 /plugins/Dbx_mmap_SA
parenteda27f234053df69a304848c91aba90897d7d097 (diff)
Dbx_mmap_SA:
plusified git-svn-id: http://svn.miranda-ng.org/main/trunk@580 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mmap_SA')
-rw-r--r--plugins/Dbx_mmap_SA/commonheaders.cpp1
-rw-r--r--plugins/Dbx_mmap_SA/commonheaders.h2
-rw-r--r--plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj25
-rw-r--r--plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters27
-rw-r--r--plugins/Dbx_mmap_SA/dbcache.cpp4
-rw-r--r--plugins/Dbx_mmap_SA/dbmodulechain.cpp12
-rw-r--r--plugins/Dbx_mmap_SA/dbpreset.cpp8
-rw-r--r--plugins/Dbx_mmap_SA/dbsettings.cpp28
-rw-r--r--plugins/Dbx_mmap_SA/dialogs.cpp7
-rw-r--r--plugins/Dbx_mmap_SA/init.cpp16
-rw-r--r--plugins/Dbx_mmap_SA/security.cpp14
11 files changed, 68 insertions, 76 deletions
diff --git a/plugins/Dbx_mmap_SA/commonheaders.cpp b/plugins/Dbx_mmap_SA/commonheaders.cpp
deleted file mode 100644
index c9fe1b2686..0000000000
--- a/plugins/Dbx_mmap_SA/commonheaders.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "commonheaders.h" \ No newline at end of file
diff --git a/plugins/Dbx_mmap_SA/commonheaders.h b/plugins/Dbx_mmap_SA/commonheaders.h
index 9c893310fc..6d5dcd8d21 100644
--- a/plugins/Dbx_mmap_SA/commonheaders.h
+++ b/plugins/Dbx_mmap_SA/commonheaders.h
@@ -68,6 +68,8 @@ extern CRITICAL_SECTION csDbAccess;
extern struct DBHeader dbHeader;
extern HANDLE hDbFile;
extern BOOL bEncoding;
+extern HINSTANCE g_hInst;
+extern HANDLE hSetPwdMenu;
#ifdef __GNUC__
#define mir_i64(x) (x##LL)
diff --git a/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj b/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj
index 83f2251fdb..e4b53cfdb2 100644
--- a/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj
+++ b/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj
@@ -185,21 +185,20 @@
</Link>
</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="dbpreset.cpp" />
+ <ClCompile Include="dbsettings.cpp" />
+ <ClCompile Include="dialogs.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="dbpreset.c" />
- <ClCompile Include="dbsettings.c" />
- <ClCompile Include="dialogs.c" />
- <ClCompile Include="encrypt.c" />
- <ClCompile Include="init.c" />
- <ClCompile Include="security.c" />
+ <ClCompile Include="security.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h" />
diff --git a/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters b/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters
index b1a8ff852a..3b68708b63 100644
--- a/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters
+++ b/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters
@@ -15,43 +15,40 @@
</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="dbpreset.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="dbpreset.c">
+ <ClCompile Include="dbsettings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="dbsettings.c">
+ <ClCompile Include="dialogs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="dialogs.c">
+ <ClCompile Include="encrypt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="encrypt.c">
+ <ClCompile Include="init.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="init.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="security.c">
+ <ClCompile Include="security.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/plugins/Dbx_mmap_SA/dbcache.cpp b/plugins/Dbx_mmap_SA/dbcache.cpp
index 625d8aa775..bf5538a64f 100644
--- a/plugins/Dbx_mmap_SA/dbcache.cpp
+++ b/plugins/Dbx_mmap_SA/dbcache.cpp
@@ -40,7 +40,7 @@ void Map()
if (hMap)
{
- pDbCache = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS/*FILE_MAP_WRITE*/, 0, 0 ,0);
+ pDbCache = (PBYTE)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS/*FILE_MAP_WRITE*/, 0, 0 ,0);
if (!pDbCache)
DatabaseCorruption( _T("%s (MapViewOfFile failed. Code: %d)"));
}
@@ -189,7 +189,7 @@ int InitCache(void)
Map();
// zero region for reads outside the file
- pNull = calloc(ChunkSize,1);
+ pNull = (PBYTE)calloc(ChunkSize, 1);
CreateServiceFunction(MS_DB_SETSAFETYMODE,CacheSetSafetyMode);
diff --git a/plugins/Dbx_mmap_SA/dbmodulechain.cpp b/plugins/Dbx_mmap_SA/dbmodulechain.cpp
index 1af4226419..62d0b6b3c7 100644
--- a/plugins/Dbx_mmap_SA/dbmodulechain.cpp
+++ b/plugins/Dbx_mmap_SA/dbmodulechain.cpp
@@ -69,13 +69,13 @@ int InitModuleNames(void)
int nameLen;
char *mod;
- hModHeap=HeapCreate(0,0,0);
- lMods.sortFunc=ModCompare;
- lMods.increment=50;
- lOfs.sortFunc=OfsCompare;
- lOfs.increment=50;
+ hModHeap = HeapCreate(0, 0, 0);
+ lMods.sortFunc = (FSortFunc)ModCompare;
+ lMods.increment = 50;
+ lOfs.sortFunc = (FSortFunc)OfsCompare;
+ lOfs.increment = 50;
- ofsThis=dbHeader.ofsFirstModuleName;
+ ofsThis = dbHeader.ofsFirstModuleName;
dbmn=(struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL);
while(ofsThis) {
if(dbmn->signature!=DBMODULENAME_SIGNATURE) DatabaseCorruption(NULL);
diff --git a/plugins/Dbx_mmap_SA/dbpreset.cpp b/plugins/Dbx_mmap_SA/dbpreset.cpp
index 0bb6ebd3a0..3bf17a298e 100644
--- a/plugins/Dbx_mmap_SA/dbpreset.cpp
+++ b/plugins/Dbx_mmap_SA/dbpreset.cpp
@@ -65,7 +65,7 @@ int InitPreset()
if (!fp) return 0;
lstPresets = li.List_Create(0, 50);
- lstPresets->sortFunc = DBPresetItem_Cmp;
+ lstPresets->sortFunc = (FSortFunc)DBPresetItem_Cmp;
while(!feof(fp))
{
@@ -158,7 +158,7 @@ void UninitPreset()
int i;
if (!lstPresets) return;
for (i = 0; i < lstPresets->realCount; ++i)
- DBPresetItem_Destroy(lstPresets->items[i]);
+ DBPresetItem_Destroy((DBPresetItem *)lstPresets->items[i]);
li.List_Destroy(lstPresets);
}
@@ -172,7 +172,7 @@ int DBPreset_QuerySetting(const char *szModule, const char *szSetting, DBVARIANT
search.szModule = (char *)szModule;
search.szSetting = (char *)szSetting;
DBPresetItem_Hash(&search);
- item = li.List_Find(lstPresets, &search);
+ item = (DBPresetItem *)li.List_Find(lstPresets, &search);
if (!item) return FALSE;
@@ -208,7 +208,7 @@ int DBPreset_CompareSetting(const char *szModule, const char *szSetting, DBVARIA
search.szModule = (char *)szModule;
search.szSetting = (char *)szSetting;
DBPresetItem_Hash(&search);
- item = li.List_Find(lstPresets, &search);
+ item = (DBPresetItem *)li.List_Find(lstPresets, &search);
if (!item) return FALSE;
if (item->dbv.type != item->dbv.type) return FALSE;
diff --git a/plugins/Dbx_mmap_SA/dbsettings.cpp b/plugins/Dbx_mmap_SA/dbsettings.cpp
index 53717ecafb..b34b7baba3 100644
--- a/plugins/Dbx_mmap_SA/dbsettings.cpp
+++ b/plugins/Dbx_mmap_SA/dbsettings.cpp
@@ -183,7 +183,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));
if (VL->last)
VL->last->next = V;
else
@@ -345,7 +345,7 @@ static __inline int GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING
DecodeCopyMemory(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));
DecodeCopyMemory(dbcgs->pValue->pbVal,pBlob+3,*(PWORD)(pBlob+1));
}
dbcgs->pValue->cpbVal=*(PWORD)(pBlob+1);
@@ -419,7 +419,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 );
}
@@ -532,7 +532,7 @@ static INT_PTR SetSettingResident(WPARAM wParam, LPARAM lParam)
if ( !li.List_GetIndex( &lSettings, szTemp, &idx ))
szSetting = InsertCachedSetting( szTemp, cbSettingNameLen, idx );
else
- szSetting = lSettings.items[ idx ];
+ szSetting = (char *)lSettings.items[idx];
*szSetting = (char)wParam;
@@ -971,7 +971,7 @@ static INT_PTR EnumResidentSettings(WPARAM wParam, LPARAM lParam)
int i;
int ret;
for(i = 0; i < lResidentSettings.realCount; i++) {
- ret=((DBMODULEENUMPROC)lParam)(lResidentSettings.items[i],0,wParam);
+ ret = ((DBMODULEENUMPROC)lParam)((char *)lResidentSettings.items[i], 0, wParam);
if(ret) return ret;
}
return 0;
@@ -1146,15 +1146,15 @@ int InitSettings(void)
hSettingChangeEvent=CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
- hCacheHeap=HeapCreate(0,0,0);
- lSettings.sortFunc=stringCompare;
- lSettings.increment=100;
- lContacts.sortFunc=HandleKeySort;
- lContacts.increment=50;
- lGlobalSettings.sortFunc=HandleKeySort;
- lGlobalSettings.increment=50;
- lResidentSettings.sortFunc=stringCompare2;
- lResidentSettings.increment=50;
+ hCacheHeap = HeapCreate(0, 0, 0);
+ lSettings.sortFunc = (FSortFunc)stringCompare;
+ lSettings.increment = 100;
+ lContacts.sortFunc = HandleKeySort;
+ lContacts.increment = 50;
+ lGlobalSettings.sortFunc = HandleKeySort;
+ lGlobalSettings.increment = 50;
+ lResidentSettings.sortFunc = (FSortFunc)stringCompare2;
+ lResidentSettings.increment = 50;
mirCp = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 );
return 0;
diff --git a/plugins/Dbx_mmap_SA/dialogs.cpp b/plugins/Dbx_mmap_SA/dialogs.cpp
index df13214b62..ffa0516fae 100644
--- a/plugins/Dbx_mmap_SA/dialogs.cpp
+++ b/plugins/Dbx_mmap_SA/dialogs.cpp
@@ -10,7 +10,6 @@
extern char encryptKey[255];
extern size_t encryptKeyLength;
-extern HANDLE g_hInst;
HANDLE hSetPwdMenu;
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -53,9 +52,9 @@ static int OptionsInit(WPARAM wParam, LPARAM lParam)
odp.position = -790000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.flags = ODPF_BOLDGROUPS;
- odp.pszTitle = LPGEN("Database Features");
- odp.pszGroup = LPGEN("Services");
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ odp.ptszTitle = LPGENT("Database Features");
+ odp.ptszGroup = LPGENT("Services");
odp.pfnDlgProc = DlgProcOptions;
Options_AddPage(wParam, &odp);
diff --git a/plugins/Dbx_mmap_SA/init.cpp b/plugins/Dbx_mmap_SA/init.cpp
index f13a4b5667..afc8cba593 100644
--- a/plugins/Dbx_mmap_SA/init.cpp
+++ b/plugins/Dbx_mmap_SA/init.cpp
@@ -30,7 +30,7 @@ int hLangpack;
extern char szDbPath[MAX_PATH];
-HINSTANCE g_hInst=NULL;
+HINSTANCE g_hInst = NULL;
PLUGINLINK *pluginLink;
PLUGININFOEX pluginInfo = {
@@ -121,7 +121,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
@@ -189,28 +189,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;
-}
+} \ No newline at end of file
diff --git a/plugins/Dbx_mmap_SA/security.cpp b/plugins/Dbx_mmap_SA/security.cpp
index f4b9b06004..bce6a55843 100644
--- a/plugins/Dbx_mmap_SA/security.cpp
+++ b/plugins/Dbx_mmap_SA/security.cpp
@@ -5,10 +5,6 @@
BOOL bEncoding;
BOOL bEncProcess = 0;
-extern HINSTANCE g_hInst;
-
-extern HANDLE hSetPwdMenu = NULL;
-
char encryptKey[255];
size_t encryptKeyLength;
@@ -91,7 +87,7 @@ void EncodeCopyMemory(void * dst, void * src, size_t size )
if (!bEncoding)
return;
- CryptoEngine->EncryptMem(dst, (int)size, key);
+ CryptoEngine->EncryptMem((BYTE *)dst, (int)size, key);
}
void DecodeCopyMemory(void * dst, void * src, size_t size )
@@ -101,7 +97,7 @@ void DecodeCopyMemory(void * dst, void * src, size_t size )
if (!bEncoding)
return;
- CryptoEngine->DecryptMem(dst, (int)size, key);
+ CryptoEngine->DecryptMem((BYTE *)dst, (int)size, key);
}
void EncodeDBWrite(DWORD ofs, void * src, size_t size)
@@ -346,7 +342,7 @@ void DecryptDB()
bEncoding = 0;
- zero_fill(encryptKey, sizeof encryptKey);
+ zero_fill((BYTE *)encryptKey, sizeof encryptKey);
xModifyMenu(hSetPwdMenu, 0, LPGENT("Set Password"), 0);
@@ -400,7 +396,7 @@ void ChangePwd()
CryptoEngine = NULL;
DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0);
- zero_fill(encryptKey, sizeof encryptKey);
+ zero_fill((BYTE *)encryptKey, sizeof encryptKey);
xModifyMenu(hSetPwdMenu, 0, LPGENT("Set Password"), 0);
}
@@ -418,7 +414,7 @@ void ChangePwd()
WriteCryptHeader();
}
- zero_fill(newpass, sizeof newpass);
+ zero_fill((BYTE *)newpass, sizeof newpass);
LeaveCriticalSection(&csDbAccess);
} \ No newline at end of file