From bcd55c0b7571fcf7119191e55ff840b656174c18 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Wed, 3 Jan 2024 14:03:44 -0800
Subject: [PATCH] sidplay: fix compilation under Windows

NarrowPath is needed.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 src/decoder/plugins/SidplayDecoderPlugin.cxx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx
index 6c671e490..6e21735b9 100644
--- a/src/decoder/plugins/SidplayDecoderPlugin.cxx
+++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx
@@ -7,6 +7,7 @@
 #include "tag/Handler.hxx"
 #include "tag/Builder.hxx"
 #include "song/DetachedSong.hxx"
+#include "fs/NarrowPath.hxx"
 #include "fs/Path.hxx"
 #include "fs/AllocatedPath.hxx"
 #include "lib/fmt/PathFormatter.hxx"
@@ -155,10 +156,9 @@ ParseSubtuneName(const char *base) noexcept
 static SidplayContainerPath
 ParseContainerPath(Path path_fs) noexcept
 {
-	const Path base = path_fs.GetBase();
+	const NarrowPath base = NarrowPath(path_fs.GetBase());
 	unsigned track;
-	if (base.IsNull() ||
-	    (track = ParseSubtuneName(base.c_str())) < 1)
+	if (!base || (track = ParseSubtuneName(base)) < 1)
 		return { AllocatedPath(path_fs), 1 };
 
 	return { path_fs.GetDirectoryName(), track };
@@ -205,7 +205,8 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
 	/* load the tune */
 
 	const auto container = ParseContainerPath(path_fs);
-	SidTune tune(container.path.c_str());
+	auto np = NarrowPath(container.path);
+	auto tune = SidTune(np);
 	if (!tune.getStatus()) {
 		const char *error = tune.statusString();
 		FmtWarning(sidplay_domain, "failed to load file: {}", error);
@@ -435,7 +436,8 @@ sidplay_scan_file(Path path_fs, TagHandler &handler) noexcept
 	const auto container = ParseContainerPath(path_fs);
 	const unsigned song_num = container.track;
 
-	SidTune tune(container.path.c_str());
+	auto np = NarrowPath(container.path);
+	auto tune = SidTune(np);
 	if (!tune.getStatus())
 		return false;
 
@@ -459,7 +461,7 @@ sidplay_container_scan(Path path_fs)
 {
 	std::forward_list<DetachedSong> list;
 
-	SidTune tune(path_fs.c_str());
+	auto tune = SidTune{NarrowPath(path_fs)};
 	if (!tune.getStatus())
 		return list;