Skip to content

Commit 099c6cd

Browse files
authored
Update h5t_equal definition to automatically return Bool (#761)
The change in #757 to `Base.:(==)(::Datatype, ::Datatype)` incorrectly assumed that `h5t_equal` was already defined to return `htri_t`, so it broke the return type of equality comparisons on datatypes.
1 parent 0ae7cbf commit 099c6cd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

gen/api_defs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
@bind h5t_copy(dtype_id::hid_t)::hid_t "Error copying datatype"
227227
@bind h5t_create(class_id::Cint, sz::Csize_t)::hid_t error("Error creating datatype of id ", class_id)
228228
@bind h5t_enum_insert(dtype_id::hid_t, name::Cstring, value::Ptr{Cvoid})::herr_t error("Error adding ", name, " to enum datatype")
229-
@bind h5t_equal(dtype_id1::hid_t, dtype_id2::hid_t)::hid_t "Error checking datatype equality"
229+
@bind h5t_equal(dtype_id1::hid_t, dtype_id2::hid_t)::htri_t "Error checking datatype equality"
230230
@bind h5t_get_array_dims(dtype_id::hid_t, dims::Ptr{hsize_t})::Cint "Error getting dimensions of array"
231231
@bind h5t_get_array_ndims(dtype_id::hid_t)::Cint "Error getting ndims of array"
232232
@bind h5t_get_class(dtype_id::hid_t)::Cint "Error getting class"

src/api.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,9 +891,9 @@ function h5t_enum_insert(dtype_id, name, value)
891891
end
892892

893893
function h5t_equal(dtype_id1, dtype_id2)
894-
var"#status#" = ccall((:H5Tequal, libhdf5), hid_t, (hid_t, hid_t), dtype_id1, dtype_id2)
894+
var"#status#" = ccall((:H5Tequal, libhdf5), htri_t, (hid_t, hid_t), dtype_id1, dtype_id2)
895895
var"#status#" < 0 && error("Error checking datatype equality")
896-
return var"#status#"
896+
return var"#status#" > 0
897897
end
898898

899899
function h5t_get_array_dims(dtype_id, dims)

0 commit comments

Comments
 (0)