MCPcopy Create free account
hub / github.com/diasurgical/devilution / ReadMPQHeader

Function ReadMPQHeader

Source/mpqapi.cpp:308–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308bool ReadMPQHeader(Archive *archive, _FILEHEADER *hdr)
309{
310 const bool has_hdr = archive->size >= sizeof(*hdr);
311 if (has_hdr) {
312 if (!archive->stream.read(reinterpret_cast<char *>(hdr), sizeof(*hdr)))
313 return false;
314 ByteSwapHdr(hdr);
315 }
316 if (!has_hdr || !IsValidMPQHeader(*archive, hdr)) {
317 InitDefaultMpqHeader(archive, hdr);
318 }
319 return true;
320}
321
322} // namespace
323

Callers 1

OpenMPQFunction · 0.85

Calls 4

ByteSwapHdrFunction · 0.85
IsValidMPQHeaderFunction · 0.85
InitDefaultMpqHeaderFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected