Alex Deymo | a5cff22 | 2015-04-08 14:10:30 -0700 | [diff] [blame] | 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_EXTENTS_H_ |
| 6 | #define _BSDIFF_EXTENTS_H_ |
Gilad Arnold | 99b5374 | 2013-04-30 09:24:14 -0700 | [diff] [blame] | 7 | |
Alex Deymo | 437b7af | 2015-10-14 20:13:58 -0700 | [diff] [blame] | 8 | #include <vector> |
| 9 | |
Alex Deymo | ddf9db5 | 2017-03-02 16:10:41 -0800 | [diff] [blame] | 10 | #include "bsdiff/extents_file.h" |
Gilad Arnold | 99b5374 | 2013-04-30 09:24:14 -0700 | [diff] [blame] | 11 | |
Alex Deymo | 03f1deb | 2015-10-13 02:15:31 -0700 | [diff] [blame] | 12 | namespace bsdiff { |
Gilad Arnold | 99b5374 | 2013-04-30 09:24:14 -0700 | [diff] [blame] | 13 | |
Alex Deymo | 437b7af | 2015-10-14 20:13:58 -0700 | [diff] [blame] | 14 | // Parses a string representation |ex_str| and populates the vector |extents| |
| 15 | // of ex_t. The string is expected to be a comma-separated list of pairs of the |
| 16 | // form "offset:length". An offset may be -1 or a non-negative integer; the |
| 17 | // former indicates a sparse extent (consisting of zeros). A length is a |
| 18 | // positive integer. Returns whether the parsing was successful. |
| 19 | bool ParseExtentStr(const char* ex_str, std::vector<ex_t>* extents); |
Gilad Arnold | 99b5374 | 2013-04-30 09:24:14 -0700 | [diff] [blame] | 20 | |
Alex Deymo | 03f1deb | 2015-10-13 02:15:31 -0700 | [diff] [blame] | 21 | } // namespace bsdiff |
| 22 | |
Alex Deymo | 437b7af | 2015-10-14 20:13:58 -0700 | [diff] [blame] | 23 | #endif // _BSDIFF_EXTENTS_H_ |