From 89a43700b18c61d209ffb68db57e020f11a2daa9 Mon Sep 17 00:00:00 2001
From: Pixel <Pixel>
Date: Sat, 10 Aug 2002 22:59:40 +0000
Subject: Nighty commit

---
 generic/Handle.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'generic')

diff --git a/generic/Handle.cpp b/generic/Handle.cpp
index 8b7a278..d46fc22 100644
--- a/generic/Handle.cpp
+++ b/generic/Handle.cpp
@@ -10,7 +10,7 @@
 #define _(x) x
 #endif
 
-Handle::Handle(const Handle & nh) : h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed), zfile(0), z(0) {
+Handle::Handle(const Handle & nh) : h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed), zfile(0), z(0), itell(0) {
 //    cerr << "Duplication of handle " << nh.h << " to " << h << endl;
     if ((h >= 0) && (nh.z)) {
 	SetZ(nh.z);
@@ -232,6 +232,7 @@ void Handle::SetZ(int az) throw (GeneralException) {
 
 ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException) {
     if (z) {
+	itell += count;
 //	cerr << "Performing gzwrite of " << count << " byte for handle " << h << endl;
 	int err = gzwrite(zfile, buf, count);
 //	cerr << "gzwrite returned " << err << endl;
@@ -245,12 +246,13 @@ ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException)
 	}
 	return err;
     } else {
-	return ::write(h, buf, count);
+	itell += count = ::write(h, buf, count);
     }
 }
 
 ssize_t Handle::uread(void * buf, size_t count) {
     if (z) {
+	itell += count;
 //	cerr << "Performing gzread of " << count << " byte for handle " << h << endl;
 	int err = gzread(zfile, buf, count);
 //	cerr << "gzwrite returned " << err << endl;
@@ -264,6 +266,11 @@ ssize_t Handle::uread(void * buf, size_t count) {
 	}
 	return err;
     } else {
-	return ::read(h, buf, count);
+	itell += count = ::read(h, buf, count);
+	return count;
     }
 }
+
+off_t Handle::tell() {
+    return itell;
+}
-- 
cgit v1.2.3