commit 6fc7c18a8105bfb51879ada01e0f49c1bd72ff83
parent 64e5421bb2a0dbad5d23a6c292d84a96cb3050e2
Author: Ricardo Mones <ricardo@mones.org>
Date: Mon, 18 May 2015 21:22:37 +0200
Switch core from strerror to g_strerror
Diffstat:
11 files changed, 75 insertions(+), 68 deletions(-)
diff --git a/src/action.c b/src/action.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto & The Claws Mail Team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto & The Claws Mail Team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -434,7 +434,7 @@ static gboolean parse_append_msgpart(GString *cmd, MsgInfo *msginfo,
g_free(filename);
if (ret < 0) {
- alertpanel_error(_("Can't get part of multipart message: %s"), strerror(-ret));
+ alertpanel_error(_("Can't get part of multipart message: %s"), g_strerror(-ret));
g_free(part_filename);
return FALSE;
}
@@ -1043,7 +1043,7 @@ static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str,
r = close(chld_in);
child_info->chld_in = -1; /* No more input */
if (r != 0)
- debug_print("%s(%d)", strerror(errno), errno);
+ debug_print("%s(%d)", g_strerror(errno), errno);
}
return child_info;
@@ -1510,7 +1510,7 @@ static void catch_input(gpointer data, gint source, GIOCondition cond)
r = close(child_info->chld_in);
child_info->chld_in = -1;
if (r != 0)
- debug_print("%s(%d)", strerror(errno), errno);
+ debug_print("%s(%d)", g_strerror(errno), errno);
child_info->chld_in = -1;
debug_print("Input to grand child sent.\n");
}
diff --git a/src/common/socket.c b/src/common/socket.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -830,7 +830,7 @@ static gboolean sock_connect_async_cb(GIOChannel *source,
close(fd);
log_error(LOG_PROTOCOL, _("%s:%d: connection failed (%s).\n"),
conn_data->hostname, conn_data->port,
- strerror(val));
+ g_strerror(val));
sock_connect_address_list_async(conn_data);
return FALSE;
}
@@ -1512,7 +1512,7 @@ gint fd_write_all(gint fd, const gchar *buf, gint len)
n = write(fd, buf, len);
if (n <= 0) {
- log_error(LOG_PROTOCOL, _("write on fd%d: %s\n"), fd, strerror(errno));
+ log_error(LOG_PROTOCOL, _("write on fd%d: %s\n"), fd, g_strerror(errno));
return -1;
}
len -= n;
diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
@@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Colin Leroy <colin@colino.net>
+ * Copyright (C) 1999-2015 Colin Leroy <colin@colino.net>
* and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -175,7 +175,7 @@ static void gnutls_export_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert, gnutls_
debug_print("writing %zd bytes\n",cert_size);
if (fwrite(&output, 1, cert_size, fp) < cert_size) {
- g_warning("failed to write cert: %d %s\n", errno, strerror(errno));
+ g_warning("failed to write cert: %d %s\n", errno, g_strerror(errno));
}
}
@@ -326,7 +326,7 @@ static gnutls_pkcs12_t gnutls_import_PKCS12_fp(FILE *fp, gnutls_x509_crt_fmt_t f
int r;
if (fstat(fileno(fp), &s) < 0) {
log_error(LOG_PROTOCOL, _("Cannot stat P12 certificate file (%s)\n"),
- strerror(errno));
+ g_strerror(errno));
return NULL;
}
tmp.data = malloc(s.st_size);
@@ -334,7 +334,7 @@ static gnutls_pkcs12_t gnutls_import_PKCS12_fp(FILE *fp, gnutls_x509_crt_fmt_t f
tmp.size = s.st_size;
if (fread (tmp.data, 1, s.st_size, fp) < s.st_size) {
log_error(LOG_PROTOCOL, _("Cannot read P12 certificate file (%s)\n"),
- strerror(errno));
+ g_strerror(errno));
free(tmp.data);
return NULL;
}
@@ -557,7 +557,7 @@ static guint check_cert(SSLCertificate *cert)
fp = g_fopen(chain_file, "r");
if (fp == NULL) {
- debug_print("fopen %s failed: %s\n", chain_file, strerror(errno));
+ debug_print("fopen %s failed: %s\n", chain_file, g_strerror(errno));
g_free(chain_file);
return (guint)-1;
}
@@ -869,11 +869,11 @@ gnutls_x509_crt_t ssl_certificate_get_x509_from_pem_file(const gchar *file)
return x509;
} else {
log_error(LOG_PROTOCOL, _("Cannot open certificate file %s: %s\n"),
- file, strerror(errno));
+ file, g_strerror(errno));
}
} else {
log_error(LOG_PROTOCOL, _("Certificate file %s missing (%s)\n"),
- file, strerror(errno));
+ file, g_strerror(errno));
}
return NULL;
}
@@ -892,11 +892,11 @@ gnutls_x509_privkey_t ssl_certificate_get_pkey_from_pem_file(const gchar *file)
return key;
} else {
log_error(LOG_PROTOCOL, _("Cannot open key file %s (%s)\n"),
- file, strerror(errno));
+ file, g_strerror(errno));
}
} else {
log_error(LOG_PROTOCOL, _("Key file %s missing (%s)\n"), file,
- strerror(errno));
+ g_strerror(errno));
}
return NULL;
}
@@ -1047,11 +1047,11 @@ void ssl_certificate_get_x509_and_pkey_from_p12_file(const gchar *file, const gc
}
} else {
log_error(LOG_PROTOCOL, _("Cannot open P12 certificate file %s (%s)\n"),
- file, strerror(errno));
+ file, g_strerror(errno));
}
} else {
log_error(LOG_PROTOCOL, _("P12 Certificate file %s missing (%s)\n"), file,
- strerror(errno));
+ g_strerror(errno));
}
if (p12 != NULL) {
if ((r = parse_pkcs12(p12, password, pkey, x509)) == 0) {
diff --git a/src/common/utils.c b/src/common/utils.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto & The Claws Mail Team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto & The Claws Mail Team
*
* 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
@@ -17,8 +17,15 @@
*
* The code of the g_utf8_substring function below is owned by
* Matthias Clasen <matthiasc@src.gnome.org>/<mclasen@redhat.com>
- * and is got from GLIB 2.30
- *
+ * and is got from GLIB 2.30: https://git.gnome.org/browse/glib/commit/
+ * ?h=glib-2-30&id=9eb65dd3ed5e1a9638595cbe10699c7606376511
+ *
+ * GLib 2.30 is licensed under GPL v2 or later and:
+ * Copyright (C) 1999 Tom Tromey
+ * Copyright (C) 2000 Red Hat, Inc.
+ *
+ * https://git.gnome.org/browse/glib/tree/glib/gutf8.c
+ * ?h=glib-2-30&id=9eb65dd3ed5e1a9638595cbe10699c7606376511
*/
#ifdef HAVE_CONFIG_H
@@ -1937,7 +1944,7 @@ void set_rc_dir(const gchar *dir)
if (err) {
g_print("Error looking for %s: %d(%s)\n",
- dir, -err, strerror(-err));
+ dir, -err, g_strerror(-err));
exit(0);
}
rc_dir_alt = TRUE;
diff --git a/src/compose.c b/src/compose.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -3904,7 +3904,7 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
outfile = procmime_get_tmp_file_name(child);
if ((err = procmime_get_part(outfile, child)) < 0)
- g_warning("Can't get the part of multipart message. (%s)", strerror(-err));
+ g_warning("Can't get the part of multipart message. (%s)", g_strerror(-err));
else {
gchar *content_type;
@@ -5155,7 +5155,7 @@ gint compose_send(Compose *compose)
alertpanel_error(_("Could not queue message for sending:\n\n"
"Signature failed: %s"), privacy_get_error());
} else if (val == -2 && errno != 0) {
- alertpanel_error(_("Could not queue message for sending:\n\n%s."), strerror(errno));
+ alertpanel_error(_("Could not queue message for sending:\n\n%s."), g_strerror(errno));
} else {
alertpanel_error(_("Could not queue message for sending."));
}
@@ -9774,7 +9774,7 @@ static void compose_send_later_cb(GtkAction *action, gpointer data)
} else if (val == -1) {
alertpanel_error(_("Could not queue message."));
} else if (val == -2) {
- alertpanel_error(_("Could not queue message:\n\n%s."), strerror(errno));
+ alertpanel_error(_("Could not queue message:\n\n%s."), g_strerror(errno));
} else if (val == -3) {
if (privacy_peek_error())
alertpanel_error(_("Could not queue message for sending:\n\n"
diff --git a/src/crash.c b/src/crash.c
@@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 by the Claws Mail Team
+ * Copyright (C) 2002-2015 by the Claws Mail Team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -334,7 +334,7 @@ static void crash_debug(unsigned long crash_pid,
pid_t pid;
if (pipe(choutput) == -1) {
- g_print("can't pipe - error %s", strerror(errno));
+ g_print("can't pipe - error %s", g_strerror(errno));
return;
}
diff --git a/src/main.c b/src/main.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -2153,7 +2153,7 @@ gchar *claws_get_socket_name(void)
stat_ok = stat(socket_dir, &st);
if (stat_ok < 0 && errno != ENOENT) {
g_print("Error stat'ing socket_dir %s: %s\n",
- socket_dir, strerror(errno));
+ socket_dir, g_strerror(errno));
} else if (stat_ok == 0 && S_ISSOCK(st.st_mode)) {
/* old versions used a sock in $TMPDIR/claws-mail-$UID */
debug_print("Using legacy socket %s\n", socket_dir);
@@ -2163,7 +2163,7 @@ gchar *claws_get_socket_name(void)
if (!is_dir_exist(socket_dir) && make_dir(socket_dir) < 0) {
g_print("Error creating socket_dir %s: %s\n",
- socket_dir, strerror(errno));
+ socket_dir, g_strerror(errno));
}
md5_hex_digest(md5sum, get_rc_dir());
@@ -2221,13 +2221,13 @@ static gint prohibit_duplicate_launch(void)
lock_fd = g_open(socket_lock, O_RDWR|O_CREAT, 0);
if (lock_fd < 0) {
debug_print("Couldn't open %s: %s (%d)\n", socket_lock,
- strerror(errno), errno);
+ g_strerror(errno), errno);
g_free(socket_lock);
return -1;
}
if (flock(lock_fd, LOCK_EX) < 0) {
debug_print("Couldn't lock %s: %s (%d)\n", socket_lock,
- strerror(errno), errno);
+ g_strerror(errno), errno);
close(lock_fd);
g_free(socket_lock);
return -1;
@@ -2790,7 +2790,7 @@ static void install_memory_sighandler()
mem_notify_fd = g_open("/dev/mem_notify", O_RDONLY|O_NONBLOCK, 0);
if (mem_notify_fd == -1) {
debug_print("/dev/mem_notify not available (%s)\n",
- strerror(errno));
+ g_strerror(errno));
return;
}
diff --git a/src/mbox.c b/src/mbox.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -379,7 +379,7 @@ gint lock_mbox(const gchar *base, LockType type)
#if HAVE_FCNTL_H && !defined(G_OS_WIN32)
if (fcntl(lockfd, F_SETLK, &fl) == -1) {
- g_warning("can't fnctl %s (%s)", base, strerror(errno));
+ g_warning("can't fnctl %s (%s)", base, g_strerror(errno));
close(lockfd);
return -1;
} else {
@@ -510,7 +510,7 @@ gint copy_mbox(gint srcfd, const gchar *dest)
if (save_errno != 0) {
g_warning("error %d reading mbox: %s\n", save_errno,
- strerror(save_errno));
+ g_strerror(save_errno));
err = TRUE;
}
diff --git a/src/mimeview.c b/src/mimeview.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -1761,7 +1761,7 @@ check_new_file:
if ((err = procmime_get_part(filename, partinfo)) < 0)
alertpanel_error
(_("Couldn't save the part of multipart message: %s"),
- strerror(-err));
+ g_strerror(-err));
tmp = g_filename_to_uri(filename, NULL, NULL);
uriname = g_strconcat(tmp, "\r\n", NULL);
@@ -1850,7 +1850,7 @@ static gboolean mimeview_write_part(const gchar *filename,
if ((err = procmime_get_part(filename, partinfo)) < 0) {
alertpanel_error
(_("Couldn't save the part of multipart message: %s"),
- strerror(-err));
+ g_strerror(-err));
return FALSE;
}
@@ -2042,7 +2042,7 @@ void mimeview_launch(MimeView *mimeview, MimeInfo *partinfo)
if ((err = procmime_get_part(filename, partinfo)) < 0)
alertpanel_error
(_("Couldn't save the part of multipart message: %s"),
- strerror(-err));
+ g_strerror(-err));
else
mimeview_view_file(filename, partinfo, NULL, mimeview);
@@ -2078,7 +2078,7 @@ static void mimeview_open_part_with(MimeView *mimeview, MimeInfo *partinfo, gboo
if ((err = procmime_get_part(filename, partinfo)) < 0) {
alertpanel_error
(_("Couldn't save the part of multipart message: %s"),
- strerror(-err));
+ g_strerror(-err));
g_free(filename);
return;
}
@@ -2190,7 +2190,7 @@ static void mimeview_send_to(MimeView *mimeview, MimeInfo *partinfo)
} else
alertpanel_error
(_("Couldn't save the part of multipart message: %s"),
- strerror(-err));
+ g_strerror(-err));
g_free(filename);
}
diff --git a/src/prefs_gtk.c b/src/prefs_gtk.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -972,7 +972,7 @@ static int prefs_cache_sections(GHashTable *file_cache, const gchar *rcfile)
if (rcfile)
fp = g_fopen(rcfile, "rb");
if (!fp) {
- debug_print("cache: %s: %s\n", rcfile?rcfile:"(null)", strerror(errno));
+ debug_print("cache: %s: %s\n", rcfile?rcfile:"(null)", g_strerror(errno));
return -1;
}
diff --git a/src/textview.c b/src/textview.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2014 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
*
* 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
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -746,7 +746,7 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
filename = procmime_get_tmp_file_name(mimeinfo);
if ((err = procmime_get_part(filename, mimeinfo)) < 0) {
- g_warning("Can't get the image file.(%s)", strerror(-err));
+ g_warning("Can't get the image file.(%s)", g_strerror(-err));
g_free(filename);
END_TIMING();
return;
@@ -1102,14 +1102,14 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
if (pipe(pfd) < 0) {
g_snprintf(buf, sizeof(buf),
- "pipe failed for textview\n\n%s\n", strerror(errno));
+ "pipe failed for textview\n\n%s\n", g_strerror(errno));
textview_write_line(textview, buf, conv, TRUE);
goto textview_default;
}
pid = fork();
if (pid < 0) {
g_snprintf(buf, sizeof(buf),
- "fork failed for textview\n\n%s\n", strerror(errno));
+ "fork failed for textview\n\n%s\n", g_strerror(errno));
textview_write_line(textview, buf, conv, TRUE);
close(pfd[0]);
close(pfd[1]);