From 35ed02a1fd510a95c46e223f7a11ab7cbca3cd03 Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Sun, 14 Jul 2019 22:57:40 +0300 Subject: [PATCH] Use explicit boolean conversions (follow-up) --- libtransmission/file-win32.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libtransmission/file-win32.c b/libtransmission/file-win32.c index 998898259..22aa8f6e3 100644 --- a/libtransmission/file-win32.c +++ b/libtransmission/file-win32.c @@ -87,11 +87,11 @@ static void stat_to_sys_path_info(DWORD attributes, DWORD size_low, DWORD size_h TR_ASSERT(mtime != NULL); TR_ASSERT(info != NULL); - if (attributes & FILE_ATTRIBUTE_DIRECTORY) + if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { info->type = TR_SYS_PATH_IS_DIRECTORY; } - else if (!(attributes & (FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_VIRTUAL))) + else if ((attributes & (FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_VIRTUAL)) == 0) { info->type = TR_SYS_PATH_IS_FILE; } @@ -278,8 +278,7 @@ static bool create_dir(char const* path, int flags, int permissions, bool okay_i { DWORD const attributes = GetFileAttributesW(wide_path); - if (attributes != INVALID_FILE_ATTRIBUTES && - (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) + if (attributes != INVALID_FILE_ATTRIBUTES && (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { ret = true; } @@ -357,7 +356,7 @@ bool tr_sys_path_exists(char const* path, tr_error** error) if (attributes != INVALID_FILE_ATTRIBUTES) { - if (attributes & FILE_ATTRIBUTE_REPARSE_POINT) + if ((attributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { handle = CreateFileW(wide_path, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); ret = handle != INVALID_HANDLE_VALUE; -- 2.40.0