summaryrefslogtreecommitdiff
path: root/google/compression_utils_portable.h
diff options
context:
space:
mode:
authorAdenilson Cavalcanti <adenilson.cavalcanti@arm.com>2019-08-09 19:12:20 +0000
committerCommit Bot <commit-bot@chromium.org>2019-08-09 19:12:20 +0000
commitddd7b06cf8c34e638643f7ce888bfc7c56e96933 (patch)
tree12f054245af4fe0c957d5f1272a9692c8fbd51dd /google/compression_utils_portable.h
parent0f820c1d7165ba79e0429eab8b55c76f2be7d440 (diff)
downloadzlib-ddd7b06cf8c34e638643f7ce888bfc7c56e96933.tar.gz
Insulate portable GZipHelpers code
The helpers are portable code and don't depend on 'base' code, this fixes a layer violation. Another advantage is to make it easier to deploy Chromium's zlib i.e. no need to write your own helpers. Change-Id: I10a5452dd8835f1e1ec592d7c1c1cc3bb67f9e70 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1742295 Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org> Reviewed-by: Chris Blume <cblume@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#685673} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 3b866f5cefa5e4d12af1d565ea779e727e4feca6
Diffstat (limited to 'google/compression_utils_portable.h')
-rw-r--r--google/compression_utils_portable.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/google/compression_utils_portable.h b/google/compression_utils_portable.h
new file mode 100644
index 0000000..5c07521
--- /dev/null
+++ b/google/compression_utils_portable.h
@@ -0,0 +1,33 @@
+/* compression_utils_portable.h
+ *
+ * Copyright 2019 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the Chromium source repository LICENSE file.
+ */
+#ifndef THIRD_PARTY_ZLIB_GOOGLE_COMPRESSION_UTILS_PORTABLE_H_
+#define THIRD_PARTY_ZLIB_GOOGLE_COMPRESSION_UTILS_PORTABLE_H_
+
+#if defined(USE_SYSTEM_ZLIB)
+#include <zlib.h>
+#else
+#include "third_party/zlib/zlib.h"
+#endif
+
+namespace zlib_internal {
+
+uLongf GZipExpectedCompressedSize(uLongf input_size);
+
+int GzipCompressHelper(Bytef* dest,
+ uLongf* dest_length,
+ const Bytef* source,
+ uLong source_length,
+ void* (*malloc_fn)(size_t),
+ void (*free_fn)(void*));
+
+int GzipUncompressHelper(Bytef* dest,
+ uLongf* dest_length,
+ const Bytef* source,
+ uLong source_length);
+} // namespace zlib_internal
+
+#endif // THIRD_PARTY_ZLIB_GOOGLE_COMPRESSION_UTILS_PORTABLE_H_