Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of jruby.org:jruby

  • Loading branch information...
commit dae852c0b19d03f46b771a23e012a51405f607b3 2 parents e18e288 + 539f45c
@donv donv authored
View
16 src/org/jruby/ext/zlib/RubyZlib.java
@@ -1343,13 +1343,27 @@ public Arity getArity() {
}
return obj;
}
+
+ /**
+ * Get position within this stream including that has been read by
+ * users calling read + what jzlib may have speculatively read in
+ * because of buffering.
+ * @return number of bytes
+ */
+ private long internalPosition() {
+ long n = io.getTotalIn();
+
+ if (io.getAvailIn() != null) n += io.getAvailIn().length;
+
+ return n;
+ }
@JRubyMethod
public IRubyObject rewind() {
Ruby rt = getRuntime();
// should invoke seek on realIo...
realIo.callMethod(rt.getCurrentContext(), "seek",
- new IRubyObject[]{rt.newFixnum(-io.getTotalIn()), rt.newFixnum(Stream.SEEK_CUR)});
+ new IRubyObject[]{rt.newFixnum(-internalPosition()), rt.newFixnum(Stream.SEEK_CUR)});
// ... and then reinitialize
initialize(realIo);
return getRuntime().getNil();
View
23 src/org/jruby/runtime/Interpreted19Block.java
@@ -28,16 +28,13 @@
package org.jruby.runtime;
import org.jruby.Ruby;
-import org.jruby.RubyArray;
import org.jruby.RubyModule;
+import org.jruby.ast.ArgsNoArgNode;
+import org.jruby.ast.ArgsNode;
import org.jruby.ast.IterNode;
import org.jruby.ast.LambdaNode;
import org.jruby.ast.NilImplicitNode;
import org.jruby.ast.Node;
-import org.jruby.ast.ArgsNoArgNode;
-import org.jruby.ast.ArgsNode;
-import org.jruby.ast.util.ArgsUtil;
-import org.jruby.common.IRubyWarnings.ID;
import org.jruby.evaluator.ASTInterpreter;
import org.jruby.exceptions.JumpException;
import org.jruby.javasupport.util.RuntimeHelpers;
@@ -230,22 +227,6 @@ private IRubyObject handleNextJump(ThreadContext context, JumpException.NextJump
return nj.getValue() == null ? context.getRuntime().getNil() : (IRubyObject)nj.getValue();
}
- private IRubyObject convertIfAlreadyArray(ThreadContext context, IRubyObject value) {
- int length = ArgsUtil.arrayLength(value);
- switch (length) {
- case 0:
- value = context.getRuntime().getNil();
- break;
- case 1:
- value = ((RubyArray)value).eltInternal(0);
- break;
- default:
- context.getRuntime().getWarnings().warn(ID.MULTIPLE_VALUES_FOR_BLOCK, "multiple values for a block parameter (" + length + " for 1)");
- }
-
- return value;
- }
-
private void setupBlockArg(ThreadContext context, IRubyObject value, IRubyObject self, Block block, Block.Type type) {
setupBlockArgs(context, value, self, block, type, false);
}
View
7 src/org/jruby/runtime/load/LoadService.java
@@ -1390,12 +1390,15 @@ protected LoadServiceResource findFileInClasspath(String name) {
entry = entry.substring("classpath:".length());
}
+ String entryName;
if (name.startsWith(entry)) {
- name = name.substring(entry.length());
+ entryName = name.substring(entry.length());
+ } else {
+ entryName = name;
}
// otherwise, try to load from classpath (Note: Jar resources always uses '/')
- LoadServiceResource foundResource = getClassPathResource(classLoader, entry + "/" + name);
+ LoadServiceResource foundResource = getClassPathResource(classLoader, entry + "/" + entryName);
if (foundResource != null) {
return foundResource;
}
Please sign in to comment.
Something went wrong with that request. Please try again.