mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
correct error code for operation not allowed in data mode is NC_ENOTINDEFINE
This commit is contained in:
parent
c59f43d604
commit
116f303182
@ -403,7 +403,7 @@ NC4_put_att(int ncid, int varid, const char *name, nc_type file_type,
|
||||
if (!(h5->flags & NC_INDEF))
|
||||
{
|
||||
if (h5->cmode & NC_CLASSIC_MODEL)
|
||||
return NC_EINDEFINE;
|
||||
return NC_ENOTINDEFINE;
|
||||
if ((retval = NC4_redef(ncid)))
|
||||
BAIL(retval);
|
||||
}
|
||||
@ -417,7 +417,7 @@ NC4_put_att(int ncid, int varid, const char *name, nc_type file_type,
|
||||
len * nc4typelen(file_type) > (size_t)att->len * nc4typelen(att->nc_typeid))
|
||||
{
|
||||
if (h5->cmode & NC_CLASSIC_MODEL)
|
||||
return NC_EINDEFINE;
|
||||
return NC_ENOTINDEFINE;
|
||||
if ((retval = NC4_redef(ncid)))
|
||||
BAIL(retval);
|
||||
}
|
||||
|
@ -178,12 +178,12 @@ main(int argc, char **argv)
|
||||
|
||||
/* Try and write a new att. Won't work. */
|
||||
if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME_2, strlen(CONTENTS_2),
|
||||
CONTENTS_2) != NC_EINDEFINE) ERR;
|
||||
CONTENTS_2) != NC_ENOTINDEFINE) ERR;
|
||||
|
||||
/* This will not work. Overwriting att must be same length or
|
||||
* shorter if not in define mode. */
|
||||
if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS_2),
|
||||
CONTENTS_2) != NC_EINDEFINE) ERR;
|
||||
CONTENTS_2) != NC_ENOTINDEFINE) ERR;
|
||||
|
||||
/* Now overwrite the att. */
|
||||
if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS_3),
|
||||
|
Loading…
Reference in New Issue
Block a user