1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Use unpack1 instead of unpack(template)[0]

https://github.com/ruby/reline/commit/45aa367616
This commit is contained in:
Kazuhiro NISHIYAMA 2021-09-22 18:14:13 +09:00 committed by git
parent 782d1d876b
commit 357406da8b
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -184,7 +184,7 @@ class Reline::Windows
# 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')