Skip to content

Commit

Permalink
Converted from bytes to characters, as this is what windows is expect…
Browse files Browse the repository at this point in the history
…ing.
  • Loading branch information
adamharrison committed Dec 18, 2022
1 parent e152db2 commit 5ab8dc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/dirmonitor/win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void deinit_dirmonitor(struct dirmonitor_internal* monitor) {
int translate_changes_dirmonitor(struct dirmonitor_internal* monitor, char* buffer, int buffer_size, int (*change_callback)(int, const char*, void*), void* data) {
for (FILE_NOTIFY_INFORMATION* info = (FILE_NOTIFY_INFORMATION*)buffer; (char*)info < buffer + buffer_size; info = (FILE_NOTIFY_INFORMATION*)(((char*)info) + info->NextEntryOffset)) {
char transform_buffer[MAX_PATH*4];
int count = WideCharToMultiByte(CP_UTF8, 0, (WCHAR*)info->FileName, info->FileNameLength, transform_buffer, MAX_PATH*4 - 1, NULL, NULL);
int count = WideCharToMultiByte(CP_UTF8, 0, (WCHAR*)info->FileName, info->FileNameLength / 2, transform_buffer, MAX_PATH*4 - 1, NULL, NULL);
change_callback(count, transform_buffer, data);
if (!info->NextEntryOffset)
break;
Expand Down

0 comments on commit 5ab8dc0

Please sign in to comment.