summaryrefslogtreecommitdiff
path: root/lib/Handle.cc
diff options
context:
space:
mode:
authorpixel <pixel>2002-12-06 18:56:46 +0000
committerpixel <pixel>2002-12-06 18:56:46 +0000
commit99447043a97d4b54cfdf3c44d5866a5d59268c43 (patch)
treed757ccfc7d3c4a7b22343fe3ff0ee5eb6f0d626c /lib/Handle.cc
parente3e6c1d7688b350046fe3fe7c862f3b3a8c879c9 (diff)
Commit of the day.
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r--lib/Handle.cc28
1 files changed, 3 insertions, 25 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 0470929..27426ab 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -9,17 +9,12 @@
#include "Handle.h"
#include "gettext.h"
-Handle::Handle(const Handle & nh) : itell(0), h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed)
-#ifdef HAVE_ZLIB
-, zfile(0), z(0)
-#endif
+Handle::Handle(const Handle & nh) : itell(0), h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed), zfile(0), z(0)
{
// cerr << "Duplication of handle " << nh.h << " to " << h << endl;
-#ifdef HAVE_ZLIB
if ((h >= 0) && (nh.z)) {
SetZ(nh.z);
}
-#endif
}
Handle::~Handle() {
@@ -27,10 +22,7 @@ Handle::~Handle() {
close();
}
-Handle::Handle(int nh) : h(nh), closed(false), nonblock(false)
-#ifdef HAVE_ZLIB
-, zfile(0), z(0)
-#endif
+Handle::Handle(int nh) : h(nh), closed(false), nonblock(false), zfile(0), z(0)
{
// cerr << "Initialising handle " << h << endl;
}
@@ -162,7 +154,6 @@ void Handle::close() throw (GeneralException) {
}
if (h >= 0) {
-#ifdef HAVE_ZLIB
if (z) {
// cerr << "Performing gzclose on handle " << h << endl;
int err = gzclose(zfile);
@@ -175,9 +166,6 @@ void Handle::close() throw (GeneralException) {
}
}
} else {
-#else
- {
-#endif
int err = ::close(h);
if (err) {
throw GeneralException(String(_("Error during close: ")) + strerror(errno));
@@ -221,7 +209,6 @@ void Handle::Dup(const Handle & H) {
}
}
-#ifdef HAVE_ZLIB
void Handle::SetZ(int az) throw (GeneralException) {
if (z) {
throw GeneralException(_("Can't SetZ a Handle twice."));
@@ -247,14 +234,12 @@ void Handle::SetZ(int az) throw (GeneralException) {
z = az;
}
}
-#endif
ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException) {
-#ifdef HAVE_ZLIB
if (z) {
itell += count;
// cerr << "Performing gzwrite of " << count << " byte for handle " << h << endl;
-#ifdef HAVE_CLEAN_ZLIB
+#ifdef HAVE_WD_ZLIB
int err = gzwrite(zfile, buf, count);
#else
int err = gzwrite(zfile, (char *) buf, count);
@@ -270,16 +255,12 @@ ssize_t Handle::uwrite(const void * buf, size_t count) throw (GeneralException)
}
return err;
} else {
-#else
- {
-#endif
itell += count = ::write(h, buf, count);
return count;
}
}
ssize_t Handle::uread(void * buf, size_t count) {
-#ifdef HAVE_ZLIB
if (z) {
itell += count;
// cerr << "Performing gzread of " << count << " byte for handle " << h << endl;
@@ -295,9 +276,6 @@ ssize_t Handle::uread(void * buf, size_t count) {
}
return err;
} else {
-#else
- {
-#endif
itell += count = ::read(h, buf, count);
return count;
}