aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-31 11:25:18 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-31 11:25:18 -0300
commit90de38bf1f85714526c30e42b670ca997ec45827 (patch)
treec9dbf61d741ddd2ededcba4c1a4da99211c28f7a
parente8a7ecb982effdfc1148098b288c6ac7130f756e (diff)
downloadlua-90de38bf1f85714526c30e42b670ca997ec45827.tar.gz
lua-90de38bf1f85714526c30e42b670ca997ec45827.tar.bz2
lua-90de38bf1f85714526c30e42b670ca997ec45827.zip
warnings in VS .Net
-rw-r--r--lapi.c6
-rw-r--r--lauxlib.c4
-rw-r--r--lauxlib.h4
-rw-r--r--ldebug.c7
-rw-r--r--ldo.c10
-rw-r--r--lgc.c6
-rw-r--r--lobject.c12
-rw-r--r--lobject.h4
-rw-r--r--lstrlib.c6
-rw-r--r--ltable.c4
-rw-r--r--lundump.c10
-rw-r--r--lvm.c6
12 files changed, 40 insertions, 39 deletions
diff --git a/lapi.c b/lapi.c
index 94dfaad2..61d0b316 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.40 2005/05/16 19:21:11 roberto Exp roberto $ 2** $Id: lapi.c,v 2.41 2005/05/17 19:49:15 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*/
@@ -153,7 +153,7 @@ LUA_API lua_State *lua_newthread (lua_State *L) {
153 153
154 154
155LUA_API int lua_gettop (lua_State *L) { 155LUA_API int lua_gettop (lua_State *L) {
156 return (L->top - L->base); 156 return cast(int, L->top - L->base);
157} 157}
158 158
159 159
@@ -972,7 +972,7 @@ LUA_API void lua_concat (lua_State *L, int n) {
972 luaC_checkGC(L); 972 luaC_checkGC(L);
973 api_checknelems(L, n); 973 api_checknelems(L, n);
974 if (n >= 2) { 974 if (n >= 2) {
975 luaV_concat(L, n, L->top - L->base - 1); 975 luaV_concat(L, n, cast(int, L->top - L->base) - 1);
976 L->top -= (n-1); 976 L->top -= (n-1);
977 } 977 }
978 else if (n == 0) { /* push empty string */ 978 else if (n == 0) { /* push empty string */
diff --git a/lauxlib.c b/lauxlib.c
index b8205191..dae9dcc7 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.133 2005/05/17 19:49:15 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.134 2005/05/25 13:21:26 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -338,7 +338,7 @@ static const char *pushnexttemplate (lua_State *L, const char *path) {
338LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, 338LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
339 const char *r) { 339 const char *r) {
340 const char *wild; 340 const char *wild;
341 int l = strlen(p); 341 size_t l = strlen(p);
342 luaL_Buffer b; 342 luaL_Buffer b;
343 luaL_buffinit(L, &b); 343 luaL_buffinit(L, &b);
344 while ((wild = strstr(s, p)) != NULL) { 344 while ((wild = strstr(s, p)) != NULL) {
diff --git a/lauxlib.h b/lauxlib.h
index 2fcb193c..504fac97 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.h,v 1.76 2005/05/20 19:09:05 roberto Exp roberto $ 2** $Id: lauxlib.h,v 1.77 2005/05/25 13:21:26 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -16,7 +16,7 @@
16 16
17 17
18#if !defined(LUA_COMPAT_GETN) 18#if !defined(LUA_COMPAT_GETN)
19#define luaL_getn(L,i) lua_objsize(L, i) 19#define luaL_getn(L,i) ((int)lua_objsize(L, i))
20#define luaL_setn(L,i,j) ((void)0) /* no op! */ 20#define luaL_setn(L,i,j) ((void)0) /* no op! */
21#endif 21#endif
22 22
diff --git a/ldebug.c b/ldebug.c
index 09e04988..8cc7bbb3 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.19 2005/05/16 21:19:00 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.20 2005/05/17 19:49:15 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -92,7 +92,7 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
92 } 92 }
93 if (level == 0 && ci > L->base_ci) { /* level found? */ 93 if (level == 0 && ci > L->base_ci) { /* level found? */
94 status = 1; 94 status = 1;
95 ar->i_ci = ci - L->base_ci; 95 ar->i_ci = cast(int, ci - L->base_ci);
96 } 96 }
97 else if (level < 0) { /* level is of a lost tail call? */ 97 else if (level < 0) { /* level is of a lost tail call? */
98 status = 1; 98 status = 1;
@@ -546,7 +546,8 @@ void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
546 const char *name = NULL; 546 const char *name = NULL;
547 const char *t = luaT_typenames[ttype(o)]; 547 const char *t = luaT_typenames[ttype(o)];
548 const char *kind = (isinstack(L->ci, o)) ? 548 const char *kind = (isinstack(L->ci, o)) ?
549 getobjname(L, L->ci, o - L->base, &name) : NULL; 549 getobjname(L, L->ci, cast(int, o - L->base), &name) :
550 NULL;
550 if (kind) 551 if (kind)
551 luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", 552 luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)",
552 op, kind, name, t); 553 op, kind, name, t);
diff --git a/ldo.c b/ldo.c
index d9e5a889..58f59bae 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.23 2005/05/03 19:01:17 roberto Exp roberto $ 2** $Id: ldo.c,v 2.24 2005/05/20 19:09:05 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -97,7 +97,7 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
97static void restore_stack_limit (lua_State *L) { 97static void restore_stack_limit (lua_State *L) {
98 lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); 98 lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1);
99 if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ 99 if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */
100 int inuse = (L->ci - L->base_ci); 100 int inuse = cast(int, L->ci - L->base_ci);
101 if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ 101 if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */
102 luaD_reallocCI(L, LUAI_MAXCALLS); 102 luaD_reallocCI(L, LUAI_MAXCALLS);
103 } 103 }
@@ -173,7 +173,7 @@ void luaD_callhook (lua_State *L, int event, int line) {
173 if (event == LUA_HOOKTAILRET) 173 if (event == LUA_HOOKTAILRET)
174 ar.i_ci = 0; /* tail call; no debug information about it */ 174 ar.i_ci = 0; /* tail call; no debug information about it */
175 else 175 else
176 ar.i_ci = L->ci - L->base_ci; 176 ar.i_ci = cast(int, L->ci - L->base_ci);
177 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ 177 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
178 L->ci->top = L->top + LUA_MINSTACK; 178 L->ci->top = L->top + LUA_MINSTACK;
179 lua_assert(L->ci->top <= L->stack_last); 179 lua_assert(L->ci->top <= L->stack_last);
@@ -260,7 +260,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
260 StkId st, base; 260 StkId st, base;
261 Proto *p = cl->p; 261 Proto *p = cl->p;
262 if (p->is_vararg) { /* varargs? */ 262 if (p->is_vararg) { /* varargs? */
263 int nargs = L->top - restorestack(L, funcr) - 1; 263 int nargs = cast(int, L->top - restorestack(L, funcr)) - 1;
264 luaD_checkstack(L, p->maxstacksize + nargs); 264 luaD_checkstack(L, p->maxstacksize + nargs);
265 base = adjust_varargs(L, p->numparams, nargs, p->is_vararg); 265 base = adjust_varargs(L, p->numparams, nargs, p->is_vararg);
266 func = restorestack(L, funcr); 266 func = restorestack(L, funcr);
@@ -380,7 +380,7 @@ static void resume (lua_State *L, void *ud) {
380 } /* else yielded inside a hook: just continue its execution */ 380 } /* else yielded inside a hook: just continue its execution */
381 } 381 }
382 L->status = 0; 382 L->status = 0;
383 firstResult = luaV_execute(L, L->ci - L->base_ci); 383 firstResult = luaV_execute(L, cast(int, L->ci - L->base_ci));
384 if (firstResult != NULL) { /* return? */ 384 if (firstResult != NULL) { /* return? */
385 luaD_poscall(L, LUA_MULTRET, firstResult); /* finalize this coroutine */ 385 luaD_poscall(L, LUA_MULTRET, firstResult); /* finalize this coroutine */
386 } 386 }
diff --git a/lgc.c b/lgc.c
index 3d3736f8..eee5555d 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.31 2005/03/22 16:04:29 roberto Exp roberto $ 2** $Id: lgc.c,v 2.32 2005/05/05 15:34:03 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*/
@@ -240,8 +240,8 @@ static void traverseclosure (global_State *g, Closure *cl) {
240 240
241 241
242static void checkstacksizes (lua_State *L, StkId max) { 242static void checkstacksizes (lua_State *L, StkId max) {
243 int ci_used = L->ci - L->base_ci; /* number of `ci' in use */ 243 int ci_used = cast(int, L->ci - L->base_ci); /* number of `ci' in use */
244 int s_used = max - L->stack; /* part of stack in use */ 244 int s_used = cast(int, max - L->stack); /* part of stack in use */
245 if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ 245 if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */
246 return; /* do not touch the stacks */ 246 return; /* do not touch the stacks */
247 if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) 247 if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci)
diff --git a/lobject.c b/lobject.c
index c01b7819..4fe5fdb4 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 2.13 2005/05/16 21:19:00 roberto Exp roberto $ 2** $Id: lobject.c,v 2.14 2005/05/20 15:53:42 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*/
@@ -159,7 +159,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
159 fmt = e+2; 159 fmt = e+2;
160 } 160 }
161 pushstr(L, fmt); 161 pushstr(L, fmt);
162 luaV_concat(L, n+1, L->top - L->base - 1); 162 luaV_concat(L, n+1, cast(int, L->top - L->base) - 1);
163 L->top -= n; 163 L->top -= n;
164 return svalue(L->top - 1); 164 return svalue(L->top - 1);
165} 165}
@@ -175,26 +175,26 @@ const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {
175} 175}
176 176
177 177
178void luaO_chunkid (char *out, const char *source, int bufflen) { 178void luaO_chunkid (char *out, const char *source, size_t bufflen) {
179 if (*source == '=') { 179 if (*source == '=') {
180 strncpy(out, source+1, bufflen); /* remove first char */ 180 strncpy(out, source+1, bufflen); /* remove first char */
181 out[bufflen-1] = '\0'; /* ensures null termination */ 181 out[bufflen-1] = '\0'; /* ensures null termination */
182 } 182 }
183 else { /* out = "source", or "...source" */ 183 else { /* out = "source", or "...source" */
184 if (*source == '@') { 184 if (*source == '@') {
185 int l; 185 size_t l;
186 source++; /* skip the `@' */ 186 source++; /* skip the `@' */
187 bufflen -= sizeof(" '...' "); 187 bufflen -= sizeof(" '...' ");
188 l = strlen(source); 188 l = strlen(source);
189 strcpy(out, ""); 189 strcpy(out, "");
190 if (l>bufflen) { 190 if (l > bufflen) {
191 source += (l-bufflen); /* get last part of file name */ 191 source += (l-bufflen); /* get last part of file name */
192 strcat(out, "..."); 192 strcat(out, "...");
193 } 193 }
194 strcat(out, source); 194 strcat(out, source);
195 } 195 }
196 else { /* out = [string "string"] */ 196 else { /* out = [string "string"] */
197 int len = strcspn(source, "\n\r"); /* stop at first newline */ 197 size_t len = strcspn(source, "\n\r"); /* stop at first newline */
198 bufflen -= sizeof(" [string \"...\"] "); 198 bufflen -= sizeof(" [string \"...\"] ");
199 if (len > bufflen) len = bufflen; 199 if (len > bufflen) len = bufflen;
200 strcpy(out, "[string \""); 200 strcpy(out, "[string \"");
diff --git a/lobject.h b/lobject.h
index 0d41e935..44291f7c 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 2.12 2005/04/25 19:24:10 roberto Exp roberto $ 2** $Id: lobject.h,v 2.13 2005/05/05 20:47:02 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*/
@@ -369,7 +369,7 @@ LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result);
369LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, 369LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
370 va_list argp); 370 va_list argp);
371LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); 371LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
372LUAI_FUNC void luaO_chunkid (char *out, const char *source, int len); 372LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);
373 373
374 374
375#endif 375#endif
diff --git a/lstrlib.c b/lstrlib.c
index 83cc45be..963469b9 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.115 2005/05/17 19:49:15 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.116 2005/05/20 15:53:42 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -461,7 +461,7 @@ static const char *lmemfind (const char *s1, size_t l1,
461 461
462 462
463static void push_onecapture (MatchState *ms, int i) { 463static void push_onecapture (MatchState *ms, int i) {
464 int l = ms->capture[i].len; 464 ptrdiff_t l = ms->capture[i].len;
465 if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); 465 if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
466 if (l == CAP_POSITION) 466 if (l == CAP_POSITION)
467 lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); 467 lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
@@ -539,7 +539,7 @@ static int gfind_aux (lua_State *L) {
539 const char *e; 539 const char *e;
540 ms.level = 0; 540 ms.level = 0;
541 if ((e = match(&ms, src, p)) != NULL) { 541 if ((e = match(&ms, src, p)) != NULL) {
542 int newstart = e-s; 542 lua_Integer newstart = e-s;
543 if (e == src) newstart++; /* empty match? go at least one position */ 543 if (e == src) newstart++; /* empty match? go at least one position */
544 lua_pushinteger(L, newstart); 544 lua_pushinteger(L, newstart);
545 lua_replace(L, lua_upvalueindex(3)); 545 lua_replace(L, lua_upvalueindex(3));
diff --git a/ltable.c b/ltable.c
index 5099d506..07575f7d 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.23 2005/05/17 19:49:15 roberto Exp roberto $ 2** $Id: ltable.c,v 2.24 2005/05/20 15:53:42 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*/
@@ -145,7 +145,7 @@ static int findindex (lua_State *L, Table *t, StkId key) {
145 if (luaO_rawequalObj(key2tval(n), key) || 145 if (luaO_rawequalObj(key2tval(n), key) ||
146 (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && 146 (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) &&
147 gcvalue(gkey(n)) == gcvalue(key))) { 147 gcvalue(gkey(n)) == gcvalue(key))) {
148 i = n - gnode(t, 0); /* key index in hash table */ 148 i = cast(int, n - gnode(t, 0)); /* key index in hash table */
149 /* hash elements are numbered after array ones */ 149 /* hash elements are numbered after array ones */
150 return i + t->sizearray; 150 return i + t->sizearray;
151 } 151 }
diff --git a/lundump.c b/lundump.c
index 7b44c425..fd3877b5 100644
--- a/lundump.c
+++ b/lundump.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lundump.c,v 2.3 2004/10/04 19:01:12 roberto Exp roberto $ 2** $Id: lundump.c,v 2.4 2005/05/05 20:47:02 roberto Exp roberto $
3** load pre-compiled Lua chunks 3** load pre-compiled Lua chunks
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -40,9 +40,9 @@ static int ezgetc (LoadState* S)
40 return c; 40 return c;
41} 41}
42 42
43static void ezread (LoadState* S, void* b, int n) 43static void ezread (LoadState* S, void* b, size_t n)
44{ 44{
45 int r=luaZ_read(S->Z,b,n); 45 size_t r=luaZ_read(S->Z,b,n);
46 if (r!=0) unexpectedEOZ(S); 46 if (r!=0) unexpectedEOZ(S);
47} 47}
48 48
@@ -51,7 +51,7 @@ static void LoadBlock (LoadState* S, void* b, size_t size)
51 if (S->swap) 51 if (S->swap)
52 { 52 {
53 char* p=(char*) b+size-1; 53 char* p=(char*) b+size-1;
54 int n=size; 54 size_t n=size;
55 while (n--) *p--=(char)ezgetc(S); 55 while (n--) *p--=(char)ezgetc(S);
56 } 56 }
57 else 57 else
@@ -66,7 +66,7 @@ static void LoadVector (LoadState* S, void* b, int m, size_t size)
66 while (m--) 66 while (m--)
67 { 67 {
68 char* p=q+size-1; 68 char* p=q+size-1;
69 int n=size; 69 size_t n=size;
70 while (n--) *p--=(char)ezgetc(S); 70 while (n--) *p--=(char)ezgetc(S);
71 q+=size; 71 q+=size;
72 } 72 }
diff --git a/lvm.c b/lvm.c
index f9577bf5..c44ac8c6 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.44 2005/05/17 19:49:15 roberto Exp roberto $ 2** $Id: lvm.c,v 2.45 2005/05/20 15:53:42 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -720,7 +720,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
720 int last; 720 int last;
721 Table *h; 721 Table *h;
722 if (n == 0) { 722 if (n == 0) {
723 n = L->top - ra - 1; 723 n = cast(int, L->top - ra) - 1;
724 L->top = L->ci->top; 724 L->top = L->ci->top;
725 } 725 }
726 if (c == 0) c = cast(int, *pc++); 726 if (c == 0) c = cast(int, *pc++);
@@ -764,7 +764,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
764 int b = GETARG_B(i) - 1; 764 int b = GETARG_B(i) - 1;
765 int j; 765 int j;
766 CallInfo *ci = L->ci; 766 CallInfo *ci = L->ci;
767 int n = ci->base - ci->func - cl->p->numparams - 1; 767 int n = cast(int, ci->base - ci->func) - cl->p->numparams - 1;
768 if (b == LUA_MULTRET) { 768 if (b == LUA_MULTRET) {
769 b = n; 769 b = n;
770 L->top = ra + n; 770 L->top = ra + n;