summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-03-31 22:06:22 +0200
committerGravatar waker <wakeroid@gmail.com>2011-03-31 22:06:22 +0200
commit5c2f94c8bfa7b98b3c832d0ce11c6ecdbd474029 (patch)
treeeb92ff856f530485809ee0e2e0710f56f8d0155b /plugins
parent57de90e3b8958b4d5edf1bd0145f98623768caa9 (diff)
thread-safe config access
Diffstat (limited to 'plugins')
-rw-r--r--plugins/alsa/alsa.c6
-rw-r--r--plugins/artwork/artwork.c13
-rw-r--r--plugins/cdda/cdda.c6
-rw-r--r--plugins/ffmpeg/ffmpeg.c4
-rw-r--r--plugins/gtkui/callbacks.c16
-rw-r--r--plugins/gtkui/dspconfig.c4
-rw-r--r--plugins/gtkui/eq.c9
-rw-r--r--plugins/gtkui/gdkdrawing.c28
-rw-r--r--plugins/gtkui/gtkui.c27
-rw-r--r--plugins/gtkui/mainplaylist.c4
-rw-r--r--plugins/gtkui/pluginconf.c4
-rw-r--r--plugins/gtkui/prefwin.c42
-rw-r--r--plugins/gtkui/tagwritersettings.c3
-rw-r--r--plugins/lastfm/lastfm.c20
-rw-r--r--plugins/mpgmad/mpgmad.c3
-rw-r--r--plugins/notify/notify.c6
-rw-r--r--plugins/oss/oss.c7
-rw-r--r--plugins/shn/shn.c5
-rw-r--r--plugins/sid/csid.cpp5
-rw-r--r--plugins/sndfile/sndfile.c4
-rw-r--r--plugins/tta/ttaplug.c3
-rw-r--r--plugins/vfs_curl/vfs_curl.c10
-rw-r--r--plugins/wildmidi/wildmidiplug.c3
23 files changed, 152 insertions, 80 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index ed4ed014..6d619cf1 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -341,7 +341,7 @@ palsa_init (void) {
mutex = 0;
// get and cache conf variables
- strcpy (conf_alsa_soundcard, deadbeef->conf_get_str ("alsa_soundcard", "default"));
+ deadbeef->conf_get_str ("alsa_soundcard", "default", conf_alsa_soundcard, sizeof (conf_alsa_soundcard));
trace ("alsa_soundcard: %s\n", conf_alsa_soundcard);
snd_pcm_sw_params_t *sw_params = NULL;
@@ -682,7 +682,8 @@ palsa_callback (char *stream, int len) {
static int
palsa_configchanged (DB_event_t *ev, uintptr_t data) {
- const char *alsa_soundcard = deadbeef->conf_get_str ("alsa_soundcard", "default");
+ deadbeef->conf_lock ();
+ const char *alsa_soundcard = deadbeef->conf_get_str_fast ("alsa_soundcard", "default");
int buffer = deadbeef->conf_get_int ("alsa.buffer", DEFAULT_BUFFER_SIZE);
int period = deadbeef->conf_get_int ("alsa.period", DEFAULT_PERIOD_SIZE);
if (audio &&
@@ -692,6 +693,7 @@ palsa_configchanged (DB_event_t *ev, uintptr_t data) {
trace ("alsa: config option changed, restarting\n");
deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
}
+ deadbeef->conf_unlock ();
return 0;
}
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c
index af154c97..fffc701e 100644
--- a/plugins/artwork/artwork.c
+++ b/plugins/artwork/artwork.c
@@ -722,9 +722,9 @@ artwork_on_configchanged (DB_event_t *ev, uintptr_t data) {
int new_artwork_enable_local = deadbeef->conf_get_int ("artwork.enable_localfolder", 1);
int new_artwork_enable_lfm = deadbeef->conf_get_int ("artwork.enable_lastfm", 0);
int new_artwork_enable_aao = deadbeef->conf_get_int ("artwork.enable_albumartorg", 0);
+
char new_artwork_filemask[200];
- strncpy (new_artwork_filemask, deadbeef->conf_get_str ("artwork.filemask", DEFAULT_FILEMASK), sizeof (new_artwork_filemask));
- new_artwork_filemask[sizeof(new_artwork_filemask)-1] = 0;
+ deadbeef->conf_get_str ("artwork.filemask", DEFAULT_FILEMASK, new_artwork_filemask, sizeof (new_artwork_filemask));
if (new_artwork_enable_embedded != artwork_enable_embedded
|| new_artwork_enable_local != artwork_enable_local
@@ -749,7 +749,9 @@ artwork_on_configchanged (DB_event_t *ev, uintptr_t data) {
static int
artwork_plugin_start (void)
{
- const char *def_art = deadbeef->conf_get_str ("gtkui.nocover_pixmap", NULL);
+ deadbeef->conf_lock ();
+
+ const char *def_art = deadbeef->conf_get_str_fast ("gtkui.nocover_pixmap", NULL);
if (!def_art) {
snprintf (default_cover, sizeof (default_cover), "%s/noartwork.jpg", deadbeef->get_pixmap_dir ());
}
@@ -764,7 +766,10 @@ artwork_plugin_start (void)
artwork_enable_aao = deadbeef->conf_get_int ("artwork.enable_albumartorg", 0);
artwork_reset_time = deadbeef->conf_get_int64 ("artwork.cache_reset_time", 0);
- strncpy (artwork_filemask, deadbeef->conf_get_str ("artwork.filemask", DEFAULT_FILEMASK), sizeof (artwork_filemask));
+ deadbeef->conf_get_str ("artwork.filemask", DEFAULT_FILEMASK, artwork_filemask, sizeof (artwork_filemask));
+
+ deadbeef->conf_unlock ();
+
artwork_filemask[sizeof(artwork_filemask)-1] = 0;
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (artwork_on_configchanged), 0);
diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c
index 55352e97..b49c0cea 100644
--- a/plugins/cdda/cdda.c
+++ b/plugins/cdda/cdda.c
@@ -243,7 +243,8 @@ resolve_disc (CdIo_t *cdio)
conn = cddb_new();
- cddb_set_server_name (conn, deadbeef->conf_get_str ("cdda.freedb.host", DEFAULT_SERVER));
+ deadbeef->conf_lock ();
+ cddb_set_server_name (conn, deadbeef->conf_get_str_fast ("cdda.freedb.host", DEFAULT_SERVER));
cddb_set_server_port (conn, deadbeef->conf_get_int ("cdda.freedb.port", DEFAULT_PORT));
if (!deadbeef->conf_get_int ("cdda.protocol", DEFAULT_PROTOCOL))
@@ -252,9 +253,10 @@ resolve_disc (CdIo_t *cdio)
if (deadbeef->conf_get_int ("network.proxy", 0))
{
cddb_set_server_port(conn, deadbeef->conf_get_int ("network.proxy.port", 8080));
- cddb_set_server_name(conn, deadbeef->conf_get_str ("network.proxy.address", ""));
+ cddb_set_server_name(conn, deadbeef->conf_get_str_fast ("network.proxy.address", ""));
}
}
+ deadbeef->conf_unlock ();
int matches = cddb_query (conn, disc);
if (matches == -1)
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index 6872db8a..d28b54b4 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -674,7 +674,8 @@ static URLProtocol vfswrapper = {
static void
ffmpeg_init_exts (void) {
- const char *new_exts = deadbeef->conf_get_str ("ffmpeg.extensions", DEFAULT_EXTS);
+ deadbeef->conf_lock ();
+ const char *new_exts = deadbeef->conf_get_str_fast ("ffmpeg.extensions", DEFAULT_EXTS);
for (int i = 0; exts[i]; i++) {
free (exts[i]);
}
@@ -702,6 +703,7 @@ ffmpeg_init_exts (void) {
new_exts = e+1;
}
exts[n] = NULL;
+ deadbeef->conf_unlock ();
}
static int
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index 00ff70c6..71cf1bca 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -145,7 +145,9 @@ on_open_activate (GtkMenuItem *menuitem,
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dlg), TRUE);
// restore folder
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str ("filechooser.lastdir", ""));
+ deadbeef->conf_lock ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str_fast ("filechooser.lastdir", ""));
+ deadbeef->conf_unlock ();
int response = gtk_dialog_run (GTK_DIALOG (dlg));
// store folder
gchar *folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dlg));
@@ -179,7 +181,9 @@ on_add_files_activate (GtkMenuItem *menuitem,
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dlg), TRUE);
// restore folder
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str ("filechooser.lastdir", ""));
+ deadbeef->conf_lock ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str_fast ("filechooser.lastdir", ""));
+ deadbeef->conf_unlock ();
int response = gtk_dialog_run (GTK_DIALOG (dlg));
// store folder
gchar *folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dlg));
@@ -225,7 +229,9 @@ on_add_folders_activate (GtkMenuItem *menuitem,
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dlg), TRUE);
// restore folder
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str ("filechooser.lastdir", ""));
+ deadbeef->conf_lock ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str_fast ("filechooser.lastdir", ""));
+ deadbeef->conf_unlock ();
int response = gtk_dialog_run (GTK_DIALOG (dlg));
// store folder
gchar *folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dlg));
@@ -1127,7 +1133,9 @@ on_custom2_activate (GtkMenuItem *menuitem,
GtkEntry *entry = GTK_ENTRY (lookup_widget (dlg, "sortfmt"));
gtk_combo_box_set_active (combo, deadbeef->conf_get_int ("gtkui.sortby_order", 0));
- gtk_entry_set_text (entry, deadbeef->conf_get_str ("gtkui.sortby_fmt", ""));
+ deadbeef->conf_lock ();
+ gtk_entry_set_text (entry, deadbeef->conf_get_str_fast ("gtkui.sortby_fmt", ""));
+ deadbeef->conf_unlock ();
int r = gtk_dialog_run (GTK_DIALOG (dlg));
diff --git a/plugins/gtkui/dspconfig.c b/plugins/gtkui/dspconfig.c
index 75f9999c..268f1b16 100644
--- a/plugins/gtkui/dspconfig.c
+++ b/plugins/gtkui/dspconfig.c
@@ -112,7 +112,9 @@ dsp_setup_init (GtkWidget *_prefwin) {
GtkWidget *combobox = lookup_widget (prefwin, "dsp_preset");
GtkWidget *entry = gtk_bin_get_child (GTK_BIN (combobox));
if (entry) {
- gtk_entry_set_text (GTK_ENTRY (entry), deadbeef->conf_get_str ("gtkui.conf_dsp_preset", ""));
+ deadbeef->conf_lock ();
+ gtk_entry_set_text (GTK_ENTRY (entry), deadbeef->conf_get_str_fast ("gtkui.conf_dsp_preset", ""));
+ deadbeef->conf_unlock ();
}
// fill list of presets
diff --git a/plugins/gtkui/eq.c b/plugins/gtkui/eq.c
index 3a5932b9..bfb77703 100644
--- a/plugins/gtkui/eq.c
+++ b/plugins/gtkui/eq.c
@@ -189,7 +189,9 @@ on_load_preset_clicked (GtkMenuItem *menuitem,
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dlg), FALSE);
// restore folder
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str ("filechooser.lastdir", ""));
+ deadbeef->conf_lock ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str_fast ("filechooser.lastdir", ""));
+ deadbeef->conf_unlock ();
int response = gtk_dialog_run (GTK_DIALOG (dlg));
// store folder
gchar *folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dlg));
@@ -252,7 +254,10 @@ on_import_fb2k_preset_clicked (GtkButton *button,
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dlg), FALSE);
// restore folder
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str ("filechooser.lastdir", ""));
+ deadbeef->conf_lock ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str_fast ("filechooser.lastdir", ""));
+ deadbeef->conf_unlock ();
+
int response = gtk_dialog_run (GTK_DIALOG (dlg));
// store folder
gchar *folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dlg));
diff --git a/plugins/gtkui/gdkdrawing.c b/plugins/gtkui/gdkdrawing.c
index e9d496f4..cb795ccb 100644
--- a/plugins/gtkui/gdkdrawing.c
+++ b/plugins/gtkui/gdkdrawing.c
@@ -227,6 +227,7 @@ gtkui_override_tabstrip_colors (void) {
void
gtkui_init_theme_colors (void) {
+ deadbeef->conf_lock ();
override_listview_colors= deadbeef->conf_get_int ("gtkui.override_listview_colors", 0);
override_bar_colors = deadbeef->conf_get_int ("gtkui.override_bar_colors", 0);
override_tabstrip_colors = deadbeef->conf_get_int ("gtkui.override_tabstrip_colors", 0);
@@ -242,11 +243,11 @@ gtkui_init_theme_colors (void) {
}
else {
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->base[GTK_STATE_SELECTED].red, style->base[GTK_STATE_SELECTED].green, style->base[GTK_STATE_SELECTED].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.bar_foreground", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.bar_foreground", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_bar_foreground_color.red, &gtkui_bar_foreground_color.green, &gtkui_bar_foreground_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->fg[GTK_STATE_NORMAL].red, style->fg[GTK_STATE_NORMAL].green, style->fg[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.bar_background", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.bar_background", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_bar_background_color.red, &gtkui_bar_background_color.green, &gtkui_bar_background_color.blue);
}
@@ -260,23 +261,23 @@ gtkui_init_theme_colors (void) {
}
else {
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->dark[GTK_STATE_NORMAL].red, style->dark[GTK_STATE_NORMAL].green, style->dark[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.tabstrip_dark", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.tabstrip_dark", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_tabstrip_dark_color.red, &gtkui_tabstrip_dark_color.green, &gtkui_tabstrip_dark_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->mid[GTK_STATE_NORMAL].red, style->mid[GTK_STATE_NORMAL].green, style->mid[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.tabstrip_mid", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.tabstrip_mid", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_tabstrip_mid_color.red, &gtkui_tabstrip_mid_color.green, &gtkui_tabstrip_mid_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->light[GTK_STATE_NORMAL].red, style->light[GTK_STATE_NORMAL].green, style->light[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.tabstrip_light", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.tabstrip_light", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_tabstrip_light_color.red, &gtkui_tabstrip_light_color.green, &gtkui_tabstrip_light_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->bg[GTK_STATE_NORMAL].red, style->bg[GTK_STATE_NORMAL].green, style->bg[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.tabstrip_base", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.tabstrip_base", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_tabstrip_base_color.red, &gtkui_tabstrip_base_color.green, &gtkui_tabstrip_base_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->text[GTK_STATE_NORMAL].red, style->text[GTK_STATE_NORMAL].green, style->text[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.tabstrip_text", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.tabstrip_text", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_tabstrip_text_color.red, &gtkui_tabstrip_text_color.green, &gtkui_tabstrip_text_color.blue);
}
@@ -290,29 +291,30 @@ gtkui_init_theme_colors (void) {
}
else {
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->light[GTK_STATE_NORMAL].red, style->light[GTK_STATE_NORMAL].green, style->light[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.listview_even_row", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.listview_even_row", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_listview_even_row_color.red, &gtkui_listview_even_row_color.green, &gtkui_listview_even_row_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->mid[GTK_STATE_NORMAL].red, style->mid[GTK_STATE_NORMAL].green, style->mid[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.listview_odd_row", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.listview_odd_row", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_listview_odd_row_color.red, &gtkui_listview_odd_row_color.green, &gtkui_listview_odd_row_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->mid[GTK_STATE_NORMAL].red, style->mid[GTK_STATE_NORMAL].green, style->mid[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.listview_selection", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.listview_selection", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_listview_selection_color.red, &gtkui_listview_selection_color.green, &gtkui_listview_selection_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->fg[GTK_STATE_NORMAL].red, style->fg[GTK_STATE_NORMAL].green, style->fg[GTK_STATE_NORMAL].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.listview_text", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.listview_text", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_listview_text_color.red, &gtkui_listview_text_color.green, &gtkui_listview_text_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->fg[GTK_STATE_SELECTED].red, style->fg[GTK_STATE_SELECTED].green, style->fg[GTK_STATE_SELECTED].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.listview_selected_text", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.listview_selected_text", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_listview_selected_text_color.red, &gtkui_listview_selected_text_color.green, &gtkui_listview_selected_text_color.blue);
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->fg[GTK_STATE_SELECTED].red, style->fg[GTK_STATE_SELECTED].green, style->fg[GTK_STATE_SELECTED].blue);
- clr = deadbeef->conf_get_str ("gtkui.color.listview_cursor", color_text);
+ clr = deadbeef->conf_get_str_fast ("gtkui.color.listview_cursor", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_listview_cursor_color.red, &gtkui_listview_cursor_color.green, &gtkui_listview_cursor_color.blue);
}
+ deadbeef->conf_unlock ();
}
void
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index f27f1ecb..fac73135 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -119,6 +119,7 @@ update_songinfo (gpointer ctx) {
if (!gtk_widget_get_visible (mainwin) || iconified) {
return FALSE;
}
+ DB_output_t *output = deadbeef->get_output ();
char sbtext_new[512] = "-";
float songpos = last_songpos;
@@ -144,7 +145,7 @@ update_songinfo (gpointer ctx) {
float duration = track ? deadbeef->pl_get_item_duration (track) : -1;
- if (deadbeef->get_output ()->state () == OUTPUT_STATE_STOPPED || !track || !c) {
+ if (!output || (output->state () == OUTPUT_STATE_STOPPED || !track || !c)) {
snprintf (sbtext_new, sizeof (sbtext_new), _("Stopped | %d tracks | %s total playtime"), deadbeef->pl_getcount (PL_MAIN), totaltime_str);
songpos = 0;
}
@@ -397,13 +398,13 @@ gtkui_set_titlebar (DB_playItem_t *it) {
else {
deadbeef->pl_item_ref (it);
}
+ char fmt[500];
char str[600];
- const char *fmt;
if (it) {
- fmt = deadbeef->conf_get_str ("gtkui.titlebar_playing", "%a - %t - DeaDBeeF-%V");
+ deadbeef->conf_get_str ("gtkui.titlebar_playing", "%a - %t - DeaDBeeF-%V", fmt, sizeof (fmt));
}
else {
- fmt = deadbeef->conf_get_str ("gtkui.titlebar_stopped", "DeaDBeeF-%V");
+ deadbeef->conf_get_str ("gtkui.titlebar_stopped", "DeaDBeeF-%V", fmt, sizeof (fmt));
}
deadbeef->pl_format_title (it, -1, str, sizeof (str), -1, fmt);
gtk_window_set_title (GTK_WINDOW (mainwin), str);
@@ -532,7 +533,7 @@ gtkui_on_playlistswitch (DB_event_t *ev, uintptr_t data) {
}
static gboolean
-gtkui_on_frameupdate (uintptr_t data) {
+gtkui_on_frameupdate (gpointer data) {
update_songinfo (NULL);
return TRUE;
@@ -570,7 +571,9 @@ gtkui_update_status_icon (gpointer unused) {
// system tray icon
traymenu = create_traymenu ();
- const char *icon_name = deadbeef->conf_get_str ("gtkui.custom_tray_icon", TRAY_ICON);
+ char tmp[1000];
+ const char *icon_name = tmp;
+ deadbeef->conf_get_str ("gtkui.custom_tray_icon", TRAY_ICON, tmp, sizeof (tmp));
GtkIconTheme *theme = gtk_icon_theme_get_default();
if (!gtk_icon_theme_has_icon(theme, icon_name))
@@ -669,7 +672,9 @@ save_playlist_as (void) {
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dlg), TRUE);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlg), "untitled.dbpl");
// restore folder
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str ("filechooser.playlist.lastdir", ""));
+ deadbeef->conf_lock ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str_fast ("filechooser.playlist.lastdir", ""));
+ deadbeef->conf_unlock ();
GtkFileFilter* flt;
flt = gtk_file_filter_new ();
@@ -769,7 +774,9 @@ on_playlist_load_activate (GtkMenuItem *menuitem,
GtkWidget *dlg = gtk_file_chooser_dialog_new (_("Load Playlist"), GTK_WINDOW (mainwin), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL);
// restore folder
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str ("filechooser.playlist.lastdir", ""));
+ deadbeef->conf_lock ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str_fast ("filechooser.playlist.lastdir", ""));
+ deadbeef->conf_unlock ();
GtkFileFilter* flt;
flt = gtk_file_filter_new ();
@@ -1044,8 +1051,10 @@ gtkui_thread (void *ctx) {
g_timeout_add (100, gtkui_on_frameupdate, NULL);
+ char fmt[500];
char str[600];
- deadbeef->pl_format_title (NULL, -1, str, sizeof (str), -1, deadbeef->conf_get_str ("gtkui.titlebar_stopped", "DeaDBeeF-%V"));
+ deadbeef->conf_get_str ("gtkui.titlebar_stopped", "DeaDBeeF-%V", fmt, sizeof (fmt));
+ deadbeef->pl_format_title (NULL, -1, str, sizeof (str), -1, fmt);
gtk_window_set_title (GTK_WINDOW (mainwin), str);
gtk_initialized = 1;
diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c
index 9a774eb4..f4616f8d 100644
--- a/plugins/gtkui/mainplaylist.c
+++ b/plugins/gtkui/mainplaylist.c
@@ -325,7 +325,9 @@ main_playlist_init (GtkWidget *widget) {
g_object_set_property (G_OBJECT (widget), "has-tooltip", &value);
g_signal_connect (G_OBJECT (widget), "query-tooltip", G_CALLBACK (playlist_tooltip_handler), NULL);
}
- strncpy (group_by_str, deadbeef->conf_get_str ("playlist.group_by", ""), sizeof (group_by_str));
+ deadbeef->conf_lock ();
+ strncpy (group_by_str, deadbeef->conf_get_str_fast ("playlist.group_by", ""), sizeof (group_by_str));
+ deadbeef->conf_unlock ();
group_by_str[sizeof (group_by_str)-1] = 0;
}
diff --git a/plugins/gtkui/pluginconf.c b/plugins/gtkui/pluginconf.c
index 6e4aeff4..c7c73ae8 100644
--- a/plugins/gtkui/pluginconf.c
+++ b/plugins/gtkui/pluginconf.c
@@ -43,7 +43,9 @@ on_prop_browse_file (GtkButton *button, gpointer user_data) {
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dlg), FALSE);
// restore folder
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str ("filechooser.lastdir", ""));
+ deadbeef->conf_lock ();
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dlg), deadbeef->conf_get_str_fast ("filechooser.lastdir", ""));
+ deadbeef->conf_unlock ();
int response = gtk_dialog_run (GTK_DIALOG (dlg));
// store folder
gchar *folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dlg));
diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c
index 7b67a0a8..cb1985c0 100644
--- a/plugins/gtkui/prefwin.c
+++ b/plugins/gtkui/prefwin.c
@@ -59,9 +59,11 @@ gtk_enum_sound_callback (const char *name, const char *desc, void *userdata) {
GtkComboBox *combobox = GTK_COMBO_BOX (userdata);
gtk_combo_box_append_text (combobox, desc);
- if (!strcmp (deadbeef->conf_get_str ("alsa_soundcard", "default"), name)) {
+ deadbeef->conf_lock ();
+ if (!strcmp (deadbeef->conf_get_str_fast ("alsa_soundcard", "default"), name)) {
gtk_combo_box_set_active (combobox, num_alsa_devices);
}
+ deadbeef->conf_unlock ();
strncpy (alsa_device_names[num_alsa_devices], name, 63);
alsa_device_names[num_alsa_devices][63] = 0;
@@ -73,15 +75,19 @@ preferences_fill_soundcards (void) {
if (!prefwin) {
return;
}
- const char *s = deadbeef->conf_get_str ("alsa_soundcard", "default");
GtkComboBox *combobox = GTK_COMBO_BOX (lookup_widget (prefwin, "pref_soundcard"));
GtkTreeModel *mdl = gtk_combo_box_get_model (combobox);
gtk_list_store_clear (GTK_LIST_STORE (mdl));
gtk_combo_box_append_text (combobox, _("Default Audio Device"));
+
+ deadbeef->conf_lock ();
+ const char *s = deadbeef->conf_get_str_fast ("alsa_soundcard", "default");
if (!strcmp (s, "default")) {
gtk_combo_box_set_active (combobox, 0);
}
+ deadbeef->conf_unlock ();
+
num_alsa_devices = 1;
strcpy (alsa_device_names[0], "default");
if (deadbeef->get_output ()->enum_soundcards) {
@@ -455,15 +461,16 @@ on_preferences_activate (GtkMenuItem *menuitem,
if (prefwin) {
return;
}
+ deadbeef->conf_lock ();
GtkWidget *w = prefwin = create_prefwin ();
gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (mainwin));
GtkComboBox *combobox = NULL;
// output plugin selection
- const char *outplugname = deadbeef->conf_get_str ("output_plugin", _("ALSA output plugin"));
combobox = GTK_COMBO_BOX (lookup_widget (w, "pref_output_plugin"));
+ const char *outplugname = deadbeef->conf_get_str_fast ("output_plugin", _("ALSA output plugin"));
DB_output_t **out_plugs = deadbeef->plug_get_output_list ();
for (int i = 0; out_plugs[i]; i++) {
gtk_combo_box_append_text (combobox, out_plugs[i]->plugin.name);
@@ -515,14 +522,14 @@ on_preferences_activate (GtkMenuItem *menuitem,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "auto_name_playlist_from_folder")), deadbeef->conf_get_int ("gtkui.name_playlist_from_folder", 0));
// titlebar text
- gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "titlebar_format_playing")), deadbeef->conf_get_str ("gtkui.titlebar_playing", "%a - %t - DeaDBeeF-%V"));
- gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "titlebar_format_stopped")), deadbeef->conf_get_str ("gtkui.titlebar_stopped", "DeaDBeeF-%V"));
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "titlebar_format_playing")), deadbeef->conf_get_str_fast ("gtkui.titlebar_playing", "%a - %t - DeaDBeeF-%V"));
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "titlebar_format_stopped")), deadbeef->conf_get_str_fast ("gtkui.titlebar_stopped", "DeaDBeeF-%V"));
// cli playlist
int active = deadbeef->conf_get_int ("cli_add_to_specific_playlist", 1);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (prefwin, "cli_add_to_playlist")), active);
gtk_widget_set_sensitive (lookup_widget (prefwin, "cli_playlist_name"), active);
- gtk_entry_set_text (GTK_ENTRY (lookup_widget (prefwin, "cli_playlist_name")), deadbeef->conf_get_str ("cli_add_playlist_name", "Default"));
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (prefwin, "cli_playlist_name")), deadbeef->conf_get_str_fast ("cli_add_playlist_name", "Default"));
// resume last session
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "resume_last_session")), deadbeef->conf_get_int ("resume_last_session", 0));
@@ -532,7 +539,7 @@ on_preferences_activate (GtkMenuItem *menuitem,
const char **names = deadbeef->plug_get_gui_names ();
for (int i = 0; names[i]; i++) {
gtk_combo_box_append_text (combobox, names[i]);
- if (!strcmp (names[i], deadbeef->conf_get_str ("gui_plugin", "GTK2"))) {
+ if (!strcmp (names[i], deadbeef->conf_get_str_fast ("gui_plugin", "GTK2"))) {
gtk_combo_box_set_active (combobox, i);
}
}
@@ -557,10 +564,10 @@ on_preferences_activate (GtkMenuItem *menuitem,
// network
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "pref_network_enableproxy")), deadbeef->conf_get_int ("network.proxy", 0));
- gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "pref_network_proxyaddress")), deadbeef->conf_get_str ("network.proxy.address", ""));
- gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "pref_network_proxyport")), deadbeef->conf_get_str ("network.proxy.port", "8080"));
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "pref_network_proxyaddress")), deadbeef->conf_get_str_fast ("network.proxy.address", ""));
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "pref_network_proxyport")), deadbeef->conf_get_str_fast ("network.proxy.port", "8080"));
combobox = GTK_COMBO_BOX (lookup_widget (w, "pref_network_proxytype"));
- const char *type = deadbeef->conf_get_str ("network.proxy.type", "HTTP");
+ const char *type = deadbeef->conf_get_str_fast ("network.proxy.type", "HTTP");
if (!strcasecmp (type, "HTTP")) {
gtk_combo_box_set_active (combobox, 0);
}
@@ -579,8 +586,8 @@ on_preferences_activate (GtkMenuItem *menuitem,
else if (!strcasecmp (type, "SOCKS5_HOSTNAME")) {
gtk_combo_box_set_active (combobox, 5);
}
- gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "proxyuser")), deadbeef->conf_get_str ("network.proxy.username", ""));
- gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "proxypassword")), deadbeef->conf_get_str ("network.proxy.password", ""));
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "proxyuser")), deadbeef->conf_get_str_fast ("network.proxy.username", ""));
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "proxypassword")), deadbeef->conf_get_str_fast ("network.proxy.password", ""));
// list of plugins
GtkTreeView *tree = GTK_TREE_VIEW (lookup_widget (w, "pref_pluginlist"));
@@ -624,6 +631,7 @@ on_preferences_activate (GtkMenuItem *menuitem,
prefwin_add_hotkeys_tab (prefwin);
}
+ deadbeef->conf_unlock ();
gtk_dialog_run (GTK_DIALOG (prefwin));
dsp_setup_free ();
gtk_widget_destroy (prefwin);
@@ -638,11 +646,13 @@ on_pref_soundcard_changed (GtkComboBox *combobox,
{
int active = gtk_combo_box_get_active (combobox);
if (active >= 0 && active < num_alsa_devices) {
- const char *soundcard = deadbeef->conf_get_str ("alsa_soundcard", "default");
+ deadbeef->conf_lock ();
+ const char *soundcard = deadbeef->conf_get_str_fast ("alsa_soundcard", "default");
if (strcmp (soundcard, alsa_device_names[active])) {
deadbeef->conf_set_str ("alsa_soundcard", alsa_device_names[active]);
deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
}
+ deadbeef->conf_unlock ();
}
}
@@ -650,13 +660,14 @@ void
on_pref_output_plugin_changed (GtkComboBox *combobox,
gpointer user_data)
{
- const char *outplugname = deadbeef->conf_get_str ("output_plugin", _("ALSA output plugin"));
int active = gtk_combo_box_get_active (combobox);
DB_output_t **out_plugs = deadbeef->plug_get_output_list ();
DB_output_t *prev = NULL;
DB_output_t *new = NULL;
+ deadbeef->conf_lock ();
+ const char *outplugname = deadbeef->conf_get_str_fast ("output_plugin", _("ALSA output plugin"));
for (int i = 0; out_plugs[i]; i++) {
if (!strcmp (out_plugs[i]->plugin.name, outplugname)) {
prev = out_plugs[i];
@@ -665,6 +676,7 @@ on_pref_output_plugin_changed (GtkComboBox *combobox,
new = out_plugs[i];
}
}
+ deadbeef->conf_unlock ();
if (!new) {
fprintf (stderr, "failed to find output plugin selected in preferences window\n");
@@ -781,7 +793,7 @@ on_pref_pluginlist_cursor_changed (GtkTreeView *treeview,
void
gtkui_conf_get_str (const char *key, char *value, int len, const char *def) {
- strcpy (value, deadbeef->conf_get_str (key, def));
+ deadbeef->conf_get_str (key, def, value, len);
}
void
diff --git a/plugins/gtkui/tagwritersettings.c b/plugins/gtkui/tagwritersettings.c
index 8451bd44..ede3d447 100644
--- a/plugins/gtkui/tagwritersettings.c
+++ b/plugins/gtkui/tagwritersettings.c
@@ -39,7 +39,8 @@ run_tagwriter_settings (GtkWidget *parentwindow) {
int write_id3v1 = deadbeef->conf_get_int ("mp3.write_id3v1", 1);
int write_apev2 = deadbeef->conf_get_int ("mp3.write_apev2", 0);
int id3v2_version = deadbeef->conf_get_int ("mp3.id3v2_version", 3);
- const char *id3v1_encoding = deadbeef->conf_get_str ("mp3.id3v1_encoding", "iso8859-1");
+ char id3v1_encoding[50];
+ deadbeef->conf_get_str ("mp3.id3v1_encoding", "iso8859-1", id3v1_encoding, sizeof (id3v1_encoding));
int ape_strip_id3v2 = deadbeef->conf_get_int ("ape.strip_id3v2", 0);
int ape_strip_apev2 = deadbeef->conf_get_int ("ape.strip_apev2", 0);
int ape_write_id3v2 = deadbeef->conf_get_int ("ape.write_id3v2", 0);
diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c
index 68f1adc0..b29355b1 100644
--- a/plugins/lastfm/lastfm.c
+++ b/plugins/lastfm/lastfm.c
@@ -67,13 +67,15 @@ static DB_playItem_t *lfm_subm_queue[LFM_SUBMISSION_QUEUE_SIZE];
static void
lfm_update_auth (void) {
- const char *user = deadbeef->conf_get_str ("lastfm.login", "");
- const char *pass = deadbeef->conf_get_str ("lastfm.password", "");
+ deadbeef->conf_lock ();
+ const char *user = deadbeef->conf_get_str_fast ("lastfm.login", "");
+ const char *pass = deadbeef->conf_get_str_fast ("lastfm.password", "");
if (strcmp (user, lfm_user) || strcmp (pass, lfm_pass)) {
strcpy (lfm_user, user);
strcpy (lfm_pass, pass);
lfm_sess[0] = 0;
}
+ deadbeef->conf_unlock ();
}
static size_t
@@ -128,9 +130,10 @@ curl_req_send (const char *req, const char *post) {
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(post));
}
if (deadbeef->conf_get_int ("network.proxy", 0)) {
- curl_easy_setopt (curl, CURLOPT_PROXY, deadbeef->conf_get_str ("network.proxy.address", ""));
+ deadbeef->conf_lock ();
+ curl_easy_setopt (curl, CURLOPT_PROXY, deadbeef->conf_get_str_fast ("network.proxy.address", ""));
curl_easy_setopt (curl, CURLOPT_PROXYPORT, deadbeef->conf_get_int ("network.proxy.port", 8080));
- const char *type = deadbeef->conf_get_str ("network.proxy.type", "HTTP");
+ const char *type = deadbeef->conf_get_str_fast ("network.proxy.type", "HTTP");
int curlproxytype = CURLPROXY_HTTP;
if (!strcasecmp (type, "HTTP")) {
curlproxytype = CURLPROXY_HTTP;
@@ -158,8 +161,8 @@ curl_req_send (const char *req, const char *post) {
#endif
curl_easy_setopt (curl, CURLOPT_PROXYTYPE, curlproxytype);
- const char *proxyuser = deadbeef->conf_get_str ("network.proxy.username", "");
- const char *proxypass = deadbeef->conf_get_str ("network.proxy.password", "");
+ const char *proxyuser = deadbeef->conf_get_str_fast ("network.proxy.username", "");
+ const char *proxypass = deadbeef->conf_get_str_fast ("network.proxy.password", "");
if (*proxyuser || *proxypass) {
#if LIBCURL_VERSION_MINOR >= 19 && LIBCURL_VERSION_PATCH >= 1
curl_easy_setopt (curl, CURLOPT_PROXYUSERNAME, proxyuser);
@@ -170,6 +173,7 @@ curl_req_send (const char *req, const char *post) {
curl_easy_setopt (curl, CURLOPT_PROXYUSERPWD, pwd);
#endif
}
+ deadbeef->conf_unlock ();
}
int status = curl_easy_perform(curl);
curl_easy_cleanup (curl);
@@ -207,12 +211,14 @@ auth (void) {
deadbeef->md5 (sig, token, strlen (token));
deadbeef->md5_to_str (token, sig);
- const char *scrobbler_url = deadbeef->conf_get_str ("lastfm.scrobbler_url", SCROBBLER_URL_LFM);
+ deadbeef->conf_lock ();
+ const char *scrobbler_url = deadbeef->conf_get_str_fast ("lastfm.scrobbler_url", SCROBBLER_URL_LFM);
#if LFM_TESTMODE
snprintf (req, sizeof (req), "%s/?hs=true&p=1.2.1&c=tst&v=1.0&u=%s&t=%d&a=%s", scrobbler_url, lfm_user, (int)timestamp, token);
#else
snprintf (req, sizeof (req), "%s/?hs=true&p=1.2.1&c=%s&v=%d.%d&u=%s&t=%d&a=%s", scrobbler_url, LFM_CLIENTID, plugin.plugin.version_major, plugin.plugin.version_minor, lfm_user, (int)timestamp, token);
#endif
+ deadbeef->conf_unlock ();
// handshake
int status = curl_req_send (req, NULL);
if (!status) {
diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c
index 29ea88b9..9e51ae6d 100644
--- a/plugins/mpgmad/mpgmad.c
+++ b/plugins/mpgmad/mpgmad.c
@@ -1397,7 +1397,8 @@ cmp3_write_metadata (DB_playItem_t *it) {
if (id3v2_version != 3 && id3v2_version != 4) {
id3v2_version = 3;
}
- const char *id3v1_encoding = deadbeef->conf_get_str ("mp3.id3v1_encoding", "iso8859-1");
+ char id3v1_encoding[50];
+ deadbeef->conf_get_str ("mp3.id3v1_encoding", "iso8859-1", id3v1_encoding, sizeof (id3v1_encoding));
return deadbeef->junk_rewrite_tags (it, junk_flags, id3v2_version, id3v1_encoding);
}
diff --git a/plugins/notify/notify.c b/plugins/notify/notify.c
index 6bd42ab8..84669594 100644
--- a/plugins/notify/notify.c
+++ b/plugins/notify/notify.c
@@ -184,8 +184,10 @@ cover_avail_callback (const char *fname, const char *artist, const char *album,
static void show_notification (DB_playItem_t *track) {
char title[1024];
char content[1024];
- deadbeef->pl_format_title (track, -1, title, sizeof (title), -1, deadbeef->conf_get_str ("notify.format", NOTIFY_DEFAULT_TITLE));
- deadbeef->pl_format_title (track, -1, content, sizeof (content), -1, deadbeef->conf_get_str ("notify.format_content", NOTIFY_DEFAULT_CONTENT));
+ deadbeef->conf_lock ();
+ deadbeef->pl_format_title (track, -1, title, sizeof (title), -1, deadbeef->conf_get_str_fast ("notify.format", NOTIFY_DEFAULT_TITLE));
+ deadbeef->pl_format_title (track, -1, content, sizeof (content), -1, deadbeef->conf_get_str_fast ("notify.format_content", NOTIFY_DEFAULT_CONTENT));
+ deadbeef->conf_unlock ();
// escape &
// char esc_title[1024];
diff --git a/plugins/oss/oss.c b/plugins/oss/oss.c
index e2fdf3ee..1570c2a0 100644
--- a/plugins/oss/oss.c
+++ b/plugins/oss/oss.c
@@ -309,19 +309,20 @@ oss_get_state (void) {
static int
oss_configchanged (DB_event_t *ev, uintptr_t data) {
- const char *dev = deadbeef->conf_get_str ("oss.device", "/dev/dsp");
+ deadbeef->conf_lock ();
+ const char *dev = deadbeef->conf_get_str_fast ("oss.device", "/dev/dsp");
if (strcmp (dev, oss_device)) {
strncpy (oss_device, dev, sizeof (oss_device)-1);
trace ("oss: config option changed, restarting\n");
deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
}
+ deadbeef->conf_unlock ();
return 0;
}
static int
oss_plugin_start (void) {
- const char *dev = deadbeef->conf_get_str ("oss.device", "/dev/dsp");
- strncpy (oss_device, dev, sizeof (oss_device)-1);
+ deadbeef->conf_get_str ("oss.device", "/dev/dsp", oss_device, sizeof (oss_device));
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (oss_configchanged), 0);
return 0;
}
diff --git a/plugins/shn/shn.c b/plugins/shn/shn.c
index 87440ee2..4a90583c 100644
--- a/plugins/shn/shn.c
+++ b/plugins/shn/shn.c
@@ -306,8 +306,9 @@ shn_init_decoder (shn_fileinfo_t *info) {
static void
shn_init_config (void) {
shn_cfg.error_output_method = ERROR_OUTPUT_DEVNULL;
- strncpy (shn_cfg.seek_tables_path, deadbeef->conf_get_str ("shn.seektable_path", ""), sizeof (shn_cfg.seek_tables_path));
- strncpy (shn_cfg.relative_seek_tables_path, deadbeef->conf_get_str ("shn.relative_seektable_path", "seektables"), sizeof (shn_cfg.relative_seek_tables_path));
+
+ deadbeef->conf_get_str ("shn.seektable_path", "", shn_cfg.seek_tables_path, sizeof (shn_cfg.seek_tables_path));
+ deadbeef->conf_get_str ("shn.relative_seektable_path", "seektables", shn_cfg.relative_seek_tables_path, sizeof (shn_cfg.relative_seek_tables_path));
shn_cfg.verbose = 0;
shn_cfg.swap_bytes = deadbeef->conf_get_int ("shn.swap_bytes", 0);
}
diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp
index dd176e05..ffdd4548 100644
--- a/plugins/sid/csid.cpp
+++ b/plugins/sid/csid.cpp
@@ -108,8 +108,9 @@ sldb_load()
sldb_disable = 1;
return;
}
- const char *conf_hvsc_path = deadbeef->conf_get_str ("hvsc_path", NULL);
- if (!conf_hvsc_path) {
+ char conf_hvsc_path[1000];
+ deadbeef->conf_get_str ("hvsc_path", "", conf_hvsc_path, sizeof (conf_hvsc_path));
+ if (!conf_hvsc_path[0]) {
sldb_disable = 1;
return;
}
diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c
index 1117788e..3af4616f 100644
--- a/plugins/sndfile/sndfile.c
+++ b/plugins/sndfile/sndfile.c
@@ -379,13 +379,14 @@ static const char *filetypes[] = { "WAV", NULL };
static void
sndfile_init_exts (void) {
- const char *new_exts = deadbeef->conf_get_str ("sndfile.extensions", DEFAULT_EXTS);
for (int i = 0; exts[i]; i++) {
free (exts[i]);
}
exts[0] = NULL;
int n = 0;
+ deadbeef->conf_lock ();
+ const char *new_exts = deadbeef->conf_get_str_fast ("sndfile.extensions", DEFAULT_EXTS);
while (*new_exts) {
if (n >= EXT_MAX) {
fprintf (stderr, "sndfile: too many extensions, max is %d\n", EXT_MAX);
@@ -406,6 +407,7 @@ sndfile_init_exts (void) {
}
new_exts = e+1;
}
+ deadbeef->conf_unlock ();
exts[n] = NULL;
}
diff --git a/plugins/tta/ttaplug.c b/plugins/tta/ttaplug.c
index b83e805b..20a0c8a5 100644
--- a/plugins/tta/ttaplug.c
+++ b/plugins/tta/ttaplug.c
@@ -285,7 +285,8 @@ static int tta_write_metadata (DB_playItem_t *it) {
}
int id3v2_version = 4;
- const char *id3v1_encoding = deadbeef->conf_get_str ("mp3.id3v1_encoding", "iso8859-1");
+ char id3v1_encoding[50];
+ deadbeef->conf_get_str ("mp3.id3v1_encoding", "iso8859-1", id3v1_encoding, sizeof (id3v1_encoding));
return deadbeef->junk_rewrite_tags (it, junk_flags, id3v2_version, id3v1_encoding);
}
diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c
index 5a2d4ddd..528b3809 100644
--- a/plugins/vfs_curl/vfs_curl.c
+++ b/plugins/vfs_curl/vfs_curl.c
@@ -558,9 +558,10 @@ http_thread_func (void *ctx) {
curl_easy_setopt (curl, CURLOPT_RESUME_FROM, fp->pos);
}
if (deadbeef->conf_get_int ("network.proxy", 0)) {
- curl_easy_setopt (curl, CURLOPT_PROXY, deadbeef->conf_get_str ("network.proxy.address", ""));
+ deadbeef->conf_lock ();
+ curl_easy_setopt (curl, CURLOPT_PROXY, deadbeef->conf_get_str_fast ("network.proxy.address", ""));
curl_easy_setopt (curl, CURLOPT_PROXYPORT, deadbeef->conf_get_int ("network.proxy.port", 8080));
- const char *type = deadbeef->conf_get_str ("network.proxy.type", "HTTP");
+ const char *type = deadbeef->conf_get_str_fast ("network.proxy.type", "HTTP");
int curlproxytype = CURLPROXY_HTTP;
if (!strcasecmp (type, "HTTP")) {
curlproxytype = CURLPROXY_HTTP;
@@ -588,8 +589,8 @@ http_thread_func (void *ctx) {
#endif
curl_easy_setopt (curl, CURLOPT_PROXYTYPE, curlproxytype);
- const char *proxyuser = deadbeef->conf_get_str ("network.proxy.username", "");
- const char *proxypass = deadbeef->conf_get_str ("network.proxy.password", "");
+ const char *proxyuser = deadbeef->conf_get_str_fast ("network.proxy.username", "");
+ const char *proxypass = deadbeef->conf_get_str_fast ("network.proxy.password", "");
if (*proxyuser || *proxypass) {
#if LIBCURL_VERSION_MINOR >= 19 && LIBCURL_VERSION_PATCH >= 1
curl_easy_setopt (curl, CURLOPT_PROXYUSERNAME, proxyuser);
@@ -600,6 +601,7 @@ http_thread_func (void *ctx) {
curl_easy_setopt (curl, CURLOPT_PROXYUSERPWD, pwd);
#endif
}
+ deadbeef->conf_unlock ();
}
// fp->status = STATUS_INITIAL;
trace ("vfs_curl: calling curl_easy_perform (status=%d)...\n", fp->status);
diff --git a/plugins/wildmidi/wildmidiplug.c b/plugins/wildmidi/wildmidiplug.c
index b12de3f1..fd9a9bbe 100644
--- a/plugins/wildmidi/wildmidiplug.c
+++ b/plugins/wildmidi/wildmidiplug.c
@@ -131,7 +131,8 @@ wmidi_insert (DB_playItem_t *after, const char *fname) {
int
wmidi_start (void) {
- const char *config_files = deadbeef->conf_get_str ("wildmidi.config", DEFAULT_TIMIDITY_CONFIG);
+ char config_files[1000];
+ deadbeef->conf_get_str ("wildmidi.config", DEFAULT_TIMIDITY_CONFIG, config_files, sizeof (config_files));
char config[1024] = "";
const char *p = config_files;
while (p) {