mu: Fix some compiler warnings

This commit is contained in:
Dirk-Jan C. Binnema 2020-01-01 15:43:10 +02:00
parent 80c5e25b08
commit ad63044915
6 changed files with 15 additions and 21 deletions

View File

@ -621,7 +621,7 @@ MuError
mu_store_foreach (MuStore *store, mu_store_foreach (MuStore *store,
MuStoreForeachFunc func, void *user_data, GError **err) MuStoreForeachFunc func, void *user_data, GError **err)
{ {
g_return_val_if_fail (self, MU_ERROR); g_return_val_if_fail (store, MU_ERROR);
g_return_val_if_fail (func, MU_ERROR); g_return_val_if_fail (func, MU_ERROR);
try { try {

View File

@ -381,9 +381,8 @@ run_cmd_cfind (MuStore *store,
gboolean color, gboolean color,
GError **err) GError **err)
{ {
gboolean rv; gboolean rv;
MuContacts *contacts; ECData ecdata;
ECData ecdata;
memset(&ecdata, 0, sizeof(ecdata)); memset(&ecdata, 0, sizeof(ecdata));

View File

@ -255,14 +255,13 @@ cleanup_missing (MuIndex *midx, MuConfig *opts, MuIndexStats *stats,
static void static void
index_title (MuStore *store, MuConfig *opts) index_title (MuStore *store, MuConfig *opts)
{ {
const char *blue, *green, *def; const char *green, *def;
char **addrs; char **addrs;
int i; int i;
time_t created; time_t created;
struct tm *tstamp; struct tm *tstamp;
char tbuf[40]; char tbuf[40];
blue = opts->nocolor ? "" : MU_COLOR_BLUE;
green = opts->nocolor ? "" : MU_COLOR_GREEN; green = opts->nocolor ? "" : MU_COLOR_GREEN;
def = opts->nocolor ? "" : MU_COLOR_DEFAULT; def = opts->nocolor ? "" : MU_COLOR_DEFAULT;

View File

@ -157,7 +157,9 @@ print_expr (const char* frm, ...)
} }
} }
static MuError
G_GNUC_PRINTF(2,3) static MuError
print_error (MuError errcode, const char* frm, ...) print_error (MuError errcode, const char* frm, ...)
{ {
char *msg, *str; char *msg, *str;
@ -182,7 +184,7 @@ print_and_clear_g_error (GError **err)
MuError rv; MuError rv;
if (err && *err) if (err && *err)
rv = print_error ((*err)->code, (*err)->message); rv = print_error ((*err)->code, "%s", (*err)->message);
else else
rv = print_error (MU_ERROR_INTERNAL, "unknown error"); rv = print_error (MU_ERROR_INTERNAL, "unknown error");
@ -1033,7 +1035,6 @@ get_checked_path (const char *path)
cpath = mu_util_dir_expand(path); cpath = mu_util_dir_expand(path);
if (!cpath || if (!cpath ||
!mu_util_check_dir (cpath, TRUE, FALSE)) { !mu_util_check_dir (cpath, TRUE, FALSE)) {
char *err;
print_error (MU_ERROR_IN_PARAMETERS, print_error (MU_ERROR_IN_PARAMETERS,
"not a readable dir: '%s'", cpath); "not a readable dir: '%s'", cpath);
g_free (cpath); g_free (cpath);
@ -1087,7 +1088,7 @@ cmd_index (ServerContext *ctx, GHashTable *args, GError **err)
MuIndex *index; MuIndex *index;
const char *argpath; const char *argpath;
char *path; char *path;
gboolean cleanup, lazy_check, contacts; gboolean cleanup, lazy_check;
index = NULL; index = NULL;

View File

@ -1,7 +1,5 @@
/* -*-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-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify it ** 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 ** under the terms of the GNU General Public License as published by the
@ -172,7 +170,7 @@ config_options_group_index (void)
} }
static void static void
set_group_find_defaults () set_group_find_defaults (void)
{ {
/* note, when no fields are specified, we use /* note, when no fields are specified, we use
* date-from-subject, and sort descending by date. If fields * date-from-subject, and sort descending by date. If fields

View File

@ -1,6 +1,6 @@
/* -*- mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- /* -*- mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
** **
** Copyright (C) 2008-2016 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** Copyright (C) 2008-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify it ** 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 ** under the terms of the GNU General Public License as published by the
@ -18,24 +18,21 @@
** **
*/ */
#if HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif /*HAVE_CONFIG_H*/
#include <glib.h> #include <glib.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "../mu-query.h"
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include "test-mu-common.h" #include "test-mu-common.h"
#include "mu-store.hh" #include "mu-store.hh"
#include "mu-query.h"
/* tests for the command line interface, uses testdir2 */ /* tests for the command line interface, uses testdir2 */