Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions lua/advdupe2/sh_codec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@
versions[2] = AdvDupe2.LegacyDecoders[2]

versions[3] = function(encodedDupe)
encodedDupe = encodedDupe:Replace("\r\r\n\t\r\n", "\t\t\t\t")
encodedDupe = encodedDupe:Replace("\r\n\t\n", "\t\t\t\t")
encodedDupe = encodedDupe:Replace("\r\n", "\n")
encodedDupe = encodedDupe:Replace("\t\t\t\t", "\r\n\t\n")
encodedDupe = encodedDupe:gsub("\r\r\n\t\r\n", "\t\t\t\t")
encodedDupe = encodedDupe:gsub("\r\n\t\n", "\t\t\t\t")
encodedDupe = encodedDupe:gsub("\r\n", "\n")
encodedDupe = encodedDupe:gsub("\t\t\t\t", "\r\n\t\n")
return versions[4](encodedDupe)
end

Expand Down Expand Up @@ -538,7 +538,7 @@
if not readFile then print("File could not be read or found! ("..readFileName..")") return end
local readData = readFile:Read(readFile:Size())
readFile:Close()
local ok, tbl = AdvDupe2.Decode(readData)

Check warning on line 541 in lua/advdupe2/sh_codec.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: ok
local writeFile = file.Open(writeFileName, "wb", "DATA")
if not writeFile then print("File could not be written! ("..writeFileName..")") return end
writeFile:Write(util.TableToJSON(tbl))
Expand Down Expand Up @@ -566,5 +566,3 @@
end)

end


18 changes: 9 additions & 9 deletions lua/advdupe2/sh_codec_legacy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]]

local pairs = pairs
local type = type

Check warning on line 12 in lua/advdupe2/sh_codec_legacy.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: type
local tonumber = tonumber
local error = error
local Vector = Vector
Expand Down Expand Up @@ -40,7 +40,7 @@
return stamp
end

local AD2FF = "AD2F%s\n%s\n%s"

Check warning on line 43 in lua/advdupe2/sh_codec_legacy.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: AD2FF

local decode_types_v1, decode_types_v2
local tables = 0
Expand Down Expand Up @@ -425,7 +425,7 @@

local function deserializeAD1(dupestring)

dupestring = dupestring:Replace("\r\n", "\n")
dupestring = dupestring:gsub("\r\n", "\n")
local header, extraHeader, dupeBlock, dictBlock = dupestring:match("%[Info%]\n(.+)\n%[More Information%]\n(.+)\n%[Save%]\n(.+)\n%[Dict%]\n(.+)")

if not header then
Expand All @@ -448,13 +448,13 @@
end

local dupe = {}
for key,block in dupeBlock:gmatch("([^\n:]+):([^\n]+)") do

Check warning on line 451 in lua/advdupe2/sh_codec_legacy.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'single quoted strings' and 'double quoted strings'

local tables = {}
subtables = {}
local head

for id,chunk in block:gmatch('(%w+){(.-)}') do

Check warning on line 457 in lua/advdupe2/sh_codec_legacy.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'single quoted strings' and 'double quoted strings'

--check if this table is the trunk
if byte(id) == 72 then
Expand All @@ -466,7 +466,7 @@

for kv in gmatch(chunk,'[^;]+') do

local k,v = match(kv,'(.-)=(.+)')

Check warning on line 469 in lua/advdupe2/sh_codec_legacy.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'double quoted strings' and 'single quoted strings'

if k then
k = deserializeChunk( k )
Expand All @@ -485,7 +485,7 @@
--Restore table references
for id,tbls in pairs( subtables ) do
for _,tbl in pairs( tbls ) do
if not tables[id] then error("attempt to reference a nonexistent table") end

Check warning on line 488 in lua/advdupe2/sh_codec_legacy.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'double quoted strings' and 'single quoted strings'
for k,v in pairs(tables[id]) do
tbl[k] = v
end
Expand Down Expand Up @@ -525,10 +525,10 @@
local versions = {}

versions[2] = function(encodedDupe)
encodedDupe = encodedDupe:Replace("\r\r\n\t\r\n", "\t\t\t\t")
encodedDupe = encodedDupe:Replace("\r\n\t\n", "\t\t\t\t")
encodedDupe = encodedDupe:Replace("\r\n", "\n")
encodedDupe = encodedDupe:Replace("\t\t\t\t", "\r\n\t\n")
encodedDupe = encodedDupe:gsub("\r\r\n\t\r\n", "\t\t\t\t")
encodedDupe = encodedDupe:gsub("\r\n\t\n", "\t\t\t\t")
encodedDupe = encodedDupe:gsub("\r\n", "\n")
encodedDupe = encodedDupe:gsub("\t\t\t\t", "\r\n\t\n")
local info, dupestring = getInfo(encodedDupe:sub(7))
return deserialize_v2(
lzwDecode(
Expand All @@ -540,10 +540,10 @@
end

versions[1] = function(encodedDupe)
encodedDupe = encodedDupe:Replace("\r\r\n\t\r\n", "\t\t\t\t")
encodedDupe = encodedDupe:Replace("\r\n\t\n", "\t\t\t\t")
encodedDupe = encodedDupe:Replace("\r\n", "\n")
encodedDupe = encodedDupe:Replace("\t\t\t\t", "\r\n\t\n")
encodedDupe = encodedDupe:gsub("\r\r\n\t\r\n", "\t\t\t\t")
encodedDupe = encodedDupe:gsub("\r\n\t\n", "\t\t\t\t")
encodedDupe = encodedDupe:gsub("\r\n", "\n")
encodedDupe = encodedDupe:gsub("\t\t\t\t", "\r\n\t\n")
local info, dupestring = getInfo(encodedDupe:sub(7))
return deserialize_v1(
lzwDecode(
Expand Down
Loading