From 06fbc9f2a32ff8dc845088e332d916dd2eab9469 Mon Sep 17 00:00:00 2001 From: Jakob Nybo Nissen Date: Tue, 5 Sep 2023 15:33:24 +0200 Subject: [PATCH] Bugfix: Convert numbers to Int in extendedterminfo 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. --- base/terminfo.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/terminfo.jl b/base/terminfo.jl index c2844d189a3e5..7bd3151cdb42f 100644 --- a/base/terminfo.jl +++ b/base/terminfo.jl @@ -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]