mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 07:49:08 +02:00
* Raise exception for fileseek positions that do not fit in longing. Issue #39407
This commit is contained in:
parent
1e74c418ae
commit
e97e27b8d5
@ -41,6 +41,7 @@ const
|
|||||||
SDispatchError = 'No variant method call dispatch';
|
SDispatchError = 'No variant method call dispatch';
|
||||||
SDivByZero = 'Division by zero';
|
SDivByZero = 'Division by zero';
|
||||||
SEndOfFile = 'Read past end of file';
|
SEndOfFile = 'Read past end of file';
|
||||||
|
SErrPosToBigForLongint = 'File position %d too big to fit in 32-bit integer; Use Int64 overload instead';
|
||||||
SErrInvalidDateMonthWeek = 'Year %d, month %d, Week %d and day %d is not a valid date.';
|
SErrInvalidDateMonthWeek = 'Year %d, month %d, Week %d and day %d is not a valid date.';
|
||||||
SerrInvalidHourMinuteSecMsec = '%d:%d:%d.%d is not a valid time specification';
|
SerrInvalidHourMinuteSecMsec = '%d:%d:%d.%d is not a valid time specification';
|
||||||
SErrInvalidDateWeek = '%d %d %d is not a valid dateweek';
|
SErrInvalidDateWeek = '%d %d %d is not a valid dateweek';
|
||||||
|
@ -525,8 +525,14 @@ end;
|
|||||||
|
|
||||||
Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
|
Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
|
||||||
|
|
||||||
|
Var
|
||||||
|
I : Int64;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
result:=longint(FileSeek(Handle,int64(FOffset),Origin));
|
I:=FileSeek(Handle,int64(FOffset),Origin);
|
||||||
|
if I>High(Longint) then
|
||||||
|
Raise EInOutError.CreateFmt(SErrPosToBigForLongint,[I]);
|
||||||
|
result:=I;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user