mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 17:29:33 +02:00
* Don't access tcfilestream.size 3 times in sequence, as each access costs two seeks (syscalls).
+ made size of tobjectreader data available via property. git-svn-id: trunk@21905 -
This commit is contained in:
parent
dd59db1bba
commit
e5ee1c9f67
@ -72,6 +72,7 @@ type
|
|||||||
function read(out b;len:longint):boolean;virtual;
|
function read(out b;len:longint):boolean;virtual;
|
||||||
function readarray(a:TDynamicArray;len:longint):boolean;
|
function readarray(a:TDynamicArray;len:longint):boolean;
|
||||||
property filename : string read getfilename;
|
property filename : string read getfilename;
|
||||||
|
property size:longint read bufmax;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -240,9 +241,9 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
ffilename:=fn;
|
ffilename:=fn;
|
||||||
getmem(buf,f.Size);
|
|
||||||
f.read(buf^,f.Size);
|
|
||||||
bufmax:=f.Size;
|
bufmax:=f.Size;
|
||||||
|
getmem(buf,bufmax);
|
||||||
|
f.read(buf^,bufmax);
|
||||||
f.free;
|
f.free;
|
||||||
bufidx:=0;
|
bufidx:=0;
|
||||||
opened:=true;
|
opened:=true;
|
||||||
|
Loading…
Reference in New Issue
Block a user