Index: radio.c =================================================================== --- radio.c (revision 5363) +++ radio.c (working copy) @@ -302,15 +302,14 @@ gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0); - GtkWidget* station = gtk_entry_new_with_max_length ( - MAX_PRESET_NAME_LENGTH); + GtkWidget* station = gtk_entry_new(); gtk_entry_set_text (GTK_ENTRY (station), preset->name); gtk_widget_show (station); gtk_box_pack_start (GTK_BOX (box), station, FALSE, FALSE, 0); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - strncpy (preset->name, gtk_entry_get_text (GTK_ENTRY (station)), - MAX_PRESET_NAME_LENGTH); + g_free (preset->name); + preset->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (station))); pop_preset (preset, data); append_to_presets (preset, data); } @@ -335,16 +334,14 @@ char buf[8]; sprintf (buf, "%5.1f FM", ((float) data->freq) / 100); - GtkWidget* station = gtk_entry_new_with_max_length ( - MAX_PRESET_NAME_LENGTH); + GtkWidget* station = gtk_entry_new(); gtk_entry_set_text (GTK_ENTRY (station), buf); gtk_widget_show (station); gtk_box_pack_start (GTK_BOX (box), station, FALSE, FALSE, 0); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { - const char* name = gtk_entry_get_text (GTK_ENTRY (station)); radio_preset* preset = malloc (sizeof (radio_preset)); - strncpy (preset->name, name, MAX_PRESET_NAME_LENGTH); + preset->name = g_strdup(gtk_entry_get_text (GTK_ENTRY (station))); preset->freq = data->freq; preset->next = NULL; if (!append_to_presets (preset, data)) { @@ -1032,8 +1029,8 @@ radio_preset *preset = malloc (sizeof (radio_preset)); preset->next = NULL; - strncpy(preset->name, value, - MAX_PRESET_NAME_LENGTH); + g_free (preset->name); + preset->name = g_strdup(value); preset->freq = atoi (*entry); append_to_presets (preset, data); } Index: radio.h =================================================================== --- radio.h (revision 5363) +++ radio.h (working copy) @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -48,7 +49,7 @@ struct radio_preset_st { int freq; - char name [MAX_PRESET_NAME_LENGTH]; + gchar *name; struct radio_preset_st* next; };