diff options
author | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2019-11-26 21:50:08 (GMT) |
---|---|---|
committer | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2019-11-26 21:50:08 (GMT) |
commit | 6b68cc352ffabb5fe997db1eb52216b3ee80e669 (patch) | |
tree | ff141b2b504db24deab1799be4a548d8fc660c1f | |
parent | b8a56718e40efaf6954a760984b9d513dbff8f7d (diff) | |
download | hdf5-6b68cc352ffabb5fe997db1eb52216b3ee80e669.zip hdf5-6b68cc352ffabb5fe997db1eb52216b3ee80e669.tar.gz hdf5-6b68cc352ffabb5fe997db1eb52216b3ee80e669.tar.bz2 |
H5R: fix H5Tconv to check for null references
Valid for both deprecated and non-deprecated references
Update test
-rw-r--r-- | src/H5Rint.c | 3 | ||||
-rw-r--r-- | src/H5Tconv.c | 71 | ||||
-rw-r--r-- | src/H5Tpkg.h | 4 | ||||
-rw-r--r-- | src/H5Tref.c | 264 | ||||
-rw-r--r-- | test/trefer.c | 8 |
5 files changed, 304 insertions, 46 deletions
diff --git a/src/H5Rint.c b/src/H5Rint.c index 504ae06..0879f31 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -413,6 +413,7 @@ H5R__destroy(H5R_ref_priv_t *ref) break; case H5R_OBJECT1: case H5R_DATASET_REGION1: + break; case H5R_BADTYPE: case H5R_MAXTYPE: HDassert("invalid reference type" && 0); @@ -423,7 +424,7 @@ H5R__destroy(H5R_ref_priv_t *ref) } /* end switch */ /* Decrement refcount of attached loc_id */ - if((ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0)) + if(ref->type && (ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0)) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") done: diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 6aea00e..4cc5f3c 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3609,39 +3609,52 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, for(elmtno = 0; elmtno < safe; elmtno++) { size_t buf_size; hbool_t dst_copy = FALSE; + hbool_t is_nil; /* Whether sequence is "nil" */ - /* Get size of references */ - if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, &dst_copy))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size") - - /* Check if conversion buffer is large enough, resize if necessary. */ - if(conv_buf_size < buf_size) { - conv_buf_size = buf_size; - if(NULL == (conv_buf = H5FL_BLK_REALLOC(ref_seq, conv_buf, conv_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") - HDmemset(conv_buf, 0, conv_buf_size); - } /* end if */ + /* Check for "nil" source sequence */ + if((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, &is_nil) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'") - if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { - H5MM_memcpy(conv_buf, s, buf_size); - } else { - /* Read reference */ - if(src->shared->u.atomic.u.r.cls->read( + if(is_nil) { + + /* Write "nil" sequence to destination location */ + if((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, b) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set reference data to 'nil'") + } /* end else-if */ + else { + /* Get size of references */ + if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") - } + dst->shared->u.atomic.u.r.file, &dst_copy))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size") + + /* Check if conversion buffer is large enough, resize if necessary. */ + if(conv_buf_size < buf_size) { + conv_buf_size = buf_size; + if(NULL == (conv_buf = H5FL_BLK_REALLOC(ref_seq, conv_buf, conv_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") + HDmemset(conv_buf, 0, conv_buf_size); + } /* end if */ - if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { - H5MM_memcpy(d, conv_buf, buf_size); - } else { - /* Write reference to destination location */ - if(dst->shared->u.atomic.u.r.cls->write( - src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, - dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") + if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { + H5MM_memcpy(conv_buf, s, buf_size); + } else { + /* Read reference */ + if(src->shared->u.atomic.u.r.cls->read( + src->shared->u.atomic.u.r.file, s, src->shared->size, + dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") + } + + if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { + H5MM_memcpy(d, conv_buf, buf_size); + } else { + /* Write reference to destination location */ + if(dst->shared->u.atomic.u.r.cls->write( + src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, + dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") + } } /* Advance pointers */ diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 1dbc229..39bff15 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -182,11 +182,15 @@ struct H5T_path_t { }; /* Reference function pointers */ +typedef herr_t (*H5T_ref_isnullfunc_t)(const H5VL_object_t *file, const void *src_buf, hbool_t *isnull); +typedef herr_t (*H5T_ref_setnullfunc_t)(H5VL_object_t *file, void *dst_buf, void *bg_buf); typedef size_t (*H5T_ref_getsizefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); typedef herr_t (*H5T_ref_readfunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); typedef herr_t (*H5T_ref_writefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); typedef struct H5T_ref_class_t { + H5T_ref_isnullfunc_t isnull; /* check if reference value is NIL */ + H5T_ref_setnullfunc_t setnull; /* set a reference value to NIL */ H5T_ref_getsizefunc_t getsize; /* get reference size (bytes) */ H5T_ref_readfunc_t read; /* read reference into buffer */ H5T_ref_writefunc_t write; /* write reference from buffer */ diff --git a/src/H5Tref.c b/src/H5Tref.c index 2e52954..57263a9 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -54,18 +54,24 @@ struct H5Tref_dsetreg { /* Local Prototypes */ /********************/ +static herr_t H5T__ref_mem_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); +static herr_t H5T__ref_mem_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf); static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); static herr_t H5T__ref_mem_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); static herr_t H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); +static herr_t H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); +static herr_t H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf); static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); static herr_t H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); static herr_t H5T__ref_disk_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf); /* For compatibility */ +static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); +static herr_t H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy); static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); @@ -75,24 +81,32 @@ static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *sr /* Class for reference in memory */ static const H5T_ref_class_t H5T_ref_mem_g = { + H5T__ref_mem_isnull, /* 'isnull' */ + H5T__ref_mem_setnull, /* 'setnull' */ H5T__ref_mem_getsize, /* 'getsize' */ H5T__ref_mem_read, /* 'read' */ H5T__ref_mem_write /* 'write' */ }; static const H5T_ref_class_t H5T_ref_disk_g = { + H5T__ref_disk_isnull, /* 'isnull' */ + H5T__ref_disk_setnull, /* 'setnull' */ H5T__ref_disk_getsize, /* 'getsize' */ H5T__ref_disk_read, /* 'read' */ H5T__ref_disk_write /* 'write' */ }; static const H5T_ref_class_t H5T_ref_obj_disk_g = { + H5T__ref_obj_disk_isnull, /* 'isnull' */ + NULL, /* 'setnull' */ H5T__ref_obj_disk_getsize, /* 'getsize' */ H5T__ref_obj_disk_read, /* 'read' */ NULL /* 'write' */ }; static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = { + H5T__ref_dsetreg_disk_isnull, /* 'isnull' */ + NULL, /* 'setnull' */ H5T__ref_dsetreg_disk_getsize, /* 'getsize' */ H5T__ref_dsetreg_disk_read, /* 'read' */ NULL /* 'write' */ @@ -268,6 +282,57 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__ref_mem_isnull + * + * Purpose: Check if it's a NULL / uninitialized reference. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, + const void *src_buf, hbool_t *isnull) +{ + const unsigned char zeros[H5T_REF_MEM_SIZE] = { 0 }; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC_NOERR + + /* Check parameters */ + HDassert(src_buf); + HDassert(isnull); + + *isnull = (0 == HDmemcmp(src_buf, zeros, H5T_REF_MEM_SIZE)) ? TRUE : FALSE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_mem_isnull() */ + + +/*------------------------------------------------------------------------- + * Function: H5T__ref_mem_setnull + * + * Purpose: Set a reference as NULL / uninitialized. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, + H5_ATTR_UNUSED void *bg_buf) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC_NOERR + + HDmemset(dst_buf, 0, H5T_REF_MEM_SIZE); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_mem_setnull() */ + + +/*------------------------------------------------------------------------- * Function: H5T__ref_mem_getsize * * Purpose: Retrieves the size of a memory based reference. @@ -484,6 +549,96 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__ref_disk_isnull + * + * Purpose: Check if it's a NULL / uninitialized reference. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, + hbool_t *isnull) +{ + const uint8_t *p = (const uint8_t *)src_buf; + H5R_type_t ref_type; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Check parameters */ + HDassert(src_file); + HDassert(src_buf); + HDassert(isnull); + + /* Try to check encoded reference type */ + ref_type = (H5R_type_t)*p++; + if(ref_type) { + /* This is a valid reference */ + *isnull = FALSE; + } else { + /* Skip the size / header */ + p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T; + + /* Check if blob ID is "nil" */ + if(H5VL_blob_specific(src_file, (void *)p, H5VL_BLOB_ISNULL, isnull) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_disk_isnull() */ + + +/*------------------------------------------------------------------------- + * Function: H5T__ref_disk_setnull + * + * Purpose: Set a reference as NULL / uninitialized. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) +{ + uint8_t *q = (uint8_t *)dst_buf; + uint8_t *p_bg = (uint8_t *)bg_buf; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(dst_file); + HDassert(dst_buf); + + /* TODO Should get rid of bg stuff */ + if(p_bg) { + /* Skip the size / header */ + p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE); + + /* Remove blob for old data */ + if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") + } /* end if */ + + /* Copy header manually so that it does not get encoded into the blob */ + HDmemset(q, 0, H5R_ENCODE_HEADER_SIZE); + q += H5R_ENCODE_HEADER_SIZE; + + /* Set the size */ + UINT32ENCODE(q, 0); + + /* Set blob ID to "nil" */ + if(H5VL_blob_specific(dst_file, q, H5VL_BLOB_SETNULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_disk_setnull() */ + + +/*------------------------------------------------------------------------- * Function: H5T__ref_disk_getsize * * Purpose: Retrieves the length of a disk based reference. @@ -562,7 +717,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size q += H5R_ENCODE_HEADER_SIZE; blob_size -= H5R_ENCODE_HEADER_SIZE; - /* Skip the length of the sequence */ + /* Skip the size */ p += H5_SIZEOF_UINT32_T; HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T)); @@ -606,10 +761,10 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, if(p_bg) { size_t p_buf_size_left = dst_size; - /* Skip the length of the reference */ - p_bg += H5_SIZEOF_UINT32_T; - HDassert(p_buf_size_left > H5_SIZEOF_UINT32_T); - p_buf_size_left -= H5_SIZEOF_UINT32_T; + /* Skip the size / header */ + p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE); + HDassert(p_buf_size_left > (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE)); + p_buf_size_left -= (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE); /* Remove blob for old data */ if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0) @@ -638,6 +793,48 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__ref_obj_disk_isnull + * + * Purpose: Check if it's a NULL / uninitialized reference. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, + const void *src_buf, hbool_t *isnull) +{ + H5F_t *src_f; + const uint8_t *p = (const uint8_t *)src_buf; + haddr_t addr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Check parameters */ + HDassert(src_file); + HDassert(src_buf); + HDassert(isnull); + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + + /* Get the object address */ + H5F_addr_decode(src_f, &p, &addr); + + /* Check if heap address is 'nil' */ + *isnull = (addr == 0) ? TRUE : FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_obj_disk_isnull() */ + + +/*------------------------------------------------------------------------- * Function: H5T__ref_obj_disk_getsize * * Purpose: Retrieves the length of a disk based reference. @@ -709,7 +906,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ /* Get object address */ if(H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size, - (unsigned char *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) + (H5VL_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") done: @@ -718,6 +915,49 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__ref_dsetreg_disk_isnull + * + * Purpose: Check if it's a NULL / uninitialized reference. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, + hbool_t *isnull) +{ + H5F_t *src_f; + const uint8_t *p = (const uint8_t *)src_buf; + haddr_t addr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Check parameters */ + HDassert(src_file); + HDassert(src_buf); + HDassert(isnull); + + /* We should assert here that the terminal connector is H5VL_NATIVE once + * there is a facility to do so -NAF 2019/10/30 */ + + /* Retrieve file from VOL object */ + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + + /* Get the heap address */ + H5F_addr_decode(src_f, &p, &addr); + + /* Check if heap address is 'nil' */ + *isnull = (addr == 0) ? TRUE : FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__ref_dsetreg_disk_isnull() */ + + +/*------------------------------------------------------------------------- * Function: H5T__ref_dsetreg_disk_getsize * * Purpose: Retrieves the length of a disk based reference. @@ -727,28 +967,28 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *file, - const void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size, +H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, + const void H5_ATTR_UNUSED *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t H5_ATTR_UNUSED *dst_copy) { size_t ret_value = sizeof(struct H5Tref_dsetreg); FUNC_ENTER_STATIC - HDassert(buf); + HDassert(src_buf); #ifndef NDEBUG { - H5F_t *f; + H5F_t *src_f; /* We should assert here that the terminal connector is H5VL_NATIVE once * there is a facility to do so -NAF 2019/10/30 */ /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(file))) + if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") - HDassert(buf_size == H5T_REF_DSETREG_DISK_SIZE(f)); + HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); } /* end block */ #endif /* NDEBUG */ diff --git a/test/trefer.c b/test/trefer.c index 7d87ea9..0f9e4f9 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -793,7 +793,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) } H5E_END_TRY; if(libver_high < H5F_LIBVER_V110) - VERIFY(ret, FAIL, "H5Dread"); + CHECK(ret, FAIL, "H5Dread"); else { CHECK(ret, FAIL, "H5Dread"); @@ -2102,7 +2102,7 @@ test_reference_compat_conv(void) hid_t tid1, tid2; /* Datatype ID */ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2}, - dims3[] = {2}; + dims3[] = {SPACE1_DIM1}; /* Purposedly set dimension larger to test NULL references */ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK];/* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ @@ -2122,8 +2122,8 @@ test_reference_compat_conv(void) /* Allocate write & read buffers */ wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1); rbuf_obj = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); - wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), 2); - rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), 2); + wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); /* Create file */ fid1 = H5Fcreate(FILE_REF_COMPAT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); |