zlib 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/zlib/extconf.rb +4 -3
- data/ext/zlib/zlib.c +56 -7
- data/zlib.gemspec +2 -6
- metadata +2 -49
- data/.gitignore +0 -12
- data/Gemfile +0 -4
- data/Rakefile +0 -13
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f0f4c2a4ba8053045fbe977bc5cf5ab6a8d1142d2d6ad7bc80cdbaa8e86da5
|
4
|
+
data.tar.gz: 67b0d3fb3d2bcd309e6e55298aff6df2a136135a56822b6c057d8236aaa2766c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50bf8adea4a39c751f12c6a13c967d3792cf27f5636eb4b1228501a427d9b1b377fd4757c54a4806979631501ee4833dacc9f31a0a41d1aa448138d244911b6d
|
7
|
+
data.tar.gz: e8e442a205ba16f584a6ac43cf8fa0f5abddfa59e8f6eca007fc5691ec7b82801198461391e3e79866a8d4d38a57f1031ec918a61ccb81aabb94aa35bf544675
|
data/ext/zlib/extconf.rb
CHANGED
@@ -10,11 +10,12 @@ require 'rbconfig'
|
|
10
10
|
|
11
11
|
dir_config 'zlib'
|
12
12
|
|
13
|
-
|
13
|
+
libs = $libs
|
14
14
|
if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and
|
15
15
|
have_header('zlib.h') then
|
16
16
|
have_zlib = true
|
17
17
|
else
|
18
|
+
$libs = libs
|
18
19
|
unless File.directory?(zsrc = "#{$srcdir}/zlib")
|
19
20
|
dirs = Dir.open($srcdir) {|z| z.grep(/\Azlib-\d+[.\d]*\z/) {|x|"#{$srcdir}/#{x}"}}
|
20
21
|
dirs.delete_if {|x| !File.directory?(x)}
|
@@ -46,7 +47,7 @@ else
|
|
46
47
|
end
|
47
48
|
m = File.read(m)
|
48
49
|
zimplib = m[/^IMPLIB[ \t]*=[ \t]*(\S+)/, 1]
|
49
|
-
$LOCAL_LIBS << " " << zimplib
|
50
|
+
($LOCAL_LIBS << " ./" << zimplib).strip!
|
50
51
|
unless $nmake or /^TOP[ \t]/ =~ m
|
51
52
|
m.gsub!(/win32\/zlib\.def/, '$(TOP)/\&')
|
52
53
|
m.gsub!(/^(\t.*[ \t])(\S+\.rc)/, '\1-I$(<D) $<')
|
@@ -62,7 +63,7 @@ else
|
|
62
63
|
"$(TARGET_SO): $(ZIMPLIB)\n",
|
63
64
|
"$(ZIMPLIB):\n",
|
64
65
|
"#{zmk} $(ZOPTS) $@\n",
|
65
|
-
"install-so: $(topdir)/#{dll}",
|
66
|
+
"install-so static: $(topdir)/#{dll}",
|
66
67
|
"$(topdir)/#{dll}: $(ZIMPLIB)\n",
|
67
68
|
"\t$(Q) $(COPY) #{dll} $(@D)\n",
|
68
69
|
"clean: clean-zsrc\n",
|
data/ext/zlib/zlib.c
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
|
26
26
|
#endif
|
27
27
|
|
28
|
-
#define RUBY_ZLIB_VERSION "2.
|
28
|
+
#define RUBY_ZLIB_VERSION "2.1.0"
|
29
29
|
|
30
30
|
#ifndef RB_PASS_CALLED_KEYWORDS
|
31
31
|
# define rb_class_new_instance_kw(argc, argv, klass, kw_splat) rb_class_new_instance(argc, argv, klass)
|
@@ -354,7 +354,9 @@ raise_zlib_error(int err, const char *msg)
|
|
354
354
|
static void
|
355
355
|
finalizer_warn(const char *msg)
|
356
356
|
{
|
357
|
+
#if 0
|
357
358
|
fprintf(stderr, "zlib(finalizer): %s\n", msg);
|
359
|
+
#endif
|
358
360
|
}
|
359
361
|
|
360
362
|
|
@@ -546,6 +548,7 @@ struct zstream {
|
|
546
548
|
unsigned long flags;
|
547
549
|
VALUE buf;
|
548
550
|
VALUE input;
|
551
|
+
VALUE mutex;
|
549
552
|
z_stream stream;
|
550
553
|
const struct zstream_funcs {
|
551
554
|
int (*reset)(z_streamp);
|
@@ -621,6 +624,7 @@ zstream_init(struct zstream *z, const struct zstream_funcs *func)
|
|
621
624
|
z->flags = 0;
|
622
625
|
z->buf = Qnil;
|
623
626
|
z->input = Qnil;
|
627
|
+
z->mutex = rb_mutex_new();
|
624
628
|
z->stream.zalloc = zlib_mem_alloc;
|
625
629
|
z->stream.zfree = zlib_mem_free;
|
626
630
|
z->stream.opaque = Z_NULL;
|
@@ -652,7 +656,9 @@ zstream_expand_buffer(struct zstream *z)
|
|
652
656
|
rb_obj_reveal(z->buf, rb_cString);
|
653
657
|
}
|
654
658
|
|
659
|
+
rb_mutex_unlock(z->mutex);
|
655
660
|
rb_protect(rb_yield, z->buf, &state);
|
661
|
+
rb_mutex_lock(z->mutex);
|
656
662
|
|
657
663
|
if (ZSTREAM_REUSE_BUFFER_P(z)) {
|
658
664
|
rb_str_modify(z->buf);
|
@@ -1054,7 +1060,7 @@ zstream_unblock_func(void *ptr)
|
|
1054
1060
|
}
|
1055
1061
|
|
1056
1062
|
static void
|
1057
|
-
|
1063
|
+
zstream_run0(struct zstream *z, Bytef *src, long len, int flush)
|
1058
1064
|
{
|
1059
1065
|
struct zstream_run_args args;
|
1060
1066
|
int err;
|
@@ -1095,6 +1101,12 @@ loop:
|
|
1095
1101
|
RB_NOGVL_UBF_ASYNC_SAFE);
|
1096
1102
|
#endif
|
1097
1103
|
|
1104
|
+
/* retry if no exception is thrown */
|
1105
|
+
if (err == Z_OK && args.interrupt) {
|
1106
|
+
args.interrupt = 0;
|
1107
|
+
goto loop;
|
1108
|
+
}
|
1109
|
+
|
1098
1110
|
if (flush != Z_FINISH && err == Z_BUF_ERROR
|
1099
1111
|
&& z->stream.avail_out > 0) {
|
1100
1112
|
z->flags |= ZSTREAM_FLAG_IN_STREAM;
|
@@ -1132,6 +1144,32 @@ loop:
|
|
1132
1144
|
rb_jump_tag(args.jump_state);
|
1133
1145
|
}
|
1134
1146
|
|
1147
|
+
struct zstream_run_synchronized_args {
|
1148
|
+
struct zstream *z;
|
1149
|
+
Bytef *src;
|
1150
|
+
long len;
|
1151
|
+
int flush;
|
1152
|
+
};
|
1153
|
+
|
1154
|
+
static VALUE
|
1155
|
+
zstream_run_synchronized(VALUE value_arg)
|
1156
|
+
{
|
1157
|
+
struct zstream_run_synchronized_args *run_args = (struct zstream_run_synchronized_args *)value_arg;
|
1158
|
+
zstream_run0(run_args->z, run_args->src, run_args->len, run_args->flush);
|
1159
|
+
return Qnil;
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
static void
|
1163
|
+
zstream_run(struct zstream *z, Bytef *src, long len, int flush)
|
1164
|
+
{
|
1165
|
+
struct zstream_run_synchronized_args run_args;
|
1166
|
+
run_args.z = z;
|
1167
|
+
run_args.src = src;
|
1168
|
+
run_args.len = len;
|
1169
|
+
run_args.flush = flush;
|
1170
|
+
rb_mutex_synchronize(z->mutex, zstream_run_synchronized, (VALUE)&run_args);
|
1171
|
+
}
|
1172
|
+
|
1135
1173
|
static VALUE
|
1136
1174
|
zstream_sync(struct zstream *z, Bytef *src, long len)
|
1137
1175
|
{
|
@@ -1177,6 +1215,7 @@ zstream_mark(void *p)
|
|
1177
1215
|
struct zstream *z = p;
|
1178
1216
|
rb_gc_mark(z->buf);
|
1179
1217
|
rb_gc_mark(z->input);
|
1218
|
+
rb_gc_mark(z->mutex);
|
1180
1219
|
}
|
1181
1220
|
|
1182
1221
|
static void
|
@@ -3514,6 +3553,16 @@ rb_gzfile_path(VALUE obj)
|
|
3514
3553
|
return gz->path;
|
3515
3554
|
}
|
3516
3555
|
|
3556
|
+
static VALUE
|
3557
|
+
gzfile_initialize_path_partial(VALUE obj)
|
3558
|
+
{
|
3559
|
+
struct gzfile* gz;
|
3560
|
+
TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
|
3561
|
+
gz->path = rb_funcall(gz->io, id_path, 0);
|
3562
|
+
rb_define_singleton_method(obj, "path", rb_gzfile_path, 0);
|
3563
|
+
return Qnil;
|
3564
|
+
}
|
3565
|
+
|
3517
3566
|
static void
|
3518
3567
|
rb_gzfile_ecopts(struct gzfile *gz, VALUE opts)
|
3519
3568
|
{
|
@@ -3622,8 +3671,8 @@ rb_gzwriter_initialize(int argc, VALUE *argv, VALUE obj)
|
|
3622
3671
|
rb_gzfile_ecopts(gz, opt);
|
3623
3672
|
|
3624
3673
|
if (rb_respond_to(io, id_path)) {
|
3625
|
-
|
3626
|
-
|
3674
|
+
/* File#path may raise IOError in case when a path is unavailable */
|
3675
|
+
rb_rescue2(gzfile_initialize_path_partial, obj, NULL, Qnil, rb_eIOError, (VALUE)0);
|
3627
3676
|
}
|
3628
3677
|
|
3629
3678
|
return obj;
|
@@ -3884,8 +3933,8 @@ rb_gzreader_initialize(int argc, VALUE *argv, VALUE obj)
|
|
3884
3933
|
rb_gzfile_ecopts(gz, opt);
|
3885
3934
|
|
3886
3935
|
if (rb_respond_to(io, id_path)) {
|
3887
|
-
|
3888
|
-
|
3936
|
+
/* File#path may raise IOError in case when a path is unavailable */
|
3937
|
+
rb_rescue2(gzfile_initialize_path_partial, obj, NULL, Qnil, rb_eIOError, (VALUE)0);
|
3889
3938
|
}
|
3890
3939
|
|
3891
3940
|
return obj;
|
@@ -4548,7 +4597,7 @@ zlib_gunzip_run(VALUE arg)
|
|
4548
4597
|
void
|
4549
4598
|
Init_zlib(void)
|
4550
4599
|
{
|
4551
|
-
#
|
4600
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
4552
4601
|
rb_ext_ractor_safe(true);
|
4553
4602
|
#endif
|
4554
4603
|
|
data/zlib.gemspec
CHANGED
@@ -22,14 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.homepage = "https://github.com/ruby/zlib"
|
23
23
|
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
24
24
|
|
25
|
-
spec.files = ["
|
25
|
+
spec.files = ["LICENSE.txt", "README.md", "ext/zlib/extconf.rb", "ext/zlib/zlib.c", "zlib.gemspec"]
|
26
26
|
spec.bindir = "exe"
|
27
|
-
spec.executables =
|
27
|
+
spec.executables = []
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
spec.extensions = "ext/zlib/extconf.rb"
|
30
30
|
spec.required_ruby_version = ">= 2.3.0"
|
31
|
-
|
32
|
-
spec.add_development_dependency "bundler"
|
33
|
-
spec.add_development_dependency "rake"
|
34
|
-
spec.add_development_dependency "rake-compiler"
|
35
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
@@ -10,49 +10,7 @@ autorequire:
|
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
12
|
date: 2021-10-14 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: bundler
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rake
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rake-compiler
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
13
|
+
dependencies: []
|
56
14
|
description: Ruby interface for the zlib compression/decompression library
|
57
15
|
email:
|
58
16
|
- matz@ruby-lang.org
|
@@ -62,13 +20,8 @@ extensions:
|
|
62
20
|
- ext/zlib/extconf.rb
|
63
21
|
extra_rdoc_files: []
|
64
22
|
files:
|
65
|
-
- ".gitignore"
|
66
|
-
- Gemfile
|
67
23
|
- LICENSE.txt
|
68
24
|
- README.md
|
69
|
-
- Rakefile
|
70
|
-
- bin/console
|
71
|
-
- bin/setup
|
72
25
|
- ext/zlib/extconf.rb
|
73
26
|
- ext/zlib/zlib.c
|
74
27
|
- zlib.gemspec
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test" << "test/lib"
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList['test/**/test_*.rb']
|
8
|
-
end
|
9
|
-
|
10
|
-
require 'rake/extensiontask'
|
11
|
-
Rake::ExtensionTask.new("zlib")
|
12
|
-
|
13
|
-
task :default => [:compile, :test]
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "zlib"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|