Browse Source

warnings in VS .Net

v5-2
Roberto Ierusalimschy 20 years ago
parent
commit
90de38bf1f
  1. 6
      lapi.c
  2. 4
      lauxlib.c
  3. 4
      lauxlib.h
  4. 7
      ldebug.c
  5. 10
      ldo.c
  6. 6
      lgc.c
  7. 12
      lobject.c
  8. 4
      lobject.h
  9. 6
      lstrlib.c
  10. 4
      ltable.c
  11. 10
      lundump.c
  12. 6
      lvm.c

6
lapi.c

@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.40 2005/05/16 19:21:11 roberto Exp roberto $
** $Id: lapi.c,v 2.41 2005/05/17 19:49:15 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@ -153,7 +153,7 @@ LUA_API lua_State *lua_newthread (lua_State *L) {
LUA_API int lua_gettop (lua_State *L) {
return (L->top - L->base);
return cast(int, L->top - L->base);
}
@ -972,7 +972,7 @@ LUA_API void lua_concat (lua_State *L, int n) {
luaC_checkGC(L);
api_checknelems(L, n);
if (n >= 2) {
luaV_concat(L, n, L->top - L->base - 1);
luaV_concat(L, n, cast(int, L->top - L->base) - 1);
L->top -= (n-1);
}
else if (n == 0) { /* push empty string */

4
lauxlib.c

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.c,v 1.133 2005/05/17 19:49:15 roberto Exp roberto $
** $Id: lauxlib.c,v 1.134 2005/05/25 13:21:26 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -338,7 +338,7 @@ static const char *pushnexttemplate (lua_State *L, const char *path) {
LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
const char *r) {
const char *wild;
int l = strlen(p);
size_t l = strlen(p);
luaL_Buffer b;
luaL_buffinit(L, &b);
while ((wild = strstr(s, p)) != NULL) {

4
lauxlib.h

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.h,v 1.76 2005/05/20 19:09:05 roberto Exp roberto $
** $Id: lauxlib.h,v 1.77 2005/05/25 13:21:26 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@ -16,7 +16,7 @@
#if !defined(LUA_COMPAT_GETN)
#define luaL_getn(L,i) lua_objsize(L, i)
#define luaL_getn(L,i) ((int)lua_objsize(L, i))
#define luaL_setn(L,i,j) ((void)0) /* no op! */
#endif

7
ldebug.c

@ -1,5 +1,5 @@
/*
** $Id: ldebug.c,v 2.19 2005/05/16 21:19:00 roberto Exp roberto $
** $Id: ldebug.c,v 2.20 2005/05/17 19:49:15 roberto Exp roberto $
** Debug Interface
** See Copyright Notice in lua.h
*/
@ -92,7 +92,7 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
}
if (level == 0 && ci > L->base_ci) { /* level found? */
status = 1;
ar->i_ci = ci - L->base_ci;
ar->i_ci = cast(int, ci - L->base_ci);
}
else if (level < 0) { /* level is of a lost tail call? */
status = 1;
@ -546,7 +546,8 @@ void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
const char *name = NULL;
const char *t = luaT_typenames[ttype(o)];
const char *kind = (isinstack(L->ci, o)) ?
getobjname(L, L->ci, o - L->base, &name) : NULL;
getobjname(L, L->ci, cast(int, o - L->base), &name) :
NULL;
if (kind)
luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)",
op, kind, name, t);

10
ldo.c

@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 2.23 2005/05/03 19:01:17 roberto Exp roberto $
** $Id: ldo.c,v 2.24 2005/05/20 19:09:05 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@ -97,7 +97,7 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
static void restore_stack_limit (lua_State *L) {
lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1);
if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */
int inuse = (L->ci - L->base_ci);
int inuse = cast(int, L->ci - L->base_ci);
if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */
luaD_reallocCI(L, LUAI_MAXCALLS);
}
@ -173,7 +173,7 @@ void luaD_callhook (lua_State *L, int event, int line) {
if (event == LUA_HOOKTAILRET)
ar.i_ci = 0; /* tail call; no debug information about it */
else
ar.i_ci = L->ci - L->base_ci;
ar.i_ci = cast(int, L->ci - L->base_ci);
luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
L->ci->top = L->top + LUA_MINSTACK;
lua_assert(L->ci->top <= L->stack_last);
@ -260,7 +260,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
StkId st, base;
Proto *p = cl->p;
if (p->is_vararg) { /* varargs? */
int nargs = L->top - restorestack(L, funcr) - 1;
int nargs = cast(int, L->top - restorestack(L, funcr)) - 1;
luaD_checkstack(L, p->maxstacksize + nargs);
base = adjust_varargs(L, p->numparams, nargs, p->is_vararg);
func = restorestack(L, funcr);
@ -380,7 +380,7 @@ static void resume (lua_State *L, void *ud) {
} /* else yielded inside a hook: just continue its execution */
}
L->status = 0;
firstResult = luaV_execute(L, L->ci - L->base_ci);
firstResult = luaV_execute(L, cast(int, L->ci - L->base_ci));
if (firstResult != NULL) { /* return? */
luaD_poscall(L, LUA_MULTRET, firstResult); /* finalize this coroutine */
}

6
lgc.c

@ -1,5 +1,5 @@
/*
** $Id: lgc.c,v 2.31 2005/03/22 16:04:29 roberto Exp roberto $
** $Id: lgc.c,v 2.32 2005/05/05 15:34:03 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@ -240,8 +240,8 @@ static void traverseclosure (global_State *g, Closure *cl) {
static void checkstacksizes (lua_State *L, StkId max) {
int ci_used = L->ci - L->base_ci; /* number of `ci' in use */
int s_used = max - L->stack; /* part of stack in use */
int ci_used = cast(int, L->ci - L->base_ci); /* number of `ci' in use */
int s_used = cast(int, max - L->stack); /* part of stack in use */
if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */
return; /* do not touch the stacks */
if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci)

12
lobject.c

@ -1,5 +1,5 @@
/*
** $Id: lobject.c,v 2.13 2005/05/16 21:19:00 roberto Exp roberto $
** $Id: lobject.c,v 2.14 2005/05/20 15:53:42 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@ -159,7 +159,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
fmt = e+2;
}
pushstr(L, fmt);
luaV_concat(L, n+1, L->top - L->base - 1);
luaV_concat(L, n+1, cast(int, L->top - L->base) - 1);
L->top -= n;
return svalue(L->top - 1);
}
@ -175,26 +175,26 @@ const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {
}
void luaO_chunkid (char *out, const char *source, int bufflen) {
void luaO_chunkid (char *out, const char *source, size_t bufflen) {
if (*source == '=') {
strncpy(out, source+1, bufflen); /* remove first char */
out[bufflen-1] = '\0'; /* ensures null termination */
}
else { /* out = "source", or "...source" */
if (*source == '@') {
int l;
size_t l;
source++; /* skip the `@' */
bufflen -= sizeof(" '...' ");
l = strlen(source);
strcpy(out, "");
if (l>bufflen) {
if (l > bufflen) {
source += (l-bufflen); /* get last part of file name */
strcat(out, "...");
}
strcat(out, source);
}
else { /* out = [string "string"] */
int len = strcspn(source, "\n\r"); /* stop at first newline */
size_t len = strcspn(source, "\n\r"); /* stop at first newline */
bufflen -= sizeof(" [string \"...\"] ");
if (len > bufflen) len = bufflen;
strcpy(out, "[string \"");

4
lobject.h

@ -1,5 +1,5 @@
/*
** $Id: lobject.h,v 2.12 2005/04/25 19:24:10 roberto Exp roberto $
** $Id: lobject.h,v 2.13 2005/05/05 20:47:02 roberto Exp roberto $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
@ -369,7 +369,7 @@ LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result);
LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
va_list argp);
LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
LUAI_FUNC void luaO_chunkid (char *out, const char *source, int len);
LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);
#endif

6
lstrlib.c

@ -1,5 +1,5 @@
/*
** $Id: lstrlib.c,v 1.115 2005/05/17 19:49:15 roberto Exp roberto $
** $Id: lstrlib.c,v 1.116 2005/05/20 15:53:42 roberto Exp roberto $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/
@ -461,7 +461,7 @@ static const char *lmemfind (const char *s1, size_t l1,
static void push_onecapture (MatchState *ms, int i) {
int l = ms->capture[i].len;
ptrdiff_t l = ms->capture[i].len;
if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
if (l == CAP_POSITION)
lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
@ -539,7 +539,7 @@ static int gfind_aux (lua_State *L) {
const char *e;
ms.level = 0;
if ((e = match(&ms, src, p)) != NULL) {
int newstart = e-s;
lua_Integer newstart = e-s;
if (e == src) newstart++; /* empty match? go at least one position */
lua_pushinteger(L, newstart);
lua_replace(L, lua_upvalueindex(3));

4
ltable.c

@ -1,5 +1,5 @@
/*
** $Id: ltable.c,v 2.23 2005/05/17 19:49:15 roberto Exp roberto $
** $Id: ltable.c,v 2.24 2005/05/20 15:53:42 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@ -145,7 +145,7 @@ static int findindex (lua_State *L, Table *t, StkId key) {
if (luaO_rawequalObj(key2tval(n), key) ||
(ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) &&
gcvalue(gkey(n)) == gcvalue(key))) {
i = n - gnode(t, 0); /* key index in hash table */
i = cast(int, n - gnode(t, 0)); /* key index in hash table */
/* hash elements are numbered after array ones */
return i + t->sizearray;
}

10
lundump.c

@ -1,5 +1,5 @@
/*
** $Id: lundump.c,v 2.3 2004/10/04 19:01:12 roberto Exp roberto $
** $Id: lundump.c,v 2.4 2005/05/05 20:47:02 roberto Exp roberto $
** load pre-compiled Lua chunks
** See Copyright Notice in lua.h
*/
@ -40,9 +40,9 @@ static int ezgetc (LoadState* S)
return c;
}
static void ezread (LoadState* S, void* b, int n)
static void ezread (LoadState* S, void* b, size_t n)
{
int r=luaZ_read(S->Z,b,n);
size_t r=luaZ_read(S->Z,b,n);
if (r!=0) unexpectedEOZ(S);
}
@ -51,7 +51,7 @@ static void LoadBlock (LoadState* S, void* b, size_t size)
if (S->swap)
{
char* p=(char*) b+size-1;
int n=size;
size_t n=size;
while (n--) *p--=(char)ezgetc(S);
}
else
@ -66,7 +66,7 @@ static void LoadVector (LoadState* S, void* b, int m, size_t size)
while (m--)
{
char* p=q+size-1;
int n=size;
size_t n=size;
while (n--) *p--=(char)ezgetc(S);
q+=size;
}

6
lvm.c

@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.44 2005/05/17 19:49:15 roberto Exp roberto $
** $Id: lvm.c,v 2.45 2005/05/20 15:53:42 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -720,7 +720,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
int last;
Table *h;
if (n == 0) {
n = L->top - ra - 1;
n = cast(int, L->top - ra) - 1;
L->top = L->ci->top;
}
if (c == 0) c = cast(int, *pc++);
@ -764,7 +764,7 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
int b = GETARG_B(i) - 1;
int j;
CallInfo *ci = L->ci;
int n = ci->base - ci->func - cl->p->numparams - 1;
int n = cast(int, ci->base - ci->func) - cl->p->numparams - 1;
if (b == LUA_MULTRET) {
b = n;
L->top = ra + n;

Loading…
Cancel
Save