]> git.sesse.net Git - vlc/blob - contrib/src/lua/luac-32bits.patch
macosx: simple prefs: Only show font family and subtype in the font panel
[vlc] / contrib / src / lua / luac-32bits.patch
1 diff -ru lua.orig/src/ldump.c lua/src/ldump.c
2 --- lua.orig/src/ldump.c        2011-12-14 19:26:18.000000000 +0200
3 +++ lua/src/ldump.c     2011-12-14 19:49:20.000000000 +0200
4 @@ -44,7 +44,8 @@
5  
6  static void DumpInt(int x, DumpState* D)
7  {
8 - DumpVar(x,D);
9 + int32_t i = x;
10 + DumpVar(i,D);
11  }
12  
13  static void DumpNumber(lua_Number x, DumpState* D)
14 @@ -62,12 +63,12 @@
15  {
16   if (s==NULL || getstr(s)==NULL)
17   {
18 -  size_t size=0;
19 +  uint32_t size=0;
20    DumpVar(size,D);
21   }
22   else
23   {
24 -  size_t size=s->tsv.len+1;            /* include trailing '\0' */
25 +  uint32_t size=s->tsv.len+1;          /* include trailing '\0' */
26    DumpVar(size,D);
27    DumpBlock(getstr(s),size,D);
28   }
29 diff -ru lua.orig/src/luaconf.h lua/src/luaconf.h
30 --- lua.orig/src/luaconf.h      2011-12-14 19:26:18.000000000 +0200
31 +++ lua/src/luaconf.h   2011-12-14 19:54:25.000000000 +0200
32 @@ -10,6 +10,8 @@
33  
34  #include <limits.h>
35  #include <stddef.h>
36 +#include <stdint.h>
37 +#include <sys/types.h>
38  
39  
40  /*
41 @@ -409,20 +411,12 @@
42  ** part always works, but may waste space on machines with 64-bit
43  ** longs.) Probably you do not need to change this.
44  */
45 -#if LUAI_BITSINT >= 32
46 -#define LUAI_UINT32    unsigned int
47 -#define LUAI_INT32     int
48 -#define LUAI_MAXINT32  INT_MAX
49 +
50 +#define LUAI_UINT32    uint32_t
51 +#define LUAI_INT32     int32_t
52 +#define LUAI_MAXINT32  0x7fffffff
53  #define LUAI_UMEM      size_t
54 -#define LUAI_MEM       ptrdiff_t
55 -#else
56 -/* 16-bit ints */
57 -#define LUAI_UINT32    unsigned long
58 -#define LUAI_INT32     long
59 -#define LUAI_MAXINT32  LONG_MAX
60 -#define LUAI_UMEM      unsigned long
61 -#define LUAI_MEM       long
62 -#endif
63 +#define LUAI_MEM       ssize_t
64  
65  
66  /*
67 diff -ru lua.orig/src/lundump.c lua/src/lundump.c
68 --- lua.orig/src/lundump.c      2011-12-14 19:26:18.000000000 +0200
69 +++ lua/src/lundump.c   2011-12-14 19:50:41.000000000 +0200
70 @@ -60,7 +60,7 @@
71  
72  static int LoadInt(LoadState* S)
73  {
74 - int x;
75 + int32_t x;
76   LoadVar(S,x);
77   IF (x<0, "bad integer");
78   return x;
79 @@ -75,7 +75,7 @@
80  
81  static TString* LoadString(LoadState* S)
82  {
83 - size_t size;
84 + uint32_t size;
85   LoadVar(S,size);
86   if (size==0)
87    return NULL;
88 @@ -219,8 +219,8 @@
89   *h++=(char)LUAC_VERSION;
90   *h++=(char)LUAC_FORMAT;
91   *h++=(char)*(char*)&x;                                /* endianness */
92 - *h++=(char)sizeof(int);
93 - *h++=(char)sizeof(size_t);
94 + *h++=(char)sizeof(int32_t);
95 + *h++=(char)sizeof(uint32_t);
96   *h++=(char)sizeof(Instruction);
97   *h++=(char)sizeof(lua_Number);
98   *h++=(char)(((lua_Number)0.5)==0);            /* is lua_Number integral? */