| 44 | |
| 45 | template <typename Source> |
| 46 | BSDiffStatus MBS_ReadHeader(Source & src, MBSPatchHeader* header) { |
| 47 | src.Read(header->tag, sizeof(header->tag)); |
| 48 | header->slen = ReadVarUint<uint32_t>(src); |
| 49 | header->scrc32 = ReadVarUint<uint32_t>(src); |
| 50 | header->dlen = ReadVarUint<uint32_t>(src); |
| 51 | |
| 52 | // The string will have a NUL terminator that we don't use, hence '-1'. |
| 53 | static_assert(sizeof(MBS_PATCH_HEADER_TAG) - 1 == sizeof(header->tag), |
| 54 | "MBS_PATCH_HEADER_TAG must match header field size"); |
| 55 | if (memcmp(header->tag, MBS_PATCH_HEADER_TAG, 8) != 0) |
| 56 | return UNEXPECTED_ERROR; |
| 57 | |
| 58 | return OK; |
| 59 | } |
| 60 | |
| 61 | inline std::string DebugPrint(BSDiffStatus status) { |
| 62 | switch (status) { |
no test coverage detected