We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
unsafe_string(::fixed_string)
1 parent 817308a commit 7195b18Copy full SHA for 7195b18
src/string_utils.jl
@@ -23,10 +23,10 @@ function unsafe_string(x::fixed_string{T}) where {T <: Integer}
23
data_array = reinterpret(UInt8, [x.data])
24
zero_idx = findfirst(data_array, 0)
25
if zero_idx == 0
26
- zero_idx = sizeof(T)
+ zero_idx = sizeof(T) + 1
27
end
28
29
- str = String(data_array[1:zero_idx])
+ str = String(data_array[1:zero_idx-1])
30
if !isvalid(str)
31
return "$(zero_idx)-byte String of invalid UTF-8 data"
32
0 commit comments