diff options
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/FileInputSource.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libqpdf/FileInputSource.cc b/libqpdf/FileInputSource.cc index 1a0c2653..2c610801 100644 --- a/libqpdf/FileInputSource.cc +++ b/libqpdf/FileInputSource.cc @@ -102,11 +102,12 @@ FileInputSource::tell() void FileInputSource::seek(qpdf_offset_t offset, int whence) { - QUtil::os_wrapper( - (std::string("seek to ") + this->filename + ", offset " + - QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) + - ")"), - QUtil::seek(this->file, offset, whence)); + if (QUtil::seek(this->file, offset, whence) == -1) { + QUtil::throw_system_error( + std::string("seek to ") + this->filename + ", offset " + + QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) + + ")"); + } } void @@ -140,7 +141,7 @@ FileInputSource::read(char* buffer, size_t length) void FileInputSource::unreadCh(char ch) { - QUtil::os_wrapper( - this->filename + ": unread character", - ungetc(static_cast<unsigned char>(ch), this->file)); + if (ungetc(static_cast<unsigned char>(ch), this->file) == -1) { + QUtil::throw_system_error(this->filename + ": unread character"); + } } |