grpc 1.57.0.pre1 → 1.58.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +534 -284
- data/include/grpc/event_engine/event_engine.h +0 -1
- data/include/grpc/event_engine/memory_allocator.h +2 -2
- data/include/grpc/impl/channel_arg_names.h +371 -0
- data/include/grpc/impl/grpc_types.h +1 -353
- data/include/grpc/module.modulemap +1 -0
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -1
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +2 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +7 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +10 -5
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +5 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +4 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +115 -109
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +0 -5
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +7 -2
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +11 -3
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +6 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +8 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +102 -11
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +9 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +4 -1
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_plugin.cc +6 -0
- data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +41 -14
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +3 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/retry_filter.h +1 -0
- data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +1 -1
- data/src/core/ext/filters/client_channel/subchannel.cc +9 -5
- data/src/core/ext/filters/client_channel/subchannel.h +8 -2
- data/src/core/ext/filters/deadline/deadline_filter.cc +1 -1
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -0
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +1 -0
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -1
- data/src/core/ext/filters/message_size/message_size_filter.cc +1 -0
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +4 -7
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +8 -12
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +357 -358
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -18
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +63 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +7 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +30 -57
- data/src/core/ext/transport/chttp2/transport/parsing.cc +16 -7
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +80 -0
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +55 -0
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +98 -0
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +73 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +81 -89
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -0
- data/src/core/ext/xds/xds_client_grpc.cc +1 -0
- data/src/core/ext/xds/xds_http_fault_filter.cc +1 -2
- data/src/core/ext/xds/xds_http_fault_filter.h +1 -2
- data/src/core/ext/xds/xds_http_filters.h +2 -4
- data/src/core/ext/xds/xds_http_rbac_filter.cc +3 -8
- data/src/core/ext/xds/xds_http_rbac_filter.h +1 -2
- data/src/core/ext/xds/xds_http_stateful_session_filter.cc +1 -2
- data/src/core/ext/xds/xds_http_stateful_session_filter.h +1 -2
- data/src/core/ext/xds/xds_lb_policy_registry.cc +3 -6
- data/src/core/ext/xds/xds_routing.cc +2 -2
- data/src/core/ext/xds/xds_transport_grpc.cc +1 -0
- data/src/core/lib/avl/avl.h +10 -173
- data/src/core/lib/channel/call_tracer.cc +289 -0
- data/src/core/lib/channel/call_tracer.h +35 -0
- data/src/core/lib/channel/channel_args.cc +84 -79
- data/src/core/lib/channel/channel_args.h +29 -17
- data/src/core/lib/channel/connected_channel.cc +0 -1
- data/src/core/lib/channel/promise_based_filter.cc +4 -1
- data/src/core/lib/compression/compression_internal.cc +8 -4
- data/src/core/lib/debug/stats_data.cc +93 -21
- data/src/core/lib/debug/stats_data.h +41 -0
- data/src/core/lib/event_engine/ares_resolver.cc +712 -0
- data/src/core/lib/event_engine/ares_resolver.h +150 -0
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +9 -3
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +229 -0
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +117 -0
- data/src/core/lib/event_engine/forkable.cc +15 -1
- data/src/core/lib/event_engine/forkable.h +15 -0
- data/src/core/lib/event_engine/grpc_polled_fd.h +73 -0
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +25 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +10 -1
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +197 -0
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +47 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +12 -1
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -0
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +2 -0
- data/src/core/lib/event_engine/thread_pool/thread_count.cc +58 -0
- data/src/core/lib/event_engine/thread_pool/thread_count.h +161 -0
- data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +7 -0
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +86 -111
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +15 -61
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +3 -4
- data/src/core/lib/experiments/config.cc +14 -0
- data/src/core/lib/experiments/experiments.cc +141 -304
- data/src/core/lib/experiments/experiments.h +16 -17
- data/src/core/lib/gprpp/ref_counted.h +3 -1
- data/src/core/lib/gprpp/ref_counted_string.cc +44 -0
- data/src/core/lib/gprpp/ref_counted_string.h +146 -0
- data/src/core/lib/gprpp/time.h +2 -2
- data/src/core/lib/gprpp/work_serializer.cc +36 -0
- data/src/core/lib/gprpp/work_serializer.h +5 -0
- data/src/core/lib/http/httpcli_security_connector.cc +1 -0
- data/src/core/lib/iomgr/buffer_list.cc +2 -0
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +7 -22
- data/src/core/lib/iomgr/tcp_posix.cc +3 -3
- data/src/core/lib/promise/detail/basic_seq.h +1 -372
- data/src/core/lib/promise/detail/seq_state.h +2076 -0
- data/src/core/lib/promise/seq.h +19 -2
- data/src/core/lib/promise/sleep.h +5 -10
- data/src/core/lib/promise/try_seq.h +34 -2
- data/src/core/lib/resource_quota/api.cc +1 -0
- data/src/core/lib/resource_quota/arena.cc +2 -0
- data/src/core/lib/resource_quota/arena.h +42 -8
- data/src/core/lib/resource_quota/memory_quota.cc +0 -1
- data/src/core/lib/resource_quota/resource_quota.h +1 -0
- data/src/core/lib/security/authorization/authorization_policy_provider.h +1 -1
- data/src/core/lib/security/authorization/rbac_policy.h +1 -1
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +8 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +17 -0
- data/src/core/lib/security/credentials/jwt/json_token.h +4 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +42 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -0
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +1 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +1 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +8 -5
- data/src/core/lib/security/transport/security_handshaker.cc +1 -0
- data/src/core/lib/security/transport/server_auth_filter.cc +2 -0
- data/src/core/lib/surface/call.cc +32 -8
- data/src/core/lib/surface/channel.cc +1 -0
- data/src/core/lib/surface/completion_queue.cc +10 -0
- data/src/core/lib/surface/init.cc +1 -0
- data/src/core/lib/surface/server.cc +67 -64
- data/src/core/lib/surface/server.h +1 -15
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/tsi/alts/crypt/aes_gcm.cc +27 -2
- data/src/core/tsi/ssl_transport_security.cc +11 -0
- data/src/ruby/ext/grpc/rb_channel.c +1 -53
- data/src/ruby/lib/grpc/generic/active_call.rb +9 -14
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/test/client.rb +16 -0
- data/src/ruby/spec/generic/rpc_server_spec.rb +3 -3
- data/third_party/abseil-cpp/absl/algorithm/container.h +3 -2
- data/third_party/abseil-cpp/absl/base/attributes.h +58 -5
- data/third_party/abseil-cpp/absl/base/call_once.h +1 -1
- data/third_party/abseil-cpp/absl/base/casts.h +8 -8
- data/third_party/abseil-cpp/absl/base/config.h +89 -106
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +26 -1
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +2 -2
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +50 -39
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +2 -1
- data/third_party/abseil-cpp/absl/base/internal/prefetch.h +17 -18
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +32 -3
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +24 -4
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +31 -73
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +9 -8
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +11 -11
- data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +23 -32
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +2 -3
- data/third_party/abseil-cpp/absl/base/options.h +1 -1
- data/third_party/abseil-cpp/absl/base/policy_checks.h +3 -3
- data/third_party/abseil-cpp/absl/base/prefetch.h +198 -0
- data/third_party/abseil-cpp/absl/container/fixed_array.h +54 -29
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +5 -1
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +6 -2
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +167 -79
- data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +1 -1
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +3 -21
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +1 -1
- data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +46 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +2 -0
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +85 -26
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +35 -18
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +70 -29
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +437 -236
- data/third_party/abseil-cpp/absl/crc/crc32c.h +8 -1
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +14 -8
- data/third_party/abseil-cpp/absl/crc/internal/crc.cc +4 -35
- data/third_party/abseil-cpp/absl/crc/internal/crc.h +2 -10
- data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +1 -1
- data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.cc +1 -1
- data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.h +4 -4
- data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +8 -10
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_64.cc +17 -19
- data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +8 -8
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +2 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +59 -23
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +1 -1
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +43 -19
- data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +3 -0
- data/third_party/abseil-cpp/absl/flags/commandlineflag.h +1 -1
- data/third_party/abseil-cpp/absl/flags/internal/commandlineflag.cc +1 -1
- data/third_party/abseil-cpp/absl/flags/internal/flag.cc +2 -2
- data/third_party/abseil-cpp/absl/flags/internal/flag.h +16 -15
- data/third_party/abseil-cpp/absl/flags/internal/flag_msvc.inc +1 -1
- data/third_party/abseil-cpp/absl/flags/marshalling.cc +43 -2
- data/third_party/abseil-cpp/absl/flags/marshalling.h +5 -0
- data/third_party/abseil-cpp/absl/functional/any_invocable.h +9 -1
- data/third_party/abseil-cpp/absl/functional/bind_front.h +1 -1
- data/third_party/abseil-cpp/absl/functional/function_ref.h +3 -3
- data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +37 -24
- data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +19 -9
- data/third_party/abseil-cpp/absl/hash/hash.h +7 -4
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +38 -15
- data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +6 -0
- data/third_party/abseil-cpp/absl/meta/type_traits.h +48 -373
- data/third_party/abseil-cpp/absl/numeric/bits.h +4 -4
- data/third_party/abseil-cpp/absl/numeric/int128.cc +20 -8
- data/third_party/abseil-cpp/absl/numeric/int128.h +36 -39
- data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +0 -3
- data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +47 -30
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +4 -3
- data/third_party/abseil-cpp/absl/random/internal/generate_real.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/platform.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +4 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +1 -1
- data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +1 -1
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +4 -0
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +12 -24
- data/third_party/abseil-cpp/absl/status/status.cc +11 -7
- data/third_party/abseil-cpp/absl/status/status.h +11 -2
- data/third_party/abseil-cpp/absl/status/statusor.h +22 -8
- data/third_party/abseil-cpp/absl/strings/ascii.cc +54 -6
- data/third_party/abseil-cpp/absl/strings/charconv.cc +21 -4
- data/third_party/abseil-cpp/absl/strings/charconv.h +2 -2
- data/third_party/abseil-cpp/absl/strings/cord.cc +1 -2
- data/third_party/abseil-cpp/absl/strings/cord.h +32 -5
- data/third_party/abseil-cpp/absl/strings/cord_analysis.cc +23 -1
- data/third_party/abseil-cpp/absl/strings/cord_analysis.h +18 -0
- data/third_party/abseil-cpp/absl/strings/cord_buffer.h +2 -5
- data/third_party/abseil-cpp/absl/strings/escaping.cc +10 -32
- data/third_party/abseil-cpp/absl/strings/escaping.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +2 -4
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +3 -3
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +0 -1
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +15 -13
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +13 -4
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +8 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc +5 -3
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.h +4 -7
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +8 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc +46 -20
- data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +1 -34
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +2 -1
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +23 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.h +1 -0
- data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +2 -77
- data/third_party/abseil-cpp/absl/strings/internal/memutil.h +4 -112
- data/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +10 -31
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +8 -8
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +5 -20
- data/third_party/abseil-cpp/absl/strings/internal/str_format/constexpr_parser.h +1 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +9 -9
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +56 -6
- data/third_party/abseil-cpp/absl/strings/match.cc +87 -0
- data/third_party/abseil-cpp/absl/strings/match.h +19 -0
- data/third_party/abseil-cpp/absl/strings/numbers.cc +154 -122
- data/third_party/abseil-cpp/absl/strings/numbers.h +1 -6
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +7 -50
- data/third_party/abseil-cpp/absl/strings/str_cat.h +83 -15
- data/third_party/abseil-cpp/absl/strings/str_format.h +6 -3
- data/third_party/abseil-cpp/absl/strings/str_split.cc +9 -6
- data/third_party/abseil-cpp/absl/strings/string_view.cc +26 -4
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +5 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +63 -43
- data/third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.cc +111 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.h +63 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +11 -7
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.cc +225 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +122 -114
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +12 -8
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +10 -1
- data/third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.cc +167 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.h +60 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.cc +122 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.h +65 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.cc +91 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.h +56 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +19 -113
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter_base.cc +42 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter_base.h +90 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.cc +151 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.h +70 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +407 -411
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +152 -118
- data/third_party/abseil-cpp/absl/time/clock.cc +6 -7
- data/third_party/abseil-cpp/absl/time/duration.cc +24 -26
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +1 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +3 -3
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +8 -6
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +6 -3
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +4 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +4 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +322 -295
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +8 -17
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +51 -33
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +7 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +128 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +5 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +34 -34
- data/third_party/abseil-cpp/absl/time/time.cc +9 -2
- data/third_party/abseil-cpp/absl/time/time.h +115 -15
- data/third_party/abseil-cpp/absl/types/internal/optional.h +0 -52
- data/third_party/abseil-cpp/absl/types/internal/span.h +2 -2
- data/third_party/abseil-cpp/absl/types/internal/variant.h +2 -2
- data/third_party/abseil-cpp/absl/types/optional.h +15 -13
- data/third_party/abseil-cpp/absl/types/span.h +1 -2
- data/third_party/boringssl-with-bazel/err_data.c +15 -14
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strex.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/bio/errno.c +92 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +4 -48
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +11 -6
- data/third_party/boringssl-with-bazel/src/crypto/bio/internal.h +16 -6
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +9 -0
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +3 -7
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_fuchsia.c +0 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_linux.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_openbsd.c +0 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_sysreg.c +93 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_freebsd.c +0 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/dh_extra/dh_asn1.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/dh_extra/params.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +9 -14
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +4 -6
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +10 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/check.c +37 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/dh.c +38 -19
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +39 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/service_indicator.c +4 -7
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +13 -21
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +6 -23
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +1 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +0 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_d2.c +1 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +2 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +9 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +11 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +7 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +6 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +22 -20
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +20 -12
- data/third_party/boringssl-with-bazel/src/include/openssl/target.h +50 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +0 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_file.cc +4 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +2 -0
- metadata +39 -31
- data/src/core/lib/promise/detail/basic_join.h +0 -197
- data/src/core/lib/promise/detail/switch.h +0 -1455
- data/src/core/lib/promise/try_join.h +0 -82
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +0 -403
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_freebsd.c +0 -62
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm.c +0 -38
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_openbsd.c +0 -31
- data/third_party/re2/util/benchmark.h +0 -156
- data/third_party/re2/util/flags.h +0 -26
- data/third_party/re2/util/malloc_counter.h +0 -19
- data/third_party/re2/util/pcre.cc +0 -1025
- data/third_party/re2/util/pcre.h +0 -681
- data/third_party/re2/util/test.h +0 -50
- data/third_party/upb/upb/mini_table.h +0 -36
- data/third_party/zlib/gzclose.c +0 -25
- data/third_party/zlib/gzlib.c +0 -639
- data/third_party/zlib/gzread.c +0 -650
- data/third_party/zlib/gzwrite.c +0 -677
data/third_party/zlib/gzwrite.c
DELETED
@@ -1,677 +0,0 @@
|
|
1
|
-
/* gzwrite.c -- zlib functions for writing gzip files
|
2
|
-
* Copyright (C) 2004-2019 Mark Adler
|
3
|
-
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
|
-
*/
|
5
|
-
|
6
|
-
#include "gzguts.h"
|
7
|
-
|
8
|
-
/* Local functions */
|
9
|
-
local int gz_init OF((gz_statep));
|
10
|
-
local int gz_comp OF((gz_statep, int));
|
11
|
-
local int gz_zero OF((gz_statep, z_off64_t));
|
12
|
-
local z_size_t gz_write OF((gz_statep, voidpc, z_size_t));
|
13
|
-
|
14
|
-
/* Initialize state for writing a gzip file. Mark initialization by setting
|
15
|
-
state->size to non-zero. Return -1 on a memory allocation failure, or 0 on
|
16
|
-
success. */
|
17
|
-
local int gz_init(state)
|
18
|
-
gz_statep state;
|
19
|
-
{
|
20
|
-
int ret;
|
21
|
-
z_streamp strm = &(state->strm);
|
22
|
-
|
23
|
-
/* allocate input buffer (double size for gzprintf) */
|
24
|
-
state->in = (unsigned char *)malloc(state->want << 1);
|
25
|
-
if (state->in == NULL) {
|
26
|
-
gz_error(state, Z_MEM_ERROR, "out of memory");
|
27
|
-
return -1;
|
28
|
-
}
|
29
|
-
|
30
|
-
/* only need output buffer and deflate state if compressing */
|
31
|
-
if (!state->direct) {
|
32
|
-
/* allocate output buffer */
|
33
|
-
state->out = (unsigned char *)malloc(state->want);
|
34
|
-
if (state->out == NULL) {
|
35
|
-
free(state->in);
|
36
|
-
gz_error(state, Z_MEM_ERROR, "out of memory");
|
37
|
-
return -1;
|
38
|
-
}
|
39
|
-
|
40
|
-
/* allocate deflate memory, set up for gzip compression */
|
41
|
-
strm->zalloc = Z_NULL;
|
42
|
-
strm->zfree = Z_NULL;
|
43
|
-
strm->opaque = Z_NULL;
|
44
|
-
ret = deflateInit2(strm, state->level, Z_DEFLATED,
|
45
|
-
MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
|
46
|
-
if (ret != Z_OK) {
|
47
|
-
free(state->out);
|
48
|
-
free(state->in);
|
49
|
-
gz_error(state, Z_MEM_ERROR, "out of memory");
|
50
|
-
return -1;
|
51
|
-
}
|
52
|
-
strm->next_in = NULL;
|
53
|
-
}
|
54
|
-
|
55
|
-
/* mark state as initialized */
|
56
|
-
state->size = state->want;
|
57
|
-
|
58
|
-
/* initialize write buffer if compressing */
|
59
|
-
if (!state->direct) {
|
60
|
-
strm->avail_out = state->size;
|
61
|
-
strm->next_out = state->out;
|
62
|
-
state->x.next = strm->next_out;
|
63
|
-
}
|
64
|
-
return 0;
|
65
|
-
}
|
66
|
-
|
67
|
-
/* Compress whatever is at avail_in and next_in and write to the output file.
|
68
|
-
Return -1 if there is an error writing to the output file or if gz_init()
|
69
|
-
fails to allocate memory, otherwise 0. flush is assumed to be a valid
|
70
|
-
deflate() flush value. If flush is Z_FINISH, then the deflate() state is
|
71
|
-
reset to start a new gzip stream. If gz->direct is true, then simply write
|
72
|
-
to the output file without compressing, and ignore flush. */
|
73
|
-
local int gz_comp(state, flush)
|
74
|
-
gz_statep state;
|
75
|
-
int flush;
|
76
|
-
{
|
77
|
-
int ret, writ;
|
78
|
-
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
|
79
|
-
z_streamp strm = &(state->strm);
|
80
|
-
|
81
|
-
/* allocate memory if this is the first time through */
|
82
|
-
if (state->size == 0 && gz_init(state) == -1)
|
83
|
-
return -1;
|
84
|
-
|
85
|
-
/* write directly if requested */
|
86
|
-
if (state->direct) {
|
87
|
-
while (strm->avail_in) {
|
88
|
-
put = strm->avail_in > max ? max : strm->avail_in;
|
89
|
-
writ = write(state->fd, strm->next_in, put);
|
90
|
-
if (writ < 0) {
|
91
|
-
gz_error(state, Z_ERRNO, zstrerror());
|
92
|
-
return -1;
|
93
|
-
}
|
94
|
-
strm->avail_in -= (unsigned)writ;
|
95
|
-
strm->next_in += writ;
|
96
|
-
}
|
97
|
-
return 0;
|
98
|
-
}
|
99
|
-
|
100
|
-
/* check for a pending reset */
|
101
|
-
if (state->reset) {
|
102
|
-
/* don't start a new gzip member unless there is data to write */
|
103
|
-
if (strm->avail_in == 0)
|
104
|
-
return 0;
|
105
|
-
deflateReset(strm);
|
106
|
-
state->reset = 0;
|
107
|
-
}
|
108
|
-
|
109
|
-
/* run deflate() on provided input until it produces no more output */
|
110
|
-
ret = Z_OK;
|
111
|
-
do {
|
112
|
-
/* write out current buffer contents if full, or if flushing, but if
|
113
|
-
doing Z_FINISH then don't write until we get to Z_STREAM_END */
|
114
|
-
if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
|
115
|
-
(flush != Z_FINISH || ret == Z_STREAM_END))) {
|
116
|
-
while (strm->next_out > state->x.next) {
|
117
|
-
put = strm->next_out - state->x.next > (int)max ? max :
|
118
|
-
(unsigned)(strm->next_out - state->x.next);
|
119
|
-
writ = write(state->fd, state->x.next, put);
|
120
|
-
if (writ < 0) {
|
121
|
-
gz_error(state, Z_ERRNO, zstrerror());
|
122
|
-
return -1;
|
123
|
-
}
|
124
|
-
state->x.next += writ;
|
125
|
-
}
|
126
|
-
if (strm->avail_out == 0) {
|
127
|
-
strm->avail_out = state->size;
|
128
|
-
strm->next_out = state->out;
|
129
|
-
state->x.next = state->out;
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
/* compress */
|
134
|
-
have = strm->avail_out;
|
135
|
-
ret = deflate(strm, flush);
|
136
|
-
if (ret == Z_STREAM_ERROR) {
|
137
|
-
gz_error(state, Z_STREAM_ERROR,
|
138
|
-
"internal error: deflate stream corrupt");
|
139
|
-
return -1;
|
140
|
-
}
|
141
|
-
have -= strm->avail_out;
|
142
|
-
} while (have);
|
143
|
-
|
144
|
-
/* if that completed a deflate stream, allow another to start */
|
145
|
-
if (flush == Z_FINISH)
|
146
|
-
state->reset = 1;
|
147
|
-
|
148
|
-
/* all done, no errors */
|
149
|
-
return 0;
|
150
|
-
}
|
151
|
-
|
152
|
-
/* Compress len zeros to output. Return -1 on a write error or memory
|
153
|
-
allocation failure by gz_comp(), or 0 on success. */
|
154
|
-
local int gz_zero(state, len)
|
155
|
-
gz_statep state;
|
156
|
-
z_off64_t len;
|
157
|
-
{
|
158
|
-
int first;
|
159
|
-
unsigned n;
|
160
|
-
z_streamp strm = &(state->strm);
|
161
|
-
|
162
|
-
/* consume whatever's left in the input buffer */
|
163
|
-
if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
164
|
-
return -1;
|
165
|
-
|
166
|
-
/* compress len zeros (len guaranteed > 0) */
|
167
|
-
first = 1;
|
168
|
-
while (len) {
|
169
|
-
n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
|
170
|
-
(unsigned)len : state->size;
|
171
|
-
if (first) {
|
172
|
-
memset(state->in, 0, n);
|
173
|
-
first = 0;
|
174
|
-
}
|
175
|
-
strm->avail_in = n;
|
176
|
-
strm->next_in = state->in;
|
177
|
-
state->x.pos += n;
|
178
|
-
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
179
|
-
return -1;
|
180
|
-
len -= n;
|
181
|
-
}
|
182
|
-
return 0;
|
183
|
-
}
|
184
|
-
|
185
|
-
/* Write len bytes from buf to file. Return the number of bytes written. If
|
186
|
-
the returned value is less than len, then there was an error. */
|
187
|
-
local z_size_t gz_write(state, buf, len)
|
188
|
-
gz_statep state;
|
189
|
-
voidpc buf;
|
190
|
-
z_size_t len;
|
191
|
-
{
|
192
|
-
z_size_t put = len;
|
193
|
-
|
194
|
-
/* if len is zero, avoid unnecessary operations */
|
195
|
-
if (len == 0)
|
196
|
-
return 0;
|
197
|
-
|
198
|
-
/* allocate memory if this is the first time through */
|
199
|
-
if (state->size == 0 && gz_init(state) == -1)
|
200
|
-
return 0;
|
201
|
-
|
202
|
-
/* check for seek request */
|
203
|
-
if (state->seek) {
|
204
|
-
state->seek = 0;
|
205
|
-
if (gz_zero(state, state->skip) == -1)
|
206
|
-
return 0;
|
207
|
-
}
|
208
|
-
|
209
|
-
/* for small len, copy to input buffer, otherwise compress directly */
|
210
|
-
if (len < state->size) {
|
211
|
-
/* copy to input buffer, compress when full */
|
212
|
-
do {
|
213
|
-
unsigned have, copy;
|
214
|
-
|
215
|
-
if (state->strm.avail_in == 0)
|
216
|
-
state->strm.next_in = state->in;
|
217
|
-
have = (unsigned)((state->strm.next_in + state->strm.avail_in) -
|
218
|
-
state->in);
|
219
|
-
copy = state->size - have;
|
220
|
-
if (copy > len)
|
221
|
-
copy = (unsigned)len;
|
222
|
-
memcpy(state->in + have, buf, copy);
|
223
|
-
state->strm.avail_in += copy;
|
224
|
-
state->x.pos += copy;
|
225
|
-
buf = (const char *)buf + copy;
|
226
|
-
len -= copy;
|
227
|
-
if (len && gz_comp(state, Z_NO_FLUSH) == -1)
|
228
|
-
return 0;
|
229
|
-
} while (len);
|
230
|
-
}
|
231
|
-
else {
|
232
|
-
/* consume whatever's left in the input buffer */
|
233
|
-
if (state->strm.avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
234
|
-
return 0;
|
235
|
-
|
236
|
-
/* directly compress user buffer to file */
|
237
|
-
state->strm.next_in = (z_const Bytef *)buf;
|
238
|
-
do {
|
239
|
-
unsigned n = (unsigned)-1;
|
240
|
-
if (n > len)
|
241
|
-
n = (unsigned)len;
|
242
|
-
state->strm.avail_in = n;
|
243
|
-
state->x.pos += n;
|
244
|
-
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
245
|
-
return 0;
|
246
|
-
len -= n;
|
247
|
-
} while (len);
|
248
|
-
}
|
249
|
-
|
250
|
-
/* input was all buffered or compressed */
|
251
|
-
return put;
|
252
|
-
}
|
253
|
-
|
254
|
-
/* -- see zlib.h -- */
|
255
|
-
int ZEXPORT gzwrite(file, buf, len)
|
256
|
-
gzFile file;
|
257
|
-
voidpc buf;
|
258
|
-
unsigned len;
|
259
|
-
{
|
260
|
-
gz_statep state;
|
261
|
-
|
262
|
-
/* get internal structure */
|
263
|
-
if (file == NULL)
|
264
|
-
return 0;
|
265
|
-
state = (gz_statep)file;
|
266
|
-
|
267
|
-
/* check that we're writing and that there's no error */
|
268
|
-
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
269
|
-
return 0;
|
270
|
-
|
271
|
-
/* since an int is returned, make sure len fits in one, otherwise return
|
272
|
-
with an error (this avoids a flaw in the interface) */
|
273
|
-
if ((int)len < 0) {
|
274
|
-
gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
|
275
|
-
return 0;
|
276
|
-
}
|
277
|
-
|
278
|
-
/* write len bytes from buf (the return value will fit in an int) */
|
279
|
-
return (int)gz_write(state, buf, len);
|
280
|
-
}
|
281
|
-
|
282
|
-
/* -- see zlib.h -- */
|
283
|
-
z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
|
284
|
-
voidpc buf;
|
285
|
-
z_size_t size;
|
286
|
-
z_size_t nitems;
|
287
|
-
gzFile file;
|
288
|
-
{
|
289
|
-
z_size_t len;
|
290
|
-
gz_statep state;
|
291
|
-
|
292
|
-
/* get internal structure */
|
293
|
-
if (file == NULL)
|
294
|
-
return 0;
|
295
|
-
state = (gz_statep)file;
|
296
|
-
|
297
|
-
/* check that we're writing and that there's no error */
|
298
|
-
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
299
|
-
return 0;
|
300
|
-
|
301
|
-
/* compute bytes to read -- error on overflow */
|
302
|
-
len = nitems * size;
|
303
|
-
if (size && len / size != nitems) {
|
304
|
-
gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
|
305
|
-
return 0;
|
306
|
-
}
|
307
|
-
|
308
|
-
/* write len bytes to buf, return the number of full items written */
|
309
|
-
return len ? gz_write(state, buf, len) / size : 0;
|
310
|
-
}
|
311
|
-
|
312
|
-
/* -- see zlib.h -- */
|
313
|
-
int ZEXPORT gzputc(file, c)
|
314
|
-
gzFile file;
|
315
|
-
int c;
|
316
|
-
{
|
317
|
-
unsigned have;
|
318
|
-
unsigned char buf[1];
|
319
|
-
gz_statep state;
|
320
|
-
z_streamp strm;
|
321
|
-
|
322
|
-
/* get internal structure */
|
323
|
-
if (file == NULL)
|
324
|
-
return -1;
|
325
|
-
state = (gz_statep)file;
|
326
|
-
strm = &(state->strm);
|
327
|
-
|
328
|
-
/* check that we're writing and that there's no error */
|
329
|
-
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
330
|
-
return -1;
|
331
|
-
|
332
|
-
/* check for seek request */
|
333
|
-
if (state->seek) {
|
334
|
-
state->seek = 0;
|
335
|
-
if (gz_zero(state, state->skip) == -1)
|
336
|
-
return -1;
|
337
|
-
}
|
338
|
-
|
339
|
-
/* try writing to input buffer for speed (state->size == 0 if buffer not
|
340
|
-
initialized) */
|
341
|
-
if (state->size) {
|
342
|
-
if (strm->avail_in == 0)
|
343
|
-
strm->next_in = state->in;
|
344
|
-
have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
|
345
|
-
if (have < state->size) {
|
346
|
-
state->in[have] = (unsigned char)c;
|
347
|
-
strm->avail_in++;
|
348
|
-
state->x.pos++;
|
349
|
-
return c & 0xff;
|
350
|
-
}
|
351
|
-
}
|
352
|
-
|
353
|
-
/* no room in buffer or not initialized, use gz_write() */
|
354
|
-
buf[0] = (unsigned char)c;
|
355
|
-
if (gz_write(state, buf, 1) != 1)
|
356
|
-
return -1;
|
357
|
-
return c & 0xff;
|
358
|
-
}
|
359
|
-
|
360
|
-
/* -- see zlib.h -- */
|
361
|
-
int ZEXPORT gzputs(file, s)
|
362
|
-
gzFile file;
|
363
|
-
const char *s;
|
364
|
-
{
|
365
|
-
z_size_t len, put;
|
366
|
-
gz_statep state;
|
367
|
-
|
368
|
-
/* get internal structure */
|
369
|
-
if (file == NULL)
|
370
|
-
return -1;
|
371
|
-
state = (gz_statep)file;
|
372
|
-
|
373
|
-
/* check that we're writing and that there's no error */
|
374
|
-
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
375
|
-
return -1;
|
376
|
-
|
377
|
-
/* write string */
|
378
|
-
len = strlen(s);
|
379
|
-
if ((int)len < 0 || (unsigned)len != len) {
|
380
|
-
gz_error(state, Z_STREAM_ERROR, "string length does not fit in int");
|
381
|
-
return -1;
|
382
|
-
}
|
383
|
-
put = gz_write(state, s, len);
|
384
|
-
return put < len ? -1 : (int)len;
|
385
|
-
}
|
386
|
-
|
387
|
-
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
388
|
-
#include <stdarg.h>
|
389
|
-
|
390
|
-
/* -- see zlib.h -- */
|
391
|
-
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
392
|
-
{
|
393
|
-
int len;
|
394
|
-
unsigned left;
|
395
|
-
char *next;
|
396
|
-
gz_statep state;
|
397
|
-
z_streamp strm;
|
398
|
-
|
399
|
-
/* get internal structure */
|
400
|
-
if (file == NULL)
|
401
|
-
return Z_STREAM_ERROR;
|
402
|
-
state = (gz_statep)file;
|
403
|
-
strm = &(state->strm);
|
404
|
-
|
405
|
-
/* check that we're writing and that there's no error */
|
406
|
-
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
407
|
-
return Z_STREAM_ERROR;
|
408
|
-
|
409
|
-
/* make sure we have some buffer space */
|
410
|
-
if (state->size == 0 && gz_init(state) == -1)
|
411
|
-
return state->err;
|
412
|
-
|
413
|
-
/* check for seek request */
|
414
|
-
if (state->seek) {
|
415
|
-
state->seek = 0;
|
416
|
-
if (gz_zero(state, state->skip) == -1)
|
417
|
-
return state->err;
|
418
|
-
}
|
419
|
-
|
420
|
-
/* do the printf() into the input buffer, put length in len -- the input
|
421
|
-
buffer is double-sized just for this function, so there is guaranteed to
|
422
|
-
be state->size bytes available after the current contents */
|
423
|
-
if (strm->avail_in == 0)
|
424
|
-
strm->next_in = state->in;
|
425
|
-
next = (char *)(state->in + (strm->next_in - state->in) + strm->avail_in);
|
426
|
-
next[state->size - 1] = 0;
|
427
|
-
#ifdef NO_vsnprintf
|
428
|
-
# ifdef HAS_vsprintf_void
|
429
|
-
(void)vsprintf(next, format, va);
|
430
|
-
for (len = 0; len < state->size; len++)
|
431
|
-
if (next[len] == 0) break;
|
432
|
-
# else
|
433
|
-
len = vsprintf(next, format, va);
|
434
|
-
# endif
|
435
|
-
#else
|
436
|
-
# ifdef HAS_vsnprintf_void
|
437
|
-
(void)vsnprintf(next, state->size, format, va);
|
438
|
-
len = strlen(next);
|
439
|
-
# else
|
440
|
-
len = vsnprintf(next, state->size, format, va);
|
441
|
-
# endif
|
442
|
-
#endif
|
443
|
-
|
444
|
-
/* check that printf() results fit in buffer */
|
445
|
-
if (len == 0 || (unsigned)len >= state->size || next[state->size - 1] != 0)
|
446
|
-
return 0;
|
447
|
-
|
448
|
-
/* update buffer and position, compress first half if past that */
|
449
|
-
strm->avail_in += (unsigned)len;
|
450
|
-
state->x.pos += len;
|
451
|
-
if (strm->avail_in >= state->size) {
|
452
|
-
left = strm->avail_in - state->size;
|
453
|
-
strm->avail_in = state->size;
|
454
|
-
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
455
|
-
return state->err;
|
456
|
-
memmove(state->in, state->in + state->size, left);
|
457
|
-
strm->next_in = state->in;
|
458
|
-
strm->avail_in = left;
|
459
|
-
}
|
460
|
-
return len;
|
461
|
-
}
|
462
|
-
|
463
|
-
int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
|
464
|
-
{
|
465
|
-
va_list va;
|
466
|
-
int ret;
|
467
|
-
|
468
|
-
va_start(va, format);
|
469
|
-
ret = gzvprintf(file, format, va);
|
470
|
-
va_end(va);
|
471
|
-
return ret;
|
472
|
-
}
|
473
|
-
|
474
|
-
#else /* !STDC && !Z_HAVE_STDARG_H */
|
475
|
-
|
476
|
-
/* -- see zlib.h -- */
|
477
|
-
int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
478
|
-
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
479
|
-
gzFile file;
|
480
|
-
const char *format;
|
481
|
-
int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
482
|
-
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
|
483
|
-
{
|
484
|
-
unsigned len, left;
|
485
|
-
char *next;
|
486
|
-
gz_statep state;
|
487
|
-
z_streamp strm;
|
488
|
-
|
489
|
-
/* get internal structure */
|
490
|
-
if (file == NULL)
|
491
|
-
return Z_STREAM_ERROR;
|
492
|
-
state = (gz_statep)file;
|
493
|
-
strm = &(state->strm);
|
494
|
-
|
495
|
-
/* check that can really pass pointer in ints */
|
496
|
-
if (sizeof(int) != sizeof(void *))
|
497
|
-
return Z_STREAM_ERROR;
|
498
|
-
|
499
|
-
/* check that we're writing and that there's no error */
|
500
|
-
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
501
|
-
return Z_STREAM_ERROR;
|
502
|
-
|
503
|
-
/* make sure we have some buffer space */
|
504
|
-
if (state->size == 0 && gz_init(state) == -1)
|
505
|
-
return state->error;
|
506
|
-
|
507
|
-
/* check for seek request */
|
508
|
-
if (state->seek) {
|
509
|
-
state->seek = 0;
|
510
|
-
if (gz_zero(state, state->skip) == -1)
|
511
|
-
return state->error;
|
512
|
-
}
|
513
|
-
|
514
|
-
/* do the printf() into the input buffer, put length in len -- the input
|
515
|
-
buffer is double-sized just for this function, so there is guaranteed to
|
516
|
-
be state->size bytes available after the current contents */
|
517
|
-
if (strm->avail_in == 0)
|
518
|
-
strm->next_in = state->in;
|
519
|
-
next = (char *)(strm->next_in + strm->avail_in);
|
520
|
-
next[state->size - 1] = 0;
|
521
|
-
#ifdef NO_snprintf
|
522
|
-
# ifdef HAS_sprintf_void
|
523
|
-
sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
|
524
|
-
a13, a14, a15, a16, a17, a18, a19, a20);
|
525
|
-
for (len = 0; len < size; len++)
|
526
|
-
if (next[len] == 0)
|
527
|
-
break;
|
528
|
-
# else
|
529
|
-
len = sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
|
530
|
-
a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
531
|
-
# endif
|
532
|
-
#else
|
533
|
-
# ifdef HAS_snprintf_void
|
534
|
-
snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9,
|
535
|
-
a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
536
|
-
len = strlen(next);
|
537
|
-
# else
|
538
|
-
len = snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8,
|
539
|
-
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
540
|
-
# endif
|
541
|
-
#endif
|
542
|
-
|
543
|
-
/* check that printf() results fit in buffer */
|
544
|
-
if (len == 0 || len >= state->size || next[state->size - 1] != 0)
|
545
|
-
return 0;
|
546
|
-
|
547
|
-
/* update buffer and position, compress first half if past that */
|
548
|
-
strm->avail_in += len;
|
549
|
-
state->x.pos += len;
|
550
|
-
if (strm->avail_in >= state->size) {
|
551
|
-
left = strm->avail_in - state->size;
|
552
|
-
strm->avail_in = state->size;
|
553
|
-
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
554
|
-
return state->err;
|
555
|
-
memmove(state->in, state->in + state->size, left);
|
556
|
-
strm->next_in = state->in;
|
557
|
-
strm->avail_in = left;
|
558
|
-
}
|
559
|
-
return (int)len;
|
560
|
-
}
|
561
|
-
|
562
|
-
#endif
|
563
|
-
|
564
|
-
/* -- see zlib.h -- */
|
565
|
-
int ZEXPORT gzflush(file, flush)
|
566
|
-
gzFile file;
|
567
|
-
int flush;
|
568
|
-
{
|
569
|
-
gz_statep state;
|
570
|
-
|
571
|
-
/* get internal structure */
|
572
|
-
if (file == NULL)
|
573
|
-
return Z_STREAM_ERROR;
|
574
|
-
state = (gz_statep)file;
|
575
|
-
|
576
|
-
/* check that we're writing and that there's no error */
|
577
|
-
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
578
|
-
return Z_STREAM_ERROR;
|
579
|
-
|
580
|
-
/* check flush parameter */
|
581
|
-
if (flush < 0 || flush > Z_FINISH)
|
582
|
-
return Z_STREAM_ERROR;
|
583
|
-
|
584
|
-
/* check for seek request */
|
585
|
-
if (state->seek) {
|
586
|
-
state->seek = 0;
|
587
|
-
if (gz_zero(state, state->skip) == -1)
|
588
|
-
return state->err;
|
589
|
-
}
|
590
|
-
|
591
|
-
/* compress remaining data with requested flush */
|
592
|
-
(void)gz_comp(state, flush);
|
593
|
-
return state->err;
|
594
|
-
}
|
595
|
-
|
596
|
-
/* -- see zlib.h -- */
|
597
|
-
int ZEXPORT gzsetparams(file, level, strategy)
|
598
|
-
gzFile file;
|
599
|
-
int level;
|
600
|
-
int strategy;
|
601
|
-
{
|
602
|
-
gz_statep state;
|
603
|
-
z_streamp strm;
|
604
|
-
|
605
|
-
/* get internal structure */
|
606
|
-
if (file == NULL)
|
607
|
-
return Z_STREAM_ERROR;
|
608
|
-
state = (gz_statep)file;
|
609
|
-
strm = &(state->strm);
|
610
|
-
|
611
|
-
/* check that we're writing and that there's no error */
|
612
|
-
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
613
|
-
return Z_STREAM_ERROR;
|
614
|
-
|
615
|
-
/* if no change is requested, then do nothing */
|
616
|
-
if (level == state->level && strategy == state->strategy)
|
617
|
-
return Z_OK;
|
618
|
-
|
619
|
-
/* check for seek request */
|
620
|
-
if (state->seek) {
|
621
|
-
state->seek = 0;
|
622
|
-
if (gz_zero(state, state->skip) == -1)
|
623
|
-
return state->err;
|
624
|
-
}
|
625
|
-
|
626
|
-
/* change compression parameters for subsequent input */
|
627
|
-
if (state->size) {
|
628
|
-
/* flush previous input with previous parameters before changing */
|
629
|
-
if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1)
|
630
|
-
return state->err;
|
631
|
-
deflateParams(strm, level, strategy);
|
632
|
-
}
|
633
|
-
state->level = level;
|
634
|
-
state->strategy = strategy;
|
635
|
-
return Z_OK;
|
636
|
-
}
|
637
|
-
|
638
|
-
/* -- see zlib.h -- */
|
639
|
-
int ZEXPORT gzclose_w(file)
|
640
|
-
gzFile file;
|
641
|
-
{
|
642
|
-
int ret = Z_OK;
|
643
|
-
gz_statep state;
|
644
|
-
|
645
|
-
/* get internal structure */
|
646
|
-
if (file == NULL)
|
647
|
-
return Z_STREAM_ERROR;
|
648
|
-
state = (gz_statep)file;
|
649
|
-
|
650
|
-
/* check that we're writing */
|
651
|
-
if (state->mode != GZ_WRITE)
|
652
|
-
return Z_STREAM_ERROR;
|
653
|
-
|
654
|
-
/* check for seek request */
|
655
|
-
if (state->seek) {
|
656
|
-
state->seek = 0;
|
657
|
-
if (gz_zero(state, state->skip) == -1)
|
658
|
-
ret = state->err;
|
659
|
-
}
|
660
|
-
|
661
|
-
/* flush, free memory, and close file */
|
662
|
-
if (gz_comp(state, Z_FINISH) == -1)
|
663
|
-
ret = state->err;
|
664
|
-
if (state->size) {
|
665
|
-
if (!state->direct) {
|
666
|
-
(void)deflateEnd(&(state->strm));
|
667
|
-
free(state->out);
|
668
|
-
}
|
669
|
-
free(state->in);
|
670
|
-
}
|
671
|
-
gz_error(state, Z_OK, NULL);
|
672
|
-
free(state->path);
|
673
|
-
if (close(state->fd) == -1)
|
674
|
-
ret = Z_ERRNO;
|
675
|
-
free(state);
|
676
|
-
return ret;
|
677
|
-
}
|