]> git.proxmox.com Git - libgit2.git/blob - include/git2/zlib.h
Move the external includes folder from `src` to `include`
[libgit2.git] / include / git2 / zlib.h
1 /*
2 * This file is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2,
4 * as published by the Free Software Foundation.
5 *
6 * In addition to the permissions in the GNU General Public License,
7 * the authors give you unlimited permission to link the compiled
8 * version of this file into combinations with other programs,
9 * and to distribute those combinations without any restriction
10 * coming from the use of this file. (The General Public License
11 * restrictions do apply in other respects; for example, they cover
12 * modification of the file, and distribution when not linked into
13 * a combined executable.)
14 *
15 * This file is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; see the file COPYING. If not, write to
22 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
24 */
25 #ifndef INCLUDE_git_zlib_h__
26 #define INCLUDE_git_zlib_h__
27
28 #include <zlib.h>
29
30 /**
31 * @file git2/zlib.h
32 * @brief Git data compression routines
33 * @defgroup git_zlib Git data compression routines
34 * @ingroup Git
35 * @{
36 */
37 GIT_BEGIN_DECL
38
39 #if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200
40 /**
41 * deflateBound returns an upper bound on the compressed size.
42 *
43 * This is a stub function used when zlib does not supply the
44 * deflateBound() implementation itself.
45 *
46 * @param stream the stream pointer.
47 * @param s total length of the source data (in bytes).
48 * @return maximum length of the compressed data.
49 */
50 GIT_INLINE(size_t) deflateBound(z_streamp stream, size_t s)
51 {
52 return (s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11);
53 }
54 #endif
55
56 /** @} */
57 GIT_END_DECL
58 #endif