mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
further movement towards NC_HDF5_FILE_INFO_T
This commit is contained in:
parent
2d53a8ece0
commit
43b6aeca34
@ -47,7 +47,7 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
|
||||
FILE *fp;
|
||||
int retval = NC_NOERR;
|
||||
NC_FILE_INFO_T* nc4_info = NULL;
|
||||
|
||||
NC_HDF5_FILE_INFO_T *hdf5_info;
|
||||
#ifdef USE_PARALLEL4
|
||||
NC_MPI_INFO *mpiinfo = NULL;
|
||||
MPI_Comm comm;
|
||||
@ -68,6 +68,7 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
|
||||
/* Add struct to hold HDF5-specific file metadata. */
|
||||
if (!(nc4_info->format_file_info = calloc(1, sizeof(NC_HDF5_FILE_INFO_T))))
|
||||
BAIL(NC_ENOMEM);
|
||||
hdf5_info = (NC_HDF5_FILE_INFO_T *)nc4_info->format_file_info;
|
||||
|
||||
nc4_info->mem.inmemory = (cmode & NC_INMEMORY) == NC_INMEMORY;
|
||||
nc4_info->mem.diskless = (cmode & NC_DISKLESS) == NC_DISKLESS;
|
||||
@ -213,10 +214,14 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
|
||||
retval = NC4_create_image_file(nc4_info,initialsz);
|
||||
if(retval)
|
||||
BAIL(retval);
|
||||
} else if ((nc4_info->hdfid = H5Fcreate(path, flags, fcpl_id, fapl_id)) < 0)
|
||||
/*Change the return error from NC_EFILEMETADATA to
|
||||
System error EACCES because that is the more likely problem */
|
||||
BAIL(EACCES);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create the HDF5 file. */
|
||||
if ((hdf5_info->hdfid = H5Fcreate(path, flags, fcpl_id, fapl_id)) < 0)
|
||||
BAIL(EACCES);
|
||||
nc4_info->hdfid = hdf5_info->hdfid;
|
||||
}
|
||||
|
||||
/* Open the root group. */
|
||||
if ((nc4_info->root_grp->hdf_grpid = H5Gopen2(nc4_info->hdfid, "/",
|
||||
|
@ -480,10 +480,13 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
|
||||
}
|
||||
else
|
||||
{
|
||||
NC_HDF5_FILE_INFO_T *hdf5_info;
|
||||
hdf5_info = (NC_HDF5_FILE_INFO_T *)nc4_info->format_file_info;
|
||||
|
||||
/* Open the HDF5 file. */
|
||||
if ((nc4_info->hdfid = H5Fopen(path, flags, fapl_id)) < 0)
|
||||
if ((hdf5_info->hdfid = H5Fopen(path, flags, fapl_id)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
((NC_HDF5_FILE_INFO_T *)(nc4_info->format_file_info))->hdfid = nc4_info->hdfid;
|
||||
nc4_info->hdfid = hdf5_info->hdfid;
|
||||
}
|
||||
|
||||
/* Now read in all the metadata. Some types and dimscale
|
||||
|
Loading…
Reference in New Issue
Block a user