diff options
author | nae202 <nae202@yandex-team.com> | 2024-11-20 12:52:01 +0300 |
---|---|---|
committer | nae202 <nae202@yandex-team.com> | 2024-11-20 13:14:09 +0300 |
commit | 0b9d91e900b52bccd6eabd033acbb57c4ee173fc (patch) | |
tree | 6839ed69fbda4d5214eb418acc4554924bc64160 /util/system/fs_win.cpp | |
parent | 878e26057d11cce46b7bc3a6c838209d4686e28b (diff) | |
download | ydb-0b9d91e900b52bccd6eabd033acbb57c4ee173fc.tar.gz |
Part of PR. Style
Часть большого ПР REVIEW:7264088
commit_hash:0f5b03fbbed0ac30f734943309e3ef5cd4d7a30e
Diffstat (limited to 'util/system/fs_win.cpp')
-rw-r--r-- | util/system/fs_win.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp index ff8a254782..65e695bee4 100644 --- a/util/system/fs_win.cpp +++ b/util/system/fs_win.cpp @@ -12,8 +12,9 @@ namespace NFsPrivate { static LPCWSTR UTF8ToWCHAR(const TStringBuf str, TUtf16String& wstr) { wstr.resize(str.size()); size_t written = 0; - if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written)) + if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written)) { return nullptr; + } wstr.erase(written); static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)"); return (const WCHAR*)wstr.data(); @@ -64,8 +65,9 @@ namespace NFsPrivate { fad.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; ::SetFileAttributesW(wname, fad.dwFileAttributes); } - if (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + if (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { return ::RemoveDirectoryW(wname) != 0; + } return ::DeleteFileW(wname) != 0; } @@ -76,8 +78,9 @@ namespace NFsPrivate { TString tName(targetName); { size_t pos; - while ((pos = tName.find('/')) != TString::npos) + while ((pos = tName.find('/')) != TString::npos) { tName.replace(pos, 1, LOCSLASH_S); + } } TUtf16String tstr; LPCWSTR wname = UTF8ToWCHAR(tName, tstr); @@ -127,8 +130,9 @@ namespace NFsPrivate { TTempBuf result; LPWSTR buf = reinterpret_cast<LPWSTR>(result.Data()); int r = GetCurrentDirectoryW(result.Size() / sizeof(WCHAR), buf); - if (r == 0) + if (r == 0) { throw TIoSystemError() << "failed to GetCurrentDirectory"; + } return WCHARToUTF8(buf, r); } |