Skip to content

Commit

Permalink
Bugfix: Convert numbers to Int in extendedterminfo (#51195)
Browse files Browse the repository at this point in the history
Before, in the extendedterminfo function in terminfo.jl, if the numbers
array was nonempty, the function would fail as a `UInt32` cannot be
implicitly converted to the output `Int` type. Do this conversion
explicitly.

Closes #51190
  • Loading branch information
jakobnissen authored Sep 5, 2023
1 parent ba16663 commit c84324f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/terminfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function extendedterminfo(data::IO; NumInt::Union{Type{UInt16}, Type{UInt32}})
0x00 == read(data, UInt8) ||
throw(ArgumentError("Terminfo did not contain a null byte after the extended flag section, expected to position the start of the numbers section on an even byte"))
end
numbers = reinterpret(NumInt, read(data, numbers_count * sizeof(NumInt))) .|> ltoh
numbers = map(n -> Int(ltoh(n)), reinterpret(NumInt, read(data, numbers_count * sizeof(NumInt))))
table_indices = reinterpret(UInt16, read(data, table_count * sizeof(UInt16))) .|> ltoh
table_strings = [String(readuntil(data, 0x00)) for _ in 1:length(table_indices)]
strings = table_strings[1:string_count]
Expand Down

0 comments on commit c84324f

Please sign in to comment.