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/
|
# before decending into tests/
|
||||||
SUBDIRS= . 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
|
# don't use -Werror, as it might break on other compilers
|
||||||
# use -Wno-unused-parameters, because some callbacks may not
|
# use -Wno-unused-parameters, because some callbacks may not
|
||||||
# really need all the params they get
|
# really need all the params they get
|
||||||
AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter \
|
# AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter \
|
||||||
-Wdeclaration-after-statement -Wno-variadic-macros
|
# -Wdeclaration-after-statement -Wno-variadic-macros
|
||||||
AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
# AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
||||||
|
|
||||||
noinst_LTLIBRARIES= \
|
noinst_LTLIBRARIES= \
|
||||||
libmu.la
|
libmu.la
|
||||||
|
|
||||||
libmu_la_SOURCES= \
|
libmu_la_SOURCES= \
|
||||||
mu-bookmarks.c \
|
mu-bookmarks.c \
|
||||||
mu-bookmarks.h \
|
mu-bookmarks.h \
|
||||||
mu-contacts.c \
|
mu-contacts.c \
|
||||||
mu-contacts.h \
|
mu-contacts.h \
|
||||||
mu-container.c \
|
mu-container.c \
|
||||||
mu-container.h \
|
mu-container.h \
|
||||||
mu-date.c \
|
mu-date.c \
|
||||||
mu-date.h \
|
mu-date.h \
|
||||||
mu-flags.h \
|
mu-flags.h \
|
||||||
mu-flags.c \
|
mu-flags.c \
|
||||||
mu-index.c \
|
mu-index.c \
|
||||||
mu-index.h \
|
mu-index.h \
|
||||||
mu-log.c \
|
mu-log.c \
|
||||||
mu-log.h \
|
mu-log.h \
|
||||||
mu-maildir.c \
|
mu-maildir.c \
|
||||||
mu-maildir.h \
|
mu-maildir.h \
|
||||||
mu-msg-crypto.c \
|
mu-msg-crypto.c \
|
||||||
mu-msg-doc.cc \
|
mu-msg-doc.cc \
|
||||||
mu-msg-doc.h \
|
mu-msg-doc.h \
|
||||||
mu-msg-fields.c \
|
mu-msg-fields.c \
|
||||||
mu-msg-fields.h \
|
mu-msg-fields.h \
|
||||||
mu-msg-file.c \
|
mu-msg-file.c \
|
||||||
mu-msg-file.h \
|
mu-msg-file.h \
|
||||||
mu-msg-iter.cc \
|
mu-msg-iter.cc \
|
||||||
mu-msg-iter.h \
|
mu-msg-iter.h \
|
||||||
mu-msg-part.c \
|
mu-msg-part.c \
|
||||||
mu-msg-part.h \
|
mu-msg-part.h \
|
||||||
mu-msg-prio.c \
|
mu-msg-prio.c \
|
||||||
mu-msg-prio.h \
|
mu-msg-prio.h \
|
||||||
mu-msg-priv.h \
|
mu-msg-priv.h \
|
||||||
mu-msg-sexp.c \
|
mu-msg-sexp.c \
|
||||||
mu-msg.c \
|
mu-msg.c \
|
||||||
mu-msg.h \
|
mu-msg.h \
|
||||||
mu-msg.h \
|
mu-msg.h \
|
||||||
mu-query.cc \
|
mu-query.cc \
|
||||||
mu-query.h \
|
mu-query.h \
|
||||||
mu-runtime.c \
|
mu-runtime.c \
|
||||||
mu-runtime.h \
|
mu-runtime.h \
|
||||||
mu-script.c \
|
mu-script.c \
|
||||||
mu-script.h \
|
mu-script.h \
|
||||||
mu-store.cc \
|
mu-store.cc \
|
||||||
mu-store.h \
|
mu-store.h \
|
||||||
mu-store-read.cc \
|
mu-store-read.cc \
|
||||||
mu-store-write.cc \
|
mu-store-write.cc \
|
||||||
mu-store-priv.hh \
|
mu-store-priv.hh \
|
||||||
mu-str.c \
|
mu-str.c \
|
||||||
mu-str.h \
|
mu-str.h \
|
||||||
mu-threader.c \
|
mu-threader.c \
|
||||||
mu-threader.h \
|
mu-threader.h \
|
||||||
mu-util.c \
|
mu-util.c \
|
||||||
mu-util.h
|
mu-util.h
|
||||||
|
|
||||||
libmu_la_LIBADD= \
|
libmu_la_LIBADD= \
|
||||||
$(XAPIAN_LIBS) \
|
$(XAPIAN_LIBS) \
|
||||||
$(GMIME_LIBS) \
|
$(GMIME_LIBS) \
|
||||||
$(GLIB_LIBS) \
|
$(GLIB_LIBS) \
|
||||||
$(GUILE_LIBS)
|
$(GUILE_LIBS)
|
||||||
|
|
||||||
EXTRA_DIST= \
|
EXTRA_DIST= \
|
||||||
mu-msg-crypto.c \
|
mu-msg-crypto.c \
|
||||||
doxyfile.in
|
doxyfile.in
|
||||||
|
|||||||
@ -48,7 +48,7 @@ static ContactInfo *contact_info_new (char *email, char *name,
|
|||||||
gboolean personal, time_t tstamp, unsigned freq);
|
gboolean personal, time_t tstamp, unsigned freq);
|
||||||
|
|
||||||
struct _MuContacts {
|
struct _MuContacts {
|
||||||
GKeyFile *_ccache;
|
GKeyFile *_ccache;
|
||||||
gchar *_path;
|
gchar *_path;
|
||||||
|
|
||||||
GHashTable *_hash;
|
GHashTable *_hash;
|
||||||
@ -245,7 +245,7 @@ encode_email_address (const char *addr)
|
|||||||
/* downcase the domain-part of the email address, but only if it
|
/* downcase the domain-part of the email address, but only if it
|
||||||
* consists of ascii (to prevent screwing up idna addresses)
|
* consists of ascii (to prevent screwing up idna addresses)
|
||||||
*/
|
*/
|
||||||
char*
|
static char*
|
||||||
downcase_domain_maybe (const char *addr)
|
downcase_domain_maybe (const char *addr)
|
||||||
{
|
{
|
||||||
char *addr_conv, *at, *cur;
|
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)
|
write_part_to_fd (GMimePart *part, int fd, GError **err)
|
||||||
{
|
{
|
||||||
GMimeStream *stream;
|
GMimeStream *stream;
|
||||||
|
|||||||
@ -807,7 +807,7 @@ mu_msg_is_readable (MuMsg *self)
|
|||||||
* from the /bar
|
* from the /bar
|
||||||
* that we got
|
* that we got
|
||||||
*/
|
*/
|
||||||
char*
|
static char*
|
||||||
get_target_mdir (MuMsg *msg, const char *target_maildir, GError **err)
|
get_target_mdir (MuMsg *msg, const char *target_maildir, GError **err)
|
||||||
{
|
{
|
||||||
char *rootmaildir, *rv;
|
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,
|
MuMsg *mu_msg_new_from_file (const char* filepath, const char *maildir,
|
||||||
GError **err)
|
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);
|
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
|
* 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
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
@ -61,22 +61,22 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::string to_sortable (std::string& s, bool is_begin) {
|
std::string to_sortable (std::string& s, bool is_begin) {
|
||||||
|
|
||||||
const char* str;
|
const char* tmp;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
// note: if s is empty and not is_begin, xapian seems
|
// note: if s is empty and not is_begin, xapian seems
|
||||||
// to repeat it.
|
// to repeat it.
|
||||||
if (s.empty() || g_str_has_suffix (s.c_str(), "..")) {
|
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 {
|
} else {
|
||||||
str = mu_date_interpret_s (s.c_str(),
|
tmp = mu_date_interpret_s (s.c_str(),
|
||||||
is_begin ? TRUE: FALSE);
|
is_begin ? TRUE: FALSE);
|
||||||
str = mu_date_complete_s (str, is_begin ? TRUE: FALSE);
|
tmp = mu_date_complete_s (tmp, is_begin ? TRUE: FALSE);
|
||||||
t = mu_date_str_to_time_t (str, TRUE /*local*/);
|
t = mu_date_str_to_time_t (tmp, TRUE /*local*/);
|
||||||
str = mu_date_time_t_to_str_s (t, FALSE /*UTC*/);
|
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) {
|
bool substitute_size (std::string& size) {
|
||||||
gchar str[16];
|
gchar buf[16];
|
||||||
gint64 num = mu_str_size_parse_bkm(size.c_str());
|
gint64 num = mu_str_size_parse_bkm(size.c_str());
|
||||||
if (num < 0)
|
if (num < 0)
|
||||||
throw Xapian::QueryParserError ("invalid size");
|
throw Xapian::QueryParserError ("invalid size");
|
||||||
snprintf (str, sizeof(str), "%" G_GUINT64_FORMAT, num);
|
snprintf (buf, sizeof(buf), "%" G_GUINT64_FORMAT, num);
|
||||||
size = str;
|
size = buf;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -117,28 +117,6 @@ mu_util_dir_expand (const char *path)
|
|||||||
return g_strdup (resolved);
|
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
|
GQuark
|
||||||
mu_util_error_quark (void)
|
mu_util_error_quark (void)
|
||||||
{
|
{
|
||||||
@ -482,6 +460,7 @@ mu_util_g_set_error (GError **err, MuError errcode, const char *frm, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
print_args (FILE *stream, const char *frm, va_list args)
|
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
|
## 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
|
## 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
|
# don't use -Werror, as it might break on other compilers
|
||||||
# use -Wno-unused-parameters, because some callbacks may not
|
# use -Wno-unused-parameters, because some callbacks may not
|
||||||
# really need all the params they get
|
# really need all the params they get
|
||||||
AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement \
|
AM_CFLAGS= \
|
||||||
-Wno-variadic-macros \
|
$(WARN_CFLAGS) \
|
||||||
-DMU_SCRIPTS_DIR="\"$(pkgdatadir)/scripts/\""
|
-Wno-switch-enum \
|
||||||
AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
-DMU_SCRIPTS_DIR="\"$(pkgdatadir)/scripts/\""
|
||||||
|
|
||||||
|
AM_CXXFLAGS= \
|
||||||
|
$(WARN_CXXFLAGS)
|
||||||
|
|
||||||
bin_PROGRAMS= \
|
bin_PROGRAMS= \
|
||||||
mu
|
mu
|
||||||
@ -52,7 +55,7 @@ BUILT_SOURCES= \
|
|||||||
mu-help-strings.h
|
mu-help-strings.h
|
||||||
|
|
||||||
mu-help-strings.h: mu-help-strings.txt mu-help-strings.awk
|
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= \
|
mu_LDADD= \
|
||||||
${top_builddir}/lib/libmu.la \
|
${top_builddir}/lib/libmu.la \
|
||||||
|
|||||||
Reference in New Issue
Block a user