Created
March 23, 2012 15:22
-
-
Save nahi/2171719 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/org/jruby/ext/zlib/RubyZlib.java b/src/org/jruby/ext/zlib/RubyZlib.java | |
index a056cb8..65bae2f 100644 | |
--- a/src/org/jruby/ext/zlib/RubyZlib.java | |
+++ b/src/org/jruby/ext/zlib/RubyZlib.java | |
@@ -1348,8 +1348,12 @@ public class RubyZlib { | |
public IRubyObject rewind() { | |
Ruby rt = getRuntime(); | |
// should invoke seek on realIo... | |
+ long n = io.getTotalIn(); | |
+ if (io.getAvailIn() != null) { | |
+ n += io.getAvailIn().length; | |
+ } | |
realIo.callMethod(rt.getCurrentContext(), "seek", | |
- new IRubyObject[]{rt.newFixnum(-io.getTotalIn()), rt.newFixnum(Stream.SEEK_CUR)}); | |
+ new IRubyObject[]{rt.newFixnum(-n), rt.newFixnum(Stream.SEEK_CUR)}); | |
// ... and then reinitialize | |
initialize(realIo); | |
return getRuntime().getNil(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment