Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.1
matio
0001-Write-backwards-compatible-Mat7.3-files.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Write-backwards-compatible-Mat7.3-files.patch of Package matio
From 6cb9145d2782f680625b705c21c290019fdf7766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> Date: Tue, 2 Oct 2018 21:41:36 +0200 Subject: [PATCH] Write backwards compatible Mat7.3 files When Matio uses HDF5 1.10.x, it may create files using features only supported with newer versions. Limiting the version range for compatibility was added in HDF5 1.10.2. For details, see https://www.hdfgroup.org/2018/04/why-should-i-care-about-the-hdf5-1-10-2-release/ --- src/mat.c | 11 +++++++++-- src/mat73.c | 11 ++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/mat.c b/src/mat.c index 3446213..dcd0ded 100644 --- a/src/mat.c +++ b/src/mat.c @@ -408,8 +408,15 @@ Mat_Open(const char *matname,int mode) if ( (mode & 0x01) == MAT_ACC_RDONLY ) *(hid_t*)mat->fp=H5Fopen(mat->filename,H5F_ACC_RDONLY,H5P_DEFAULT); - else if ( (mode & 0x01) == MAT_ACC_RDWR ) - *(hid_t*)mat->fp=H5Fopen(mat->filename,H5F_ACC_RDWR,H5P_DEFAULT); + else if ( (mode & 0x01) == MAT_ACC_RDWR ) { + hid_t plist_ap; + plist_ap = H5Pcreate(H5P_FILE_ACCESS); +#if H5_VERSION_GE(1,10,2) + H5Pset_libver_bounds(plist_ap,H5F_LIBVER_EARLIEST,H5F_LIBVER_V18); +#endif + *(hid_t*)mat->fp=H5Fopen(mat->filename,H5F_ACC_RDWR,plist_ap); + H5Pclose(plist_ap); + } if ( -1 < *(hid_t*)mat->fp ) { H5G_info_t group_info; diff --git a/src/mat73.c b/src/mat73.c index 81b31fd..f5c17f0 100644 --- a/src/mat73.c +++ b/src/mat73.c @@ -2200,11 +2200,15 @@ Mat_Create73(const char *matname,const char *hdr_str) mat_t *mat = NULL; size_t err; time_t t; - hid_t plist_id,fid; + hid_t plist_id,fid,plist_ap; plist_id = H5Pcreate(H5P_FILE_CREATE); H5Pset_userblock(plist_id,512); - fid = H5Fcreate(matname,H5F_ACC_TRUNC,plist_id,H5P_DEFAULT); + plist_ap = H5Pcreate(H5P_FILE_ACCESS); +#if H5_VERSION_GE(1,10,2) + H5Pset_libver_bounds(plist_ap,H5F_LIBVER_EARLIEST,H5F_LIBVER_V18); +#endif + fid = H5Fcreate(matname,H5F_ACC_TRUNC,plist_id,plist_ap); H5Fclose(fid); H5Pclose(plist_id); @@ -2263,7 +2267,8 @@ Mat_Create73(const char *matname,const char *hdr_str) fclose(fp); - fid = H5Fopen(matname,H5F_ACC_RDWR,H5P_DEFAULT); + fid = H5Fopen(matname,H5F_ACC_RDWR,plist_ap); + H5Pclose(plist_ap); mat->fp = malloc(sizeof(hid_t)); *(hid_t*)mat->fp = fid; -- 2.19.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor