From 1b02959148ccd2b78c76e92e213111d3687dab08 Mon Sep 17 00:00:00 2001 From: 0xfadead Date: Mon, 20 Jan 2025 17:36:15 -0500 Subject: [PATCH 1/3] Fixed some MSVC warnings --- cthreads.c | 7 ++++++- cthreads.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cthreads.c b/cthreads.c index 8119612..87fec10 100644 --- a/cthreads.c +++ b/cthreads.c @@ -136,7 +136,11 @@ void cthreads_thread_exit(void *code) { #endif #ifdef _WIN32 - #if defined __WATCOMC__ || _MSC_VER || __DMC__ + /* NOTE: This gives warnings on MSVC, so I removed this + * for the oldest version of it I could test (19.20). */ + /* TODO: Test with the other described compilers if this + * is _really_ necessary. */ + #if defined __WATCOMC__ || _MSC_VER < 1920 || __DMC__ ExitThread((DWORD)code); #else ExitThread((DWORD)(uintptr_t)code); @@ -323,6 +327,7 @@ int cthreads_cond_destroy(struct cthreads_cond *cond) { #endif #ifdef _WIN32 + (void) cond; return 0; #else return pthread_cond_destroy(&cond->pCond); diff --git a/cthreads.h b/cthreads.h index 97bc29d..bd1f38e 100644 --- a/cthreads.h +++ b/cthreads.h @@ -7,6 +7,8 @@ struct cthreads_args { }; #ifdef _WIN32 + /* MSVC sees strncpy() as insecure. */ + #define _CRT_SECURE_NO_WARNINGS #include #else #include From bc7c20a21bbbe5215c65d46f97fc139e8829b56d Mon Sep 17 00:00:00 2001 From: Awildidiot <69577313+0xfadead@users.noreply.github.com> Date: Mon, 3 Feb 2025 21:56:22 -0500 Subject: [PATCH 2/3] Change `_really_` to `REALLY` in comment Co-authored-by: Pedro.js Signed-off-by: Awildidiot <69577313+0xfadead@users.noreply.github.com> --- cthreads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cthreads.c b/cthreads.c index 5d0a799..b6b927e 100644 --- a/cthreads.c +++ b/cthreads.c @@ -139,7 +139,7 @@ void cthreads_thread_exit(void *code) { /* NOTE: This gives warnings on MSVC, so I removed this * for the oldest version of it I could test (19.20). */ /* TODO: Test with the other described compilers if this - * is _really_ necessary. */ + * is REALLY necessary. */ #if defined __WATCOMC__ || _MSC_VER < 1920 || __DMC__ ExitThread((DWORD)code); #else From e29a3d767ad9107c65d255240252da03113ffc81 Mon Sep 17 00:00:00 2001 From: Awildidiot <69577313+0xfadead@users.noreply.github.com> Date: Mon, 3 Feb 2025 21:57:31 -0500 Subject: [PATCH 3/3] Added extra line for formatting Co-authored-by: Pedro.js Signed-off-by: Awildidiot <69577313+0xfadead@users.noreply.github.com> --- cthreads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cthreads.c b/cthreads.c index b6b927e..3139245 100644 --- a/cthreads.c +++ b/cthreads.c @@ -328,6 +328,7 @@ int cthreads_cond_destroy(struct cthreads_cond *cond) { #ifdef _WIN32 (void) cond; + return 0; #else return pthread_cond_destroy(&cond->pCond);