diff options
| author | Christopher Sundeby <Christopher.sundeby@ist.com> | 2026-11-23 19:56:33 +0100 |
|---|---|---|
| committer | Christopher Sundeby <Christopher.sundeby@ist.com> | 2026-11-24 20:08:27 +0100 |
| commit | bbdb7543b7a0e0448cb9fced5699ccbded3c2378 (patch) | |
| tree | 9893db59cb8b01c78cf41e36478b082a12a582c8 /runtime/test/file_system_test.cpp | |
| parent | 6293c1c4f88c7ea2088ec595fea51362f1759996 (diff) | |
file_system_test: build without the C4456 shadow warning
The reserved-folder probe (RT-294) declared `const HANDLE h` inside a loop
that already sits in the scope of the outer `HANDLE h`, which MSVC reports
at /W4 as C4456. Name the inner handle `refused`; the checks are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/file_system_test.cpp')
| -rw-r--r-- | runtime/test/file_system_test.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/test/file_system_test.cpp b/runtime/test/file_system_test.cpp index 299ceda3b..060b9dac7 100644 --- a/runtime/test/file_system_test.cpp +++ b/runtime/test/file_system_test.cpp | |||
| @@ -1288,10 +1288,10 @@ void run_checks(const std::filesystem::path& root) { | |||
| 1288 | L"GAME:\\.gta6rt-deleted\\data\\gone.txt", L"GAME:\\.gta6rt-copy\\x.bin", | 1288 | L"GAME:\\.gta6rt-deleted\\data\\gone.txt", L"GAME:\\.gta6rt-copy\\x.bin", |
| 1289 | L"GAME:\\.gta6rt-temp"}) { | 1289 | L"GAME:\\.gta6rt-temp"}) { |
| 1290 | SetLastError(0); | 1290 | SetLastError(0); |
| 1291 | const HANDLE h = create_w(reserved, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); | 1291 | const HANDLE refused = create_w(reserved, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); |
| 1292 | check(h == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_NAME, | 1292 | check(refused == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_NAME, |
| 1293 | "an explicit GAME: path into a reserved overlay folder is refused (CreateFileW)"); | 1293 | "an explicit GAME: path into a reserved overlay folder is refused (CreateFileW)"); |
| 1294 | if (h != INVALID_HANDLE_VALUE) ::CloseHandle(h); | 1294 | if (refused != INVALID_HANDLE_VALUE) ::CloseHandle(refused); |
| 1295 | SetLastError(0); | 1295 | SetLastError(0); |
| 1296 | check(attributes_w(reserved) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_INVALID_NAME, | 1296 | check(attributes_w(reserved) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_INVALID_NAME, |
| 1297 | "and has no attributes (GetFileAttributesW)"); | 1297 | "and has no attributes (GetFileAttributesW)"); |