bool MMRDecoder::decode_header( ByteStream &inp, int &width, int &height, int &invert) { unsigned long int magic = inp.read32(); if((magic&0xfffffffc) != 0x4d4d5200) G_THROW( ERR_MSG("MMRDecoder.unrecog_header") ); invert = ((magic & 0x1) ? 1 : 0); const bool strip = ((magic & 0x2) ? 1 : 0); width = inp.read16(); height = inp.read16(); if (width<=0 || height<=0) G_THROW( ERR_MSG("MMRDecoder.bad_header") ); return strip; }
void DjVmDir0::decode(ByteStream & bs) // WARNING! make sure, that get_size(), encode() and decode() are in sync { name2file.empty(); num2file.empty(); for(int i=bs.read16();i>0;i--) { GUTF8String name; char ch; while(bs.read(&ch, 1) && ch) name+=ch; bool iff_file=bs.read8()?true:false; int offset=bs.read32(); int size=bs.read32(); add_file(name, iff_file, offset, size); }; }