Skip to content

Commit 015f1d1

Browse files
committed
Small style fixes.
1 parent 2569923 commit 015f1d1

File tree

1 file changed

+5
-4
lines changed
  • src/main/ruby/truffleruby/core

1 file changed

+5
-4
lines changed

src/main/ruby/truffleruby/core/io.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,7 @@ def reopen(other, mode=undefined)
20072007
# We need to use that mode of other here like MRI, and not fcntl(), because fcntl(fd, F_GETFL)
20082008
# gives O_RDWR for the 3 standard IOs, even though they are not bidirectional.
20092009
@mode = other.instance_variable_get :@mode
2010-
@ibuffer = (@mode & FMODE_READWRITE != FMODE_WRITABLE) ? IO::InternalBuffer.new : nil
2010+
@ibuffer = (@mode & FMODE_READABLE != 0) ? IO::InternalBuffer.new : nil
20112011

20122012

20132013
if io.respond_to?(:path)
@@ -2047,7 +2047,7 @@ def reopen(other, mode=undefined)
20472047
Errno.handle if mode < 0
20482048

20492049
@mode = Truffle::IOOperations.translate_omode_to_fmode((mode & ACCMODE))
2050-
@ibuffer = (@mode & FMODE_READWRITE) != FMODE_WRITABLE ? IO::InternalBuffer.new : nil
2050+
@ibuffer = (@mode & FMODE_READABLE) != 0 ? IO::InternalBuffer.new : nil
20512051
end
20522052

20532053
self
@@ -2104,7 +2104,7 @@ def set_encoding(external, internal=nil, options=undefined)
21042104
when String
21052105
@external = nil
21062106
when nil
2107-
if (@mode & FMODE_READWRITE == FMODE_READABLE) || @external
2107+
if (@mode & FMODE_WRITABLE == 0) || @external
21082108
@external = nil
21092109
else
21102110
@external = Encoding.default_external
@@ -2252,11 +2252,12 @@ def sync
22522252
# See also IO#fsync.
22532253
def sync=(v)
22542254
ensure_open
2255-
if Primitive.as_boolean(v)
2255+
if v
22562256
@mode |= FMODE_SYNC
22572257
else
22582258
@mode &= ~FMODE_SYNC
22592259
end
2260+
v
22602261
end
22612262

22622263
##

0 commit comments

Comments
 (0)