aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-15 22:52:04 +0200
committerMax Kellermann <max@duempel.org>2013-10-15 22:52:04 +0200
commit1cde86823d35606d5340adf940c6126b358b81fd (patch)
treef9029bd0e5b095e29cd7c2802a2cde14dd5765d5 /src/output
parentdbd88e6aeff46f43504ea64aed49127ff5848b9f (diff)
downloadmpd-1cde86823d35606d5340adf940c6126b358b81fd.tar.gz
mpd-1cde86823d35606d5340adf940c6126b358b81fd.tar.xz
mpd-1cde86823d35606d5340adf940c6126b358b81fd.zip
output/pipe: use std::string
Diffstat (limited to 'src/output')
-rw-r--r--src/output/PipeOutputPlugin.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/output/PipeOutputPlugin.cxx b/src/output/PipeOutputPlugin.cxx
index 2b830ef29..34d615284 100644
--- a/src/output/PipeOutputPlugin.cxx
+++ b/src/output/PipeOutputPlugin.cxx
@@ -24,15 +24,14 @@
#include "util/Error.hxx"
#include "util/Domain.hxx"
-#include <glib.h>
+#include <string>
#include <stdio.h>
-#include <errno.h>
struct PipeOutput {
struct audio_output base;
- char *cmd;
+ std::string cmd;
FILE *fh;
bool Initialize(const config_param &param, Error &error) {
@@ -52,8 +51,8 @@ static constexpr Domain pipe_output_domain("pipe_output");
inline bool
PipeOutput::Configure(const config_param &param, Error &error)
{
- cmd = param.DupBlockString("command");
- if (cmd == nullptr) {
+ cmd = param.GetBlockValue("command", "");
+ if (cmd.empty()) {
error.Set(config_domain,
"No \"command\" parameter specified");
return false;
@@ -86,7 +85,6 @@ pipe_output_finish(struct audio_output *ao)
{
PipeOutput *pd = (PipeOutput *)ao;
- g_free(pd->cmd);
pd->Deinitialize();
delete pd;
}
@@ -98,10 +96,10 @@ pipe_output_open(struct audio_output *ao,
{
PipeOutput *pd = (PipeOutput *)ao;
- pd->fh = popen(pd->cmd, "w");
+ pd->fh = popen(pd->cmd.c_str(), "w");
if (pd->fh == nullptr) {
error.FormatErrno("Error opening pipe \"%s\"",
- pd->cmd);
+ pd->cmd.c_str());
return false;
}