now return NC_EINVAL on attempt to set chunking on scalar var

This commit is contained in:
Edward Hartnett 2020-03-03 11:57:16 -07:00
parent c484f8f3d0
commit 502336c2c7
2 changed files with 9 additions and 7 deletions

View File

@ -728,9 +728,11 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *unused1,
}
/* Handle chunked storage settings. */
if (*storage == NC_CHUNKED && var->ndims == 0) {
var->contiguous = NC_TRUE;
var->compact = NC_FALSE;
if (*storage == NC_CHUNKED && var->ndims == 0)
{
return NC_EINVAL;
/* var->contiguous = NC_TRUE; */
/* var->compact = NC_FALSE; */
} else if (*storage == NC_CHUNKED)
{
var->contiguous = NC_FALSE;

View File

@ -912,18 +912,18 @@ main(int argc, char **argv)
if (nc_def_var(ncid, VAR_NAME5_2, NC_INT, 0, NULL, &varid2)) ERR;
if (nc_def_var(ncid, VAR_NAME5_3, NC_INT, 0, NULL, &varid3)) ERR;
if (nc_def_var(ncid, VAR_NAME5_4, NC_INT, NDIMS5, dimids, &varid4)) ERR;
if (nc_def_var_chunking(ncid, varid2, NC_CHUNKED, chunksize)) ERR;
if (nc_def_var_chunking(ncid, varid2, NC_CHUNKED, chunksize) != NC_EINVAL) ERR;
if (nc_def_var_chunking(ncid, varid3, NC_CONTIGUOUS, NULL)) ERR;
if (nc_def_var_chunking(ncid, varid4, NC_CHUNKED, large_chunksize) != NC_EBADCHUNK) ERR;
if (nc_def_var_chunking_ints(ncid, varid2, NC_CHUNKED, chunksize_int)) ERR;
if (nc_def_var_chunking_ints(ncid, varid2, NC_CHUNKED, chunksize_int) != NC_EINVAL) ERR;
if (nc_def_var_chunking_ints(ncid, varid1, NC_CHUNKED, chunksize_int)) ERR;
if (nc_inq_var_chunking_ints(ncid, varid2, NULL, chunksize_int_in)) ERR;
if (nc_inq_var_chunking_ints(ncid, varid2, &storage_in, NULL)) ERR;
if (storage_in != NC_CONTIGUOUS) ERR;
if (nc_inq_var_chunking_ints(ncid, varid1, NULL, chunksize_int_in)) ERR;
for (d = 0; d < NDIMS5; d++)
if (chunksize_int_in[d] != chunksize[d] * 2) ERR;
if (nc_inq_var_chunking_ints(ncid, varid1, &storage_in, NULL)) ERR;
if (storage_in != NC_CHUNKED) ERR;
if (nc_inq_var_chunking_ints(ncid, varid2, NULL, chunksize_int_in)) ERR;
if (nc_inq_var_chunking_ints(ncid, varid3, &storage_in, NULL)) ERR;
if (storage_in != NC_CONTIGUOUS) ERR;
if (nc_inq_var_chunking_ints(ncid, varid3, &storage_in, chunksize_int_in)) ERR;