* <many> fix small conversion errors (-Wconversion)
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
## Copyright (C) 2008-2010 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
|
||||||
@ -17,10 +17,11 @@
|
|||||||
include $(top_srcdir)/gtest.mk
|
include $(top_srcdir)/gtest.mk
|
||||||
|
|
||||||
dist_man_MANS = \
|
dist_man_MANS = \
|
||||||
mu.1 \
|
mu-cleanup.1 \
|
||||||
|
mu-easy.1 \
|
||||||
|
mu-extract.1 \
|
||||||
mu-find.1 \
|
mu-find.1 \
|
||||||
mu-index.1 \
|
mu-index.1 \
|
||||||
mu-cleanup.1 \
|
|
||||||
mu-mkdir.1 \
|
mu-mkdir.1 \
|
||||||
mu-view.1 \
|
mu-view.1 \
|
||||||
mu-extract.1
|
mu.1
|
||||||
|
|||||||
@ -38,16 +38,17 @@ save_numbered_parts (MuMsg *msg, MuConfigOptions *opts)
|
|||||||
|
|
||||||
for (rv = TRUE, cur = parts; cur && *cur; ++cur) {
|
for (rv = TRUE, cur = parts; cur && *cur; ++cur) {
|
||||||
|
|
||||||
int idx;
|
unsigned idx;
|
||||||
|
int i;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
|
||||||
idx = (int)strtol (*cur, &endptr, 10);
|
idx = (unsigned)(i = strtol (*cur, &endptr, 10));
|
||||||
if (idx < 0 || *cur == endptr) {
|
if (i < 0 || *cur == endptr) {
|
||||||
g_warning ("invalid MIME-part index '%s'", *cur);
|
g_warning ("invalid MIME-part index '%s'", *cur);
|
||||||
rv = FALSE;
|
rv = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mu_msg_mime_part_save
|
if (!mu_msg_mime_part_save
|
||||||
(msg, idx, opts->targetdir, opts->overwrite)) {
|
(msg, idx, opts->targetdir, opts->overwrite)) {
|
||||||
g_warning ("failed to save MIME-part %d", idx);
|
g_warning ("failed to save MIME-part %d", idx);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2008-2010 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
|
||||||
@ -17,7 +17,11 @@
|
|||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
|
||||||
|
#include "mu-cmd.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -29,17 +33,15 @@
|
|||||||
#include "mu-util-db.h"
|
#include "mu-util-db.h"
|
||||||
|
|
||||||
#include "mu-msg.h"
|
#include "mu-msg.h"
|
||||||
|
|
||||||
#include "mu-index.h"
|
#include "mu-index.h"
|
||||||
#include "mu-cmd.h"
|
|
||||||
|
|
||||||
static gboolean MU_CAUGHT_SIGNAL;
|
static gboolean MU_CAUGHT_SIGNAL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maybe_newline (gboolean quiet)
|
maybe_newline (gboolean quiet)
|
||||||
{
|
{
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -111,34 +113,44 @@ index_msg_silent_cb (MuIndexStats* stats, void *user_data)
|
|||||||
return MU_CAUGHT_SIGNAL ? MU_STOP: MU_OK;
|
return MU_CAUGHT_SIGNAL ? MU_STOP: MU_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned
|
||||||
static MuResult
|
print_stats (MuIndexStats* stats)
|
||||||
index_msg_cb (MuIndexStats* stats, void *user_data)
|
|
||||||
{
|
{
|
||||||
char *kars="-\\|/";
|
char *kars="-\\|/";
|
||||||
char output[120];
|
char output[120];
|
||||||
|
|
||||||
static int i = 0;
|
static int i = 0;
|
||||||
static int len = 0;
|
unsigned len = 0;
|
||||||
|
|
||||||
|
len = (unsigned) snprintf (output, sizeof(output),
|
||||||
|
"%c processing mail; processed: %u; "
|
||||||
|
"updated/new: %u, cleaned-up: %u",
|
||||||
|
(unsigned)kars[++i % 4],
|
||||||
|
(unsigned)stats->_processed,
|
||||||
|
(unsigned)stats->_updated,
|
||||||
|
(unsigned)stats->_cleaned_up);
|
||||||
|
|
||||||
|
g_print ("%s", output);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static MuResult
|
||||||
|
index_msg_cb (MuIndexStats* stats, void *user_data)
|
||||||
|
{
|
||||||
|
static unsigned len = 0;
|
||||||
|
|
||||||
if (MU_CAUGHT_SIGNAL)
|
if (MU_CAUGHT_SIGNAL)
|
||||||
return MU_STOP;
|
return MU_STOP;
|
||||||
|
|
||||||
if (stats->_processed % 25)
|
if (stats->_processed % 25)
|
||||||
return MU_OK;
|
return MU_OK;
|
||||||
|
|
||||||
while (len --> 0) /* note the --> operator :-) */
|
while (len --> 0) /* note the --> operator :-) */
|
||||||
g_print ("\b");
|
g_print ("\b");
|
||||||
|
|
||||||
len = snprintf (output, sizeof(output),
|
len = print_stats (stats);
|
||||||
"%c processing mail; processed: %u; "
|
|
||||||
"updated/new: %u, cleaned-up: %u",
|
|
||||||
(unsigned)kars[++i % 4],
|
|
||||||
(unsigned)stats->_processed,
|
|
||||||
(unsigned)stats->_updated,
|
|
||||||
(unsigned)stats->_cleaned_up);
|
|
||||||
g_print ("%s", output);
|
|
||||||
|
|
||||||
return MU_CAUGHT_SIGNAL ? MU_STOP: MU_OK;
|
return MU_CAUGHT_SIGNAL ? MU_STOP: MU_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,11 @@
|
|||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
|
||||||
|
#include "mu-index.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -27,7 +31,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "mu-maildir.h"
|
#include "mu-maildir.h"
|
||||||
#include "mu-index.h"
|
|
||||||
#include "mu-store.h"
|
#include "mu-store.h"
|
||||||
#include "mu-util.h"
|
#include "mu-util.h"
|
||||||
#include "mu-util-db.h"
|
#include "mu-util-db.h"
|
||||||
|
|||||||
@ -242,7 +242,7 @@ log_write (const char* domain, GLogLevelFlags level,
|
|||||||
if (len == sizeof(buf))
|
if (len == sizeof(buf))
|
||||||
buf[sizeof(buf)-2] = '\n';
|
buf[sizeof(buf)-2] = '\n';
|
||||||
|
|
||||||
len = write (MU_LOG->_fd, buf, len);
|
len = write (MU_LOG->_fd, buf, (size_t)len);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
fprintf (stderr, "%s: failed to write to log: %s\n",
|
fprintf (stderr, "%s: failed to write to log: %s\n",
|
||||||
__FUNCTION__, strerror(errno));
|
__FUNCTION__, strerror(errno));
|
||||||
|
|||||||
@ -53,7 +53,7 @@ fullpath_s (const char* path, const char* name)
|
|||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
create_maildir (const char *path, int mode)
|
create_maildir (const char *path, mode_t mode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const gchar* subdirs[] = {"new", "cur", "tmp"};
|
const gchar* subdirs[] = {"new", "cur", "tmp"};
|
||||||
@ -73,8 +73,7 @@ create_maildir (const char *path, int mode)
|
|||||||
|
|
||||||
/* static buffer */
|
/* static buffer */
|
||||||
fullpath = fullpath_s (path, subdirs[i]);
|
fullpath = fullpath_s (path, subdirs[i]);
|
||||||
|
rv = g_mkdir_with_parents (fullpath, (int)mode);
|
||||||
rv = g_mkdir_with_parents (fullpath, mode);
|
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
g_warning ("g_mkdir_with_parents failed: %s",
|
g_warning ("g_mkdir_with_parents failed: %s",
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
@ -457,10 +456,18 @@ dirent_destroy (struct dirent *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_STRUCT_DIRENT_D_INO
|
#ifdef HAVE_STRUCT_DIRENT_D_INO
|
||||||
static gint
|
static int
|
||||||
dirent_cmp (struct dirent *d1, struct dirent *d2)
|
dirent_cmp (struct dirent *d1, struct dirent *d2)
|
||||||
{
|
{
|
||||||
return d1->d_ino - d2->d_ino;
|
/* we do it his way instead of a simple d1->d_ino - d2->d_ino
|
||||||
|
* because this way, we don't need 64-bit numbers for the
|
||||||
|
* actual sorting */
|
||||||
|
if (d1->d_ino < d2->d_ino)
|
||||||
|
return -1;
|
||||||
|
else if (d1->d_ino > d2->d_ino)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /*HAVE_STRUCT_DIRENT_D_INO*/
|
#endif /*HAVE_STRUCT_DIRENT_D_INO*/
|
||||||
|
|
||||||
|
|||||||
@ -166,14 +166,13 @@ part_foreach_save_cb (GMimeObject *parent, GMimeObject *part,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
mu_msg_mime_part_save (MuMsg *msg, int wanted_idx,
|
mu_msg_mime_part_save (MuMsg *msg, unsigned wanted_idx,
|
||||||
const char *targetdir, gboolean overwrite)
|
const char *targetdir, gboolean overwrite)
|
||||||
{
|
{
|
||||||
SavePartData spd;
|
SavePartData spd;
|
||||||
const char *msgid;
|
const char *msgid;
|
||||||
|
|
||||||
g_return_val_if_fail (msg, FALSE);
|
g_return_val_if_fail (msg, FALSE);
|
||||||
g_return_val_if_fail (wanted_idx >= 0, FALSE);
|
|
||||||
|
|
||||||
spd.idx = 0;
|
spd.idx = 0;
|
||||||
spd.wanted_idx = wanted_idx;
|
spd.wanted_idx = wanted_idx;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ static void
|
|||||||
ref_gmime (void)
|
ref_gmime (void)
|
||||||
{
|
{
|
||||||
if (G_UNLIKELY(_refcount == 0)) {
|
if (G_UNLIKELY(_refcount == 0)) {
|
||||||
srandom (getpid()*time(NULL));
|
srandom ((unsigned)(getpid()*time(NULL)));
|
||||||
g_mime_init(0);
|
g_mime_init(0);
|
||||||
}
|
}
|
||||||
++_refcount;
|
++_refcount;
|
||||||
@ -101,7 +101,8 @@ init_file_metadata (MuMsg* msg, const char* path, const gchar* mdir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg->_timestamp = statbuf.st_mtime;
|
msg->_timestamp = statbuf.st_mtime;
|
||||||
msg->_size = statbuf.st_size;
|
/* size_t should be enough for message size... */
|
||||||
|
msg->_size = (size_t)statbuf.st_size;
|
||||||
msg->_fields[PATH_FIELD] = strdup (path);
|
msg->_fields[PATH_FIELD] = strdup (path);
|
||||||
|
|
||||||
/* FIXME: maybe try to derive it from the path? */
|
/* FIXME: maybe try to derive it from the path? */
|
||||||
@ -362,7 +363,7 @@ mu_msg_get_flags (MuMsg *msg)
|
|||||||
size_t
|
size_t
|
||||||
mu_msg_get_size (MuMsg *msg)
|
mu_msg_get_size (MuMsg *msg)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (msg, -1);
|
g_return_val_if_fail (msg, 0);
|
||||||
|
|
||||||
return msg->_size;
|
return msg->_size;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,7 +106,7 @@ const char* mu_msg_get_summary (MuMsg *msg, size_t max_lines);
|
|||||||
* @return TRUE if saving succeeded, FALSE otherwise
|
* @return TRUE if saving succeeded, FALSE otherwise
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
mu_msg_mime_part_save (MuMsg *msg, int wanted_idx,
|
mu_msg_mime_part_save (MuMsg *msg, unsigned wanted_idx,
|
||||||
const char *targetdir, gboolean overwrite);
|
const char *targetdir, gboolean overwrite);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -78,7 +78,7 @@ mu_store_new (const char* xpath)
|
|||||||
unsigned
|
unsigned
|
||||||
mu_store_count (MuStore *store)
|
mu_store_count (MuStore *store)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (store, NULL);
|
g_return_val_if_fail (store, 0);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return store->_db->get_doccount();
|
return store->_db->get_doccount();
|
||||||
@ -413,8 +413,8 @@ mu_store_remove (MuStore *store, const char* msgpath)
|
|||||||
gboolean
|
gboolean
|
||||||
mu_store_contains_message (MuStore *store, const char* path)
|
mu_store_contains_message (MuStore *store, const char* path)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (store, NULL);
|
g_return_val_if_fail (store, FALSE);
|
||||||
g_return_val_if_fail (path, NULL);
|
g_return_val_if_fail (path, FALSE);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const std::string uid (get_message_uid(path));
|
const std::string uid (get_message_uid(path));
|
||||||
|
|||||||
@ -113,7 +113,7 @@ mu_util_init_system (void)
|
|||||||
gboolean
|
gboolean
|
||||||
mu_util_check_dir (const gchar* path, gboolean readable, gboolean writeable)
|
mu_util_check_dir (const gchar* path, gboolean readable, gboolean writeable)
|
||||||
{
|
{
|
||||||
mode_t mode;
|
int mode;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
|
|||||||
Reference in New Issue
Block a user