Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorHieu Hoang <fishandfrolick@gmail.com>2012-02-24 04:04:08 +0400
committerHieu Hoang <fishandfrolick@gmail.com>2012-02-24 04:04:08 +0400
commitde14bc2210a432d3f21412445666df7974434f91 (patch)
tree2420004653005b420ff1bd70f37b01c1aaaba1b5 /util
parent939ac15d0e0ef63a6c72d6779160abd7bad1e54e (diff)
zlib changes. More strongly type gzFile variables. HAVE_ZLIB prob no longer works
Diffstat (limited to 'util')
-rw-r--r--util/file_piece.cc12
-rw-r--r--util/file_piece.hh8
2 files changed, 10 insertions, 10 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. . .
diff --git a/util/file_piece.hh b/util/file_piece.hh
index b81ac0e20..2e4a91bbd 100644
--- a/util/file_piece.hh
+++ b/util/file_piece.hh
@@ -13,6 +13,10 @@
#include <stdint.h>
+#ifdef HAVE_ZLIB
+#include <zlib.h>
+#endif
+
namespace util {
class ParseNumberException : public Exception {
@@ -23,7 +27,7 @@ class ParseNumberException : public Exception {
class GZException : public Exception {
public:
- explicit GZException(void *file);
+ explicit GZException(gzFile file);
GZException() throw() {}
~GZException() throw() {}
};
@@ -117,7 +121,7 @@ class FilePiece {
std::string file_name_;
#ifdef HAVE_ZLIB
- void *gz_file_;
+ gzFile gz_file_;
#endif // HAVE_ZLIB
};