summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2003-12-27 13:36:48 +0000
committerpixel <pixel>2003-12-27 13:36:48 +0000
commitdb1421d32f901ee3a1b33212c3421570c85a0579 (patch)
treeeced1c5ebf33a49a722eaf5858173fbae2fbe15d
parent63cc0687e978f9d93ff2dd569e19c9f6a713a8bd (diff)
Fixing copy function
-rw-r--r--lib/Handle.cc8
1 files changed, 7 insertions, 1 deletions
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 <stdio.h>
#include <string.h>
@@ -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);