mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
use ncx_get_uint32 instead of ncx_get_int_int
This commit is contained in:
parent
f6804fc5c0
commit
1f32277afb
@ -150,10 +150,12 @@ v1h_put_size_t(v1hs *psp, const size_t *sp)
|
|||||||
status = check_v1hs(psp, X_SIZEOF_INT64);
|
status = check_v1hs(psp, X_SIZEOF_INT64);
|
||||||
else
|
else
|
||||||
status = check_v1hs(psp, X_SIZEOF_SIZE_T);
|
status = check_v1hs(psp, X_SIZEOF_SIZE_T);
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR)
|
||||||
return status;
|
return status;
|
||||||
if (psp->version == 5)
|
if (psp->version == 5) {
|
||||||
return ncx_put_int64(&psp->pos, *sp);
|
unsigned long long tmp = (unsigned long long) (*sp);
|
||||||
|
return ncx_put_uint64(&psp->pos, tmp);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return ncx_put_size_t(&psp->pos, sp);
|
return ncx_put_size_t(&psp->pos, sp);
|
||||||
}
|
}
|
||||||
@ -167,11 +169,11 @@ v1h_get_size_t(v1hs *gsp, size_t *sp)
|
|||||||
status = check_v1hs(gsp, X_SIZEOF_INT64);
|
status = check_v1hs(gsp, X_SIZEOF_INT64);
|
||||||
else
|
else
|
||||||
status = check_v1hs(gsp, X_SIZEOF_SIZE_T);
|
status = check_v1hs(gsp, X_SIZEOF_SIZE_T);
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR)
|
||||||
return status;
|
return status;
|
||||||
if (gsp->version == 5) {
|
if (gsp->version == 5) {
|
||||||
long long tmp=0;
|
unsigned long long tmp=0;
|
||||||
status = ncx_get_int64((const void **)(&gsp->pos), &tmp);
|
status = ncx_get_uint64((const void **)(&gsp->pos), &tmp);
|
||||||
*sp = (size_t)tmp;
|
*sp = (size_t)tmp;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -187,18 +189,10 @@ v1h_get_size_t(v1hs *gsp, size_t *sp)
|
|||||||
static int
|
static int
|
||||||
v1h_put_nc_type(v1hs *psp, const nc_type *typep)
|
v1h_put_nc_type(v1hs *psp, const nc_type *typep)
|
||||||
{
|
{
|
||||||
const int itype = (int) *typep;
|
const unsigned int itype = (unsigned int) *typep;
|
||||||
int status = check_v1hs(psp, X_SIZEOF_INT);
|
int status = check_v1hs(psp, X_SIZEOF_INT);
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR) return status;
|
||||||
return status;
|
status = ncx_put_uint32(&psp->pos, itype);
|
||||||
status = ncx_put_int_int(psp->pos, &itype);
|
|
||||||
|
|
||||||
#ifdef __arm__
|
|
||||||
psp->pos = (void *)((signed char *)psp->pos + X_SIZEOF_INT);
|
|
||||||
#else
|
|
||||||
psp->pos = (void *)((char *)psp->pos + X_SIZEOF_INT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,16 +201,10 @@ v1h_put_nc_type(v1hs *psp, const nc_type *typep)
|
|||||||
static int
|
static int
|
||||||
v1h_get_nc_type(v1hs *gsp, nc_type *typep)
|
v1h_get_nc_type(v1hs *gsp, nc_type *typep)
|
||||||
{
|
{
|
||||||
int type = 0;
|
unsigned int type = 0;
|
||||||
int status = check_v1hs(gsp, X_SIZEOF_INT);
|
int status = check_v1hs(gsp, X_SIZEOF_INT);
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR) return status;
|
||||||
return status;
|
status = ncx_get_uint32((const void**)(&gsp->pos), &type);
|
||||||
status = ncx_get_int_int(gsp->pos, &type);
|
|
||||||
#ifdef __arm__
|
|
||||||
gsp->pos = (void *)((signed char *)gsp->pos + X_SIZEOF_INT);
|
|
||||||
#else
|
|
||||||
gsp->pos = (void *)((char *)gsp->pos + X_SIZEOF_INT);
|
|
||||||
#endif
|
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@ -248,16 +236,10 @@ v1h_get_nc_type(v1hs *gsp, nc_type *typep)
|
|||||||
static int
|
static int
|
||||||
v1h_put_NCtype(v1hs *psp, NCtype type)
|
v1h_put_NCtype(v1hs *psp, NCtype type)
|
||||||
{
|
{
|
||||||
const int itype = (int) type;
|
const unsigned int itype = (unsigned int) type;
|
||||||
int status = check_v1hs(psp, X_SIZEOF_INT);
|
int status = check_v1hs(psp, X_SIZEOF_INT);
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR) return status;
|
||||||
return status;
|
status = ncx_put_uint32(&psp->pos, itype);
|
||||||
status = ncx_put_int_int(psp->pos, &itype);
|
|
||||||
#ifdef __arm__
|
|
||||||
psp->pos = (void *)((signed char *)psp->pos + X_SIZEOF_INT);
|
|
||||||
#else
|
|
||||||
psp->pos = (void *)((char *)psp->pos + X_SIZEOF_INT);
|
|
||||||
#endif
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,21 +247,13 @@ v1h_put_NCtype(v1hs *psp, NCtype type)
|
|||||||
static int
|
static int
|
||||||
v1h_get_NCtype(v1hs *gsp, NCtype *typep)
|
v1h_get_NCtype(v1hs *gsp, NCtype *typep)
|
||||||
{
|
{
|
||||||
int type = 0;
|
unsigned int type = 0;
|
||||||
int status = check_v1hs(gsp, X_SIZEOF_INT);
|
int status = check_v1hs(gsp, X_SIZEOF_INT);
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR) return status;
|
||||||
return status;
|
status = ncx_get_uint32((const void**)(&gsp->pos), &type);
|
||||||
status = ncx_get_int_int(gsp->pos, &type);
|
if(status != NC_NOERR) return status;
|
||||||
|
/* else */
|
||||||
#ifdef __arm__
|
*typep = (NCtype) type;
|
||||||
gsp->pos = (void *)((signed char *)gsp->pos + X_SIZEOF_INT);
|
|
||||||
#else
|
|
||||||
gsp->pos = (void *)((char *)gsp->pos + X_SIZEOF_INT);
|
|
||||||
#endif
|
|
||||||
if(status != NC_NOERR)
|
|
||||||
return status;
|
|
||||||
/* else */
|
|
||||||
*typep = (NCtype) type;
|
|
||||||
return NC_NOERR;
|
return NC_NOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1350,16 +1324,18 @@ ncx_put_NC(const NC3_INFO* ncp, void **xpp, off_t offset, size_t extent)
|
|||||||
status = ncx_putn_schar_schar(&ps.pos, sizeof(ncmagic), ncmagic);
|
status = ncx_putn_schar_schar(&ps.pos, sizeof(ncmagic), ncmagic);
|
||||||
else
|
else
|
||||||
status = ncx_putn_schar_schar(&ps.pos, sizeof(ncmagic1), ncmagic1);
|
status = ncx_putn_schar_schar(&ps.pos, sizeof(ncmagic1), ncmagic1);
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR)
|
||||||
goto release;
|
goto release;
|
||||||
|
|
||||||
{
|
{
|
||||||
const size_t nrecs = NC_get_numrecs(ncp);
|
const size_t nrecs = NC_get_numrecs(ncp);
|
||||||
if (ps.version == 5)
|
if (ps.version == 5) {
|
||||||
status = ncx_put_int64(&ps.pos, nrecs);
|
unsigned long long tmp = (unsigned long long) nrecs;
|
||||||
|
status = ncx_put_uint64(&ps.pos, tmp);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
status = ncx_put_size_t(&ps.pos, &nrecs);
|
status = ncx_put_size_t(&ps.pos, &nrecs);
|
||||||
if(status != NC_NOERR)
|
if(status != NC_NOERR)
|
||||||
goto release;
|
goto release;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1486,8 +1462,8 @@ nc_get_NC(NC3_INFO* ncp)
|
|||||||
{
|
{
|
||||||
size_t nrecs = 0;
|
size_t nrecs = 0;
|
||||||
if (gs.version == 5) {
|
if (gs.version == 5) {
|
||||||
long long tmp = 0;
|
unsigned long long tmp = 0;
|
||||||
status = ncx_get_int64((const void **)(&gs.pos), &tmp);
|
status = ncx_get_uint64((const void **)(&gs.pos), &tmp);
|
||||||
nrecs = (size_t)tmp;
|
nrecs = (size_t)tmp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user