From 9d55df2bd56edf466ccd975bbdbe2594e0931b19 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 30 Oct 2003 16:30:53 +0000 Subject: [PATCH] * merged copyfrom with 0 --- rtl/objpas/classes/streams.inc | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/rtl/objpas/classes/streams.inc b/rtl/objpas/classes/streams.inc index b685a78ade..0c6a4df3c7 100644 --- a/rtl/objpas/classes/streams.inc +++ b/rtl/objpas/classes/streams.inc @@ -158,18 +158,22 @@ begin CopyFrom:=0; + If (Count=0) then + begin + // This WILL fail for non-seekable streams... + Source.Position:=0; + Count:=Source.Size; + end; while Count>0 do begin - if (Count>sizeof(buffer)) then - i:=sizeof(Buffer) - else - i:=Count; - i:=Source.Read(buffer,i); - i:=Write(buffer,i); - dec(count,i); - CopyFrom:=CopyFrom+i; - if i=0 then - exit; + if (Count>sizeof(buffer)) then + i:=sizeof(Buffer) + else + i:=Count; + i:=Source.Read(buffer,i); + i:=Write(buffer,i); + dec(count,i); + CopyFrom:=CopyFrom+i; end; end; @@ -783,8 +787,14 @@ end; { $Log$ - Revision 1.1 2003-10-06 21:01:06 peter - * moved classes unit to rtl + Revision 1.2 2003-10-30 16:30:53 peter + * merged copyfrom with 0 + + Revision 1.3 2003/10/28 22:04:29 michael + + Fixed private seeksupport stuff + + Revision 1.2 2003/10/26 14:52:29 michael + + Fixed TStream.CopyFrom with Count=0 Revision 1.13 2003/07/26 16:20:50 michael + Fixed readstring from TStringStream (