summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-10-03 15:16:26 +0200
committerLennart Poettering <lennart@poettering.net>2008-10-03 15:16:26 +0200
commit8a50105fe0568598ef5bc0f5360d60536a8bf5cd (patch)
treec26c4a70fd57c38f7f6037c2aaa8965c3e4a2c9a /src
parent33b186e74dc2de6fa363d10d3450c354ec99f864 (diff)
downloadpulseaudio-8a50105fe0568598ef5bc0f5360d60536a8bf5cd.tar.gz
if a volume or channel map is invalid show so when printing it
Diffstat (limited to 'src')
-rw-r--r--src/pulse/channelmap.c7
-rw-r--r--src/pulse/sample.c2
-rw-r--r--src/pulse/volume.c8
3 files changed, 16 insertions, 1 deletions
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 373087515..db6577ed4 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 93da2465f..39891d255 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 6907dc83e..60a86bebc 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-util.h>
#include <pulsecore/macro.h>
@@ -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++) {