mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
now always relax!
This commit is contained in:
parent
d516652c05
commit
5ab7bf7796
@ -221,11 +221,7 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
|
||||
#endif
|
||||
else {
|
||||
/* mystart is unsigned, will never be < 0 */
|
||||
#ifdef RELAX_COORD_BOUND
|
||||
if (mystart[i] > dimlen) return NC_EINVALCOORDS;
|
||||
#else
|
||||
if (mystart[i] >= dimlen) return NC_EINVALCOORDS;
|
||||
#endif
|
||||
}
|
||||
if(edges == NULL) {
|
||||
#if 0
|
||||
@ -239,12 +235,12 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
|
||||
myedges[i] = varshape[i] - mystart[i];
|
||||
} else
|
||||
myedges[i] = edges[i];
|
||||
#ifdef RELAX_COORD_BOUND
|
||||
|
||||
if(!is_recdim[i]) {
|
||||
if (mystart[i] == dimlen && myedges[i] > 0)
|
||||
return NC_EINVALCOORDS;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!is_recdim[i]) {
|
||||
/* myediges is unsigned, will never be < 0 */
|
||||
if(mystart[i] + myedges[i] > dimlen)
|
||||
@ -434,12 +430,8 @@ NCDEFAULT_put_varm(
|
||||
|
||||
for (idim = isrecvar; idim <= maxidim; ++idim)
|
||||
{
|
||||
#ifdef RELAX_COORD_BOUND
|
||||
if (mystart[idim] > varshape[idim] ||
|
||||
(mystart[idim] == varshape[idim] && myedges[idim] > 0))
|
||||
#else
|
||||
if (mystart[idim] >= varshape[idim])
|
||||
#endif
|
||||
{
|
||||
status = NC_EINVALCOORDS;
|
||||
goto done;
|
||||
|
@ -1586,19 +1586,12 @@ NC4_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
|
||||
endindex = start[d2]; /* fixup for zero read count */
|
||||
if (!dim->unlimited)
|
||||
{
|
||||
#ifdef RELAX_COORD_BOUND
|
||||
/* Allow start to equal dim size if count is zero. */
|
||||
if (start[d2] > (hssize_t)fdims[d2] ||
|
||||
(start[d2] == (hssize_t)fdims[d2] && count[d2] > 0))
|
||||
BAIL_QUIET(NC_EINVALCOORDS);
|
||||
if (!zero_count && endindex >= fdims[d2])
|
||||
BAIL_QUIET(NC_EEDGE);
|
||||
#else
|
||||
if (start[d2] >= (hssize_t)fdims[d2])
|
||||
BAIL_QUIET(NC_EINVALCOORDS);
|
||||
if (endindex >= fdims[d2])
|
||||
BAIL_QUIET(NC_EEDGE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1920,15 +1913,10 @@ NC4_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
|
||||
BAIL(retval);
|
||||
|
||||
/* Check for out of bound requests. */
|
||||
#ifdef RELAX_COORD_BOUND
|
||||
/* Allow start to equal dim size if count is zero. */
|
||||
if (start[d2] > (hssize_t)ulen ||
|
||||
(start[d2] == (hssize_t)ulen && count[d2] > 0))
|
||||
BAIL_QUIET(NC_EINVALCOORDS);
|
||||
#else
|
||||
if (start[d2] >= (hssize_t)ulen && ulen > 0)
|
||||
BAIL_QUIET(NC_EINVALCOORDS);
|
||||
#endif
|
||||
if (count[d2] && endindex >= ulen)
|
||||
BAIL_QUIET(NC_EEDGE);
|
||||
|
||||
@ -1950,15 +1938,10 @@ NC4_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
|
||||
else /* Dim is not unlimited. */
|
||||
{
|
||||
/* Check for out of bound requests. */
|
||||
#ifdef RELAX_COORD_BOUND
|
||||
/* Allow start to equal dim size if count is zero. */
|
||||
if (start[d2] > (hssize_t)fdims[d2] ||
|
||||
(start[d2] == (hssize_t)fdims[d2] && count[d2] > 0))
|
||||
BAIL_QUIET(NC_EINVALCOORDS);
|
||||
#else
|
||||
if (start[d2] >= (hssize_t)fdims[d2])
|
||||
BAIL_QUIET(NC_EINVALCOORDS);
|
||||
#endif
|
||||
if (count[d2] && endindex >= fdims[d2])
|
||||
BAIL_QUIET(NC_EEDGE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user