29 #ifndef HEADER_VERSION_HPP
30 #define HEADER_VERSION_HPP
32 #include "../my_config.h"
44 const U_I VERSION_FLAG_SAVED_EA_ROOT = 0x80;
45 const U_I VERSION_FLAG_SAVED_EA_USER = 0x40;
46 const U_I VERSION_FLAG_SCRAMBLED = 0x20;
47 const U_I VERSION_FLAG_SEQUENCE_MARK = 0x10;
48 const U_I VERSION_FLAG_INITIAL_OFFSET = 0x08;
49 const U_I VERSION_FLAG_HAS_AN_EXTENDED_SIZE = 0x01;
50 const U_I VERSION_SIZE = 3;
51 const U_I HEADER_CRC_SIZE = 2;
77 f.
read(&algo_zip,
sizeof(algo_zip));
80 f.
read((
char *)&flag, 1);
83 if((flag & VERSION_FLAG_INITIAL_OFFSET) != 0)
84 initial_offset.read(f);
93 if((edition == empty_archive_version()))
94 throw Erange(
"header_version::read", gettext(
"Consistency check failed for archive header"));
97 crc *coh = create_crc_from_file(f);
103 if(
typeid(*coh) !=
typeid(*ctrl))
105 if(coh->get_size() != ctrl->get_size())
111 throw Erange(
"header_version::read", gettext(
"Consistency check failed for archive header"));
122 if(initial_offset == 0)
142 if(initial_offset != 0)
143 flag |= VERSION_FLAG_INITIAL_OFFSET;
145 flag &= ~VERSION_FLAG_INITIAL_OFFSET;
151 f.
write(&algo_zip,
sizeof(algo_zip));
153 f.
write((
char *)&flag, 1);
154 if(initial_offset != 0)
155 initial_offset.dump(f);