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/infback.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* infback.c -- inflate using a call-back interface
|
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
|
|
@@ -61,7 +61,7 @@ int stream_size;
|
|
61
61
|
Tracev((stderr, "inflate: allocated\n"));
|
62
62
|
strm->state = (struct internal_state FAR *)state;
|
63
63
|
state->dmax = 32768U;
|
64
|
-
state->wbits = windowBits;
|
64
|
+
state->wbits = (uInt)windowBits;
|
65
65
|
state->wsize = 1U << windowBits;
|
66
66
|
state->window = window;
|
67
67
|
state->wnext = 0;
|
data/third_party/zlib/inffast.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* inffast.c -- fast 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
|
|
@@ -8,26 +8,9 @@
|
|
8
8
|
#include "inflate.h"
|
9
9
|
#include "inffast.h"
|
10
10
|
|
11
|
-
#
|
12
|
-
|
13
|
-
/* Allow machine dependent optimization for post-increment or pre-increment.
|
14
|
-
Based on testing to date,
|
15
|
-
Pre-increment preferred for:
|
16
|
-
- PowerPC G3 (Adler)
|
17
|
-
- MIPS R5000 (Randers-Pehrson)
|
18
|
-
Post-increment preferred for:
|
19
|
-
- none
|
20
|
-
No measurable difference:
|
21
|
-
- Pentium III (Anderson)
|
22
|
-
- M68060 (Nikl)
|
23
|
-
*/
|
24
|
-
#ifdef POSTINC
|
25
|
-
# define OFF 0
|
26
|
-
# define PUP(a) *(a)++
|
11
|
+
#ifdef ASMINF
|
12
|
+
# pragma message("Assembler code may have bugs -- use at your own risk")
|
27
13
|
#else
|
28
|
-
# define OFF 1
|
29
|
-
# define PUP(a) *++(a)
|
30
|
-
#endif
|
31
14
|
|
32
15
|
/*
|
33
16
|
Decode literal, length, and distance codes and write out the resulting
|
@@ -96,9 +79,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
96
79
|
|
97
80
|
/* copy state to local variables */
|
98
81
|
state = (struct inflate_state FAR *)strm->state;
|
99
|
-
in = strm->next_in
|
82
|
+
in = strm->next_in;
|
100
83
|
last = in + (strm->avail_in - 5);
|
101
|
-
out = strm->next_out
|
84
|
+
out = strm->next_out;
|
102
85
|
beg = out - (start - strm->avail_out);
|
103
86
|
end = out + (strm->avail_out - 257);
|
104
87
|
#ifdef INFLATE_STRICT
|
@@ -119,9 +102,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
119
102
|
input data or output space */
|
120
103
|
do {
|
121
104
|
if (bits < 15) {
|
122
|
-
hold += (unsigned long)(
|
105
|
+
hold += (unsigned long)(*in++) << bits;
|
123
106
|
bits += 8;
|
124
|
-
hold += (unsigned long)(
|
107
|
+
hold += (unsigned long)(*in++) << bits;
|
125
108
|
bits += 8;
|
126
109
|
}
|
127
110
|
here = lcode[hold & lmask];
|
@@ -134,14 +117,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
134
117
|
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
135
118
|
"inflate: literal '%c'\n" :
|
136
119
|
"inflate: literal 0x%02x\n", here.val));
|
137
|
-
|
120
|
+
*out++ = (unsigned char)(here.val);
|
138
121
|
}
|
139
122
|
else if (op & 16) { /* length base */
|
140
123
|
len = (unsigned)(here.val);
|
141
124
|
op &= 15; /* number of extra bits */
|
142
125
|
if (op) {
|
143
126
|
if (bits < op) {
|
144
|
-
hold += (unsigned long)(
|
127
|
+
hold += (unsigned long)(*in++) << bits;
|
145
128
|
bits += 8;
|
146
129
|
}
|
147
130
|
len += (unsigned)hold & ((1U << op) - 1);
|
@@ -150,9 +133,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
150
133
|
}
|
151
134
|
Tracevv((stderr, "inflate: length %u\n", len));
|
152
135
|
if (bits < 15) {
|
153
|
-
hold += (unsigned long)(
|
136
|
+
hold += (unsigned long)(*in++) << bits;
|
154
137
|
bits += 8;
|
155
|
-
hold += (unsigned long)(
|
138
|
+
hold += (unsigned long)(*in++) << bits;
|
156
139
|
bits += 8;
|
157
140
|
}
|
158
141
|
here = dcode[hold & dmask];
|
@@ -165,10 +148,10 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
165
148
|
dist = (unsigned)(here.val);
|
166
149
|
op &= 15; /* number of extra bits */
|
167
150
|
if (bits < op) {
|
168
|
-
hold += (unsigned long)(
|
151
|
+
hold += (unsigned long)(*in++) << bits;
|
169
152
|
bits += 8;
|
170
153
|
if (bits < op) {
|
171
|
-
hold += (unsigned long)(
|
154
|
+
hold += (unsigned long)(*in++) << bits;
|
172
155
|
bits += 8;
|
173
156
|
}
|
174
157
|
}
|
@@ -196,30 +179,30 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
196
179
|
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
197
180
|
if (len <= op - whave) {
|
198
181
|
do {
|
199
|
-
|
182
|
+
*out++ = 0;
|
200
183
|
} while (--len);
|
201
184
|
continue;
|
202
185
|
}
|
203
186
|
len -= op - whave;
|
204
187
|
do {
|
205
|
-
|
188
|
+
*out++ = 0;
|
206
189
|
} while (--op > whave);
|
207
190
|
if (op == 0) {
|
208
191
|
from = out - dist;
|
209
192
|
do {
|
210
|
-
|
193
|
+
*out++ = *from++;
|
211
194
|
} while (--len);
|
212
195
|
continue;
|
213
196
|
}
|
214
197
|
#endif
|
215
198
|
}
|
216
|
-
from = window
|
199
|
+
from = window;
|
217
200
|
if (wnext == 0) { /* very common case */
|
218
201
|
from += wsize - op;
|
219
202
|
if (op < len) { /* some from window */
|
220
203
|
len -= op;
|
221
204
|
do {
|
222
|
-
|
205
|
+
*out++ = *from++;
|
223
206
|
} while (--op);
|
224
207
|
from = out - dist; /* rest from output */
|
225
208
|
}
|
@@ -230,14 +213,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
230
213
|
if (op < len) { /* some from end of window */
|
231
214
|
len -= op;
|
232
215
|
do {
|
233
|
-
|
216
|
+
*out++ = *from++;
|
234
217
|
} while (--op);
|
235
|
-
from = window
|
218
|
+
from = window;
|
236
219
|
if (wnext < len) { /* some from start of window */
|
237
220
|
op = wnext;
|
238
221
|
len -= op;
|
239
222
|
do {
|
240
|
-
|
223
|
+
*out++ = *from++;
|
241
224
|
} while (--op);
|
242
225
|
from = out - dist; /* rest from output */
|
243
226
|
}
|
@@ -248,35 +231,35 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
248
231
|
if (op < len) { /* some from window */
|
249
232
|
len -= op;
|
250
233
|
do {
|
251
|
-
|
234
|
+
*out++ = *from++;
|
252
235
|
} while (--op);
|
253
236
|
from = out - dist; /* rest from output */
|
254
237
|
}
|
255
238
|
}
|
256
239
|
while (len > 2) {
|
257
|
-
|
258
|
-
|
259
|
-
|
240
|
+
*out++ = *from++;
|
241
|
+
*out++ = *from++;
|
242
|
+
*out++ = *from++;
|
260
243
|
len -= 3;
|
261
244
|
}
|
262
245
|
if (len) {
|
263
|
-
|
246
|
+
*out++ = *from++;
|
264
247
|
if (len > 1)
|
265
|
-
|
248
|
+
*out++ = *from++;
|
266
249
|
}
|
267
250
|
}
|
268
251
|
else {
|
269
252
|
from = out - dist; /* copy direct from output */
|
270
253
|
do { /* minimum length is three */
|
271
|
-
|
272
|
-
|
273
|
-
|
254
|
+
*out++ = *from++;
|
255
|
+
*out++ = *from++;
|
256
|
+
*out++ = *from++;
|
274
257
|
len -= 3;
|
275
258
|
} while (len > 2);
|
276
259
|
if (len) {
|
277
|
-
|
260
|
+
*out++ = *from++;
|
278
261
|
if (len > 1)
|
279
|
-
|
262
|
+
*out++ = *from++;
|
280
263
|
}
|
281
264
|
}
|
282
265
|
}
|
@@ -313,8 +296,8 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
313
296
|
hold &= (1U << bits) - 1;
|
314
297
|
|
315
298
|
/* update state and return */
|
316
|
-
strm->next_in = in
|
317
|
-
strm->next_out = out
|
299
|
+
strm->next_in = in;
|
300
|
+
strm->next_out = out;
|
318
301
|
strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
|
319
302
|
strm->avail_out = (unsigned)(out < end ?
|
320
303
|
257 + (end - out) : 257 - (out - end));
|
data/third_party/zlib/inflate.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/* inflate.c -- zlib decompression
|
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
|
|
@@ -92,6 +92,7 @@
|
|
92
92
|
#endif
|
93
93
|
|
94
94
|
/* function prototypes */
|
95
|
+
local int inflateStateCheck OF((z_streamp strm));
|
95
96
|
local void fixedtables OF((struct inflate_state FAR *state));
|
96
97
|
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
97
98
|
unsigned copy));
|
@@ -101,12 +102,26 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
|
101
102
|
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
|
102
103
|
unsigned len));
|
103
104
|
|
105
|
+
local int inflateStateCheck(strm)
|
106
|
+
z_streamp strm;
|
107
|
+
{
|
108
|
+
struct inflate_state FAR *state;
|
109
|
+
if (strm == Z_NULL ||
|
110
|
+
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
111
|
+
return 1;
|
112
|
+
state = (struct inflate_state FAR *)strm->state;
|
113
|
+
if (state == Z_NULL || state->strm != strm ||
|
114
|
+
state->mode < HEAD || state->mode > SYNC)
|
115
|
+
return 1;
|
116
|
+
return 0;
|
117
|
+
}
|
118
|
+
|
104
119
|
int ZEXPORT inflateResetKeep(strm)
|
105
120
|
z_streamp strm;
|
106
121
|
{
|
107
122
|
struct inflate_state FAR *state;
|
108
123
|
|
109
|
-
if (strm
|
124
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
110
125
|
state = (struct inflate_state FAR *)strm->state;
|
111
126
|
strm->total_in = strm->total_out = state->total = 0;
|
112
127
|
strm->msg = Z_NULL;
|
@@ -131,7 +146,7 @@ z_streamp strm;
|
|
131
146
|
{
|
132
147
|
struct inflate_state FAR *state;
|
133
148
|
|
134
|
-
if (strm
|
149
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
135
150
|
state = (struct inflate_state FAR *)strm->state;
|
136
151
|
state->wsize = 0;
|
137
152
|
state->whave = 0;
|
@@ -147,7 +162,7 @@ int windowBits;
|
|
147
162
|
struct inflate_state FAR *state;
|
148
163
|
|
149
164
|
/* get the state */
|
150
|
-
if (strm
|
165
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
151
166
|
state = (struct inflate_state FAR *)strm->state;
|
152
167
|
|
153
168
|
/* extract wrap request from windowBits parameter */
|
@@ -156,7 +171,7 @@ int windowBits;
|
|
156
171
|
windowBits = -windowBits;
|
157
172
|
}
|
158
173
|
else {
|
159
|
-
wrap = (windowBits >> 4) +
|
174
|
+
wrap = (windowBits >> 4) + 5;
|
160
175
|
#ifdef GUNZIP
|
161
176
|
if (windowBits < 48)
|
162
177
|
windowBits &= 15;
|
@@ -210,7 +225,9 @@ int stream_size;
|
|
210
225
|
if (state == Z_NULL) return Z_MEM_ERROR;
|
211
226
|
Tracev((stderr, "inflate: allocated\n"));
|
212
227
|
strm->state = (struct internal_state FAR *)state;
|
228
|
+
state->strm = strm;
|
213
229
|
state->window = Z_NULL;
|
230
|
+
state->mode = HEAD; /* to pass state test in inflateReset2() */
|
214
231
|
ret = inflateReset2(strm, windowBits);
|
215
232
|
if (ret != Z_OK) {
|
216
233
|
ZFREE(strm, state);
|
@@ -234,17 +251,17 @@ int value;
|
|
234
251
|
{
|
235
252
|
struct inflate_state FAR *state;
|
236
253
|
|
237
|
-
if (strm
|
254
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
238
255
|
state = (struct inflate_state FAR *)strm->state;
|
239
256
|
if (bits < 0) {
|
240
257
|
state->hold = 0;
|
241
258
|
state->bits = 0;
|
242
259
|
return Z_OK;
|
243
260
|
}
|
244
|
-
if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
|
261
|
+
if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR;
|
245
262
|
value &= (1L << bits) - 1;
|
246
|
-
state->hold += value << state->bits;
|
247
|
-
state->bits += bits;
|
263
|
+
state->hold += (unsigned)value << state->bits;
|
264
|
+
state->bits += (uInt)bits;
|
248
265
|
return Z_OK;
|
249
266
|
}
|
250
267
|
|
@@ -625,7 +642,7 @@ int flush;
|
|
625
642
|
static const unsigned short order[19] = /* permutation of code lengths */
|
626
643
|
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
|
627
644
|
|
628
|
-
if (strm
|
645
|
+
if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
|
629
646
|
(strm->next_in == Z_NULL && strm->avail_in != 0))
|
630
647
|
return Z_STREAM_ERROR;
|
631
648
|
|
@@ -645,6 +662,8 @@ int flush;
|
|
645
662
|
NEEDBITS(16);
|
646
663
|
#ifdef GUNZIP
|
647
664
|
if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
|
665
|
+
if (state->wbits == 0)
|
666
|
+
state->wbits = 15;
|
648
667
|
state->check = crc32(0L, Z_NULL, 0);
|
649
668
|
CRC2(state->check, hold);
|
650
669
|
INITBITS();
|
@@ -672,7 +691,7 @@ int flush;
|
|
672
691
|
len = BITS(4) + 8;
|
673
692
|
if (state->wbits == 0)
|
674
693
|
state->wbits = len;
|
675
|
-
|
694
|
+
if (len > 15 || len > state->wbits) {
|
676
695
|
strm->msg = (char *)"invalid window size";
|
677
696
|
state->mode = BAD;
|
678
697
|
break;
|
@@ -699,14 +718,16 @@ int flush;
|
|
699
718
|
}
|
700
719
|
if (state->head != Z_NULL)
|
701
720
|
state->head->text = (int)((hold >> 8) & 1);
|
702
|
-
if (state->flags & 0x0200)
|
721
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
722
|
+
CRC2(state->check, hold);
|
703
723
|
INITBITS();
|
704
724
|
state->mode = TIME;
|
705
725
|
case TIME:
|
706
726
|
NEEDBITS(32);
|
707
727
|
if (state->head != Z_NULL)
|
708
728
|
state->head->time = hold;
|
709
|
-
if (state->flags & 0x0200)
|
729
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
730
|
+
CRC4(state->check, hold);
|
710
731
|
INITBITS();
|
711
732
|
state->mode = OS;
|
712
733
|
case OS:
|
@@ -715,7 +736,8 @@ int flush;
|
|
715
736
|
state->head->xflags = (int)(hold & 0xff);
|
716
737
|
state->head->os = (int)(hold >> 8);
|
717
738
|
}
|
718
|
-
if (state->flags & 0x0200)
|
739
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
740
|
+
CRC2(state->check, hold);
|
719
741
|
INITBITS();
|
720
742
|
state->mode = EXLEN;
|
721
743
|
case EXLEN:
|
@@ -724,7 +746,8 @@ int flush;
|
|
724
746
|
state->length = (unsigned)(hold);
|
725
747
|
if (state->head != Z_NULL)
|
726
748
|
state->head->extra_len = (unsigned)hold;
|
727
|
-
if (state->flags & 0x0200)
|
749
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
750
|
+
CRC2(state->check, hold);
|
728
751
|
INITBITS();
|
729
752
|
}
|
730
753
|
else if (state->head != Z_NULL)
|
@@ -742,7 +765,7 @@ int flush;
|
|
742
765
|
len + copy > state->head->extra_max ?
|
743
766
|
state->head->extra_max - len : copy);
|
744
767
|
}
|
745
|
-
if (state->flags & 0x0200)
|
768
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
746
769
|
state->check = crc32(state->check, next, copy);
|
747
770
|
have -= copy;
|
748
771
|
next += copy;
|
@@ -761,9 +784,9 @@ int flush;
|
|
761
784
|
if (state->head != Z_NULL &&
|
762
785
|
state->head->name != Z_NULL &&
|
763
786
|
state->length < state->head->name_max)
|
764
|
-
state->head->name[state->length++] = len;
|
787
|
+
state->head->name[state->length++] = (Bytef)len;
|
765
788
|
} while (len && copy < have);
|
766
|
-
if (state->flags & 0x0200)
|
789
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
767
790
|
state->check = crc32(state->check, next, copy);
|
768
791
|
have -= copy;
|
769
792
|
next += copy;
|
@@ -782,9 +805,9 @@ int flush;
|
|
782
805
|
if (state->head != Z_NULL &&
|
783
806
|
state->head->comment != Z_NULL &&
|
784
807
|
state->length < state->head->comm_max)
|
785
|
-
state->head->comment[state->length++] = len;
|
808
|
+
state->head->comment[state->length++] = (Bytef)len;
|
786
809
|
} while (len && copy < have);
|
787
|
-
if (state->flags & 0x0200)
|
810
|
+
if ((state->flags & 0x0200) && (state->wrap & 4))
|
788
811
|
state->check = crc32(state->check, next, copy);
|
789
812
|
have -= copy;
|
790
813
|
next += copy;
|
@@ -796,7 +819,7 @@ int flush;
|
|
796
819
|
case HCRC:
|
797
820
|
if (state->flags & 0x0200) {
|
798
821
|
NEEDBITS(16);
|
799
|
-
if (hold != (state->check & 0xffff)) {
|
822
|
+
if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
|
800
823
|
strm->msg = (char *)"header crc mismatch";
|
801
824
|
state->mode = BAD;
|
802
825
|
break;
|
@@ -1177,11 +1200,11 @@ int flush;
|
|
1177
1200
|
out -= left;
|
1178
1201
|
strm->total_out += out;
|
1179
1202
|
state->total += out;
|
1180
|
-
if (out)
|
1203
|
+
if ((state->wrap & 4) && out)
|
1181
1204
|
strm->adler = state->check =
|
1182
1205
|
UPDATE(state->check, put - out, out);
|
1183
1206
|
out = left;
|
1184
|
-
if ((
|
1207
|
+
if ((state->wrap & 4) && (
|
1185
1208
|
#ifdef GUNZIP
|
1186
1209
|
state->flags ? hold :
|
1187
1210
|
#endif
|
@@ -1240,10 +1263,10 @@ int flush;
|
|
1240
1263
|
strm->total_in += in;
|
1241
1264
|
strm->total_out += out;
|
1242
1265
|
state->total += out;
|
1243
|
-
if (state->wrap && out)
|
1266
|
+
if ((state->wrap & 4) && out)
|
1244
1267
|
strm->adler = state->check =
|
1245
1268
|
UPDATE(state->check, strm->next_out - out, out);
|
1246
|
-
strm->data_type = state->bits + (state->last ? 64 : 0) +
|
1269
|
+
strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
|
1247
1270
|
(state->mode == TYPE ? 128 : 0) +
|
1248
1271
|
(state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
|
1249
1272
|
if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
|
@@ -1255,7 +1278,7 @@ int ZEXPORT inflateEnd(strm)
|
|
1255
1278
|
z_streamp strm;
|
1256
1279
|
{
|
1257
1280
|
struct inflate_state FAR *state;
|
1258
|
-
if (strm
|
1281
|
+
if (inflateStateCheck(strm))
|
1259
1282
|
return Z_STREAM_ERROR;
|
1260
1283
|
state = (struct inflate_state FAR *)strm->state;
|
1261
1284
|
if (state->window != Z_NULL) ZFREE(strm, state->window);
|
@@ -1273,7 +1296,7 @@ uInt *dictLength;
|
|
1273
1296
|
struct inflate_state FAR *state;
|
1274
1297
|
|
1275
1298
|
/* check state */
|
1276
|
-
if (strm
|
1299
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1277
1300
|
state = (struct inflate_state FAR *)strm->state;
|
1278
1301
|
|
1279
1302
|
/* copy dictionary */
|
@@ -1298,7 +1321,7 @@ uInt dictLength;
|
|
1298
1321
|
int ret;
|
1299
1322
|
|
1300
1323
|
/* check state */
|
1301
|
-
if (strm
|
1324
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1302
1325
|
state = (struct inflate_state FAR *)strm->state;
|
1303
1326
|
if (state->wrap != 0 && state->mode != DICT)
|
1304
1327
|
return Z_STREAM_ERROR;
|
@@ -1330,7 +1353,7 @@ gz_headerp head;
|
|
1330
1353
|
struct inflate_state FAR *state;
|
1331
1354
|
|
1332
1355
|
/* check state */
|
1333
|
-
if (strm
|
1356
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1334
1357
|
state = (struct inflate_state FAR *)strm->state;
|
1335
1358
|
if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
|
1336
1359
|
|
@@ -1383,7 +1406,7 @@ z_streamp strm;
|
|
1383
1406
|
struct inflate_state FAR *state;
|
1384
1407
|
|
1385
1408
|
/* check parameters */
|
1386
|
-
if (strm
|
1409
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1387
1410
|
state = (struct inflate_state FAR *)strm->state;
|
1388
1411
|
if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
|
1389
1412
|
|
@@ -1430,7 +1453,7 @@ z_streamp strm;
|
|
1430
1453
|
{
|
1431
1454
|
struct inflate_state FAR *state;
|
1432
1455
|
|
1433
|
-
if (strm
|
1456
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1434
1457
|
state = (struct inflate_state FAR *)strm->state;
|
1435
1458
|
return state->mode == STORED && state->bits == 0;
|
1436
1459
|
}
|
@@ -1445,8 +1468,7 @@ z_streamp source;
|
|
1445
1468
|
unsigned wsize;
|
1446
1469
|
|
1447
1470
|
/* check input */
|
1448
|
-
if (
|
1449
|
-
source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
|
1471
|
+
if (inflateStateCheck(source) || dest == Z_NULL)
|
1450
1472
|
return Z_STREAM_ERROR;
|
1451
1473
|
state = (struct inflate_state FAR *)source->state;
|
1452
1474
|
|
@@ -1467,6 +1489,7 @@ z_streamp source;
|
|
1467
1489
|
/* copy state */
|
1468
1490
|
zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
|
1469
1491
|
zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
|
1492
|
+
copy->strm = dest;
|
1470
1493
|
if (state->lencode >= state->codes &&
|
1471
1494
|
state->lencode <= state->codes + ENOUGH - 1) {
|
1472
1495
|
copy->lencode = copy->codes + (state->lencode - state->codes);
|
@@ -1488,25 +1511,51 @@ int subvert;
|
|
1488
1511
|
{
|
1489
1512
|
struct inflate_state FAR *state;
|
1490
1513
|
|
1491
|
-
if (strm
|
1514
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1492
1515
|
state = (struct inflate_state FAR *)strm->state;
|
1493
|
-
state->sane = !subvert;
|
1494
1516
|
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
1517
|
+
state->sane = !subvert;
|
1495
1518
|
return Z_OK;
|
1496
1519
|
#else
|
1520
|
+
(void)subvert;
|
1497
1521
|
state->sane = 1;
|
1498
1522
|
return Z_DATA_ERROR;
|
1499
1523
|
#endif
|
1500
1524
|
}
|
1501
1525
|
|
1526
|
+
int ZEXPORT inflateValidate(strm, check)
|
1527
|
+
z_streamp strm;
|
1528
|
+
int check;
|
1529
|
+
{
|
1530
|
+
struct inflate_state FAR *state;
|
1531
|
+
|
1532
|
+
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
1533
|
+
state = (struct inflate_state FAR *)strm->state;
|
1534
|
+
if (check)
|
1535
|
+
state->wrap |= 4;
|
1536
|
+
else
|
1537
|
+
state->wrap &= ~4;
|
1538
|
+
return Z_OK;
|
1539
|
+
}
|
1540
|
+
|
1502
1541
|
long ZEXPORT inflateMark(strm)
|
1503
1542
|
z_streamp strm;
|
1504
1543
|
{
|
1505
1544
|
struct inflate_state FAR *state;
|
1506
1545
|
|
1507
|
-
if (strm
|
1546
|
+
if (inflateStateCheck(strm))
|
1547
|
+
return -(1L << 16);
|
1508
1548
|
state = (struct inflate_state FAR *)strm->state;
|
1509
|
-
return ((long)(state->back) << 16) +
|
1549
|
+
return (long)(((unsigned long)((long)state->back)) << 16) +
|
1510
1550
|
(state->mode == COPY ? state->length :
|
1511
1551
|
(state->mode == MATCH ? state->was - state->length : 0));
|
1512
1552
|
}
|
1553
|
+
|
1554
|
+
unsigned long ZEXPORT inflateCodesUsed(strm)
|
1555
|
+
z_streamp strm;
|
1556
|
+
{
|
1557
|
+
struct inflate_state FAR *state;
|
1558
|
+
if (inflateStateCheck(strm)) return (unsigned long)-1;
|
1559
|
+
state = (struct inflate_state FAR *)strm->state;
|
1560
|
+
return (unsigned long)(state->next - state->codes);
|
1561
|
+
}
|