Skip to content

Commit

Permalink
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -3289,6 +3289,7 @@ private long checkBase(IRubyObject arg0) {
/** rb_str_to_inum
*
*/
@Deprecated
public IRubyObject stringToInum(int base, boolean badcheck) {
ByteList s = this.value;
return ConvertBytes.byteListToInum(getRuntime(), s, base, badcheck);
8 changes: 5 additions & 3 deletions core/src/main/java/org/jruby/util/ConvertBytes.java
Original file line number Diff line number Diff line change
@@ -21,9 +21,10 @@ public class ConvertBytes {
private final boolean is19;

public ConvertBytes(Ruby runtime, ByteList _str, int base, boolean badcheck) {
this(runtime, _str, base, badcheck, false);
this(runtime, _str, base, badcheck, true);
}

@Deprecated
public ConvertBytes(Ruby runtime, ByteList _str, int base, boolean badcheck, boolean is19) {
this.runtime = runtime;
this._str = _str;
@@ -229,12 +230,13 @@ public static final byte[] twosComplementToUnsignedBytes(byte[] in, int shift, b
/** rb_cstr_to_inum
*
*/
@Deprecated
public static RubyInteger byteListToInum(Ruby runtime, ByteList str, int base, boolean badcheck) {
return new ConvertBytes(runtime, str, base, badcheck).byteListToInum();
return new ConvertBytes(runtime, str, base, badcheck, false).byteListToInum();
}

public static RubyInteger byteListToInum19(Ruby runtime, ByteList str, int base, boolean badcheck) {
return new ConvertBytes(runtime, str, base, badcheck, true).byteListToInum();
return new ConvertBytes(runtime, str, base, badcheck).byteListToInum();
}

private final static byte[] conv_digit = new byte[128];
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/Sprintf.java
Original file line number Diff line number Diff line change
@@ -605,7 +605,7 @@ else if ((flags & FLAG_MINUS) != 0) {
arg = RubyNumeric.dbl2num(arg.getRuntime(),((RubyFloat)arg).getValue());
break;
case STRING:
arg = ((RubyString)arg).stringToInum(0, true);
arg = ((RubyString)arg).stringToInum19(0, true);
break;
default:
if (arg.respondsTo("to_int")) {

0 comments on commit df64c6e

Please sign in to comment.