Skip to content

Commit f8e0069

Browse files
committed
Modified UNZIP.LUA so that it's under 4 clusters (2048 bytes) in size when squished.
1 parent 0fc8c47 commit f8e0069

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

arch/UNZIP.LUA

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,20 @@ function unzip(z, d, l, x)
5656
-- of = Output file
5757
-- re = Remaining bytes
5858
-- ec = Expected crc32 checksum
59-
local s, fl, cm, cr, cs, us, nl, el, fn, of, re, ec = f:read(30)
59+
local s, re, fl, cm, cr, cs, us, nl, el, fn, of, ec = f:read(30), "cur"
6060
if not s or #s < 30 or not s:find("^PK\3\4") then break end
6161
v, fl, cm, _, _, ec, cs, us, nl, el = string.unpack("<HHHHHIIIHH", s, 5)
6262

6363
fn, E = f:read(nl) D() -- read the filename
64-
if el > 0 then f:seek("cur", el) end
64+
if el > 0 then f:seek(re, el) end
6565

6666
if x then -- Skip file if it's on the exclude list
67-
for _, i in ipairs(x) do if i == fn then f:seek("cur", cs) goto L end end
67+
for _, i in ipairs(x) do if i == fn then f:seek(re, cs) goto L end end
6868
end
6969

7070
if l then -- Skip file if it's not on the include list
71-
72-
-- j = file found in list
73-
local j
74-
7571
for _, i in ipairs(l) do if i == fn then j = 1 break end end
76-
if not j then f:seek("cur", cs) goto L end
72+
if j > 0 then f:seek(re, cs) goto L end
7773
end
7874

7975
re = cs
@@ -130,7 +126,7 @@ function unzip(z, d, l, x)
130126
elseif (cm == 8 or cm == 9) and pcall(require, "INFLATE") then -- deflated file
131127
inflate(R, W, cm == 9)
132128
else
133-
print("!Unsupported compression method " .. cm)
129+
print("!CM" .. cm)
134130
end
135131

136132
of:close()

0 commit comments

Comments
 (0)