* Use dyn array of byte for CRC buffer

This commit is contained in:
Michaël Van Canneyt 2025-03-18 15:11:08 +01:00
parent 1068015c4d
commit 480200a708

View File

@ -191,7 +191,7 @@ Implementation
fs : TCStream; fs : TCStream;
bufcount, bufcount,
bufsize : Integer; bufsize : Integer;
buf : pbyte; buf : TByteDynArray;
begin begin
result:=0; result:=0;
bufsize:=64*1024; bufsize:=64*1024;
@ -202,12 +202,12 @@ Implementation
Comment(V_Error,'Can''t open file: '+fn); Comment(V_Error,'Can''t open file: '+fn);
exit; exit;
end; end;
getmem(buf,bufsize); setlength(buf,bufsize);
repeat repeat
bufcount:=fs.Read(buf^,bufsize); bufcount:=fs.Read(buf[0],bufsize);
result:=UpdateCrc32(result,buf^,bufcount); result:=UpdateCrc32(result,buf[0],bufcount);
until bufcount<bufsize; until bufcount<bufsize;
freemem(buf); buf:=nil;
fs.Free; fs.Free;
end; end;