File: 0008-Use-stdint.h-to-support-MIPS64.patch

package info (click to toggle)
calibre 6.13.0%2Brepack-2%2Bdeb12u5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,147,768 kB
  • sloc: python: 461,364; ansic: 80,698; cpp: 18,081; javascript: 2,855; xml: 1,297; sh: 892; sql: 683; objc: 544; makefile: 71; perl: 66; sed: 6
file content (58 lines) | stat: -rw-r--r-- 1,941 bytes parent folder | download | duplicates (3)
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)