diff options
author | Tianjie Xu <xunchang@google.com> | 2017-11-20 11:05:55 -0800 |
---|---|---|
committer | Tianjie Xu <xunchang@google.com> | 2018-01-18 12:32:09 -0800 |
commit | 1f1cdb2b6baa562d9858fb2324a85382b9ea963e (patch) | |
tree | 09001b1fbab3208c6f397f551761c01b68e82f36 /patch_writer_factory.cc | |
parent | 0474f1be4516b74635b21bba729a04273ea31d41 (diff) | |
download | bsdiff-1f1cdb2b6baa562d9858fb2324a85382b9ea963e.tar.gz |
Add an argument parser in bsdiff
Add a parser of format, type and quality in the bsdiff main function.
This allow the bsdiff binary to choose between the BSDFF40|BSDF2 patch
format and compress the patch with desired algorithms.
Bug: 34220646
Test: unittest pass; generate brotli compressed patches with bsdiff
binary
Change-Id: Ia4f7941e4eca7e6047e2749315127d1cf4a988ee
Diffstat (limited to 'patch_writer_factory.cc')
-rw-r--r-- | patch_writer_factory.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/patch_writer_factory.cc b/patch_writer_factory.cc index d24cffe..95bfe32 100644 --- a/patch_writer_factory.cc +++ b/patch_writer_factory.cc @@ -9,11 +9,18 @@ namespace bsdiff { -// TODO(xunchang) choose the bsdiff format based on the input parameter. std::unique_ptr<PatchWriterInterface> CreateBsdiffPatchWriter( const std::string& patch_filename) { return std::unique_ptr<PatchWriterInterface>( - new BsdiffPatchWriter(patch_filename, BsdiffFormat::kLegacy)); + new BsdiffPatchWriter(patch_filename)); +} + +std::unique_ptr<PatchWriterInterface> CreateBSDF2PatchWriter( + const std::string& patch_filename, + CompressorType type, + int quality) { + return std::unique_ptr<PatchWriterInterface>( + new BsdiffPatchWriter(patch_filename, type, quality)); } std::unique_ptr<PatchWriterInterface> CreateEndsleyPatchWriter( |