Skip to content

Commit c240711

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

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/io/file/hdf5_io.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,7 +2368,6 @@ void HDF5_IO::add_v9_layout(std::string dataset_file)
23682368
}
23692369

23702370
//change version to 9
2371-
float version = 9;
23722371
hid_t version_id = H5Dopen(file_id, "/MAPS/version", H5P_DEFAULT);
23732372
if(version_id > -1)
23742373
{
@@ -2384,7 +2383,16 @@ void HDF5_IO::add_v9_layout(std::string dataset_file)
23842383
{
23852384
_global_close_map.push({ver_type, H5O_DATATYPE });
23862385
}
2387-
H5Dwrite(version_id, ver_type, ver_space, ver_space, H5P_DEFAULT, (void*)&version);
2386+
if (H5Tget_class(ver_type) == H5T_FLOAT)
2387+
{
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);
2395+
}
23882396
if (H5Gget_objinfo(file_id, "/version", 0, NULL) < 0)
23892397
{
23902398
H5Lcreate_hard(file_id, "/MAPS/version", H5L_SAME_LOC, "/version", H5P_DEFAULT, H5P_DEFAULT);

0 commit comments

Comments
 (0)