summarylogtreecommitdiffstats
path: root/003-fix-glibc-2.42-compilation.patch
blob: 76bf63eb676fa7bc84043bb08ed412cd4b12a7e3 (plain)
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
commit 3ce9cd66aa57764c3f3676f5edd58f57f5e9b7dd
Author: Hazel <109479539+transdryad@users.noreply.github.com>
Date:   Tue Aug 5 20:15:17 2025 -0600

    Fix Compilation on GLIBC 2.42 by renaming B10000000 to BYTE_10000000. (#168)

diff --git a/src/libtcod/renderer_xterm.c b/src/libtcod/renderer_xterm.c
index a2cdce01..249d0fd4 100644
--- ./src/libtcod/renderer_xterm.c
+++ ./src/libtcod/renderer_xterm.c
@@ -93,10 +93,10 @@ struct TCOD_RendererXterm {
 };
 
 static char* ucs4_to_utf8(int ucs4, char out[5]) {
-  static const unsigned char B10000000 = 128;
-  static const unsigned char B11000000 = 192;
-  static const unsigned char B11100000 = 224;
-  static const unsigned char B11110000 = 240;
+  static const unsigned char BYTE_10000000 = 128;
+  static const unsigned char BYTE_11000000 = 192;
+  static const unsigned char BYTE_11100000 = 224;
+  static const unsigned char BYTE_11110000 = 240;
   static const int B000_000000_000000_111111 = 63;
   static const int B000_000000_011111_000000 = 1984;
   static const int B000_000000_111111_000000 = 4032;
@@ -109,21 +109,21 @@ static char* ucs4_to_utf8(int ucs4, char out[5]) {
     out[1] = '\0';
     return out;
   } else if (ucs4 <= 0x07FF) {
-    out[0] = B11000000 | (unsigned char)((ucs4 & B000_000000_011111_000000) >> 6);
-    out[1] = B10000000 | (unsigned char)((ucs4 & B000_000000_000000_111111) >> 0);
+    out[0] = BYTE_11000000 | (unsigned char)((ucs4 & B000_000000_011111_000000) >> 6);
+    out[1] = BYTE_10000000 | (unsigned char)((ucs4 & B000_000000_000000_111111) >> 0);
     out[2] = '\0';
     return out;
   } else if (ucs4 <= 0xFFFF) {
-    out[0] = B11100000 | (unsigned char)((ucs4 & B000_001111_000000_000000) >> 12);
-    out[1] = B10000000 | (unsigned char)((ucs4 & B000_000000_111111_000000) >> 6);
-    out[2] = B10000000 | (unsigned char)((ucs4 & B000_000000_000000_111111) >> 0);
+    out[0] = BYTE_11100000 | (unsigned char)((ucs4 & B000_001111_000000_000000) >> 12);
+    out[1] = BYTE_10000000 | (unsigned char)((ucs4 & B000_000000_111111_000000) >> 6);
+    out[2] = BYTE_10000000 | (unsigned char)((ucs4 & B000_000000_000000_111111) >> 0);
     out[3] = '\0';
     return out;
   } else if (ucs4 <= 0x10FFFF) {
-    out[0] = B11110000 | (unsigned char)((ucs4 & B111_000000_000000_000000) >> 18);
-    out[1] = B10000000 | (unsigned char)((ucs4 & B000_111111_000000_000000) >> 12);
-    out[2] = B10000000 | (unsigned char)((ucs4 & B000_000000_111111_000000) >> 6);
-    out[3] = B10000000 | (unsigned char)((ucs4 & B000_000000_000000_111111) >> 0);
+    out[0] = BYTE_11110000 | (unsigned char)((ucs4 & B111_000000_000000_000000) >> 18);
+    out[1] = BYTE_10000000 | (unsigned char)((ucs4 & B000_111111_000000_000000) >> 12);
+    out[2] = BYTE_10000000 | (unsigned char)((ucs4 & B000_000000_111111_000000) >> 6);
+    out[3] = BYTE_10000000 | (unsigned char)((ucs4 & B000_000000_000000_111111) >> 0);
     out[4] = '\0';
     return out;
   }