1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Sat, 26 Jun 2021 02:02:25 +0900
Subject: Use <stdint.h> to support MIPS64
Forwarded: not-needed
stb library doesn't know MIPS 64 architecture.
It makes pointer size to 32 bits.
Use <stdint.h> and "uintptr_t" to tell proper pointer size.
This patch will not forward to upstream because they don't want this fix.
https://github.com/nothings/stb/blob/master/README.md#why-not-c99-stdinth-declare-anywhere-etc
> #### Why not C99? stdint.h, declare-anywhere, etc.
>
> I still use MSVC 6 (1998) as my IDE because it has better human factors
> for me than later versions of MSVC.
---
src/calibre/utils/stb_sprintf.h | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/src/calibre/utils/stb_sprintf.h b/src/calibre/utils/stb_sprintf.h
index 0635360..3d5d2ed 100644
--- a/src/calibre/utils/stb_sprintf.h
+++ b/src/calibre/utils/stb_sprintf.h
@@ -202,24 +202,17 @@ STBSP__PUBLICDEF void STB_SPRINTF_DECORATE(set_separators)(char comma, char peri
#include <stdlib.h> // for va_arg()
-#define stbsp__uint32 unsigned int
-#define stbsp__int32 signed int
+#include <stdint.h>
+#define stbsp__uint32 uint32_t
+#define stbsp__int32 int32_t
-#ifdef _MSC_VER
-#define stbsp__uint64 unsigned __int64
-#define stbsp__int64 signed __int64
-#else
-#define stbsp__uint64 unsigned long long
-#define stbsp__int64 signed long long
-#endif
-#define stbsp__uint16 unsigned short
+#define stbsp__uint64 uint64_t
+#define stbsp__int64 int64_t
+
+#define stbsp__uint16 uint16_t
#ifndef stbsp__uintptr
-#if defined(__ppc64__) || defined(__powerpc64__) || defined(__aarch64__) || defined(_M_X64) || defined(__x86_64__) || defined(__x86_64)
-#define stbsp__uintptr stbsp__uint64
-#else
-#define stbsp__uintptr stbsp__uint32
-#endif
+#define stbsp__uintptr uintptr_t
#endif
#ifndef STB_SPRINTF_MSVC_MODE // used for MSVC2013 and earlier (MSVC2015 matches GCC)
|