From 95c7dc35d07e8d9e49dd764bdf559de48b497c6b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 5 Nov 2010 10:29:18 +0000 Subject: [PATCH] From Alaxandre Irion, "Trying to load the attached texture file "texture.dds.gz" fails and causes the following warning on the console: ReadDDSFile warning: couldn't read mipmapData The issue is caused, when the last block of data is read from the file (less than chunk size of 16384 bytes). The read operation in ReaderWriterGZ::read() then sets the eof and fail bit in the stream and the lines if (fin.fail()) { (void)inflateEnd(&strm); return false; } causes the reading to be aborted with the last read data not beeing inflated. Please find the attached fix for this problem." --- src/osgPlugins/gz/ReaderWriterGZ.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/gz/ReaderWriterGZ.cpp b/src/osgPlugins/gz/ReaderWriterGZ.cpp index a0566b957..e77464e10 100644 --- a/src/osgPlugins/gz/ReaderWriterGZ.cpp +++ b/src/osgPlugins/gz/ReaderWriterGZ.cpp @@ -261,8 +261,8 @@ bool ReaderWriterGZ::read(std::istream& fin, std::string& destination) const fin.read((char*)in, CHUNK); strm.avail_in = fin.gcount(); - - if (fin.fail()) + + if (fin.bad()) { (void)inflateEnd(&strm); return false;