From e9d24f7f90d9e60e6a922ea969fb56b89a7d9914 Mon Sep 17 00:00:00 2001 From: Will Xyen Date: Fri, 7 Apr 2023 23:03:42 -0700 Subject: [PATCH] camhook: fix convert_path_to_fakesym failing on some versions of mingw --- src/main/camhook/cam.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/camhook/cam.c b/src/main/camhook/cam.c index 939c308..19978e8 100644 --- a/src/main/camhook/cam.c +++ b/src/main/camhook/cam.c @@ -550,8 +550,8 @@ char *grab_next_camera_id(char *buffer, size_t bsz) goto done; } - log_info("Detected webcam: %s\n", buffer); wcstombs(buffer, wSymLink, bsz); + log_info("Detected webcam: %s\n", buffer); ++gotten; done: @@ -659,15 +659,18 @@ bool convert_path_to_fakesym(const char *path, wchar_t *sym, char *extra_o) strtolower(mistr); strtolower(extra); - swprintf( - sym, + char buffer[CAMERA_DATA_STRING_SIZE]; + snprintf( + buffer, CAMERA_DATA_STRING_SIZE, - L"\\\\?\\%S#%S&%S&%S#%S", + "\\\\?\\%s#%s&%s&%s#%s", root, vidstr, pidstr, mistr, extra); + + mbstowcs(sym, buffer, CAMERA_DATA_STRING_SIZE); return true; }