diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-11-28 17:11:27 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-11-28 17:11:27 (GMT) |
commit | 3d84163ad37960ff1ecdd5782af88b442832fd99 (patch) | |
tree | 99d6ea66069bef7d37ca3abbf823e731f374b3c3 /src/H5Pencdec.c | |
parent | e1dd55be8538ee0ebd1c46be3df4b306a3ac6f3f (diff) | |
download | hdf5-3d84163ad37960ff1ecdd5782af88b442832fd99.zip hdf5-3d84163ad37960ff1ecdd5782af88b442832fd99.tar.gz hdf5-3d84163ad37960ff1ecdd5782af88b442832fd99.tar.bz2 |
Fix for HDFFV-9947 H5Sencode
Modifications to fix H5Sencode bug when num points selected is > 2^32.
Diffstat (limited to 'src/H5Pencdec.c')
-rw-r--r-- | src/H5Pencdec.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index 73c48d7..3332098 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -49,9 +49,10 @@ /* Typedef for iterator when encoding a property list */ typedef struct { - hbool_t encode; /* Whether the property list should be encoded */ - size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ - void **pp; /* Pointer to encoding buffer pointer */ + hbool_t encode; /* Whether the property list should be encoded */ + size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ + void **pp; /* Pointer to encoding buffer pointer */ + hid_t fapl_id; /* File access property list */ } H5P_enc_iter_ud_t; @@ -90,7 +91,7 @@ typedef struct { *------------------------------------------------------------------------- */ herr_t -H5P__encode_size_t(const void *value, void **_pp, size_t *size) +H5P__encode_size_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint64_t enc_value = (uint64_t)*(const size_t *)value; /* Property value to encode */ uint8_t **pp = (uint8_t **)_pp; @@ -132,7 +133,7 @@ H5P__encode_size_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) +H5P__encode_hsize_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint64_t enc_value = (uint64_t)*(const hsize_t *)value; /* Property value to encode */ unsigned enc_size = H5VM_limit_enc_size(enc_value); /* Size of encoded property */ @@ -173,7 +174,7 @@ H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_unsigned(const void *value, void **_pp, size_t *size) +H5P__encode_unsigned(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -212,7 +213,7 @@ H5P__encode_unsigned(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) +H5P__encode_uint8_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -248,7 +249,7 @@ H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) +H5P__encode_hbool_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -283,7 +284,7 @@ H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_double(const void *value, void **_pp, size_t *size) +H5P__encode_double(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -332,7 +333,8 @@ static int H5P__encode_cb(H5P_genprop_t *prop, void *_udata) { H5P_enc_iter_ud_t *udata = (H5P_enc_iter_ud_t *)_udata; /* Pointer to user data */ - int ret_value = H5_ITER_CONT; /* Return value */ + H5P_enc_cb_info_t cb_udata; /* User data for property iteration callback */ + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC @@ -355,7 +357,8 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata) /* Encode (or not, if *(udata->pp) is NULL) the property value */ prop_value_len = 0; - if((prop->encode)(prop->value, udata->pp, &prop_value_len) < 0) + cb_udata.fapl_id = udata->fapl_id; + if((prop->encode)(prop->value, udata->pp, &prop_value_len, &cb_udata) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, H5_ITER_ERROR, "property encoding routine failed") *(udata->enc_size_ptr) += prop_value_len; } /* end if */ @@ -390,7 +393,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, - size_t *nalloc) + size_t *nalloc, hid_t fapl_id) { H5P_enc_iter_ud_t udata; /* User data for property iteration callback */ uint8_t *p = (uint8_t *)buf; /* Temporary pointer to encoding buffer */ @@ -425,6 +428,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, udata.encode = encode; udata.enc_size_ptr = &encode_size; udata.pp = (void **)&p; + udata.fapl_id = fapl_id; /* Iterate over all properties in property list, encoding them */ idx = 0; |