From b427ddce887617f17aefdbe1f22ca1e00d013c3d Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Sun, 21 Feb 2021 20:48:21 +0100 Subject: Codechange: Switch to explicit wide strings --- src/music/dmusic.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/music/dmusic.cpp') diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index c35765337..b0e34070c 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -81,7 +81,7 @@ struct DLSFile { std::vector waves; /** Try loading a DLS file into memory. */ - bool LoadFile(const TCHAR *file); + bool LoadFile(const wchar_t *file); private: /** Load an articulation structure from a DLS file. */ @@ -428,11 +428,11 @@ bool DLSFile::ReadDLSWaveList(FILE *f, DWORD list_length) return true; } -bool DLSFile::LoadFile(const TCHAR *file) +bool DLSFile::LoadFile(const wchar_t *file) { DEBUG(driver, 2, "DMusic: Try to load DLS file %s", FS2OTTD(file)); - FILE *f = _tfopen(file, _T("rb")); + FILE *f = _wfopen(file, L"rb"); if (f == nullptr) return false; FileCloser f_scope(f); @@ -861,11 +861,11 @@ static const char *LoadDefaultDLSFile(const char *user_dls) if (user_dls == nullptr) { /* Try loading the default GM DLS file stored in the registry. */ HKEY hkDM; - if (SUCCEEDED(RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\DirectMusic"), 0, KEY_READ, &hkDM))) { - TCHAR dls_path[MAX_PATH]; + if (SUCCEEDED(RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\DirectMusic", 0, KEY_READ, &hkDM))) { + wchar_t dls_path[MAX_PATH]; DWORD buf_size = sizeof(dls_path); // Buffer size as to be given in bytes! - if (SUCCEEDED(RegQueryValueEx(hkDM, _T("GMFilePath"), nullptr, nullptr, (LPBYTE)dls_path, &buf_size))) { - TCHAR expand_path[MAX_PATH * 2]; + if (SUCCEEDED(RegQueryValueEx(hkDM, L"GMFilePath", nullptr, nullptr, (LPBYTE)dls_path, &buf_size))) { + wchar_t expand_path[MAX_PATH * 2]; ExpandEnvironmentStrings(dls_path, expand_path, lengthof(expand_path)); if (!dls_file.LoadFile(expand_path)) DEBUG(driver, 1, "Failed to load default GM DLS file from registry"); } @@ -874,8 +874,8 @@ static const char *LoadDefaultDLSFile(const char *user_dls) /* If we couldn't load the file from the registry, try again at the default install path of the GM DLS file. */ if (dls_file.instruments.size() == 0) { - static const TCHAR *DLS_GM_FILE = _T("%windir%\\System32\\drivers\\gm.dls"); - TCHAR path[MAX_PATH]; + static const wchar_t *DLS_GM_FILE = L"%windir%\\System32\\drivers\\gm.dls"; + wchar_t path[MAX_PATH]; ExpandEnvironmentStrings(DLS_GM_FILE, path, lengthof(path)); if (!dls_file.LoadFile(path)) return "Can't load GM DLS collection"; -- cgit v1.2.3-54-g00ecf