diff options
author | Max Kellermann <max@duempel.org> | 2013-10-19 17:48:46 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-19 17:48:46 +0200 |
commit | 5a7c931293b55a27c3f79c6951707a8d6e2a5f6c (patch) | |
tree | b4e4d30a8de80b79f978d68ebba2dab5bf896a90 /src | |
parent | 1373d40fead4a465525c7a0b7a286d271e24d793 (diff) | |
download | mpd-5a7c931293b55a27c3f79c6951707a8d6e2a5f6c.tar.gz mpd-5a7c931293b55a27c3f79c6951707a8d6e2a5f6c.tar.xz mpd-5a7c931293b55a27c3f79c6951707a8d6e2a5f6c.zip |
input/cdio: use class AllocatedPath
Diffstat (limited to 'src')
-rw-r--r-- | src/input/CdioParanoiaInputPlugin.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/input/CdioParanoiaInputPlugin.cxx b/src/input/CdioParanoiaInputPlugin.cxx index 654a6dc4a..db0593cee 100644 --- a/src/input/CdioParanoiaInputPlugin.cxx +++ b/src/input/CdioParanoiaInputPlugin.cxx @@ -29,6 +29,7 @@ #include "util/Error.hxx" #include "util/Domain.hxx" #include "system/ByteOrder.hxx" +#include "fs/AllocatedPath.hxx" #include "Log.hxx" #include <stdio.h> @@ -136,18 +137,17 @@ parse_cdio_uri(struct cdio_uri *dest, const char *src, Error &error) return true; } -static char * +static AllocatedPath cdio_detect_device(void) { char **devices = cdio_get_devices_with_cap(nullptr, CDIO_FS_AUDIO, false); if (devices == nullptr) - return nullptr; + return AllocatedPath::Null(); - char *device = g_strdup(devices[0]); + AllocatedPath path = AllocatedPath::FromFS(devices[0]); cdio_free_device_list(devices); - - return device; + return path; } static struct input_stream * @@ -164,10 +164,10 @@ input_cdio_open(const char *uri, parsed_uri.track); /* get list of CD's supporting CD-DA */ - char *device = parsed_uri.device[0] != 0 - ? g_strdup(parsed_uri.device) + const AllocatedPath device = parsed_uri.device[0] != 0 + ? AllocatedPath::FromFS(parsed_uri.device) : cdio_detect_device(); - if (device == nullptr) { + if (device.IsNull()) { error.Set(cdio_domain, "Unable find or access a CD-ROM drive with an audio CD in it."); delete i; @@ -175,8 +175,7 @@ input_cdio_open(const char *uri, } /* Found such a CD-ROM with a CD-DA loaded. Use the first drive in the list. */ - i->cdio = cdio_open(device, DRIVER_UNKNOWN); - g_free(device); + i->cdio = cdio_open(device.c_str(), DRIVER_UNKNOWN); i->drv = cdio_cddap_identify_cdio(i->cdio, 1, nullptr); |