diff --git a/include/nc.h b/include/nc.h index aa597c9c3..2275c0e86 100644 --- a/include/nc.h +++ b/include/nc.h @@ -38,11 +38,7 @@ typedef struct NC { typedef struct { /* all xdr'd */ size_t nchars; -#ifdef __arm__ - signed char *cp; -#else char *cp; -#endif } NC_string; @@ -55,17 +51,10 @@ free_NC_string(NC_string *ncstrp); extern int NC_check_name(const char *name); -#ifdef __arm__ -extern NC_string * -new_NC_string(size_t slen, const signed char *str); -extern int -set_NC_string(NC_string *ncstrp, const signed char *str); -#else extern NC_string * new_NC_string(size_t slen, const char *str); extern int set_NC_string(NC_string *ncstrp, const char *str); -#endif /* End defined in string.c */ diff --git a/libdispatch/dstring.c b/libdispatch/dstring.c index d251fe471..10f53e636 100644 --- a/libdispatch/dstring.c +++ b/libdispatch/dstring.c @@ -228,13 +228,8 @@ fail: NC_new_string(count, str) */ -#ifdef __arm__ -NC_string * -new_NC_string(size_t slen, const signed char *str) -#else NC_string * new_NC_string(size_t slen, const char *str) -#endif { NC_string *ncstrp; size_t sz = M_RNDUP(sizeof(NC_string)) + slen + 1; @@ -269,13 +264,8 @@ new_NC_string(size_t slen, const char *str) NC_re_string() */ -#ifdef __arm__ - int - set_NC_string(NC_string *ncstrp, const signed char *str) -#else int set_NC_string(NC_string *ncstrp, const char *str) -#endif { size_t slen; diff --git a/libdispatch/dvarput.c b/libdispatch/dvarput.c index 59e071bc7..fca2750f3 100644 --- a/libdispatch/dvarput.c +++ b/libdispatch/dvarput.c @@ -226,7 +226,11 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start, #endif else { /* mystart is unsigned, will never be < 0 */ +#ifdef ISSUE243 if(mystart[i] > dimlen) +#else + if(mystart[i] >= dimlen) +#endif return NC_EINVALCOORDS; /* myediges is unsigned, will never be < 0 */ if(mystart[i] + myedges[i] > dimlen) @@ -422,7 +426,11 @@ NCDEFAULT_put_varm( */ for (idim = isrecvar; idim < maxidim; ++idim) { +#ifdef ISSUE243 if (mystart[idim] > varshape[idim]) +#else + if (mystart[idim] >= varshape[idim]) +#endif { status = NC_EINVALCOORDS; goto done; diff --git a/libsrc/ncx.h b/libsrc/ncx.h index 01e8433c4..08a7874b1 100644 --- a/libsrc/ncx.h +++ b/libsrc/ncx.h @@ -989,21 +989,6 @@ ncx_putn_ulonglong_ulonglong(void **xpp, size_t nelems, const ulonglong *ip); */ /* read ASCII characters */ -#ifdef __arm__ - -extern int -ncx_getn_text(const void **xpp, size_t nchars, signed char *cp); -extern int -ncx_pad_getn_text(const void **xpp, size_t nchars, signed char *cp); - -/* write ASCII characters */ -extern int -ncx_putn_text(void **xpp, size_t nchars, const signed char *cp); -extern int -ncx_pad_putn_text(void **xpp, size_t nchars, const signed char *cp); - -#else // ifdef __arm__ - extern int ncx_getn_text(const void **xpp, size_t nchars, char *cp); extern int @@ -1015,7 +1000,6 @@ ncx_putn_text(void **xpp, size_t nchars, const char *cp); extern int ncx_pad_putn_text(void **xpp, size_t nchars, const char *cp); -#endif //ifdef __arm__ /* for symmetry */ #define ncx_getn_char_char(xpp, nelems, fillp) ncx_getn_text(xpp, nelems, fillp) diff --git a/libsrc/v1hpg.c b/libsrc/v1hpg.c index acb211da2..b8fda9247 100644 --- a/libsrc/v1hpg.c +++ b/libsrc/v1hpg.c @@ -85,11 +85,7 @@ fault_v1hs(v1hs *gsp, size_t extent) if(gsp->base != NULL) { -#ifdef __arm__ const ptrdiff_t incr = (signed char *)gsp->pos - (signed char *)gsp->base; -#else - const ptrdiff_t incr = (char *)gsp->pos - (char *)gsp->base; -#endif status = rel_v1hs(gsp); if(status) return status; @@ -107,11 +103,7 @@ fault_v1hs(v1hs *gsp, size_t extent) gsp->pos = gsp->base; -#ifdef __arm__ gsp->end = (signed char *)gsp->base + gsp->extent; -#else - gsp->end = (char *)gsp->base + gsp->extent; -#endif return NC_NOERR; } @@ -128,13 +120,8 @@ fprintf(stderr, "nextread %lu, remaining %lu\n", (unsigned long)nextread, (unsigned long)((char *)gsp->end - (char *)gsp->pos)); #endif -#ifdef __arm__ if((signed char *)gsp->pos + nextread <= (signed char *)gsp->end) return NC_NOERR; -#else - if((char *)gsp->pos + nextread <= (char *)gsp->end) - return NC_NOERR; -#endif return fault_v1hs(gsp, nextread); } @@ -613,13 +600,8 @@ v1h_put_NC_attrV(v1hs *psp, const NC_attr *attrp) (void) memcpy(psp->pos, value, nbytes); -#ifdef __arm__ psp->pos = (void *)((signed char *)psp->pos + nbytes); value = (void *)((signed char *)value + nbytes); -#else - psp->pos = (void *)((char *)psp->pos + nbytes); - value = (void *)((char *)value + nbytes); -#endif remaining -= nbytes; } while(remaining != 0); @@ -675,13 +657,8 @@ v1h_get_NC_attrV(v1hs *gsp, NC_attr *attrp) return status; (void) memcpy(value, gsp->pos, nget); -#ifdef __arm__ gsp->pos = (void *)((signed char *)gsp->pos + nget); value = (void *)((signed char *)value + nget); -#else - gsp->pos = (void *)((char *)gsp->pos + nget); - value = (void *)((char *)value + nget); -#endif remaining -= nget; @@ -1473,11 +1450,8 @@ nc_get_NC(NC3_INFO* ncp) NC_set_numrecs(ncp, nrecs); } -#ifdef __arm__ assert((signed char *)gs.pos < (signed char *)gs.end); -#else - assert((char *)gs.pos < (char *)gs.end); -#endif + status = v1h_get_NC_dimarray(&gs, &ncp->dims); if(status != NC_NOERR) goto unwind_get; diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c index b66317666..0758f109d 100644 --- a/libsrc4/nc4hdf.c +++ b/libsrc4/nc4hdf.c @@ -625,8 +625,12 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp, assert(dim && dim->dimid == var->dimids[d2]); if (!dim->unlimited) { +#ifdef ISSUE243 if (start[d2] > (hssize_t)fdims[d2] || (start[d2] == (hssize_t)fdims[d2] && count[d2] > 0)) +#else + if (start[d2] >= (hssize_t)fdims[d2]) +#endif BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > fdims[d2]) BAIL_QUIET(NC_EEDGE); @@ -957,8 +961,12 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp, BAIL(retval); /* Check for out of bound requests. */ +#ifdef ISSUE243 if (start[d2] > (hssize_t)ulen || (start[d2] == (hssize_t)ulen && count[d2] > 0)) +#else + if (start[d2] >= (hssize_t)ulen && count[d2]) +#endif BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > ulen) BAIL_QUIET(NC_EEDGE); @@ -981,8 +989,12 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp, else { /* Check for out of bound requests. */ +#ifdef ISSUE243 if (start[d2] > (hssize_t)fdims[d2] || (start[d2] == (hssize_t)fdims[d2] && count[d2] > 0)) +#else + if (start[d2] >= (hssize_t)fdims[d2]) +#endif BAIL_QUIET(NC_EINVALCOORDS); if (start[d2] + count[d2] > fdims[d2]) BAIL_QUIET(NC_EEDGE);