Fix NC_coord_zero indexing in NCDISPATCH_initialize()

Fixes #1518.
This commit is contained in:
Constantine Khrulev 2019-11-14 08:26:33 -09:00
parent 108e938b2f
commit 91d3a89bdd

View File

@ -26,7 +26,7 @@ See LICENSE.txt for license information.
#include <curl/curl.h> #include <curl/curl.h>
#endif #endif
/* Define vectors of zeros and ones for use with various nc_get_varX function*/ /* Define vectors of zeros and ones for use with various nc_get_varX functions */
size_t NC_coord_zero[NC_MAX_VAR_DIMS] = {0}; size_t NC_coord_zero[NC_MAX_VAR_DIMS] = {0};
size_t NC_coord_one[NC_MAX_VAR_DIMS] = {1}; size_t NC_coord_one[NC_MAX_VAR_DIMS] = {1};
ptrdiff_t NC_stride_one[NC_MAX_VAR_DIMS] = {1}; ptrdiff_t NC_stride_one[NC_MAX_VAR_DIMS] = {1};
@ -46,15 +46,10 @@ NCDISPATCH_initialize(void)
int i; int i;
NCRCglobalstate* globalstate = NULL; NCRCglobalstate* globalstate = NULL;
{ for(i=0;i<NC_MAX_VAR_DIMS;i++) {
size_t* c0 = (size_t*)NC_coord_zero; NC_coord_zero[i] = 0;
size_t* c1 = (size_t*)NC_coord_one; NC_coord_one[i] = 1;
ptrdiff_t* s1 = (ptrdiff_t*)NC_stride_one; NC_stride_one[i] = 1;
for(i=0;i<NC_MAX_VAR_DIMS;i++) {
c0[0] = 0;
c1[i] = 1;
s1[i] = 1;
}
} }
globalstate = ncrc_getglobalstate(); /* will allocate and clear */ globalstate = ncrc_getglobalstate(); /* will allocate and clear */