changed var atts_not_read to atts_read

This commit is contained in:
Ed Hartnett 2019-01-21 08:40:04 -07:00
parent 59ee728b93
commit 243cef8fa5
5 changed files with 10 additions and 6 deletions

View File

@ -153,7 +153,7 @@ typedef struct NC_VAR_INFO
nc_bool_t created; /* Variable has already been created (_not_ that it was just created) */
nc_bool_t written_to; /* True if variable has data written to it */
struct NC_TYPE_INFO *type_info;
int atts_not_read; /* If true, the atts have not yet been read. */
int atts_read; /* If true, the atts have been read. */
nc_bool_t meta_read; /* True if this vars metadata has been completely read. */
nc_bool_t coords_read; /* True if this var has hidden coordinates att, and it has been read. */
NCindex *att; /* NCindex<NC_ATT_INFO_T*> */

View File

@ -27,9 +27,10 @@ static int
getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp,
NCindex **attlist)
{
NC_VAR_INFO_T* var;
int retval;
assert(grp && attlist);
if (varid == NC_GLOBAL)
{
/* Do we need to read the atts? */
@ -43,12 +44,14 @@ getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp,
}
else
{
NC_VAR_INFO_T *var;
if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid)))
return NC_ENOTVAR;
assert(var->hdr.id == varid);
/* Do we need to read the atts? */
if (var->atts_not_read)
if (!var->atts_read)
if ((retval = nc4_read_atts(grp, var)))
return retval;

View File

@ -849,7 +849,7 @@ nc4_hdf5_find_grp_var_att(int ncid, int varid, const char *name, int attnum,
return NC_ENOTVAR;
/* Do we need to read the var attributes? */
if (my_var->atts_not_read)
if (!my_var->atts_read)
if ((retval = nc4_read_atts(my_grp, my_var)))
return retval;

View File

@ -1308,7 +1308,7 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
H5Iinc_ref(hdf5_var->hdf_datasetid); /* Increment number of objects using ID */
incr_id_rc++; /* Indicate that we've incremented the ref. count (for errors) */
var->created = NC_TRUE;
var->atts_not_read = 1; /* Don't read var atts until user asks for one. */
var->atts_read = 0;
/* Try and read the dimids from the COORDINATES attribute. If it's
* not present, we will have to do dimsscale matching to locate the
@ -2112,7 +2112,7 @@ nc4_read_atts(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
/* Remember that we have read the atts for this var or group. */
if (var)
var->atts_not_read = 0;
var->atts_read = 1;
else
grp->atts_not_read = 0;

View File

@ -410,6 +410,7 @@ NC4_def_var(int ncid, const char *name, nc_type xtype,
var->is_new_var = NC_TRUE;
var->meta_read = NC_TRUE;
var->atts_read = NC_TRUE;
/* Point to the type, and increment its ref. count */
var->type_info = type;