MCPcopy Create free account
hub / github.com/ccache/ccache / parse

Method parse

src/ccache/core/cacheentry.cpp:148–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148void
149CacheEntry::Header::parse(std::span<const uint8_t> data)
150{
151 CacheEntryDataReader reader(data);
152 reader.read_int(magic);
153 if (magic != core::k_ccache_magic) {
154 throw core::Error(FMT("Bad magic value: 0x{:04x}", magic));
155 }
156
157 reader.read_int(entry_format_version);
158 if (entry_format_version != k_format_version) {
159 throw core::Error(
160 FMT("Unknown entry format version: {}", entry_format_version));
161 }
162
163 entry_type = cache_entry_type_from_int(reader.read_int<uint8_t>());
164 compression_type = compression_type_from_int(reader.read_int<uint8_t>());
165 reader.read_int(compression_level);
166 self_contained = bool(reader.read_int<uint8_t>());
167 reader.read_int(creation_time);
168 ccache_version = reader.read_str(reader.read_int<uint8_t>());
169 namespace_ = reader.read_str(reader.read_int<uint8_t>());
170 reader.read_int(entry_size);
171}
172
173size_t
174CacheEntry::Header::serialized_size() const

Callers

nothing calls this directly

Calls 5

read_intMethod · 0.80
read_strMethod · 0.80
ErrorClass · 0.70

Tested by

no test coverage detected