OSDN Git Service
(root)
/
luatex-ja
/
luatexja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
699497f
)
gzip.save -> write(gzip.compress()) (gzip.save does not work?)
author
Hironori Kitagawa
<h_kitagawa2001@yahoo.co.jp>
Thu, 9 Mar 2023 11:25:29 +0000
(20:25 +0900)
committer
Hironori Kitagawa
<h_kitagawa2001@yahoo.co.jp>
Thu, 9 Mar 2023 11:25:29 +0000
(20:25 +0900)
src/ltj-base.lua
patch
|
blob
|
history
diff --git
a/src/ltj-base.lua
b/src/ltj-base.lua
index
4a95616
..
2af3908
100644
(file)
--- a/
src/ltj-base.lua
+++ b/
src/ltj-base.lua
@@
-285,12
+285,17
@@
do
end
end
end
end
+ local compress, decompress = gzip.compress, gzip.decompress
local function save_cache(filename, t)
local fullpath = savepath .. '/' .. filename .. '.lua.gz'
local s = serialize(t, 'return', false, serial_spec)
if s then
local function save_cache(filename, t)
local fullpath = savepath .. '/' .. filename .. '.lua.gz'
local s = serialize(t, 'return', false, serial_spec)
if s then
- gzip.save(fullpath, s, 1)
- texio.write('log', '(save cache: ' .. fullpath .. ')')
+ local f = io.open(fullpath, 'wb')
+ if f then
+ f:write(compress(s, 31))
+ texio.write('log', '(save cache: ' .. fullpath .. ')')
+ f:close()
+ end
save_cache_luc(filename, t, s)
end
end
save_cache_luc(filename, t, s)
end
end
@@
-302,7
+307,8
@@
do
if isreadable(fn) then
texio.write('log','(load cache: ' .. filename .. ')')
if compressed then
if isreadable(fn) then
texio.write('log','(load cache: ' .. filename .. ')')
if compressed then
- result = loadstring(gzip.load(fn))
+ local f = io.open(fn, 'rb'); result = f:read'*a'; f:close()
+ result = loadstring(decompress(result, 31))
else
result = loadfile(fn)
end
else
result = loadfile(fn)
end