From 328e7f8d57690b51c03ca1f5da5ea5bf01eabd62 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Tue, 10 Jun 2014 17:34:15 -0400 Subject: [PATCH] fix compile error when no audio support --- src/settings.c | 31 ++++++++++++++++++++++++------- src/settings.h | 13 ++++++++++--- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/settings.c b/src/settings.c index add9e47..2eb860d 100644 --- a/src/settings.c +++ b/src/settings.c @@ -25,7 +25,11 @@ #include "toxic_windows.h" #include "configdir.h" -#include "audio_call.h" + +#ifdef _SUPPORT_AUDIO + #include "audio_call.h" +#endif + #include "settings.h" #include "line_info.h" @@ -33,11 +37,14 @@ static void uset_autolog(struct user_settings *s, const char *val); static void uset_time(struct user_settings *s, const char *val); static void uset_alerts(struct user_settings *s, const char *val); static void uset_colours(struct user_settings *s, const char *val); -static void uset_ain_dev(struct user_settings *s, const char *val); -static void uset_aout_dev(struct user_settings *s, const char *val); static void uset_hst_size(struct user_settings *s, const char *val); static void uset_dwnld_path(struct user_settings *s, const char *val); +#ifdef _SUPPORT_AUDIO +static void uset_ain_dev(struct user_settings *s, const char *val); +static void uset_aout_dev(struct user_settings *s, const char *val); +#endif + struct { const char *key; void (*func)(struct user_settings *s, const char *val); @@ -46,10 +53,13 @@ struct { { "time", uset_time }, { "disable_alerts", uset_alerts }, { "colour_theme", uset_colours }, - { "audio_in_dev", uset_ain_dev }, - { "audio_out_dev", uset_aout_dev }, { "history_size", uset_hst_size }, { "download_path", uset_dwnld_path }, + +#ifdef _SUPPORT_AUDIO + { "audio_in_dev", uset_ain_dev }, + { "audio_out_dev", uset_aout_dev }, +#endif }; static void uset_autolog(struct user_settings *s, const char *val) @@ -84,6 +94,8 @@ static void uset_colours(struct user_settings *s, const char *val) s->colour_theme = n == NATIVE_COLS ? NATIVE_COLS : DFLT_COLS; } +#ifdef _SUPPORT_AUDIO + static void uset_ain_dev(struct user_settings *s, const char *val) { int n = atoi(val); @@ -104,6 +116,8 @@ static void uset_aout_dev(struct user_settings *s, const char *val) s->audio_out_dev = (long int) n; } +#endif /* _SUPPORT_AUDIO */ + static void uset_hst_size(struct user_settings *s, const char *val) { int n = atoi(val); @@ -142,10 +156,13 @@ static void set_default_settings(struct user_settings *s) uset_time(s, "24"); uset_alerts(s, "0"); uset_colours(s, "0"); - uset_ain_dev(s, "0"); - uset_aout_dev(s, "0"); uset_hst_size(s, "700"); uset_dwnld_path(s, NULL); + +#ifdef _SUPPORT_AUDIO + uset_ain_dev(s, "0"); + uset_aout_dev(s, "0"); +#endif } int settings_load(struct user_settings *s, char *path) diff --git a/src/settings.h b/src/settings.h index 83f05b3..ef9e709 100644 --- a/src/settings.h +++ b/src/settings.h @@ -20,7 +20,11 @@ * */ -#define NUM_SETTINGS 8 +#ifdef _SUPPORT_AUDIO + #define NUM_SETTINGS 8 +#else + #define NUM_SETTINGS 6 +#endif /* holds user setting values */ struct user_settings { @@ -28,10 +32,13 @@ struct user_settings { int alerts; /* boolean */ int time; /* 12 or 24 */ int colour_theme; /* boolean (0 for default toxic colours) */ - long int audio_in_dev; - long int audio_out_dev; int history_size; /* int between MIN_HISTORY and MAX_HISTORY */ char download_path[MAX_STR_SIZE]; + +#ifdef _SUPPORT_AUDIO + long int audio_in_dev; + long int audio_out_dev; +#endif }; enum {