took RELAX_COORD_BOUND out of libsrc code

This commit is contained in:
Edward Hartnett 2019-11-26 06:29:27 -07:00
parent 64d821b568
commit ccaaa2e745
3 changed files with 2 additions and 22 deletions

View File

@ -1196,10 +1196,6 @@ AC_ARG_ENABLE([erange_fill],
dnl Always build with relaxed coord bound checking, to prevent API
dnl incompatibilities between different installs of netCDF.
enable_zero_length_coord_bound=yes
dnl AC_ARG_ENABLE([zero-length-coord-bound],
dnl [AS_HELP_STRING([--disable-zero-length-coord-bound],
dnl [Disable relaxed boundary error check. Deprecated. Using this can cause API incompatibilities. This option will be removed in the next release of netCDF.])])
dnl test "x$enable_zero_length_coord_bound" = xno || enable_zero_length_coord_bound=yes
# check PnetCDF's settings on enable_erange_fill and relax_coord_bound
if test "x$enable_pnetcdf" = xyes; then
@ -1425,7 +1421,7 @@ AC_SUBST(HAS_PARALLEL4,[$enable_parallel4])
AC_SUBST(HAS_DISKLESS,[yes])
AC_SUBST(HAS_MMAP,[$enable_mmap])
AC_SUBST(HAS_JNA,[$enable_jna])
AC_SUBST(RELAX_COORD_BOUND,[$enable_zero_length_coord_bound])
#AC_SUBST(RELAX_COORD_BOUND,[$enable_zero_length_coord_bound])
AC_SUBST(HAS_ERANGE_FILL,[$enable_erange_fill])
AC_SUBST(HAS_BYTERANGE,[$enable_byterange])

View File

@ -39,4 +39,4 @@ MMap Support: @HAS_MMAP@
JNA Support: @HAS_JNA@
CDF5 Support: @HAS_CDF5@
ERANGE Fill Support: @HAS_ERANGE_FILL@
Relaxed Boundary Check: @RELAX_COORD_BOUND@
Relaxed Boundary Check: yes

View File

@ -498,11 +498,7 @@ NCcoordck(NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
{
if(*coord > X_UINT_MAX) /* rkr: bug fix from previous X_INT_MAX */
return NC_EINVALCOORDS; /* sanity check */
#ifdef RELAX_COORD_BOUND
if(NC_readonly(ncp) && *coord > NC_get_numrecs(ncp))
#else
if(NC_readonly(ncp) && *coord >= NC_get_numrecs(ncp))
#endif
{
if(!NC_doNsync(ncp))
return NC_EINVALCOORDS;
@ -512,11 +508,7 @@ NCcoordck(NC3_INFO* ncp, const NC_var *varp, const size_t *coord)
const int status = read_numrecs(ncp);
if(status != NC_NOERR)
return status;
#ifdef RELAX_COORD_BOUND
if(*coord > NC_get_numrecs(ncp))
#else
if(*coord >= NC_get_numrecs(ncp))
#endif
return NC_EINVALCOORDS;
}
}
@ -543,11 +535,7 @@ fprintf(stderr," NCcoordck: ip %p, *ip %ld, up %p, *up %lu\n",
#endif /* CDEBUG */
/* cast needed for braindead systems with signed size_t */
#ifdef RELAX_COORD_BOUND
if((unsigned long) *ip > (unsigned long) *up )
#else
if((unsigned long) *ip >= (unsigned long) *up )
#endif
return NC_EINVALCOORDS;
}
@ -571,11 +559,9 @@ NCedgeck(const NC3_INFO* ncp, const NC_var *varp,
if(IS_RECVAR(varp))
{
#ifdef RELAX_COORD_BOUND
if (NC_readonly(ncp) &&
(start[0] == NC_get_numrecs(ncp) && edges[0] > 0))
return(NC_EINVALCOORDS);
#endif
start++;
edges++;
shp++;
@ -583,10 +569,8 @@ NCedgeck(const NC3_INFO* ncp, const NC_var *varp,
for(; start < end; start++, edges++, shp++)
{
#ifdef RELAX_COORD_BOUND
if ((unsigned long) *start == *shp && *edges > 0)
return(NC_EINVALCOORDS);
#endif
/* cast needed for braindead systems with signed size_t */
if((unsigned long) *edges > *shp ||
(unsigned long) *start + (unsigned long) *edges > *shp)