Switch core from strerror to g_strerror
authorRicardo Mones <ricardo@mones.org>
Mon, 18 May 2015 19:22:37 +0000 (21:22 +0200)
committerRicardo Mones <ricardo@mones.org>
Mon, 18 May 2015 20:42:37 +0000 (22:42 +0200)
src/action.c
src/common/socket.c
src/common/ssl_certificate.c
src/common/utils.c
src/compose.c
src/crash.c
src/main.c
src/mbox.c
src/mimeview.c
src/prefs_gtk.c
src/textview.c

index e236301771852e3a66ad89968976e73e1ecef799..86fd1989268edfd70e463b953b5d26df7c8ffa28 100644 (file)
@@ -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");
 }
index 946293a28698f8fa47a27d68b2d6fe92477cd774..5f8b477a18c6bcdefdf2d0becd89b7421d7d2a1b 100644 (file)
@@ -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;
index c1e7dbfcc7ba6382e84aca592cf3a17391598884..013f96ed660635b757b9734e14985d1a0c77fa25 100644 (file)
@@ -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) {
index f322ac82b3e33ca9c72543dfa49f8323ff3547a6..aecb84c16293dc02b1a791c75957610c84db928b 100644 (file)
@@ -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
  *
  * 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;
index fa5a05ca93911f0e0b7bddebd25e1f9760b7187b..926a033a4c818cb02cb0d90e7e1abd4ae0438746 100644 (file)
@@ -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"
index 3f6cd562d25007d4e8f04cccadecfaff668d2054..cb1f1fe30cfcbff9c7bc81df5a5413387783aaf3 100644 (file)
@@ -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;
        }
 
index 813bb4712cb4932944af99200298e59d75add54b..5f8ddb1d3dacedb2e96d9f6aaa766836dace35e0 100644 (file)
@@ -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;
        }
        
index 6ef1cad617fdf8a512df0f1541c46c928b871550..92a6b5d65dded20fff33bff91ea8c4b547fc7a79 100644 (file)
@@ -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;
        }
 
index 7f4664bde1a053abaa19ddb6fbbb7054b25afcc1..4ee68bb3bd75ee0a827dc144ca8061fdadd7299f 100644 (file)
@@ -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);
 }
 
index 897c9cf1bd99c2b3b2f4ce1ac444893347ed3568..843f9c95b1656fc5d9f7babdc9b9b86acbfe6e8d 100644 (file)
@@ -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;
        }
        
index 6f0027aa8272ca5adbd900e2cf1dd9709d345367..e65b1d7403d222b0c7a87e6b509dc0c0d91b7681 100644 (file)
@@ -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]);