removed name param from function give_var_secret_name()

This commit is contained in:
Ed Hartnett 2019-01-27 11:07:57 -07:00
parent 627a55cf78
commit c95887cc53

View File

@ -227,7 +227,6 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
* HDF5 file.
*
* @param var Pointer to var info.
* @param name Non-secret name. Should already be UTF8 normalized.
*
* @returns ::NC_NOERR No error.
* @returns ::NC_EMAXNAME Name too long to fit secret prefix.
@ -235,17 +234,17 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
* @author Ed Hartnett
*/
static int
give_var_secret_name(NC_VAR_INFO_T *var, const char *name)
give_var_secret_name(NC_VAR_INFO_T *var)
{
/* Set a different hdf5 name for this variable to avoid name
* clash. */
if (strlen(name) + strlen(NON_COORD_PREPEND) > NC_MAX_NAME)
if (strlen(var->hdr.name) + strlen(NON_COORD_PREPEND) > NC_MAX_NAME)
return NC_EMAXNAME;
if (!(var->hdf5_name = malloc((strlen(NON_COORD_PREPEND) +
strlen(name) + 1) * sizeof(char))))
strlen(var->hdr.name) + 1) * sizeof(char))))
return NC_ENOMEM;
sprintf(var->hdf5_name, "%s%s", NON_COORD_PREPEND, name);
sprintf(var->hdf5_name, "%s%s", NON_COORD_PREPEND, var->hdr.name);
return NC_NOERR;
}
@ -532,7 +531,7 @@ NC4_def_var(int ncid, const char *name, nc_type xtype,
* and this var has the same name. */
dim = (NC_DIM_INFO_T*)ncindexlookup(grp->dim,norm_name);
if (dim && (!var->ndims || dimidsp[0] != dim->hdr.id))
if ((retval = give_var_secret_name(var, norm_name)))
if ((retval = give_var_secret_name(var)))
BAIL(retval);
/* If this is a coordinate var, it is marked as a HDF5 dimension