From: Georgi Valkov Date: Fri, 19 Jul 2024 21:37:21 +0000 (+0300) Subject: threads_win: fix improper cast to long * instead of LONG * X-Git-Tag: openssl-3.5.0-alpha1~1181 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71ae46618108a095e6e10a875a59afb526548d3b;p=thirdparty%2Fopenssl.git threads_win: fix improper cast to long * instead of LONG * InterlockedExchangeAdd expects arguments of type LONG *, LONG but the int arguments were improperly cast to long *, long Note: - LONG is always 32 bit - long is 32 bit on Win32 VC x86/x64 and MingW-W64 - long is 64 bit on cygwin64 Signed-off-by: Georgi Valkov Reviewed-by: Paul Dale Reviewed-by: Tom Cosgrove Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/24941) --- diff --git a/crypto/threads_win.c b/crypto/threads_win.c index de5c56d3d6d..bdbd4d381f0 100644 --- a/crypto/threads_win.c +++ b/crypto/threads_win.c @@ -625,7 +625,7 @@ int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b) int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) { - *ret = (int)InterlockedExchangeAdd((long volatile *)val, (long)amount) + *ret = (int)InterlockedExchangeAdd((LONG volatile *)val, (LONG)amount) + amount; return 1; }