diff options
-rw-r--r-- | Android.bp | 414 | ||||
-rw-r--r-- | BUILD.bazel | 22 | ||||
-rw-r--r-- | CleanSpec.mk | 49 | ||||
-rw-r--r-- | METADATA | 19 | ||||
-rw-r--r-- | MODULE_LICENSE_BSD_LIKE | 0 | ||||
-rw-r--r-- | OWNERS.android | 1 | ||||
-rw-r--r-- | TEST_MAPPING | 27 | ||||
-rw-r--r-- | libz.map.txt | 151 | ||||
-rw-r--r-- | zconf.h | 4 | ||||
-rw-r--r-- | zlib.h | 63 |
10 files changed, 750 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..a6d27d1 --- /dev/null +++ b/Android.bp @@ -0,0 +1,414 @@ +package { + default_applicable_licenses: ["external_zlib_license"], +} + +license { + name: "external_zlib_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-BSD", + "SPDX-license-identifier-Zlib", + ], + license_text: [ + "LICENSE", + ], +} + +// These cflags are shared --- not only between all architectures, +// but between libz and libz_stable too. +cflags_shared = [ + // Our compiler does support hidden visibility. + "-DHAVE_HIDDEN", + // Our compiler does support const. + "-DZLIB_CONST", + // Use the traditional Rabin-Karp rolling hash to match zlib DEFLATE output exactly. + "-DCHROMIUM_ZLIB_NO_CASTAGNOLI", + // Enable -O3 for everyone, as chromium's BUILD.gn does. + "-O3", + "-Wall", + "-Werror", + "-Wno-deprecated-non-prototype", + "-Wno-unused", + "-Wno-unused-parameter", +] + +cflags_arm = [ + // Even the NDK dropped non-neon support in r24. + "-DADLER32_SIMD_NEON", + // HWCAP_CRC32 is checked at runtime, so it's okay to enable crc32 + // acceleration for both 64-bit and 32-bit (which may be armv7, at + // least for NDK users). + "-DCRC32_ARMV8_CRC32", + // TODO: DINFLATE_CHUNK_SIMD_NEON causes `atest org.apache.harmony.tests.java.util.zip.DeflaterTest` failures. + // "-DINFLATE_CHUNK_SIMD_NEON", +] +cflags_arm64 = cflags_arm + ["-DINFLATE_CHUNK_READ_64LE"] + +cflags_riscv64 = [ + // TODO: test and enable these. + // "-DRISCV_RVV", + // "-DADLER32_SIMD_RVV", +] + +// The *host* x86 configuration (with *lower* CPU feature requirements). +cflags_x86 = [ + // See ARMV8_OS_LINUX above. + "-DX86_NOT_WINDOWS", + // Android's host CPU feature requirements are *lower* than the + // corresponding device CPU feature requirements, so it's easier to just + // say "no SIMD for you" rather than specificially disable SSSE3. + // We should have a conversation about that, but not until we at least have + // data on how many Studio users have CPUs that don't make the grade... + // https://issuetracker.google.com/171235570 + "-DCPU_NO_SIMD", +] +cflags_x86_64 = cflags_x86 + ["-DINFLATE_CHUNK_READ_64LE"] + +// The additional *device* x86/x86_64 configuration. Devices have *higher* CPU +// feature requirements than the host. +cflags_android_x86 = [ + // Android's x86 and x86-64 ABIs both include SSE2 and SSSE3. + "-UCPU_NO_SIMD", + "-DADLER32_SIMD_SSSE3", + // TODO: DINFLATE_CHUNK_SIMD_SSE2 causes `atest org.apache.harmony.tests.java.util.zip.DeflaterTest` failures. + // "-DINFLATE_CHUNK_SIMD_SSE2", +] + +libz_srcs = [ + "adler32.c", + "adler32_simd.c", + "compress.c", + "cpu_features.c", + "crc32.c", + "crc32_simd.c", + "crc_folding.c", + "deflate.c", + "gzclose.c", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", + + // Not-yet-enabled optimizations. + // See https://chromium-review.googlesource.com/749732. + // TODO: causes `atest org.apache.harmony.tests.java.util.zip.DeflaterTest` failures. + // "contrib/optimizations/inffast_chunk.c", + // "contrib/optimizations/inflate.c", +] + +cc_defaults { + name: "libz_defaults", + + cflags: cflags_shared, + stl: "none", + export_include_dirs: ["."], + + host_supported: true, + native_bridge_supported: true, + + vendor_available: true, + product_available: true, + ramdisk_available: true, + vendor_ramdisk_available: true, + recovery_available: true, + + arch: { + arm: { + // TODO: This is to work around b/24465209. Remove after root cause + // is fixed. + pack_relocations: false, + ldflags: ["-Wl,--hash-style=both"], + + cflags: cflags_arm, + }, + arm64: { + cflags: cflags_arm64, + }, + riscv64: { + cflags: cflags_riscv64, + }, + x86: { + cflags: cflags_x86, + }, + x86_64: { + cflags: cflags_x86_64, + }, + }, + target: { + android_arm: { + cflags: [ + // Since we're building for the platform, we claim to be Linux rather than + // Android so we use getauxval() directly instead of the NDK + // android_getCpuFeatures which isn't available to us anyway. + "-DARMV8_OS_LINUX", + ], + }, + android_x86: { + cflags: cflags_android_x86, + }, + android_x86_64: { + cflags: cflags_android_x86, + }, + darwin_arm64: { + cflags: [ + "-DARMV8_OS_MACOS", + ], + }, + linux_bionic: { + enabled: true, + }, + linux_arm64: { + cflags: [ + // Since we're building for the platform, we claim to be Linux rather than + // Android so we use getauxval() directly instead of the NDK + // android_getCpuFeatures which isn't available to us anyway. + "-DARMV8_OS_LINUX", + ], + }, + windows: { + enabled: true, + }, + }, +} + +cc_library { + name: "libz", + defaults: ["libz_defaults"], + + whole_static_libs: ["libz_static"], + + unique_host_soname: true, + static_ndk_lib: true, + + vndk: { + enabled: true, + support_system_process: true, + }, + + stubs: { + versions: [ + "29", + "30", + ], + symbol_file: "libz.map.txt", + }, + + // When used by Vendor/Product APEX, + // libz should be treated like non-stable module. + // (Hence, should be bundled in APEX). + target: { + product: { + no_stubs: true, + }, + vendor: { + no_stubs: true, + }, + }, +} + +cc_library { + name: "libz_static", + defaults: ["libz_defaults"], + visibility: [ + "//external/angle", + "//system/unwinding/libunwindstack", + ], + + srcs: libz_srcs, + + sdk_version: "minimum", + min_sdk_version: "apex_inherit", + + apex_available: [ + "com.android.art", + "com.android.art.debug", + "com.android.runtime", + "//apex_available:platform", + ], +} + +// A build of libz with identical behavior between architectures. +// Used by legacy OTA tools such as imgdiff and updater and their tests. +// New code should not use this library, because new code should not make +// assumptions about the _compressed_ bits, beyond the fact that they will +// decompress to the same input bytes. The actual compressed byte sequences +// can and do differ over time. +cc_library { + name: "libz_stable", + visibility: [ + "//bootable/recovery/applypatch", + "//bootable/recovery/tests", + "//bootable/recovery/updater", + "//bootable/deprecated-ota/applypatch", + "//bootable/deprecated-ota/tests", + "//bootable/deprecated-ota/updater", + ], + // We only use the shared flags here; the whole point is that this + // library behaves the same on all different architectures. + cflags: cflags_shared, + stl: "none", + export_include_dirs: ["."], + srcs: libz_srcs, + host_supported: true, + vendor_available: true, + recovery_available: true, +} + +cc_binary { + name: "zlib_bench", + srcs: ["contrib/bench/zlib_bench.cc"], + cflags: [ + "-Wall", + "-Werror", + "-Wno-deprecated-non-prototype", + "-Wno-unused-parameter", + ], + host_supported: true, + shared_libs: ["libz"], + // We build zlib_bench32 and zlib_bench64 so it's easy to test LP32. + compile_multilib: "both", + multilib: { + lib32: { + suffix: "32", + }, + lib64: { + suffix: "64", + }, + }, +} + +cc_library { + name: "zlib_google_compression_utils_portable", + defaults: ["libz_defaults"], + srcs: [ + "google/compression_utils_portable.cc", + ], + export_include_dirs: ["google"], + host_supported: true, + shared_libs: ["libz"], + sdk_version: "minimum", + visibility: ["//external/angle"], + apex_available: [ + "com.android.runtime", + "//apex_available:platform", + ], +} + +cc_test { + name: "zlib_tests", + srcs: [ + "contrib/tests/infcover.cc", + "contrib/tests/utils_unittest.cc", + ], + cflags: [ + "-DCMAKE_STANDALONE_UNITTESTS", + "-Wno-unused-parameter", + ], + include_dirs: [ + // These tests include "gtest.h" rather than the usual "gtest/gtest.h". + "external/googletest/googletest/include/gtest/", + ], + shared_libs: ["libz"], + static_libs: ["zlib_google_compression_utils_portable"], + host_supported: true, + test_suites: ["device-tests"], +} + +ndk_headers { + name: "libz_headers", + from: "", + to: "", + srcs: [ + "zconf.h", + "zlib.h", + ], + license: "LICENSE", +} + +ndk_library { + name: "libz", + symbol_file: "libz.map.txt", + first_version: "9", + unversioned_until: "current", + export_header_libs: [ + "libz_headers", + ], +} + +// Export zlib headers for inclusion in the musl sysroot. +genrule { + name: "libc_musl_sysroot_zlib_headers", + visibility: ["//external/musl"], + srcs: [ + "LICENSE", + "zconf.h", + "zlib.h", + ], + out: ["libc_musl_sysroot_zlib_headers.zip"], + tools: [ + "soong_zip", + "zip2zip", + ], + cmd: "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" + + // NOTICE + " -j -f $(location LICENSE) " + + // headers + " -j -P include " + + " -f $(location zconf.h) " + + " -f $(location zlib.h) " + + " && " + + "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(out) " + + " include/**/*:include " + + " LICENSE:NOTICE.zlib", +} + +cc_defaults { + name: "zlib_fuzz_defaults", + static_libs: ["libz"], + host_supported: true, +} + +cc_fuzz { + name: "zlib_deflate_fuzzer", + defaults: ["zlib_fuzz_defaults"], + srcs: ["contrib/tests/fuzzers/deflate_fuzzer.cc"], +} + +cc_fuzz { + name: "zlib_deflate_set_dictionary_fuzzer", + defaults: ["zlib_fuzz_defaults"], + srcs: ["contrib/tests/fuzzers/deflate_set_dictionary_fuzzer.cc"], +} + +cc_fuzz { + name: "zlib_inflate_fuzzer", + defaults: ["zlib_fuzz_defaults"], + srcs: ["contrib/tests/fuzzers/inflate_fuzzer.cc"], +} + +cc_fuzz { + name: "zlib_inflate_with_header_fuzzer", + defaults: ["zlib_fuzz_defaults"], + srcs: ["contrib/tests/fuzzers/inflate_with_header_fuzzer.cc"], +} + +cc_fuzz { + name: "zlib_streaming_inflate_fuzzer", + defaults: ["zlib_fuzz_defaults"], + srcs: ["contrib/tests/fuzzers/streaming_inflate_fuzzer.cc"], + fuzz_config: { + libfuzzer_options: ["max_len=256000"], + }, +} + +cc_fuzz { + name: "zlib_uncompress_fuzzer", + defaults: ["zlib_fuzz_defaults"], + srcs: ["contrib/tests/fuzzers/uncompress_fuzzer.cc"], +} diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..f0fc0f9 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,22 @@ +# Copyright (C) 2024 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@rules_pkg//pkg:mappings.bzl", "pkg_files") + +pkg_files( + name = "test_mappings", + srcs = ["TEST_MAPPING"], + prefix = package_name(), + visibility = ["//kernel/tests/test_mappings:__pkg__"], +) diff --git a/CleanSpec.mk b/CleanSpec.mk new file mode 100644 index 0000000..b84e1b6 --- /dev/null +++ b/CleanSpec.mk @@ -0,0 +1,49 @@ +# Copyright (C) 2007 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# If you don't need to do a full clean build but would like to touch +# a file or delete some intermediate files, add a clean step to the end +# of the list. These steps will only be run once, if they haven't been +# run before. +# +# E.g.: +# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) +# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) +# +# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with +# files that are missing or have been moved. +# +# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. +# Use $(OUT_DIR) to refer to the "out" directory. +# +# If you need to re-do something that's already mentioned, just copy +# the command and add it to the bottom of the list. E.g., if a change +# that you made last week required touching a file and a change you +# made today requires touching the same file, just copy the old +# touch step and add it to the end of the list. +# +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ + +# For example: +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) +#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) + +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ diff --git a/METADATA b/METADATA new file mode 100644 index 0000000..65435cc --- /dev/null +++ b/METADATA @@ -0,0 +1,19 @@ +# This project was upgraded with external_updater. +# Usage: tools/external_updater/updater.sh update external/zlib +# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md + +name: "zlib" +description: "The Chromium fork of the zlib compression library." +third_party { + license_type: NOTICE + last_upgrade_date { + year: 2024 + month: 4 + day: 10 + } + identifier { + type: "Git" + value: "https://chromium.googlesource.com/chromium/src/third_party/zlib/" + version: "7d77fb7fd66d8a5640618ad32c71fdeb7d3e02df" + } +} diff --git a/MODULE_LICENSE_BSD_LIKE b/MODULE_LICENSE_BSD_LIKE new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/MODULE_LICENSE_BSD_LIKE diff --git a/OWNERS.android b/OWNERS.android new file mode 100644 index 0000000..7529cb9 --- /dev/null +++ b/OWNERS.android @@ -0,0 +1 @@ +include platform/system/core:/janitors/OWNERS diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..b2c8b36 --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,27 @@ +{ + "presubmit": [ + { + "name": "puffin_unittest" + }, + { + "name": "recovery_unit_test" + }, + { + "name": "update_engine_unittests" + }, + { + "name": "ziparchive-tests" + }, + { + "name": "zlib_tests" + }, + { + "name": "CtsLibcoreTestCases", + "options": [ + { + "include-filter": "org.apache.harmony.tests.java.util.zip" + } + ] + } + ] +} diff --git a/libz.map.txt b/libz.map.txt new file mode 100644 index 0000000..850bbf8 --- /dev/null +++ b/libz.map.txt @@ -0,0 +1,151 @@ +# This file is copied from src/zlib.map and annotated with comments for the NDK +# stub library generation script. +ZLIB_1.2.0 { + global: + compressBound; + deflateBound; + inflateBack; + inflateBackEnd; + inflateBackInit_; + inflateCopy; + local: + deflate_copyright; # var + inflate_copyright; # var + inflate_fast; + inflate_table; + zcalloc; + zcfree; + z_errmsg; # var + gz_error; + gz_intmax; + _*; +}; + +ZLIB_1.2.0.2 { + gzclearerr; + gzungetc; + zlibCompileFlags; +} ZLIB_1.2.0; + +ZLIB_1.2.0.8 { + deflatePrime; +} ZLIB_1.2.0.2; + +ZLIB_1.2.2 { + adler32_combine; + crc32_combine; + deflateSetHeader; + inflateGetHeader; +} ZLIB_1.2.0.8; + +ZLIB_1.2.2.3 { + deflateTune; + gzdirect; +} ZLIB_1.2.2; + +ZLIB_1.2.2.4 { + inflatePrime; +} ZLIB_1.2.2.3; + +ZLIB_1.2.3.3 { + adler32_combine64; + crc32_combine64; + gzopen64; + gzseek64; + gztell64; + inflateUndermine; +} ZLIB_1.2.2.4; + +ZLIB_1.2.3.4 { + inflateReset2; + inflateMark; +} ZLIB_1.2.3.3; + +ZLIB_1.2.3.5 { + gzbuffer; + gzoffset; + gzoffset64; + gzclose_r; + gzclose_w; +} ZLIB_1.2.3.4; + +ZLIB_1.2.5.1 { + deflatePending; +} ZLIB_1.2.3.5; + +ZLIB_1.2.5.2 { + deflateResetKeep; + gzgetc_; + inflateResetKeep; +} ZLIB_1.2.5.1; + +ZLIB_1.2.7.1 { # introduced=19 + inflateGetDictionary; + gzvprintf; +} ZLIB_1.2.5.2; + +ZLIB_1.2.9 { # introduced=28 + inflateCodesUsed; + inflateValidate; + uncompress2; + gzfread; + gzfwrite; + deflateGetDictionary; + adler32_z; + crc32_z; +} ZLIB_1.2.7.1; + +# These were all exposed by the old NDK stub library. Unclear if they still +# should be, but at least some of them are marked as being exported in zlib.h +# and the tree doesn't build without them. +ZLIB_NDK { + _dist_code; + _length_code; + _tr_align; + _tr_flush_bits; # introduced=21 + _tr_flush_block; + _tr_init; + _tr_stored_block; + _tr_tally; + adler32; + compress2; + compress; + crc32; + deflate; + deflateCopy; + deflateEnd; + deflateInit2_; + deflateInit_; + deflateParams; + deflateReset; + deflateSetDictionary; + get_crc_table; + gzclose; + gzdopen; + gzeof; + gzerror; + gzflush; + gzgetc; + gzgets; + gzopen; + gzprintf; + gzputc; + gzputs; + gzread; + gzrewind; + gzseek; + gzsetparams; + gztell; + gzwrite; + inflate; + inflateEnd; + inflateInit2_; + inflateInit_; + inflateReset; + inflateSetDictionary; + inflateSync; + inflateSyncPoint; + uncompress; + zError; + zlibVersion; +}; @@ -8,6 +8,10 @@ #ifndef ZCONF_H #define ZCONF_H +// ANDROID CHNAGE: Upstream chromium renames all the functions; we don't want +// that. +#define CHROMIUM_ZLIB_NO_CHROMECONF + /* * This library is also built as a part of AOSP, which does not need to include * chromeconf.h. This config does not want chromeconf.h, so it can set this @@ -45,6 +45,49 @@ extern "C" { #define ZLIB_VER_SUBREVISION 1 /* + * In Android's NDK we have one zlib.h for all the versions. + * zlib users tend to use ZLIB_VERNUM to check API availability, + * so we need to translate __ANDROID_API__ appropriately. + * + * ZLIB_1.2.7.1 and ZLIB_1.2.9 are the only API changes in the NDK's + * supported range of API levels. + * + * jb-mr2-dev (18): 1.2.7 (but not 1.2.7.1, where the APIs were added!) + * https://android.googlesource.com/platform/external/zlib/+/refs/heads/jb-mr2-dev/src/zlib.h + * kitkat-dev (19): 1.2.8 + * https://android.googlesource.com/platform/external/zlib/+/refs/heads/kitkat-dev/src/zlib.h + * + * oreo-mr1-dev (27): 1.2.8 + * https://android.googlesource.com/platform/external/zlib/+/refs/heads/oreo-mr1-dev/src/zlib.h + * pie-dev (28): 1.2.11 + * https://android.googlesource.com/platform/external/zlib/+/refs/heads/pie-dev/src/zlib.h + * + * So: + * >= 28 --> 1.2.11 + * >= 19 --> 1.2.8 + * < 19 --> 1.2.7 + */ +#if defined(__ANDROID__) +# if __ANDROID_API__ >= 28 + /* Already okay. */ +# elif __ANDROID_API__ >= 19 +# undef ZLIB_VERSION +# define ZLIB_VERSION "1.2.8" +# undef ZLIB_VERNUM +# define ZLIB_VERNUM 0x1280 +# undef ZLIB_VER_REVISION +# define ZLIB_VER_REVISION 8 +# else +# undef ZLIB_VERSION +# define ZLIB_VERSION "1.2.6" +# undef ZLIB_VERNUM +# define ZLIB_VERNUM 0x1260 +# undef ZLIB_VER_REVISION +# define ZLIB_VER_REVISION 6 +# endif +#endif + +/* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) @@ -651,9 +694,11 @@ ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm, not perform any compression: this will be done by deflate(). */ +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength); +#endif /* Returns the sliding dictionary being maintained by deflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied @@ -907,9 +952,11 @@ ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm, inflate(). */ +#if !defined(__ANDROID__) || __ANDROID_API__ >= 19 ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength); +#endif /* Returns the sliding dictionary being maintained by inflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied @@ -1284,8 +1331,10 @@ ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, buffer with the uncompressed data up to that point. */ +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, uLong *sourceLen); +#endif /* Same as uncompress, except that sourceLen is a pointer, where the length of the source is *sourceLen. On return, *sourceLen is the number of @@ -1421,8 +1470,10 @@ ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len); Z_STREAM_ERROR. */ +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file); +#endif /* Read and decompress up to nitems items of size size from file into buf, otherwise operating as gzread() does. This duplicates the interface of @@ -1453,8 +1504,10 @@ ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len); returns the number of uncompressed bytes written or 0 in case of error. */ +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems, gzFile file); +#endif /* Compress and write nitems items of size size from buf to file, duplicating the interface of stdio's fwrite(), with size_t request and return types. If @@ -1708,8 +1761,10 @@ ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len); if (adler != original_adler) error(); */ +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len); +#endif /* Same as adler32(), but with a size_t length. */ @@ -1744,8 +1799,10 @@ ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len); if (crc != original_crc) error(); */ +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, z_size_t len); +#endif /* Same as crc32(), but with a size_t length. */ @@ -1944,8 +2001,12 @@ ZEXTERN const char * ZEXPORT zError(int); ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void); ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int); +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 ZEXTERN int ZEXPORT inflateValidate(z_streamp, int); +#endif +#if !defined(__ANDROID__) || __ANDROID_API__ >= 28 ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp); +#endif ZEXTERN int ZEXPORT inflateResetKeep(z_streamp); ZEXTERN int ZEXPORT deflateResetKeep(z_streamp); #if defined(_WIN32) && !defined(Z_SOLO) @@ -1954,9 +2015,11 @@ ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, #endif #if defined(STDC) || defined(Z_HAVE_STDARG_H) # ifndef Z_SOLO +# if !defined(__ANDROID__) || __ANDROID_API__ >= 19 ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va); +# endif # endif #endif |