grpc 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +581 -450
- data/include/grpc/census.h +49 -49
- data/include/grpc/grpc.h +16 -70
- data/include/grpc/grpc_security.h +59 -59
- data/include/grpc/grpc_security_constants.h +9 -9
- data/include/grpc/impl/codegen/atm.h +1 -1
- data/include/grpc/impl/codegen/atm_windows.h +4 -4
- data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
- data/include/grpc/impl/codegen/compression_types.h +4 -5
- data/include/grpc/impl/codegen/gpr_slice.h +5 -5
- data/include/grpc/impl/codegen/gpr_types.h +6 -7
- data/include/grpc/impl/codegen/grpc_types.h +128 -59
- data/include/grpc/impl/codegen/port_platform.h +6 -0
- data/include/grpc/impl/codegen/propagation_bits.h +2 -2
- data/include/grpc/impl/codegen/slice.h +13 -12
- data/include/grpc/impl/codegen/status.h +23 -18
- data/include/grpc/impl/codegen/sync.h +1 -1
- data/include/grpc/load_reporting.h +6 -6
- data/include/grpc/slice.h +47 -25
- data/include/grpc/slice_buffer.h +18 -14
- data/include/grpc/support/alloc.h +7 -7
- data/include/grpc/support/cmdline.h +10 -10
- data/include/grpc/support/cpu.h +3 -3
- data/include/grpc/support/histogram.h +1 -1
- data/include/grpc/support/host_port.h +2 -2
- data/include/grpc/support/log.h +9 -9
- data/include/grpc/support/log_windows.h +1 -1
- data/include/grpc/support/string_util.h +3 -3
- data/include/grpc/support/subprocess.h +3 -3
- data/include/grpc/support/sync.h +31 -31
- data/include/grpc/support/thd.h +11 -11
- data/include/grpc/support/time.h +12 -12
- data/include/grpc/support/tls.h +1 -1
- data/include/grpc/support/tls_gcc.h +2 -2
- data/include/grpc/support/tls_msvc.h +1 -1
- data/include/grpc/support/tls_pthread.h +1 -1
- data/include/grpc/support/useful.h +2 -2
- data/include/grpc/support/workaround_list.h +46 -0
- data/src/core/ext/census/context.c +1 -1
- data/src/core/ext/census/intrusive_hash_map.c +319 -0
- data/src/core/ext/census/intrusive_hash_map.h +167 -0
- data/src/core/ext/census/intrusive_hash_map_internal.h +63 -0
- data/src/core/ext/census/resource.c +3 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.c +1 -1
- data/src/core/ext/filters/client_channel/client_channel.c +173 -103
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +3 -2
- data/src/core/ext/filters/client_channel/lb_policy.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +153 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +42 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +405 -102
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +133 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +65 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +90 -51
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +7 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +19 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +63 -34
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +188 -294
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +28 -5
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +18 -4
- data/src/core/ext/filters/client_channel/parse_address.c +90 -59
- data/src/core/ext/filters/client_channel/parse_address.h +17 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +11 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +59 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/filters/client_channel/subchannel.c +20 -17
- data/src/core/ext/filters/client_channel/subchannel.h +1 -0
- data/src/core/ext/filters/client_channel/subchannel_index.c +11 -1
- data/src/core/ext/filters/client_channel/uri_parser.c +36 -22
- data/src/core/ext/filters/client_channel/uri_parser.h +1 -1
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.c +42 -17
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.h +8 -9
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.c +19 -11
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.h +3 -6
- data/src/core/ext/filters/http/http_filters_plugin.c +104 -0
- data/src/core/{lib/channel/compress_filter.c → ext/filters/http/message_compress/message_compress_filter.c} +124 -23
- data/src/core/{lib/channel/compress_filter.h → ext/filters/http/message_compress/message_compress_filter.h} +5 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.c +4 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.h +3 -3
- data/src/core/ext/filters/load_reporting/load_reporting.c +2 -25
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +26 -1
- data/src/core/ext/filters/max_age/max_age_filter.c +14 -14
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.c +91 -47
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.h +3 -3
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +223 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +40 -0
- data/src/core/ext/filters/workarounds/workaround_utils.c +65 -0
- data/src/core/ext/filters/workarounds/workaround_utils.h +52 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +2 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +3 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +319 -175
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.c +203 -164
- data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -14
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -5
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +4 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +2 -4
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +4 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +50 -33
- data/src/core/ext/transport/chttp2/transport/parsing.c +10 -11
- data/src/core/ext/transport/chttp2/transport/writing.c +32 -13
- data/src/core/lib/channel/channel_args.c +30 -9
- data/src/core/lib/channel/channel_args.h +5 -1
- data/src/core/lib/channel/channel_stack.c +1 -1
- data/src/core/lib/channel/channel_stack.h +2 -2
- data/src/core/lib/channel/channel_stack_builder.c +13 -1
- data/src/core/lib/channel/channel_stack_builder.h +5 -1
- data/src/core/lib/channel/connected_channel.c +3 -1
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/compression/message_compress.c +2 -2
- data/src/core/lib/debug/trace.c +13 -6
- data/src/core/lib/debug/trace.h +27 -1
- data/src/core/lib/http/httpcli.c +1 -1
- data/src/core/lib/http/httpcli_security_connector.c +9 -11
- data/src/core/lib/http/parser.c +2 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/combiner.c +6 -6
- data/src/core/lib/iomgr/combiner.h +2 -1
- data/src/core/lib/iomgr/error.c +12 -5
- data/src/core/lib/iomgr/error.h +13 -13
- data/src/core/lib/iomgr/ev_epoll1_linux.c +984 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.h +44 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +2146 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +1337 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epollex_linux.c +1511 -0
- data/src/core/lib/iomgr/ev_epollex_linux.h +43 -0
- data/src/core/lib/iomgr/{ev_epoll_linux.c → ev_epollsig_linux.c} +41 -33
- data/src/core/lib/iomgr/{ev_epoll_linux.h → ev_epollsig_linux.h} +4 -4
- data/src/core/lib/iomgr/ev_poll_posix.c +12 -27
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
- data/src/core/lib/iomgr/ev_posix.c +22 -8
- data/src/core/lib/iomgr/ev_posix.h +4 -3
- data/src/core/lib/iomgr/ev_windows.c +43 -0
- data/src/core/lib/iomgr/exec_ctx.c +5 -0
- data/src/core/lib/iomgr/exec_ctx.h +2 -0
- data/src/core/lib/iomgr/iomgr.c +4 -0
- data/src/core/lib/iomgr/iomgr.h +3 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.c +116 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.h +41 -0
- data/src/core/lib/iomgr/lockfree_event.c +16 -0
- data/src/core/lib/iomgr/pollset.h +2 -5
- data/src/core/lib/iomgr/pollset_uv.c +1 -1
- data/src/core/lib/iomgr/pollset_windows.c +3 -3
- data/src/core/lib/iomgr/resource_quota.c +9 -8
- data/src/core/lib/iomgr/resource_quota.h +2 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +2 -0
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +43 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +6 -6
- data/src/core/lib/iomgr/tcp_client_uv.c +3 -3
- data/src/core/lib/iomgr/tcp_posix.c +7 -7
- data/src/core/lib/iomgr/tcp_posix.h +2 -1
- data/src/core/lib/iomgr/tcp_server_posix.c +1 -1
- data/src/core/lib/iomgr/tcp_uv.c +6 -6
- data/src/core/lib/iomgr/tcp_uv.h +2 -1
- data/src/core/lib/iomgr/tcp_windows.c +1 -1
- data/src/core/lib/iomgr/timer_generic.c +24 -25
- data/src/core/lib/iomgr/timer_manager.c +276 -0
- data/src/core/lib/iomgr/timer_manager.h +52 -0
- data/src/core/lib/iomgr/timer_uv.c +6 -0
- data/src/core/lib/iomgr/udp_server.c +42 -9
- data/src/core/lib/iomgr/udp_server.h +3 -1
- data/src/core/lib/security/credentials/credentials.c +0 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.c +23 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -9
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +24 -53
- data/src/core/lib/security/transport/client_auth_filter.c +9 -3
- data/src/core/lib/security/transport/secure_endpoint.c +7 -7
- data/src/core/lib/security/transport/secure_endpoint.h +1 -1
- data/src/core/lib/security/transport/security_connector.c +45 -57
- data/src/core/lib/security/transport/security_connector.h +10 -14
- data/src/core/lib/security/transport/security_handshaker.c +123 -97
- data/src/core/lib/slice/b64.c +1 -1
- data/src/core/lib/slice/percent_encoding.c +3 -3
- data/src/core/lib/slice/slice.c +66 -33
- data/src/core/lib/slice/slice_buffer.c +25 -6
- data/src/core/lib/slice/slice_hash_table.c +33 -35
- data/src/core/lib/slice/slice_hash_table.h +7 -12
- data/src/core/lib/support/atomic.h +45 -0
- data/src/core/lib/support/atomic_with_atm.h +70 -0
- data/src/core/lib/support/atomic_with_std.h +48 -0
- data/src/core/lib/support/avl.c +14 -14
- data/src/core/lib/support/cmdline.c +3 -3
- data/src/core/lib/support/histogram.c +2 -2
- data/src/core/lib/support/host_port.c +1 -1
- data/src/core/lib/support/memory.h +74 -0
- data/src/core/lib/support/mpscq.c +36 -2
- data/src/core/lib/support/mpscq.h +28 -1
- data/src/core/lib/support/stack_lockfree.c +3 -36
- data/src/core/lib/support/string.c +12 -12
- data/src/core/lib/support/string_posix.c +1 -1
- data/src/core/lib/support/subprocess_posix.c +2 -2
- data/src/core/lib/support/thd_posix.c +1 -1
- data/src/core/lib/support/time_posix.c +8 -0
- data/src/core/lib/support/tmpfile_posix.c +10 -10
- data/src/core/lib/surface/alarm.c +3 -1
- data/src/core/lib/surface/api_trace.c +2 -1
- data/src/core/lib/surface/api_trace.h +2 -2
- data/src/core/lib/surface/byte_buffer_reader.c +1 -1
- data/src/core/lib/surface/call.c +65 -22
- data/src/core/lib/surface/call.h +4 -2
- data/src/core/lib/surface/channel_init.c +2 -19
- data/src/core/lib/surface/channel_stack_type.c +18 -0
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.c +694 -247
- data/src/core/lib/surface/completion_queue.h +30 -13
- data/src/core/lib/surface/completion_queue_factory.c +24 -9
- data/src/core/lib/surface/init.c +1 -52
- data/src/core/lib/surface/{lame_client.c → lame_client.cc} +37 -26
- data/src/core/lib/surface/server.c +79 -110
- data/src/core/lib/surface/server.h +2 -1
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.c +25 -9
- data/src/core/lib/transport/bdp_estimator.h +7 -1
- data/src/core/lib/transport/byte_stream.c +23 -9
- data/src/core/lib/transport/byte_stream.h +15 -6
- data/src/core/lib/transport/connectivity_state.c +6 -6
- data/src/core/lib/transport/connectivity_state.h +2 -1
- data/src/core/lib/transport/service_config.c +6 -13
- data/src/core/lib/transport/service_config.h +2 -2
- data/src/core/lib/transport/static_metadata.c +403 -389
- data/src/core/lib/transport/static_metadata.h +127 -114
- data/src/core/plugin_registry/grpc_plugin_registry.c +16 -0
- data/src/core/tsi/fake_transport_security.c +5 -4
- data/src/core/tsi/ssl_transport_security.c +71 -82
- data/src/core/tsi/ssl_transport_security.h +39 -61
- data/src/core/tsi/transport_security.c +83 -2
- data/src/core/tsi/transport_security.h +27 -2
- data/src/core/tsi/transport_security_adapter.c +236 -0
- data/src/core/tsi/transport_security_adapter.h +62 -0
- data/src/core/tsi/transport_security_interface.h +179 -66
- data/src/ruby/ext/grpc/extconf.rb +2 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -6
- data/src/ruby/ext/grpc/rb_call.c +56 -48
- data/src/ruby/ext/grpc/rb_call.h +3 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +23 -22
- data/src/ruby/ext/grpc/rb_channel.c +2 -3
- data/src/ruby/ext/grpc/rb_channel_args.c +11 -9
- data/src/ruby/ext/grpc/rb_channel_credentials.c +16 -12
- data/src/ruby/ext/grpc/rb_completion_queue.c +7 -9
- data/src/ruby/ext/grpc/rb_compression_options.c +7 -6
- data/src/ruby/ext/grpc/rb_event_thread.c +10 -12
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -2
- data/src/ruby/ext/grpc/rb_grpc.c +11 -15
- data/src/ruby/ext/grpc/rb_grpc.h +2 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +25 -10
- data/src/ruby/ext/grpc/rb_server.c +26 -28
- data/src/ruby/lib/grpc/grpc.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/cares/config_linux/ares_config.h +36 -2
- data/third_party/zlib/adler32.c +14 -7
- data/third_party/zlib/compress.c +24 -18
- data/third_party/zlib/crc32.c +29 -12
- data/third_party/zlib/deflate.c +499 -303
- data/third_party/zlib/deflate.h +19 -16
- data/third_party/zlib/gzguts.h +16 -7
- data/third_party/zlib/gzlib.c +17 -14
- data/third_party/zlib/gzread.c +108 -48
- data/third_party/zlib/gzwrite.c +210 -122
- data/third_party/zlib/infback.c +2 -2
- data/third_party/zlib/inffast.c +34 -51
- data/third_party/zlib/inflate.c +86 -37
- data/third_party/zlib/inflate.h +7 -4
- data/third_party/zlib/inftrees.c +12 -14
- data/third_party/zlib/trees.c +38 -61
- data/third_party/zlib/uncompr.c +66 -32
- data/third_party/zlib/zconf.h +32 -9
- data/third_party/zlib/zlib.h +298 -154
- data/third_party/zlib/zutil.c +25 -24
- data/third_party/zlib/zutil.h +35 -17
- metadata +63 -30
data/third_party/zlib/inflate.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* inflate.h -- internal inflate state definition
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2016 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
/* Possible inflate modes between inflate() calls */
|
20
20
|
typedef enum {
|
21
|
-
HEAD,
|
21
|
+
HEAD = 16180, /* i: waiting for magic header */
|
22
22
|
FLAGS, /* i: waiting for method and flags (gzip) */
|
23
23
|
TIME, /* i: waiting for modification time (gzip) */
|
24
24
|
OS, /* i: waiting for extra flags and operating system (gzip) */
|
@@ -77,11 +77,14 @@ typedef enum {
|
|
77
77
|
CHECK -> LENGTH -> DONE
|
78
78
|
*/
|
79
79
|
|
80
|
-
/*
|
80
|
+
/* State maintained between inflate() calls -- approximately 7K bytes, not
|
81
|
+
including the allocated sliding window, which is up to 32K bytes. */
|
81
82
|
struct inflate_state {
|
83
|
+
z_streamp strm; /* pointer back to this zlib stream */
|
82
84
|
inflate_mode mode; /* current inflate mode */
|
83
85
|
int last; /* true if processing last block */
|
84
|
-
int wrap; /* bit 0 true for zlib, bit 1 true for gzip
|
86
|
+
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
|
87
|
+
bit 2 true to validate check value */
|
85
88
|
int havedict; /* true if dictionary provided */
|
86
89
|
int flags; /* gzip header method and flags (0 if zlib) */
|
87
90
|
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
|
data/third_party/zlib/inftrees.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* inftrees.c -- generate Huffman trees for efficient decoding
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2017 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#define MAXBITS 15
|
10
10
|
|
11
11
|
const char inflate_copyright[] =
|
12
|
-
" inflate 1.2.
|
12
|
+
" inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
|
13
13
|
/*
|
14
14
|
If you use the zlib library in a product, an acknowledgment is welcome
|
15
15
|
in the documentation of your product. If for some reason you cannot
|
@@ -54,7 +54,7 @@ unsigned short FAR *work;
|
|
54
54
|
code FAR *next; /* next available space in table */
|
55
55
|
const unsigned short FAR *base; /* base value table to use */
|
56
56
|
const unsigned short FAR *extra; /* extra bits table to use */
|
57
|
-
|
57
|
+
unsigned match; /* use base and extra for symbol >= match */
|
58
58
|
unsigned short count[MAXBITS+1]; /* number of codes of each length */
|
59
59
|
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
|
60
60
|
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
|
@@ -62,7 +62,7 @@ unsigned short FAR *work;
|
|
62
62
|
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
63
63
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
64
64
|
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
65
|
-
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16,
|
65
|
+
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
|
66
66
|
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
67
67
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
68
68
|
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
@@ -181,19 +181,17 @@ unsigned short FAR *work;
|
|
181
181
|
switch (type) {
|
182
182
|
case CODES:
|
183
183
|
base = extra = work; /* dummy value--not used */
|
184
|
-
|
184
|
+
match = 20;
|
185
185
|
break;
|
186
186
|
case LENS:
|
187
187
|
base = lbase;
|
188
|
-
base -= 257;
|
189
188
|
extra = lext;
|
190
|
-
|
191
|
-
end = 256;
|
189
|
+
match = 257;
|
192
190
|
break;
|
193
|
-
default:
|
191
|
+
default: /* DISTS */
|
194
192
|
base = dbase;
|
195
193
|
extra = dext;
|
196
|
-
|
194
|
+
match = 0;
|
197
195
|
}
|
198
196
|
|
199
197
|
/* initialize state for loop */
|
@@ -216,13 +214,13 @@ unsigned short FAR *work;
|
|
216
214
|
for (;;) {
|
217
215
|
/* create table entry */
|
218
216
|
here.bits = (unsigned char)(len - drop);
|
219
|
-
if (
|
217
|
+
if (work[sym] + 1U < match) {
|
220
218
|
here.op = (unsigned char)0;
|
221
219
|
here.val = work[sym];
|
222
220
|
}
|
223
|
-
else if (
|
224
|
-
here.op = (unsigned char)(extra[work[sym]]);
|
225
|
-
here.val = base[work[sym]];
|
221
|
+
else if (work[sym] >= match) {
|
222
|
+
here.op = (unsigned char)(extra[work[sym] - match]);
|
223
|
+
here.val = base[work[sym] - match];
|
226
224
|
}
|
227
225
|
else {
|
228
226
|
here.op = (unsigned char)(32 + 64); /* end of block */
|
data/third_party/zlib/trees.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* trees.c -- output deflated data using Huffman coding
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2017 Jean-loup Gailly
|
3
3
|
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
4
4
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
5
5
|
*/
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
#include "deflate.h"
|
38
38
|
|
39
|
-
#ifdef
|
39
|
+
#ifdef ZLIB_DEBUG
|
40
40
|
# include <ctype.h>
|
41
41
|
#endif
|
42
42
|
|
@@ -122,13 +122,13 @@ struct static_tree_desc_s {
|
|
122
122
|
int max_length; /* max bit length for the codes */
|
123
123
|
};
|
124
124
|
|
125
|
-
local static_tree_desc static_l_desc =
|
125
|
+
local const static_tree_desc static_l_desc =
|
126
126
|
{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
|
127
127
|
|
128
|
-
local static_tree_desc static_d_desc =
|
128
|
+
local const static_tree_desc static_d_desc =
|
129
129
|
{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
|
130
130
|
|
131
|
-
local static_tree_desc static_bl_desc =
|
131
|
+
local const static_tree_desc static_bl_desc =
|
132
132
|
{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
|
133
133
|
|
134
134
|
/* ===========================================================================
|
@@ -152,18 +152,16 @@ local int detect_data_type OF((deflate_state *s));
|
|
152
152
|
local unsigned bi_reverse OF((unsigned value, int length));
|
153
153
|
local void bi_windup OF((deflate_state *s));
|
154
154
|
local void bi_flush OF((deflate_state *s));
|
155
|
-
local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
|
156
|
-
int header));
|
157
155
|
|
158
156
|
#ifdef GEN_TREES_H
|
159
157
|
local void gen_trees_header OF((void));
|
160
158
|
#endif
|
161
159
|
|
162
|
-
#ifndef
|
160
|
+
#ifndef ZLIB_DEBUG
|
163
161
|
# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
|
164
162
|
/* Send a code of the given tree. c and tree must not have side effects */
|
165
163
|
|
166
|
-
#else /*
|
164
|
+
#else /* !ZLIB_DEBUG */
|
167
165
|
# define send_code(s, c, tree) \
|
168
166
|
{ if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
|
169
167
|
send_bits(s, tree[c].Code, tree[c].Len); }
|
@@ -182,7 +180,7 @@ local void gen_trees_header OF((void));
|
|
182
180
|
* Send a value on a given number of bits.
|
183
181
|
* IN assertion: length <= 16 and value fits in length bits.
|
184
182
|
*/
|
185
|
-
#ifdef
|
183
|
+
#ifdef ZLIB_DEBUG
|
186
184
|
local void send_bits OF((deflate_state *s, int value, int length));
|
187
185
|
|
188
186
|
local void send_bits(s, value, length)
|
@@ -208,12 +206,12 @@ local void send_bits(s, value, length)
|
|
208
206
|
s->bi_valid += length;
|
209
207
|
}
|
210
208
|
}
|
211
|
-
#else /* !
|
209
|
+
#else /* !ZLIB_DEBUG */
|
212
210
|
|
213
211
|
#define send_bits(s, value, length) \
|
214
212
|
{ int len = length;\
|
215
213
|
if (s->bi_valid > (int)Buf_size - len) {\
|
216
|
-
int val = value;\
|
214
|
+
int val = (int)value;\
|
217
215
|
s->bi_buf |= (ush)val << s->bi_valid;\
|
218
216
|
put_short(s, s->bi_buf);\
|
219
217
|
s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
|
@@ -223,7 +221,7 @@ local void send_bits(s, value, length)
|
|
223
221
|
s->bi_valid += len;\
|
224
222
|
}\
|
225
223
|
}
|
226
|
-
#endif /*
|
224
|
+
#endif /* ZLIB_DEBUG */
|
227
225
|
|
228
226
|
|
229
227
|
/* the arguments must not have side effects */
|
@@ -317,7 +315,7 @@ local void tr_static_init()
|
|
317
315
|
* Genererate the file trees.h describing the static trees.
|
318
316
|
*/
|
319
317
|
#ifdef GEN_TREES_H
|
320
|
-
# ifndef
|
318
|
+
# ifndef ZLIB_DEBUG
|
321
319
|
# include <stdio.h>
|
322
320
|
# endif
|
323
321
|
|
@@ -394,7 +392,7 @@ void ZLIB_INTERNAL _tr_init(s)
|
|
394
392
|
|
395
393
|
s->bi_buf = 0;
|
396
394
|
s->bi_valid = 0;
|
397
|
-
#ifdef
|
395
|
+
#ifdef ZLIB_DEBUG
|
398
396
|
s->compressed_len = 0L;
|
399
397
|
s->bits_sent = 0L;
|
400
398
|
#endif
|
@@ -522,12 +520,12 @@ local void gen_bitlen(s, desc)
|
|
522
520
|
xbits = 0;
|
523
521
|
if (n >= base) xbits = extra[n-base];
|
524
522
|
f = tree[n].Freq;
|
525
|
-
s->opt_len += (ulg)f * (bits + xbits);
|
526
|
-
if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
|
523
|
+
s->opt_len += (ulg)f * (unsigned)(bits + xbits);
|
524
|
+
if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits);
|
527
525
|
}
|
528
526
|
if (overflow == 0) return;
|
529
527
|
|
530
|
-
|
528
|
+
Tracev((stderr,"\nbit length overflow\n"));
|
531
529
|
/* This happens for example on obj2 and pic of the Calgary corpus */
|
532
530
|
|
533
531
|
/* Find the first bit length which could increase: */
|
@@ -554,9 +552,8 @@ local void gen_bitlen(s, desc)
|
|
554
552
|
m = s->heap[--h];
|
555
553
|
if (m > max_code) continue;
|
556
554
|
if ((unsigned) tree[m].Len != (unsigned) bits) {
|
557
|
-
|
558
|
-
s->opt_len += ((
|
559
|
-
*(long)tree[m].Freq;
|
555
|
+
Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
|
556
|
+
s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq;
|
560
557
|
tree[m].Len = (ush)bits;
|
561
558
|
}
|
562
559
|
n--;
|
@@ -578,7 +575,7 @@ local void gen_codes (tree, max_code, bl_count)
|
|
578
575
|
ushf *bl_count; /* number of codes at each bit length */
|
579
576
|
{
|
580
577
|
ush next_code[MAX_BITS+1]; /* next code value for each bit length */
|
581
|
-
|
578
|
+
unsigned code = 0; /* running code value */
|
582
579
|
int bits; /* bit index */
|
583
580
|
int n; /* code index */
|
584
581
|
|
@@ -586,7 +583,8 @@ local void gen_codes (tree, max_code, bl_count)
|
|
586
583
|
* without bit reversal.
|
587
584
|
*/
|
588
585
|
for (bits = 1; bits <= MAX_BITS; bits++) {
|
589
|
-
|
586
|
+
code = (code + bl_count[bits-1]) << 1;
|
587
|
+
next_code[bits] = (ush)code;
|
590
588
|
}
|
591
589
|
/* Check that the bit counts in bl_count are consistent. The last code
|
592
590
|
* must be all ones.
|
@@ -599,7 +597,7 @@ local void gen_codes (tree, max_code, bl_count)
|
|
599
597
|
int len = tree[n].Len;
|
600
598
|
if (len == 0) continue;
|
601
599
|
/* Now reverse the bits */
|
602
|
-
tree[n].Code = bi_reverse(next_code[len]++, len);
|
600
|
+
tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
|
603
601
|
|
604
602
|
Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
605
603
|
n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
|
@@ -821,7 +819,7 @@ local int build_bl_tree(s)
|
|
821
819
|
if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
|
822
820
|
}
|
823
821
|
/* Update opt_len to include the bit length tree and counts */
|
824
|
-
s->opt_len += 3*(max_blindex+1) + 5+5+4;
|
822
|
+
s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4;
|
825
823
|
Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
|
826
824
|
s->opt_len, s->static_len));
|
827
825
|
|
@@ -869,11 +867,17 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
|
|
869
867
|
int last; /* one if this is the last block for a file */
|
870
868
|
{
|
871
869
|
send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
|
872
|
-
|
870
|
+
bi_windup(s); /* align on byte boundary */
|
871
|
+
put_short(s, (ush)stored_len);
|
872
|
+
put_short(s, (ush)~stored_len);
|
873
|
+
zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
|
874
|
+
s->pending += stored_len;
|
875
|
+
#ifdef ZLIB_DEBUG
|
873
876
|
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
|
874
877
|
s->compressed_len += (stored_len + 4) << 3;
|
878
|
+
s->bits_sent += 2*16;
|
879
|
+
s->bits_sent += stored_len<<3;
|
875
880
|
#endif
|
876
|
-
copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
|
877
881
|
}
|
878
882
|
|
879
883
|
/* ===========================================================================
|
@@ -894,7 +898,7 @@ void ZLIB_INTERNAL _tr_align(s)
|
|
894
898
|
{
|
895
899
|
send_bits(s, STATIC_TREES<<1, 3);
|
896
900
|
send_code(s, END_BLOCK, static_ltree);
|
897
|
-
#ifdef
|
901
|
+
#ifdef ZLIB_DEBUG
|
898
902
|
s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
|
899
903
|
#endif
|
900
904
|
bi_flush(s);
|
@@ -902,7 +906,7 @@ void ZLIB_INTERNAL _tr_align(s)
|
|
902
906
|
|
903
907
|
/* ===========================================================================
|
904
908
|
* Determine the best encoding for the current block: dynamic trees, static
|
905
|
-
* trees or store, and
|
909
|
+
* trees or store, and write out the encoded block.
|
906
910
|
*/
|
907
911
|
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
908
912
|
deflate_state *s;
|
@@ -974,7 +978,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
|
974
978
|
send_bits(s, (STATIC_TREES<<1)+last, 3);
|
975
979
|
compress_block(s, (const ct_data *)static_ltree,
|
976
980
|
(const ct_data *)static_dtree);
|
977
|
-
#ifdef
|
981
|
+
#ifdef ZLIB_DEBUG
|
978
982
|
s->compressed_len += 3 + s->static_len;
|
979
983
|
#endif
|
980
984
|
} else {
|
@@ -983,7 +987,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
|
983
987
|
max_blindex+1);
|
984
988
|
compress_block(s, (const ct_data *)s->dyn_ltree,
|
985
989
|
(const ct_data *)s->dyn_dtree);
|
986
|
-
#ifdef
|
990
|
+
#ifdef ZLIB_DEBUG
|
987
991
|
s->compressed_len += 3 + s->opt_len;
|
988
992
|
#endif
|
989
993
|
}
|
@@ -995,7 +999,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
|
995
999
|
|
996
1000
|
if (last) {
|
997
1001
|
bi_windup(s);
|
998
|
-
#ifdef
|
1002
|
+
#ifdef ZLIB_DEBUG
|
999
1003
|
s->compressed_len += 7; /* align on byte boundary */
|
1000
1004
|
#endif
|
1001
1005
|
}
|
@@ -1090,7 +1094,7 @@ local void compress_block(s, ltree, dtree)
|
|
1090
1094
|
send_code(s, code, dtree); /* send the distance code */
|
1091
1095
|
extra = extra_dbits[code];
|
1092
1096
|
if (extra != 0) {
|
1093
|
-
dist -= base_dist[code];
|
1097
|
+
dist -= (unsigned)base_dist[code];
|
1094
1098
|
send_bits(s, dist, extra); /* send the extra distance bits */
|
1095
1099
|
}
|
1096
1100
|
} /* literal or match pair ? */
|
@@ -1193,34 +1197,7 @@ local void bi_windup(s)
|
|
1193
1197
|
}
|
1194
1198
|
s->bi_buf = 0;
|
1195
1199
|
s->bi_valid = 0;
|
1196
|
-
#ifdef
|
1200
|
+
#ifdef ZLIB_DEBUG
|
1197
1201
|
s->bits_sent = (s->bits_sent+7) & ~7;
|
1198
1202
|
#endif
|
1199
1203
|
}
|
1200
|
-
|
1201
|
-
/* ===========================================================================
|
1202
|
-
* Copy a stored block, storing first the length and its
|
1203
|
-
* one's complement if requested.
|
1204
|
-
*/
|
1205
|
-
local void copy_block(s, buf, len, header)
|
1206
|
-
deflate_state *s;
|
1207
|
-
charf *buf; /* the input data */
|
1208
|
-
unsigned len; /* its length */
|
1209
|
-
int header; /* true if block header must be written */
|
1210
|
-
{
|
1211
|
-
bi_windup(s); /* align on byte boundary */
|
1212
|
-
|
1213
|
-
if (header) {
|
1214
|
-
put_short(s, (ush)len);
|
1215
|
-
put_short(s, (ush)~len);
|
1216
|
-
#ifdef DEBUG
|
1217
|
-
s->bits_sent += 2*16;
|
1218
|
-
#endif
|
1219
|
-
}
|
1220
|
-
#ifdef DEBUG
|
1221
|
-
s->bits_sent += (ulg)len<<3;
|
1222
|
-
#endif
|
1223
|
-
while (len--) {
|
1224
|
-
put_byte(s, *buf++);
|
1225
|
-
}
|
1226
|
-
}
|
data/third_party/zlib/uncompr.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* uncompr.c -- decompress a memory buffer
|
2
|
-
* Copyright (C) 1995-2003, 2010 Jean-loup Gailly
|
2
|
+
* Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -9,51 +9,85 @@
|
|
9
9
|
#include "zlib.h"
|
10
10
|
|
11
11
|
/* ===========================================================================
|
12
|
-
Decompresses the source buffer into the destination buffer. sourceLen is
|
13
|
-
the byte length of the source buffer. Upon entry, destLen is the total
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
Decompresses the source buffer into the destination buffer. *sourceLen is
|
13
|
+
the byte length of the source buffer. Upon entry, *destLen is the total size
|
14
|
+
of the destination buffer, which must be large enough to hold the entire
|
15
|
+
uncompressed data. (The size of the uncompressed data must have been saved
|
16
|
+
previously by the compressor and transmitted to the decompressor by some
|
17
|
+
mechanism outside the scope of this compression library.) Upon exit,
|
18
|
+
*destLen is the size of the decompressed data and *sourceLen is the number
|
19
|
+
of source bytes consumed. Upon return, source + *sourceLen points to the
|
20
|
+
first unused input byte.
|
21
|
+
|
22
|
+
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
23
|
+
memory, Z_BUF_ERROR if there was not enough room in the output buffer, or
|
24
|
+
Z_DATA_ERROR if the input data was corrupted, including if the input data is
|
25
|
+
an incomplete zlib stream.
|
23
26
|
*/
|
24
|
-
int ZEXPORT
|
27
|
+
int ZEXPORT uncompress2 (dest, destLen, source, sourceLen)
|
25
28
|
Bytef *dest;
|
26
29
|
uLongf *destLen;
|
27
30
|
const Bytef *source;
|
28
|
-
uLong sourceLen;
|
31
|
+
uLong *sourceLen;
|
29
32
|
{
|
30
33
|
z_stream stream;
|
31
34
|
int err;
|
35
|
+
const uInt max = (uInt)-1;
|
36
|
+
uLong len, left;
|
37
|
+
Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */
|
32
38
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
len = *sourceLen;
|
40
|
+
if (*destLen) {
|
41
|
+
left = *destLen;
|
42
|
+
*destLen = 0;
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
left = 1;
|
46
|
+
dest = buf;
|
47
|
+
}
|
41
48
|
|
49
|
+
stream.next_in = (z_const Bytef *)source;
|
50
|
+
stream.avail_in = 0;
|
42
51
|
stream.zalloc = (alloc_func)0;
|
43
52
|
stream.zfree = (free_func)0;
|
53
|
+
stream.opaque = (voidpf)0;
|
44
54
|
|
45
55
|
err = inflateInit(&stream);
|
46
56
|
if (err != Z_OK) return err;
|
47
57
|
|
48
|
-
|
49
|
-
|
50
|
-
inflateEnd(&stream);
|
51
|
-
if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
|
52
|
-
return Z_DATA_ERROR;
|
53
|
-
return err;
|
54
|
-
}
|
55
|
-
*destLen = stream.total_out;
|
58
|
+
stream.next_out = dest;
|
59
|
+
stream.avail_out = 0;
|
56
60
|
|
57
|
-
|
58
|
-
|
61
|
+
do {
|
62
|
+
if (stream.avail_out == 0) {
|
63
|
+
stream.avail_out = left > (uLong)max ? max : (uInt)left;
|
64
|
+
left -= stream.avail_out;
|
65
|
+
}
|
66
|
+
if (stream.avail_in == 0) {
|
67
|
+
stream.avail_in = len > (uLong)max ? max : (uInt)len;
|
68
|
+
len -= stream.avail_in;
|
69
|
+
}
|
70
|
+
err = inflate(&stream, Z_NO_FLUSH);
|
71
|
+
} while (err == Z_OK);
|
72
|
+
|
73
|
+
*sourceLen -= len + stream.avail_in;
|
74
|
+
if (dest != buf)
|
75
|
+
*destLen = stream.total_out;
|
76
|
+
else if (stream.total_out && err == Z_BUF_ERROR)
|
77
|
+
left = 1;
|
78
|
+
|
79
|
+
inflateEnd(&stream);
|
80
|
+
return err == Z_STREAM_END ? Z_OK :
|
81
|
+
err == Z_NEED_DICT ? Z_DATA_ERROR :
|
82
|
+
err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
|
83
|
+
err;
|
84
|
+
}
|
85
|
+
|
86
|
+
int ZEXPORT uncompress (dest, destLen, source, sourceLen)
|
87
|
+
Bytef *dest;
|
88
|
+
uLongf *destLen;
|
89
|
+
const Bytef *source;
|
90
|
+
uLong sourceLen;
|
91
|
+
{
|
92
|
+
return uncompress2(dest, destLen, source, &sourceLen);
|
59
93
|
}
|