Skip to content
Browse files

Fix RubyString#byteslice on substring.

As value.getBegin() already managed by makeShared19(), the method
byteSubstr() need not take it into account.
  • Loading branch information...
1 parent 3cd83a9 commit c7ed4abd3c4d1dc501080e6ccb0756271e7a689a @grddev committed May 14, 2013
Showing with 1 addition and 7 deletions.
  1. +1 −7 src/org/jruby/RubyString.java
View
8 src/org/jruby/RubyString.java
@@ -3512,11 +3512,9 @@ public final IRubyObject substr(Ruby runtime, int beg, int len) {
/* str_byte_substr */
private IRubyObject byteSubstr(Ruby runtime, int beg, int len) {
int length = value.length();
- int s = value.getBegin();
if (len < 0 || beg > length) return runtime.getNil();
- int p;
if (beg < 0) {
beg += length;
if (beg < 0) return runtime.getNil();
@@ -3525,13 +3523,9 @@ private IRubyObject byteSubstr(Ruby runtime, int beg, int len) {
if (len <= 0) {
len = 0;
- p = 0;
- }
- else {
- p = s + beg;
}
- return makeShared19(runtime, p, len);
+ return makeShared19(runtime, beg, len);
}
/* str_byte_aref */

0 comments on commit c7ed4ab

Please sign in to comment.
Something went wrong with that request. Please try again.