| 306 | } |
| 307 | |
| 308 | bool 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 |
no test coverage detected