Index: runtime/bin/file_system_watcher_win.cc |
diff --git a/runtime/bin/file_system_watcher_win.cc b/runtime/bin/file_system_watcher_win.cc |
index a772c6ddb7618f164145301c3535215781d4efcc..e6b091a4364eb3c9a8b41c15953715a3a4e65892 100644 |
--- a/runtime/bin/file_system_watcher_win.cc |
+++ b/runtime/bin/file_system_watcher_win.cc |
@@ -6,16 +6,15 @@ |
#if defined(TARGET_OS_WINDOWS) |
#include "bin/file_system_watcher.h" |
-#include "bin/eventhandler.h" |
#include <WinIoCtl.h> // NOLINT |
#include "bin/builtin.h" |
+#include "bin/eventhandler.h" |
#include "bin/log.h" |
#include "bin/utils.h" |
#include "bin/utils_win.h" |
- |
namespace dart { |
namespace bin { |
@@ -55,11 +54,13 @@ intptr_t FileSystemWatcher::WatchPath(intptr_t id, |
} |
int list_events = 0; |
- if (events & (kCreate | kMove | kDelete)) { |
+ if ((events & (kCreate | kMove | kDelete)) != 0) { |
list_events |= FILE_NOTIFY_CHANGE_FILE_NAME | |
FILE_NOTIFY_CHANGE_DIR_NAME; |
} |
- if (events & kModifyContent) list_events |= FILE_NOTIFY_CHANGE_LAST_WRITE; |
+ if ((events & kModifyContent) != 0) { |
+ list_events |= FILE_NOTIFY_CHANGE_LAST_WRITE; |
+ } |
DirectoryWatchHandle* handle = |
new DirectoryWatchHandle(dir, list_events, recursive); |
@@ -102,11 +103,21 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { |
Dart_Handle event = Dart_NewList(5); |
int mask = 0; |
- if (e->Action == FILE_ACTION_ADDED) mask |= kCreate; |
- if (e->Action == FILE_ACTION_REMOVED) mask |= kDelete; |
- if (e->Action == FILE_ACTION_MODIFIED) mask |= kModifyContent; |
- if (e->Action == FILE_ACTION_RENAMED_OLD_NAME) mask |= kMove; |
- if (e->Action == FILE_ACTION_RENAMED_NEW_NAME) mask |= kMove; |
+ if (e->Action == FILE_ACTION_ADDED) { |
+ mask |= kCreate; |
+ } |
+ if (e->Action == FILE_ACTION_REMOVED) { |
+ mask |= kDelete; |
+ } |
+ if (e->Action == FILE_ACTION_MODIFIED) { |
+ mask |= kModifyContent; |
+ } |
+ if (e->Action == FILE_ACTION_RENAMED_OLD_NAME) { |
+ mask |= kMove; |
+ } |
+ if (e->Action == FILE_ACTION_RENAMED_NEW_NAME) { |
+ mask |= kMove; |
+ } |
Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); |
// Move events come in pairs. Just 'enable' by default. |
Dart_ListSetAt(event, 1, Dart_NewInteger(1)); |
@@ -116,7 +127,9 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) { |
Dart_ListSetAt(event, 4, Dart_NewInteger(path_id)); |
Dart_ListSetAt(events, i, event); |
i++; |
- if (e->NextEntryOffset == 0) break; |
+ if (e->NextEntryOffset == 0) { |
+ break; |
+ } |
offset += e->NextEntryOffset; |
} |
return events; |