diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-20 15:56:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-20 15:56:25 +0000 |
commit | bfe1bd0fc087be44c70904aee0fe4276643d206d (patch) | |
tree | d5376d7cab1f6e5084a1449dc341c325b6cee45c /plugins/Db3x/src | |
parent | 8593e7594773c30b35488bb6a45fcc782ed5df0c (diff) |
- db3x_mmap is completely moved to a class;
- the old nightmare in the core "How to detect a db plugin and load it" is eliminated forever;
- databases are the usual plugins now (loadable via Load)
- dynamic DATABASELINK registration
git-svn-id: http://svn.miranda-ng.org/main/trunk@1082 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x/src')
-rw-r--r-- | plugins/Db3x/src/init.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/plugins/Db3x/src/init.cpp b/plugins/Db3x/src/init.cpp index b2b3f1fa72..ab0e6b4357 100644 --- a/plugins/Db3x/src/init.cpp +++ b/plugins/Db3x/src/init.cpp @@ -44,13 +44,8 @@ CDdxMmap* g_Db = NULL; /////////////////////////////////////////////////////////////////////////////////////////
-static int getCapability( int flag )
-{
- return 0;
-}
-
// returns 0 if the profile is created, EMKPRF*
-static int makeDatabase(TCHAR *profile, int * error)
+static int makeDatabase(const TCHAR *profile, int * error)
{
HANDLE hFile = CreateFile(profile, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
if ( hFile != INVALID_HANDLE_VALUE ) {
@@ -63,7 +58,7 @@ static int makeDatabase(TCHAR *profile, int * error) }
// returns 0 if the given profile has a valid header
-static int grokHeader(TCHAR *profile, int * error )
+static int grokHeader(const TCHAR *profile, int * error )
{
int rc = 1;
int chk = 0;
@@ -115,7 +110,7 @@ static int grokHeader(TCHAR *profile, int * error ) }
// returns 0 if all the APIs are injected otherwise, 1
-static MIDatabase* LoadDatabase(TCHAR *profile)
+static MIDatabase* LoadDatabase(const TCHAR *profile)
{
if (g_Db) delete g_Db;
g_Db = new CDdxMmap(profile);
@@ -131,23 +126,16 @@ static MIDatabase* LoadDatabase(TCHAR *profile) return g_Db;
}
-static int UnloadDatabase(int wasLoaded)
+static int UnloadDatabase(MIDatabase* db)
{
- if ( !wasLoaded) return 0;
UnloadDatabaseModule();
return 0;
}
-static int getFriendlyName( TCHAR *buf, size_t cch, int shortName )
-{
- _tcsncpy(buf, shortName ? _T("db3x driver") : _T("db3x database support"), cch);
- return 0;
-}
-
static DATABASELINK dblink = {
sizeof(DATABASELINK),
- getCapability,
- getFriendlyName,
+ "db3x driver",
+ _T("db3x database support"),
makeDatabase,
grokHeader,
LoadDatabase,
@@ -174,7 +162,8 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_DATABAS extern "C" __declspec(dllexport) int Load(void)
{
- return 1;
+ RegisterDatabasePlugin(&dblink);
+ return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
|