rest of separation of libhdf5 and libsrc4

This commit is contained in:
Ed Hartnett 2018-11-30 14:05:11 -07:00
parent b5ed407e9f
commit f6443bce8f
3 changed files with 32 additions and 11 deletions

View File

@ -809,6 +809,15 @@ NC4_HDF5_inq_att(int ncid, int varid, const char *name, nc_type *xtypep,
&h5, &grp, &var, NULL)))
return retval;
/* If this is one of the reserved atts, use nc_get_att_special. */
if (!var)
{
const NC_reservedatt *ra = NC_findreserved(norm_name);
if (ra && ra->flags & NAMEONLYFLAG)
return nc4_get_att_special(h5, norm_name, xtypep, NC_NAT, lenp, NULL,
NULL);
}
return nc4_get_att_ptrs(h5, grp, var, norm_name, xtypep, NC_NAT,
lenp, NULL, NULL);
}
@ -841,6 +850,15 @@ NC4_HDF5_inq_attid(int ncid, int varid, const char *name, int *attnump)
&h5, &grp, &var, NULL)))
return retval;
/* If this is one of the reserved atts, use nc_get_att_special. */
if (!var)
{
const NC_reservedatt *ra = NC_findreserved(norm_name);
if (ra && ra->flags & NAMEONLYFLAG)
return nc4_get_att_special(h5, norm_name, NULL, NC_NAT, NULL, attnump,
NULL);
}
return nc4_get_att_ptrs(h5, grp, var, norm_name, NULL, NC_NAT,
NULL, attnump, NULL);
}
@ -886,14 +904,16 @@ NC4_HDF5_inq_attname(int ncid, int varid, int attnum, char *name)
* @param varid Variable ID.
* @param name Name of attribute.
* @param value Pointer that gets attribute data.
* @param memtype The type the data should be converted to as it is read.
* @param memtype The type the data should be converted to as it is
* read.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Ed Hartnett
*/
int
NC4_HDF5_get_att(int ncid, int varid, const char *name, void *value, nc_type memtype)
NC4_HDF5_get_att(int ncid, int varid, const char *name, void *value,
nc_type memtype)
{
NC_FILE_INFO_T *h5;
NC_GRP_INFO_T *grp;
@ -909,6 +929,15 @@ NC4_HDF5_get_att(int ncid, int varid, const char *name, void *value, nc_type mem
&h5, &grp, &var, NULL)))
return retval;
/* If this is one of the reserved atts, use nc_get_att_special. */
if (!var)
{
const NC_reservedatt *ra = NC_findreserved(norm_name);
if (ra && ra->flags & NAMEONLYFLAG)
return nc4_get_att_special(h5, norm_name, NULL, NC_NAT, NULL, NULL,
value);
}
return nc4_get_att_ptrs(h5, grp, var, norm_name, NULL, memtype,
NULL, NULL, value);
}

View File

@ -91,10 +91,10 @@ nc_initialize()
#endif
#ifdef USE_NETCDF4
if((stat = NC4_initialize())) goto done;
stat = NC4_provenance_init();
#endif /* USE_NETCDF4 */
#ifdef USE_HDF5
if((stat = NC_HDF5_initialize())) goto done;
stat = NC4_provenance_init();
#endif
#ifdef USE_HDF4
if((stat = NC_HDF4_initialize())) goto done;

View File

@ -68,14 +68,6 @@ nc4_get_att_ptrs(NC_FILE_INFO_T *h5, NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var,
if (name == NULL)
BAIL(NC_EBADNAME);
/* If this is one of the reserved atts, use nc_get_att_special. */
if (!var)
{
const NC_reservedatt* ra = NC_findreserved(name);
if(ra != NULL && (ra->flags & NAMEONLYFLAG))
return nc4_get_att_special(h5, name, xtype, mem_type, lenp, attnum, data);
}
/* Find the attribute, if it exists. */
if ((retval = nc4_find_grp_att(grp, varid, name, my_attnum, &att)))
return retval;