This commit is contained in:
Matthew 2026-06-27 15:51:46 +10:00
parent 253be45581
commit 031f7c74b3

View File

@ -1547,14 +1547,14 @@ struct Watcher
{
Arena arena;
u8[] buffer;
WatcherH handle;
WatchH dir_handle;
WatcherHandle handle;
WatchHandle dir_handle;
u8[] watched_dir;
bool blocking;
}
alias WatcherH = int;
alias WatchH = int;
alias WatcherHandle = int;
alias WatchHandle = int;
enum WatchType
{
@ -1607,15 +1607,15 @@ ViewChanges(Watcher* watcher)
if(length > 0)
{
i64 count = 0;
i64 i = 0;
while(i < length)
i64 index = 0;
while(index < length)
{
inotify_event* event = (cast(inotify_event*)(watcher.buffer.ptr + i));
inotify_event* event = (cast(inotify_event*)(watcher.buffer.ptr + index));
count += 1;
assert(event.wd == watcher.dir_handle);
i += inotify_event.sizeof + event.len;
index += inotify_event.sizeof + event.len;
}
if(count > 0)
@ -1631,15 +1631,15 @@ ViewChanges(Watcher* watcher)
i64 m_count = 0;
events = Alloc!(WatchEvent)(&watcher.arena, count);
count = 0;
i = 0;
while (i < length)
index = 0;
while (index < length)
{
inotify_event* event = (cast(inotify_event*)(watcher.buffer.ptr + i));
inotify_event* event = (cast(inotify_event*)(watcher.buffer.ptr + index));
if(event.len > 0)
{
u8[] file_name = (cast(u8*)event.name)[0 .. strlen(event.name.ptr)];
if(event.mask & IN_MOVED_FROM || event.mask & IN_MOVED_TO)
if(event.mask & (IN_MOVED_FROM | IN_MOVED_TO))
{
bool from = (event.mask & IN_MOVED_FROM) > 0;
@ -1726,7 +1726,7 @@ ViewChanges(Watcher* watcher)
count += 1;
}
i += inotify_event.sizeof + event.len;
index += inotify_event.sizeof + event.len;
}
}
}