[Scummvm-cvs-logs] CVS: residual/lua lbuiltin.cpp,1.4,1.5 liolib.cpp,1.2,1.3 llex.cpp,1.1,1.2 lmathlib.cpp,1.2,1.3 lstrlib.cpp,1.1,1.2 lundump.cpp,1.2,1.3 lundump.h,1.1,1.2 lzio.cpp,1.1,1.2

Pawel Kolodziejski aquadran at users.sourceforge.net
Wed Jan 12 14:11:45 CET 2005


Update of /cvsroot/scummvm/residual/lua
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13712/residual/lua

Modified Files:
	lbuiltin.cpp liolib.cpp llex.cpp lmathlib.cpp lstrlib.cpp 
	lundump.cpp lundump.h lzio.cpp 
Log Message:
fixed some lua warnings

Index: lbuiltin.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/lbuiltin.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- lbuiltin.cpp	25 Dec 2004 18:23:07 -0000	1.4
+++ lbuiltin.cpp	12 Jan 2005 22:10:11 -0000	1.5
@@ -205,7 +205,7 @@
 
 static void tonumber (void)
 {
-  int base = luaL_opt_number(2, 10);
+  int base = (int)luaL_opt_number(2, 10);
   if (base == 10) {  /* standard conversion */
     lua_Object o = lua_getparam(1);
     if (lua_isnumber(o))
@@ -276,7 +276,7 @@
   lua_Object temp;
   /* temp = table.n */
   lua_pushobject(table); lua_pushstring("n"); temp = lua_rawgettable();
-  return (lua_isnumber(temp) ? lua_getnumber(temp) : MAX_INT);
+  return (lua_isnumber(temp) ? (int)lua_getnumber(temp) : MAX_INT);
 }
 
 static void luaI_call (void)
@@ -326,7 +326,7 @@
 {
   lua_Object o = luaL_tablearg(1);
   lua_pushobject(o);
-  lua_settag(luaL_check_number(2));
+  lua_settag((int)luaL_check_number(2));
   lua_pushobject(o);  /* returns first argument */
 }
 
@@ -339,8 +339,8 @@
 
 static void copytagmethods (void)
 {
-  lua_pushnumber(lua_copytagmethods(luaL_check_number(1),
-                                    luaL_check_number(2)));
+  lua_pushnumber(lua_copytagmethods((int)luaL_check_number(1),
+                                    (int)luaL_check_number(2)));
 }
 
 
@@ -387,7 +387,7 @@
 
 static void luaI_collectgarbage (void)
 {
-  lua_pushnumber(lua_collectgarbage(luaL_opt_number(1, 0)));
+  lua_pushnumber(lua_collectgarbage((long int)luaL_opt_number(1, 0)));
 }
 
 

Index: liolib.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/liolib.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- liolib.cpp	25 Dec 2004 18:23:07 -0000	1.2
+++ liolib.cpp	12 Jan 2005 22:10:12 -0000	1.3
@@ -51,7 +51,7 @@
 
 static int gettag (int i)
 {
-  return lua_getnumber(lua_getparam(i));
+  return (int)lua_getnumber(lua_getparam(i));
 }
 
 
@@ -266,7 +266,7 @@
   char *s;
   long l;
   while ((s = luaL_opt_lstr(arg++, NULL, &l)) != NULL)
-    status = status && (fwrite(s, 1, l, f) == l);
+    status = status && (fwrite(s, 1, l, f) == (unsigned long)l);
   pushresult(status);
 }
 
