mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Fixed redbean compression functions (#421)
This commit is contained in:
parent
58c77a9b1d
commit
8b13e1acc8
1 changed files with 2 additions and 7 deletions
|
@ -163,9 +163,7 @@ int LuaDecimate(lua_State *L) {
|
||||||
bzero(p + n, m - n);
|
bzero(p + n, m - n);
|
||||||
cDecimate2xUint8x8(m, (unsigned char *)p,
|
cDecimate2xUint8x8(m, (unsigned char *)p,
|
||||||
(signed char[8]){-1, -3, 3, 17, 17, 3, -3, -1});
|
(signed char[8]){-1, -3, 3, 17, 17, 3, -3, -1});
|
||||||
n = (n + 1) >> 1;
|
luaL_pushresultsize(&buf, (n + 1) >> 1);
|
||||||
luaL_addsize(&buf, n);
|
|
||||||
luaL_pushresultsize(&buf, n);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,8 +423,7 @@ int LuaGetRandomBytes(lua_State *L) {
|
||||||
unreachable;
|
unreachable;
|
||||||
}
|
}
|
||||||
CHECK_EQ(n, getrandom(luaL_buffinitsize(L, &buf, n), n, 0));
|
CHECK_EQ(n, getrandom(luaL_buffinitsize(L, &buf, n), n, 0));
|
||||||
luaL_addsize(&buf, n); // register added string with the buffer
|
luaL_pushresultsize(&buf, n);
|
||||||
luaL_pushresult(&buf);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +737,6 @@ int LuaCompress(lua_State *L) {
|
||||||
LuaCompress2(L, q + hdrlen, &m, p, n, level);
|
LuaCompress2(L, q + hdrlen, &m, p, n, level);
|
||||||
m += hdrlen;
|
m += hdrlen;
|
||||||
}
|
}
|
||||||
luaL_addsize(&buf, m);
|
|
||||||
luaL_pushresultsize(&buf, m);
|
luaL_pushresultsize(&buf, m);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -774,7 +770,6 @@ int LuaUncompress(lua_State *L) {
|
||||||
unreachable;
|
unreachable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
luaL_addsize(&buf, m);
|
|
||||||
luaL_pushresultsize(&buf, m);
|
luaL_pushresultsize(&buf, m);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue