Removing the game gui files from the gui directory.
[fail.git] / abf / reader-DGST.h
blobd452fcd61a4e5695f56711c6ffe2583fb2fa4939
1 #ifndef AWFUL_ABF_READER_DGST_H
2 #define AWFUL_ABF_READER_DGST_H
4 namespace awful { namespace abf
5 {
6 template< class EndianessPolicy > bool BaseReader< EndianessPolicy >::
7 ReadDGST( buffered_stream_type& Stream )
9 const char dgst[] = { 'D', 'G', 'S', 'T' };
10 char chunkid[4];
12 Stream.read( chunkid, sizeof( chunkid ) );
14 while( memcmp( dgst, chunkid, sizeof( chunkid ) ) )
16 uint32_t size = Stream.readU32();
17 Stream.seek( Stream.tell() + size );
18 if( Stream.read( chunkid, sizeof( chunkid ) ) != sizeof( chunkid ) )
20 // TODO: throw
21 std::cout << "ABF reader: DGST chunk not found\n";
25 uint32_t size = Stream.readU32();
26 bool bDigestCheckOk = true;
28 while( size )
30 uint64_t digest = Stream.readU64();
31 bDigestCheckOk = bDigestCheckOk && Impl::Digests.find( digest ) != Impl::Digests.end();
32 size -= 8;
35 return bDigestCheckOk;
39 #endif