]> granicus.if.org Git - transmission/commitdiff
Use explicit boolean conversions (follow-up)
authorMike Gelfand <mikedld@mikedld.com>
Sun, 14 Jul 2019 19:57:40 +0000 (22:57 +0300)
committerMike Gelfand <mikedld@mikedld.com>
Sun, 14 Jul 2019 19:57:40 +0000 (22:57 +0300)
libtransmission/file-win32.c

index 998898259a0268a10743bad4fb1322c15662a334..22aa8f6e385556577815e0ba17890f296b85b722 100644 (file)
@@ -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;