Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ext/java/org/jruby/ext/stringio/StringIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -1110,11 +1110,7 @@ private IRubyObject readCommon(ThreadContext context, int argc, IRubyObject arg0
final RubyString string;
switch (argc) {
case 2:
str = arg1;
if (!str.isNil()) {
str = str.convertToString();
modifyString((RubyString) str);
}
str = readBuf(arg1);
case 1:
if (!arg0.isNil()) {
len = RubyNumeric.fix2int(arg0);
Expand Down Expand Up @@ -1206,11 +1202,7 @@ private RubyString preadCommon(ThreadContext context, int argc, IRubyObject arg0

switch (argc) {
case 3:
str = arg2;
if (!str.isNil()) {
str = str.convertToString();
modifyString((RubyString) str);
}
str = readBuf(arg2);
case 2:
len = RubyNumeric.fix2int(arg0);
if (!arg0.isNil()) {
Expand Down Expand Up @@ -1702,6 +1694,14 @@ private static IRubyObject substrString(RubyString ch, IRubyObject str, Ruby run
return str;
}

private static IRubyObject readBuf(IRubyObject str) {
if (!str.isNil()) {
str = str.convertToString();
modifyString((RubyString) str);
}
return str;
}

// MRI: strio_write
private long stringIOWrite(ThreadContext context, Ruby runtime, IRubyObject arg) {
checkWritable();
Expand Down
Loading