Skip to content

Commit

Permalink
Merge pull request #353 from znz/unpack1
Browse files Browse the repository at this point in the history
Use `unpack1` instead of `unpack(template)[0]`
  • Loading branch information
aycabta committed Sep 22, 2021
2 parents f0a1d5e + 45aa367 commit f84afd9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/reline/terminfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module Reline::Terminfo
def self.setupterm(term, fildes)
errret_int = String.new("\x00" * 8, encoding: 'ASCII-8BIT')
ret = @setupterm.(term, fildes, errret_int)
errret = errret_int.unpack('i')[0]
errret = errret_int.unpack1('i')
case ret
when 0 # OK
0
Expand Down
2 changes: 1 addition & 1 deletion lib/reline/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def self.msys_tty?(io=@@hConsoleInputHandle)
# DWORD FileNameLength;
# WCHAR FileName[1];
# } FILE_NAME_INFO
len = p_buffer[0, 4].unpack("L")[0]
len = p_buffer[0, 4].unpack1("L")
name = p_buffer[4, len].encode(Encoding::UTF_8, Encoding::UTF_16LE, invalid: :replace)

# Check if this could be a MSYS2 pty pipe ('\msys-XXXX-ptyN-XX')
Expand Down

0 comments on commit f84afd9

Please sign in to comment.