diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Handle.cc | 4 | ||||
-rw-r--r-- | lib/Input.cc | 14 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc index 912e779..2233722 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -95,6 +95,10 @@ ssize_t Handle::write(const void *cbuf, size_t count) throw (GeneralException) { ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) { ssize_t r; + +#ifdef DEBUG + std::cerr << "read: reading " << count << " bytes from handle " << GetHandle() << std::endl; +#endif errno = 0; while ((r = uread(buf, count)) < 0) { diff --git a/lib/Input.cc b/lib/Input.cc index 7427c38..e9b859a 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -20,12 +20,12 @@ #define S_ISREG(x) 1 #endif -#define DEBUG - #define BUILTIN_SIG 0x5141504e +static Input::openresults_t gresults; + Input::Input(const String & no) throw (GeneralException) : - Handle(no.strlen() ? wrapopen(no, &results) : dup(0)), + Handle(no.strlen() ? wrapopen(no, &gresults) : dup(0)), n(no) { #ifdef DEBUG @@ -36,6 +36,9 @@ Input::Input(const String & no) throw (GeneralException) : throw IOGeneral(String(_("Error opening file ")) + no + _(" for reading: ") + strerror(errno)); } + results = gresults; + + fromarchive = false; if (results.name == "") { struct stat s; fstat(GetHandle(), &s); @@ -51,6 +54,7 @@ Input::Input(const String & no) throw (GeneralException) : read(&size, 4); date_modif = 0; SetZ(); + fromarchive = true; } } @@ -86,7 +90,7 @@ time_t Input::GetModif() const { } off_t Input::seek(off_t offset, int whence) throw (GeneralException) { - if (results.name == "") { + if (!fromarchive) { if ((itell = lseek(GetHandle(), offset, whence)) < 0) { throw IOGeneral(String(_("Error seeking file ")) + GetName() + _(": ") + strerror(errno)); } @@ -119,7 +123,7 @@ int Input::wrapopen(const String & fname, openresults_t * results) { } void Input::SetZ(int l) throw(GeneralException) { - if (results.name == "") + if (!fromarchive) Handle::SetZ(l); } |