diff options
author | Ruben Undheim <ruben.undheim@gmail.com> | 2018-08-13 09:26:34 +0200 |
---|---|---|
committer | Ruben Undheim <ruben.undheim@gmail.com> | 2018-08-13 09:26:34 +0200 |
commit | 7097a4eaa0a32e0d02207521941157bda8968b05 (patch) | |
tree | d4b1258d2601508182f8ff8b992d7e9431a7d20a /openEMS/matlab/h5readatt_octave.cc | |
parent | aa7abb5c97c20b34f159886dfc523dd8198fef98 (diff) |
New upstream version 0.0.35+ds.1
Diffstat (limited to 'openEMS/matlab/h5readatt_octave.cc')
-rwxr-xr-x | openEMS/matlab/h5readatt_octave.cc | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/openEMS/matlab/h5readatt_octave.cc b/openEMS/matlab/h5readatt_octave.cc index 8bd58d0..13e1765 100755 --- a/openEMS/matlab/h5readatt_octave.cc +++ b/openEMS/matlab/h5readatt_octave.cc @@ -5,13 +5,7 @@ // this special treatment is necessary because Win32-Octave ships with a very old hdf5 version (1.6.10) void CloseH5Object(hid_t obj) { -#if ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR == 6)) - // try group close, than Dataset close - if (H5Gclose(obj)<0) - H5Dclose(obj); -#else H5Oclose(obj); -#endif } DEFUN_DLD (h5readatt_octave, args, nargout, "h5readatt_octave(<File_Name>,<DataSet_Name>,<Attribute_Name>)") @@ -30,7 +24,7 @@ DEFUN_DLD (h5readatt_octave, args, nargout, "h5readatt_octave(<File_Name>,<DataS } //suppress hdf5 error output - H5Eset_auto1(NULL, NULL); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); hid_t file = H5Fopen( args(0).string_value().c_str(), H5F_ACC_RDONLY, H5P_DEFAULT ); if (file==-1) @@ -39,17 +33,7 @@ DEFUN_DLD (h5readatt_octave, args, nargout, "h5readatt_octave(<File_Name>,<DataS return retval; } -#if ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR == 6)) - // this special treatment is necessary because Win32-Octave ships with a very old hdf5 version (1.6.10) - hid_t obj = -1; - //try opening the group - obj = H5Gopen(file, args(1).string_value().c_str()); - //try opening the dataset if group failed - if (obj==-1) - obj = H5Dopen(file, args(1).string_value().c_str()); -#else hid_t obj = H5Oopen(file, args(1).string_value().c_str(), H5P_DEFAULT); -#endif if (obj==-1) { @@ -59,7 +43,8 @@ DEFUN_DLD (h5readatt_octave, args, nargout, "h5readatt_octave(<File_Name>,<DataS return retval; } - hid_t attr = H5Aopen_name(obj, args(2).string_value().c_str()); + hid_t attr = H5Aopen_by_name(obj, ".", args(2).string_value().c_str(), H5P_DEFAULT, H5P_DEFAULT); + if (attr==-1) { CloseH5Object(obj); |