Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
fail-fast: false
matrix:
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
os: [ ubuntu-latest, macos-latest, windows-latest ]
# os: [ ubuntu-latest, macos-latest, windows-latest ]
os: [ ubuntu-latest ]
include:
- ruby: mswin
os: windows-latest
Expand Down
9 changes: 4 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
require "bundler/gem_tasks"
require "rake/testtask"

desc "Run tests"
task :test do
if RUBY_PLATFORM.include?("s390x")
# Avoid possible test failures with the zlib applying the following patch on
# s390x CPU architecture.
# https://github.com/madler/zlib/pull/410
ENV["DFLTCC"] = "0" if RUBY_PLATFORM =~ /s390x/
Rake::Task["test_internal"].invoke
# ENV["DFLTCC"] = "0"
end

Rake::TestTask.new(:test_internal) do |t|
desc "Run tests"
Rake::TestTask.new do |t|
t.libs << "test/lib"
t.ruby_opts << "-rhelper"
t.test_files = FileList["test/**/test_*.rb"]
Expand Down
28 changes: 12 additions & 16 deletions ext/zlib/zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2444,17 +2444,16 @@ struct gzfile {

#define GZFILE_READ_SIZE 2048

enum { read_raw_arg_len, read_raw_arg_buf, read_raw_arg__count};
struct read_raw_arg {
VALUE io;
union {
const VALUE argv[2]; /* for rb_funcallv */
struct {
VALUE len;
VALUE buf;
} in;
} as;
const VALUE argv[read_raw_arg__count]; /* for rb_funcallv */
};

#define read_raw_arg_argc(ra) \
((int)read_raw_arg__count - NIL_P((ra)->argv[read_raw_arg__count - 1]))
#define read_raw_arg_init(io, len, buf) { io, { len, buf } }

static void
gzfile_mark(void *p)
{
Expand Down Expand Up @@ -2580,9 +2579,9 @@ gzfile_read_raw_partial(VALUE arg)
{
struct read_raw_arg *ra = (struct read_raw_arg *)arg;
VALUE str;
int argc = NIL_P(ra->as.argv[1]) ? 1 : 2;
int argc = read_raw_arg_argc(ra);

str = rb_funcallv(ra->io, id_readpartial, argc, ra->as.argv);
str = rb_funcallv(ra->io, id_readpartial, argc, ra->argv);
Check_Type(str, T_STRING);
return str;
}
Expand All @@ -2593,8 +2592,8 @@ gzfile_read_raw_rescue(VALUE arg, VALUE _)
struct read_raw_arg *ra = (struct read_raw_arg *)arg;
VALUE str = Qnil;
if (rb_obj_is_kind_of(rb_errinfo(), rb_eNoMethodError)) {
int argc = NIL_P(ra->as.argv[1]) ? 1 : 2;
str = rb_funcallv(ra->io, id_read, argc, ra->as.argv);
int argc = read_raw_arg_argc(ra);
str = rb_funcallv(ra->io, id_read, argc, ra->argv);
if (!NIL_P(str)) {
Check_Type(str, T_STRING);
}
Expand All @@ -2605,11 +2604,8 @@ gzfile_read_raw_rescue(VALUE arg, VALUE _)
static VALUE
gzfile_read_raw(struct gzfile *gz, VALUE outbuf)
{
struct read_raw_arg ra;

ra.io = gz->io;
ra.as.in.len = INT2FIX(GZFILE_READ_SIZE);
ra.as.in.buf = outbuf;
struct read_raw_arg ra =
read_raw_arg_init(gz->io, INT2FIX(GZFILE_READ_SIZE), outbuf);

return rb_rescue2(gzfile_read_raw_partial, (VALUE)&ra,
gzfile_read_raw_rescue, (VALUE)&ra,
Expand Down