1 // Copyright 2015 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef _BSDIFF_BSPATCH_H_ 6 #define _BSDIFF_BSPATCH_H_ 7 8 #include <functional> 9 #include <memory> 10 #include <vector> 11 12 #include "extents_file.h" 13 14 namespace bsdiff { 15 16 int bspatch(const char* old_filename, 17 const char* new_filename, 18 const char* patch_filename, 19 const char* old_extents, 20 const char* new_extents); 21 22 int bspatch(const char* old_filename, 23 const char* new_filename, 24 const uint8_t* patch_data, 25 size_t patch_size, 26 const char* old_extents, 27 const char* new_extents); 28 29 int bspatch(const uint8_t* old_data, 30 size_t old_size, 31 const uint8_t* patch_data, 32 size_t patch_size, 33 const std::function<size_t(const uint8_t*, size_t)>& sink); 34 35 int bspatch(const std::unique_ptr<FileInterface>& old_file, 36 const std::unique_ptr<FileInterface>& new_file, 37 const uint8_t* patch_data, 38 size_t patch_size); 39 40 bool WriteAll(const std::unique_ptr<FileInterface>& file, 41 const uint8_t* data, 42 size_t size); 43 44 bool IsOverlapping(const char* old_filename, 45 const char* new_filename, 46 const std::vector<ex_t>& old_extents, 47 const std::vector<ex_t>& new_extents); 48 49 } // namespace bsdiff 50 51 #endif // _BSDIFF_BSPATCH_H_ 52