Skip to content

Commit

Permalink
From Alaxandre Irion, "Trying to load the attached texture file "text…
Browse files Browse the repository at this point in the history
…ure.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."
  • Loading branch information
robertosfield committed Nov 5, 2010
1 parent b996ce7 commit a2c2608
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/osgPlugins/gz/ReaderWriterGZ.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit a2c2608

Please sign in to comment.