blob: efc6716eb3f759c5b7d8c4ba3327c20cd037c559 [file] [log] [blame]
Alex Deymoa5cff222015-04-08 14:10:30 -07001// 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 Arnold99b53742013-04-30 09:24:14 -07007
Alex Deymo437b7af2015-10-14 20:13:58 -07008#include <vector>
9
Alex Deymoddf9db52017-03-02 16:10:41 -080010#include "bsdiff/extents_file.h"
Gilad Arnold99b53742013-04-30 09:24:14 -070011
Alex Deymo03f1deb2015-10-13 02:15:31 -070012namespace bsdiff {
Gilad Arnold99b53742013-04-30 09:24:14 -070013
Alex Deymo437b7af2015-10-14 20:13:58 -070014// 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.
19bool ParseExtentStr(const char* ex_str, std::vector<ex_t>* extents);
Gilad Arnold99b53742013-04-30 09:24:14 -070020
Alex Deymo03f1deb2015-10-13 02:15:31 -070021} // namespace bsdiff
22
Alex Deymo437b7af2015-10-14 20:13:58 -070023#endif // _BSDIFF_EXTENTS_H_