mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
allocating HDF5-specific group info struct for root group
This commit is contained in:
parent
9364157a9b
commit
6b75bb483b
@ -71,6 +71,10 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
|
||||
BAIL(NC_ENOMEM);
|
||||
hdf5_info = (NC_HDF5_FILE_INFO_T *)nc4_info->format_file_info;
|
||||
|
||||
/* Add struct to hold HDF5-specific group info. */
|
||||
if (!(nc4_info->root_grp->format_grp_info = calloc(1, sizeof(NC_HDF5_GRP_INFO_T))))
|
||||
return NC_ENOMEM;
|
||||
|
||||
nc4_info->mem.inmemory = (cmode & NC_INMEMORY) == NC_INMEMORY;
|
||||
nc4_info->mem.diskless = (cmode & NC_DISKLESS) == NC_DISKLESS;
|
||||
nc4_info->mem.persist = (cmode & NC_PERSIST) == NC_PERSIST;
|
||||
|
@ -388,6 +388,10 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
|
||||
if (!(nc4_info->format_file_info = calloc(1, sizeof(NC_HDF5_FILE_INFO_T))))
|
||||
BAIL(NC_ENOMEM);
|
||||
|
||||
/* Add struct to hold HDF5-specific group info. */
|
||||
if (!(nc4_info->root_grp->format_grp_info = calloc(1, sizeof(NC_HDF5_GRP_INFO_T))))
|
||||
return NC_ENOMEM;
|
||||
|
||||
nc4_info->mem.inmemory = ((mode & NC_INMEMORY) == NC_INMEMORY);
|
||||
nc4_info->mem.diskless = ((mode & NC_DISKLESS) == NC_DISKLESS);
|
||||
nc4_info->mem.persist = ((mode & NC_PERSIST) == NC_PERSIST);
|
||||
|
@ -1324,7 +1324,8 @@ create_group(NC_GRP_INFO_T *grp)
|
||||
hid_t gcpl_id = -1;
|
||||
int retval = NC_NOERR;;
|
||||
|
||||
assert(grp && grp->parent && grp->parent->hdf_grpid);
|
||||
assert(grp && grp->format_grp_info && grp->parent &&
|
||||
grp->parent->format_grp_info && grp->parent->hdf_grpid);
|
||||
|
||||
/* Create group, with link_creation_order set in the group
|
||||
* creation property list. */
|
||||
|
@ -92,12 +92,14 @@ nc4_check_name(const char *name, char *norm_name)
|
||||
* @param mode The mode flag.
|
||||
*
|
||||
* @return ::NC_NOERR No error.
|
||||
* @return ::NC_ENOMEM Out of memory.
|
||||
* @author Ed Hartnett, Dennis Heimbigner
|
||||
*/
|
||||
int
|
||||
nc4_nc4f_list_add(NC *nc, const char *path, int mode)
|
||||
{
|
||||
NC_FILE_INFO_T *h5;
|
||||
int retval;
|
||||
|
||||
assert(nc && !NC4_DATA(nc) && path);
|
||||
|
||||
@ -123,7 +125,10 @@ nc4_nc4f_list_add(NC *nc, const char *path, int mode)
|
||||
/* There's always at least one open group - the root
|
||||
* group. Allocate space for one group's worth of information. Set
|
||||
* its hdf id, name, and a pointer to it's file structure. */
|
||||
return nc4_grp_list_add(h5, NULL, NC_GROUP_NAME, &h5->root_grp);
|
||||
if ((retval = nc4_grp_list_add(h5, NULL, NC_GROUP_NAME, &h5->root_grp)))
|
||||
return retval;
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user