last batch of fixes related to problems caused by new http streaming code
authorJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 2 Sep 2005 05:00:31 +0000 (05:00 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 2 Sep 2005 05:00:31 +0000 (05:00 +0000)
src/plugin_xmms/configure.c
src/plugin_xmms/plugin.c

index 7d5bf20..9e1d77f 100644 (file)
@@ -55,13 +55,13 @@ flac_config_t flac_cfg = {
                100 /* KB */, /* http_buffer_size */
                50, /* http_prebuffer */
                FALSE, /* use_proxy */
-               "", /* proxy_host */
+               NULL, /* proxy_host */
                0, /* proxy_port */
                FALSE, /* proxy_use_auth */
-               "", /* proxy_user */
-               "", /* proxy_pass */
+               NULL, /* proxy_user */
+               NULL, /* proxy_pass */
                FALSE, /* save_http_stream */
-               FALSE, /* save_http_path */
+               NULL, /* save_http_path */
                FALSE, /* cast_title_streaming */
                FALSE /* use_udp_channel */
        },
@@ -159,7 +159,8 @@ static void flac_configurewin_ok(GtkWidget * widget, gpointer data)
        flac_cfg.stream.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value;
 
        flac_cfg.stream.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
-       g_free(flac_cfg.stream.proxy_host);
+       if(flac_cfg.stream.proxy_host)
+               g_free(flac_cfg.stream.proxy_host);
        flac_cfg.stream.proxy_host = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry)));
        flac_cfg.stream.proxy_port = atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry)));
 
@@ -380,7 +381,7 @@ void FLAC_XMMS__configure(void)
        GtkWidget *streaming_size_box, *streaming_size_label, *streaming_size_spin;
        GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin;
        GtkWidget *streaming_proxy_frame, *streaming_proxy_vbox;
-       GtkWidget *streaming_proxy_port_label,  *streaming_proxy_host_label;
+       GtkWidget *streaming_proxy_port_label, *streaming_proxy_host_label;
        GtkWidget *streaming_save_frame, *streaming_save_vbox;
        GtkWidget *streaming_save_label, *streaming_save_browse;
 #ifdef FLAC_ICECAST
@@ -666,7 +667,7 @@ void FLAC_XMMS__configure(void)
        gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_label, FALSE, FALSE, 0);
 
        streaming_proxy_host_entry = gtk_entry_new();
-       gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry), flac_cfg.stream.proxy_host);
+       gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry), flac_cfg.stream.proxy_host? flac_cfg.stream.proxy_host : "");
        gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_entry, TRUE, TRUE, 0);
 
        streaming_proxy_port_label = gtk_label_new(_("Port:"));
@@ -731,7 +732,7 @@ void FLAC_XMMS__configure(void)
        gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label, FALSE, FALSE, 0);
 
        streaming_save_entry = gtk_entry_new();
-       gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), flac_cfg.stream.save_http_path);
+       gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), flac_cfg.stream.save_http_path? flac_cfg.stream.save_http_path : "");
        gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, TRUE, TRUE, 0);
 
        streaming_save_browse = gtk_button_new_with_label(_("Browse"));
index 343038e..c0948ce 100644 (file)
@@ -220,7 +220,8 @@ void FLAC_XMMS__init()
        is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true;
 
        flac_cfg.title.tag_override = FALSE;
-       g_free(flac_cfg.title.tag_format);
+       if (flac_cfg.title.tag_format)
+               g_free(flac_cfg.title.tag_format);
        flac_cfg.title.convert_char_set = FALSE;
 
        cfg = xmms_cfg_open_default_file();
@@ -262,14 +263,24 @@ void FLAC_XMMS__init()
        xmms_cfg_read_int(cfg, "flac", "stream.http_buffer_size", &flac_cfg.stream.http_buffer_size);
        xmms_cfg_read_int(cfg, "flac", "stream.http_prebuffer", &flac_cfg.stream.http_prebuffer);
        xmms_cfg_read_boolean(cfg, "flac", "stream.use_proxy", &flac_cfg.stream.use_proxy);
-       xmms_cfg_read_string(cfg, "flac", "stream.proxy_host", &flac_cfg.stream.proxy_host);
+       if(flac_cfg.stream.proxy_host)
+               g_free(flac_cfg.stream.proxy_host);
+       if(!xmms_cfg_read_string(cfg, "flac", "stream.proxy_host", &flac_cfg.stream.proxy_host))
+               flac_cfg.stream.proxy_host = g_strdup("");
        xmms_cfg_read_int(cfg, "flac", "stream.proxy_port", &flac_cfg.stream.proxy_port);
        xmms_cfg_read_boolean(cfg, "flac", "stream.proxy_use_auth", &flac_cfg.stream.proxy_use_auth);
+       if(flac_cfg.stream.proxy_user)
+               g_free(flac_cfg.stream.proxy_user);
+       flac_cfg.stream.proxy_user = NULL;
        xmms_cfg_read_string(cfg, "flac", "stream.proxy_user", &flac_cfg.stream.proxy_user);
+       if(flac_cfg.stream.proxy_pass)
+               g_free(flac_cfg.stream.proxy_pass);
+       flac_cfg.stream.proxy_pass = NULL;
        xmms_cfg_read_string(cfg, "flac", "stream.proxy_pass", &flac_cfg.stream.proxy_pass);
        xmms_cfg_read_boolean(cfg, "flac", "stream.save_http_stream", &flac_cfg.stream.save_http_stream);
-       if (!xmms_cfg_read_string(cfg, "flac", "stream.save_http_path", &flac_cfg.stream.save_http_path) ||
-                ! *flac_cfg.stream.save_http_path) {
+       if (flac_cfg.stream.save_http_path)
+               g_free (flac_cfg.stream.save_http_path);
+       if (!xmms_cfg_read_string(cfg, "flac", "stream.save_http_path", &flac_cfg.stream.save_http_path) || ! *flac_cfg.stream.save_http_path) {
                if (flac_cfg.stream.save_http_path)
                        g_free (flac_cfg.stream.save_http_path);
                flac_cfg.stream.save_http_path = homedir();