@@ -424,7 +424,7 @@
 {
   int iotag = lua_newtag();
   int closedtag = lua_newtag();
-  int i;
+  unsigned int i;
   for (i=0; i<sizeof(iolibtag)/sizeof(iolibtag[0]); i++) {
     /* put both tags as upvalues for these functions */
     lua_pushnumber(iotag);

Index: llex.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/llex.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- llex.cpp	6 Oct 2004 19:07:53 -0000	1.1
+++ llex.cpp	12 Jan 2005 22:10:12 -0000	1.2
@@ -37,7 +37,7 @@
 
 void luaX_init (void)
 {
-  int i;
+  unsigned int i;
   for (i=0; i<(sizeof(reserved)/sizeof(reserved[0])); i++) {
     TaggedString *ts = luaS_new(reserved[i]);
     ts->head.marked = FIRST_RESERVED+i;  /* reserved word  (always > 255) */
@@ -59,7 +59,7 @@
 }
 
 
-void luaX_token2str (LexState *ls, int token, char *s) {
+void luaX_token2str (LexState * /*ls*/, int token, char *s) {
   if (token < 255) {
     s[0] = token;
     s[1] = 0;

Index: lmathlib.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/lmathlib.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- lmathlib.cpp	25 Dec 2004 18:23:07 -0000	1.2
+++ lmathlib.cpp	12 Jan 2005 22:10:12 -0000	1.3
@@ -122,7 +122,7 @@
 }
 
 static void math_ldexp (void) {
-  lua_pushnumber(ldexp(luaL_check_number(1), luaL_check_number(2)));
+  lua_pushnumber(ldexp(luaL_check_number(1), (int)luaL_check_number(2)));
 }
 
 
@@ -168,7 +168,7 @@
 
 static void math_randomseed (void)
 {
-  srand(luaL_check_number(1));
+  srand((unsigned int)luaL_check_number(1));
 }
 
 

Index: lstrlib.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/lstrlib.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- lstrlib.cpp	6 Oct 2004 19:07:53 -0000	1.1
+++ lstrlib.cpp	12 Jan 2005 22:10:12 -0000	1.2
@@ -49,8 +49,8 @@
 {
   long l;
   char *s = luaL_check_lstr(1, &l);
-  long start = posrelat(luaL_check_number(2), l);
-  long end = posrelat(luaL_opt_number(3, -1), l);
+  long start = posrelat((int)luaL_check_number(2), l);
+  long end = posrelat((int)luaL_opt_number(3, -1), l);
   if (1 <= start && start <= end && end <= l)
     lua_pushlstring(s+start-1, end-start+1);
   else lua_pushstring("");
@@ -96,7 +96,7 @@
 {
   long l;
   char *s = luaL_check_lstr(1, &l);
-  long pos = posrelat(luaL_opt_number(2, 1), l);
+  long pos = posrelat((int)luaL_opt_number(2, 1), l);
   luaL_arg_check(0<pos && pos<=l, 2,  "out of range");
   lua_pushnumber((unsigned char)s[pos-1]);
 }
@@ -337,7 +337,7 @@
   long l;
   char *s = luaL_check_lstr(1, &l);
   char *p = luaL_check_string(2);
-  long init = posrelat(luaL_opt_number(3, 1), l) - 1;
+  long init = posrelat((int)luaL_opt_number(3, 1), l) - 1;
   struct Capture cap;
   luaL_arg_check(0 <= init && init <= l, 3, "out of range");
   if (lua_getparam(4) != LUA_NOOBJECT ||

Index: lundump.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/lundump.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- lundump.cpp	30 Dec 2004 07:37:13 -0000	1.2
+++ lundump.cpp	12 Jan 2005 22:10:12 -0000	1.3
@@ -13,28 +13,12 @@
 #include "lstring.h"
 #include "lundump.h"
 
-#include <SDL_byteorder.h>
-
 #define	LoadBlock(b,size,Z)	ezread(Z,b,size)
 #define	LoadNative(t,Z)		LoadBlock(&t,sizeof(t),Z)
 
-#if (SDL_BYTEORDER == SDL_LIL_ENDIAN)
-	#define doLoadNumber(f,Z)	LoadNative(f,Z)
-#else
-	#define doLoadNumber(f,Z)	f=LoadNumber(Z)
-#endif
+#define doLoadNumber(f,Z)	LoadNative(f,Z)
 
 
-static float conv_float(const char *data) {
-        const unsigned char *udata = (const unsigned char *)(data);
-        unsigned char fdata[4];
-        fdata[0] = udata[3];
-        fdata[1] = udata[2];
-        fdata[2] = udata[1];
-        fdata[3] = udata[0];
-        return *(const float *)(fdata);
-}
-
 static void unexpectedEOZ(ZIO* Z)
 {
  luaL_verror("unexpected end of file in %s",zname(Z));
@@ -67,39 +51,6 @@
  return (hi<<16)|lo;
 }
 
-#if ID_NUMBER==ID_REAL4
-/* LUA_NUMBER */
-/* assumes sizeof(long)==4 and sizeof(float)==4 (IEEE) */
-static float LoadFloat(ZIO* Z)
-{
- unsigned long l=LoadLong(Z);
- return conv_float((const char *)&l);
-}
-#endif
-
-#if ID_NUMBER==ID_REAL8
-/* LUA_NUMBER */
-/* assumes sizeof(long)==4 and sizeof(double)==8 (IEEE) */
-static double LoadDouble(ZIO* Z)
-{
- unsigned long l[2];
- double f;
- int x=1;
- if (*(char*)&x==1)			/* little-endian */
- {
-  l[1]=LoadLong(Z);
-  l[0]=LoadLong(Z);
- }
- else					/* big-endian */
- {
-  l[0]=LoadLong(Z);
-  l[1]=LoadLong(Z);
- }
- memcpy(&f,l,sizeof(f));
- return f;
-}
-#endif
-
 static Byte* LoadCode(ZIO* Z)
 {
  unsigned long size=LoadLong(Z);
@@ -223,7 +174,9 @@
 static void LoadHeader(ZIO* Z)
 {
  int version,id,sizeofR;
+#if 0
  real f=(real)-TEST_NUMBER,tf=(real)TEST_NUMBER;
+#endif
  LoadSignature(Z);
  version=ezgetc(Z);
  if (version>VERSION)

Index: lundump.h
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/lundump.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- lundump.h	6 Oct 2004 19:07:53 -0000	1.1
+++ lundump.h	12 Jan 2005 22:10:12 -0000	1.2
@@ -44,35 +44,10 @@
 * dump and undump routines.
 */
 
-#ifndef ID_NUMBER
 #define	ID_NUMBER	ID_REAL4
-#endif
 
-#if 0
-#define	ID_NUMBER	ID_INT4
-#define	ID_NUMBER	ID_REAL4
-#define	ID_NUMBER	ID_REAL8
-#define	ID_NUMBER	ID_NATIVE
 #endif
 
-#endif
+#define	DumpNumber	DumpFloat
+#define SIZEOF_NUMBER	4
 
-#if   ID_NUMBER==ID_REAL4
-	#define	DumpNumber	DumpFloat
-	#define	LoadNumber	LoadFloat
-	#define SIZEOF_NUMBER	4
-#elif ID_NUMBER==ID_REAL8
-	#define	DumpNumber	DumpDouble
-	#define	LoadNumber	LoadDouble
-	#define SIZEOF_NUMBER	8
-#elif ID_NUMBER==ID_INT4
-	#define	DumpNumber	DumpLong
-	#define	LoadNumber	LoadLong
-	#define SIZEOF_NUMBER	4
-#elif ID_NUMBER==ID_NATIVE
-	#define	DumpNumber	DumpNative
-	#define	LoadNumber	LoadNative
-	#define SIZEOF_NUMBER	sizeof(real)
-#else
-	#error	bad ID_NUMBER
-#endif

Index: lzio.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/lzio.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- lzio.cpp	6 Oct 2004 19:07:53 -0000	1.1
+++ lzio.cpp	12 Jan 2005 22:10:12 -0000	1.2
@@ -15,7 +15,7 @@
 
 /* ----------------------------------------------------- memory buffers --- */
 
-static int zmfilbuf (ZIO* z)
+static int zmfilbuf (ZIO* /*z*/)
 {
  return EOZ;
 }





More information about the Scummvm-git-logs mailing list