diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-10 19:22:03 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-10-10 19:22:03 (GMT) |
commit | e1c1f5cc1543fccb47e46cc85531a6a4646e0fad (patch) | |
tree | 71394ddfeac675f0143fb788ef8307260548b2c3 /tools/lib | |
parent | 166580844b2cd4fe36eded33d060e1ab6750e7a6 (diff) | |
download | hdf5-e1c1f5cc1543fccb47e46cc85531a6a4646e0fad.zip hdf5-e1c1f5cc1543fccb47e46cc85531a6a4646e0fad.tar.gz hdf5-e1c1f5cc1543fccb47e46cc85531a6a4646e0fad.tar.bz2 |
[svn-r9395] Purpose:
Bug fix
Description:
Correct a couple of array bounds issues exposed by the PGI compiler
Platforms tested:
Linux 2.4 (verbena) w/PGI compilers
Too minor too requie h5committest
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 992b769..fef34df 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -903,14 +903,17 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, ctx.p_min_idx[i] = 0; H5Sget_simple_extent_dims(f_space, total_size, NULL); - ctx.size_last_dim = (total_size[ctx.ndims - 1]); /* calculate the number of elements we're going to print */ p_nelmts = 1; - if (ctx.ndims > 0) - for (i = 0, p_nelmts = 1; i < ctx.ndims; i++) + if (ctx.ndims > 0) { + for (i = 0; i < ctx.ndims; i++) p_nelmts *= total_size[i]; + ctx.size_last_dim = (total_size[ctx.ndims - 1]); + } /* end if */ + else + ctx.size_last_dim = 0; if (p_nelmts == 0) { /* nothing to print */ @@ -1062,8 +1065,12 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, if (nelmts == 0) return SUCCEED; /*nothing to print*/ - assert(ctx.p_max_idx[ctx.ndims - 1]==(hsize_t)((int)ctx.p_max_idx[ctx.ndims - 1])); - ctx.size_last_dim = (int)(ctx.p_max_idx[ctx.ndims - 1]); + if(ctx.ndims>0) { + assert(ctx.p_max_idx[ctx.ndims - 1]==(hsize_t)((int)ctx.p_max_idx[ctx.ndims - 1])); + ctx.size_last_dim = (int)(ctx.p_max_idx[ctx.ndims - 1]); + } /* end if */ + else + ctx.size_last_dim = 0; /* Print it */ h5tools_dump_simple_data(stream, info, obj_id, &ctx, |