From: Lennart Poettering Date: Fri, 3 Oct 2008 13:16:26 +0000 (+0200) Subject: if a volume or channel map is invalid show so when printing it X-Git-Tag: submit/2.0-panda/20130828.192557~2624 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8a50105fe0568598ef5bc0f5360d60536a8bf5cd;p=profile%2Fivi%2Fpulseaudio-panda.git if a volume or channel map is invalid show so when printing it --- diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c index 3730875..db6577e 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 93da246..39891d2 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 6907dc8..60a86be 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++) {