fix missing SSIZE_T not only for MSVC

Wed, 01 Jan 2025 16:06:32 +0100

author
Mike Becker <universe@uap-core.de>
date
Wed, 01 Jan 2025 16:06:32 +0100
changeset 1076
bb4da3255de3
parent 1075
0cc4b63a0ae0
child 1077
911a154dd469

fix missing SSIZE_T not only for MSVC

src/cx/common.h file | annotate | diff | comparison | revisions
--- a/src/cx/common.h	Wed Jan 01 15:56:02 2025 +0100
+++ b/src/cx/common.h	Wed Jan 01 16:06:32 2025 +0100
@@ -117,6 +117,19 @@
 #endif
 
 // ---------------------------------------------------------------------------
+//       Missing Defines
+// ---------------------------------------------------------------------------
+
+#ifndef SSIZE_MAX // not defined in glibc since C23 and MSVC
+#if CX_WORDSIZE == 64
+#define SSIZE_MAX 0x7fffffffffffffffll
+#else
+#define SSIZE_MAX 0x7fffffffl
+#endif
+#endif
+
+
+// ---------------------------------------------------------------------------
 //       Attribute definitions
 // ---------------------------------------------------------------------------
 
@@ -365,13 +378,6 @@
 // fix missing ssize_t definition
 #include <BaseTsd.h>
 typedef SSIZE_T ssize_t;
-#ifndef SSIZE_MAX
-#ifdef _WIN64
-#define SSIZE_MAX 0x7fffffffffffffffi64
-#else
-#define SSIZE_MAX 0x7fffffffi32
-#endif
-#endif
 
 // fix missing _Thread_local support
 #define _Thread_local __declspec(thread)

mercurial