From f1d2bf84089b1e5b5988a5e5d6d571a507a52337 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 6 Aug 2008 18:54:13 +0200 Subject: add i18n support --- src/daemon/daemon-conf.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/daemon/daemon-conf.c') diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 50b812dc..a6b27c55 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -198,7 +199,7 @@ static int parse_log_target(const char *filename, unsigned line, const char *lva pa_assert(data); if (pa_daemon_conf_set_log_target(c, rvalue) < 0) { - pa_log("[%s:%u] Invalid log target '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid log target '%s'."), filename, line, rvalue); return -1; } @@ -214,7 +215,7 @@ static int parse_log_level(const char *filename, unsigned line, const char *lval pa_assert(data); if (pa_daemon_conf_set_log_level(c, rvalue) < 0) { - pa_log("[%s:%u] Invalid log level '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid log level '%s'."), filename, line, rvalue); return -1; } @@ -230,7 +231,7 @@ static int parse_resample_method(const char *filename, unsigned line, const char pa_assert(data); if (pa_daemon_conf_set_resample_method(c, rvalue) < 0) { - pa_log("[%s:%u] Invalid resample method '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid resample method '%s'."), filename, line, rvalue); return -1; } @@ -253,14 +254,14 @@ static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, } else { int32_t k; if (pa_atoi(rvalue, &k) < 0) { - pa_log("[%s:%u] Invalid rlimit '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid rlimit '%s'."), filename, line, rvalue); return -1; } r->is_set = k >= 0; r->value = k >= 0 ? (rlim_t) k : 0; } #else - pa_log_warn("[%s:%u] rlimit not supported on this platform.", filename, line); + pa_log_warn(_("[%s:%u] rlimit not supported on this platform."), filename, line); #endif return 0; @@ -276,7 +277,7 @@ static int parse_sample_format(const char *filename, unsigned line, const char * pa_assert(data); if ((f = pa_parse_sample_format(rvalue)) < 0) { - pa_log("[%s:%u] Invalid sample format '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid sample format '%s'."), filename, line, rvalue); return -1; } @@ -294,7 +295,7 @@ static int parse_sample_rate(const char *filename, unsigned line, const char *lv pa_assert(data); if (pa_atoi(rvalue, &r) < 0 || r > (int32_t) PA_RATE_MAX || r <= 0) { - pa_log("[%s:%u] Invalid sample rate '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid sample rate '%s'."), filename, line, rvalue); return -1; } @@ -312,7 +313,7 @@ static int parse_sample_channels(const char *filename, unsigned line, const char pa_assert(data); if (pa_atoi(rvalue, &n) < 0 || n > (int32_t) PA_CHANNELS_MAX || n <= 0) { - pa_log("[%s:%u] Invalid sample channels '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid sample channels '%s'."), filename, line, rvalue); return -1; } @@ -330,7 +331,7 @@ static int parse_fragments(const char *filename, unsigned line, const char *lval pa_assert(data); if (pa_atoi(rvalue, &n) < 0 || n < 2) { - pa_log("[%s:%u] Invalid number of fragments '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid number of fragments '%s'."), filename, line, rvalue); return -1; } @@ -348,7 +349,7 @@ static int parse_fragment_size_msec(const char *filename, unsigned line, const c pa_assert(data); if (pa_atoi(rvalue, &n) < 0 || n < 1) { - pa_log("[%s:%u] Invalid fragment size '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid fragment size '%s'."), filename, line, rvalue); return -1; } @@ -366,7 +367,7 @@ static int parse_nice_level(const char *filename, unsigned line, const char *lva pa_assert(data); if (pa_atoi(rvalue, &level) < 0 || level < -20 || level > 19) { - pa_log("[%s:%u] Invalid nice level '%s'.", filename, line, rvalue); + pa_log(_("[%s:%u] Invalid nice level '%s'."), filename, line, rvalue); return -1; } @@ -557,7 +558,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { pa_open_config_file(DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_FILE_USER, ENV_CONFIG_FILE, &c->config_file); if (!f && errno != ENOENT) { - pa_log_warn("Failed to open configuration file: %s", pa_cstrerror(errno)); + pa_log_warn(_("Failed to open configuration file: %s"), pa_cstrerror(errno)); goto finish; } @@ -631,7 +632,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { s = pa_strbuf_new(); if (c->config_file) - pa_strbuf_printf(s, "### Read from configuration file: %s ###\n", c->config_file); + pa_strbuf_printf(s, _("### Read from configuration file: %s ###\n"), c->config_file); pa_assert(c->log_level <= PA_LOG_LEVEL_MAX); -- cgit From 756fac8d0433d02819d3910238ebf1b7a33a3046 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 6 Aug 2008 19:39:12 +0200 Subject: add new switch --disallow-exit --- src/daemon/daemon-conf.c | 60 ++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'src/daemon/daemon-conf.c') diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index a6b27c55..05c86c87 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -63,6 +63,7 @@ static const pa_daemon_conf default_conf = { .realtime_scheduling = FALSE, .realtime_priority = 5, /* Half of JACK's default rtprio */ .disallow_module_loading = FALSE, + .disallow_exit = FALSE, .exit_idle_time = 20, .module_idle_time = 20, .scache_idle_time = 20, @@ -403,6 +404,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { { "high-priority", pa_config_parse_bool, NULL }, { "realtime-scheduling", pa_config_parse_bool, NULL }, { "disallow-module-loading", pa_config_parse_bool, NULL }, + { "disallow-exit", pa_config_parse_bool, NULL }, { "use-pid-file", pa_config_parse_bool, NULL }, { "system-instance", pa_config_parse_bool, NULL }, { "no-cpu-limit", pa_config_parse_bool, NULL }, @@ -466,17 +468,17 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { table[2].data = &c->high_priority; table[3].data = &c->realtime_scheduling; table[4].data = &c->disallow_module_loading; - table[5].data = &c->use_pid_file; - table[6].data = &c->system_instance; - table[7].data = &c->no_cpu_limit; - table[8].data = &c->disable_shm; - table[9].data = &c->exit_idle_time; - table[10].data = &c->module_idle_time; - table[11].data = &c->scache_idle_time; - table[12].data = c; - table[13].data = &c->dl_search_path; - table[14].data = &c->default_script_file; - table[15].data = c; + table[5].data = &c->disallow_exit; + table[6].data = &c->use_pid_file; + table[7].data = &c->system_instance; + table[8].data = &c->no_cpu_limit; + table[9].data = &c->disable_shm; + table[10].data = &c->exit_idle_time; + table[11].data = &c->module_idle_time; + table[12].data = &c->scache_idle_time; + table[13].data = c; + table[14].data = &c->dl_search_path; + table[15].data = &c->default_script_file; table[16].data = c; table[17].data = c; table[18].data = c; @@ -486,67 +488,68 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { table[22].data = c; table[23].data = c; table[24].data = c; - table[25].data = &c->disable_remixing; - table[26].data = &c->load_default_script_file; + table[25].data = c; + table[26].data = &c->disable_remixing; + table[27].data = &c->load_default_script_file; #ifdef HAVE_SYS_RESOURCE_H - table[27].data = &c->rlimit_fsize; - table[28].data = &c->rlimit_data; - table[29].data = &c->rlimit_stack; - table[30].data = &c->rlimit_as; - table[31].data = &c->rlimit_core; - table[32].data = &c->rlimit_nofile; - table[33].data = &c->rlimit_as; + table[28].data = &c->rlimit_fsize; + table[29].data = &c->rlimit_data; + table[30].data = &c->rlimit_stack; + table[31].data = &c->rlimit_as; + table[32].data = &c->rlimit_core; + table[33].data = &c->rlimit_nofile; + table[34].data = &c->rlimit_as; #ifdef RLIMIT_NPROC - table[34].data = &c->rlimit_nproc; + table[35].data = &c->rlimit_nproc; #endif #ifdef RLIMIT_MEMLOCK #ifndef RLIMIT_NPROC #error "Houston, we have a numbering problem!" #endif - table[35].data = &c->rlimit_memlock; + table[36].data = &c->rlimit_memlock; #endif #ifdef RLIMIT_LOCKS #ifndef RLIMIT_MEMLOCK #error "Houston, we have a numbering problem!" #endif - table[36].data = &c->rlimit_locks; + table[37].data = &c->rlimit_locks; #endif #ifdef RLIMIT_SIGPENDING #ifndef RLIMIT_LOCKS #error "Houston, we have a numbering problem!" #endif - table[37].data = &c->rlimit_sigpending; + table[38].data = &c->rlimit_sigpending; #endif #ifdef RLIMIT_MSGQUEUE #ifndef RLIMIT_SIGPENDING #error "Houston, we have a numbering problem!" #endif - table[38].data = &c->rlimit_msgqueue; + table[39].data = &c->rlimit_msgqueue; #endif #ifdef RLIMIT_NICE #ifndef RLIMIT_MSGQUEUE #error "Houston, we have a numbering problem!" #endif - table[39].data = &c->rlimit_nice; + table[40].data = &c->rlimit_nice; #endif #ifdef RLIMIT_RTPRIO #ifndef RLIMIT_NICE #error "Houston, we have a numbering problem!" #endif - table[40].data = &c->rlimit_rtprio; + table[41].data = &c->rlimit_rtprio; #endif #ifdef RLIMIT_RTTIME #ifndef RLIMIT_RTTIME #error "Houston, we have a numbering problem!" #endif - table[41].data = &c->rlimit_rttime; + table[42].data = &c->rlimit_rttime; #endif #endif @@ -643,6 +646,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { pa_strbuf_printf(s, "realtime-scheduling = %s\n", pa_yes_no(c->realtime_scheduling)); pa_strbuf_printf(s, "realtime-priority = %i\n", c->realtime_priority); pa_strbuf_printf(s, "disallow-module-loading = %s\n", pa_yes_no(c->disallow_module_loading)); + pa_strbuf_printf(s, "disallow-exit = %s\n", pa_yes_no(c->disallow_exit)); pa_strbuf_printf(s, "use-pid-file = %s\n", pa_yes_no(c->use_pid_file)); pa_strbuf_printf(s, "system-instance = %s\n", pa_yes_no(c->system_instance)); pa_strbuf_printf(s, "no-cpu-limit = %s\n", pa_yes_no(c->no_cpu_limit)); -- cgit From 432b4e5f7d9ea722d13bbe4c117a4f9b78091e4f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 9 Aug 2008 16:20:29 +0200 Subject: don't use PA_GCC_UNUSED anymore --- src/daemon/daemon-conf.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/daemon/daemon-conf.c') diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 05c86c87..4f7470ba 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -191,7 +191,7 @@ int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string) { return 0; } -static int parse_log_target(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_log_target(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; pa_assert(filename); @@ -207,7 +207,7 @@ static int parse_log_target(const char *filename, unsigned line, const char *lva return 0; } -static int parse_log_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_log_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; pa_assert(filename); @@ -223,7 +223,7 @@ static int parse_log_level(const char *filename, unsigned line, const char *lval return 0; } -static int parse_resample_method(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_resample_method(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; pa_assert(filename); @@ -239,7 +239,7 @@ static int parse_resample_method(const char *filename, unsigned line, const char return 0; } -static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { #ifdef HAVE_SYS_RESOURCE_H struct pa_rlimit *r = data; @@ -268,7 +268,7 @@ static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, return 0; } -static int parse_sample_format(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_sample_format(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; pa_sample_format_t f; @@ -286,7 +286,7 @@ static int parse_sample_format(const char *filename, unsigned line, const char * return 0; } -static int parse_sample_rate(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_sample_rate(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t r; @@ -304,7 +304,7 @@ static int parse_sample_rate(const char *filename, unsigned line, const char *lv return 0; } -static int parse_sample_channels(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_sample_channels(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t n; @@ -322,7 +322,7 @@ static int parse_sample_channels(const char *filename, unsigned line, const char return 0; } -static int parse_fragments(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_fragments(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t n; @@ -340,7 +340,7 @@ static int parse_fragments(const char *filename, unsigned line, const char *lval return 0; } -static int parse_fragment_size_msec(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_fragment_size_msec(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t n; @@ -358,7 +358,7 @@ static int parse_fragment_size_msec(const char *filename, unsigned line, const c return 0; } -static int parse_nice_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_nice_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t level; @@ -376,7 +376,7 @@ static int parse_nice_level(const char *filename, unsigned line, const char *lva return 0; } -static int parse_rtprio(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_rtprio(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t rtprio; -- cgit From b7026bf248948a6a30386ddbcc137f48f369a51e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 19 Aug 2008 22:39:54 +0200 Subject: add a few more gcc warning flags and fix quite a few problems found by doing so --- src/daemon/daemon-conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/daemon/daemon-conf.c') diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 4f7470ba..40e0a170 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -288,14 +288,14 @@ static int parse_sample_format(const char *filename, unsigned line, const char * static int parse_sample_rate(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; - int32_t r; + uint32_t r; pa_assert(filename); pa_assert(lvalue); pa_assert(rvalue); pa_assert(data); - if (pa_atoi(rvalue, &r) < 0 || r > (int32_t) PA_RATE_MAX || r <= 0) { + if (pa_atou(rvalue, &r) < 0 || r > (uint32_t) PA_RATE_MAX || r <= 0) { pa_log(_("[%s:%u] Invalid sample rate '%s'."), filename, line, rvalue); return -1; } -- cgit