diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Tconv.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 44dde72..ab4ef71 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2126,7 +2126,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t conv_buf_size=0; /*size of conversion buffer in bytes */ void *tmp_buf=NULL; /*temporary background buffer */ size_t tmp_buf_size=0; /*size of temporary bkg buffer */ - uint8_t dbuf[64],*dbuf_ptr=dbuf;/*temp destination buffer */ + uint8_t dbuf[64],*dbuf_ptr; /*temp destination buffer */ int direction; /*direction of traversal */ int nested=0; /*flag of nested VL case */ hsize_t elmtno; /*element number counter */ @@ -2205,6 +2205,12 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, dst_delta = direction * (buf_stride ? buf_stride : dst->size); bkg_delta = direction * (bkg_stride ? bkg_stride : dst->size); + /* Set the dbuf_ptr correctly, based on the alignment of the dbuf */ + /* (Have to use the maximum alignment of hvl_t and 'char *' types */ + /* since this routine is used for both variable-length sequences */ + /* and variable-length strings) */ + dbuf_ptr=dbuf+(((size_t)dbuf)%MAX(H5T_HVL_COMP_ALIGN_g,H5T_POINTER_COMP_ALIGN_g)); + /* * If the source and destination buffers overlap then use a * temporary buffer for the destination. @@ -2334,7 +2340,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, * then we should copy the value to the true destination * buffer. */ - if (d==dbuf) HDmemcpy (dp, d, dst->size); + if (d==dbuf_ptr) HDmemcpy (dp, d, dst->size); sp += src_delta; dp += dst_delta; if(bg_ptr!=NULL) |