mu: fix some compiler warnings
This commit is contained in:
137
lib/Makefile.am
137
lib/Makefile.am
@ -20,77 +20,90 @@ include $(top_srcdir)/gtest.mk
|
||||
# before decending into tests/
|
||||
SUBDIRS= . tests
|
||||
|
||||
AM_CPPFLAGS=$(XAPIAN_CXXFLAGS) $(GMIME_CFLAGS) $(GLIB_CFLAGS) $(GUILE_CFLAGS)
|
||||
AM_CFLAGS= \
|
||||
$(WARN_CFLAGS) \
|
||||
-Wno-format-nonliteral \
|
||||
-Wno-switch-enum \
|
||||
$(GMIME_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(GUILE_CFLAGS)
|
||||
|
||||
AM_CXXFLAGS= \
|
||||
$(WARN_CXXFLAGS) \
|
||||
$(GMIME_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(XAPIAN_CXXFLAGS) \
|
||||
$(GUILE_CFLAGS)
|
||||
|
||||
# don't use -Werror, as it might break on other compilers
|
||||
# use -Wno-unused-parameters, because some callbacks may not
|
||||
# really need all the params they get
|
||||
AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter \
|
||||
-Wdeclaration-after-statement -Wno-variadic-macros
|
||||
AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
||||
# AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter \
|
||||
# -Wdeclaration-after-statement -Wno-variadic-macros
|
||||
# AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
||||
|
||||
noinst_LTLIBRARIES= \
|
||||
noinst_LTLIBRARIES= \
|
||||
libmu.la
|
||||
|
||||
libmu_la_SOURCES= \
|
||||
mu-bookmarks.c \
|
||||
mu-bookmarks.h \
|
||||
mu-contacts.c \
|
||||
mu-contacts.h \
|
||||
mu-container.c \
|
||||
mu-container.h \
|
||||
mu-date.c \
|
||||
mu-date.h \
|
||||
mu-flags.h \
|
||||
mu-flags.c \
|
||||
mu-index.c \
|
||||
mu-index.h \
|
||||
mu-log.c \
|
||||
mu-log.h \
|
||||
mu-maildir.c \
|
||||
mu-maildir.h \
|
||||
mu-msg-crypto.c \
|
||||
mu-msg-doc.cc \
|
||||
mu-msg-doc.h \
|
||||
mu-msg-fields.c \
|
||||
mu-msg-fields.h \
|
||||
mu-msg-file.c \
|
||||
mu-msg-file.h \
|
||||
mu-msg-iter.cc \
|
||||
mu-msg-iter.h \
|
||||
mu-msg-part.c \
|
||||
mu-msg-part.h \
|
||||
mu-msg-prio.c \
|
||||
mu-msg-prio.h \
|
||||
mu-msg-priv.h \
|
||||
mu-msg-sexp.c \
|
||||
mu-msg.c \
|
||||
mu-msg.h \
|
||||
mu-msg.h \
|
||||
mu-query.cc \
|
||||
mu-query.h \
|
||||
mu-runtime.c \
|
||||
mu-runtime.h \
|
||||
mu-script.c \
|
||||
mu-script.h \
|
||||
mu-store.cc \
|
||||
mu-store.h \
|
||||
mu-store-read.cc \
|
||||
mu-store-write.cc \
|
||||
mu-store-priv.hh \
|
||||
mu-str.c \
|
||||
mu-str.h \
|
||||
mu-threader.c \
|
||||
mu-threader.h \
|
||||
mu-util.c \
|
||||
libmu_la_SOURCES= \
|
||||
mu-bookmarks.c \
|
||||
mu-bookmarks.h \
|
||||
mu-contacts.c \
|
||||
mu-contacts.h \
|
||||
mu-container.c \
|
||||
mu-container.h \
|
||||
mu-date.c \
|
||||
mu-date.h \
|
||||
mu-flags.h \
|
||||
mu-flags.c \
|
||||
mu-index.c \
|
||||
mu-index.h \
|
||||
mu-log.c \
|
||||
mu-log.h \
|
||||
mu-maildir.c \
|
||||
mu-maildir.h \
|
||||
mu-msg-crypto.c \
|
||||
mu-msg-doc.cc \
|
||||
mu-msg-doc.h \
|
||||
mu-msg-fields.c \
|
||||
mu-msg-fields.h \
|
||||
mu-msg-file.c \
|
||||
mu-msg-file.h \
|
||||
mu-msg-iter.cc \
|
||||
mu-msg-iter.h \
|
||||
mu-msg-part.c \
|
||||
mu-msg-part.h \
|
||||
mu-msg-prio.c \
|
||||
mu-msg-prio.h \
|
||||
mu-msg-priv.h \
|
||||
mu-msg-sexp.c \
|
||||
mu-msg.c \
|
||||
mu-msg.h \
|
||||
mu-msg.h \
|
||||
mu-query.cc \
|
||||
mu-query.h \
|
||||
mu-runtime.c \
|
||||
mu-runtime.h \
|
||||
mu-script.c \
|
||||
mu-script.h \
|
||||
mu-store.cc \
|
||||
mu-store.h \
|
||||
mu-store-read.cc \
|
||||
mu-store-write.cc \
|
||||
mu-store-priv.hh \
|
||||
mu-str.c \
|
||||
mu-str.h \
|
||||
mu-threader.c \
|
||||
mu-threader.h \
|
||||
mu-util.c \
|
||||
mu-util.h
|
||||
|
||||
libmu_la_LIBADD= \
|
||||
$(XAPIAN_LIBS) \
|
||||
$(GMIME_LIBS) \
|
||||
$(GLIB_LIBS) \
|
||||
libmu_la_LIBADD= \
|
||||
$(XAPIAN_LIBS) \
|
||||
$(GMIME_LIBS) \
|
||||
$(GLIB_LIBS) \
|
||||
$(GUILE_LIBS)
|
||||
|
||||
EXTRA_DIST= \
|
||||
mu-msg-crypto.c \
|
||||
EXTRA_DIST= \
|
||||
mu-msg-crypto.c \
|
||||
doxyfile.in
|
||||
|
||||
@ -48,7 +48,7 @@ static ContactInfo *contact_info_new (char *email, char *name,
|
||||
gboolean personal, time_t tstamp, unsigned freq);
|
||||
|
||||
struct _MuContacts {
|
||||
GKeyFile *_ccache;
|
||||
GKeyFile *_ccache;
|
||||
gchar *_path;
|
||||
|
||||
GHashTable *_hash;
|
||||
@ -245,7 +245,7 @@ encode_email_address (const char *addr)
|
||||
/* downcase the domain-part of the email address, but only if it
|
||||
* consists of ascii (to prevent screwing up idna addresses)
|
||||
*/
|
||||
char*
|
||||
static char*
|
||||
downcase_domain_maybe (const char *addr)
|
||||
{
|
||||
char *addr_conv, *at, *cur;
|
||||
|
||||
@ -650,7 +650,7 @@ mu_msg_part_foreach (MuMsg *msg, MuMsgOptions opts,
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
write_part_to_fd (GMimePart *part, int fd, GError **err)
|
||||
{
|
||||
GMimeStream *stream;
|
||||
|
||||
@ -807,7 +807,7 @@ mu_msg_is_readable (MuMsg *self)
|
||||
* from the /bar
|
||||
* that we got
|
||||
*/
|
||||
char*
|
||||
static char*
|
||||
get_target_mdir (MuMsg *msg, const char *target_maildir, GError **err)
|
||||
{
|
||||
char *rootmaildir, *rv;
|
||||
|
||||
14
lib/mu-msg.h
14
lib/mu-msg.h
@ -82,7 +82,7 @@ typedef enum _MuMsgOptions MuMsgOptions;
|
||||
*/
|
||||
MuMsg *mu_msg_new_from_file (const char* filepath, const char *maildir,
|
||||
GError **err)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
/**
|
||||
@ -280,18 +280,6 @@ const char* mu_msg_get_msgid (MuMsg *msg);
|
||||
const char* mu_msg_get_mailing_list (MuMsg *msg);
|
||||
|
||||
|
||||
/**
|
||||
* get any arbitrary header from this message
|
||||
*
|
||||
* @param msg a valid MuMsg* instance
|
||||
* @header the header requested
|
||||
*
|
||||
* @return the header requested or NULL in case of error or if there
|
||||
* is no such header. the returned string should *not* be modified or freed.
|
||||
*/
|
||||
const char* mu_msg_get_header (MuMsg *msg,
|
||||
const char* header);
|
||||
|
||||
/**
|
||||
* get the message date/time (the Date: field) as time_t, using UTC
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
** Copyright (C) 2008-2016 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
|
||||
@ -61,22 +61,22 @@ public:
|
||||
private:
|
||||
std::string to_sortable (std::string& s, bool is_begin) {
|
||||
|
||||
const char* str;
|
||||
time_t t;
|
||||
const char* tmp;
|
||||
time_t t;
|
||||
|
||||
// note: if s is empty and not is_begin, xapian seems
|
||||
// to repeat it.
|
||||
if (s.empty() || g_str_has_suffix (s.c_str(), "..")) {
|
||||
str = mu_date_complete_s ("", is_begin);
|
||||
tmp = mu_date_complete_s ("", is_begin);
|
||||
} else {
|
||||
str = mu_date_interpret_s (s.c_str(),
|
||||
tmp = mu_date_interpret_s (s.c_str(),
|
||||
is_begin ? TRUE: FALSE);
|
||||
str = mu_date_complete_s (str, is_begin ? TRUE: FALSE);
|
||||
t = mu_date_str_to_time_t (str, TRUE /*local*/);
|
||||
str = mu_date_time_t_to_str_s (t, FALSE /*UTC*/);
|
||||
tmp = mu_date_complete_s (tmp, is_begin ? TRUE: FALSE);
|
||||
t = mu_date_str_to_time_t (tmp, TRUE /*local*/);
|
||||
tmp = mu_date_time_t_to_str_s (t, FALSE /*UTC*/);
|
||||
}
|
||||
|
||||
return s = std::string(str);
|
||||
return s = std::string(tmp);
|
||||
}
|
||||
|
||||
|
||||
@ -145,12 +145,12 @@ private:
|
||||
}
|
||||
|
||||
bool substitute_size (std::string& size) {
|
||||
gchar str[16];
|
||||
gchar buf[16];
|
||||
gint64 num = mu_str_size_parse_bkm(size.c_str());
|
||||
if (num < 0)
|
||||
throw Xapian::QueryParserError ("invalid size");
|
||||
snprintf (str, sizeof(str), "%" G_GUINT64_FORMAT, num);
|
||||
size = str;
|
||||
snprintf (buf, sizeof(buf), "%" G_GUINT64_FORMAT, num);
|
||||
size = buf;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -117,28 +117,6 @@ mu_util_dir_expand (const char *path)
|
||||
return g_strdup (resolved);
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
mu_util_create_tmpdir (void)
|
||||
{
|
||||
gchar *dirname;
|
||||
|
||||
dirname = g_strdup_printf ("%s%cmu-%d%c%x",
|
||||
g_get_tmp_dir(),
|
||||
G_DIR_SEPARATOR,
|
||||
getuid(),
|
||||
G_DIR_SEPARATOR,
|
||||
(int)random()*getpid()*(int)time(NULL));
|
||||
|
||||
if (!mu_util_create_dir_maybe (dirname, 0700, FALSE)) {
|
||||
g_free (dirname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dirname;
|
||||
}
|
||||
|
||||
|
||||
GQuark
|
||||
mu_util_error_quark (void)
|
||||
{
|
||||
@ -482,6 +460,7 @@ mu_util_g_set_error (GError **err, MuError errcode, const char *frm, ...)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static gboolean
|
||||
print_args (FILE *stream, const char *frm, va_list args)
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2010-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
## Copyright (C) 2010-2016 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
|
||||
@ -25,10 +25,13 @@ AM_CPPFLAGS=-I${top_srcdir}/lib $(GLIB_CFLAGS)
|
||||
# don't use -Werror, as it might break on other compilers
|
||||
# use -Wno-unused-parameters, because some callbacks may not
|
||||
# really need all the params they get
|
||||
AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement \
|
||||
-Wno-variadic-macros \
|
||||
-DMU_SCRIPTS_DIR="\"$(pkgdatadir)/scripts/\""
|
||||
AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
||||
AM_CFLAGS= \
|
||||
$(WARN_CFLAGS) \
|
||||
-Wno-switch-enum \
|
||||
-DMU_SCRIPTS_DIR="\"$(pkgdatadir)/scripts/\""
|
||||
|
||||
AM_CXXFLAGS= \
|
||||
$(WARN_CXXFLAGS)
|
||||
|
||||
bin_PROGRAMS= \
|
||||
mu
|
||||
@ -52,7 +55,7 @@ BUILT_SOURCES= \
|
||||
mu-help-strings.h
|
||||
|
||||
mu-help-strings.h: mu-help-strings.txt mu-help-strings.awk
|
||||
$(AWK) -f ${top_srcdir}/mu/mu-help-strings.awk < $< > $@
|
||||
$(AM_V_GEN) $(AWK) -f ${top_srcdir}/mu/mu-help-strings.awk < $< > $@
|
||||
|
||||
mu_LDADD= \
|
||||
${top_builddir}/lib/libmu.la \
|
||||
|
||||
Reference in New Issue
Block a user