util/StringFormat: new utility library
This commit is contained in:
+2
-6
@@ -39,6 +39,7 @@
|
||||
#include "config/ConfigGlobal.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <stdexcept>
|
||||
@@ -165,12 +166,7 @@ FilteredAudioOutput::Configure(const ConfigBlock &block)
|
||||
config_audio_format.Clear();
|
||||
}
|
||||
|
||||
{
|
||||
char buffer[64];
|
||||
snprintf(buffer, sizeof(buffer), "\"%s\" (%s)",
|
||||
name, plugin_name);
|
||||
log_name = buffer;
|
||||
}
|
||||
log_name = StringFormat<256>("\"%s\" (%s)", name, plugin_name);
|
||||
|
||||
/* set up the filter chain */
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
#include "util/StringAPI.hxx"
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <shout/shout.h>
|
||||
@@ -87,13 +88,11 @@ require_block_string(const ConfigBlock &block, const char *name)
|
||||
static void
|
||||
ShoutSetAudioInfo(shout_t *shout_conn, const AudioFormat &audio_format)
|
||||
{
|
||||
char temp[11];
|
||||
shout_set_audio_info(shout_conn, SHOUT_AI_CHANNELS,
|
||||
StringFormat<11>("%u", audio_format.channels));
|
||||
|
||||
snprintf(temp, sizeof(temp), "%u", audio_format.channels);
|
||||
shout_set_audio_info(shout_conn, SHOUT_AI_CHANNELS, temp);
|
||||
|
||||
snprintf(temp, sizeof(temp), "%u", audio_format.sample_rate);
|
||||
shout_set_audio_info(shout_conn, SHOUT_AI_SAMPLERATE, temp);
|
||||
shout_set_audio_info(shout_conn, SHOUT_AI_SAMPLERATE,
|
||||
StringFormat<11>("%u", audio_format.sample_rate));
|
||||
}
|
||||
|
||||
ShoutOutput::ShoutOutput(const ConfigBlock &block)
|
||||
|
||||
Reference in New Issue
Block a user