fixed HDF4 test

This commit is contained in:
Ed Hartnett 2018-08-14 06:44:11 -06:00
parent acc22e0c54
commit 69b37d994e
2 changed files with 24 additions and 2 deletions

View File

@ -74,8 +74,7 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
/* These won't work. */
if (nc_get_vara_int(ncid, 0, NULL, count, data_int) != NC_EINVAL) ERR;
if (nc_get_vara_int(ncid, 0, start, count, NULL) != NC_EINVAL) ERR;
if (nc_get_vara_int(ncid, 0, NULL, count, data_int) != NC_EINVALCOORDS) ERR;
if (nc_get_vara_int(ncid + TEST_VAL_42, 0, start, count, data_int) != NC_EBADID) ERR;
/* Read data as short. */

View File

@ -569,6 +569,29 @@ NCDEFAULT_get_varm(int ncid, int varid, const size_t *start,
return status;
}
/**
* @internal Check the start, count, and stride parameters for gets
* and puts, and handle NULLs.
*
* @param ncid The file ID.
* @param varid The variable ID.
* @param start Pointer to pointer to start array. If NULL
* NC_EINVALCOORDS will be returned for non-scalar variable.
* @param count Pointer to pointer to count array. If NULL, an array
* of the correct size will be allocated, and filled with counts that
* represent the full extent of the variable. In this case, the memory
* must be freed by the caller.
* @param stride Pointer to pointer to stride array. If NULL, an array
* of the correct size will be allocated, and filled with ones. In
* this case, the memory must be freed by the caller.
*
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @return ::NC_ENOTVAR Variable not found.
* @return ::NC_ENOMEM Out of memory.
* @return ::NC_EINVALCOORS Missing start array.
* @author Ed Hartnett
*/
int
NC_check_nulls(int ncid, int varid, size_t **start, size_t **count,
ptrdiff_t **stride)