| Kelvin Zhang | 4eae81e | 2021-12-09 17:07:17 -0800 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2021 The Android Open Source Project | 
|  | 3 | // | 
|  | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | // you may not use this file except in compliance with the License. | 
|  | 6 | // You may obtain a copy of the License at | 
|  | 7 | // | 
|  | 8 | //      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | // | 
|  | 10 | // Unless required by applicable law or agreed to in writing, software | 
|  | 11 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | // See the License for the specific language governing permissions and | 
|  | 14 | // limitations under the License. | 
|  | 15 | // | 
|  | 16 |  | 
|  | 17 | #ifndef UPDATE_ENGINE_LZ4DIFF_LZ4PATCH_H_ | 
|  | 18 | #define UPDATE_ENGINE_LZ4DIFF_LZ4PATCH_H_ | 
|  | 19 |  | 
| Kelvin Zhang | 893b3a1 | 2021-12-30 12:28:53 -0800 | [diff] [blame] | 20 | #include "lz4diff/lz4diff_compress.h" | 
| Kelvin Zhang | 4eae81e | 2021-12-09 17:07:17 -0800 | [diff] [blame] | 21 | #include "lz4diff_format.h" | 
|  | 22 |  | 
|  | 23 | namespace chromeos_update_engine { | 
| Kelvin Zhang | 636ba2f | 2022-02-09 14:40:22 -0800 | [diff] [blame] | 24 |  | 
|  | 25 | bool Lz4Patch(std::string_view src_data, | 
|  | 26 | std::string_view patch_data, | 
|  | 27 | const SinkFunc& sink); | 
|  | 28 |  | 
| Kelvin Zhang | 4eae81e | 2021-12-09 17:07:17 -0800 | [diff] [blame] | 29 | bool Lz4Patch(std::string_view src_data, | 
|  | 30 | std::string_view patch_data, | 
|  | 31 | Blob* output); | 
| Kelvin Zhang | 893b3a1 | 2021-12-30 12:28:53 -0800 | [diff] [blame] | 32 | bool Lz4Patch(const Blob& src_data, const Blob& patch_data, Blob* output); | 
| Kelvin Zhang | 4eae81e | 2021-12-09 17:07:17 -0800 | [diff] [blame] | 33 |  | 
| Kelvin Zhang | 8389dfe | 2022-01-13 12:47:11 -0800 | [diff] [blame] | 34 | std::ostream& operator<<(std::ostream& out, const CompressionAlgorithm& info); | 
|  | 35 |  | 
| Kelvin Zhang | 4eae81e | 2021-12-09 17:07:17 -0800 | [diff] [blame] | 36 | std::ostream& operator<<(std::ostream& out, const Lz4diffHeader&); | 
|  | 37 |  | 
|  | 38 | template <typename T> | 
|  | 39 | std::ostream& operator<<(std::ostream& out, | 
|  | 40 | const google::protobuf::RepeatedPtrField<T>& arr) { | 
|  | 41 | if (arr.empty()) { | 
|  | 42 | out << "[]"; | 
|  | 43 | return out; | 
|  | 44 | } | 
|  | 45 | out << "["; | 
|  | 46 | auto begin = arr.begin(); | 
|  | 47 | out << *begin; | 
|  | 48 | ++begin; | 
|  | 49 | for (; begin != arr.end(); ++begin) { | 
|  | 50 | out << ", " << *begin; | 
|  | 51 | } | 
|  | 52 | out << "]"; | 
|  | 53 |  | 
|  | 54 | return out; | 
|  | 55 | } | 
|  | 56 |  | 
|  | 57 | }  // namespace chromeos_update_engine | 
|  | 58 |  | 
|  | 59 | #endif |