Skip to content

Commit

Permalink
ensure ::Int for odr sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasIsensee committed Sep 22, 2024
1 parent 8483565 commit 77ab2b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/data/reconstructing_datatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function constructrr(f::JLDFile, T::DataType, dt::CompoundDatatype,
tequal &= odr_offsets == offsets
tequal && return (ReadRepresentation{T,wodr}(), true)
end
return (ReadRepresentation{T,OnDiskRepresentation{offsets, Tuple{types...}, Tuple{odrs...}, offsets[end]+odr_sizeof(odrs[end])}()}(), false)
return (ReadRepresentation{T,OnDiskRepresentation{offsets, Tuple{types...}, Tuple{odrs...}, Int(offsets[end]+odr_sizeof(odrs[end]))}()}(), false)
end

function constructrr(f::JLDFile, u::Upgrade, dt::CompoundDatatype,
Expand Down Expand Up @@ -603,7 +603,7 @@ function reconstruct_odr(f::JLDFile, dt::CompoundDatatype,
push!(offsets, offset)
offset += odr_sizeof(dtrr)
end
OnDiskRepresentation{(offsets...,), Tuple{types...}, Tuple{h5types...},dt.size}()
OnDiskRepresentation{(offsets...,), Tuple{types...}, Tuple{h5types...},Int(dt.size)}()
end

# Reconstruct type that is a "lost cause": either we were not able to resolve
Expand All @@ -616,7 +616,7 @@ function reconstruct_compound(f::JLDFile, T::String, dt::H5Datatype,
fnames = tuple((Symbol(k) for k in keys(field_datatypes))...,)
if !any(jlconvert_canbeuninitialized(ReadRepresentation{types[i], odrs[i]}()) for i = 1:length(types))
rt = ReconstructedStatic{Symbol(T), fnames, Tuple{types...}}
odr = OnDiskRepresentation{(0,), Tuple{NamedTuple{fnames,Tuple{types...}}}, Tuple{rodr}, dt.size}()
odr = OnDiskRepresentation{(0,), Tuple{NamedTuple{fnames,Tuple{types...}}}, Tuple{rodr}, Int(dt.size)}()
return (ReadRepresentation{rt, odr}(), false)
end
T = ReconstructedMutable{Symbol(T), fnames, Tuple{types...}}
Expand Down
4 changes: 2 additions & 2 deletions src/data/writing_datatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ end
offset += odr_sizeof(fodr)
end

OnDiskRepresentation{(offsets...,), Tuple{T.types...}, Tuple{odrs...}, offset}()
OnDiskRepresentation{(offsets...,), Tuple{T.types...}, Tuple{odrs...}, Int(offset)}()
end

abstract type DataMode end
Expand All @@ -669,7 +669,7 @@ datamode(::DataType) = ReferenceFree()
datamode(::FixedLengthString) = ReferenceFree()
datamode(::AsciiString) = ReferenceFree()
datamode(::Nothing) = ReferenceFree()
function datamode(odr::OnDiskRepresentation{Offsets,JLTypes,H5Types,Size} where {Offsets,JLTypes,Size}) where H5Types
function datamode(::OnDiskRepresentation{Offsets,JLTypes,H5Types,Size} where {Offsets,JLTypes,Size}) where H5Types
for ty in H5Types.parameters
datamode(ty) == HasReferences() && return HasReferences()
end
Expand Down
2 changes: 1 addition & 1 deletion src/datatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ end

struct ArrayPlaceHolder{T, D} end

odr_sizeof(::Type{ArrayPlaceHolder{T,D}}) where {T,D} = (odr_sizeof(T)*prod(D))::Int
odr_sizeof(::Type{ArrayPlaceHolder{T,D}}) where {T,D} = Int(odr_sizeof(T)*prod(D))

function jltype(f::JLDFile, dt::ArrayDatatype)
rr = jltype(f, dt.base_type)
Expand Down

0 comments on commit 77ab2b9

Please sign in to comment.