diff options
author | Hieu Hoang <fishandfrolick@gmail.com> | 2012-02-24 04:04:08 +0400 |
---|---|---|
committer | Hieu Hoang <fishandfrolick@gmail.com> | 2012-02-24 04:04:08 +0400 |
commit | de14bc2210a432d3f21412445666df7974434f91 (patch) | |
tree | 2420004653005b420ff1bd70f37b01c1aaaba1b5 /util/file_piece.cc | |
parent | 939ac15d0e0ef63a6c72d6779160abd7bad1e54e (diff) |
zlib changes. More strongly type gzFile variables. HAVE_ZLIB prob no longer works
Diffstat (limited to 'util/file_piece.cc')
-rw-r--r-- | util/file_piece.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/util/file_piece.cc b/util/file_piece.cc index cd5880132..17cd23cbb 100644 --- a/util/file_piece.cc +++ b/util/file_piece.cc @@ -18,20 +18,16 @@ #include <sys/types.h> #include <sys/stat.h> -#ifdef HAVE_ZLIB -#include <zlib.h> -#endif - namespace util { ParseNumberException::ParseNumberException(StringPiece value) throw() { *this << "Could not parse \"" << value << "\" into a number"; } -GZException::GZException(void *file) { +GZException::GZException(gzFile file) { #ifdef HAVE_ZLIB int num; - *this << gzerror( (gzFile) file, &num) << " from zlib"; + *this << gzerror( file, &num) << " from zlib"; #endif // HAVE_ZLIB } @@ -56,7 +52,7 @@ FilePiece::~FilePiece() { // zlib took ownership file_.release(); int ret; - if (Z_OK != (ret = gzclose( (gzFile) gz_file_))) { + if (Z_OK != (ret = gzclose(gz_file_))) { std::cerr << "could not close file " << file_name_ << " using zlib" << std::endl; abort(); } @@ -295,7 +291,7 @@ void FilePiece::ReadShift() { ssize_t read_return; #ifdef HAVE_ZLIB - read_return = gzread( (gzFile) gz_file_, static_cast<char*>(data_.get()) + already_read, default_map_size_ - already_read); + read_return = gzread(gz_file_, static_cast<char*>(data_.get()) + already_read, default_map_size_ - already_read); if (read_return == -1) throw GZException(gz_file_); if (total_size_ != kBadSize) { // Just get the position, don't actually seek. Apparently this is how you do it. . . |