From 8a50105fe0568598ef5bc0f5360d60536a8bf5cd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 3 Oct 2008 15:16:26 +0200 Subject: if a volume or channel map is invalid show so when printing it --- src/pulse/channelmap.c | 7 +++++++ src/pulse/sample.c | 2 +- src/pulse/volume.c | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src/pulse') diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c index 37308751..db6577ed 100644 --- a/src/pulse/channelmap.c +++ b/src/pulse/channelmap.c @@ -466,6 +466,13 @@ char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map) { pa_assert(l > 0); pa_assert(map); + pa_init_i18n(); + + if (!pa_channel_map_valid(map)) { + pa_snprintf(s, l, _("(invalid)")); + return s; + } + *(e = s) = 0; for (channel = 0; channel < map->channels && l > 1; channel++) { diff --git a/src/pulse/sample.c b/src/pulse/sample.c index 93da2465..39891d25 100644 --- a/src/pulse/sample.c +++ b/src/pulse/sample.c @@ -131,7 +131,7 @@ char *pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec) { pa_init_i18n(); if (!pa_sample_spec_valid(spec)) - pa_snprintf(s, l, _("Invalid")); + pa_snprintf(s, l, _("(invalid)")); else pa_snprintf(s, l, "%s %uch %uHz", pa_sample_format_to_string(spec->format), spec->channels, spec->rate); diff --git a/src/pulse/volume.c b/src/pulse/volume.c index 6907dc83..60a86beb 100644 --- a/src/pulse/volume.c +++ b/src/pulse/volume.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -134,6 +135,13 @@ char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) { pa_assert(l > 0); pa_assert(c); + pa_init_i18n(); + + if (!pa_cvolume_valid(c)) { + pa_snprintf(s, l, _("(invalid)")); + return s; + } + *(e = s) = 0; for (channel = 0; channel < c->channels && l > 1; channel++) { -- cgit