summaryrefslogtreecommitdiff
path: root/src/music
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2021-02-21 17:03:19 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2021-04-07 09:31:47 +0200
commite0561dbded57f195e7842cf69764e3ee2c3a71da (patch)
tree10ae740118601eb102fa73a753bdcdca03607552 /src/music
parent825867f2c50ce508fac442e6113da9cebbfccf75 (diff)
downloadopenttd-e0561dbded57f195e7842cf69764e3ee2c3a71da.tar.xz
Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers
Diffstat (limited to 'src/music')
-rw-r--r--src/music/cocoa_m.cpp4
-rw-r--r--src/music/dmusic.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/music/cocoa_m.cpp b/src/music/cocoa_m.cpp
index a989cfe76..279e0b38a 100644
--- a/src/music/cocoa_m.cpp
+++ b/src/music/cocoa_m.cpp
@@ -134,8 +134,8 @@ void MusicDriver_Cocoa::PlaySong(const MusicSongInfo &song)
return;
}
- const char *os_file = OTTD2FS(filename.c_str());
- CFAutoRelease<CFURLRef> url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8*)os_file, strlen(os_file), false));
+ std::string os_file = OTTD2FS(filename);
+ CFAutoRelease<CFURLRef> url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8*)os_file.c_str(), os_file.length(), false));
if (MusicSequenceFileLoad(_sequence, url.get(), kMusicSequenceFile_AnyType, 0) != noErr) {
DEBUG(driver, 0, "cocoa_m: Failed to load MIDI file");
diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp
index c9447206a..619a20d8b 100644
--- a/src/music/dmusic.cpp
+++ b/src/music/dmusic.cpp
@@ -430,7 +430,7 @@ bool DLSFile::ReadDLSWaveList(FILE *f, DWORD list_length)
bool DLSFile::LoadFile(const wchar_t *file)
{
- DEBUG(driver, 2, "DMusic: Try to load DLS file %s", FS2OTTD(file));
+ DEBUG(driver, 2, "DMusic: Try to load DLS file %s", FS2OTTD(file).c_str());
FILE *f = _wfopen(file, L"rb");
if (f == nullptr) return false;
@@ -881,7 +881,7 @@ static const char *LoadDefaultDLSFile(const char *user_dls)
if (!dls_file.LoadFile(path)) return "Can't load GM DLS collection";
}
} else {
- if (!dls_file.LoadFile(OTTD2FS(user_dls))) return "Can't load GM DLS collection";
+ if (!dls_file.LoadFile(OTTD2FS(user_dls).c_str())) return "Can't load GM DLS collection";
}
/* Get download port and allocate download IDs. */