summaryrefslogtreecommitdiff
path: root/debian/patches/0002-Fix-code-which-needed-a-32-bit-int-to-not-use-int-lo.patch
blob: 3cc5450381f9c0aba66f18aeff37e570a6496285 (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
57
58
From 448e655d55608b18ed6e8e387d5f9c86356900c8 Mon Sep 17 00:00:00 2001
From: Manoj Srivastava <srivasta@debian.org>
Date: Tue, 21 Oct 2008 08:25:47 -0500
Subject: [PATCH 2/3] Fix code which needed a 32 bit int to not use int/long

On amd64, but not on i386, tome produces LUA errors at various
times. The errors occur at savefile load, when wileding a weapon,
unweilding a weapon, and for other events. The same homedir, same
savefiles, same config, same etc., does not produce errors in the
32bit build of the package.

The error seems to be that the type Number needs to be a 32bit wide
integer; and seems to be defined by default as an long, with an option
to define it as an int for amd64. However, for the 11 arches Debian
supports, this would lead to a morass of selecting architectures in
the makefile to override the type; a better solution is to use
stdint.h and use a type which is 32 bits wide by design: int32_t.

This fixes the LUA errors, and Closes: Bug#419825

Signed-off-by: Manoj Srivastava <srivasta@debian.org>
---
 src/lua/llimits.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lua/llimits.h b/src/lua/llimits.h
index 4b12450..39a1e0d 100644
--- a/src/lua/llimits.h
+++ b/src/lua/llimits.h
@@ -10,6 +10,7 @@
 
 #include <limits.h>
 #include <stddef.h>
+#include <stdint.h>
 
 
 
@@ -36,7 +37,7 @@
 ** GREP LUA_NUMBER to change that
 */
 #ifndef LUA_NUM_TYPE
-#define LUA_NUM_TYPE long
+#define LUA_NUM_TYPE int32_t
 #endif
 
 typedef LUA_NUM_TYPE Number;
@@ -50,7 +51,7 @@ typedef LUA_NUM_TYPE Number;
 
 
 
-typedef unsigned long lint32;  /* unsigned int with at least 32 bits */
+typedef int_least32_t lint32;  /* unsigned int with at least 32 bits */
 
 
 #define MAX_SIZET	((size_t)(~(size_t)0)-2)
-- 
2.0.0.rc2