* raise exception when file not found.

git-svn-id: trunk@49166 -
This commit is contained in:
marco 2021-04-10 14:26:20 +00:00
parent 5340d45a18
commit 763d287af4

View File

@ -51,6 +51,8 @@ function SHA1Match(const Digest1, Digest2: TSHA1Digest): Boolean;
implementation
uses sysutils,sysconst;
// inverts the bytes of (Count div 4) cardinals from source to target.
procedure Invert(Source, Dest: Pointer; Count: PtrUInt);
var
@ -257,6 +259,11 @@ begin
SHA1Final(Context, Result);
end;
procedure RaiseFileNotFoundException(const fn : String);
begin
raise EFileNotFoundException.Create(SFileNotFound);
end;
function SHA1File(const Filename: String; const Bufsize: PtrUInt): TSHA1Digest;
var
F: File;
@ -284,7 +291,9 @@ begin
until Count < BufSize;
FreeMem(Buf, BufSize);
Close(F);
end;
end
else
RaiseFileNotFoundException(FileName);
SHA1Final(Context, Result);
FileMode := ofm;