Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf88de7f48da
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: eef3f728c6b7
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on Jun 16, 2017

  1. Copy the full SHA
    14619bd View commit details
  2. Copy the full SHA
    026b366 View commit details

Commits on Jun 22, 2017

  1. Merge pull request #4673 from haines/gzip_reader_readpartial

    Handle nil buffer in Zlib::GzipReader#readpartial
    kares authored Jun 22, 2017
    Copy the full SHA
    eef3f72 View commit details
Showing with 18 additions and 1 deletion.
  1. +1 −1 core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipReader.java
  2. +17 −0 spec/ruby/library/zlib/gzipreader/readpartial_spec.rb
Original file line number Diff line number Diff line change
@@ -363,7 +363,7 @@ public IRubyObject readpartial(IRubyObject[] args) {
throw getRuntime().newArgumentError("negative length " + len + " given");
}

if (args.length > 1) {
if (args.length > 1 && !args[1].isNil()) {
if (!(args[1] instanceof RubyString)) {
throw getRuntime().newTypeError(
"wrong argument type " + args[1].getMetaClass().getName()
17 changes: 17 additions & 0 deletions spec/ruby/library/zlib/gzipreader/readpartial_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require File.expand_path('../../../../spec_helper', __FILE__)
require 'stringio'
require 'zlib'

describe 'GzipReader#readpartial' do
before :each do
@data = '12345abcde'
@zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
@io = StringIO.new(@zip)
end

it 'accepts nil buffer' do
gz = Zlib::GzipReader.new(@io)
gz.readpartial(5, nil).should == '12345'
end
end