diff options
author | Max Kellermann <max@musicpd.org> | 2017-01-17 22:04:31 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-01-17 22:18:21 +0100 |
commit | 39114f91a7c39c3da9a097f0bc63c08b2b74bf0f (patch) | |
tree | 6b76798ead5ebec8dbec2574e3185640677f9a11 /src/AudioFormat.cxx | |
parent | 4f01387edfc522908758ca8f3ad0eb96cf841e02 (diff) |
AudioFormat: replace struct audio_format_string with class StringBuffer, return it
Diffstat (limited to 'src/AudioFormat.cxx')
-rw-r--r-- | src/AudioFormat.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/AudioFormat.cxx b/src/AudioFormat.cxx index a374bc02e..c3ebb2e6f 100644 --- a/src/AudioFormat.cxx +++ b/src/AudioFormat.cxx @@ -18,6 +18,7 @@ */ #include "AudioFormat.hxx" +#include "util/StringBuffer.hxx" #include <assert.h> #include <stdio.h> @@ -40,15 +41,13 @@ AudioFormat::ApplyMask(AudioFormat mask) assert(IsValid()); } -const char * -audio_format_to_string(const AudioFormat af, - struct audio_format_string *s) +StringBuffer<24> +ToString(const AudioFormat af) { - assert(s != nullptr); - - snprintf(s->buffer, sizeof(s->buffer), "%u:%s:%u", + StringBuffer<24> buffer; + snprintf(buffer.data(), buffer.capacity(), "%u:%s:%u", af.sample_rate, sample_format_to_string(af.format), af.channels); - return s->buffer; + return buffer; } |