| 163 | } |
| 164 | |
| 165 | void IFFFile::Chunk::readHeader( std::streampos *pos ) |
| 166 | { |
| 167 | m_file->m_iStream->seekg( *pos, std::ios_base::beg ); |
| 168 | |
| 169 | // read type |
| 170 | char tagBuffer[IFFFile::Tag::TagSize]; |
| 171 | m_file->m_iStream->read( tagBuffer, IFFFile::Tag::TagSize ); |
| 172 | m_type = IFFFile::Tag( tagBuffer ); |
| 173 | |
| 174 | // read dataSize |
| 175 | m_file->m_iStream->read( (char *)&m_dataSize, sizeof(m_dataSize) ); |
| 176 | m_dataSize = asBigEndian( m_dataSize ); |
| 177 | |
| 178 | if ( isGroup() ) |
| 179 | { |
| 180 | // read groupName |
| 181 | m_file->m_iStream->read( tagBuffer, IFFFile::Tag::TagSize ); |
| 182 | m_groupName = IFFFile::Tag( tagBuffer ); |
| 183 | |
| 184 | // modify dataSize |
| 185 | m_dataSize -= IFFFile::Tag::TagSize; |
| 186 | |
| 187 | // calculate alignment quota |
| 188 | m_alignmentQuota = alignmentQuota(); |
| 189 | } |
| 190 | |
| 191 | // set the file position of the data |
| 192 | m_filePosition = m_file->m_iStream->tellg(); |
| 193 | *pos = m_filePosition; |
| 194 | } |
| 195 | |
| 196 | void IFFFile::Chunk::read( std::string &data ) |
| 197 | { |