summaryrefslogtreecommitdiff
path: root/plugins/Dbx_tree
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-28 12:35:00 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-28 12:35:00 +0000
commita7001dfd139fbb9d5cf5434fc40370f8da0cf04c (patch)
tree844416b2bc429054557bda440e75f466f1e30bf7 /plugins/Dbx_tree
parentd5defc979cd71a5f2bb5176382fa2f5f50f23d1b (diff)
perversive error reporting schema in DATABASELINK removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@1223 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_tree')
-rw-r--r--plugins/Dbx_tree/DatabaseLink.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/plugins/Dbx_tree/DatabaseLink.cpp b/plugins/Dbx_tree/DatabaseLink.cpp
index ec71cdeca1..579076613d 100644
--- a/plugins/Dbx_tree/DatabaseLink.cpp
+++ b/plugins/Dbx_tree/DatabaseLink.cpp
@@ -34,13 +34,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Note: Do not initialise internal data structures at this point!
Returns: 0 on success, non zero on failure - error contains extended error information, see EMKPRF_*
*/
-static int makeDatabase(const TCHAR *profile, int* error)
-{
- if (gDataBase) delete gDataBase;
- gDataBase = new CDataBase(profile);
- *error = gDataBase->CreateDB();
- return *error;
+static int makeDatabase(const TCHAR *profile)
+{
+ std::auto_ptr<CDataBase> db( new CDataBase(profile));
+ return gDataBase->CreateDB();
}
/*
@@ -53,13 +51,10 @@ static int makeDatabase(const TCHAR *profile, int* error)
etc.
Returns: 0 on success, non zero on failure
*/
-static int grokHeader(const TCHAR *profile, int* error)
+static int grokHeader(const TCHAR *profile)
{
- if (gDataBase) delete gDataBase;
- gDataBase = new CDataBase(profile);
-
- *error = gDataBase->CheckDB();
- return *error;
+ std::auto_ptr<CDataBase> db( new CDataBase(profile));
+ return gDataBase->CheckDB();
}
/*
@@ -70,9 +65,7 @@ Returns: 0 on success, nonzero on failure
static MIDatabase* LoadDatabase(const TCHAR *profile)
{
- if (gDataBase) delete gDataBase;
gDataBase = new CDataBase(profile);
-
gDataBase->OpenDB();
return gDataBase;
}
@@ -82,12 +75,12 @@ Affect: The database plugin should shutdown, unloading things from the core and
Returns: 0 on success, nonzero on failure
Note: Unload() might be called even if Load(void) was never called, wasLoaded is set to 1 if Load(void) was ever called.
*/
+
static int UnloadDatabase(MIDatabase* db)
{
- if (gDataBase)
- delete gDataBase;
-
- gDataBase = NULL;
+ if (gDataBase == db)
+ gDataBase = NULL;
+ delete db;
return 0;
}