26 #ifndef HEADER_VERSION_HPP
27 #define HEADER_VERSION_HPP
29 #include "../my_config.h"
41 const U_I VERSION_FLAG_SAVED_EA_ROOT = 0x80;
42 const U_I VERSION_FLAG_SAVED_EA_USER = 0x40;
43 const U_I VERSION_FLAG_SCRAMBLED = 0x20;
44 const U_I VERSION_FLAG_SEQUENCE_MARK = 0x10;
45 const U_I VERSION_FLAG_INITIAL_OFFSET = 0x08;
46 const U_I VERSION_FLAG_HAS_AN_EXTENDED_SIZE = 0x01;
47 const U_I VERSION_SIZE = 3;
48 const U_I HEADER_CRC_SIZE = 2;
74 f.
read(&algo_zip,
sizeof(algo_zip));
77 f.
read((
char *)&flag, 1);
80 if((flag & VERSION_FLAG_INITIAL_OFFSET) != 0)
81 initial_offset.read(f);
90 if((edition == empty_archive_version()))
91 throw Erange(
"header_version::read", gettext(
"Consistency check failed for archive header"));
94 crc *coh = create_crc_from_file(f);
100 if(
typeid(*coh) !=
typeid(*ctrl))
102 if(coh->get_size() != ctrl->get_size())
108 throw Erange(
"header_version::read", gettext(
"Consistency check failed for archive header"));
119 if(initial_offset == 0)
139 if(initial_offset != 0)
140 flag |= VERSION_FLAG_INITIAL_OFFSET;
142 flag &= ~VERSION_FLAG_INITIAL_OFFSET;
148 f.
write(&algo_zip,
sizeof(algo_zip));
150 f.
write((
char *)&flag, 1);
151 if(initial_offset != 0)
152 initial_offset.dump(f);