[rhythmbox] sprintf smells bad and makes theo laugh at me



commit 9c75f5cca2a17e6774e81554c8c60c632d1a7803
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Dec 18 18:39:34 2013 +1000

    sprintf smells bad and makes theo laugh at me

 sources/rb-playlist-source.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/sources/rb-playlist-source.c b/sources/rb-playlist-source.c
index c2c454a..276a816 100644
--- a/sources/rb-playlist-source.c
+++ b/sources/rb-playlist-source.c
@@ -907,13 +907,14 @@ rb_playlist_source_save_to_xml (RBPlaylistSource *source,
 
        g_object_get (source, "settings", &settings, NULL);
        if (settings) {
-               char buf[99];
+               char *p;
                xmlSetProp (node,
                            RB_PLAYLIST_SHOW_BROWSER,
                            (xmlChar *)(g_settings_get_boolean (settings, "show-browser") ? "true" : 
"false"));
 
-               sprintf (buf, "%d", g_settings_get_int (settings, "paned-position"));
-               xmlSetProp (node, RB_PLAYLIST_BROWSER_POSITION, (xmlChar *)buf);
+               p = g_strdup_printf ("%d", g_settings_get_int (settings, "paned-position"));
+               xmlSetProp (node, RB_PLAYLIST_BROWSER_POSITION, (xmlChar *)p);
+               g_free (p);
 
                xmlSetProp (node, RB_PLAYLIST_SEARCH_TYPE, (xmlChar *)g_settings_get_string (settings, 
"search-type"));
                g_object_unref (settings);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]