Codechange: replace lengthof with std::size in Windows specific code

This commit is contained in:
rubidium42
2024-04-10 20:12:33 +02:00
committed by rubidium42
parent 6bc4a62c27
commit 442daf58da
6 changed files with 17 additions and 17 deletions

View File

@@ -870,7 +870,7 @@ static const char *LoadDefaultDLSFile(const char *user_dls)
DWORD buf_size = sizeof(dls_path); // Buffer size as to be given in bytes!
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));
ExpandEnvironmentStrings(dls_path, expand_path, static_cast<DWORD>(std::size(expand_path)));
if (!dls_file.LoadFile(expand_path)) Debug(driver, 1, "Failed to load default GM DLS file from registry");
}
RegCloseKey(hkDM);
@@ -880,7 +880,7 @@ static const char *LoadDefaultDLSFile(const char *user_dls)
if (dls_file.instruments.empty()) {
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));
ExpandEnvironmentStrings(DLS_GM_FILE, path, static_cast<DWORD>(std::size(path)));
if (!dls_file.LoadFile(path)) return "Can't load GM DLS collection";
}