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."
This commit is contained in:
Robert Osfield
2010-11-05 10:29:18 +00:00
parent 1c6e33bc7e
commit 95c7dc35d0

View File

@@ -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;