Skip to content

Commit 8244b81

Browse files
author
Arthur Glowacki
committed
Fixed add_v9layout saving version if it was processed as double
1 parent c240711 commit 8244b81

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/io/file/hdf5_io.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,13 +2385,16 @@ void HDF5_IO::add_v9_layout(std::string dataset_file)
23852385
}
23862386
if (H5Tget_class(ver_type) == H5T_FLOAT)
23872387
{
2388-
float version = 9.0;
2389-
H5Dwrite(version_id, ver_type, ver_space, ver_space, H5P_DEFAULT, (void*)&version);
2390-
}
2391-
else
2392-
{
2393-
double version = 9.0;
2394-
H5Dwrite(version_id, ver_type, ver_space, ver_space, H5P_DEFAULT, (void*)&version);
2388+
if (H5Tget_size(ver_type) == sizeof(float))
2389+
{
2390+
float version = 9.0;
2391+
H5Dwrite(version_id, ver_type, ver_space, ver_space, H5P_DEFAULT, (void*)&version);
2392+
}
2393+
else
2394+
{
2395+
double version = 9.0;
2396+
H5Dwrite(version_id, ver_type, ver_space, ver_space, H5P_DEFAULT, (void*)&version);
2397+
}
23952398
}
23962399
if (H5Gget_objinfo(file_id, "/version", 0, NULL) < 0)
23972400
{

0 commit comments

Comments
 (0)