changeset 2949:7a88f6d9cd92 trunk

use g_strdup_printf instead of fixed-size gchar*
author Tomasz Mon <desowin@gmail.com>
date Sun, 01 Jul 2007 14:29:27 +0200
parents 830fdbec31be
children fc18fcad95a6
files src/audacious/ui_main.c src/audacious/ui_skinned_textbox.c
diffstat 2 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Sun Jul 01 13:31:07 2007 +0200
+++ b/src/audacious/ui_main.c	Sun Jul 01 14:29:27 2007 +0200
@@ -834,7 +834,7 @@
                       gint frequency,
                       gint n_channels)
 {
-    gchar text[512];
+    gchar *text;
     gchar *title;
     Playlist *playlist = playlist_get_active();
 
@@ -845,12 +845,12 @@
 
         if (bitrate < 1000) {
             /* Show bitrate in 1000s */
-            g_snprintf(text, sizeof(text), "%3d", bitrate);
+            text = g_strdup_printf("%3d", bitrate);
             ui_skinned_textbox_set_text(mainwin_rate_text, text);
         }
         else {
             /* Show bitrate in 100,000s */
-            g_snprintf(text, sizeof(text), "%2dH", bitrate / 100);
+            text = g_strdup_printf("%2dH", bitrate / 100);
             ui_skinned_textbox_set_text(mainwin_rate_text, text);
         }
     }
@@ -858,7 +858,7 @@
         ui_skinned_textbox_set_text(mainwin_rate_text, _("VBR"));
 
     /* Show sampling frequency in kHz */
-    g_snprintf(text, sizeof(text), "%2d", frequency / 1000);
+    text = g_strdup_printf("%2d", frequency / 1000);
     ui_skinned_textbox_set_text(mainwin_freq_text, text);
 
     monostereo_set_num_channels(mainwin_monostereo, n_channels);
@@ -893,12 +893,12 @@
     == TRUE)
     {
         if (bitrate != -1)
-            g_snprintf(text, 512, "%d kbps, %0.1f kHz, %s",
+            text = g_strdup_printf("%d kbps, %0.1f kHz, %s",
             bitrate,
             (gfloat) frequency / 1000,
             (n_channels > 1) ? _("stereo") : _("mono"));
         else
-            g_snprintf(text, 512, "VBR, %0.1f kHz, %s",
+            text = g_strdup_printf("VBR, %0.1f kHz, %s",
             (gfloat) frequency / 1000,
             (n_channels > 1) ? _("stereo") : _("mono"));
 
@@ -2934,9 +2934,6 @@
 
     /* XXX: eventually update widgetcore API to not need this */
 
-    ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_rate_text));
-    ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_freq_text));
-
     ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_menurow));
 
     ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_volume));
--- a/src/audacious/ui_skinned_textbox.c	Sun Jul 01 13:31:07 2007 +0200
+++ b/src/audacious/ui_skinned_textbox.c	Sun Jul 01 14:29:27 2007 +0200
@@ -675,7 +675,7 @@
     }
 
     priv->pixmap_width = length * bmp_active_skin->properties.textbox_bitmap_font_width;
-    priv->pixmap = gdk_pixmap_new(mainwin->window,
+    priv->pixmap = gdk_pixmap_new(NULL,
                                      priv->pixmap_width, bmp_active_skin->properties.textbox_bitmap_font_height,
                                      gdk_rgb_get_visual()->depth);
     gc = priv->gc;