mirror of
https://github.com/0x5eal/luau-unzip.git
synced 2025-04-11 01:30:54 +01:00
refactor: minor sylistic changes
Swaps places with the pattern: ```luau x = x + 1 ``` to use: ```luau x += 1 ```
This commit is contained in:
parent
c2e638cbec
commit
10a399c91f
2 changed files with 255 additions and 256 deletions
|
@ -2,7 +2,7 @@ local Tree = {}
|
|||
|
||||
export type Tree = typeof(setmetatable({} :: TreeInner, { __index = Tree }))
|
||||
type TreeInner = {
|
||||
table: { number }, -- len: 16 (🏳️⚧️❓)
|
||||
table: { number }, -- len: 16
|
||||
trans: { number }, -- len: 288
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ local distBits = table.create(30, 0)
|
|||
local distBase = table.create(30, 0)
|
||||
|
||||
-- Special ordering of code length codes
|
||||
-- stylua: ignore
|
||||
local clcIndex = {
|
||||
16, 17, 18, 0, 8, 7, 9, 6,
|
||||
10, 5, 11, 4, 12, 3, 13, 2,
|
||||
|
@ -82,7 +81,7 @@ local function buildBitsBase(bits: { number }, base: { number }, delta: number,
|
|||
-- build base table
|
||||
for i = 0, 29 do
|
||||
base[i] = sum
|
||||
sum = sum + bit32.lshift(1, bits[i])
|
||||
sum += bit32.lshift(1, bits[i])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -138,7 +137,7 @@ local function buildTree(t: Tree, lengths: { number }, off: number, num: number)
|
|||
local sum = 0
|
||||
for i = 0, 15 do
|
||||
offs[i] = sum
|
||||
sum = sum + t.table[i]
|
||||
sum += t.table[i]
|
||||
end
|
||||
|
||||
-- create code->symbol translation table
|
||||
|
|
|
@ -127,7 +127,7 @@ function ZipReader.parseCentralDirectory(self: ZipReader): ()
|
|||
if buffer.readu32(self.data, pos) == SIGNATURES.END_OF_CENTRAL_DIR then
|
||||
break
|
||||
end
|
||||
pos = pos - 1
|
||||
pos -= 1
|
||||
end
|
||||
|
||||
-- Central Directory offset is stored 16 bytes into the EoCD record
|
||||
|
@ -373,12 +373,12 @@ function ZipReader.getStats(self: ZipReader): ZipStatistics
|
|||
-- Iterate through the entries, updating stats
|
||||
for _, entry in self.entries do
|
||||
if entry.isDirectory then
|
||||
stats.dirCount = stats.dirCount + 1
|
||||
stats.dirCount += 1
|
||||
continue
|
||||
end
|
||||
|
||||
stats.fileCount = stats.fileCount + 1
|
||||
stats.totalSize = stats.totalSize + entry.size
|
||||
stats.fileCount += 1
|
||||
stats.totalSize += entry.size
|
||||
end
|
||||
|
||||
return stats
|
||||
|
|
Loading…
Add table
Reference in a new issue