Libravatar: fix g_warning strings
authorRicardo Mones <ricardo@mones.org>
Tue, 23 Jun 2015 23:50:16 +0000 (01:50 +0200)
committerRicardo Mones <ricardo@mones.org>
Tue, 23 Jun 2015 23:50:16 +0000 (01:50 +0200)
src/plugins/libravatar/libravatar.c
src/plugins/libravatar/libravatar_cache.c
src/plugins/libravatar/libravatar_missing.c
src/plugins/libravatar/libravatar_prefs.c

index 4bdeb3bfe0345265ec592306cdb6dc2d7578b6d6..f67d5833cbe4f72d77c61ccab68d180a8e587efa 100644 (file)
@@ -113,14 +113,14 @@ static GtkWidget *image_widget_from_filename(const gchar *filename)
                picture = gdk_pixbuf_new_from_file(filename, &error);
 
        if (error != NULL) {
-               g_warning("Failed to load image '%s': %s\n", filename, error->message);
+               g_warning("failed to load image '%s': %s", filename, error->message);
                g_error_free(error);
        } else {
                if (picture) {
                        image = gtk_image_new_from_pixbuf(picture);
                        g_object_unref(picture);
                } else
-                       g_warning("Failed to load image '%s': no error returned!\n", filename);
+                       g_warning("failed to load image '%s': no error returned!", filename);
        }
 
        return image;
@@ -155,7 +155,7 @@ static GtkWidget *image_widget_from_url(const gchar *url, const gchar *md5)
 
        curl = curl_easy_init();
        if (curl == NULL) {
-               g_warning("could not initialize curl to get image from url\n");
+               g_warning("could not initialize curl to get image from URL");
                return NULL;
        }
        curl_easy_setopt(curl, CURLOPT_URL, url);
@@ -194,13 +194,13 @@ static GtkWidget *image_widget_from_url(const gchar *url, const gchar *md5)
 
                if (!libravatarprefs.cache_icons || filesize == 0) {
                        if (g_unlink(filename) < 0)
-                               g_warning("failed to delete cache file %s\n", filename);
+                               g_warning("failed to delete cache file '%s'", filename);
                }
 
                if (filesize == 0)
                        missing_add_md5(libravatarmisses, md5);
        } else {
-               g_warning("could not open '%s' for writing\n", filename);
+               g_warning("could not open '%s' for writing", filename);
        }
        curl_easy_cleanup(curl);
        g_free(filename);
@@ -254,7 +254,7 @@ static gchar *libravatar_url_for_md5(const gchar *base, const gchar *md5)
                                base, md5, AVATAR_SIZE);
        }
 
-       g_warning("invalid libravatar default mode: %d\n", libravatarprefs.default_mode);
+       g_warning("invalid libravatar default mode: %d", libravatarprefs.default_mode);
        return NULL;
 }
 
index 321420ccdb2c2ba6c74f0a10232b2944f77a0b09..3114ebb66a9b823bd13b21afd3c3f72644faa707 100644 (file)
@@ -29,7 +29,7 @@ gchar *libravatar_cache_init(const char *dirs[], gint start, gint end)
                                NULL);
        if (!is_dir_exist(rootdir)) {
                if (make_dir(rootdir) < 0) {
-                       g_warning("cannot create root directory %s\n", subdir);
+                       g_warning("cannot create root directory '%s'", subdir);
                        g_free(rootdir);
                        return NULL;
                }
@@ -38,7 +38,7 @@ gchar *libravatar_cache_init(const char *dirs[], gint start, gint end)
                subdir = g_strconcat(rootdir, dirs[i], NULL);
                if (!is_dir_exist(subdir)) {
                        if (make_dir(subdir) < 0) {
-                               g_warning("cannot create directory %s\n", subdir);
+                               g_warning("cannot create directory '%s'", subdir);
                                g_free(subdir);
                                g_free(rootdir);
                                return NULL;
index 238f6d386276427e2f2bb2d673bc5c2f52aa577b..c884899cede6ecdd0ff38482cae4ac01e52ea195 100644 (file)
@@ -43,12 +43,12 @@ GHashTable *missing_load_from_file(const gchar *filename)
                if (!is_file_exist(filename)) { /* first run, return an empty table */
                        return g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
                }
-               g_warning("Cannot open %s for reading\n", filename);
+               g_warning("cannot open '%s' for reading", filename);
                return NULL;
        }
        t = time(NULL);
        if (t == (time_t)-1) {
-               g_warning("Cannot get time!\n");
+               g_warning("cannot get time!");
                goto close_exit;
        }
 
@@ -58,7 +58,7 @@ GHashTable *missing_load_from_file(const gchar *filename)
                if (t - (time_t)seen <= LIBRAVATAR_MISSING_TIME) {
                        time_t *value = g_malloc0(sizeof(time_t));
                        if (value == NULL) {
-                               g_warning("Cannot allocate memory\n");
+                               g_warning("cannot allocate memory");
                                g_hash_table_destroy(table);
                                return NULL;
                        }
@@ -71,7 +71,7 @@ GHashTable *missing_load_from_file(const gchar *filename)
 
 close_exit:
        if (fclose(file) != 0)
-               g_warning("Error closing %s\n", filename);
+               g_warning("error closing '%s'", filename);
 
        debug_print("Read %d missing avatar entries, %d obsolete entries discarded\n", a, d);
        return table;
@@ -89,7 +89,7 @@ static void missing_save_item(gpointer key, gpointer value, gpointer data)
        FILE *file = (FILE *)data;
        gchar *line = g_strdup_printf("%s %llu\n", (gchar *)key, *((long long unsigned *)value));
        if (fputs(line, file) < 0)
-               g_warning("Error saving missing item\n");
+               g_warning("error saving missing item");
        g_free(line);
 }
 
@@ -106,7 +106,7 @@ gint missing_save_to_file(GHashTable *table, const gchar *filename)
        FILE *file = fopen(filename, "w");
 
        if (file == NULL) {
-               g_warning("Cannot open %s for writing\n", filename);
+               g_warning("cannot open '%s' for writing", filename);
                return -1;
        }
 
@@ -114,7 +114,7 @@ gint missing_save_to_file(GHashTable *table, const gchar *filename)
        debug_print("Saved %u missing avatar entries\n", g_hash_table_size(table));
 
        if (fclose(file) != 0) {
-               g_warning("Error closing %s\n", filename);
+               g_warning("error closing '%s'", filename);
                return -1;
        }
 
@@ -133,7 +133,7 @@ void missing_add_md5(GHashTable *table, const gchar *md5)
        time_t t = time(NULL);
 
        if (t == (time_t)-1) {
-               g_warning("Cannot get time!\n");
+               g_warning("cannot get time!");
                return;
        }
 
@@ -141,7 +141,7 @@ void missing_add_md5(GHashTable *table, const gchar *md5)
        if (seen == NULL) {
                seen = g_malloc0(sizeof(time_t));
                if (seen == NULL) {
-                       g_warning("Cannot allocate memory\n");
+                       g_warning("cannot allocate memory");
                        return;
                }
                *seen = t;
index edf08cec84a32831e828647b5ed06fe633a39d71..794a7dfb11f53f4a70c854a60fa53c28d1537ef1 100644 (file)
@@ -388,7 +388,7 @@ static void libravatar_save_config(void)
                return;
 
        if (prefs_write_param(param, pfile->fp) < 0) {
-               g_warning("Failed to write Libravatar configuration to file\n");
+               g_warning("failed to write Libravatar configuration to file");
                prefs_file_close_revert(pfile);
                return;
        }