summaryrefslogtreecommitdiffstats
path: root/src/H5V.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5V.c')
-rw-r--r--src/H5V.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/H5V.c b/src/H5V.c
index 85d8752..c9f3de2 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -502,23 +502,30 @@ H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
FUNC_ENTER(H5V_stride_copy, FAIL);
- H5V_vector_cpy(n, idx, size);
- nelmts = H5V_vector_reduce_product(n, size);
- for (i = 0; i < nelmts; i++) {
- /* Copy an element */
- HDmemcpy(dst, src, elmt_size);
+ if (n) {
+ H5V_vector_cpy(n, idx, size);
+ nelmts = H5V_vector_reduce_product(n, size);
+ for (i = 0; i < nelmts; i++) {
- /* Decrement indices and advance pointers */
- for (j = n - 1, carry = TRUE; j >= 0 && carry; --j) {
- src += src_stride[j];
- dst += dst_stride[j];
+ /* Copy an element */
+ HDmemcpy(dst, src, elmt_size);
- if (--idx[j]) carry = FALSE;
- else idx[j] = size[j];
+ /* Decrement indices and advance pointers */
+ for (j = n - 1, carry = TRUE; j >= 0 && carry; --j) {
+ src += src_stride[j];
+ dst += dst_stride[j];
+
+ if (--idx[j]) carry = FALSE;
+ else idx[j] = size[j];
+ }
}
+ } else {
+ HDmemcpy (dst, src, elmt_size);
+ HRETURN (SUCCEED);
}
+
FUNC_LEAVE(SUCCEED);
}