[Olsr-cvs] olsrd-current/lib/tas/src/lua lauxlib.c, 1.2, 1.3 lauxlib.h, 1.2, 1.3 lbaselib.c, 1.2, 1.3 ldblib.c, 1.1, 1.2 liolib.c, 1.2, 1.3 lmathlib.c, 1.1, 1.2 lstrlib.c, 1.1, 1.2

Bernd Petrovitsch (spam-protected)
Fri Nov 16 20:34:28 CET 2007


Update of /cvsroot/olsrd/olsrd-current/lib/tas/src/lua
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3811/lib/tas/src/lua

Modified Files:
	lauxlib.c lauxlib.h lbaselib.c ldblib.c liolib.c lmathlib.c 
	lstrlib.c 
Log Message:
* added -Wbad-function-cast

Index: liolib.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/liolib.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** liolib.c	20 Apr 2007 13:46:03 -0000	1.2
--- liolib.c	16 Nov 2007 19:34:26 -0000	1.3
***************
*** 375,379 ****
      for (n = first; nargs-- && success; n++) {
        if (lua_type(L, n) == LUA_TNUMBER) {
!         size_t l = (size_t)lua_tonumber(L, n);
          success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);
        }
--- 375,379 ----
      for (n = first; nargs-- && success; n++) {
        if (lua_type(L, n) == LUA_TNUMBER) {
!         size_t l = lua_tonumber(L, n);
          success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);
        }
***************
*** 584,588 ****
  
  static int io_clock (lua_State *L) {
!   lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC);
    return 1;
  }
--- 584,588 ----
  
  static int io_clock (lua_State *L) {
!   lua_pushnumber(L, clock()/(lua_Number)CLOCKS_PER_SEC);
    return 1;
  }
***************
*** 624,628 ****
    lua_gettable(L, -2);
    if (lua_isnumber(L, -1))
!     res = (int)(lua_tonumber(L, -1));
    else {
      if (d == -2)
--- 624,628 ----
    lua_gettable(L, -2);
    if (lua_isnumber(L, -1))
!     res = lua_tonumber(L, -1);
    else {
      if (d == -2)
***************
*** 637,641 ****
  static int io_date (lua_State *L) {
    const char *s = luaL_optstring(L, 1, "%c");
!   time_t t = (time_t)(luaL_optnumber(L, 2, -1));
    struct tm *stm;
    if (t == (time_t)(-1))  /* no time given? */
--- 637,641 ----
  static int io_date (lua_State *L) {
    const char *s = luaL_optstring(L, 1, "%c");
!   time_t t = luaL_optnumber(L, 2, -1);
    struct tm *stm;
    if (t == (time_t)(-1))  /* no time given? */
***************
*** 698,703 ****
  
  static int io_difftime (lua_State *L) {
!   lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)),
!                              (time_t)(luaL_optnumber(L, 2, 0))));
    return 1;
  }
--- 698,703 ----
  
  static int io_difftime (lua_State *L) {
!   lua_pushnumber(L, difftime(luaL_checknumber(L, 1),
!                              luaL_optnumber(L, 2, 0)));
    return 1;
  }

Index: lstrlib.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lstrlib.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** lstrlib.c	12 Apr 2005 17:17:27 -0000	1.1
--- lstrlib.c	16 Nov 2007 19:34:26 -0000	1.2
***************
*** 518,526 ****
    size_t ls = lua_strlen(L, lua_upvalueindex(1));
    const char *p = lua_tostring(L, lua_upvalueindex(2));
    const char *src;
    ms.L = L;
    ms.src_init = s;
    ms.src_end = s+ls;
!   for (src = s + (size_t)lua_tonumber(L, lua_upvalueindex(3));
         src <= ms.src_end;
         src++) {
--- 518,527 ----
    size_t ls = lua_strlen(L, lua_upvalueindex(1));
    const char *p = lua_tostring(L, lua_upvalueindex(2));
+   unsigned int idx3 = lua_tonumber(L, lua_upvalueindex(3));
    const char *src;
    ms.L = L;
    ms.src_init = s;
    ms.src_end = s+ls;
!   for (src = s + idx3;
         src <= ms.src_end;
         src++) {
***************
*** 705,709 ****
          }
          case 'o':  case 'u':  case 'x':  case 'X': {
!           sprintf(buff, form, (unsigned int)(luaL_checknumber(L, arg)));
            break;
          }
--- 706,711 ----
          }
          case 'o':  case 'u':  case 'x':  case 'X': {
!           const unsigned int n = luaL_checknumber(L, arg);
!           sprintf(buff, form, n);
            break;
          }

