diff options
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff_dset.c | 8 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 4826a7f..a295585 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -452,8 +452,12 @@ hsize_t diff_datasetid( hid_t did1, */ sm_nbytes = p_type_nbytes; - for (i = rank1; i > 0; --i) { - sm_size[i - 1] = MIN(dims1[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); + for (i = rank1; i > 0; --i) + { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(dims1[i - 1], size); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 6032c02..a1d0696 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1170,7 +1170,10 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, if (ctx.ndims > 0) { for (i = ctx.ndims; i > 0; --i) { - sm_size[i - 1] = MIN(total_size[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(total_size[i - 1], size); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } |