diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-19 21:16:28 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-19 21:16:28 (GMT) |
commit | 525caddd9e0460b2f39d043f04dabc7ab6a1bf3a (patch) | |
tree | 176f2be3724d8160e67de97df457988a27aa2257 /tools/lib/h5tools.c | |
parent | d221d97f992d66540d39b0dfdca80b37849a7dd6 (diff) | |
download | hdf5-525caddd9e0460b2f39d043f04dabc7ab6a1bf3a.zip hdf5-525caddd9e0460b2f39d043f04dabc7ab6a1bf3a.tar.gz hdf5-525caddd9e0460b2f39d043f04dabc7ab6a1bf3a.tar.bz2 |
[svn-r19254] Description:
Bring r19252 & 19253 from trunk to 1.8 branch:
Bring Coverity changes from branch to trunk:
r19161:
Fixed the part for matching the subset info with dataset
r19189:
BZ1646: h5dump does not check number of dimensions for subsetting parameters against the dataset
Changed subset_t structure from holding hsize_t pointers to holding new subset_d pointers, which hold the original hsize_t pointer + len. this len is then checked against dataset ndims in the handle_dataset function of h5dump.
Changed all references to use new data structure.
Added tests for each subset parameter.
r19190:
Added new h5dump ddl files
Tested on:
Mac OS X/32 10.6.4 (amazon) w/debug & production
(h5committested on Coverity branch)
Diffstat (limited to 'tools/lib/h5tools.c')
-rw-r--r-- | tools/lib/h5tools.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index e0ead62..d7aab94 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1990,7 +1990,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c if (ctx->ndims > 0) init_acc_pos(ctx, total_size); - size_row_block = sset->block[row_dim]; + size_row_block = sset->block.data[row_dim]; /* display loop */ for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) { @@ -1998,9 +1998,9 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c cases where block > 1 only and stride > block */ if (size_row_block > 1 && row_counter == size_row_block - && sset->stride[row_dim] > sset->block[row_dim]) { + && sset->stride.data[row_dim] > sset->block.data[row_dim]) { - hsize_t increase_rows = sset->stride[row_dim] - sset->block[row_dim]; + hsize_t increase_rows = sset->stride.data[row_dim] - sset->block.data[row_dim]; temp_start[row_dim] += increase_rows; row_counter = 0; } @@ -2158,22 +2158,22 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools if (ctx->ndims > 2) for (i = 0; i < (size_t) ctx->ndims - 2; i++) { /* consider block size */ - outer_count = outer_count * sset->count[i] * sset->block[i]; + outer_count = outer_count * sset->count.data[i] * sset->block.data[i]; } /* initialize temporary start, count and maximum start */ for (i = 0; i < (size_t) ctx->ndims; i++) { - temp_start[i] = sset->start[i]; - temp_count[i] = sset->count[i]; - temp_block[i] = sset->block[i]; - temp_stride[i] = sset->stride[i]; + temp_start[i] = sset->start.data[i]; + temp_count[i] = sset->count.data[i]; + temp_block[i] = sset->block.data[i]; + temp_stride[i] = sset->stride.data[i]; max_start[i] = 0; } if (ctx->ndims > 2) { for (i = 0; i < (size_t) ctx->ndims - 2; i++) { - max_start[i] = temp_start[i] + sset->count[i]; + max_start[i] = temp_start[i] + sset->count.data[i]; temp_count[i] = 1; } @@ -2186,14 +2186,14 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools /* count is the number of iterations to display all the rows, the block size count times */ - count = sset->count[row_dim] * sset->block[row_dim]; + count = sset->count.data[row_dim] * sset->block.data[row_dim]; /* always 1 row_counter at a time, that is a block of size 1, 1 time */ temp_count[row_dim] = 1; temp_block[row_dim] = 1; /* advance 1 row_counter at a time */ - if (sset->block[row_dim] > 1) + if (sset->block.data[row_dim] > 1) temp_stride[row_dim] = 1; } @@ -2212,7 +2212,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools /* set start to original from current_outer_dim up */ for (i = current_outer_dim + 1; i < ctx->ndims; i++) { - temp_start[i] = sset->start[i]; + temp_start[i] = sset->start.data[i]; } /* increment start dimension */ @@ -2220,10 +2220,10 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools reset_dim = 0; temp_start[current_outer_dim]++; if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) { - temp_start[current_outer_dim] = sset->start[current_outer_dim]; + temp_start[current_outer_dim] = sset->start.data[current_outer_dim]; /* consider block */ - if (sset->block[current_outer_dim] > 1) + if (sset->block.data[current_outer_dim] > 1) temp_start[current_outer_dim]++; current_outer_dim--; @@ -2631,7 +2631,6 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, H5S_class_t space_type; int status = FAIL; h5tool_format_t info_dflt; - /* Use default values */ if (!stream) stream = stdout; @@ -2666,12 +2665,10 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, /* Print the data */ if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) { - if (!sset) { + if(!sset) status = h5tools_dump_simple_dset(stream, info, dset, p_type, indentlevel); - } - else { + else status = h5tools_dump_simple_subset(stream, info, dset, p_type, sset, indentlevel); - } } else /* space is H5S_NULL */ |