mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
changed NC_GRP_INFO_T to use atts_read instead of atts_not_read
This commit is contained in:
parent
243cef8fa5
commit
840d51d035
@ -229,7 +229,7 @@ typedef struct NC_GRP_INFO
|
|||||||
void *format_grp_info;
|
void *format_grp_info;
|
||||||
struct NC_FILE_INFO *nc4_info;
|
struct NC_FILE_INFO *nc4_info;
|
||||||
struct NC_GRP_INFO *parent;
|
struct NC_GRP_INFO *parent;
|
||||||
int atts_not_read;
|
int atts_read; /* True if atts have been read for this group. */
|
||||||
NCindex* children; /* NCindex<struct NC_GRP_INFO*> */
|
NCindex* children; /* NCindex<struct NC_GRP_INFO*> */
|
||||||
NCindex* dim; /* NCindex<NC_DIM_INFO_T> * */
|
NCindex* dim; /* NCindex<NC_DIM_INFO_T> * */
|
||||||
NCindex* att; /* NCindex<NC_ATT_INFO_T> * */
|
NCindex* att; /* NCindex<NC_ATT_INFO_T> * */
|
||||||
|
@ -34,7 +34,7 @@ getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp,
|
|||||||
if (varid == NC_GLOBAL)
|
if (varid == NC_GLOBAL)
|
||||||
{
|
{
|
||||||
/* Do we need to read the atts? */
|
/* Do we need to read the atts? */
|
||||||
if (grp->atts_not_read)
|
if (!grp->atts_read)
|
||||||
if ((retval = nc4_read_atts(grp, NULL)))
|
if ((retval = nc4_read_atts(grp, NULL)))
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ nc4_create_file(const char *path, int cmode, size_t initialsz,
|
|||||||
BAIL(retval);
|
BAIL(retval);
|
||||||
nc4_info = NC4_DATA(nc);
|
nc4_info = NC4_DATA(nc);
|
||||||
assert(nc4_info && nc4_info->root_grp);
|
assert(nc4_info && nc4_info->root_grp);
|
||||||
|
nc4_info->root_grp->atts_read = 1;
|
||||||
|
|
||||||
/* Add struct to hold HDF5-specific file metadata. */
|
/* Add struct to hold HDF5-specific file metadata. */
|
||||||
if (!(nc4_info->format_file_info = calloc(1, sizeof(NC_HDF5_FILE_INFO_T))))
|
if (!(nc4_info->format_file_info = calloc(1, sizeof(NC_HDF5_FILE_INFO_T))))
|
||||||
|
@ -727,7 +727,7 @@ NC4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
|
|||||||
if (nattsp)
|
if (nattsp)
|
||||||
{
|
{
|
||||||
/* Do we need to read the atts? */
|
/* Do we need to read the atts? */
|
||||||
if (grp->atts_not_read)
|
if (!grp->atts_read)
|
||||||
if ((retval = nc4_read_atts(grp, NULL)))
|
if ((retval = nc4_read_atts(grp, NULL)))
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
@ -67,6 +67,11 @@ NC4_def_grp(int parent_ncid, const char *name, int *new_ncid)
|
|||||||
return retval;
|
return retval;
|
||||||
if (!(g->format_grp_info = calloc(1, sizeof(NC_HDF5_GRP_INFO_T))))
|
if (!(g->format_grp_info = calloc(1, sizeof(NC_HDF5_GRP_INFO_T))))
|
||||||
return NC_ENOMEM;
|
return NC_ENOMEM;
|
||||||
|
|
||||||
|
/* For new groups, there are no atts to read from file. */
|
||||||
|
g->atts_read = 1;
|
||||||
|
|
||||||
|
/* Return the ncid to the user. */
|
||||||
if (new_ncid)
|
if (new_ncid)
|
||||||
*new_ncid = grp->nc4_info->controller->ext_ncid | g->hdr.id;
|
*new_ncid = grp->nc4_info->controller->ext_ncid | g->hdr.id;
|
||||||
|
|
||||||
|
@ -837,7 +837,7 @@ nc4_hdf5_find_grp_var_att(int ncid, int varid, const char *name, int attnum,
|
|||||||
if (varid == NC_GLOBAL)
|
if (varid == NC_GLOBAL)
|
||||||
{
|
{
|
||||||
/* Do we need to read the atts? */
|
/* Do we need to read the atts? */
|
||||||
if (my_grp->atts_not_read)
|
if (!my_grp->atts_read)
|
||||||
if ((retval = nc4_read_atts(my_grp, NULL)))
|
if ((retval = nc4_read_atts(my_grp, NULL)))
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
@ -2114,7 +2114,7 @@ nc4_read_atts(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
|||||||
if (var)
|
if (var)
|
||||||
var->atts_read = 1;
|
var->atts_read = 1;
|
||||||
else
|
else
|
||||||
grp->atts_not_read = 0;
|
grp->atts_read = 1;
|
||||||
|
|
||||||
return NC_NOERR;
|
return NC_NOERR;
|
||||||
}
|
}
|
||||||
@ -2569,9 +2569,6 @@ rec_read_metadata(NC_GRP_INFO_T *grp)
|
|||||||
BAIL(retval);
|
BAIL(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Defer the reading of global atts until someone asks for one. */
|
|
||||||
grp->atts_not_read = 1;
|
|
||||||
|
|
||||||
/* When reading existing file, mark all variables as written. */
|
/* When reading existing file, mark all variables as written. */
|
||||||
for (i = 0; i < ncindexsize(grp->vars); i++)
|
for (i = 0; i < ncindexsize(grp->vars); i++)
|
||||||
((NC_VAR_INFO_T *)ncindexith(grp->vars, i))->written_to = NC_TRUE;
|
((NC_VAR_INFO_T *)ncindexith(grp->vars, i))->written_to = NC_TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user