diff options
author | Chris Robinson <[email protected]> | 2018-10-30 09:31:52 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-10-30 09:31:52 -0700 |
commit | e2a1dd4503be8cd1280be8d34826c4858c4d6ed2 (patch) | |
tree | 19b1aa99abc2b41ed23cfd642cf3b916eaf2dcb2 /router/router.cpp | |
parent | ce212c911c8634fb9ccd9944b00dcd6c2b28d516 (diff) |
Use std::wstring in place of some fixed WCHAR arrays
Diffstat (limited to 'router/router.cpp')
-rw-r--r-- | router/router.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/router/router.cpp b/router/router.cpp index 4d0cf5a5..38d00e27 100644 --- a/router/router.cpp +++ b/router/router.cpp @@ -93,7 +93,7 @@ static void AddModule(HMODULE module, const WCHAR *name) FreeLibrary(module); return; } - if(wcscmp(drv.Name, name) == 0) + if(drv.Name == name) { TRACE("Skipping similarly-named module %ls\n", name); FreeLibrary(module); @@ -212,7 +212,7 @@ static void AddModule(HMODULE module, const WCHAR *name) if(!err) { ALCint alc_ver[2] = { 0, 0 }; - wcsncpy(newdrv.Name, name, 32); + newdrv.Name = name; newdrv.Module = module; newdrv.alcGetIntegerv(nullptr, ALC_MAJOR_VERSION, 1, &alc_ver[0]); newdrv.alcGetIntegerv(nullptr, ALC_MINOR_VERSION, 1, &alc_ver[1]); @@ -250,27 +250,26 @@ static void AddModule(HMODULE module, const WCHAR *name) static void SearchDrivers(WCHAR *path) { - WCHAR srchPath[MAX_PATH+1] = L""; WIN32_FIND_DATAW fdata; - HANDLE srchHdl; TRACE("Searching for drivers in %ls...\n", path); - wcsncpy(srchPath, path, MAX_PATH); - wcsncat(srchPath, L"\\*oal.dll", MAX_PATH - lstrlenW(srchPath)); - srchHdl = FindFirstFileW(srchPath, &fdata); + std::wstring srchPath = path; + srchPath += L"\\*oal.dll"; + + HANDLE srchHdl = FindFirstFileW(srchPath.c_str(), &fdata); if(srchHdl != INVALID_HANDLE_VALUE) { do { HMODULE mod; - wcsncpy(srchPath, path, MAX_PATH); - wcsncat(srchPath, L"\\", MAX_PATH - lstrlenW(srchPath)); - wcsncat(srchPath, fdata.cFileName, MAX_PATH - lstrlenW(srchPath)); - TRACE("Found %ls\n", srchPath); + srchPath = path; + srchPath += L"\\"; + srchPath += fdata.cFileName; + TRACE("Found %ls\n", srchPath.c_str()); - mod = LoadLibraryW(srchPath); + mod = LoadLibraryW(srchPath.c_str()); if(!mod) - WARN("Could not load %ls\n", srchPath); + WARN("Could not load %ls\n", srchPath.c_str()); else AddModule(mod, fdata.cFileName); } while(FindNextFileW(srchHdl, &fdata)); |