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/deflate.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* deflate.h -- internal compression state
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2016 Jean-loup Gailly
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -51,13 +51,16 @@
|
|
51
51
|
#define Buf_size 16
|
52
52
|
/* size of bit buffer in bi_buf */
|
53
53
|
|
54
|
-
#define INIT_STATE 42
|
55
|
-
#
|
56
|
-
#define
|
57
|
-
#
|
58
|
-
#define
|
59
|
-
#define
|
60
|
-
#define
|
54
|
+
#define INIT_STATE 42 /* zlib header -> BUSY_STATE */
|
55
|
+
#ifdef GZIP
|
56
|
+
# define GZIP_STATE 57 /* gzip header -> BUSY_STATE | EXTRA_STATE */
|
57
|
+
#endif
|
58
|
+
#define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */
|
59
|
+
#define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */
|
60
|
+
#define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */
|
61
|
+
#define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */
|
62
|
+
#define BUSY_STATE 113 /* deflate -> FINISH_STATE */
|
63
|
+
#define FINISH_STATE 666 /* stream complete */
|
61
64
|
/* Stream status */
|
62
65
|
|
63
66
|
|
@@ -83,7 +86,7 @@ typedef struct static_tree_desc_s static_tree_desc;
|
|
83
86
|
typedef struct tree_desc_s {
|
84
87
|
ct_data *dyn_tree; /* the dynamic tree */
|
85
88
|
int max_code; /* largest code with non zero frequency */
|
86
|
-
static_tree_desc *stat_desc;
|
89
|
+
const static_tree_desc *stat_desc; /* the corresponding static tree */
|
87
90
|
} FAR tree_desc;
|
88
91
|
|
89
92
|
typedef ush Pos;
|
@@ -100,10 +103,10 @@ typedef struct internal_state {
|
|
100
103
|
Bytef *pending_buf; /* output still pending */
|
101
104
|
ulg pending_buf_size; /* size of pending_buf */
|
102
105
|
Bytef *pending_out; /* next pending byte to output to the stream */
|
103
|
-
|
106
|
+
ulg pending; /* nb of bytes in the pending buffer */
|
104
107
|
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
|
105
108
|
gz_headerp gzhead; /* gzip header information to write */
|
106
|
-
|
109
|
+
ulg gzindex; /* where in extra, name, or comment */
|
107
110
|
Byte method; /* can only be DEFLATED */
|
108
111
|
int last_flush; /* value of flush param for previous deflate call */
|
109
112
|
|
@@ -249,7 +252,7 @@ typedef struct internal_state {
|
|
249
252
|
uInt matches; /* number of string matches in current block */
|
250
253
|
uInt insert; /* bytes at end of window left to insert */
|
251
254
|
|
252
|
-
#ifdef
|
255
|
+
#ifdef ZLIB_DEBUG
|
253
256
|
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
|
254
257
|
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
|
255
258
|
#endif
|
@@ -275,7 +278,7 @@ typedef struct internal_state {
|
|
275
278
|
/* Output a byte on the stream.
|
276
279
|
* IN assertion: there is enough room in pending_buf.
|
277
280
|
*/
|
278
|
-
#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
|
281
|
+
#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
|
279
282
|
|
280
283
|
|
281
284
|
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
|
@@ -309,7 +312,7 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
|
309
312
|
* used.
|
310
313
|
*/
|
311
314
|
|
312
|
-
#ifndef
|
315
|
+
#ifndef ZLIB_DEBUG
|
313
316
|
/* Inline versions of _tr_tally for speed: */
|
314
317
|
|
315
318
|
#if defined(GEN_TREES_H) || !defined(STDC)
|
@@ -328,8 +331,8 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
|
328
331
|
flush = (s->last_lit == s->lit_bufsize-1); \
|
329
332
|
}
|
330
333
|
# define _tr_tally_dist(s, distance, length, flush) \
|
331
|
-
{ uch len = (length); \
|
332
|
-
ush dist = (distance); \
|
334
|
+
{ uch len = (uch)(length); \
|
335
|
+
ush dist = (ush)(distance); \
|
333
336
|
s->d_buf[s->last_lit] = dist; \
|
334
337
|
s->l_buf[s->last_lit++] = len; \
|
335
338
|
dist--; \
|
data/third_party/zlib/gzguts.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* gzguts.h -- zlib internal header definitions for gz* operations
|
2
|
-
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
|
2
|
+
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -25,6 +25,10 @@
|
|
25
25
|
# include <stdlib.h>
|
26
26
|
# include <limits.h>
|
27
27
|
#endif
|
28
|
+
|
29
|
+
#ifndef _POSIX_SOURCE
|
30
|
+
# define _POSIX_SOURCE
|
31
|
+
#endif
|
28
32
|
#include <fcntl.h>
|
29
33
|
|
30
34
|
#ifdef _WIN32
|
@@ -35,6 +39,10 @@
|
|
35
39
|
# include <io.h>
|
36
40
|
#endif
|
37
41
|
|
42
|
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
43
|
+
# define WIDECHAR
|
44
|
+
#endif
|
45
|
+
|
38
46
|
#ifdef WINAPI_FAMILY
|
39
47
|
# define open _open
|
40
48
|
# define read _read
|
@@ -95,18 +103,19 @@
|
|
95
103
|
# endif
|
96
104
|
#endif
|
97
105
|
|
98
|
-
/* unlike snprintf (which is required in C99,
|
99
|
-
|
100
|
-
termination of the result -- however this is only used in gzlib.c where
|
106
|
+
/* unlike snprintf (which is required in C99), _snprintf does not guarantee
|
107
|
+
null termination of the result -- however this is only used in gzlib.c where
|
101
108
|
the result is assured to fit in the space provided */
|
102
|
-
#
|
109
|
+
#if defined(_MSC_VER) && _MSC_VER < 1900
|
103
110
|
# define snprintf _snprintf
|
104
111
|
#endif
|
105
112
|
|
106
113
|
#ifndef local
|
107
114
|
# define local static
|
108
115
|
#endif
|
109
|
-
/*
|
116
|
+
/* since "static" is used to mean two completely different things in C, we
|
117
|
+
define "local" for the non-static meaning of "static", for readability
|
118
|
+
(compile with -Dlocal if your debugger can't find static symbols) */
|
110
119
|
|
111
120
|
/* gz* functions always use library allocation functions */
|
112
121
|
#ifndef STDC
|
@@ -170,7 +179,7 @@ typedef struct {
|
|
170
179
|
char *path; /* path or fd for error messages */
|
171
180
|
unsigned size; /* buffer size, zero if not allocated yet */
|
172
181
|
unsigned want; /* requested buffer size, default is GZBUFSIZE */
|
173
|
-
unsigned char *in; /* input buffer */
|
182
|
+
unsigned char *in; /* input buffer (double-sized when writing) */
|
174
183
|
unsigned char *out; /* output buffer (double-sized when reading) */
|
175
184
|
int direct; /* 0 if processing gzip, 1 if transparent */
|
176
185
|
/* just for reading */
|
data/third_party/zlib/gzlib.c
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
/* gzlib.c -- zlib functions common to reading and writing gzip files
|
2
|
-
* Copyright (C) 2004
|
2
|
+
* Copyright (C) 2004-2017 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#include "gzguts.h"
|
7
7
|
|
8
|
-
#if defined(_WIN32) && !defined(__BORLANDC__)
|
8
|
+
#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
|
9
9
|
# define LSEEK _lseeki64
|
10
10
|
#else
|
11
11
|
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
@@ -94,7 +94,7 @@ local gzFile gz_open(path, fd, mode)
|
|
94
94
|
const char *mode;
|
95
95
|
{
|
96
96
|
gz_statep state;
|
97
|
-
|
97
|
+
z_size_t len;
|
98
98
|
int oflag;
|
99
99
|
#ifdef O_CLOEXEC
|
100
100
|
int cloexec = 0;
|
@@ -188,10 +188,10 @@ local gzFile gz_open(path, fd, mode)
|
|
188
188
|
}
|
189
189
|
|
190
190
|
/* save the path name for error messages */
|
191
|
-
#ifdef
|
191
|
+
#ifdef WIDECHAR
|
192
192
|
if (fd == -2) {
|
193
193
|
len = wcstombs(NULL, path, 0);
|
194
|
-
if (len == (
|
194
|
+
if (len == (z_size_t)-1)
|
195
195
|
len = 0;
|
196
196
|
}
|
197
197
|
else
|
@@ -202,7 +202,7 @@ local gzFile gz_open(path, fd, mode)
|
|
202
202
|
free(state);
|
203
203
|
return NULL;
|
204
204
|
}
|
205
|
-
#ifdef
|
205
|
+
#ifdef WIDECHAR
|
206
206
|
if (fd == -2)
|
207
207
|
if (len)
|
208
208
|
wcstombs(state->path, path, len + 1);
|
@@ -211,7 +211,7 @@ local gzFile gz_open(path, fd, mode)
|
|
211
211
|
else
|
212
212
|
#endif
|
213
213
|
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
|
214
|
-
snprintf(state->path, len + 1, "%s", (const char *)path);
|
214
|
+
(void)snprintf(state->path, len + 1, "%s", (const char *)path);
|
215
215
|
#else
|
216
216
|
strcpy(state->path, path);
|
217
217
|
#endif
|
@@ -239,7 +239,7 @@ local gzFile gz_open(path, fd, mode)
|
|
239
239
|
|
240
240
|
/* open the file with the appropriate flags (or just use fd) */
|
241
241
|
state->fd = fd > -1 ? fd : (
|
242
|
-
#ifdef
|
242
|
+
#ifdef WIDECHAR
|
243
243
|
fd == -2 ? _wopen(path, oflag, 0666) :
|
244
244
|
#endif
|
245
245
|
open((const char *)path, oflag, 0666));
|
@@ -248,8 +248,10 @@ local gzFile gz_open(path, fd, mode)
|
|
248
248
|
free(state);
|
249
249
|
return NULL;
|
250
250
|
}
|
251
|
-
if (state->mode == GZ_APPEND)
|
251
|
+
if (state->mode == GZ_APPEND) {
|
252
|
+
LSEEK(state->fd, 0, SEEK_END); /* so gzoffset() is correct */
|
252
253
|
state->mode = GZ_WRITE; /* simplify later checks */
|
254
|
+
}
|
253
255
|
|
254
256
|
/* save the current position for rewinding (only if reading) */
|
255
257
|
if (state->mode == GZ_READ) {
|
@@ -291,7 +293,7 @@ gzFile ZEXPORT gzdopen(fd, mode)
|
|
291
293
|
if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
|
292
294
|
return NULL;
|
293
295
|
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
|
294
|
-
snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd);
|
296
|
+
(void)snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd);
|
295
297
|
#else
|
296
298
|
sprintf(path, "<fd:%d>", fd); /* for debugging */
|
297
299
|
#endif
|
@@ -301,7 +303,7 @@ gzFile ZEXPORT gzdopen(fd, mode)
|
|
301
303
|
}
|
302
304
|
|
303
305
|
/* -- see zlib.h -- */
|
304
|
-
#ifdef
|
306
|
+
#ifdef WIDECHAR
|
305
307
|
gzFile ZEXPORT gzopen_w(path, mode)
|
306
308
|
const wchar_t *path;
|
307
309
|
const char *mode;
|
@@ -329,6 +331,8 @@ int ZEXPORT gzbuffer(file, size)
|
|
329
331
|
return -1;
|
330
332
|
|
331
333
|
/* check and set requested size */
|
334
|
+
if ((size << 1) < size)
|
335
|
+
return -1; /* need to be able to double it */
|
332
336
|
if (size < 2)
|
333
337
|
size = 2; /* need two bytes to check magic header */
|
334
338
|
state->want = size;
|
@@ -604,14 +608,13 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
|
|
604
608
|
return;
|
605
609
|
}
|
606
610
|
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
|
607
|
-
snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
|
608
|
-
|
611
|
+
(void)snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
|
612
|
+
"%s%s%s", state->path, ": ", msg);
|
609
613
|
#else
|
610
614
|
strcpy(state->msg, state->path);
|
611
615
|
strcat(state->msg, ": ");
|
612
616
|
strcat(state->msg, msg);
|
613
617
|
#endif
|
614
|
-
return;
|
615
618
|
}
|
616
619
|
|
617
620
|
#ifndef INT_MAX
|
data/third_party/zlib/gzread.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* gzread.c -- zlib functions for reading gzip files
|
2
|
-
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
|
2
|
+
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -12,6 +12,7 @@ local int gz_look OF((gz_statep));
|
|
12
12
|
local int gz_decomp OF((gz_statep));
|
13
13
|
local int gz_fetch OF((gz_statep));
|
14
14
|
local int gz_skip OF((gz_statep, z_off64_t));
|
15
|
+
local z_size_t gz_read OF((gz_statep, voidp, z_size_t));
|
15
16
|
|
16
17
|
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
|
17
18
|
state->fd, and update state->eof, state->err, and state->msg as appropriate.
|
@@ -24,13 +25,17 @@ local int gz_load(state, buf, len, have)
|
|
24
25
|
unsigned *have;
|
25
26
|
{
|
26
27
|
int ret;
|
28
|
+
unsigned get, max = ((unsigned)-1 >> 2) + 1;
|
27
29
|
|
28
30
|
*have = 0;
|
29
31
|
do {
|
30
|
-
|
32
|
+
get = len - *have;
|
33
|
+
if (get > max)
|
34
|
+
get = max;
|
35
|
+
ret = read(state->fd, buf + *have, get);
|
31
36
|
if (ret <= 0)
|
32
37
|
break;
|
33
|
-
*have += ret;
|
38
|
+
*have += (unsigned)ret;
|
34
39
|
} while (*have < len);
|
35
40
|
if (ret < 0) {
|
36
41
|
gz_error(state, Z_ERRNO, zstrerror());
|
@@ -94,10 +99,8 @@ local int gz_look(state)
|
|
94
99
|
state->in = (unsigned char *)malloc(state->want);
|
95
100
|
state->out = (unsigned char *)malloc(state->want << 1);
|
96
101
|
if (state->in == NULL || state->out == NULL) {
|
97
|
-
|
98
|
-
|
99
|
-
if (state->in != NULL)
|
100
|
-
free(state->in);
|
102
|
+
free(state->out);
|
103
|
+
free(state->in);
|
101
104
|
gz_error(state, Z_MEM_ERROR, "out of memory");
|
102
105
|
return -1;
|
103
106
|
}
|
@@ -284,33 +287,17 @@ local int gz_skip(state, len)
|
|
284
287
|
return 0;
|
285
288
|
}
|
286
289
|
|
287
|
-
/*
|
288
|
-
|
289
|
-
|
290
|
+
/* Read len bytes into buf from file, or less than len up to the end of the
|
291
|
+
input. Return the number of bytes read. If zero is returned, either the
|
292
|
+
end of file was reached, or there was an error. state->err must be
|
293
|
+
consulted in that case to determine which. */
|
294
|
+
local z_size_t gz_read(state, buf, len)
|
295
|
+
gz_statep state;
|
290
296
|
voidp buf;
|
291
|
-
|
297
|
+
z_size_t len;
|
292
298
|
{
|
293
|
-
|
294
|
-
|
295
|
-
z_streamp strm;
|
296
|
-
|
297
|
-
/* get internal structure */
|
298
|
-
if (file == NULL)
|
299
|
-
return -1;
|
300
|
-
state = (gz_statep)file;
|
301
|
-
strm = &(state->strm);
|
302
|
-
|
303
|
-
/* check that we're reading and that there's no (serious) error */
|
304
|
-
if (state->mode != GZ_READ ||
|
305
|
-
(state->err != Z_OK && state->err != Z_BUF_ERROR))
|
306
|
-
return -1;
|
307
|
-
|
308
|
-
/* since an int is returned, make sure len fits in one, otherwise return
|
309
|
-
with an error (this avoids the flaw in the interface) */
|
310
|
-
if ((int)len < 0) {
|
311
|
-
gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
|
312
|
-
return -1;
|
313
|
-
}
|
299
|
+
z_size_t got;
|
300
|
+
unsigned n;
|
314
301
|
|
315
302
|
/* if len is zero, avoid unnecessary operations */
|
316
303
|
if (len == 0)
|
@@ -320,32 +307,38 @@ int ZEXPORT gzread(file, buf, len)
|
|
320
307
|
if (state->seek) {
|
321
308
|
state->seek = 0;
|
322
309
|
if (gz_skip(state, state->skip) == -1)
|
323
|
-
return
|
310
|
+
return 0;
|
324
311
|
}
|
325
312
|
|
326
313
|
/* get len bytes to buf, or less than len if at the end */
|
327
314
|
got = 0;
|
328
315
|
do {
|
316
|
+
/* set n to the maximum amount of len that fits in an unsigned int */
|
317
|
+
n = -1;
|
318
|
+
if (n > len)
|
319
|
+
n = len;
|
320
|
+
|
329
321
|
/* first just try copying data from the output buffer */
|
330
322
|
if (state->x.have) {
|
331
|
-
|
323
|
+
if (state->x.have < n)
|
324
|
+
n = state->x.have;
|
332
325
|
memcpy(buf, state->x.next, n);
|
333
326
|
state->x.next += n;
|
334
327
|
state->x.have -= n;
|
335
328
|
}
|
336
329
|
|
337
330
|
/* output buffer empty -- return if we're at the end of the input */
|
338
|
-
else if (state->eof && strm
|
331
|
+
else if (state->eof && state->strm.avail_in == 0) {
|
339
332
|
state->past = 1; /* tried to read past end */
|
340
333
|
break;
|
341
334
|
}
|
342
335
|
|
343
336
|
/* need output data -- for small len or new stream load up our output
|
344
337
|
buffer */
|
345
|
-
else if (state->how == LOOK ||
|
338
|
+
else if (state->how == LOOK || n < (state->size << 1)) {
|
346
339
|
/* get more output, looking for header if required */
|
347
340
|
if (gz_fetch(state) == -1)
|
348
|
-
return
|
341
|
+
return 0;
|
349
342
|
continue; /* no progress yet -- go back to copy above */
|
350
343
|
/* the copy above assures that we will leave with space in the
|
351
344
|
output buffer, allowing at least one gzungetc() to succeed */
|
@@ -353,16 +346,16 @@ int ZEXPORT gzread(file, buf, len)
|
|
353
346
|
|
354
347
|
/* large len -- read directly into user buffer */
|
355
348
|
else if (state->how == COPY) { /* read directly */
|
356
|
-
if (gz_load(state, (unsigned char *)buf,
|
357
|
-
return
|
349
|
+
if (gz_load(state, (unsigned char *)buf, n, &n) == -1)
|
350
|
+
return 0;
|
358
351
|
}
|
359
352
|
|
360
353
|
/* large len -- decompress directly into user buffer */
|
361
354
|
else { /* state->how == GZIP */
|
362
|
-
strm
|
363
|
-
strm
|
355
|
+
state->strm.avail_out = n;
|
356
|
+
state->strm.next_out = (unsigned char *)buf;
|
364
357
|
if (gz_decomp(state) == -1)
|
365
|
-
return
|
358
|
+
return 0;
|
366
359
|
n = state->x.have;
|
367
360
|
state->x.have = 0;
|
368
361
|
}
|
@@ -374,8 +367,75 @@ int ZEXPORT gzread(file, buf, len)
|
|
374
367
|
state->x.pos += n;
|
375
368
|
} while (len);
|
376
369
|
|
377
|
-
/* return number of bytes read into user buffer
|
378
|
-
return
|
370
|
+
/* return number of bytes read into user buffer */
|
371
|
+
return got;
|
372
|
+
}
|
373
|
+
|
374
|
+
/* -- see zlib.h -- */
|
375
|
+
int ZEXPORT gzread(file, buf, len)
|
376
|
+
gzFile file;
|
377
|
+
voidp buf;
|
378
|
+
unsigned len;
|
379
|
+
{
|
380
|
+
gz_statep state;
|
381
|
+
|
382
|
+
/* get internal structure */
|
383
|
+
if (file == NULL)
|
384
|
+
return -1;
|
385
|
+
state = (gz_statep)file;
|
386
|
+
|
387
|
+
/* check that we're reading and that there's no (serious) error */
|
388
|
+
if (state->mode != GZ_READ ||
|
389
|
+
(state->err != Z_OK && state->err != Z_BUF_ERROR))
|
390
|
+
return -1;
|
391
|
+
|
392
|
+
/* since an int is returned, make sure len fits in one, otherwise return
|
393
|
+
with an error (this avoids a flaw in the interface) */
|
394
|
+
if ((int)len < 0) {
|
395
|
+
gz_error(state, Z_STREAM_ERROR, "request does not fit in an int");
|
396
|
+
return -1;
|
397
|
+
}
|
398
|
+
|
399
|
+
/* read len or fewer bytes to buf */
|
400
|
+
len = gz_read(state, buf, len);
|
401
|
+
|
402
|
+
/* check for an error */
|
403
|
+
if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR)
|
404
|
+
return -1;
|
405
|
+
|
406
|
+
/* return the number of bytes read (this is assured to fit in an int) */
|
407
|
+
return (int)len;
|
408
|
+
}
|
409
|
+
|
410
|
+
/* -- see zlib.h -- */
|
411
|
+
z_size_t ZEXPORT gzfread(buf, size, nitems, file)
|
412
|
+
voidp buf;
|
413
|
+
z_size_t size;
|
414
|
+
z_size_t nitems;
|
415
|
+
gzFile file;
|
416
|
+
{
|
417
|
+
z_size_t len;
|
418
|
+
gz_statep state;
|
419
|
+
|
420
|
+
/* get internal structure */
|
421
|
+
if (file == NULL)
|
422
|
+
return 0;
|
423
|
+
state = (gz_statep)file;
|
424
|
+
|
425
|
+
/* check that we're reading and that there's no (serious) error */
|
426
|
+
if (state->mode != GZ_READ ||
|
427
|
+
(state->err != Z_OK && state->err != Z_BUF_ERROR))
|
428
|
+
return 0;
|
429
|
+
|
430
|
+
/* compute bytes to read -- error on overflow */
|
431
|
+
len = nitems * size;
|
432
|
+
if (size && len / size != nitems) {
|
433
|
+
gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
|
434
|
+
return 0;
|
435
|
+
}
|
436
|
+
|
437
|
+
/* read len or fewer bytes to buf, return the number of full items read */
|
438
|
+
return len ? gz_read(state, buf, len) / size : 0;
|
379
439
|
}
|
380
440
|
|
381
441
|
/* -- see zlib.h -- */
|
@@ -408,8 +468,8 @@ int ZEXPORT gzgetc(file)
|
|
408
468
|
return *(state->x.next)++;
|
409
469
|
}
|
410
470
|
|
411
|
-
/* nothing there -- try
|
412
|
-
ret =
|
471
|
+
/* nothing there -- try gz_read() */
|
472
|
+
ret = gz_read(state, buf, 1);
|
413
473
|
return ret < 1 ? -1 : buf[0];
|
414
474
|
}
|
415
475
|
|
@@ -451,7 +511,7 @@ int ZEXPORT gzungetc(c, file)
|
|
451
511
|
if (state->x.have == 0) {
|
452
512
|
state->x.have = 1;
|
453
513
|
state->x.next = state->out + (state->size << 1) - 1;
|
454
|
-
state->x.next[0] = c;
|
514
|
+
state->x.next[0] = (unsigned char)c;
|
455
515
|
state->x.pos--;
|
456
516
|
state->past = 0;
|
457
517
|
return c;
|
@@ -473,7 +533,7 @@ int ZEXPORT gzungetc(c, file)
|
|
473
533
|
}
|
474
534
|
state->x.have++;
|
475
535
|
state->x.next--;
|
476
|
-
state->x.next[0] = c;
|
536
|
+
state->x.next[0] = (unsigned char)c;
|
477
537
|
state->x.pos--;
|
478
538
|
state->past = 0;
|
479
539
|
return c;
|