From db1421d32f901ee3a1b33212c3421570c85a0579 Mon Sep 17 00:00:00 2001 From: pixel Date: Sat, 27 Dec 2003 13:36:48 +0000 Subject: Fixing copy function --- lib/Handle.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Handle.cc b/lib/Handle.cc index 3d60fda..199aa4b 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Handle.cc,v 1.67 2003-12-27 01:51:41 pixel Exp $ */ +/* $Id: Handle.cc,v 1.68 2003-12-27 13:36:48 pixel Exp $ */ #include #include @@ -509,6 +509,9 @@ void copyone(Handle * s, Handle * d, ssize_t size) { unsigned char c; long r; + if (size < 0) + size = s->GetSize(); + for (i = 0; (i < size) || (size < 0); i++) { r = s->read(&c, 1); if (r == 0) { @@ -525,6 +528,9 @@ void copy(Handle * s, Handle * d, ssize_t size) { static unsigned char b[BSIZE]; long r; + if (size < 0) + size = s->GetSize(); + while (size) { if ((size > BSIZE) || (size < 0)) { r = s->read(b, BSIZE); -- cgit v1.2.3