Skip to content

Commit dec585d

Browse files
committed
Removed redundant seek in the P() function of PE95TIME.LUA.
1 parent d9b6894 commit dec585d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

demo/xtra/PE95TIME.LUA

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function C(x)return F:seek("cur",x)end
66
function S(x)return F:seek("set",x)end
77
function R(l)local b=F:read(l)if b and#b>=l then return string.unpack(l==2 and"<I2"or I,b)end error("!EOF")end
88
function W(p,v)S(p)F:write(string.pack(I,v))end
9-
function P()S(0)local mz=F:read(2)S(60)if mz=="MZ"then return R(4)end error("!MZ")end
9+
function P()local mz=F:read(2)S(60)if mz=="MZ"then return R(4)end error("!MZ")end
1010
function O()
1111
S(J)local s,n,h,m=F:read(4)if s~="PE\0\0"then error("!PE")end C(2)n=R(2)C(12)s=R(2)C(2)h,m=C(),R(2)
1212
if m~=267 then error("!10")end S(h+s)
@@ -20,6 +20,4 @@ function A(o,l,v)
2020
if(d&X)~=0 then A(d&(X-1),l+1,v or(l==1 and i==16))
2121
elseif v and l==3 then local r=C()S(K+d)B(R(4),R(4))S(r)end end end
2222
if #arg<1 then print(arg[0],"'PEFORMAT.EXE'\n\n"..H)os.exit(1)end
23-
F=assert(io.open(arg[1],"r+b"))J=P()W(J+8,V)O()
24-
A(0,1)F:close()
25-
print("OK")
23+
F=assert(io.open(arg[1],"r+b"))J=P()W(J+8,V)O()A(0,1)F:close()print("OK")

0 commit comments

Comments
 (0)