diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-28 04:02:24 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-28 04:02:24 +0200 |
commit | e327e4469ac2847615f7c847facd5879b5c2e5bc (patch) | |
tree | b7db3fb2383be3364ea2692769a8d02e708e3478 /c/ext.cpp | |
parent | a8a73a21495bf54f720088cf789d8cf6cf682661 (diff) | |
download | EpisodeBrowser-e327e4469ac2847615f7c847facd5879b5c2e5bc.tar.gz |
Replace Managed with Unique.
Diffstat (limited to 'c/ext.cpp')
-rw-r--r-- | c/ext.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -78,8 +78,6 @@ static inline bool MatchFileName(wchar_t (&file)[MAX_PATH], const wchar_t* const static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const root, const wchar_t* const siEp, const int level = 0) { - using FindHandle = Managed<HANDLE, FindClose, Win32Error, -1>; - /* Don't recurse too much. */ if (level > 3) return false; @@ -88,7 +86,9 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo Swprintf(pat, L"%s\\*", root); WIN32_FIND_DATA fdata; - FindHandle h = FindFirstFileW(pat, &fdata); + Unique<HANDLE, FindClose> h = FindFirstFileW(pat, &fdata); + if (!h.Not(INVALID_HANDLE_VALUE)) + throw Win32Error(); do if (fdata.cFileName[0] == L'.') @@ -103,7 +103,7 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo Swprintf(file, L"%s\\%s", root, fdata.cFileName); return true; } - while (FindNextFileW(h, &fdata)); + while (FindNextFileW(h.v, &fdata)); if (GetLastError() != ERROR_NO_MORE_FILES) throw Win32Error(); |