Skip to content

Commit

Permalink
add note on an early check for buftype when bufcount is -1
Browse files Browse the repository at this point in the history
  • Loading branch information
wkliao committed May 2, 2022
1 parent 24062cb commit 6765111
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/drivers/common/dtype_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,28 @@ ncmpii_buftype_decode(int ndims,
for (i=0; i<ndims; i++)
fnelems *= count[i];

if (bufcount == -1) { /* the subroutine is called from a high-level API */
if (bufcount == -1) {
/* This is called from a high-level API, buftype must be the I/O
* buffer's data type, a predefined MPI datatype.
*/
#if 0
/* The same error will also be captured in ncmpio_pack_xbuf(),
* ncmpio_unpack_xbuf(), ncmpii_putn_xxx(), or ncmpii_getn_NC_xxx().
*/
if (buftype != MPI_CHAR &&
buftype != MPI_SIGNED_CHAR &&
buftype != MPI_UNSIGNED_CHAR &&
buftype != MPI_SHORT &&
buftype != MPI_UNSIGNED_SHORT &&
buftype != MPI_INT &&
buftype != MPI_UNSIGNED &&
buftype != MPI_LONG &&
buftype != MPI_FLOAT &&
buftype != MPI_DOUBLE &&
buftype != MPI_LONG_LONG_INT &&
buftype != MPI_UNSIGNED_LONG_LONG)
DEBUG_RETURN_ERROR(NC_EBADTYPE)
#endif
*nelems = fnelems;
*etype = buftype; /* buftype is an MPI primitive data type */
MPI_Type_size(buftype, esize);
Expand Down

0 comments on commit 6765111

Please sign in to comment.