diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-01-28 13:13:26 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-01-28 13:13:26 -0200 |
| commit | e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce (patch) | |
| tree | 0c8fe009fffa187be71ea3e268daf1a6e29d6d9a | |
| parent | 89110986d7a9e81960261ae682780d5fd06dc4ac (diff) | |
| download | lua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.tar.gz lua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.tar.bz2 lua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.zip | |
janitor work on casts
| -rw-r--r-- | lapi.c | 8 | ||||
| -rw-r--r-- | lcode.c | 4 | ||||
| -rw-r--r-- | ldebug.h | 4 | ||||
| -rw-r--r-- | lfunc.h | 10 | ||||
| -rw-r--r-- | lgc.c | 4 | ||||
| -rw-r--r-- | lgc.h | 6 | ||||
| -rw-r--r-- | llex.c | 4 | ||||
| -rw-r--r-- | llex.h | 4 | ||||
| -rw-r--r-- | llimits.h | 9 | ||||
| -rw-r--r-- | lmem.c | 10 | ||||
| -rw-r--r-- | lmem.h | 14 | ||||
| -rw-r--r-- | lobject.c | 16 | ||||
| -rw-r--r-- | lobject.h | 8 | ||||
| -rw-r--r-- | lopcodes.h | 12 | ||||
| -rw-r--r-- | lstate.c | 6 | ||||
| -rw-r--r-- | lstring.c | 4 | ||||
| -rw-r--r-- | ltable.c | 10 | ||||
| -rw-r--r-- | ltests.c | 26 |
18 files changed, 83 insertions, 76 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.279 2017/12/08 17:28:25 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.280 2018/01/10 12:02:35 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -439,7 +439,7 @@ LUA_API const void *lua_topointer (lua_State *L, int idx) { | |||
| 439 | case LUA_TTABLE: return hvalue(o); | 439 | case LUA_TTABLE: return hvalue(o); |
| 440 | case LUA_TLCL: return clLvalue(o); | 440 | case LUA_TLCL: return clLvalue(o); |
| 441 | case LUA_TCCL: return clCvalue(o); | 441 | case LUA_TCCL: return clCvalue(o); |
| 442 | case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); | 442 | case LUA_TLCF: return cast_voidp(cast_sizet(fvalue(o))); |
| 443 | case LUA_TTHREAD: return thvalue(o); | 443 | case LUA_TTHREAD: return thvalue(o); |
| 444 | case LUA_TUSERDATA: return getudatamem(uvalue(o)); | 444 | case LUA_TUSERDATA: return getudatamem(uvalue(o)); |
| 445 | case LUA_TLIGHTUSERDATA: return pvalue(o); | 445 | case LUA_TLIGHTUSERDATA: return pvalue(o); |
| @@ -685,7 +685,7 @@ LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { | |||
| 685 | lua_lock(L); | 685 | lua_lock(L); |
| 686 | t = index2value(L, idx); | 686 | t = index2value(L, idx); |
| 687 | api_check(L, ttistable(t), "table expected"); | 687 | api_check(L, ttistable(t), "table expected"); |
| 688 | setpvalue(&k, cast(void *, p)); | 688 | setpvalue(&k, cast_voidp(p)); |
| 689 | setobj2s(L, L->top, luaH_get(hvalue(t), &k)); | 689 | setobj2s(L, L->top, luaH_get(hvalue(t), &k)); |
| 690 | api_incr_top(L); | 690 | api_incr_top(L); |
| 691 | lua_unlock(L); | 691 | lua_unlock(L); |
| @@ -854,7 +854,7 @@ LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) { | |||
| 854 | api_checknelems(L, 1); | 854 | api_checknelems(L, 1); |
| 855 | o = index2value(L, idx); | 855 | o = index2value(L, idx); |
| 856 | api_check(L, ttistable(o), "table expected"); | 856 | api_check(L, ttistable(o), "table expected"); |
| 857 | setpvalue(&k, cast(void *, p)); | 857 | setpvalue(&k, cast_voidp(p)); |
| 858 | slot = luaH_set(L, hvalue(o), &k); | 858 | slot = luaH_set(L, hvalue(o), &k); |
| 859 | setobj2t(L, slot, s2v(L->top - 1)); | 859 | setobj2t(L, slot, s2v(L->top - 1)); |
| 860 | luaC_barrierback(L, hvalue(o), s2v(L->top - 1)); | 860 | luaC_barrierback(L, hvalue(o), s2v(L->top - 1)); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lcode.c,v 2.150 2018/01/18 16:24:31 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.151 2018/01/27 16:56:33 roberto Exp roberto $ |
| 3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -545,7 +545,7 @@ int luaK_stringK (FuncState *fs, TString *s) { | |||
| 545 | */ | 545 | */ |
| 546 | static int luaK_intK (FuncState *fs, lua_Integer n) { | 546 | static int luaK_intK (FuncState *fs, lua_Integer n) { |
| 547 | TValue k, o; | 547 | TValue k, o; |
| 548 | setpvalue(&k, cast(void*, cast(size_t, n))); | 548 | setpvalue(&k, cast_voidp(cast_sizet(n))); |
| 549 | setivalue(&o, n); | 549 | setivalue(&o, n); |
| 550 | return addk(fs, &k, &o); | 550 | return addk(fs, &k, &o); |
| 551 | } | 551 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp roberto $ | 2 | ** $Id: ldebug.h,v 2.15 2017/06/27 11:35:31 roberto Exp roberto $ |
| 3 | ** Auxiliary functions from Debug Interface module | 3 | ** Auxiliary functions from Debug Interface module |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "lstate.h" | 11 | #include "lstate.h" |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) | 14 | #define pcRel(pc, p) (cast_int((pc) - (p)->code) - 1) |
| 15 | 15 | ||
| 16 | #define resethookcount(L) (L->hookcount = L->basehookcount) | 16 | #define resethookcount(L) (L->hookcount = L->basehookcount) |
| 17 | 17 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lfunc.h,v 2.17 2017/05/04 13:32:01 roberto Exp roberto $ | 2 | ** $Id: lfunc.h,v 2.18 2017/06/29 15:06:44 roberto Exp roberto $ |
| 3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -11,11 +11,11 @@ | |||
| 11 | #include "lobject.h" | 11 | #include "lobject.h" |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ | 14 | #define sizeCclosure(n) (cast_int(sizeof(CClosure)) + \ |
| 15 | cast(int, sizeof(TValue)*((n)-1))) | 15 | cast_int(sizeof(TValue)*((n)-1))) |
| 16 | 16 | ||
| 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ | 17 | #define sizeLclosure(n) (cast_int(sizeof(LClosure)) + \ |
| 18 | cast(int, sizeof(TValue *)*((n)-1))) | 18 | cast_int(sizeof(TValue *)*((n)-1))) |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | /* test whether thread is in 'twups' list */ | 21 | /* test whether thread is in 'twups' list */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 2.243 2017/12/20 14:58:05 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.244 2017/12/28 15:42:57 roberto Exp roberto $ |
| 3 | ** Garbage Collector | 3 | ** Garbage Collector |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -107,7 +107,7 @@ static lu_mem atomic (lua_State *L); | |||
| 107 | /* | 107 | /* |
| 108 | ** one after last element in a hash array | 108 | ** one after last element in a hash array |
| 109 | */ | 109 | */ |
| 110 | #define gnodelast(h) gnode(h, cast(size_t, sizenode(h))) | 110 | #define gnodelast(h) gnode(h, cast_sizet(sizenode(h))) |
| 111 | 111 | ||
| 112 | 112 | ||
| 113 | /* | 113 | /* |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.h,v 2.98 2017/05/26 19:14:29 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.99 2017/10/11 12:38:45 roberto Exp roberto $ |
| 3 | ** Garbage Collector | 3 | ** Garbage Collector |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -57,7 +57,7 @@ | |||
| 57 | /* | 57 | /* |
| 58 | ** some useful bit tricks | 58 | ** some useful bit tricks |
| 59 | */ | 59 | */ |
| 60 | #define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) | 60 | #define resetbits(x,m) ((x) &= cast_byte(~(m))) |
| 61 | #define setbits(x,m) ((x) |= (m)) | 61 | #define setbits(x,m) ((x) |= (m)) |
| 62 | #define testbits(x,m) ((x) & (m)) | 62 | #define testbits(x,m) ((x) & (m)) |
| 63 | #define bitmask(b) (1<<(b)) | 63 | #define bitmask(b) (1<<(b)) |
| @@ -95,7 +95,7 @@ | |||
| 95 | #define changewhite(x) ((x)->marked ^= WHITEBITS) | 95 | #define changewhite(x) ((x)->marked ^= WHITEBITS) |
| 96 | #define gray2black(x) l_setbit((x)->marked, BLACKBIT) | 96 | #define gray2black(x) l_setbit((x)->marked, BLACKBIT) |
| 97 | 97 | ||
| 98 | #define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) | 98 | #define luaC_white(g) cast_byte((g)->currentwhite & WHITEBITS) |
| 99 | 99 | ||
| 100 | 100 | ||
| 101 | /* object age in generational mode */ | 101 | /* object age in generational mode */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.c,v 2.97 2017/06/09 16:48:44 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.98 2017/06/29 15:06:44 roberto Exp roberto $ |
| 3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -63,7 +63,7 @@ static void save (LexState *ls, int c) { | |||
| 63 | newsize = luaZ_sizebuffer(b) * 2; | 63 | newsize = luaZ_sizebuffer(b) * 2; |
| 64 | luaZ_resizebuffer(ls->L, b, newsize); | 64 | luaZ_resizebuffer(ls->L, b, newsize); |
| 65 | } | 65 | } |
| 66 | b->buffer[luaZ_bufflen(b)++] = cast(char, c); | 66 | b->buffer[luaZ_bufflen(b)++] = cast_char(c); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | 69 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.h,v 1.78 2014/10/29 15:38:24 roberto Exp roberto $ | 2 | ** $Id: llex.h,v 1.79 2016/05/02 14:02:12 roberto Exp roberto $ |
| 3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -37,7 +37,7 @@ enum RESERVED { | |||
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | /* number of reserved words */ | 39 | /* number of reserved words */ |
| 40 | #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) | 40 | #define NUM_RESERVED (cast_int(TK_WHILE-FIRST_RESERVED + 1)) |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | typedef union { | 43 | typedef union { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llimits.h,v 1.147 2017/12/11 18:53:53 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.148 2017/12/28 11:51:00 roberto Exp roberto $ |
| 3 | ** Limits, basic types, and some other 'installation-dependent' definitions | 3 | ** Limits, basic types, and some other 'installation-dependent' definitions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -104,10 +104,15 @@ typedef LUAI_UACINT l_uacInt; | |||
| 104 | #define cast(t, exp) ((t)(exp)) | 104 | #define cast(t, exp) ((t)(exp)) |
| 105 | 105 | ||
| 106 | #define cast_void(i) cast(void, (i)) | 106 | #define cast_void(i) cast(void, (i)) |
| 107 | #define cast_byte(i) cast(lu_byte, (i)) | 107 | #define cast_voidp(i) cast(void *, (i)) |
| 108 | #define cast_num(i) cast(lua_Number, (i)) | 108 | #define cast_num(i) cast(lua_Number, (i)) |
| 109 | #define cast_int(i) cast(int, (i)) | 109 | #define cast_int(i) cast(int, (i)) |
| 110 | #define cast_uint(i) cast(unsigned int, (i)) | ||
| 111 | #define cast_byte(i) cast(lu_byte, (i)) | ||
| 110 | #define cast_uchar(i) cast(unsigned char, (i)) | 112 | #define cast_uchar(i) cast(unsigned char, (i)) |
| 113 | #define cast_char(i) cast(char, (i)) | ||
| 114 | #define cast_charp(i) cast(char *, (i)) | ||
| 115 | #define cast_sizet(i) cast(size_t, (i)) | ||
| 111 | 116 | ||
| 112 | 117 | ||
| 113 | /* cast a signed lua_Integer to lua_Unsigned */ | 118 | /* cast a signed lua_Integer to lua_Unsigned */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.c,v 1.94 2017/12/08 17:28:25 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.95 2017/12/11 12:27:48 roberto Exp roberto $ |
| 3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -71,8 +71,8 @@ void *luaM_growaux_ (lua_State *L, void *block, int nelems, int *psize, | |||
| 71 | } | 71 | } |
| 72 | lua_assert(nelems + 1 <= size && size <= limit); | 72 | lua_assert(nelems + 1 <= size && size <= limit); |
| 73 | /* 'limit' ensures that multiplication will not overflow */ | 73 | /* 'limit' ensures that multiplication will not overflow */ |
| 74 | newblock = luaM_realloc_(L, block, cast(size_t, *psize) * size_elems, | 74 | newblock = luaM_realloc_(L, block, cast_sizet(*psize) * size_elems, |
| 75 | cast(size_t, size) * size_elems); | 75 | cast_sizet(size) * size_elems); |
| 76 | if (newblock == NULL) | 76 | if (newblock == NULL) |
| 77 | luaM_error(L); | 77 | luaM_error(L); |
| 78 | *psize = size; /* update only when everything else is OK */ | 78 | *psize = size; /* update only when everything else is OK */ |
| @@ -84,8 +84,8 @@ void *luaM_shrinkvector_ (lua_State *L, void *block, int *size, | |||
| 84 | int final_n, int size_elem) { | 84 | int final_n, int size_elem) { |
| 85 | global_State *g = G(L); | 85 | global_State *g = G(L); |
| 86 | void *newblock; | 86 | void *newblock; |
| 87 | size_t oldsize = cast(size_t, (*size) * size_elem); | 87 | size_t oldsize = cast_sizet((*size) * size_elem); |
| 88 | size_t newsize = cast(size_t, final_n * size_elem); | 88 | size_t newsize = cast_sizet(final_n * size_elem); |
| 89 | lua_assert(newsize <= oldsize); | 89 | lua_assert(newsize <= oldsize); |
| 90 | newblock = (*g->frealloc)(g->ud, block, oldsize, newsize); | 90 | newblock = (*g->frealloc)(g->ud, block, oldsize, newsize); |
| 91 | if (newblock == NULL && final_n > 0) /* allocation failed? */ | 91 | if (newblock == NULL && final_n > 0) /* allocation failed? */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.h,v 1.45 2017/12/07 18:59:52 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.46 2017/12/08 17:28:25 roberto Exp roberto $ |
| 3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -29,7 +29,7 @@ | |||
| 29 | ** avoiding this warning but also this optimization.) | 29 | ** avoiding this warning but also this optimization.) |
| 30 | */ | 30 | */ |
| 31 | #define luaM_testsize(n,e) \ | 31 | #define luaM_testsize(n,e) \ |
| 32 | (sizeof(n) >= sizeof(size_t) && cast(size_t, (n)) + 1 > MAX_SIZET/(e)) | 32 | (sizeof(n) >= sizeof(size_t) && cast_sizet((n)) + 1 > MAX_SIZET/(e)) |
| 33 | 33 | ||
| 34 | #define luaM_checksize(L,n,e) \ | 34 | #define luaM_checksize(L,n,e) \ |
| 35 | (luaM_testsize(n,e) ? luaM_toobig(L) : cast_void(0)) | 35 | (luaM_testsize(n,e) ? luaM_toobig(L) : cast_void(0)) |
| @@ -42,13 +42,15 @@ | |||
| 42 | ** 'int' or 'unsigned int' and that 'int' is not larger than 'size_t'.) | 42 | ** 'int' or 'unsigned int' and that 'int' is not larger than 'size_t'.) |
| 43 | */ | 43 | */ |
| 44 | #define luaM_limitN(n,t) \ | 44 | #define luaM_limitN(n,t) \ |
| 45 | ((cast(size_t, n) > MAX_SIZET/sizeof(t)) ? (MAX_SIZET/sizeof(t)) : (n)) | 45 | ((cast_sizet(n) <= MAX_SIZET/sizeof(t)) ? (n) : \ |
| 46 | cast_uint((MAX_SIZET/sizeof(t)))) | ||
| 47 | |||
| 46 | 48 | ||
| 47 | /* | 49 | /* |
| 48 | ** Arrays of chars do not need any test | 50 | ** Arrays of chars do not need any test |
| 49 | */ | 51 | */ |
| 50 | #define luaM_reallocvchar(L,b,on,n) \ | 52 | #define luaM_reallocvchar(L,b,on,n) \ |
| 51 | cast(char *, luaM_saferealloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) | 53 | cast_charp(luaM_saferealloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) |
| 52 | 54 | ||
| 53 | #define luaM_freemem(L, b, s) luaM_free_(L, (b), (s)) | 55 | #define luaM_freemem(L, b, s) luaM_free_(L, (b), (s)) |
| 54 | #define luaM_free(L, b) luaM_free_(L, (b), sizeof(*(b))) | 56 | #define luaM_free(L, b) luaM_free_(L, (b), sizeof(*(b))) |
| @@ -66,8 +68,8 @@ | |||
| 66 | luaM_limitN(limit,t),e))) | 68 | luaM_limitN(limit,t),e))) |
| 67 | 69 | ||
| 68 | #define luaM_reallocvector(L, v,oldn,n,t) \ | 70 | #define luaM_reallocvector(L, v,oldn,n,t) \ |
| 69 | (cast(t *, luaM_realloc_(L, v, cast(size_t, oldn) * sizeof(t), \ | 71 | (cast(t *, luaM_realloc_(L, v, cast_sizet(oldn) * sizeof(t), \ |
| 70 | cast(size_t, n) * sizeof(t)))) | 72 | cast_sizet(n) * sizeof(t)))) |
| 71 | 73 | ||
| 72 | #define luaM_shrinkvector(L,v,size,fs,t) \ | 74 | #define luaM_shrinkvector(L,v,size,fs,t) \ |
| 73 | ((v)=cast(t *, luaM_shrinkvector_(L, v, &(size), fs, sizeof(t)))) | 75 | ((v)=cast(t *, luaM_shrinkvector_(L, v, &(size), fs, sizeof(t)))) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 2.121 2017/11/23 19:29:04 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.122 2017/12/30 20:46:18 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -204,7 +204,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) { | |||
| 204 | int e = 0; /* exponent correction */ | 204 | int e = 0; /* exponent correction */ |
| 205 | int neg; /* 1 if number is negative */ | 205 | int neg; /* 1 if number is negative */ |
| 206 | int hasdot = 0; /* true after seen a dot */ | 206 | int hasdot = 0; /* true after seen a dot */ |
| 207 | *endptr = cast(char *, s); /* nothing is valid yet */ | 207 | *endptr = cast_charp(s); /* nothing is valid yet */ |
| 208 | while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ | 208 | while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ |
| 209 | neg = isneg(&s); /* check sign */ | 209 | neg = isneg(&s); /* check sign */ |
| 210 | if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ | 210 | if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ |
| @@ -226,7 +226,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) { | |||
| 226 | } | 226 | } |
| 227 | if (nosigdig + sigdig == 0) /* no digits? */ | 227 | if (nosigdig + sigdig == 0) /* no digits? */ |
| 228 | return 0.0; /* invalid format */ | 228 | return 0.0; /* invalid format */ |
| 229 | *endptr = cast(char *, s); /* valid up to here */ | 229 | *endptr = cast_charp(s); /* valid up to here */ |
| 230 | e *= 4; /* each digit multiplies/divides value by 2^4 */ | 230 | e *= 4; /* each digit multiplies/divides value by 2^4 */ |
| 231 | if (*s == 'p' || *s == 'P') { /* exponent part? */ | 231 | if (*s == 'p' || *s == 'P') { /* exponent part? */ |
| 232 | int exp1 = 0; /* exponent value */ | 232 | int exp1 = 0; /* exponent value */ |
| @@ -239,7 +239,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) { | |||
| 239 | exp1 = exp1 * 10 + *(s++) - '0'; | 239 | exp1 = exp1 * 10 + *(s++) - '0'; |
| 240 | if (neg1) exp1 = -exp1; | 240 | if (neg1) exp1 = -exp1; |
| 241 | e += exp1; | 241 | e += exp1; |
| 242 | *endptr = cast(char *, s); /* valid up to here */ | 242 | *endptr = cast_charp(s); /* valid up to here */ |
| 243 | } | 243 | } |
| 244 | if (neg) r = -r; | 244 | if (neg) r = -r; |
| 245 | return l_mathop(ldexp)(r, e); | 245 | return l_mathop(ldexp)(r, e); |
| @@ -353,15 +353,15 @@ int luaO_utf8esc (char *buff, unsigned long x) { | |||
| 353 | int n = 1; /* number of bytes put in buffer (backwards) */ | 353 | int n = 1; /* number of bytes put in buffer (backwards) */ |
| 354 | lua_assert(x <= 0x10FFFF); | 354 | lua_assert(x <= 0x10FFFF); |
| 355 | if (x < 0x80) /* ascii? */ | 355 | if (x < 0x80) /* ascii? */ |
| 356 | buff[UTF8BUFFSZ - 1] = cast(char, x); | 356 | buff[UTF8BUFFSZ - 1] = cast_char(x); |
| 357 | else { /* need continuation bytes */ | 357 | else { /* need continuation bytes */ |
| 358 | unsigned int mfb = 0x3f; /* maximum that fits in first byte */ | 358 | unsigned int mfb = 0x3f; /* maximum that fits in first byte */ |
| 359 | do { /* add continuation bytes */ | 359 | do { /* add continuation bytes */ |
| 360 | buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f)); | 360 | buff[UTF8BUFFSZ - (n++)] = cast_char(0x80 | (x & 0x3f)); |
| 361 | x >>= 6; /* remove added bits */ | 361 | x >>= 6; /* remove added bits */ |
| 362 | mfb >>= 1; /* now there is one less bit available in first byte */ | 362 | mfb >>= 1; /* now there is one less bit available in first byte */ |
| 363 | } while (x > mfb); /* still needs continuation byte? */ | 363 | } while (x > mfb); /* still needs continuation byte? */ |
| 364 | buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */ | 364 | buff[UTF8BUFFSZ - n] = cast_char((~mfb << 1) | x); /* add first byte */ |
| 365 | } | 365 | } |
| 366 | return n; | 366 | return n; |
| 367 | } | 367 | } |
| @@ -417,7 +417,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
| 417 | break; | 417 | break; |
| 418 | } | 418 | } |
| 419 | case 'c': { /* an 'int' as a character */ | 419 | case 'c': { /* an 'int' as a character */ |
| 420 | char buff = cast(char, va_arg(argp, int)); | 420 | char buff = cast_char(va_arg(argp, int)); |
| 421 | if (lisprint(cast_uchar(buff))) | 421 | if (lisprint(cast_uchar(buff))) |
| 422 | pushstr(L, &buff, 1); | 422 | pushstr(L, &buff, 1); |
| 423 | else /* non-printable character; print its code */ | 423 | else /* non-printable character; print its code */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 2.131 2017/11/23 19:29:04 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.132 2018/01/28 12:07:53 roberto Exp roberto $ |
| 3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -351,7 +351,7 @@ typedef union UTString { | |||
| 351 | ** (Access to 'extra' ensures that value is really a 'TString'.) | 351 | ** (Access to 'extra' ensures that value is really a 'TString'.) |
| 352 | */ | 352 | */ |
| 353 | #define getstr(ts) \ | 353 | #define getstr(ts) \ |
| 354 | check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString)) | 354 | check_exp(sizeof((ts)->extra), cast_charp((ts)) + sizeof(UTString)) |
| 355 | 355 | ||
| 356 | 356 | ||
| 357 | /* get the actual string (array of bytes) from a Lua value */ | 357 | /* get the actual string (array of bytes) from a Lua value */ |
| @@ -391,7 +391,7 @@ typedef union UUdata { | |||
| 391 | ** (Access to 'ttuv_' ensures that value is really a 'Udata'.) | 391 | ** (Access to 'ttuv_' ensures that value is really a 'Udata'.) |
| 392 | */ | 392 | */ |
| 393 | #define getudatamem(u) \ | 393 | #define getudatamem(u) \ |
| 394 | check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata))) | 394 | check_exp(sizeof((u)->ttuv_), (cast_charp(u) + sizeof(UUdata))) |
| 395 | 395 | ||
| 396 | #define setuservalue(L,u,o) \ | 396 | #define setuservalue(L,u,o) \ |
| 397 | { const TValue *io=(o); Udata *iu = (u); \ | 397 | { const TValue *io=(o); Udata *iu = (u); \ |
| @@ -607,7 +607,7 @@ typedef struct Table { | |||
| 607 | ** 'module' operation for hashing (size is always a power of 2) | 607 | ** 'module' operation for hashing (size is always a power of 2) |
| 608 | */ | 608 | */ |
| 609 | #define lmod(s,size) \ | 609 | #define lmod(s,size) \ |
| 610 | (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1))))) | 610 | (check_exp((size&(size-1))==0, (cast_int((s) & ((size)-1))))) |
| 611 | 611 | ||
| 612 | 612 | ||
| 613 | #define twoto(x) (1<<(x)) | 613 | #define twoto(x) (1<<(x)) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.h,v 1.182 2018/01/09 11:24:12 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.183 2018/01/27 16:56:33 roberto Exp roberto $ |
| 3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -111,7 +111,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ | |||
| 111 | #define checkopm(i,m) (getOpMode(GET_OPCODE(i)) == m) | 111 | #define checkopm(i,m) (getOpMode(GET_OPCODE(i)) == m) |
| 112 | 112 | ||
| 113 | 113 | ||
| 114 | #define getarg(i,pos,size) (cast(int, ((i)>>(pos)) & MASK1(size,0))) | 114 | #define getarg(i,pos,size) (cast_int(((i)>>(pos)) & MASK1(size,0))) |
| 115 | #define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ | 115 | #define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ |
| 116 | ((cast(Instruction, v)<<pos)&MASK1(size,pos)))) | 116 | ((cast(Instruction, v)<<pos)&MASK1(size,pos)))) |
| 117 | 117 | ||
| @@ -126,7 +126,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ | |||
| 126 | #define GETARG_sC(i) (GETARG_C(i) - OFFSET_sC) | 126 | #define GETARG_sC(i) (GETARG_C(i) - OFFSET_sC) |
| 127 | #define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) | 127 | #define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) |
| 128 | 128 | ||
| 129 | #define TESTARG_k(i) (cast(int, ((i) & (1u << POS_k)))) | 129 | #define TESTARG_k(i) (cast_int(((i) & (1u << POS_k)))) |
| 130 | #define GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1)) | 130 | #define GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1)) |
| 131 | #define SETARG_k(i,v) setarg(i, v, POS_k, 1) | 131 | #define SETARG_k(i,v) setarg(i, v, POS_k, 1) |
| 132 | 132 | ||
| @@ -138,12 +138,12 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ | |||
| 138 | 138 | ||
| 139 | #define GETARG_sBx(i) \ | 139 | #define GETARG_sBx(i) \ |
| 140 | check_exp(checkopm(i, iAsBx), getarg(i, POS_Bx, SIZE_Bx) - OFFSET_sBx) | 140 | check_exp(checkopm(i, iAsBx), getarg(i, POS_Bx, SIZE_Bx) - OFFSET_sBx) |
| 141 | #define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+OFFSET_sBx)) | 141 | #define SETARG_sBx(i,b) SETARG_Bx((i),cast_uint((b)+OFFSET_sBx)) |
| 142 | 142 | ||
| 143 | #define GETARG_sJ(i) \ | 143 | #define GETARG_sJ(i) \ |
| 144 | check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ) | 144 | check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ) |
| 145 | #define SETARG_sJ(i,j) \ | 145 | #define SETARG_sJ(i,j) \ |
| 146 | setarg(i, cast(unsigned int, (j)+OFFSET_sJ), POS_sJ, SIZE_sJ) | 146 | setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ) |
| 147 | #define GETARG_m(i) check_exp(checkopm(i, isJ), getarg(i, POS_m, 1)) | 147 | #define GETARG_m(i) check_exp(checkopm(i, isJ), getarg(i, POS_m, 1)) |
| 148 | #define SETARG_m(i,m) setarg(i, m, POS_m, 1) | 148 | #define SETARG_m(i,m) setarg(i, m, POS_m, 1) |
| 149 | 149 | ||
| @@ -292,7 +292,7 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | |||
| 292 | } OpCode; | 292 | } OpCode; |
| 293 | 293 | ||
| 294 | 294 | ||
| 295 | #define NUM_OPCODES (cast(int, OP_EXTRAARG) + 1) | 295 | #define NUM_OPCODES (cast_int(OP_EXTRAARG) + 1) |
| 296 | 296 | ||
| 297 | 297 | ||
| 298 | 298 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 2.148 2017/11/23 16:35:54 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.149 2017/12/19 16:40:17 roberto Exp roberto $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -35,7 +35,7 @@ | |||
| 35 | */ | 35 | */ |
| 36 | #if !defined(luai_makeseed) | 36 | #if !defined(luai_makeseed) |
| 37 | #include <time.h> | 37 | #include <time.h> |
| 38 | #define luai_makeseed() cast(unsigned int, time(NULL)) | 38 | #define luai_makeseed() cast_uint(time(NULL)) |
| 39 | #endif | 39 | #endif |
| 40 | 40 | ||
| 41 | 41 | ||
| @@ -67,7 +67,7 @@ typedef struct LG { | |||
| 67 | ** Layout Randomization (if present) to increase randomness.. | 67 | ** Layout Randomization (if present) to increase randomness.. |
| 68 | */ | 68 | */ |
| 69 | #define addbuff(b,p,e) \ | 69 | #define addbuff(b,p,e) \ |
| 70 | { size_t t = cast(size_t, e); \ | 70 | { size_t t = cast_sizet(e); \ |
| 71 | memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } | 71 | memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } |
| 72 | 72 | ||
| 73 | static unsigned int makeseed (lua_State *L) { | 73 | static unsigned int makeseed (lua_State *L) { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 2.61 2017/12/12 11:52:35 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.62 2017/12/18 13:00:57 roberto Exp roberto $ |
| 3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -51,7 +51,7 @@ int luaS_eqlngstr (TString *a, TString *b) { | |||
| 51 | 51 | ||
| 52 | 52 | ||
| 53 | unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { | 53 | unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { |
| 54 | unsigned int h = seed ^ cast(unsigned int, l); | 54 | unsigned int h = seed ^ cast_uint(l); |
| 55 | size_t step = (l >> LUAI_HASHLIMIT) + 1; | 55 | size_t step = (l >> LUAI_HASHLIMIT) + 1; |
| 56 | for (; l >= step; l -= step) | 56 | for (; l >= step; l -= step) |
| 57 | h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1])); | 57 | h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1])); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 2.129 2017/12/08 17:28:25 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.130 2017/12/29 15:58:23 roberto Exp roberto $ |
| 3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -116,8 +116,8 @@ static int l_hashfloat (lua_Number n) { | |||
| 116 | return 0; | 116 | return 0; |
| 117 | } | 117 | } |
| 118 | else { /* normal case */ | 118 | else { /* normal case */ |
| 119 | unsigned int u = cast(unsigned int, i) + cast(unsigned int, ni); | 119 | unsigned int u = cast_uint(i) + cast_uint(ni); |
| 120 | return cast_int(u <= cast(unsigned int, INT_MAX) ? u : ~u); | 120 | return cast_int(u <= cast_uint(INT_MAX) ? u : ~u); |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | #endif | 123 | #endif |
| @@ -213,7 +213,7 @@ static const TValue *getgeneric (Table *t, const TValue *key) { | |||
| 213 | */ | 213 | */ |
| 214 | static unsigned int arrayindex (lua_Integer k) { | 214 | static unsigned int arrayindex (lua_Integer k) { |
| 215 | if (0 < k && l_castS2U(k) <= MAXASIZE) | 215 | if (0 < k && l_castS2U(k) <= MAXASIZE) |
| 216 | return cast(unsigned int, k); /* 'key' is an appropriate array index */ | 216 | return cast_uint(k); /* 'key' is an appropriate array index */ |
| 217 | else | 217 | else |
| 218 | return 0; | 218 | return 0; |
| 219 | } | 219 | } |
| @@ -264,7 +264,7 @@ int luaH_next (lua_State *L, Table *t, StkId key) { | |||
| 264 | 264 | ||
| 265 | static void freehash (lua_State *L, Table *t) { | 265 | static void freehash (lua_State *L, Table *t) { |
| 266 | if (!isdummy(t)) | 266 | if (!isdummy(t)) |
| 267 | luaM_freearray(L, t->node, cast(size_t, sizenode(t))); | 267 | luaM_freearray(L, t->node, cast_sizet(sizenode(t))); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | 270 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.239 2018/01/09 11:21:41 roberto Exp $ | 2 | ** $Id: ltests.c,v 2.239 2018/01/09 11:24:12 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -110,7 +110,7 @@ static void freeblock (Memcontrol *mc, Header *block) { | |||
| 110 | size_t size = block->d.size; | 110 | size_t size = block->d.size; |
| 111 | int i; | 111 | int i; |
| 112 | for (i = 0; i < MARKSIZE; i++) /* check marks after block */ | 112 | for (i = 0; i < MARKSIZE; i++) /* check marks after block */ |
| 113 | lua_assert(*(cast(char *, block + 1) + size + i) == MARK); | 113 | lua_assert(*(cast_charp(block + 1) + size + i) == MARK); |
| 114 | mc->objcount[block->d.type]--; | 114 | mc->objcount[block->d.type]--; |
| 115 | fillmem(block, sizeof(Header) + size + MARKSIZE); /* erase block */ | 115 | fillmem(block, sizeof(Header) + size + MARKSIZE); /* erase block */ |
| 116 | free(block); /* actually free block */ | 116 | free(block); /* actually free block */ |
| @@ -161,10 +161,10 @@ void *debug_realloc (void *ud, void *b, size_t oldsize, size_t size) { | |||
| 161 | freeblock(mc, block); /* erase (and check) old copy */ | 161 | freeblock(mc, block); /* erase (and check) old copy */ |
| 162 | } | 162 | } |
| 163 | /* initialize new part of the block with something weird */ | 163 | /* initialize new part of the block with something weird */ |
| 164 | fillmem(cast(char *, newblock + 1) + commonsize, size - commonsize); | 164 | fillmem(cast_charp(newblock + 1) + commonsize, size - commonsize); |
| 165 | /* initialize marks after block */ | 165 | /* initialize marks after block */ |
| 166 | for (i = 0; i < MARKSIZE; i++) | 166 | for (i = 0; i < MARKSIZE; i++) |
| 167 | *(cast(char *, newblock + 1) + size + i) = MARK; | 167 | *(cast_charp(newblock + 1) + size + i) = MARK; |
| 168 | newblock->d.size = size; | 168 | newblock->d.size = size; |
| 169 | newblock->d.type = type; | 169 | newblock->d.type = type; |
| 170 | mc->total += size; | 170 | mc->total += size; |
| @@ -919,8 +919,8 @@ static int upvalue (lua_State *L) { | |||
| 919 | 919 | ||
| 920 | 920 | ||
| 921 | static int newuserdata (lua_State *L) { | 921 | static int newuserdata (lua_State *L) { |
| 922 | size_t size = cast(size_t, luaL_checkinteger(L, 1)); | 922 | size_t size = cast_sizet(luaL_checkinteger(L, 1)); |
| 923 | char *p = cast(char *, lua_newuserdata(L, size)); | 923 | char *p = cast_charp(lua_newuserdata(L, size)); |
| 924 | while (size--) *p++ = '\0'; | 924 | while (size--) *p++ = '\0'; |
| 925 | return 1; | 925 | return 1; |
| 926 | } | 926 | } |
| @@ -928,7 +928,7 @@ static int newuserdata (lua_State *L) { | |||
| 928 | 928 | ||
| 929 | static int pushuserdata (lua_State *L) { | 929 | static int pushuserdata (lua_State *L) { |
| 930 | lua_Integer u = luaL_checkinteger(L, 1); | 930 | lua_Integer u = luaL_checkinteger(L, 1); |
| 931 | lua_pushlightuserdata(L, cast(void *, cast(size_t, u))); | 931 | lua_pushlightuserdata(L, cast_voidp(cast_sizet(u))); |
| 932 | return 1; | 932 | return 1; |
| 933 | } | 933 | } |
| 934 | 934 | ||
| @@ -959,7 +959,7 @@ static int s2d (lua_State *L) { | |||
| 959 | 959 | ||
| 960 | static int d2s (lua_State *L) { | 960 | static int d2s (lua_State *L) { |
| 961 | double d = luaL_checknumber(L, 1); | 961 | double d = luaL_checknumber(L, 1); |
| 962 | lua_pushlstring(L, cast(char *, &d), sizeof(d)); | 962 | lua_pushlstring(L, cast_charp(&d), sizeof(d)); |
| 963 | return 1; | 963 | return 1; |
| 964 | } | 964 | } |
| 965 | 965 | ||
| @@ -1277,7 +1277,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
| 1277 | } | 1277 | } |
| 1278 | else if EQ("func2num") { | 1278 | else if EQ("func2num") { |
| 1279 | lua_CFunction func = lua_tocfunction(L1, getindex); | 1279 | lua_CFunction func = lua_tocfunction(L1, getindex); |
| 1280 | lua_pushnumber(L1, cast(size_t, func)); | 1280 | lua_pushnumber(L1, cast_sizet(func)); |
| 1281 | } | 1281 | } |
| 1282 | else if EQ("getfield") { | 1282 | else if EQ("getfield") { |
| 1283 | int t = getindex; | 1283 | int t = getindex; |
| @@ -1422,11 +1422,11 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
| 1422 | } | 1422 | } |
| 1423 | else if EQ("rawgetp") { | 1423 | else if EQ("rawgetp") { |
| 1424 | int t = getindex; | 1424 | int t = getindex; |
| 1425 | lua_rawgetp(L1, t, cast(void *, cast(size_t, getnum))); | 1425 | lua_rawgetp(L1, t, cast_voidp(cast_sizet(getnum))); |
| 1426 | } | 1426 | } |
| 1427 | else if EQ("rawsetp") { | 1427 | else if EQ("rawsetp") { |
| 1428 | int t = getindex; | 1428 | int t = getindex; |
| 1429 | lua_rawsetp(L1, t, cast(void *, cast(size_t, getnum))); | 1429 | lua_rawsetp(L1, t, cast_voidp(cast_sizet(getnum))); |
| 1430 | } | 1430 | } |
| 1431 | else if EQ("remove") { | 1431 | else if EQ("remove") { |
| 1432 | lua_remove(L1, getnum); | 1432 | lua_remove(L1, getnum); |
| @@ -1511,7 +1511,7 @@ static struct X { int x; } x; | |||
| 1511 | lua_pushnumber(L1, lua_tonumber(L1, getindex)); | 1511 | lua_pushnumber(L1, lua_tonumber(L1, getindex)); |
| 1512 | } | 1512 | } |
| 1513 | else if EQ("topointer") { | 1513 | else if EQ("topointer") { |
| 1514 | lua_pushnumber(L1, cast(size_t, lua_topointer(L1, getindex))); | 1514 | lua_pushnumber(L1, cast_sizet(lua_topointer(L1, getindex))); |
| 1515 | } | 1515 | } |
| 1516 | else if EQ("tostring") { | 1516 | else if EQ("tostring") { |
| 1517 | const char *s = lua_tostring(L1, getindex); | 1517 | const char *s = lua_tostring(L1, getindex); |
| @@ -1725,7 +1725,7 @@ int luaB_opentests (lua_State *L) { | |||
| 1725 | lua_atpanic(L, &tpanic); | 1725 | lua_atpanic(L, &tpanic); |
| 1726 | atexit(checkfinalmem); | 1726 | atexit(checkfinalmem); |
| 1727 | lua_assert(lua_getallocf(L, &ud) == debug_realloc); | 1727 | lua_assert(lua_getallocf(L, &ud) == debug_realloc); |
| 1728 | lua_assert(ud == cast(void *, &l_memcontrol)); | 1728 | lua_assert(ud == cast_voidp(&l_memcontrol)); |
| 1729 | lua_setallocf(L, lua_getallocf(L, NULL), ud); | 1729 | lua_setallocf(L, lua_getallocf(L, NULL), ud); |
| 1730 | luaL_newlib(L, tests_funcs); | 1730 | luaL_newlib(L, tests_funcs); |
| 1731 | return 1; | 1731 | return 1; |
