mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
Rolled back unnecessary gzFile casts.
This commit is contained in:
parent
c7f18473aa
commit
1b666bdf01
@ -382,10 +382,10 @@ void Model::zipFile()
|
|||||||
char inbuffer[128];
|
char inbuffer[128];
|
||||||
int num_read;
|
int num_read;
|
||||||
while ((num_read = fread(inbuffer, 1, sizeof(inbuffer), file)) > 0) {
|
while ((num_read = fread(inbuffer, 1, sizeof(inbuffer), file)) > 0) {
|
||||||
gzwrite((gzFile)gzfile, inbuffer, num_read);
|
gzwrite(gzfile, inbuffer, num_read);
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
gzclose((gzFile)gzfile);
|
gzclose(gzfile);
|
||||||
|
|
||||||
//Remove the unzipped file
|
//Remove the unzipped file
|
||||||
remove(filename.c_str());
|
remove(filename.c_str());
|
||||||
|
@ -27,7 +27,7 @@ ParseNumberException::ParseNumberException(StringPiece value) throw() {
|
|||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
GZException::GZException(gzFile file) {
|
GZException::GZException(gzFile file) {
|
||||||
int num;
|
int num;
|
||||||
*this << gzerror((gzFile)file, &num) << " from zlib";
|
*this << gzerror(file, &num) << " from zlib";
|
||||||
}
|
}
|
||||||
#endif // HAVE_ZLIB
|
#endif // HAVE_ZLIB
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ FilePiece::~FilePiece() {
|
|||||||
// zlib took ownership
|
// zlib took ownership
|
||||||
file_.release();
|
file_.release();
|
||||||
int ret;
|
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;
|
std::cerr << "could not close file " << file_name_ << " using zlib" << std::endl;
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ void FilePiece::ReadShift() {
|
|||||||
|
|
||||||
ssize_t read_return;
|
ssize_t read_return;
|
||||||
#ifdef HAVE_ZLIB
|
#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 (read_return == -1) throw GZException(gz_file_);
|
||||||
if (total_size_ != kBadSize) {
|
if (total_size_ != kBadSize) {
|
||||||
// Just get the position, don't actually seek. Apparently this is how you do it. . .
|
// Just get the position, don't actually seek. Apparently this is how you do it. . .
|
||||||
|
Loading…
Reference in New Issue
Block a user