summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src/init.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-19 11:48:12 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-19 11:48:12 +0000
commit8dc7456651251bc112b9edd9b5fd1c4849d7c83d (patch)
tree3e2e376197c49e77488c109a129ea269b08cb38f /plugins/Db3x_mmap/src/init.cpp
parent8d428350dc3307f8ada75fafece2049cca84e969 (diff)
import to open a database in read-only mode
git-svn-id: http://svn.miranda-ng.org/main/trunk@8172 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/init.cpp')
-rw-r--r--plugins/Db3x_mmap/src/init.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/Db3x_mmap/src/init.cpp b/plugins/Db3x_mmap/src/init.cpp
index 8b1664d5aa..f2236976a6 100644
--- a/plugins/Db3x_mmap/src/init.cpp
+++ b/plugins/Db3x_mmap/src/init.cpp
@@ -49,7 +49,7 @@ LIST<CDb3Mmap> g_Dbs(1, HandleKeySortT);
// returns 0 if the profile is created, EMKPRF*
static int makeDatabase(const TCHAR *profile)
{
- std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile));
+ std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile, false));
if (db->Create() != ERROR_SUCCESS)
return EMKPRF_CREATEFAILED;
@@ -59,7 +59,7 @@ static int makeDatabase(const TCHAR *profile)
// returns 0 if the given profile has a valid header
static int grokHeader(const TCHAR *profile)
{
- std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile));
+ std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile, true));
if (db->Load(true) != ERROR_SUCCESS)
return EGROKPRF_CANTREAD;
@@ -67,12 +67,12 @@ static int grokHeader(const TCHAR *profile)
}
// returns 0 if all the APIs are injected otherwise, 1
-static MIDatabase* LoadDatabase(const TCHAR *profile)
+static MIDatabase* LoadDatabase(const TCHAR *profile, BOOL bReadOnly)
{
// set the memory, lists & UTF8 manager
mir_getLP(&pluginInfo);
- std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile));
+ std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile, bReadOnly != 0));
if (db->Load(false) != ERROR_SUCCESS)
return NULL;
@@ -89,7 +89,7 @@ static int UnloadDatabase(MIDatabase* db)
MIDatabaseChecker* CheckDb(const TCHAR* profile, int *error)
{
- std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile));
+ std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile, true));
if (db->Load(true) != ERROR_SUCCESS) {
*error = EGROKPRF_CANTREAD;
return NULL;