summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMike Smith <grimbough@gmail.com>2021-03-06 02:34:25 (GMT)
committerGitHub <noreply@github.com>2021-03-06 02:34:25 (GMT)
commit150fb83345bbf9ff6659231ba3f5bcdd536fb35c (patch)
tree46fbfc3713f4ee5746115da1813bf3b028e29a98 /examples
parent6794428d232236e1c4605e8ca0face915f01286b (diff)
downloadhdf5-150fb83345bbf9ff6659231ba3f5bcdd536fb35c.zip
hdf5-150fb83345bbf9ff6659231ba3f5bcdd536fb35c.tar.gz
hdf5-150fb83345bbf9ff6659231ba3f5bcdd536fb35c.tar.bz2
fix block coordinate printing example (#437)
Diffstat (limited to 'examples')
-rw-r--r--examples/h5_vds.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/h5_vds.c b/examples/h5_vds.c
index 6bef06f..e036204 100644
--- a/examples/h5_vds.c
+++ b/examples/h5_vds.c
@@ -60,7 +60,7 @@ main(void)
hsize_t start_out[2], stride_out[2], count_out[2], block_out[2];
int wdata[DIM0], /* Write buffer for source dataset */
rdata[VDSDIM0][VDSDIM1], /* Read buffer for virtual dataset */
- i, j, k, l;
+ i, j, k, l, block_inc;
int fill_value = -1; /* Fill value for VDS */
H5D_layout_t layout; /* Storage layout */
size_t num_map; /* Number of mappings */
@@ -178,13 +178,14 @@ main(void)
buf = (hsize_t *)malloc(sizeof(hsize_t) * 2 * RANK2 * nblocks);
status = H5Sget_select_hyper_blocklist(vspace, (hsize_t)0, nblocks, buf);
for (l = 0; l < nblocks; l++) {
+ block_inc = 2 * RANK2 * l;
printf("(");
for (k = 0; k < RANK2 - 1; k++)
- printf("%d,", (int)buf[k]);
- printf("%d ) - (", (int)buf[k]);
+ printf("%d,", (int)buf[block_inc + k]);
+ printf("%d) - (", (int)buf[block_inc + k]);
for (k = 0; k < RANK2 - 1; k++)
- printf("%d,", (int)buf[RANK2 + k]);
- printf("%d)\n", (int)buf[RANK2 + k]);
+ printf("%d,", (int)buf[block_inc + RANK2 + k]);
+ printf("%d)\n", (int)buf[block_inc + RANK2 + k]);
}
/* We also can use new APIs to get start, stride, count and block */
if (H5Sis_regular_hyperslab(vspace)) {