aboutsummaryrefslogtreecommitdiff
path: root/c/ext.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-28 04:02:24 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-28 04:02:24 +0200
commite327e4469ac2847615f7c847facd5879b5c2e5bc (patch)
treeb7db3fb2383be3364ea2692769a8d02e708e3478 /c/ext.cpp
parenta8a73a21495bf54f720088cf789d8cf6cf682661 (diff)
downloadEpisodeBrowser-e327e4469ac2847615f7c847facd5879b5c2e5bc.tar.gz
Replace Managed with Unique.
Diffstat (limited to 'c/ext.cpp')
-rw-r--r--c/ext.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/c/ext.cpp b/c/ext.cpp
index 272f4a3..398804e 100644
--- a/c/ext.cpp
+++ b/c/ext.cpp
@@ -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();