rename HDF5 dispatch functions to start with NC4_HDF5

This commit is contained in:
Ed Hartnett 2018-11-26 08:13:57 -07:00
parent aade08ee22
commit 1f64c66cdf
6 changed files with 17 additions and 35 deletions

View File

@ -18,6 +18,6 @@ ncbytes.h nchashmap.h ceconstraints.h rnd.h nclog.h ncconfigure.h \
nc4internal.h nctime.h nc3internal.h onstack.h ncrc.h ncauth.h \
ncoffsets.h nctestserver.h nc4dispatch.h nc3dispatch.h ncexternl.h \
ncwinpath.h ncfilter.h ncindex.h hdf4dispatch.h hdf5internal.h \
ncdap.h
ncdap.h hdf5dispatch.h
EXTRA_DIST = CMakeLists.txt XGetopt.h netcdf_meta.h.in

View File

@ -17,6 +17,7 @@
#include "nc4internal.h"
#include "ncdimscale.h"
#include "nc4dispatch.h"
#include "hdf5dispatch.h"
#define NC_MAX_HDF5_NAME (NC_MAX_NAME + 10)

View File

@ -97,22 +97,12 @@ extern "C" {
EXTERNL int
NC4_inq_attname(int ncid, int varid, int attnum, char *name);
EXTERNL int
NC4_rename_att(int ncid, int varid, const char *name, const char *newname);
EXTERNL int
NC4_del_att(int ncid, int varid, const char*);
/* End _att */
/* Begin {put,get}_att */
EXTERNL int
NC4_get_att(int ncid, int varid, const char *name, void *value, nc_type);
EXTERNL int
NC4_put_att(int ncid, int varid, const char *name, nc_type datatype,
size_t len, const void *value, nc_type);
/* End {put,get}_att */
/* Begin _var */

View File

@ -80,7 +80,7 @@ getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp,
* @author Ed Hartnett
*/
int
NC4_rename_att(int ncid, int varid, const char *name, const char *newname)
NC4_HDF5_rename_att(int ncid, int varid, const char *name, const char *newname)
{
NC *nc;
NC_GRP_INFO_T *grp;
@ -195,7 +195,7 @@ NC4_rename_att(int ncid, int varid, const char *name, const char *newname)
* @author Ed Hartnett, Dennis Heimbigner
*/
int
NC4_del_att(int ncid, int varid, const char *name)
NC4_HDF5_del_att(int ncid, int varid, const char *name)
{
NC_GRP_INFO_T *grp;
NC_VAR_INFO_T *var;
@ -355,7 +355,7 @@ nc4_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type,
ncid = nc->ext_ncid | grp->hdr.id;
/* Find att, if it exists. (Must check varid first or nc_test will
* break.) */
* break.) This also does lazy att reads if needed. */
if ((ret = getattlist(grp, varid, &var, &attlist)))
return ret;
@ -398,9 +398,6 @@ nc4_put_att(NC_GRP_INFO_T* grp, int varid, const char *name, nc_type file_type,
/* See if there is already an attribute with this name. */
att = (NC_ATT_INFO_T*)ncindexlookup(attlist,norm_name);
LOG((1, "%s: ncid 0x%x varid %d name %s file_type %d mem_type %d len %d",
__func__, ncid, varid, name, file_type, mem_type, len));
if (!att)
{
/* If this is a new att, require define mode. */
@ -674,10 +671,8 @@ exit:
}
/**
* @internal
* Write an attribute to a netCDF-4/HDF5 file, converting
* @internal Write an attribute to a netCDF-4/HDF5 file, converting
* data type if necessary.
* Wrapper around nc4_put_att
*
* @param ncid File and group ID.
* @param varid Variable ID.
@ -696,18 +691,17 @@ exit:
* @author Ed Hartnett, Dennis Heimbigner
*/
int
NC4_put_att(int ncid, int varid, const char *name, nc_type file_type,
size_t len, const void *data, nc_type mem_type)
NC4_HDF5_put_att(int ncid, int varid, const char *name, nc_type file_type,
size_t len, const void *data, nc_type mem_type)
{
int ret = NC_NOERR;
NC *nc;
NC_FILE_INFO_T *h5;
NC_GRP_INFO_T *grp;
int ret;
/* Find info for this file, group, and h5 info. */
if ((ret = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
if ((ret = nc4_find_nc_grp_h5(ncid, NULL, &grp, &h5)))
return ret;
assert(nc && grp && h5);
assert(grp && h5);
return nc4_put_att(grp,varid,name,file_type,len,data,mem_type,0);
return nc4_put_att(grp, varid, name, file_type, len, data, mem_type, 0);
}

View File

@ -9,10 +9,7 @@
*/
#include "config.h"
#include <stdlib.h>
#include "nc4internal.h"
#include "nc4dispatch.h"
#include "nc.h"
#include "hdf5internal.h"
static NC_Dispatch NC4_dispatcher = {
@ -44,10 +41,10 @@ NC4_rename_dim,
NC4_inq_att,
NC4_inq_attid,
NC4_inq_attname,
NC4_rename_att,
NC4_del_att,
NC4_HDF5_rename_att,
NC4_HDF5_del_att,
NC4_get_att,
NC4_put_att,
NC4_HDF5_put_att,
NC4_def_var,
NC4_inq_varid,

View File

@ -729,7 +729,7 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate,
var->hdr.name));
/* If there's a _FillValue attribute, delete it. */
retval = NC4_del_att(ncid, varid, _FillValue);
retval = NC4_HDF5_del_att(ncid, varid, _FillValue);
if (retval && retval != NC_ENOTATT)
return retval;