mirror of https://github.com/djcb/mu.git
lib: fix a few compiler warnings
WARN_C(XX)FLAGS is really strict.
This commit is contained in:
parent
5a03c115c9
commit
688507f193
|
@ -37,8 +37,8 @@
|
|||
|
||||
class MuStoreError {
|
||||
public:
|
||||
MuStoreError (MuError err, const std::string& what):
|
||||
_err (err), _what(what) {}
|
||||
MuStoreError (MuError err, const std::string& whatarg):
|
||||
_err (err), _what(whatarg) {}
|
||||
MuError mu_error () const { return _err; }
|
||||
const std::string& what() const { return _what; }
|
||||
private:
|
||||
|
@ -50,17 +50,17 @@ private:
|
|||
struct _MuStore {
|
||||
public:
|
||||
/* create a read-write MuStore */
|
||||
_MuStore (const char *path, const char *contacts_path,
|
||||
_MuStore (const char *patharg, const char *contacts_path,
|
||||
bool rebuild) {
|
||||
|
||||
init (path, contacts_path, rebuild, false);
|
||||
init (patharg, contacts_path, rebuild, false);
|
||||
|
||||
if (rebuild)
|
||||
_db = new Xapian::WritableDatabase
|
||||
(path, Xapian::DB_CREATE_OR_OVERWRITE);
|
||||
(patharg, Xapian::DB_CREATE_OR_OVERWRITE);
|
||||
else
|
||||
_db = new Xapian::WritableDatabase
|
||||
(path, Xapian::DB_CREATE_OR_OPEN);
|
||||
(patharg, Xapian::DB_CREATE_OR_OPEN);
|
||||
|
||||
check_set_version ();
|
||||
|
||||
|
@ -81,10 +81,10 @@ public:
|
|||
}
|
||||
|
||||
/* create a read-only MuStore */
|
||||
_MuStore (const char *path) {
|
||||
_MuStore (const char *patharg) {
|
||||
|
||||
init (path, NULL, false, false);
|
||||
_db = new Xapian::Database (path);
|
||||
init (patharg, NULL, false, false);
|
||||
_db = new Xapian::Database (patharg);
|
||||
|
||||
if (!mu_store_versions_match(this)) {
|
||||
char *errstr =
|
||||
|
@ -100,31 +100,31 @@ public:
|
|||
MU_WRITE_LOG ("%s: opened %s read-only", __func__, this->path());
|
||||
}
|
||||
|
||||
void init (const char *path, const char *contacts_path,
|
||||
void init (const char *patharg, const char *contacts_path,
|
||||
bool rebuild, bool read_only) {
|
||||
|
||||
|
||||
_my_addresses = NULL;
|
||||
_batch_size = DEFAULT_BATCH_SIZE;
|
||||
_contacts = 0;
|
||||
_in_transaction = false;
|
||||
_path = path;
|
||||
_path = patharg;
|
||||
_processed = 0;
|
||||
_read_only = read_only;
|
||||
_ref_count = 1;
|
||||
_version = NULL;
|
||||
}
|
||||
|
||||
void set_my_addresses (const char **my_addresses) {
|
||||
void set_my_addresses (const char **addrs) {
|
||||
|
||||
if (_my_addresses) {
|
||||
mu_str_free_list (_my_addresses);
|
||||
_my_addresses = NULL;
|
||||
}
|
||||
|
||||
while (my_addresses && *my_addresses) {
|
||||
while (addrs && *addrs) {
|
||||
_my_addresses = g_slist_prepend
|
||||
(_my_addresses, g_strdup (*my_addresses));
|
||||
++my_addresses;
|
||||
(_my_addresses, g_strdup (*addrs));
|
||||
++addrs;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public:
|
|||
mu_store_set_metadata (this, MU_STORE_VERSION_KEY,
|
||||
MU_STORE_SCHEMA_VERSION, NULL);
|
||||
_version = mu_store_get_metadata (this, MU_STORE_VERSION_KEY, NULL);
|
||||
|
||||
|
||||
} else if (g_strcmp0 (_version, MU_STORE_SCHEMA_VERSION) != 0)
|
||||
throw MuStoreError (MU_ERROR_XAPIAN_VERSION_MISMATCH,
|
||||
"the database needs a rebuild");
|
||||
|
@ -149,7 +149,7 @@ public:
|
|||
|
||||
mu_contacts_destroy (_contacts);
|
||||
_contacts = NULL;
|
||||
|
||||
|
||||
if (!_read_only)
|
||||
mu_store_flush (this);
|
||||
|
||||
|
@ -190,10 +190,10 @@ public:
|
|||
return _version;
|
||||
}
|
||||
|
||||
void set_version (const char *version) {
|
||||
void set_version (const char *vers) {
|
||||
g_free (_version);
|
||||
_version = NULL;
|
||||
mu_store_set_metadata (this, MU_STORE_VERSION_KEY, version, NULL);
|
||||
mu_store_set_metadata (this, MU_STORE_VERSION_KEY, vers, NULL);
|
||||
}
|
||||
|
||||
static unsigned max_term_length() { return MAX_TERM_LENGTH; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-mode: c++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8-*- */
|
||||
/*
|
||||
** Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
** Copyright (C) 2008-2017 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** 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
|
||||
|
@ -33,7 +33,6 @@
|
|||
#include "mu-store.h"
|
||||
#include "mu-store-priv.hh" /* _MuStore */
|
||||
|
||||
|
||||
#include "mu-msg.h"
|
||||
#include "mu-msg-part.h"
|
||||
#include "mu-store.h"
|
||||
|
@ -66,8 +65,6 @@ mu_store_unref (MuStore *store)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static char*
|
||||
xapian_get_metadata (const gchar *xpath, const gchar *key)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue