From 313be5e71e850c288fda6678862e4b6ada13f396 Mon Sep 17 00:00:00 2001 From: John Thacker Date: Tue, 19 May 2026 17:48:58 -0400 Subject: [PATCH] Win32: Type SSIZE_T as ssize_t instead of long 64-bit Windows uses a LLP64 data model, where long is still 32 bits and long long and pointers are 64-bits. basetsd.h defines Windows Data Types, including a SSIZE_T which is 32-bit on 32-bit Windows and 64-bit on 64-bit Windows and intended for the same purpose as POSIX ssize_t. Use that for the ssize_t typedef. This is what the recently on hiatus ShiftMediaProject Windows port of libgcrypt did (https://github.com/ShiftMediaProject/libgcrypt/blob/master/src/gcrypt.h.in) and also matches what some other projects like Wireshark use. Signed-off-by: John Thacker --- src/gcrypt.h.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index 04339a48..73e54bf3 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -35,7 +35,8 @@ #if defined _WIN32 || defined __WIN32__ # ifndef __GNUC__ - typedef long ssize_t; +# include + typedef SSIZE_T ssize_t; typedef int pid_t; # endif /*!__GNUC__*/ #endif /*_WIN32*/ -- 2.54.0