Index: lauxlib.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lauxlib.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** lauxlib.c	20 Apr 2007 13:46:03 -0000	1.2
--- lauxlib.c	16 Nov 2007 19:34:26 -0000	1.3
***************
*** 258,262 ****
  
  static int checkint (lua_State *L, int topop) {
!   int n = (int)lua_tonumber(L, -1);
    if (n == 0 && !lua_isnumber(L, -1)) n = -1;
    lua_pop(L, topop);
--- 258,262 ----
  
  static int checkint (lua_State *L, int topop) {
!   int n = lua_tonumber(L, -1);
    if (n == 0 && !lua_isnumber(L, -1)) n = -1;
    lua_pop(L, topop);
***************
*** 426,430 ****
    }
    lua_rawgeti(L, t, FREELIST_REF);  /* get first free element */
!   ref = (int)lua_tonumber(L, -1);  /* ref = t[FREELIST_REF] */
    lua_pop(L, 1);  /* remove it from stack */
    if (ref != 0) {  /* any free element? */
--- 426,430 ----
    }
    lua_rawgeti(L, t, FREELIST_REF);  /* get first free element */
!   ref = lua_tonumber(L, -1);  /* ref = t[FREELIST_REF] */
    lua_pop(L, 1);  /* remove it from stack */
    if (ref != 0) {  /* any free element? */

Index: lauxlib.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lauxlib.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** lauxlib.h	20 Apr 2007 13:46:03 -0000	1.2
--- lauxlib.h	16 Nov 2007 19:34:26 -0000	1.3
***************
*** 71,82 ****
  */
  
! #define luaL_argcheck(L, cond,numarg,extramsg) if (!(cond)) \
!                                                luaL_argerror(L, numarg,extramsg)
! #define luaL_checkstring(L,n)	(luaL_checklstring(L, (n), NULL))
! #define luaL_optstring(L,n,d)	(luaL_optlstring(L, (n), (d), NULL))
! #define luaL_checkint(L,n)	((int)luaL_checknumber(L, n))
! #define luaL_checklong(L,n)	((long)luaL_checknumber(L, n))
! #define luaL_optint(L,n,d)	((int)luaL_optnumber(L, n,(lua_Number)(d)))
! #define luaL_optlong(L,n,d)	((long)luaL_optnumber(L, n,(lua_Number)(d)))
  
  
--- 71,82 ----
  */
  
! #define luaL_argcheck(L, cond,numarg,extramsg) do { if (!(cond))         \
!             luaL_argerror(L, numarg,extramsg); } while (0)
! #define luaL_checkstring(L,n)	luaL_checklstring(L, (n), NULL)
! #define luaL_optstring(L,n,d)	luaL_optlstring(L, (n), (d), NULL)
! #define luaL_checkint(L,n)	luaL_checknumber(L, n)
! #define luaL_checklong(L,n)	luaL_checknumber(L, n)
! #define luaL_optint(L,n,d)	luaL_optnumber(L, n,(lua_Number)(d))
! #define luaL_optlong(L,n,d)	luaL_optnumber(L, n,(lua_Number)(d))
  
  

Index: lmathlib.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lmathlib.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** lmathlib.c	12 Apr 2005 17:17:26 -0000	1.1
--- lmathlib.c	16 Nov 2007 19:34:26 -0000	1.2
***************
*** 180,184 ****
        int u = luaL_checkint(L, 1);
        luaL_argcheck(L, 1<=u, 1, "interval is empty");
!       lua_pushnumber(L, (int)floor(r*u)+1);  /* int between 1 and `u' */
        break;
      }
--- 180,184 ----
        int u = luaL_checkint(L, 1);
        luaL_argcheck(L, 1<=u, 1, "interval is empty");
!       lua_pushnumber(L, floor(r*u)+1);  /* int between 1 and `u' */
        break;
      }
***************
*** 187,191 ****
        int u = luaL_checkint(L, 2);
        luaL_argcheck(L, l<=u, 2, "interval is empty");
!       lua_pushnumber(L, (int)floor(r*(u-l+1))+l);  /* int between `l' and `u' */
        break;
      }
--- 187,191 ----
        int u = luaL_checkint(L, 2);
        luaL_argcheck(L, l<=u, 2, "interval is empty");
!       lua_pushnumber(L, floor(r*(u-l+1))+l);  /* int between `l' and `u' */
        break;
      }

Index: ldblib.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/ldblib.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ldblib.c	12 Apr 2005 17:17:26 -0000	1.1
--- ldblib.c	16 Nov 2007 19:34:26 -0000	1.2
***************
*** 37,41 ****
    const char *options = luaL_optstring(L, 2, "flnSu");
    if (lua_isnumber(L, 1)) {
!     if (!lua_getstack(L, (int)(lua_tonumber(L, 1)), &ar)) {
        lua_pushnil(L);  /* level out of range */
        return 1;
--- 37,41 ----
    const char *options = luaL_optstring(L, 2, "flnSu");
    if (lua_isnumber(L, 1)) {
!     if (!lua_getstack(L, lua_tonumber(L, 1), &ar)) {
        lua_pushnil(L);  /* level out of range */
        return 1;
***************
*** 204,208 ****
    }
    lua_pushstring(L, unmakemask(mask, buff));
!   lua_pushnumber(L, (lua_Number)lua_gethookcount(L));
    return 3;
  }
--- 204,208 ----
    }
    lua_pushstring(L, unmakemask(mask, buff));
!   lua_pushnumber(L, lua_gethookcount(L));
    return 3;
  }

Index: lbaselib.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/lua/lbaselib.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** lbaselib.c	20 Apr 2007 13:46:03 -0000	1.2
--- lbaselib.c	16 Nov 2007 19:34:26 -0000	1.3
***************
*** 188,193 ****
  
  static int luaB_gcinfo (lua_State *L) {
!   lua_pushnumber(L, (lua_Number)lua_getgccount(L));
!   lua_pushnumber(L, (lua_Number)lua_getgcthreshold(L));
    return 2;
  }
--- 188,193 ----
  
  static int luaB_gcinfo (lua_State *L) {
!   lua_pushnumber(L, lua_getgccount(L));
!   lua_pushnumber(L, lua_getgcthreshold(L));
    return 2;
  }





More information about the Olsr-cvs mailing list