* ext/zlib/zlib.c (gzfile_reset): preserve ZSTREAM_FLAG_GZFILE
[Bug #10101]
* test/zlib/test_zlib.rb (test_rewind): test each_byte
We must preserve the ZSTREAM_FLAG_GZFILE flag to prevent
zstream_detach_buffer from:
a) returning Qnil and breaking out of the `each_byte' loop
b) yielding a large string to each_byte
Note: the test case in bug report takes a long time. I found this
bug because I noticed the massive time descrepancy between
`each_byte' and `readbyte' loop before this patch. With this patch,
`each_byte' and `readbyte' both take very long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
they may change in the implementation without notice. Patched by
@robin850 [Fixes GH-682] https://github.com/ruby/ruby/pull/682
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/zlib/zlib.c (zstream_shift_buffer): create new copied string
since it cannot be shared ever.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
need a dictionary but are being decompressed by Zlib::Inflate.inflate
(which has no option to set a dictionary). Now Zlib::NeedDict is
raised instead of crashing. [ruby-trunk - Bug #8829]
* test/zlib/test_zlib.rb (TestZlibInflate): Test for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RBASIC_CLASS(obj) macro which returns a class of `obj'.
This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
This function reveal interal (hidden) object by rb_obj_hide().
Note that do not change class before and after hiding.
Only permitted example is:
klass = RBASIC_CLASS(obj);
rb_obj_hide(obj);
....
rb_obj_reveal(obj, klass);
TODO: API design. rb_obj_reveal() should be replaced with others.
TODO: modify constified variables using cast may be harmful for
compiler's analysis and optimizaton.
Any idea to prohibt inserting RBasic::klass directly?
If rename RBasic::klass and force to use RBASIC_CLASS(obj),
then all codes such as `RBASIC(obj)->klass' will be
compilation error. Is it acceptable? (We have similar
experience at Ruby 1.9,
for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fix documentation syntax and naming errors.
Based on patch by Robin Dupret. Fix GH-271.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
z->stream.avail_in == 0. it return Z_BUF_ERROR.
but deflate() could be called with z->stream->avail_in == 0 because
it has hidden buffer in z->stream->state (opaque structure).
fix for gem install error. [ruby-dev:46149] [Bug #7040]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (sysopen_func, rb_sysopen_internal): cast through VALUE to get
rid of warnings. fixup of r36355.
* process.c (rb_waitpid_blocking, rb_waitpid): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This allows zlib streams to be processed without huge memory growth.
[Feature #6612]
* NEWS: ditto
* ext/zlib/zlib.c (zstream_expand_buffer): Uses rb_yield when a block
is given for streaming support. Refactored to use
zstream_expand_buffer_into to remove duplicate code.
* ext/zlib/zlib.c (zstream_expand_buffer_protect): Added wrapper
function to pass jump state back through GVL-free section to allow
zstream clean-up before terminating the ruby call.
* ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Acquire GVL to
yield processed chunk of output stream.
* ext/zlib/zlib.c (zstream_detach_buffer): When a block is given,
returns Qnil mid-stream and yields the output buffer at the end of
the stream.
* test/zlib/test_zlib.rb: Updated tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
processing. rb_block_given_p() is not callable without the GVL.
* ext/zlib/extconf.rb: ditto
* NEWS: ditto
* test/zlib/test_zlib.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This allows zlib streams to be processed without huge memory growth.
[Feature #6612]
* NEWS: ditto
* ext/zlib/zlib.c (zstream_expand_buffer): Uses rb_yield when a block
is given for streaming support. Refactored to use
zstream_expand_buffer_into to remove duplicate code.
* ext/zlib/zlib.c (zstream_expand_buffer_protect): Added wrapper
function to pass jump state back through GVL-free section to allow
zstream clean-up before terminating the ruby call.
* ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Acquire GVL to
yield processed chunk of output stream.
* ext/zlib/zlib.c (zstream_detach_buffer): When a block is given,
returns Qnil mid-stream and yields the output buffer at the end of
the stream.
* ext/zlib/extconf.rb: Update INCFLAGS to find internal.h for
rb_thread_call_with_gvl
* test/zlib/test_zlib.rb: Updated tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/zlib/zlib.c (zstream_run_func): initialize the return value,
interrupt flag may set before starting loop.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ruby_xrealloc() to avoid crash with CALC_EXACT_MALLOC_SIZE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
since zlib-1.2.7.
* ext/zlib/zlib.c (rb_zlib_crc_table): use z_crc_t if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
strategies.
* NEWS: Add note about the new Zlib constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Zlib::Inflate#add_dictionary to allow users to pre-specify
for using during #inflate. [ruby-trunk - Feature #5937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e