From e5ee1c9f673ad821e72a5db54cb03d1fe5905438 Mon Sep 17 00:00:00 2001 From: sergei Date: Thu, 12 Jul 2012 16:10:34 +0000 Subject: [PATCH] * 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 - --- compiler/owbase.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/owbase.pas b/compiler/owbase.pas index ac90487825..082db2eef7 100644 --- a/compiler/owbase.pas +++ b/compiler/owbase.pas @@ -72,6 +72,7 @@ type function read(out b;len:longint):boolean;virtual; function readarray(a:TDynamicArray;len:longint):boolean; property filename : string read getfilename; + property size:longint read bufmax; end; implementation @@ -240,9 +241,9 @@ begin exit; end; ffilename:=fn; - getmem(buf,f.Size); - f.read(buf^,f.Size); bufmax:=f.Size; + getmem(buf,bufmax); + f.read(buf^,bufmax); f.free; bufidx:=0; opened:=true;