From f274b0265343f5a334ac82f1e99bb102b201e44e Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 17 Aug 2024 10:26:43 -0500 Subject: [PATCH] More changes for filewatch windows. --- src/core/filewatch.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/filewatch.c b/src/core/filewatch.c index bb534961..2ac73ed3 100644 --- a/src/core/filewatch.c +++ b/src/core/filewatch.c @@ -329,7 +329,6 @@ static void janet_watcher_remove(JanetWatcher *watcher, const char *path) { static void watcher_callback_read(JanetFiber *fiber, JanetAsyncEvent event) { JanetWatcher *watcher = (JanetWatcher *) fiber->ev_state; - char buf[1024]; switch (event) { default: break; @@ -354,11 +353,11 @@ static void watcher_callback_read(JanetFiber *fiber, JanetAsyncEvent event) { static void janet_watcher_listen(JanetWatcher *watcher) { for (int32_t i = 0; i < watcher->watch_descriptors.capacity; i++) { - const JanetKV *kv = watcher->watch_descriptors.items + i; + const JanetKV *kv = watcher->watch_descriptors.data + i; if (!janet_checktype(kv->key, JANET_POINTER)) continue; OverlappedWatch *ow = janet_unwrap_pointer(kv->key); Janet pathv = kv->value; - BOOL result = ReadDirecoryChangesW(ow->handle, + BOOL result = ReadDirectoryChangesW(ow->stream.handle, &ow->fni, sizeof(FILE_NOTIFY_INFORMATION), TRUE, @@ -414,7 +413,7 @@ static void janet_watcher_listen(JanetWatcher *watcher) { static int janet_filewatch_mark(void *p, size_t s) { JanetWatcher *watcher = (JanetWatcher *) p; (void) s; - if (watcher->stream == NULL) return 0; /* Incomplete initialization */ + if (watcher->channel == NULL) return 0; /* Incomplete initialization */ #ifndef JANET_WINDOWS janet_mark(janet_wrap_abstract(watcher->stream)); #endif @@ -425,7 +424,7 @@ static int janet_filewatch_mark(void *p, size_t s) { static int janet_filewatch_gc(void *p, size_t s) { JanetWatcher *watcher = (JanetWatcher *) p; - if (watcher->stream == NULL) return 0; /* Incomplete initialization */ + if (watcher->channel == NULL) return 0; /* Incomplete initialization */ (void) s; janet_table_deinit(&watcher->watch_descriptors); return 0;