From ebcb5e9368a3002df53a797da8c6fb74dd1fae77 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 27 May 2020 14:06:22 +0200 Subject: [PATCH] decoder/wildmidi: use NarrowPath, fixing the Windows build --- NEWS | 1 + src/decoder/plugins/WildmidiDecoderPlugin.cxx | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 64df932ec..276c07b9d 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ ver 0.21.24 (not yet released) - simple: fix crash when mounting twice * decoder - wildmidi: attempt to detect WildMidi using pkg-config + - wildmidi: fix Windows build failure * Android - fix build failure with Android NDK r21 * Windows diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx index bafccdf13..a5d8aa5c6 100644 --- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx +++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx @@ -25,6 +25,7 @@ #include "fs/AllocatedPath.hxx" #include "fs/FileSystem.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "Log.hxx" #include "PluginUnavailable.hxx" @@ -53,7 +54,8 @@ wildmidi_init(const ConfigBlock &block) AtScopeExit() { WildMidi_ClearError(); }; #endif - if (WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate, + if (WildMidi_Init(NarrowPath(path), + wildmidi_audio_format.sample_rate, 0) != 0) { #ifdef LIBWILDMIDI_VERSION /* WildMidi_GetError() requires libwildmidi 0.4 */ @@ -96,7 +98,7 @@ wildmidi_file_decode(DecoderClient &client, Path path_fs) midi *wm; const struct _WM_Info *info; - wm = WildMidi_Open(path_fs.c_str()); + wm = WildMidi_Open(NarrowPath(path_fs)); if (wm == nullptr) return; @@ -136,7 +138,7 @@ wildmidi_file_decode(DecoderClient &client, Path path_fs) static bool wildmidi_scan_file(Path path_fs, TagHandler &handler) noexcept { - midi *wm = WildMidi_Open(path_fs.c_str()); + midi *wm = WildMidi_Open(NarrowPath(path_fs)); if (wm == nullptr) return false;