diff options
author | Ilnur Khuziev <ilnur.khuziev@yandex.ru> | 2022-02-10 16:46:14 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:14 +0300 |
commit | 60040c91ffe701a84689b2c6310ff845e65cff42 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/folder/lstat_win.c | |
parent | 736dcd8ca259457a136f2f9f9168c44643914323 (diff) | |
download | ydb-60040c91ffe701a84689b2c6310ff845e65cff42.tar.gz |
Restoring authorship annotation for Ilnur Khuziev <ilnur.khuziev@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/folder/lstat_win.c')
-rw-r--r-- | util/folder/lstat_win.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/util/folder/lstat_win.c b/util/folder/lstat_win.c index 43951ecd32..cf94cec01a 100644 --- a/util/folder/lstat_win.c +++ b/util/folder/lstat_win.c @@ -5,22 +5,22 @@ #include "lstat_win.h" int lstat(const char* fileName, stat_struct* fileStat) { - int len = strlen(fileName); - int convRes = MultiByteToWideChar(CP_UTF8, 0, fileName, len, 0, 0); - if (convRes == 0) { - return -1; - } - WCHAR* buf = malloc(sizeof(WCHAR) * (convRes + 1)); - MultiByteToWideChar(CP_UTF8, 0, fileName, len, buf, convRes); - buf[convRes] = 0; - + int len = strlen(fileName); + int convRes = MultiByteToWideChar(CP_UTF8, 0, fileName, len, 0, 0); + if (convRes == 0) { + return -1; + } + WCHAR* buf = malloc(sizeof(WCHAR) * (convRes + 1)); + MultiByteToWideChar(CP_UTF8, 0, fileName, len, buf, convRes); + buf[convRes] = 0; + HANDLE findHandle; - WIN32_FIND_DATAW findBuf; + WIN32_FIND_DATAW findBuf; int result; - result = _wstat64(buf, fileStat); + result = _wstat64(buf, fileStat); if (result == 0) { SetLastError(0); - findHandle = FindFirstFileW(buf, &findBuf); + findHandle = FindFirstFileW(buf, &findBuf); if (findBuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && (findBuf.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || findBuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { @@ -28,7 +28,7 @@ int lstat(const char* fileName, stat_struct* fileStat) { } FindClose(findHandle); } - free(buf); + free(buf); return result; } |