Skip to content

Commit

Permalink
Merge remote-tracking branch 'robux4/crc_write'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbunkus committed Feb 24, 2024
2 parents ab8f30a + 3db777e commit 209ad33
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/EbmlCrc32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +187,10 @@ bool EbmlCrc32::CheckElementCRC32(EbmlElement &ElementToCRC) const

filepos_t EbmlCrc32::RenderData(IOCallback & output, bool /* bForceRender */, const ShouldWrite & /* writeFilter */)
{
filepos_t Result = 4;
static_assert(sizeof(m_crc_final) == 4, "Bogus CRC internal size");
output.writeFully(&m_crc_final, 4);

if (Result != 0) {
output.writeFully(&m_crc_final, Result);
}

if (Result < GetDefaultSize()) {
// pad the rest with 0
auto Pad = std::make_unique<binary>(GetDefaultSize() - Result);
if (Pad != nullptr) {
output.writeFully(Pad.get(), GetDefaultSize() - Result);

Result = GetDefaultSize();
}
}

return Result;
return 4;
}

filepos_t EbmlCrc32::ReadData(IOCallback & input, ScopeMode ReadFully)
Expand Down

0 comments on commit 209ad33

Please sign in to comment.