add updated lua patchset from Steven Barth (cyrus) as explained in http://lists.openwrt.org/pipermail/openwrt-devel/2008-May/002170.html
SVN-Revision: 11239master
parent
b8652e42e8
commit
6fa85238f5
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,113 @@ |
||||
diff -ur lua-5.1.3-pt2/src/ldump.c lua-5.1.3-pt3/src/ldump.c
|
||||
--- lua-5.1.3-pt2/src/ldump.c 2008-04-05 14:25:13.000000000 +0200
|
||||
+++ lua-5.1.3-pt3/src/ldump.c 2008-04-05 14:28:27.000000000 +0200
|
||||
@@ -67,12 +67,12 @@
|
||||
{
|
||||
if (s==NULL || getstr(s)==NULL)
|
||||
{
|
||||
- size_t size=0;
|
||||
+ unsigned int size=0;
|
||||
DumpVar(size,D);
|
||||
}
|
||||
else
|
||||
{
|
||||
- size_t size=s->tsv.len+1; /* include trailing '\0' */
|
||||
+ unsigned int size=s->tsv.len+1; /* include trailing '\0' */
|
||||
DumpVar(size,D);
|
||||
DumpBlock(getstr(s),size,D);
|
||||
}
|
||||
diff -ur lua-5.1.3-pt2/src/lundump.c lua-5.1.3-pt3/src/lundump.c
|
||||
--- lua-5.1.3-pt2/src/lundump.c 2008-04-05 14:25:13.000000000 +0200
|
||||
+++ lua-5.1.3-pt3/src/lundump.c 2008-04-05 14:28:27.000000000 +0200
|
||||
@@ -25,6 +25,7 @@
|
||||
ZIO* Z;
|
||||
Mbuffer* b;
|
||||
const char* name;
|
||||
+ int swap;
|
||||
} LoadState;
|
||||
|
||||
#ifdef LUAC_TRUST_BINARIES
|
||||
@@ -40,7 +41,6 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
-#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size))
|
||||
#define LoadByte(S) (lu_byte)LoadChar(S)
|
||||
#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
|
||||
#define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
|
||||
@@ -52,6 +52,49 @@
|
||||
IF (r!=0, "unexpected end");
|
||||
}
|
||||
|
||||
+static void LoadMem (LoadState* S, void* b, int n, size_t size)
|
||||
+{
|
||||
+ LoadBlock(S,b,n*size);
|
||||
+ if (S->swap)
|
||||
+ {
|
||||
+ char* p=(char*) b;
|
||||
+ char c;
|
||||
+ switch (size)
|
||||
+ {
|
||||
+ case 1:
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ while (n--)
|
||||
+ {
|
||||
+ c=p[0]; p[0]=p[1]; p[1]=c;
|
||||
+ p+=2;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ while (n--)
|
||||
+ {
|
||||
+ c=p[0]; p[0]=p[3]; p[3]=c;
|
||||
+ c=p[1]; p[1]=p[2]; p[2]=c;
|
||||
+ p+=4;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 8:
|
||||
+ while (n--)
|
||||
+ {
|
||||
+ c=p[0]; p[0]=p[7]; p[7]=c;
|
||||
+ c=p[1]; p[1]=p[6]; p[6]=c;
|
||||
+ c=p[2]; p[2]=p[5]; p[5]=c;
|
||||
+ c=p[3]; p[3]=p[4]; p[4]=c;
|
||||
+ p+=8;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ IF(1, "bad size");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int LoadChar(LoadState* S)
|
||||
{
|
||||
char x;
|
||||
@@ -83,7 +126,7 @@
|
||||
|
||||
static TString* LoadString(LoadState* S)
|
||||
{
|
||||
- size_t size;
|
||||
+ unsigned int size;
|
||||
LoadVar(S,size);
|
||||
if (size==0)
|
||||
return NULL;
|
||||
@@ -194,6 +237,7 @@
|
||||
char s[LUAC_HEADERSIZE];
|
||||
luaU_header(h);
|
||||
LoadBlock(S,s,LUAC_HEADERSIZE);
|
||||
+ S->swap=(s[6]!=h[6]); s[6]=h[6];
|
||||
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
|
||||
}
|
||||
|
||||
@@ -228,7 +272,7 @@
|
||||
*h++=(char)LUAC_FORMAT;
|
||||
*h++=(char)*(char*)&x; /* endianness */
|
||||
*h++=(char)sizeof(int);
|
||||
- *h++=(char)sizeof(size_t);
|
||||
+ *h++=(char)sizeof(unsigned int);
|
||||
*h++=(char)sizeof(Instruction);
|
||||
*h++=(char)sizeof(lua_Number);
|
||||
|
@ -0,0 +1,15 @@ |
||||
--- b/src/luaconf.h 2008-05-06 20:10:46.000000000 +0200
|
||||
+++ a/src/luaconf.h 2008-05-06 20:10:27.000000000 +0200
|
||||
@@ -95,9 +95,9 @@
|
||||
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
|
||||
|
||||
#else
|
||||
-#define LUA_ROOT "/usr/local/"
|
||||
-#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
|
||||
-#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
|
||||
+#define LUA_ROOT "/usr/"
|
||||
+#define LUA_LDIR LUA_ROOT "share/lua/"
|
||||
+#define LUA_CDIR LUA_ROOT "lib/lua/"
|
||||
#define LUA_PATH_DEFAULT \
|
||||
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
|
||||
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
|
Loading…
Reference in new issue