summaryrefslogtreecommitdiff
path: root/decoder/filelib.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-21 02:54:09 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-21 02:54:09 +0000
commit9c763a8c5863bd7a576cfe67c38672a0cf71b06a (patch)
tree06fb0649b56f1fc9a739b1b90c9c5e49be5b6aa9 /decoder/filelib.h
parenta875e8dc40128a3b876dfc0387aa64bb669fabd4 (diff)
vest generate options valgrind fix
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@352 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/filelib.h')
-rw-r--r--decoder/filelib.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/decoder/filelib.h b/decoder/filelib.h
index 85e1c29a..9f6bd0a9 100644
--- a/decoder/filelib.h
+++ b/decoder/filelib.h
@@ -58,9 +58,10 @@ class ReadFile : public BaseFile<std::istream> {
std::cerr << "File does not exist: " << filename << std::endl;
abort();
}
+ char const* file=filename_.c_str(); // just in case the gzstream keeps using the filename for longer than the constructor, e.g. inflateReset2. warning in valgrind that I'm hoping will disappear - it makes no sense.
ps_.reset(EndsWith(filename, ".gz") ?
- static_cast<std::istream*>(new igzstream(filename.c_str())) :
- static_cast<std::istream*>(new std::ifstream(filename.c_str())));
+ static_cast<std::istream*>(new igzstream(file)) :
+ static_cast<std::istream*>(new std::ifstream(file)));
if (!*ps_) {
std::cerr << "Failed to open " << filename << std::endl;
abort();
@@ -79,9 +80,10 @@ class WriteFile : public BaseFile<std::ostream> {
if (is_std()) {
ps_=PS(&std::cout,file_null_deleter());
} else {
+ char const* file=filename_.c_str(); // just in case the gzstream keeps using the filename for longer than the constructor, e.g. inflateReset2. warning in valgrind that I'm hoping will disappear - it makes no sense.
ps_.reset(EndsWith(filename, ".gz") ?
- static_cast<std::ostream*>(new ogzstream(filename.c_str())) :
- static_cast<std::ostream*>(new std::ofstream(filename.c_str())));
+ static_cast<std::ostream*>(new ogzstream(file)) :
+ static_cast<std::ostream*>(new std::ofstream(file)));
if (!*ps_) {
std::cerr << "Failed to open " << filename << std::endl;
abort();