Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/highfive/H5DataSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class DataSpace: public Object {
// to use this constructor
template <typename IT,
typename = typename std::enable_if<!std::is_integral<IT>::value, IT>::type>
DataSpace(const IT begin, const IT end);
DataSpace(IT begin, IT end);

/// \brief Create a resizable N-dimensional DataSpace.
/// \param dims Initial size of dataspace
Expand Down
18 changes: 9 additions & 9 deletions include/highfive/H5PropertyList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class MPIOFileAccess {

private:
friend FileAccessProps;
void apply(const hid_t list) const;
void apply(hid_t list) const;

MPI_Comm _comm;
MPI_Info _info;
Expand Down Expand Up @@ -344,7 +344,7 @@ class FileVersionBounds {

private:
friend FileAccessProps;
void apply(const hid_t list) const;
void apply(hid_t list) const;

H5F_libver_t _low;
H5F_libver_t _high;
Expand All @@ -364,7 +364,7 @@ class MetadataBlockSize {

private:
friend FileAccessProps;
void apply(const hid_t list) const;
void apply(hid_t list) const;
hsize_t _size;
};

Expand Down Expand Up @@ -393,7 +393,7 @@ class FileSpaceStrategy {
private:
friend FileCreateProps;

void apply(const hid_t list) const;
void apply(hid_t list) const;

H5F_fspace_strategy_t _strategy;
hbool_t _persist;
Expand Down Expand Up @@ -422,7 +422,7 @@ class FileSpacePageSize {

private:
friend FileCreateProps;
void apply(const hid_t list) const;
void apply(hid_t list) const;

hsize_t _page_size;
};
Expand Down Expand Up @@ -579,9 +579,9 @@ class Caching {
public:
/// https://support.hdfgroup.org/HDF5/doc/RM/H5P/H5Pset_chunk_cache.html for
/// details.
Caching(const size_t numSlots,
const size_t cacheSize,
const double w0 = static_cast<double>(H5D_CHUNK_CACHE_W0_DEFAULT));
Caching(size_t numSlots,
size_t cacheSize,
double w0 = static_cast<double>(H5D_CHUNK_CACHE_W0_DEFAULT));

explicit Caching(const DataSetCreateProps& dcpl);

Expand Down Expand Up @@ -664,7 +664,7 @@ class MpioNoCollectiveCause {
#endif

struct CreationOrder {
enum _CreationOrder {
enum _creation_order {
Tracked = H5P_CRT_ORDER_TRACKED,
Indexed = H5P_CRT_ORDER_INDEXED,
};
Expand Down
2 changes: 1 addition & 1 deletion include/highfive/H5Selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Selection: public SliceTraits<Selection> {
///
/// \brief return the datatype of the selection
/// \return return the datatype of the selection
const DataType getDataType() const;
DataType getDataType() const;

protected:
Selection(const DataSpace& memspace, const DataSpace& file_space, const DataSet& set);
Expand Down
7 changes: 4 additions & 3 deletions include/highfive/bits/H5Exception_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ namespace HighFive {

struct HDF5ErrMapper {
template <typename ExceptionType>
static inline herr_t stackWalk(unsigned n, const H5E_error2_t* err_desc, void* client_data) {
static inline herr_t stackWalk(unsigned /* n */,
const H5E_error2_t* err_desc,
void* client_data) {
auto** e_iter = static_cast<ExceptionType**>(client_data);
(void) n;

const char* major_err = detail::nothrow::h5e_get_major(err_desc->maj_num);
const char* minor_err = detail::nothrow::h5e_get_minor(err_desc->min_num);
Expand Down Expand Up @@ -49,7 +50,7 @@ struct HDF5ErrMapper {
detail::nothrow::h5e_walk2(err_stack,
H5E_WALK_UPWARD,
&HDF5ErrMapper::stackWalk<ExceptionType>,
&e_iter);
(void*) &e_iter);
detail::nothrow::h5e_clear2(err_stack);

const char* next_err_msg = (e.nextException() != NULL) ? (e.nextException()->what())
Expand Down
8 changes: 5 additions & 3 deletions include/highfive/bits/H5File_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ inline File::File(const std::string& filename,
if (!mustCreate) {
// Silence open errors if create is allowed
std::unique_ptr<SilenceHDF5> silencer;
if (openOrCreate)
silencer.reset(new SilenceHDF5());
if (openOrCreate) {
silencer = std::make_unique<SilenceHDF5>();
}

_hid = detail::nothrow::h5f_open(filename.c_str(), openMode, fileAccessProps.getId());

if (isValid())
if (isValid()) {
return; // Done
}

if (openOrCreate) {
// Will attempt to create ensuring wont clobber any file
Expand Down
6 changes: 3 additions & 3 deletions include/highfive/bits/H5Inspector_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ struct inspector<bool>: type_helper<bool> {
static void unserialize(const hdf5_type* vec,
const std::vector<size_t>& /* dims */,
type& val) {
val = vec[0] != 0 ? true : false;
val = vec[0] != 0;
}

static void serialize(const type& val, const std::vector<size_t>& /* dims*/, hdf5_type* m) {
Expand Down Expand Up @@ -337,7 +337,7 @@ struct inspector<std::vector<bool>> {
const std::vector<size_t>& dims,
type& val) {
for (size_t i = 0; i < dims[0]; ++i) {
val[i] = vec_align[i] != 0 ? true : false;
val[i] = vec_align[i] != 0;
}
}
};
Expand Down Expand Up @@ -475,7 +475,7 @@ struct inspector<T[N]> {
static constexpr bool is_trivially_nestable = is_trivially_copyable;

static void prepare(type& val, const std::vector<size_t>& dims) {
if (dims.size() < 1) {
if (dims.empty()) {
throw DataSpaceException("Invalid 'dims', must be at least 1 dimensional.");
}

Expand Down
6 changes: 3 additions & 3 deletions include/highfive/bits/H5Iterables_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ namespace details {
struct HighFiveIterateData {
inline HighFiveIterateData(std::vector<std::string>& my_names)
: names(my_names)
, err(NULL) {}
, err(nullptr) {}

std::vector<std::string>& names;
std::exception* err;

inline void throwIfError() {
if (err) {
inline void throwIfError() const {
if (err != nullptr) {
throw *err;
}
}
Expand Down
6 changes: 3 additions & 3 deletions include/highfive/bits/H5Node_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ class NodeTraits {
const std::string& obj_path,
LinkCreateProps linkCreateProps = LinkCreateProps(),
const LinkAccessProps& linkAccessProps = LinkAccessProps(),
const bool parents = true);
bool parents = true);

void createExternalLink(const std::string& link_name,
const std::string& h5_file,
const std::string& obj_path,
LinkCreateProps linkCreateProps = LinkCreateProps(),
const LinkAccessProps& linkAccessProps = LinkAccessProps(),
const bool parents = true);
bool parents = true);

///
/// \brief Creates hardlinks
Expand All @@ -208,7 +208,7 @@ class NodeTraits {
const T& target_obj,
LinkCreateProps linkCreateProps = LinkCreateProps(),
const LinkAccessProps& linkAccessProps = LinkAccessProps(),
const bool parents = true);
bool parents = true);

private:
using derivate_type = Derivate;
Expand Down
2 changes: 1 addition & 1 deletion include/highfive/bits/H5Selection_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ inline const DataSet& Selection::getDataset() const {
}

// Not only a shortcut but also for templated compat with H5Dataset
inline const DataType Selection::getDataType() const {
inline DataType Selection::getDataType() const {
return _set.getDataType();
}

Expand Down
7 changes: 4 additions & 3 deletions include/highfive/bits/H5Slice_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ class HyperSlab {
/// The length of a stream of `Op::Or` starting at `begin`.
size_t detect_streak(Select_ const* begin, Select_ const* end, Op op) const {
assert(op == Op::Or);
auto it = std::find_if(begin, end, [op](const Select_& sel) { return sel.op != op; });
auto const* it =
std::find_if(begin, end, [op](const Select_& sel) { return sel.op != op; });
return static_cast<size_t>(it - begin);
}

Expand Down Expand Up @@ -304,8 +305,8 @@ class HyperSlab {
auto space = space_.clone();
auto n_selects = selects.size();
for (size_t i = 0; i < n_selects; ++i) {
auto begin = selects.data() + i;
auto end = selects.data() + n_selects;
auto const* const begin = selects.data() + i;
auto const* const end = selects.data() + n_selects;

auto n_ors = detect_streak(begin, end, Op::Or);

Expand Down
2 changes: 1 addition & 1 deletion include/highfive/bits/H5Slice_traits_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ inline Selection SliceTraits<Derivate>::select(const ElementSet& elements) const
// switch for data conversion on 32bits platforms
if (std::is_same<std::size_t, hsize_t>::value) {
// `if constexpr` can't be used, thus a reinterpret_cast is needed.
data = reinterpret_cast<const hsize_t*>(&(elements._ids[0]));
data = reinterpret_cast<const hsize_t*>(elements._ids.data());
} else {
raw_elements.resize(length);
std::copy(elements._ids.begin(), elements._ids.end(), raw_elements.begin());
Expand Down
3 changes: 1 addition & 2 deletions include/highfive/bits/H5Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ namespace details {
// converter function for hsize_t -> size_t when hsize_t != size_t
template <typename Size>
inline std::vector<std::size_t> to_vector_size_t(const std::vector<Size>& vec) {
static_assert(std::is_same<Size, std::size_t>::value == false,
" hsize_t != size_t mandatory here");
static_assert(!std::is_same<Size, std::size_t>::value, " hsize_t != size_t mandatory here");
std::vector<size_t> res(vec.size());
std::transform(vec.cbegin(), vec.cend(), res.begin(), [](Size e) {
return static_cast<size_t>(e);
Expand Down
2 changes: 1 addition & 1 deletion include/highfive/bits/assert_compatible_spaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace detail {

inline void assert_compatible_spaces(const DataSpace& old, const std::vector<size_t>& dims) {
auto n_elements_old = old.getElementCount();
auto n_elements_new = dims.size() == 0 ? 1 : compute_total_size(dims);
auto n_elements_new = dims.empty() ? 1 : compute_total_size(dims);

if (n_elements_old != n_elements_new) {
throw Exception("Invalid parameter `new_dims` number of elements differ: " +
Expand Down
Loading