Skip to content

Commit c84324f

Browse files
authored
Bugfix: Convert numbers to Int in extendedterminfo (#51195)
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
1 parent ba16663 commit c84324f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

base/terminfo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function extendedterminfo(data::IO; NumInt::Union{Type{UInt16}, Type{UInt32}})
137137
0x00 == read(data, UInt8) ||
138138
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"))
139139
end
140-
numbers = reinterpret(NumInt, read(data, numbers_count * sizeof(NumInt))) .|> ltoh
140+
numbers = map(n -> Int(ltoh(n)), reinterpret(NumInt, read(data, numbers_count * sizeof(NumInt))))
141141
table_indices = reinterpret(UInt16, read(data, table_count * sizeof(UInt16))) .|> ltoh
142142
table_strings = [String(readuntil(data, 0x00)) for _ in 1:length(table_indices)]
143143
strings = table_strings[1:string_count]

0 commit comments

Comments
 (0)