Skip to content

Commit

Permalink
fix(32bit arches): use explicit casts
Browse files Browse the repository at this point in the history
Explicitly casts long long unsigned int to size_t

Fixes BlueBrain#443
  • Loading branch information
sanjayankur31 committed Apr 6, 2022
1 parent 34bbc60 commit 861aae5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
5 changes: 3 additions & 2 deletions include/highfive/bits/H5Attribute_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
namespace HighFive {

inline std::string Attribute::getName() const {
return details::get_name(
[&](char* buffer, hsize_t length) { return H5Aget_name(_hid, length, buffer); });
return details::get_name([&](char *buffer, hsize_t length) {
return H5Aget_name(_hid, static_cast<size_t>(length), buffer);
});
}

inline size_t Attribute::getStorageSize() const {
Expand Down
5 changes: 3 additions & 2 deletions include/highfive/bits/H5File_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ inline File::File(const std::string& filename,

inline const std::string& File::getName() const noexcept {
if (_filename.empty()) {
_filename = details::get_name(
[this](char* buffer, hsize_t length) { return H5Fget_name(getId(), buffer, length); });
_filename = details::get_name([this](char* buffer, hsize_t length) {
return H5Fget_name(getId(), buffer, static_cast<size_t>(length));
});
}
return _filename;
}
Expand Down
11 changes: 3 additions & 8 deletions include/highfive/bits/H5Node_traits_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,9 @@ inline size_t NodeTraits<Derivate>::getNumberObjects() const {
template <typename Derivate>
inline std::string NodeTraits<Derivate>::getObjectName(size_t index) const {
return details::get_name([&](char* buffer, hsize_t length) {
return H5Lget_name_by_idx(static_cast<const Derivate*>(this)->getId(),
".",
H5_INDEX_NAME,
H5_ITER_INC,
index,
buffer,
length,
H5P_DEFAULT);
return H5Lget_name_by_idx(
static_cast<const Derivate*>(this)->getId(), ".", H5_INDEX_NAME, H5_ITER_INC,
index, buffer, static_cast<size_t>(length), H5P_DEFAULT);
});
}

Expand Down
2 changes: 1 addition & 1 deletion include/highfive/bits/H5Path_traits_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ inline PathTraits<Derivate>::PathTraits() {
template <typename Derivate>
inline std::string PathTraits<Derivate>::getPath() const {
return details::get_name([this](char* buffer, hsize_t length) {
return H5Iget_name(static_cast<const Derivate*>(this)->getId(), buffer, length);
return H5Iget_name(static_cast<const Derivate*>(this)->getId(), buffer, static_cast<size_t>(length));
});
}

Expand Down
4 changes: 2 additions & 2 deletions include/highfive/bits/H5Reference_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace HighFive {

inline Reference::Reference(const Object& location, const Object& object)
: parent_id(location.getId()) {
obj_name = details::get_name(
[&](char* buffer, hsize_t length) { return H5Iget_name(object.getId(), buffer, length); });
obj_name = details::get_name([&](char *buffer, hsize_t length) {
return H5Iget_name(object.getId(), buffer, static_cast<size_t>(length)); });
}

inline void Reference::create_ref(hobj_ref_t* refptr) const {
Expand Down

0 comments on commit 861aae5

Please sign in to comment.