mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
Merge branch 'patch-4' of https://github.com/gsjaardema/netcdf-c into gh290
This commit is contained in:
commit
f4ac2f827d
@ -1957,24 +1957,14 @@ write_nc3_strict_att(hid_t hdf_grpid)
|
||||
int one = 1, num, a;
|
||||
char att_name[NC_MAX_HDF5_NAME + 1];
|
||||
int retval = NC_NOERR;
|
||||
htri_t attr_exists;
|
||||
|
||||
/* If the attribute already exists, call that a success and return
|
||||
* NC_NOERR. */
|
||||
if ((num = H5Aget_num_attrs(hdf_grpid)) < 0)
|
||||
if ((attr_exists = H5Aexists(hdf_grpid, NC3_STRICT_ATT_NAME)) < 0)
|
||||
return NC_EHDFERR;
|
||||
for (a = 0; a < num; a++)
|
||||
{
|
||||
if ((attid = H5Aopen_idx(hdf_grpid, (unsigned int)a)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
if (H5Aget_name(attid, NC_MAX_HDF5_NAME, att_name) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
if (H5Aclose(attid) < 0)
|
||||
return NC_EFILEMETA;
|
||||
if (strcmp(att_name, NC3_STRICT_ATT_NAME)==0)
|
||||
{
|
||||
if (attr_exists)
|
||||
return NC_NOERR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the attribute to mark this as a file that needs to obey
|
||||
* strict netcdf-3 rules. */
|
||||
|
Loading…
Reference in New Issue
Block a user