mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 10:48:30 +02:00
* raise exception when file not found.
git-svn-id: trunk@49166 -
This commit is contained in:
parent
5340d45a18
commit
763d287af4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user