Skip to content

Commit f12722b

Browse files
committed
Fixed case where classic mac line ending could cause an infinite loop.
1 parent ad25ec8 commit f12722b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xtra/DIFF.LUA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local function diff_u(fn1,fn2)
66
local function crc32(s)local c=M for i=1,#s do local byte=s:byte(i)c=(c >> 8)~CT[(c~byte)&0xFF]end return(~c)&M end
77
local o,p=0,""while 1 do local ls,l=o,{}
88
while 1 do local c=f:read(1)if not c then break end
9-
local function eol()if c=='\r'then local d=f:read(1)f:seek("cur",-1)return d~='\n'end return c=='\n'end
9+
local function eol()if c=='\r'then local d=f:read(1)if not d then return true end f:seek("cur",-1)return d~='\n'end return c=='\n'end
1010
o=o+1 table.insert(l,c)if eol()then break end end
1111
if #l==0 then break end l=table.concat(l)local ln,c=#l,crc32(l)p=p..string.pack(PF,ln,c,ls)end f:close()return p end
1212
local f1,f2,ps,la=open(fn1),open(fn2),string.packsize(PF)

0 commit comments

Comments
 (0)