Fix a number of potential problems by changing calls to nc_XXX to NC3/4_XXX

This commit is contained in:
Dennis Heimbigner 2012-12-12 20:05:06 +00:00
parent fc91587e26
commit 5f2eb8afbf
9 changed files with 29 additions and 26 deletions

View File

@ -828,6 +828,7 @@ nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp,
EXTERNL int
nc_redef(int ncid);
/* Is this ever used? */
EXTERNL int
nc__enddef(int ncid, size_t h_minfree, size_t v_align,
size_t v_minfree, size_t r_align);

View File

@ -202,7 +202,7 @@ NC3_inq_unlimdims(int ncid, int *ndimsp, int *unlimdimidsp)
int retval;
int unlimid;
if ((retval = nc_inq_unlimdim(ncid, &unlimid)))
if ((retval = NC3_inq_unlimdim(ncid, &unlimid)))
return retval;
if (unlimid != -1) {
if(ndimsp) *ndimsp = 1;
@ -267,9 +267,9 @@ static int
NC3_inq_varids(int ncid, int *nvarsp, int *varids)
{
int retval,v,nvars;
/* If this is a netcdf-3 file, there is only one group, the root
/* This is a netcdf-3 file, there is only one group, the root
group, and its vars have ids 0 thru nvars - 1. */
if ((retval = nc_inq(ncid, NULL, &nvars, NULL, NULL)))
if ((retval = NC3_inq(ncid, NULL, &nvars, NULL, NULL)))
return retval;
if(nvarsp) *nvarsp = nvars;
if (varids)
@ -284,7 +284,7 @@ NC3_inq_dimids(int ncid, int *ndimsp, int *dimids, int include_parents)
int retval,d,ndims;
/* If this is a netcdf-3 file, then the dimids are going to be 0
thru ndims-1, so just provide them. */
if ((retval = nc_inq(ncid, &ndims, NULL, NULL, NULL)))
if ((retval = NC3_inq(ncid, &ndims, NULL, NULL, NULL)))
return retval;
if(ndimsp) *ndimsp = ndims;
if (dimids)

View File

@ -1097,7 +1097,7 @@ NC3_close(int ncid)
status = NC_endef(nc3, 0, 1, 0, 1); /* TODO: defaults */
if(status != NC_NOERR )
{
(void) nc_abort(ncid);
(void) NC3_abort(ncid);
return status;
}
}

View File

@ -12,6 +12,7 @@ $Id: nc4dim.c,v 1.41 2010/05/25 17:54:23 dmh Exp $
*/
#include "nc4internal.h"
#include "nc4dispatch.h"
#ifdef USE_PNETCDF
#include <pnetcdf.h>
@ -113,7 +114,7 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
/* If it's not in define mode, enter define mode. */
if (!(h5->flags & NC_INDEF))
if ((retval = nc_redef(ncid)))
if ((retval = NC4_redef(ncid)))
return retval;
/* Make sure this is a valid netcdf name. */
@ -328,7 +329,7 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
/* { */
/* if (h5->cmode & NC_CLASSIC_MODEL) */
/* return NC_ENOTINDEFINE; */
/* if ((retval = nc_redef(ncid))) */
/* if ((retval = NC4_redef(ncid))) */
/* return retval; */
/* } */

View File

@ -1245,8 +1245,7 @@ read_type(NC_GRP_INFO_T *grp, char *type_name)
if ((retval = nc4_enum_member_add(&type->enum_member, type->size,
member_name, value)))
return retval;
H5MM_xfree(member_name);
H5MM_xfree(member_name); /* Where is this defined? */
}
/* Free the tempory memory for one value, and the member name
@ -2900,7 +2899,7 @@ NC4_sync(int ncid)
{
if (nc4_info->cmode & NC_CLASSIC_MODEL)
return NC_EINDEFINE;
if ((retval = nc_enddef(ncid)))
if ((retval = NC4_enddef(ncid)))
return retval;
}

View File

@ -178,7 +178,7 @@ NC4_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
int i, ret = NC_NOERR;
/* How many generations? */
for (g = 0; !nc_inq_grp_parent(id, &parent_id); g++, id = parent_id)
for (g = 0; !NC4_inq_grp_parent(id, &parent_id); g++, id = parent_id)
;
/* Allocate storage. */
@ -197,12 +197,12 @@ NC4_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
/* Get the ncids for all generations. */
gid[0] = ncid;
for (i = 1; i < g && !ret; i++)
ret = nc_inq_grp_parent(gid[i - 1], &gid[i]);
ret = NC4_inq_grp_parent(gid[i - 1], &gid[i]);
/* Assemble the full name. */
for (i = g - 1; !ret && i >= 0 && !ret; i--)
{
if ((ret = nc_inq_grpname(gid[i], grp_name)))
if ((ret = NC4_inq_grpname(gid[i], grp_name)))
break;
strcat(name, grp_name);
if (i)
@ -297,7 +297,7 @@ NC4_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
/* Keep parsing the string. */
for (; cp; id1 = id2)
{
if ((ret = nc_inq_grp_ncid(id1, cp, &id2)))
if ((ret = NC4_inq_ncid(id1, cp, &id2)))
{
free(full_name_cpy);
return ret;
@ -335,7 +335,7 @@ NC4_inq_varids(int ncid, int *nvars, int *varids)
{
/* If this is a netcdf-3 file, there is only one group, the root
* group, and its vars have ids 0 thru nvars - 1. */
if ((retval = nc_inq(ncid, NULL, &num_vars, NULL, NULL)))
if ((retval = NC4_inq(ncid, NULL, &num_vars, NULL, NULL)))
return retval;
if (varids)
for (v = 0; v < num_vars; v++)
@ -396,7 +396,7 @@ NC4_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents)
{
/* If this is a netcdf-3 file, then the dimids are going to be 0
* thru ndims-1, so just provide them. */
if ((retval = nc_inq(ncid, &num, NULL, NULL, NULL)))
if ((retval = NC4_inq(ncid, &num, NULL, NULL, NULL)))
return retval;
if (dimids)
for (d = 0; d < num; d++)

View File

@ -15,6 +15,7 @@
#include "config.h"
#include "nc4internal.h"
#include "nc4dispatch.h"
#include <H5DSpublic.h>
#include <math.h>
@ -924,7 +925,7 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
/* We can't go beyond the latgest current extent of
the unlimited dim. */
if ((retval = nc_inq_dimlen(ncid, dim->dimid, &ulen)))
if ((retval = NC4_inq_dim(ncid, dim->dimid, NULL, &ulen)))
BAIL(retval);
/* Check for out of bound requests. */
@ -2561,7 +2562,7 @@ pg_var(NC_PG_T pg, NC *nc, int ncid, int varid, nc_type xtype,
for (i = 0; i < var->ndims; i++)
{
start[i] = 0;
if ((retval = nc_inq_dimlen(ncid, var->dimids[i], &(count[i]))))
if ((retval = NC4_inq_dim(ncid, var->dimids[i], NULL, &(count[i]))))
return retval;
}
@ -2662,7 +2663,7 @@ nc4_pg_varm(NC_PG_T pg, NC *nc, int ncid, int varid, const size_t *start,
{
if (h5->cmode & NC_CLASSIC_MODEL)
return NC_EINDEFINE;
if ((retval = nc_enddef(ncid)))
if ((retval = NC4__enddef(ncid,0,0,0,0)))
BAIL(retval);
}
@ -2748,7 +2749,7 @@ nc4_pg_varm(NC_PG_T pg, NC *nc, int ncid, int varid, const size_t *start,
else
{
size_t len;
if ((retval = nc_inq_dimlen(ncid, var->dimids[idim], &len)))
if ((retval = NC4_inq_dim(ncid, var->dimids[idim], NULL, &len)))
goto done;
myedges[idim] = len - mystart[idim];
}
@ -2773,13 +2774,13 @@ nc4_pg_varm(NC_PG_T pg, NC *nc, int ncid, int varid, const size_t *start,
for (idim = maxidim; idim >= 0; --idim)
{
size_t dimlen;
if ((retval = nc_inq_dimlen(ncid, var->dimids[idim], &dimlen)))
if ((retval = NC4_inq_dim(ncid, var->dimids[idim], NULL, &dimlen)))
goto done;
/* Don't check unlimited dimension on PUTs. */
if (pg == PUT)
{
int stop = 0, d, num_unlim_dim, unlim_dimids[NC_MAX_DIMS];
if ((retval = nc_inq_unlimdims(ncid, &num_unlim_dim, unlim_dimids)))
if ((retval = NC4_inq_unlimdims(ncid, &num_unlim_dim, unlim_dimids)))
goto done;
for (d = 0; d < num_unlim_dim; d++)
if (var->dimids[idim] == unlim_dimids[d])

View File

@ -13,6 +13,7 @@ $Id: nc4type.c,v 1.73 2010/05/25 17:54:24 dmh Exp $
*/
#include "nc4internal.h"
#include "nc4dispatch.h"
#define NUM_ATOMIC_TYPES 13
char atomic_name[NUM_ATOMIC_TYPES][NC_MAX_NAME + 1] = {"none", "byte", "char",
@ -206,7 +207,7 @@ add_user_type(int ncid, size_t size, const char *name, nc_type base_typeid,
/* Turn on define mode if it is not on. */
if (!(h5->cmode & NC_INDEF))
if ((retval = nc_redef(ncid)))
if ((retval = NC4_redef(ncid)))
return retval;
/* No size is provided for vlens or enums, get it from the base type. */

View File

@ -137,7 +137,7 @@ nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems,
if (preemption >= 0)
real_preemption = preemption / 100.;
return nc_set_var_chunk_cache(ncid, varid, real_size, real_nelems,
return NC4_set_var_chunk_cache(ncid, varid, real_size, real_nelems,
real_preemption);
}
@ -190,7 +190,7 @@ nc_get_var_chunk_cache_ints(int ncid, int varid, int *sizep,
float real_preemption;
int ret;
if ((ret = nc_get_var_chunk_cache(ncid, varid, &real_size,
if ((ret = NC4_get_var_chunk_cache(ncid, varid, &real_size,
&real_nelems, &real_preemption)))
return ret;
@ -915,7 +915,7 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate,
memcpy(var->fill_value, fill_value, type_size);
/* If there's a _FillValue attribute, delete it. */
retval = nc_del_att(ncid, varid, _FillValue);
retval = NC4_del_att(ncid, varid, _FillValue);
if (retval && retval != NC_ENOTATT)
return retval;