zlib 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/zlib/zlib.c +87 -69
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4f3ce4aeaaaf23f2bd617eeb0bd83378b727dabddb3a57bd35cda7edc64a36b
|
|
4
|
+
data.tar.gz: cd9e3b9ccbd1207c468190771e38103a24dceaf6f3ae897073cfd1d9c7a7848e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8c1eb5a13d1d37b84c2fc5d30db95aea73587665d0a5a606cc0aca871da6dea229a2eb4acbaa79dbe5a51354b89fecd107f81fa4ffb7df9b95df914ca047595
|
|
7
|
+
data.tar.gz: 12430704e1af5489bb474c8b6a5dc7a925ee1738c10d66886cc620ce9e21f58cdf860d4ab86e02ad88e28f892c309df292d0af2fe5bd98ce75d58054e6ff4230
|
data/README.md
CHANGED
|
@@ -53,7 +53,7 @@ puts "Uncompressed data is: #{uncompressed_data}"
|
|
|
53
53
|
|
|
54
54
|
## Development
|
|
55
55
|
|
|
56
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
56
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake compile test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
57
57
|
|
|
58
58
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
59
59
|
|
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 "3.
|
|
28
|
+
#define RUBY_ZLIB_VERSION "3.2.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)
|
|
@@ -90,7 +90,7 @@ static void zstream_expand_buffer_into(struct zstream*, unsigned long);
|
|
|
90
90
|
static int zstream_expand_buffer_non_stream(struct zstream *z);
|
|
91
91
|
static void zstream_append_buffer(struct zstream*, const Bytef*, long);
|
|
92
92
|
static VALUE zstream_detach_buffer(struct zstream*);
|
|
93
|
-
static VALUE zstream_shift_buffer(struct zstream*, long);
|
|
93
|
+
static VALUE zstream_shift_buffer(struct zstream*, long, VALUE);
|
|
94
94
|
static void zstream_buffer_ungets(struct zstream*, const Bytef*, unsigned long);
|
|
95
95
|
static void zstream_buffer_ungetbyte(struct zstream*, int);
|
|
96
96
|
static void zstream_append_input(struct zstream*, const Bytef*, long);
|
|
@@ -170,8 +170,8 @@ static void gzfile_check_footer(struct gzfile*, VALUE outbuf);
|
|
|
170
170
|
static void gzfile_write(struct gzfile*, Bytef*, long);
|
|
171
171
|
static long gzfile_read_more(struct gzfile*, VALUE outbuf);
|
|
172
172
|
static void gzfile_calc_crc(struct gzfile*, VALUE);
|
|
173
|
-
static VALUE gzfile_read(struct gzfile*, long);
|
|
174
|
-
static VALUE gzfile_read_all(struct gzfile
|
|
173
|
+
static VALUE gzfile_read(struct gzfile*, long, VALUE);
|
|
174
|
+
static VALUE gzfile_read_all(struct gzfile*, VALUE);
|
|
175
175
|
static void gzfile_ungets(struct gzfile*, const Bytef*, long);
|
|
176
176
|
static void gzfile_ungetbyte(struct gzfile*, int);
|
|
177
177
|
static VALUE gzfile_writer_end_run(VALUE);
|
|
@@ -820,19 +820,31 @@ zstream_detach_buffer(struct zstream *z)
|
|
|
820
820
|
}
|
|
821
821
|
|
|
822
822
|
static VALUE
|
|
823
|
-
zstream_shift_buffer(struct zstream *z, long len)
|
|
823
|
+
zstream_shift_buffer(struct zstream *z, long len, VALUE dst)
|
|
824
824
|
{
|
|
825
|
-
VALUE dst;
|
|
826
825
|
char *bufptr;
|
|
827
826
|
long buflen = ZSTREAM_BUF_FILLED(z);
|
|
828
827
|
|
|
829
828
|
if (buflen <= len) {
|
|
830
|
-
|
|
829
|
+
if (NIL_P(dst) || (!ZSTREAM_IS_FINISHED(z) && !ZSTREAM_IS_GZFILE(z) &&
|
|
830
|
+
rb_block_given_p())) {
|
|
831
|
+
return zstream_detach_buffer(z);
|
|
832
|
+
} else {
|
|
833
|
+
bufptr = RSTRING_PTR(z->buf);
|
|
834
|
+
rb_str_resize(dst, buflen);
|
|
835
|
+
memcpy(RSTRING_PTR(dst), bufptr, buflen);
|
|
836
|
+
}
|
|
837
|
+
buflen = 0;
|
|
838
|
+
} else {
|
|
839
|
+
bufptr = RSTRING_PTR(z->buf);
|
|
840
|
+
if (NIL_P(dst)) {
|
|
841
|
+
dst = rb_str_new(bufptr, len);
|
|
842
|
+
} else {
|
|
843
|
+
rb_str_resize(dst, len);
|
|
844
|
+
memcpy(RSTRING_PTR(dst), bufptr, len);
|
|
845
|
+
}
|
|
846
|
+
buflen -= len;
|
|
831
847
|
}
|
|
832
|
-
|
|
833
|
-
bufptr = RSTRING_PTR(z->buf);
|
|
834
|
-
dst = rb_str_new(bufptr, len);
|
|
835
|
-
buflen -= len;
|
|
836
848
|
memmove(bufptr, bufptr + len, buflen);
|
|
837
849
|
rb_str_set_len(z->buf, buflen);
|
|
838
850
|
z->stream.next_out = (Bytef*)RSTRING_END(z->buf);
|
|
@@ -851,7 +863,9 @@ zstream_buffer_ungets(struct zstream *z, const Bytef *b, unsigned long len)
|
|
|
851
863
|
char *bufptr;
|
|
852
864
|
long filled;
|
|
853
865
|
|
|
854
|
-
|
|
866
|
+
if (NIL_P(z->buf) || (long)rb_str_capacity(z->buf) <= ZSTREAM_BUF_FILLED(z)) {
|
|
867
|
+
zstream_expand_buffer_into(z, len);
|
|
868
|
+
}
|
|
855
869
|
|
|
856
870
|
RSTRING_GETMEM(z->buf, bufptr, filled);
|
|
857
871
|
memmove(bufptr + len, bufptr, filled);
|
|
@@ -1086,6 +1100,12 @@ zstream_run_try(VALUE value_arg)
|
|
|
1086
1100
|
int err;
|
|
1087
1101
|
VALUE old_input = Qnil;
|
|
1088
1102
|
|
|
1103
|
+
/* Cannot start zstream while it is in progress. */
|
|
1104
|
+
if (z->flags & ZSTREAM_IN_PROGRESS) {
|
|
1105
|
+
rb_raise(cInProgressError, "zlib stream is in progress");
|
|
1106
|
+
}
|
|
1107
|
+
z->flags |= ZSTREAM_IN_PROGRESS;
|
|
1108
|
+
|
|
1089
1109
|
if (NIL_P(z->input) && len == 0) {
|
|
1090
1110
|
z->stream.next_in = (Bytef*)"";
|
|
1091
1111
|
z->stream.avail_in = 0;
|
|
@@ -1153,9 +1173,6 @@ loop:
|
|
|
1153
1173
|
rb_str_resize(old_input, 0);
|
|
1154
1174
|
}
|
|
1155
1175
|
|
|
1156
|
-
if (args->jump_state)
|
|
1157
|
-
rb_jump_tag(args->jump_state);
|
|
1158
|
-
|
|
1159
1176
|
return Qnil;
|
|
1160
1177
|
}
|
|
1161
1178
|
|
|
@@ -1163,25 +1180,11 @@ static VALUE
|
|
|
1163
1180
|
zstream_run_ensure(VALUE value_arg)
|
|
1164
1181
|
{
|
|
1165
1182
|
struct zstream_run_args *args = (struct zstream_run_args *)value_arg;
|
|
1183
|
+
struct zstream *z = args->z;
|
|
1166
1184
|
|
|
1167
1185
|
/* Remove ZSTREAM_IN_PROGRESS flag to signal that this zstream is not in use. */
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
return Qnil;
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
static VALUE
|
|
1174
|
-
zstream_run_synchronized(VALUE value_arg)
|
|
1175
|
-
{
|
|
1176
|
-
struct zstream_run_args *args = (struct zstream_run_args *)value_arg;
|
|
1177
|
-
|
|
1178
|
-
/* Cannot start zstream while it is in progress. */
|
|
1179
|
-
if (args->z->flags & ZSTREAM_IN_PROGRESS) {
|
|
1180
|
-
rb_raise(cInProgressError, "zlib stream is in progress");
|
|
1181
|
-
}
|
|
1182
|
-
args->z->flags |= ZSTREAM_IN_PROGRESS;
|
|
1183
|
-
|
|
1184
|
-
rb_ensure(zstream_run_try, value_arg, zstream_run_ensure, value_arg);
|
|
1186
|
+
z->flags &= ~ZSTREAM_IN_PROGRESS;
|
|
1187
|
+
rb_mutex_unlock(z->mutex);
|
|
1185
1188
|
|
|
1186
1189
|
return Qnil;
|
|
1187
1190
|
}
|
|
@@ -1198,7 +1201,10 @@ zstream_run(struct zstream *z, Bytef *src, long len, int flush)
|
|
|
1198
1201
|
.jump_state = 0,
|
|
1199
1202
|
.stream_output = !ZSTREAM_IS_GZFILE(z) && rb_block_given_p(),
|
|
1200
1203
|
};
|
|
1201
|
-
|
|
1204
|
+
rb_mutex_lock(z->mutex);
|
|
1205
|
+
rb_ensure(zstream_run_try, (VALUE)&args, zstream_run_ensure, (VALUE)&args);
|
|
1206
|
+
if (args.jump_state)
|
|
1207
|
+
rb_jump_tag(args.jump_state);
|
|
1202
1208
|
}
|
|
1203
1209
|
|
|
1204
1210
|
static VALUE
|
|
@@ -1507,7 +1513,7 @@ rb_zstream_total_out(VALUE obj)
|
|
|
1507
1513
|
}
|
|
1508
1514
|
|
|
1509
1515
|
/*
|
|
1510
|
-
* Guesses the type of the data which have been
|
|
1516
|
+
* Guesses the type of the data which have been inputted into the stream. The
|
|
1511
1517
|
* returned value is either <tt>BINARY</tt>, <tt>ASCII</tt>, or
|
|
1512
1518
|
* <tt>UNKNOWN</tt>.
|
|
1513
1519
|
*/
|
|
@@ -2872,18 +2878,18 @@ gzfile_newstr(struct gzfile *gz, VALUE str)
|
|
|
2872
2878
|
}
|
|
2873
2879
|
|
|
2874
2880
|
static long
|
|
2875
|
-
gzfile_fill(struct gzfile *gz, long len)
|
|
2881
|
+
gzfile_fill(struct gzfile *gz, long len, VALUE outbuf)
|
|
2876
2882
|
{
|
|
2877
2883
|
if (len < 0)
|
|
2878
2884
|
rb_raise(rb_eArgError, "negative length %ld given", len);
|
|
2879
2885
|
if (len == 0)
|
|
2880
2886
|
return 0;
|
|
2881
2887
|
while (!ZSTREAM_IS_FINISHED(&gz->z) && ZSTREAM_BUF_FILLED(&gz->z) < len) {
|
|
2882
|
-
gzfile_read_more(gz,
|
|
2888
|
+
gzfile_read_more(gz, outbuf);
|
|
2883
2889
|
}
|
|
2884
2890
|
if (GZFILE_IS_FINISHED(gz)) {
|
|
2885
2891
|
if (!(gz->z.flags & GZFILE_FLAG_FOOTER_FINISHED)) {
|
|
2886
|
-
gzfile_check_footer(gz,
|
|
2892
|
+
gzfile_check_footer(gz, outbuf);
|
|
2887
2893
|
}
|
|
2888
2894
|
return -1;
|
|
2889
2895
|
}
|
|
@@ -2891,14 +2897,27 @@ gzfile_fill(struct gzfile *gz, long len)
|
|
|
2891
2897
|
}
|
|
2892
2898
|
|
|
2893
2899
|
static VALUE
|
|
2894
|
-
gzfile_read(struct gzfile *gz, long len)
|
|
2900
|
+
gzfile_read(struct gzfile *gz, long len, VALUE outbuf)
|
|
2895
2901
|
{
|
|
2896
2902
|
VALUE dst;
|
|
2897
2903
|
|
|
2898
|
-
len = gzfile_fill(gz, len);
|
|
2899
|
-
|
|
2900
|
-
if (len < 0)
|
|
2901
|
-
|
|
2904
|
+
len = gzfile_fill(gz, len, outbuf);
|
|
2905
|
+
|
|
2906
|
+
if (len < 0) {
|
|
2907
|
+
if (!NIL_P(outbuf))
|
|
2908
|
+
rb_str_resize(outbuf, 0);
|
|
2909
|
+
return Qnil;
|
|
2910
|
+
}
|
|
2911
|
+
if (len == 0) {
|
|
2912
|
+
if (NIL_P(outbuf))
|
|
2913
|
+
return rb_str_new(0, 0);
|
|
2914
|
+
else {
|
|
2915
|
+
rb_str_resize(outbuf, 0);
|
|
2916
|
+
return outbuf;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
dst = zstream_shift_buffer(&gz->z, len, outbuf);
|
|
2902
2921
|
if (!NIL_P(dst)) gzfile_calc_crc(gz, dst);
|
|
2903
2922
|
return dst;
|
|
2904
2923
|
}
|
|
@@ -2931,29 +2950,26 @@ gzfile_readpartial(struct gzfile *gz, long len, VALUE outbuf)
|
|
|
2931
2950
|
rb_raise(rb_eEOFError, "end of file reached");
|
|
2932
2951
|
}
|
|
2933
2952
|
|
|
2934
|
-
dst = zstream_shift_buffer(&gz->z, len);
|
|
2953
|
+
dst = zstream_shift_buffer(&gz->z, len, outbuf);
|
|
2935
2954
|
gzfile_calc_crc(gz, dst);
|
|
2936
2955
|
|
|
2937
|
-
if (!NIL_P(outbuf)) {
|
|
2938
|
-
rb_str_resize(outbuf, RSTRING_LEN(dst));
|
|
2939
|
-
memcpy(RSTRING_PTR(outbuf), RSTRING_PTR(dst), RSTRING_LEN(dst));
|
|
2940
|
-
dst = outbuf;
|
|
2941
|
-
}
|
|
2942
2956
|
return dst;
|
|
2943
2957
|
}
|
|
2944
2958
|
|
|
2945
2959
|
static VALUE
|
|
2946
|
-
gzfile_read_all(struct gzfile *gz)
|
|
2960
|
+
gzfile_read_all(struct gzfile *gz, VALUE dst)
|
|
2947
2961
|
{
|
|
2948
|
-
VALUE dst;
|
|
2949
|
-
|
|
2950
2962
|
while (!ZSTREAM_IS_FINISHED(&gz->z)) {
|
|
2951
|
-
gzfile_read_more(gz,
|
|
2963
|
+
gzfile_read_more(gz, dst);
|
|
2952
2964
|
}
|
|
2953
2965
|
if (GZFILE_IS_FINISHED(gz)) {
|
|
2954
2966
|
if (!(gz->z.flags & GZFILE_FLAG_FOOTER_FINISHED)) {
|
|
2955
|
-
gzfile_check_footer(gz,
|
|
2967
|
+
gzfile_check_footer(gz, dst);
|
|
2956
2968
|
}
|
|
2969
|
+
if (!NIL_P(dst)) {
|
|
2970
|
+
rb_str_resize(dst, 0);
|
|
2971
|
+
return dst;
|
|
2972
|
+
}
|
|
2957
2973
|
return rb_str_new(0, 0);
|
|
2958
2974
|
}
|
|
2959
2975
|
|
|
@@ -2991,7 +3007,7 @@ gzfile_getc(struct gzfile *gz)
|
|
|
2991
3007
|
de = (unsigned char *)ds + GZFILE_CBUF_CAPA;
|
|
2992
3008
|
(void)rb_econv_convert(gz->ec, &sp, se, &dp, de, ECONV_PARTIAL_INPUT|ECONV_AFTER_OUTPUT);
|
|
2993
3009
|
rb_econv_check_error(gz->ec);
|
|
2994
|
-
dst = zstream_shift_buffer(&gz->z, sp - ss);
|
|
3010
|
+
dst = zstream_shift_buffer(&gz->z, sp - ss, Qnil);
|
|
2995
3011
|
gzfile_calc_crc(gz, dst);
|
|
2996
3012
|
rb_str_resize(cbuf, dp - ds);
|
|
2997
3013
|
return cbuf;
|
|
@@ -2999,7 +3015,7 @@ gzfile_getc(struct gzfile *gz)
|
|
|
2999
3015
|
else {
|
|
3000
3016
|
buf = gz->z.buf;
|
|
3001
3017
|
len = rb_enc_mbclen(RSTRING_PTR(buf), RSTRING_END(buf), gz->enc);
|
|
3002
|
-
dst = gzfile_read(gz, len);
|
|
3018
|
+
dst = gzfile_read(gz, len, Qnil);
|
|
3003
3019
|
if (NIL_P(dst)) return dst;
|
|
3004
3020
|
return gzfile_newstr(gz, dst);
|
|
3005
3021
|
}
|
|
@@ -3907,7 +3923,7 @@ rb_gzreader_s_zcat(int argc, VALUE *argv, VALUE klass)
|
|
|
3907
3923
|
if (!buf) {
|
|
3908
3924
|
buf = rb_str_new(0, 0);
|
|
3909
3925
|
}
|
|
3910
|
-
tmpbuf = gzfile_read_all(get_gzfile(obj));
|
|
3926
|
+
tmpbuf = gzfile_read_all(get_gzfile(obj), Qnil);
|
|
3911
3927
|
rb_str_cat(buf, RSTRING_PTR(tmpbuf), RSTRING_LEN(tmpbuf));
|
|
3912
3928
|
}
|
|
3913
3929
|
|
|
@@ -4009,19 +4025,19 @@ static VALUE
|
|
|
4009
4025
|
rb_gzreader_read(int argc, VALUE *argv, VALUE obj)
|
|
4010
4026
|
{
|
|
4011
4027
|
struct gzfile *gz = get_gzfile(obj);
|
|
4012
|
-
VALUE vlen;
|
|
4028
|
+
VALUE vlen, outbuf;
|
|
4013
4029
|
long len;
|
|
4014
4030
|
|
|
4015
|
-
rb_scan_args(argc, argv, "
|
|
4031
|
+
rb_scan_args(argc, argv, "02", &vlen, &outbuf);
|
|
4016
4032
|
if (NIL_P(vlen)) {
|
|
4017
|
-
return gzfile_read_all(gz);
|
|
4033
|
+
return gzfile_read_all(gz, outbuf);
|
|
4018
4034
|
}
|
|
4019
4035
|
|
|
4020
4036
|
len = NUM2INT(vlen);
|
|
4021
4037
|
if (len < 0) {
|
|
4022
4038
|
rb_raise(rb_eArgError, "negative length %ld given", len);
|
|
4023
4039
|
}
|
|
4024
|
-
return gzfile_read(gz, len);
|
|
4040
|
+
return gzfile_read(gz, len, outbuf);
|
|
4025
4041
|
}
|
|
4026
4042
|
|
|
4027
4043
|
/*
|
|
@@ -4030,7 +4046,7 @@ rb_gzreader_read(int argc, VALUE *argv, VALUE obj)
|
|
|
4030
4046
|
* call-seq:
|
|
4031
4047
|
* gzipreader.readpartial(maxlen [, outbuf]) => string, outbuf
|
|
4032
4048
|
*
|
|
4033
|
-
* Reads at most <i>maxlen</i> bytes from the
|
|
4049
|
+
* Reads at most <i>maxlen</i> bytes from the gzipped stream but
|
|
4034
4050
|
* it blocks only if <em>gzipreader</em> has no data immediately available.
|
|
4035
4051
|
* If the optional <i>outbuf</i> argument is present,
|
|
4036
4052
|
* it must reference a String, which will receive the data.
|
|
@@ -4094,7 +4110,7 @@ rb_gzreader_getbyte(VALUE obj)
|
|
|
4094
4110
|
struct gzfile *gz = get_gzfile(obj);
|
|
4095
4111
|
VALUE dst;
|
|
4096
4112
|
|
|
4097
|
-
dst = gzfile_read(gz, 1);
|
|
4113
|
+
dst = gzfile_read(gz, 1, Qnil);
|
|
4098
4114
|
if (!NIL_P(dst)) {
|
|
4099
4115
|
dst = INT2FIX((unsigned int)(RSTRING_PTR(dst)[0]) & 0xff);
|
|
4100
4116
|
}
|
|
@@ -4205,6 +4221,7 @@ gzreader_skip_linebreaks(struct gzfile *gz)
|
|
|
4205
4221
|
while (n++, *(p++) == '\n') {
|
|
4206
4222
|
if (n >= ZSTREAM_BUF_FILLED(&gz->z)) {
|
|
4207
4223
|
str = zstream_detach_buffer(&gz->z);
|
|
4224
|
+
ASSUME(!NIL_P(str));
|
|
4208
4225
|
gzfile_calc_crc(gz, str);
|
|
4209
4226
|
while (ZSTREAM_BUF_FILLED(&gz->z) == 0) {
|
|
4210
4227
|
if (GZFILE_IS_FINISHED(gz)) return;
|
|
@@ -4215,7 +4232,7 @@ gzreader_skip_linebreaks(struct gzfile *gz)
|
|
|
4215
4232
|
}
|
|
4216
4233
|
}
|
|
4217
4234
|
|
|
4218
|
-
str = zstream_shift_buffer(&gz->z, n - 1);
|
|
4235
|
+
str = zstream_shift_buffer(&gz->z, n - 1, Qnil);
|
|
4219
4236
|
gzfile_calc_crc(gz, str);
|
|
4220
4237
|
}
|
|
4221
4238
|
|
|
@@ -4236,7 +4253,7 @@ gzreader_charboundary(struct gzfile *gz, long n)
|
|
|
4236
4253
|
if (l < n) {
|
|
4237
4254
|
int n_bytes = rb_enc_precise_mbclen(p, e, gz->enc);
|
|
4238
4255
|
if (MBCLEN_NEEDMORE_P(n_bytes)) {
|
|
4239
|
-
if ((l = gzfile_fill(gz, n + MBCLEN_NEEDMORE_LEN(n_bytes))) > 0) {
|
|
4256
|
+
if ((l = gzfile_fill(gz, n + MBCLEN_NEEDMORE_LEN(n_bytes), Qnil)) > 0) {
|
|
4240
4257
|
return l;
|
|
4241
4258
|
}
|
|
4242
4259
|
}
|
|
@@ -4288,10 +4305,10 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
|
|
|
4288
4305
|
|
|
4289
4306
|
if (NIL_P(rs)) {
|
|
4290
4307
|
if (limit < 0) {
|
|
4291
|
-
dst = gzfile_read_all(gz);
|
|
4308
|
+
dst = gzfile_read_all(gz, Qnil);
|
|
4292
4309
|
if (RSTRING_LEN(dst) == 0) return Qnil;
|
|
4293
4310
|
}
|
|
4294
|
-
else if ((n = gzfile_fill(gz, limit)) <= 0) {
|
|
4311
|
+
else if ((n = gzfile_fill(gz, limit, Qnil)) <= 0) {
|
|
4295
4312
|
return Qnil;
|
|
4296
4313
|
}
|
|
4297
4314
|
else {
|
|
@@ -4301,7 +4318,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
|
|
|
4301
4318
|
else {
|
|
4302
4319
|
n = limit;
|
|
4303
4320
|
}
|
|
4304
|
-
dst = zstream_shift_buffer(&gz->z, n);
|
|
4321
|
+
dst = zstream_shift_buffer(&gz->z, n, Qnil);
|
|
4305
4322
|
if (NIL_P(dst)) return dst;
|
|
4306
4323
|
gzfile_calc_crc(gz, dst);
|
|
4307
4324
|
dst = gzfile_newstr(gz, dst);
|
|
@@ -4328,7 +4345,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
|
|
|
4328
4345
|
while (ZSTREAM_BUF_FILLED(&gz->z) < rslen) {
|
|
4329
4346
|
if (ZSTREAM_IS_FINISHED(&gz->z)) {
|
|
4330
4347
|
if (ZSTREAM_BUF_FILLED(&gz->z) > 0) gz->lineno++;
|
|
4331
|
-
return gzfile_read(gz, rslen);
|
|
4348
|
+
return gzfile_read(gz, rslen, Qnil);
|
|
4332
4349
|
}
|
|
4333
4350
|
gzfile_read_more(gz, Qnil);
|
|
4334
4351
|
}
|
|
@@ -4365,7 +4382,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj)
|
|
|
4365
4382
|
}
|
|
4366
4383
|
|
|
4367
4384
|
gz->lineno++;
|
|
4368
|
-
dst = gzfile_read(gz, n);
|
|
4385
|
+
dst = gzfile_read(gz, n, Qnil);
|
|
4369
4386
|
if (NIL_P(dst)) return dst;
|
|
4370
4387
|
if (rspara) {
|
|
4371
4388
|
gzreader_skip_linebreaks(gz);
|
|
@@ -4613,6 +4630,7 @@ zlib_gunzip_run(VALUE arg)
|
|
|
4613
4630
|
|
|
4614
4631
|
gzfile_read_header(gz, Qnil);
|
|
4615
4632
|
dst = zstream_detach_buffer(&gz->z);
|
|
4633
|
+
ASSUME(!NIL_P(dst));
|
|
4616
4634
|
gzfile_calc_crc(gz, dst);
|
|
4617
4635
|
if (!ZSTREAM_IS_FINISHED(&gz->z)) {
|
|
4618
4636
|
rb_raise(cGzError, "unexpected end of file");
|
metadata
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zlib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yukihiro Matsumoto
|
|
8
8
|
- UENO Katsuhiro
|
|
9
|
+
autorequire:
|
|
9
10
|
bindir: exe
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
+
date: 2024-11-12 00:00:00.000000000 Z
|
|
12
13
|
dependencies: []
|
|
13
14
|
description: Ruby interface for the zlib compression/decompression library
|
|
14
15
|
email:
|
|
15
16
|
- matz@ruby-lang.org
|
|
16
|
-
-
|
|
17
|
+
-
|
|
17
18
|
executables: []
|
|
18
19
|
extensions:
|
|
19
20
|
- ext/zlib/extconf.rb
|
|
@@ -30,6 +31,7 @@ licenses:
|
|
|
30
31
|
- Ruby
|
|
31
32
|
- BSD-2-Clause
|
|
32
33
|
metadata: {}
|
|
34
|
+
post_install_message:
|
|
33
35
|
rdoc_options: []
|
|
34
36
|
require_paths:
|
|
35
37
|
- lib
|
|
@@ -44,7 +46,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
44
46
|
- !ruby/object:Gem::Version
|
|
45
47
|
version: '0'
|
|
46
48
|
requirements: []
|
|
47
|
-
rubygems_version:
|
|
49
|
+
rubygems_version: 3.5.11
|
|
50
|
+
signing_key:
|
|
48
51
|
specification_version: 4
|
|
49
52
|
summary: Ruby interface for the zlib compression/decompression library
|
|
50
53
|
test_files: []
|