mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
fixed null stride problem for vars calls
This commit is contained in:
parent
b16eceabe2
commit
091880fd4d
@ -699,10 +699,10 @@ NC_check_nulls(int ncid, int varid, const size_t *start, size_t **count,
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!(*stride = malloc(varndims * sizeof(size_t))))
|
||||
if (!(*stride = malloc(varndims * sizeof(ptrdiff_t))))
|
||||
return NC_ENOMEM;
|
||||
for (i = 0; i < varndims; i++)
|
||||
*stride[i] = 1;
|
||||
(*stride)[i] = 1;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
|
@ -387,6 +387,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
int ncid, dimid[NDIMS2], varid;
|
||||
size_t start[NDIMS2] = {0, 0}, count[NDIMS2] = {NX, NY};
|
||||
ptrdiff_t stride[NDIMS2] = {1, 1};
|
||||
double double_data[NX * NY];
|
||||
|
||||
/* Create file with two dims, one 2D var. */
|
||||
@ -400,6 +401,10 @@ main(int argc, char **argv)
|
||||
if (nc_put_vara_double(ncid + MILLION, 0, start, count, double_data) != NC_EBADID) ERR;
|
||||
if (nc_put_vara_double(ncid + TEST_VAL_42, 0, start, count, double_data) != NC_EBADID) ERR;
|
||||
|
||||
/* Write some data. */
|
||||
if (nc_put_vars_double(ncid, varid, start, count, NULL, double_data)) ERR;
|
||||
if (nc_put_vars_double(ncid, varid, start, count, stride, double_data)) ERR;
|
||||
|
||||
if (nc_close(ncid)) ERR;
|
||||
}
|
||||
SUMMARIZE_ERR;
|
||||
|
Loading…
Reference in New Issue
Block a user