mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
more name normalization
This commit is contained in:
parent
77d0922d49
commit
d0587c9536
@ -696,6 +696,10 @@ nc4_hdf5_find_grp_var_att(int ncid, int varid, const char *name, int attnum,
|
|||||||
LOG((4, "%s: ncid %d varid %d attnum %d use_name %d", __func__, ncid, varid,
|
LOG((4, "%s: ncid %d varid %d attnum %d use_name %d", __func__, ncid, varid,
|
||||||
attnum, use_name));
|
attnum, use_name));
|
||||||
|
|
||||||
|
/* Don't need to provide name unless getting att pointer and using
|
||||||
|
* use_name. */
|
||||||
|
assert(!att || ((use_name && name) || !use_name));
|
||||||
|
|
||||||
/* Find info for this file, group, and h5 info. */
|
/* Find info for this file, group, and h5 info. */
|
||||||
if ((retval = nc4_find_nc_grp_h5(ncid, NULL, &my_grp, &my_h5)))
|
if ((retval = nc4_find_nc_grp_h5(ncid, NULL, &my_grp, &my_h5)))
|
||||||
return retval;
|
return retval;
|
||||||
@ -725,10 +729,15 @@ nc4_hdf5_find_grp_var_att(int ncid, int varid, const char *name, int attnum,
|
|||||||
}
|
}
|
||||||
assert(attlist);
|
assert(attlist);
|
||||||
|
|
||||||
|
/* Normalize the name. */
|
||||||
|
if (use_name && name)
|
||||||
|
if ((retval = nc4_normalize_name(name, my_norm_name)))
|
||||||
|
return retval;
|
||||||
|
|
||||||
/* Now find the attribute by name or number. */
|
/* Now find the attribute by name or number. */
|
||||||
if (att)
|
if (att)
|
||||||
{
|
{
|
||||||
my_att = use_name ? (NC_ATT_INFO_T *)ncindexlookup(attlist, name) :
|
my_att = use_name ? (NC_ATT_INFO_T *)ncindexlookup(attlist, my_norm_name) :
|
||||||
(NC_ATT_INFO_T *)ncindexith(attlist, attnum);
|
(NC_ATT_INFO_T *)ncindexith(attlist, attnum);
|
||||||
if (!my_att)
|
if (!my_att)
|
||||||
return NC_ENOTATT;
|
return NC_ENOTATT;
|
||||||
|
@ -2062,14 +2062,13 @@ NC4_HDF5_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
|
|||||||
NC_FILE_INFO_T *h5;
|
NC_FILE_INFO_T *h5;
|
||||||
NC_GRP_INFO_T *grp;
|
NC_GRP_INFO_T *grp;
|
||||||
NC_VAR_INFO_T *var = NULL;
|
NC_VAR_INFO_T *var = NULL;
|
||||||
char norm_name[NC_MAX_NAME + 1];
|
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
LOG((2, "%s: ncid 0x%x varid %d", __func__, ncid, varid));
|
LOG((2, "%s: ncid 0x%x varid %d", __func__, ncid, varid));
|
||||||
|
|
||||||
/* Find the file, group, and var info, and do lazy att read if
|
/* Find the file, group, and var info, and do lazy att read if
|
||||||
* needed. */
|
* needed. */
|
||||||
if ((retval = nc4_hdf5_find_grp_var_att(ncid, varid, name, 0, 1, norm_name,
|
if ((retval = nc4_hdf5_find_grp_var_att(ncid, varid, NULL, 0, 0, NULL,
|
||||||
&h5, &grp, &var, NULL)))
|
&h5, &grp, &var, NULL)))
|
||||||
return retval;
|
return retval;
|
||||||
assert(grp && h5);
|
assert(grp && h5);
|
||||||
|
Loading…
Reference in New Issue
Block a user