MCPcopy Create free account
hub / github.com/comaps/comaps / MakeDiffVersion0

Function MakeDiffVersion0

libs/mwm_diff/diff.cpp:31–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29};
30
31bool MakeDiffVersion0(FileReader & oldReader, FileReader & newReader, FileWriter & diffFileWriter)
32{
33 std::vector<uint8_t> diffBuf;
34 MemWriter<std::vector<uint8_t>> diffMemWriter(diffBuf);
35
36 auto const status = bsdiff::CreateBinaryPatch(oldReader, newReader, diffMemWriter);
37
38 if (status != bsdiff::BSDiffStatus::OK)
39 {
40 LOG(LERROR, ("Could not create patch with bsdiff:", status));
41 return false;
42 }
43
44 using Deflate = coding::ZLib::Deflate;
45 Deflate deflate(Deflate::Format::ZLib, Deflate::Level::BestCompression);
46
47 std::vector<uint8_t> deflatedDiffBuf;
48 deflate(diffBuf.data(), diffBuf.size(), back_inserter(deflatedDiffBuf));
49
50 // A basic header that holds only version.
51 WriteToSink(diffFileWriter, static_cast<uint32_t>(VERSION_V0));
52 diffFileWriter.Write(deflatedDiffBuf.data(), deflatedDiffBuf.size());
53
54 return true;
55}
56
57generator::mwm_diff::DiffApplicationResult ApplyDiffVersion0(FileReader & oldReader, FileWriter & newWriter,
58 ReaderSource<FileReader> & diffFileSource,

Callers 1

MakeDiffFunction · 0.85

Calls 5

CreateBinaryPatchFunction · 0.85
WriteToSinkFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected