summaryrefslogtreecommitdiff
path: root/generic/Handle.cpp
diff options
context:
space:
mode:
authorPixel <Pixel>2002-08-10 22:59:40 +0000
committerPixel <Pixel>2002-08-10 22:59:40 +0000
commit89a43700b18c61d209ffb68db57e020f11a2daa9 (patch)
tree5a3fb40b511a85a5c4853dcea3edc23079d7f928 /generic/Handle.cpp
parent4b6d43a6a5146b0165d05a66c70b2a39ab8980f4 (diff)
Nighty commit
Diffstat (limited to 'generic/Handle.cpp')
-rw-r--r--generic/Handle.cpp13
1 files changed, 10 insertions, 3 deletions
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;
+}