summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5.c2
-rw-r--r--src/H5Dcompact.c31
-rw-r--r--src/H5Dcontig.c184
-rw-r--r--src/H5Distore.c303
-rw-r--r--src/H5Dpkg.h23
-rw-r--r--src/H5F.c25
-rw-r--r--src/H5G.c78
-rw-r--r--src/H5Gpkg.h1
-rw-r--r--src/H5Gprivate.h1
-rw-r--r--src/H5Gpublic.h2
-rw-r--r--src/H5HG.c62
-rw-r--r--src/H5HGprivate.h2
-rw-r--r--src/H5O.c329
-rw-r--r--src/H5Oattr.c69
-rw-r--r--src/H5Ocache.c30
-rw-r--r--src/H5Odtype.c3
-rw-r--r--src/H5Olayout.c13
-rw-r--r--src/H5Oprivate.h5
-rwxr-xr-xsrc/H5Pocpl.c2
-rw-r--r--src/H5R.c89
-rw-r--r--src/H5Rpublic.h8
-rw-r--r--src/H5Tconv.c2
-rw-r--r--src/H5Tvlen.c2
-rw-r--r--test/gheap.c4
-rwxr-xr-xtest/objcopy.c2709
-rw-r--r--tools/h5copy/h5copy.c4
26 files changed, 2386 insertions, 1597 deletions
diff --git a/src/H5.c b/src/H5.c
index 081ce5e..eadf195 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -524,7 +524,7 @@ H5_debug_mask(const char *s)
} else if (HDisdigit(*s)) {
int fd = (int)HDstrtol (s, &rest, 0);
if ((stream=HDfdopen(fd, "w"))!=NULL)
- (void)HDsetvbuf (stream, NULL, _IOLBF, 0);
+ (void)HDsetvbuf (stream, NULL, _IOLBF, (size_t)0);
s = rest;
} else {
s++;
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 842ad9c..2d17a57 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -140,6 +140,7 @@ H5D_compact_writevv(const H5D_io_info_t *io_info,
if((ret_value=H5V_memcpyvv(io_info->dset->shared->layout.u.compact.buf,dset_max_nseq,dset_curr_seq,dset_size_arr,dset_offset_arr,buf,mem_max_nseq,mem_curr_seq,mem_size_arr,mem_offset_arr))<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
+ /* Mark the compact dataset's buffer as dirty */
io_info->dset->shared->layout.u.compact.dirty = TRUE;
done:
@@ -160,8 +161,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_compact_copy(const H5O_layout_t *layout_src, H5F_t *f_dst, H5O_layout_t *layout_dst,
- H5T_t *dt_src, hid_t dxpl_id)
+H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
+ H5O_layout_t *layout_dst, H5T_t *dt_src, H5O_copy_t *cpy_info, hid_t dxpl_id)
{
hid_t tid_src = -1; /* Datatype ID for source datatype */
hid_t tid_dst = -1; /* Datatype ID for destination datatype */
@@ -176,14 +177,32 @@ H5D_compact_copy(const H5O_layout_t *layout_src, H5F_t *f_dst, H5O_layout_t *la
/* Check args */
HDassert(layout_src && H5D_COMPACT == layout_src->type);
+ HDassert(f_src);
HDassert(f_dst);
HDassert(layout_dst && H5D_COMPACT == layout_dst->type);
/* If there's a source datatype, set up type conversion information */
- if (!dt_src)
+ if(!dt_src)
/* Type conversion not necessary */
HDmemcpy(layout_dst->u.compact.buf, layout_src->u.compact.buf, layout_src->u.compact.size);
- else {
+ else if(dt_src && (H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) && (f_src != f_dst)) {
+ /* Check for expanding references */
+ if(cpy_info->expand_ref) {
+ size_t ref_count;
+
+ /* Determine # of reference elements to copy */
+ ref_count = layout_src->u.compact.size / H5T_get_size(dt_src);
+
+ /* Copy objects referenced in source buffer to destination file and set destination elements */
+ if(H5O_copy_expand_ref(f_src, layout_src->u.compact.buf, dxpl_id, f_dst,
+ layout_dst->u.compact.buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
+ } /* end if */
+ else
+ /* Reset value to zero */
+ HDmemset(layout_dst->u.compact.buf, 0, layout_src->u.compact.size);
+ } /* end if */
+ else if(dt_src && (H5T_detect_class(dt_src, H5T_VLEN) > 0) ) {
H5T_path_t *tpath_src_mem, *tpath_mem_dst; /* Datatype conversion paths */
H5T_t *dt_dst; /* Destination datatype */
H5T_t *dt_mem; /* Memory datatype */
@@ -203,7 +222,7 @@ H5D_compact_copy(const H5O_layout_t *layout_src, H5F_t *f_dst, H5O_layout_t *la
if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem)) < 0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
@@ -278,6 +297,8 @@ H5D_compact_copy(const H5O_layout_t *layout_src, H5F_t *f_dst, H5O_layout_t *la
if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
} /* end if */
+ else
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy dataset elements")
done:
if(buf_sid > 0)
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 544e092..d39c8c5 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -104,7 +104,7 @@ H5D_contig_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ )
/* Allocate space for the contiguous data */
if (HADDR_UNDEF==(layout->u.contig.addr=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.size)))
- HGOTO_ERROR (H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space")
+ HGOTO_ERROR(H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -212,7 +212,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
if(dset->shared->fill.buf) {
/* Allocate temporary buffer */
if ((buf=H5FL_BLK_MALLOC(non_zero_fill,bufsize))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
H5V_array_fill(buf, dset->shared->fill.buf, elmt_size, ptsperbuf);
@@ -232,7 +232,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id)
else
buf=H5FL_BLK_MALLOC(zero_fill,bufsize);
if(buf==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
/* Indicate that a zero fill buffer was used */
non_zero_fill_f=0;
@@ -996,8 +996,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
- H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *dt_src, hid_t dxpl_id)
+H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
+ H5O_layout_t *layout_dst, H5T_t *dt_src, H5O_copy_t *cpy_info, hid_t dxpl_id)
{
haddr_t addr_src; /* File offset in source dataset */
haddr_t addr_dst; /* File offset in destination dataset */
@@ -1023,7 +1023,8 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
H5S_t *buf_space = NULL; /* Dataspace describing buffer */
hid_t buf_sid = -1; /* ID for buffer dataspace */
hsize_t buf_dim; /* Dimension for buffer */
- hbool_t do_conv; /* Flag to indicate that type conversion should occur */
+ hbool_t is_vlen = FALSE; /* Flag to indicate that VL type conversion should occur */
+ hbool_t fix_ref = FALSE; /* Flag to indicate that ref values should be fixed */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_contig_copy, FAIL)
@@ -1045,71 +1046,83 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
/* If there's a source datatype, set up type conversion information */
if(dt_src) {
- /* Create datatype ID for src datatype */
- if((tid_src = H5I_register(H5I_DATATYPE, dt_src)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
-
- /* create a memory copy of the variable-length datatype */
- if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem)) < 0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
-
- /* create variable-length datatype at the destinaton file */
- if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
- if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
-
- /* Set up the conversion functions */
- if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
- if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
-
- /* Determine largest datatype size */
- if(0 == (src_dt_size = H5T_get_size(dt_src)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- if(0 == (mem_dt_size = H5T_get_size(dt_mem)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- max_dt_size = MAX(src_dt_size, mem_dt_size);
- if(0 == (dst_dt_size = H5T_get_size(dt_dst)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- max_dt_size = MAX(max_dt_size, dst_dt_size);
-
- /* Set maximum number of whole elements that fit in buffer */
- if(0 == (nelmts = buf_size / max_dt_size))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large")
-
- /* Set the number of bytes to transfer */
- src_nbytes = nelmts * src_dt_size;
- dst_nbytes = nelmts * dst_dt_size;
- mem_nbytes = nelmts * mem_dt_size;
-
- /* Adjust buffer size to be multiple of elements */
- buf_size = nelmts * max_dt_size;
-
- /* Create dataspace for number of elements in buffer */
- buf_dim = nelmts;
-
- /* Create the space and set the initial extent */
- if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
-
- /* Atomize */
- if((buf_sid = H5I_register(H5I_DATASPACE, buf_space)) < 0) {
- H5S_close(buf_space);
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
- } /* end if */
+ if(H5T_detect_class(dt_src, H5T_VLEN) > 0) {
+ /* Create datatype ID for src datatype */
+ if((tid_src = H5I_register(H5I_DATATYPE, dt_src)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
+
+ /* create a memory copy of the variable-length datatype */
+ if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
+ if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
+
+ /* create variable-length datatype at the destinaton file */
+ if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
+ if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
+ if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
+
+ /* Set up the conversion functions */
+ if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
+ if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst, NULL, NULL, dxpl_id, FALSE)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
+
+ /* Determine largest datatype size */
+ if(0 == (src_dt_size = H5T_get_size(dt_src)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
+ if(0 == (mem_dt_size = H5T_get_size(dt_mem)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
+ max_dt_size = MAX(src_dt_size, mem_dt_size);
+ if(0 == (dst_dt_size = H5T_get_size(dt_dst)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
+ max_dt_size = MAX(max_dt_size, dst_dt_size);
+
+ /* Set maximum number of whole elements that fit in buffer */
+ if(0 == (nelmts = buf_size / max_dt_size))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large")
+
+ /* Set the number of bytes to transfer */
+ src_nbytes = nelmts * src_dt_size;
+ dst_nbytes = nelmts * dst_dt_size;
+ mem_nbytes = nelmts * mem_dt_size;
+
+ /* Adjust buffer size to be multiple of elements */
+ buf_size = nelmts * max_dt_size;
+
+ /* Create dataspace for number of elements in buffer */
+ buf_dim = nelmts;
+
+ /* Create the space and set the initial extent */
+ if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
+
+ /* Atomize */
+ if((buf_sid = H5I_register(H5I_DATASPACE, buf_space)) < 0) {
+ H5S_close(buf_space);
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ } /* end if */
- /* Set flag to do type conversion */
- do_conv = TRUE;
+ /* Set flag to do type conversion */
+ is_vlen = TRUE;
+ }
+ /* Check for reference datatype */
+ else if((H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) && (f_src != f_dst)) {
+ /* need to fix values of reference */
+ fix_ref = TRUE;
+
+ /* Set the number of bytes to read & write to the buffer size */
+ src_nbytes = dst_nbytes = mem_nbytes = buf_size;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy dataset elements")
} /* end if */
else {
/* Type conversion not necessary */
- do_conv = FALSE;
+ is_vlen = FALSE;
/* Set the number of bytes to read & write to the buffer size */
src_nbytes = dst_nbytes = mem_nbytes = buf_size;
@@ -1121,9 +1134,13 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
/* Need extra buffer for datatype conversions, to prevent stranding/leaking memory */
- if(do_conv) {
+ if(is_vlen || fix_ref) {
if(NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
+
+ /* allocate temporary bkg buff for data conversion */
+ if(NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
} /* end if */
/* Loop over copying data */
@@ -1136,7 +1153,7 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
src_nbytes = (size_t)total_src_nbytes;
/* Adjust dataspace describing buffer */
- if(do_conv) {
+ if(is_vlen) {
/* Adjust destination & memory bytes to transfer */
nelmts = src_nbytes / src_dt_size;
dst_nbytes = nelmts * dst_dt_size;
@@ -1149,10 +1166,9 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
if(H5S_set_extent_real(buf_space, &buf_dim) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to change buffer dataspace size")
} /* end if */
- else {
+ else
/* Adjust destination & memory bytes to transfer */
dst_nbytes = mem_nbytes = src_nbytes;
- } /* end else */
} /* end if */
/* Read raw data from source file */
@@ -1160,7 +1176,7 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data")
/* Perform datatype conversion, if necessary */
- if(do_conv) {
+ if(is_vlen) {
/* Convert from source file to memory */
if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
@@ -1168,9 +1184,8 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
/* Copy into another buffer, to reclaim memory later */
HDmemcpy(reclaim_buf, buf, mem_nbytes);
- /* allocate temporary bkg buff for data conversion */
- if(NULL == (bkg = H5FL_BLK_CALLOC(type_conv, buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
+ /* Set background buffer to all zeros */
+ HDmemset(bkg, 0, buf_size);
/* Convert from memory to destination file */
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
@@ -1180,6 +1195,25 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
} /* end if */
+ else if(fix_ref) {
+ /* Check for expanding references */
+ if(cpy_info->expand_ref) {
+ size_t ref_count;
+
+ /* Determine # of reference elements to copy */
+ ref_count = src_nbytes / H5T_get_size(dt_src);
+
+ /* Copy the reference elements */
+ if(H5O_copy_expand_ref(f_src, buf, dxpl_id, f_dst, bkg, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
+
+ /* After fix ref, copy the new reference elements to the buffer to write out */
+ HDmemcpy(buf, bkg, buf_size);
+ } /* end if */
+ else
+ /* Reset value to zero */
+ HDmemset(buf, 0, src_nbytes);
+ } /* end if */
/* Write raw data to destination file */
if(H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, dst_nbytes, H5P_DATASET_XFER_DEFAULT, buf) < 0)
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 26d332a..8518763 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -192,15 +192,17 @@ typedef struct H5D_istore_it_ud3_t {
/* B-tree callback info for iteration to copy data */
typedef struct H5D_istore_it_ud4_t {
H5D_istore_bt_ud_common_t common; /* Common info for B-tree user data (must be first) */
- H5F_t *file_dst; /* Destination file for copy */
+ H5F_t *file_src; /* Source file for copy */
haddr_t addr_dst; /* Address of dest. B-tree */
void *buf; /* Buffer to hold chunk data for read/write */
+ void *bkg; /* Buffer for background information during type conversion */
size_t buf_size; /* Buffer size */
/* needed for converting variable-length data */
hid_t tid_src; /* Datatype ID for source datatype */
hid_t tid_dst; /* Datatype ID for destination datatype */
hid_t tid_mem; /* Datatype ID for memory datatype */
+ H5T_t *dt_src; /* Source datatype */
H5T_path_t *tpath_src_mem; /* Datatype conversion path from source file to memory */
H5T_path_t *tpath_mem_dst; /* Datatype conversion path from memory to dest. file */
void *reclaim_buf; /* Buffer for reclaiming data */
@@ -210,6 +212,10 @@ typedef struct H5D_istore_it_ud4_t {
/* needed for compressed variable-length data */
H5O_pline_t *pline; /* Filter pipeline */
+
+ /* needed for copy object pointed by refs */
+ H5F_t *file_dst; /* Destination file for copy */
+ H5O_copy_t *cpy_info; /* Copy options */
} H5D_istore_it_ud4_t;
/* B-tree callback info for iteration to obtain chunk address and the index of the chunk for all chunks in the B-tree. */
@@ -915,7 +921,7 @@ H5D_istore_iter_chunkmap (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt
rank = udata->common.mesg->u.chunk.ndims - 1;
if(H5V_chunk_index(rank,lt_key->offset,udata->common.mesg->u.chunk.dim,udata->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
udata->chunk_addr[chunk_index] = addr;
@@ -982,16 +988,17 @@ H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt_key
*-------------------------------------------------------------------------
*/
static int
-H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, haddr_t addr_src,
- const void UNUSED *_rt_key, void *_udata)
+H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key,
+ haddr_t addr_src, const void UNUSED *_rt_key, void *_udata)
{
H5D_istore_it_ud4_t *udata = (H5D_istore_it_ud4_t *)_udata;
const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key;
H5D_istore_ud1_t udata_dst; /* User data about new destination chunk */
- void *bkg = NULL; /* Temporary buffer for copying data */
hbool_t is_vlen = FALSE;
+ hbool_t fix_ref = FALSE;
/* General information about chunk copy */
+ void *bkg = udata->bkg;
void *buf = udata->buf;
size_t buf_size = udata->buf_size;
H5O_pline_t *pline = udata->pline;
@@ -1007,17 +1014,23 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, haddr_t a
FUNC_ENTER_NOAPI_NOINIT(H5D_istore_iter_copy)
/* Check parameter for type conversion */
- if (udata->tid_src > 0)
- is_vlen = TRUE;
+ if(udata->dt_src) {
+ if(H5T_detect_class(udata->dt_src, H5T_VLEN) > 0)
+ is_vlen = TRUE;
+ else if((H5T_get_class(udata->dt_src, FALSE) == H5T_REFERENCE) && (udata->file_src != udata->file_dst))
+ fix_ref = TRUE;
+ else
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy dataset elements")
+ } /* end if */
/* Check for filtered chunks */
- if (pline && pline->nused) {
+ if(pline && pline->nused) {
is_compressed = TRUE;
cb_struct.func = NULL; /* no callback function when failed */
} /* end if */
/* Resize the buf if it is too small to hold the data */
- if ( nbytes > buf_size) {
+ if(nbytes > buf_size) {
/* Re-allocate memory for copying the chunk */
if(NULL == (udata->buf = H5MM_realloc(udata->buf, nbytes)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed for raw data chunk")
@@ -1030,8 +1043,8 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, haddr_t a
if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, nbytes, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5B_ITER_ERROR, "unable to read raw data chunk")
- /* need to uncompress variable-length data */
- if (is_compressed && is_vlen) {
+ /* Need to uncompress variable-length & reference data elements */
+ if(is_compressed && (is_vlen | fix_ref)) {
unsigned filter_mask = lt_key->filter_mask;
if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, edc_read, cb_struct, &nbytes, &buf_size, &buf) < 0)
@@ -1057,9 +1070,8 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, haddr_t a
/* Copy into another buffer, to reclaim memory later */
HDmemcpy(reclaim_buf, buf, reclaim_buf_size);
- /* allocate temporary bkg buff for data conversion */
- if(NULL == (bkg = H5FL_BLK_CALLOC(type_conv, buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed")
+ /* Set background buffer to all zeros */
+ HDmemset(bkg, 0, buf_size);
/* Convert from memory to destination file */
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
@@ -1069,14 +1081,31 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, haddr_t a
if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, H5B_ITER_ERROR, "unable to reclaim variable-length data")
} /* end if */
+ else if(fix_ref) {
+ /* Check for expanding references */
+ /* (background buffer has already been zeroed out, if not expanding) */
+ if(udata->cpy_info->expand_ref) {
+ size_t ref_count;
+
+ /* Determine # of reference elements to copy */
+ ref_count = nbytes / H5T_get_size(udata->dt_src);
+
+ /* Copy the reference elements */
+ if(H5O_copy_expand_ref(f_src, buf, dxpl_id, udata->file_dst, bkg, ref_count, H5T_get_ref_type(udata->dt_src), udata->cpy_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
+ } /* end if */
+
+ /* After fix ref, copy the new reference elements to the buffer to write out */
+ HDmemcpy(buf, bkg, buf_size);
+ } /* end if */
/* Copy source chunk callback information for insertion */
HDmemset(&udata_dst, 0, sizeof(udata_dst));
HDmemcpy(&(udata_dst.common.key), lt_key, sizeof(H5D_istore_key_t));
udata_dst.common.mesg = udata->common.mesg; /* Share this pointer for a short while */
- /* need to compress variable-length data before writing to file*/
- if (is_compressed && is_vlen) {
+ /* Need to compress variable-length & reference data elements before writing to file */
+ if(is_compressed && (is_vlen || fix_ref) ) {
if(H5Z_pipeline(pline, 0, &(udata_dst.common.key.filter_mask), edc_read,
cb_struct, &nbytes, &buf_size, &buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_READERROR, H5B_ITER_ERROR, "output pipeline failed")
@@ -1095,9 +1124,6 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, haddr_t a
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, H5B_ITER_ERROR, "unable to write raw data to file")
done:
- if(bkg)
- H5FL_BLK_FREE(type_conv, bkg);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_iter_copy() */
@@ -1128,12 +1154,12 @@ H5D_istore_init (const H5F_t *f, const H5D_t *dset)
rdcc->nslots = H5F_RDCC_NELMTS(f);
rdcc->slot = H5FL_SEQ_CALLOC (H5D_rdcc_ent_ptr_t,rdcc->nslots);
if (NULL==rdcc->slot)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end if */
/* Allocate the shared structure */
if(H5D_istore_shared_create(f, &dset->shared->layout)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_istore_init() */
@@ -1362,7 +1388,7 @@ H5D_istore_flush (H5D_t *dset, hid_t dxpl_id, unsigned flags)
} /* end for */
if (nerrors)
- HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1415,7 +1441,7 @@ H5D_istore_dest (H5D_t *dset, hid_t dxpl_id)
nerrors++;
}
if (nerrors)
- HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
if(rdcc->slot)
H5FL_SEQ_FREE (H5D_rdcc_ent_ptr_t,rdcc->slot);
@@ -1423,9 +1449,9 @@ H5D_istore_dest (H5D_t *dset, hid_t dxpl_id)
/* Free the raw B-tree node buffer */
if(dset->shared->layout.u.chunk.btree_shared==NULL)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
if(H5RC_DEC(dset->shared->layout.u.chunk.btree_shared)<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1455,7 +1481,7 @@ H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout)
/* Allocate space for the shared structure */
if(NULL==(shared=H5FL_MALLOC(H5B_shared_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info")
/* Set up the "global" information for this file's groups */
shared->type= H5B_ISTORE;
@@ -1467,12 +1493,12 @@ H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout)
shared->sizeof_rnode = H5B_nodesize(f, shared, &shared->sizeof_keys);
assert(shared->sizeof_rnode);
if(NULL==(shared->page=H5FL_BLK_MALLOC(chunk_page,shared->sizeof_rnode)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree page")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree page")
#ifdef H5_USING_PURIFY
HDmemset(shared->page,0,shared->sizeof_rnode);
#endif /* H5_USING_PURIFY */
if(NULL==(shared->nkey=H5FL_SEQ_MALLOC(size_t,(size_t)(2*H5F_KVALUE(f,H5B_ISTORE)+1))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree page")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree page")
/* Initialize the offsets into the native key buffer */
for(u=0; u<(2*H5F_KVALUE(f,H5B_ISTORE)+1); u++)
@@ -1480,7 +1506,7 @@ HDmemset(shared->page,0,shared->sizeof_rnode);
/* Make shared B-tree info reference counted */
if(NULL==(layout->u.chunk.btree_shared=H5RC_create(shared,H5D_istore_shared_free)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1626,7 +1652,7 @@ H5D_istore_prune (const H5D_io_info_t *io_info, size_t size)
}
if (nerrors)
- HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1726,7 +1752,7 @@ H5D_istore_lock(const H5D_io_info_t *io_info,
rdcc->nhits++;
#endif
if (NULL==(chunk=H5D_istore_chunk_alloc (chunk_size,pline)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
} else {
H5D_istore_ud1_t tmp_udata; /*B-tree pass-through */
@@ -1778,7 +1804,7 @@ H5D_istore_lock(const H5D_io_info_t *io_info,
/* Chunk size on disk isn't [likely] the same size as the final chunk
* size in memory, so allocate memory big enough. */
if (NULL==(chunk = H5D_istore_chunk_alloc (chunk_size,pline)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined")
@@ -2077,7 +2103,7 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf);
/* Do I/O directly on chunk without reading it into the cache */
if ((ret_value=H5D_contig_readvv(&chk_io_info, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0)
- HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file")
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file")
} /* end if */
else {
uint8_t *chunk; /* Pointer to cached chunk in memory */
@@ -2257,9 +2283,9 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
/* Additional sanity checks when operating in parallel */
if(IS_H5FD_MPI(dset->oloc.file)) {
if (chunk_addr==HADDR_UNDEF)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk")
if (dset->shared->dcpl_cache.pline.nused>0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "cannot write to chunked storage with filters in parallel")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot write to chunked storage with filters in parallel")
} /* end if */
#endif /* H5_HAVE_PARALLEL */
@@ -2277,7 +2303,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
/* Do I/O directly on chunk without reading it into the cache */
if ((ret_value=H5D_contig_writevv(&chk_io_info, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
} /* end if */
else {
uint8_t *chunk; /* Pointer to cached chunk in memory */
@@ -2317,7 +2343,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
#endif /* OLD_WAY */
if (NULL==(chunk=H5D_istore_lock(io_info, &udata, relax, &idx_hint)))
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk")
/* Use the vectorized memory copy routine to do actual work */
if((naccessed=H5V_memcpyvv(chunk,chunk_max_nseq,chunk_curr_seq,chunk_len_arr,chunk_offset_arr,buf,mem_max_nseq,mem_curr_seq,mem_len_arr,mem_offset_arr))<0)
@@ -2325,7 +2351,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t);
if (H5D_istore_unlock(io_info, TRUE, idx_hint, chunk, (size_t)naccessed)<0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk")
/* Set return value */
ret_value=naccessed;
@@ -2582,17 +2608,17 @@ done:
static void *
H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline)
{
- void *ret_value=NULL; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_istore_chunk_alloc)
- assert(size);
- assert(pline);
+ HDassert(size);
+ HDassert(pline);
- if(pline->nused>0)
- ret_value=H5MM_malloc(size);
+ if(pline->nused > 0)
+ ret_value = H5MM_malloc(size);
else
- ret_value=H5FL_BLK_MALLOC(chunk,size);
+ ret_value = H5FL_BLK_MALLOC(chunk, size);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D_istore_chunk_alloc() */
@@ -2749,16 +2775,16 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite)
* or if there are any pipeline filters defined,
* set the "should fill" flag
*/
- if((!full_overwrite && (fill_time==H5D_FILL_TIME_ALLOC ||
- (fill_time==H5D_FILL_TIME_IFSET && fill_status==H5D_FILL_VALUE_USER_DEFINED)))
- || pline.nused>0)
- should_fill=1;
+ if((!full_overwrite && (fill_time == H5D_FILL_TIME_ALLOC ||
+ (fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)))
+ || pline.nused > 0)
+ should_fill = 1;
/* Check if fill values should be written to blocks */
if(should_fill) {
/* Allocate chunk buffer for processes to use when writing fill values */
- H5_CHECK_OVERFLOW(chunk_size,hsize_t,size_t);
- if (NULL==(chunk = H5D_istore_chunk_alloc((size_t)chunk_size,&pline)))
+ H5_CHECK_OVERFLOW(chunk_size, hsize_t, size_t);
+ if(NULL == (chunk = H5D_istore_chunk_alloc((size_t)chunk_size, &pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for chunk")
/* Fill the chunk with the proper values */
@@ -3249,7 +3275,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
/* Get the "down" sizes for each dimension */
if(H5V_array_down(rank,chunks,down_chunks)<0)
- HGOTO_ERROR (H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
/* Create a data space for a chunk & set the extent */
for(u = 0; u < rank; u++)
@@ -3298,7 +3324,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info)
/* Calculate the index of this chunk */
if(H5V_chunk_index(rank,chunk_offset,layout->u.chunk.dim,down_chunks,&store.chunk.index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
store.chunk.offset=chunk_offset;
if(NULL == (chunk = H5D_istore_lock(io_info, NULL, FALSE, &idx_hint)))
@@ -3386,7 +3412,7 @@ H5D_istore_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout)
/* Allocate the shared structure */
if(H5D_istore_shared_create(f, &tmp_layout)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
/* Delete entire B-tree */
if(H5B_delete(f, dxpl_id, H5B_ISTORE, tmp_layout.u.chunk.addr, &udata)<0)
@@ -3394,9 +3420,9 @@ H5D_istore_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout)
/* Free the raw B-tree node buffer */
if(tmp_layout.u.chunk.btree_shared==NULL)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
if(H5RC_DEC(tmp_layout.u.chunk.btree_shared)<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
} /* end if */
done:
@@ -3453,7 +3479,7 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id)
/* Get the "down" sizes for each dimension */
if(H5V_array_down(rank,chunks,down_chunks)<0)
- HGOTO_ERROR (H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
/* Fill the DXPL cache values for later use */
if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
@@ -3468,7 +3494,7 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id)
/* Calculate the index of this chunk */
if(H5V_chunk_index(rank,ent->offset,dset->shared->layout.u.chunk.dim,down_chunks,&idx)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Compute the index for the chunk entry */
old_idx=ent->idx; /* Save for later */
@@ -3486,7 +3512,7 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id)
/* Remove the old entry from the cache */
if (H5D_istore_preempt(&io_info, old_ent, TRUE )<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
} /* end if */
/* Insert this chunk into correct location in hash table */
@@ -3517,7 +3543,7 @@ done:
*/
herr_t
H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
- H5O_layout_t *layout_dst, H5T_t *dt_src, H5O_pline_t *pline, hid_t dxpl_id)
+ H5O_layout_t *layout_dst, H5T_t *dt_src, H5O_copy_t *cpy_info, H5O_pline_t *pline, hid_t dxpl_id)
{
H5D_istore_it_ud4_t udata;
H5T_path_t *tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
@@ -3527,6 +3553,7 @@ H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
size_t buf_size; /* Size of copy buffer */
size_t reclaim_buf_size; /* Size of reclaim buffer */
void *buf = NULL; /* Buffer for copying data */
+ void *bkg = NULL; /* Buffer for background during type conversion */
void *reclaim_buf = NULL; /* Buffer for reclaiming data */
H5S_t *buf_space = NULL; /* Dataspace describing buffer */
hid_t sid_buf = -1; /* ID for buffer dataspace */
@@ -3556,71 +3583,87 @@ H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
/* If there's a source datatype, set up type conversion information */
if(dt_src) {
- H5T_t *dt_dst; /* Destination datatype */
- H5T_t *dt_mem; /* Memory datatype */
- size_t mem_dt_size; /* Memory datatype size */
- size_t tmp_dt_size; /* Temp. datatype size */
- size_t max_dt_size; /* Max atatype size */
- hsize_t buf_dim; /* Dimension for buffer */
- unsigned u;
-
- /* Create datatype ID for src datatype */
- if((tid_src = H5I_register(H5I_DATATYPE, dt_src)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
-
- /* create a memory copy of the variable-length datatype */
- if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem)) < 0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
-
- /* create variable-length datatype at the destinaton file */
- if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
- if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
-
- /* Set up the conversion functions */
- if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
- if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
-
- /* Determine largest datatype size */
- if(0 == (max_dt_size = H5T_get_size(dt_src)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- if(0 == (mem_dt_size = H5T_get_size(dt_mem)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- max_dt_size = MAX(max_dt_size, mem_dt_size);
- if(0 == (tmp_dt_size = H5T_get_size(dt_dst)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- max_dt_size = MAX(max_dt_size, tmp_dt_size);
-
- /* Compute the number of elements per chunk */
- nelmts = 1;
- for(u = 0; u < (layout_src->u.chunk.ndims - 1); u++)
- nelmts *= layout_src->u.chunk.dim[u];
-
- /* Create the space and set the initial extent */
- buf_dim = nelmts;
- if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
-
- /* Atomize */
- if((sid_buf = H5I_register(H5I_DATASPACE, buf_space)) < 0) {
- H5S_close(buf_space);
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
- } /* end if */
+ if(H5T_detect_class(dt_src, H5T_VLEN) > 0) {
+ H5T_t *dt_dst; /* Destination datatype */
+ H5T_t *dt_mem; /* Memory datatype */
+ size_t mem_dt_size; /* Memory datatype size */
+ size_t tmp_dt_size; /* Temp. datatype size */
+ size_t max_dt_size; /* Max atatype size */
+ hsize_t buf_dim; /* Dimension for buffer */
+ unsigned u;
+
+ /* Create datatype ID for src datatype */
+ if((tid_src = H5I_register(H5I_DATATYPE, dt_src)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
+
+ /* create a memory copy of the variable-length datatype */
+ if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
+ if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
+
+ /* create variable-length datatype at the destinaton file */
+ if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
+ if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
+ if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
+
+ /* Set up the conversion functions */
+ if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
+ if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst, NULL, NULL, dxpl_id, FALSE)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
+
+ /* Determine largest datatype size */
+ if(0 == (max_dt_size = H5T_get_size(dt_src)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
+ if(0 == (mem_dt_size = H5T_get_size(dt_mem)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
+ max_dt_size = MAX(max_dt_size, mem_dt_size);
+ if(0 == (tmp_dt_size = H5T_get_size(dt_dst)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
+ max_dt_size = MAX(max_dt_size, tmp_dt_size);
+
+ /* Compute the number of elements per chunk */
+ nelmts = 1;
+ for(u = 0; u < (layout_src->u.chunk.ndims - 1); u++)
+ nelmts *= layout_src->u.chunk.dim[u];
+
+ /* Create the space and set the initial extent */
+ buf_dim = nelmts;
+ if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
+
+ /* Atomize */
+ if((sid_buf = H5I_register(H5I_DATASPACE, buf_space)) < 0) {
+ H5S_close(buf_space);
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ } /* end if */
- /* Set initial buffer sizes */
- buf_size = nelmts * max_dt_size;
- reclaim_buf_size = nelmts * mem_dt_size;
+ /* Set initial buffer sizes */
+ buf_size = nelmts * max_dt_size;
+ reclaim_buf_size = nelmts * mem_dt_size;
+
+ /* Allocate memory for reclaim buf */
+ if(NULL == (reclaim_buf = H5MM_malloc(reclaim_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
+ } /* end if */
+ else {
+ buf_size = layout_src->u.chunk.size;
+ reclaim_buf_size = 0;
+ } /* end else */
- /* Allocate memory for reclaim buf */
- if(NULL == (reclaim_buf = H5MM_malloc(reclaim_buf_size)))
+ /* Allocate background memory for converting the chunk */
+ if(NULL == (bkg = H5MM_malloc(buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
+
+ /* Check for reference datatype and no expanding references & clear background buffer */
+ if(!cpy_info->expand_ref &&
+ ((H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) && (f_src != f_dst)))
+ /* Reset value to zero */
+ HDmemset(bkg, 0, buf_size);
} /* end if */
else {
buf_size = layout_src->u.chunk.size;
@@ -3634,13 +3677,15 @@ H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
/* Initialize the callback structure for the source */
HDmemset(&udata, 0, sizeof udata);
udata.common.mesg = layout_src;
- udata.file_dst = f_dst;
+ udata.file_src = f_src;
udata.addr_dst = layout_dst->u.chunk.addr;
udata.buf = buf;
+ udata.bkg = bkg;
udata.buf_size = buf_size;
udata.tid_src = tid_src;
udata.tid_mem = tid_mem;
udata.tid_dst = tid_dst;
+ udata.dt_src = dt_src;
udata.tpath_src_mem = tpath_src_mem;
udata.tpath_mem_dst = tpath_mem_dst;
udata.reclaim_buf = reclaim_buf;
@@ -3648,6 +3693,8 @@ H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
udata.buf_space = buf_space;
udata.nelmts = nelmts;
udata.pline = pline;
+ udata.file_dst = f_dst;
+ udata.cpy_info = cpy_info;
/* copy the chunked data by iteration */
if(H5B_iterate(f_src, dxpl_id, H5B_ISTORE, H5D_istore_iter_copy, layout_src->u.chunk.addr, &udata) < 0)
@@ -3670,9 +3717,11 @@ done:
if(H5I_dec_ref(tid_mem) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(buf)
- H5MM_xfree (buf);
+ H5MM_xfree(buf);
+ if(bkg)
+ H5MM_xfree(bkg);
if(reclaim_buf)
- H5MM_xfree (reclaim_buf);
+ H5MM_xfree(reclaim_buf);
if(H5RC_DEC(layout_src->u.chunk.btree_shared) < 0)
HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
@@ -3812,7 +3861,7 @@ H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int inden
/* Allocate the shared structure */
if(H5D_istore_shared_create(f, &layout)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
/* Set up B-tree user data */
HDmemset(&udata, 0, sizeof udata);
@@ -3822,9 +3871,9 @@ H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int inden
/* Free the raw B-tree node buffer */
if(layout.u.chunk.btree_shared==NULL)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
if(H5RC_DEC(layout.u.chunk.btree_shared)<0)
- HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
+ HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 3022b12..b11252f 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -268,8 +268,8 @@ H5_DLL ssize_t H5D_contig_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
const void *buf);
-H5_DLL herr_t H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src,
- H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *src_dtype, hid_t dxpl_id);
+H5_DLL herr_t H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
+ H5O_layout_t *layout_dst, H5T_t *src_dtype, H5O_copy_t *cpy_info, hid_t dxpl_id);
/* Functions that operate on compact dataset storage */
H5_DLL ssize_t H5D_compact_readvv(const H5D_io_info_t *io_info,
@@ -280,8 +280,8 @@ H5_DLL ssize_t H5D_compact_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[],
const void *buf);
-H5_DLL herr_t H5D_compact_copy(const H5O_layout_t *layout_src,
- H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *src_dtype, hid_t dxpl_id);
+H5_DLL herr_t H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src,
+ H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *src_dtype, H5O_copy_t *cpy_info, hid_t dxpl_id);
/* Functions that operate on indexed storage */
/* forward reference for collective-chunk IO use */
@@ -303,17 +303,18 @@ H5_DLL herr_t H5D_istore_chunkmap(const H5D_io_info_t *io_info, haddr_t chunk_ad
H5_DLL herr_t H5D_istore_stats (H5D_t *dset, hbool_t headers);
#endif /* H5D_ISTORE_DEBUG */
H5_DLL ssize_t H5D_istore_readvv(const H5D_io_info_t *io_info,
- size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
- void *buf);
+ size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[],
+ hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq,
+ size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf);
H5_DLL ssize_t H5D_istore_writevv(const H5D_io_info_t *io_info,
- size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[],
- const void *buf);
+ size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[],
+ hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq,
+ size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf);
H5_DLL haddr_t H5D_istore_get_addr(const H5D_io_info_t *io_info,
struct H5D_istore_ud1_t *_udata);
H5_DLL herr_t H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src,
- H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *src_dtype, H5O_pline_t *pline, hid_t dxpl_id);
+ H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *src_dtype,
+ H5O_copy_t *cpy_info, H5O_pline_t *pline, hid_t dxpl_id);
/* Functions that operate on external file list (efl) storage */
H5_DLL ssize_t H5D_efl_readvv(const H5D_io_info_t *io_info,
diff --git a/src/H5F.c b/src/H5F.c
index 7df4359..455c658 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -221,8 +221,8 @@ H5F_init_interface(void)
/*
* Initialize the atom group for the file IDs.
*/
- if (H5I_register_type(H5I_FILE, (size_t)H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE)
- HGOTO_ERROR (H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface")
+ if(H5I_register_type(H5I_FILE, (size_t)H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* ========== File Creation Property Class Initialization ============*/
assert(H5P_CLS_FILE_CREATE_g!=-1);
@@ -2033,7 +2033,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if (flags & ~(H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags")
if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC))
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation")
/* Check file creation property list */
if(H5P_DEFAULT == fcpl_id)
@@ -2133,7 +2133,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file name")
if ((flags & ~H5F_ACC_PUBLIC_FLAGS) ||
(flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL))
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags")
if(H5P_DEFAULT == fapl_id)
fapl_id = H5P_FILE_ACCESS_DEFAULT;
else
@@ -2618,7 +2618,7 @@ H5F_try_close(H5F_t *f)
/* (Only try to flush the file if it was opened with write access) */
if(f->intent&H5F_ACC_RDWR) {
/* Flush and destroy all caches */
- if (H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL,
+ if(H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL,
H5F_FLUSH_INVALIDATE | H5F_FLUSH_CLOSING) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
@@ -2628,7 +2628,7 @@ H5F_try_close(H5F_t *f)
* shared H5F_file_t struct. If the reference count for the H5F_file_t
* struct reaches zero then destroy it also.
*/
- if (H5F_dest(f, H5AC_dxpl_id) < 0)
+ if(H5F_dest(f, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
done:
@@ -2666,15 +2666,15 @@ H5Fclose(hid_t file_id)
H5TRACE1("e","i",file_id);
/* Check/fix arguments. */
- if (H5I_FILE != H5I_get_type(file_id))
+ if(H5I_FILE != H5I_get_type(file_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID")
/*
* Decrement reference count on atom. When it reaches zero the file will
* be closed.
*/
- if (H5I_dec_ref (file_id)<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
+ if(H5I_dec_ref (file_id) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -2738,8 +2738,8 @@ done:
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Fget_intent
*
@@ -2759,11 +2759,12 @@ herr_t
H5Fget_intent(hid_t file_id, unsigned *intent_flags)
{
H5F_t * file = NULL;
- herr_t ret_value=SUCCEED;
+ herr_t ret_value = SUCCEED;
+
FUNC_ENTER_API(H5Fget_intent, FAIL)
H5TRACE2("e","i*Iu",file_id,intent_flags);
- if (NULL==(file=H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (file = H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* If no intent flags were passed in, exit quietly */
diff --git a/src/H5G.c b/src/H5G.c
index 468181f..db049dc 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -88,9 +88,9 @@
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-#include "H5Lprivate.h" /* Links */
/* Local macros */
#define H5G_INIT_HEAP 8192
@@ -946,24 +946,51 @@ done:
* Purpose: Copy an object (group or dataset) to destination location
* within a file or cross files. PLIST_ID is a property list
* which is used to pass user options and properties to the
- * copy.
+ * copy. The name, dst_name, must not already be taken by some
+ * other object in the destination group.
*
- * OPTIONS THAT MAY APPLY TO COPY IN THE FUTURE.
+ * H5Gcopy() will fail if the name of the destination object
+ * exists in the destination group. For example,
+ * H5Gcopy(fid_src, "/dset", fid_dst, "/dset", ...)
+ * will fail if "/dset" exists in the destination file
+ *
+ * OPTIONS THAT HAVE BEEN IMPLEMENTED.
* H5G_COPY_SHALLOW_HIERARCHY_FLAG
- * Recursively copy all objects below the group (default)
- * Only immediate members.
+ * If this flag is specified, only immediate members of
+ * the group are copied. Otherwise (default), it will
+ * recursively copy all objects below the group
* H5G_COPY_EXPAND_SOFT_LINK_FLAG
- * Keep soft links as they are (default)
- * Expand them into new objects
- * H5G_COPY_EXPAND_EXT_LINK_FLAG
- * Keep external links as they are (default)
- * Expand them into new objects
- * H5G_COPY_EXPAND_OBJ_REFERENCE_FLAG
- * Update only the values of object references (default)
- * Copy objects that are pointed by references
+ * If this flag is specified, it will copy the objects
+ * pointed by the soft links. Otherwise (default), it
+ * will copy the soft link as they are
* H5G_COPY_WITHOUT_ATTR_FLAG
- * Copy object along with all its attributes (default)
- * Copy object without copying attributes
+ * If this flag is specified, it will copy object without
+ * copying attributes. Otherwise (default), it will
+ * copy object along with all its attributes
+ * H5G_COPY_EXPAND_REFERENCE_FLAG
+ * 1) Copy object between two different files:
+ * When this flag is specified, it will copy objects that
+ * are pointed by the references and update the values of
+ * references in the destination file. Otherwise (default)
+ * the values of references in the destination will set to
+ * zero
+ * The current implementation does not handle references
+ * inside of other datatype structure. For example, if
+ * a member of compound datatype is reference, H5Gcopy()
+ * will copy that field as it is. It will not set the
+ * value to zero as default is used nor copy the object
+ * pointed by that field the flag is set
+ * 2) Copy object within the same file:
+ * This flag does not have any effect to the H5Gcopy().
+ * Datasets or attributes of references are copied as they
+ * are, i.e. values of references of the destination object
+ * are the same as the values of the source object
+ *
+ * OPTIONS THAT MAY APPLY TO COPY IN THE FUTURE.
+ * H5G_COPY_EXPAND_EXT_LINK_FLAG
+ * If this flag is specified, it will expand the external links
+ * into new objects, Otherwise (default), it will keep external
+ * links as they are (default)
*
* PROPERTIES THAT MAY APPLY TO COPY IN FUTURE
* Change data layout such as chunk size
@@ -979,7 +1006,7 @@ done:
* const char *src_name IN: Name of the source object to be copied
* hid_t dst_loc_id IN: Destination file or group identifier
* const char *dst_name IN: Name of the destination object
- * hid_t ocpypl_id IN: Properties which apply to the copy
+ * hid_t ocpypl_id IN: Properties which apply to the copy
* hid_t lcpl_id IN: Properties which apply to the new hard link
*
*
@@ -1020,6 +1047,24 @@ H5Gcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(!dst_name || !*dst_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified")
+ /* check if destination name already exists */
+ {
+ H5G_name_t tmp_path;
+ H5O_loc_t tmp_oloc;
+ H5G_loc_t tmp_loc;
+
+ /* Set up group location */
+ tmp_loc.oloc = &tmp_oloc;
+ tmp_loc.path = &tmp_path;
+ H5G_loc_reset(&tmp_loc);
+
+ /* Check if object already exists in destination */
+ if(H5G_loc_find(&dst_loc, dst_name, &tmp_loc, H5P_DEFAULT, H5AC_dxpl_id) >= 0) {
+ H5G_name_free(&tmp_path);
+ HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "destination object already exists")
+ } /* end if */
+ }
+
/* Set up opened group location to fill in */
src_loc.oloc = &src_oloc;
src_loc.path = &src_path;
@@ -2336,7 +2381,6 @@ H5G_copy(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name,
H5G_loc_t new_loc; /* Group location of object copied */
hbool_t entry_inserted=FALSE; /* Flag to indicate that the new entry was inserted into a group */
unsigned cpy_option = 0; /* Copy options */
- hid_t gcplist_id = H5P_DEFAULT; /* Group creation property list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_copy, FAIL);
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index aa7d582..164cf31 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -277,7 +277,6 @@ H5_DLLVAR const H5AC_class_t H5AC_SNODE[1];
* Utility functions
*/
H5_DLL char * H5G_normalize(const char *name);
-H5_DLL H5G_t *H5G_rootof(H5F_t *f);
H5_DLL const char * H5G_component(const char *name, size_t *size_p);
H5_DLL herr_t H5G_traverse_term_interface(void);
H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name,
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index acef4a3..d03f400 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -125,6 +125,7 @@ typedef struct H5G_shared_t H5G_shared_t;
*/
H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc);
H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp);
+H5_DLL H5G_t *H5G_rootof(H5F_t *f);
H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp);
H5_DLL H5F_t *H5G_fileof(H5G_t *grp);
H5_DLL herr_t H5G_free(H5G_t *grp);
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 52420e1..45e6f64 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -81,7 +81,7 @@ typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name,
#define H5G_COPY_SHALLOW_HIERARCHY_FLAG (0x0002u) /* Copy only immediate members */
#define H5G_COPY_EXPAND_SOFT_LINK_FLAG (0x0004u) /* Expand soft links into new objects */
#define H5G_COPY_EXPAND_EXT_LINK_FLAG (0x0008u) /* Expand external links into new objects */
-#define H5G_COPY_EXPAND_OBJ_REFERENCE_FLAG (0x0010u) /* Copy objects that are pointed by references */
+#define H5G_COPY_EXPAND_REFERENCE_FLAG (0x0010u) /* Copy objects that are pointed by references */
#define H5G_COPY_WITHOUT_ATTR_FLAG (0x0020u) /* Copy object without copying attributes */
#define H5G_COPY_ALL (0x003Fu) /* All object copying flags (for internal checking) */
diff --git a/src/H5HG.c b/src/H5HG.c
index 26133b5..8c418de 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -1081,57 +1081,63 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/)
+H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/,
+ size_t *buf_size)
{
H5HG_heap_t *heap = NULL;
- int i;
size_t size;
uint8_t *p = NULL;
void *ret_value;
- FUNC_ENTER_NOAPI(H5HG_read, NULL);
+ FUNC_ENTER_NOAPI(H5HG_read, NULL)
/* Check args */
- assert (f);
- assert (hobj);
+ HDassert(f);
+ HDassert(hobj);
/* Load the heap */
- if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
+ if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap")
- assert (hobj->idx<heap->nused);
- assert (heap->obj[hobj->idx].begin);
+ HDassert(hobj->idx < heap->nused);
+ HDassert(heap->obj[hobj->idx].begin);
size = heap->obj[hobj->idx].size;
- p = heap->obj[hobj->idx].begin + H5HG_SIZEOF_OBJHDR (f);
- if (!object && NULL==(object = H5MM_malloc (size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- HDmemcpy (object, p, size);
+ p = heap->obj[hobj->idx].begin + H5HG_SIZEOF_OBJHDR(f);
+ /* Allocate a buffer for the object read in, if the user didn't give one */
+ if(!object && NULL == (object = H5MM_malloc(size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HDmemcpy(object, p, size);
/*
* Advance the heap in the CWFS list. We might have done this already
* with the H5AC_protect(), but it won't hurt to do it twice.
*/
- if (heap->obj[0].begin) {
- for (i=0; i<f->shared->ncwfs; i++) {
- if (f->shared->cwfs[i]==heap) {
- if (i) {
- f->shared->cwfs[i] = f->shared->cwfs[i-1];
- f->shared->cwfs[i-1] = heap;
- }
+ if(heap->obj[0].begin) {
+ int i;
+
+ for(i = 0; i < f->shared->ncwfs; i++)
+ if(f->shared->cwfs[i] == heap) {
+ if(i) {
+ f->shared->cwfs[i] = f->shared->cwfs[i - 1];
+ f->shared->cwfs[i - 1] = heap;
+ } /* end if */
break;
- }
- }
- }
+ } /* end if */
+ } /* end if */
+
+ /* If the caller would like to know the heap object's size, set that */
+ if(buf_size)
+ *buf_size = size;
/* Set return value */
- ret_value=object;
+ ret_value = object;
done:
- if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, H5AC__NO_FLAGS_SET)<0)
- HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
+ if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, H5AC__NO_FLAGS_SET)<0)
+ HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header")
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HG_read() */
/*-------------------------------------------------------------------------
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index 2cfa773..c4c2d54 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -42,7 +42,7 @@ typedef struct H5HG_heap_t H5HG_heap_t;
H5_DLL herr_t H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj,
H5HG_t *hobj/*out*/);
-H5_DLL void *H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object);
+H5_DLL void *H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object, size_t *buf_size/*out*/);
H5_DLL int H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust);
H5_DLL herr_t H5HG_remove(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj);
diff --git a/src/H5O.c b/src/H5O.c
index efe1ee3..c87cd40 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -32,8 +32,10 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
-#include "H5MFprivate.h" /* File memory management */
+#include "H5HGprivate.h" /* Global Heaps */
#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
@@ -74,10 +76,16 @@ typedef struct {
hbool_t adj_link; /* Whether to adjust links when removing messages */
} H5O_iter_ud1_t;
-/* Typedef for "internal" iteration operations */
-typedef herr_t (*H5O_operator_int_t)(H5O_mesg_t *mesg/*in,out*/, unsigned idx,
+/* Typedef for "internal library" iteration operations */
+typedef herr_t (*H5O_lib_operator_t)(H5O_mesg_t *mesg/*in,out*/, unsigned idx,
unsigned * oh_flags_ptr, void *operator_data/*in,out*/);
+/* Some syntactic sugar to make the compiler happy with two different kinds of iterator callbacks */
+typedef union {
+ H5O_operator_t app_op; /* Application callback for each message */
+ H5O_lib_operator_t lib_op; /* Library internal callback for each message */
+} H5O_mesg_operator_t;
+
/*
* This table contains a list of object types, descriptions, and the
* functions that determine if some object is a particular type. The table
@@ -221,7 +229,7 @@ static herr_t H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_msg_class_t *typ
const void *mesg, unsigned flags, unsigned update_flags,
unsigned * oh_flags_ptr);
static herr_t H5O_iterate_real(const H5O_loc_t *loc, const H5O_msg_class_t *type,
- H5AC_protect_t prot, hbool_t internal, void *op, void *op_data, hid_t dxpl_id);
+ H5AC_protect_t prot, hbool_t internal, H5O_mesg_operator_t op, void *op_data, hid_t dxpl_id);
static H5G_obj_t H5O_obj_type_real(H5O_t *oh);
static const H5O_obj_class_t *H5O_obj_class(H5O_t *oh);
static void * H5O_copy_mesg_file(const H5O_msg_class_t *type, H5F_t *file_src, void *mesg_src,
@@ -229,6 +237,8 @@ static void * H5O_copy_mesg_file(const H5O_msg_class_t *type, H5F_t *file_src, v
static herr_t H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_copy_free_addrmap_cb(void *item, void *key, void *op_data);
+static herr_t H5O_copy_obj_by_ref(H5O_loc_t *src_oloc, hid_t dxpl_id,
+ H5O_loc_t *dst_oloc, H5G_loc_t *dst_root_loc, H5O_copy_t *cpy_info);
/*-------------------------------------------------------------------------
@@ -293,8 +303,7 @@ done:
} /* end if */
FUNC_LEAVE_API(ret_value)
-}
-
+} /* end H5Oopen() */
/*-------------------------------------------------------------------------
@@ -371,9 +380,9 @@ done:
} /* end if */
FUNC_LEAVE_API(ret_value)
-}
-
+} /* end H5Oopen_by_addr() */
+
/*-------------------------------------------------------------------------
* Function: H5Oclose
*
@@ -403,23 +412,23 @@ H5Oclose(hid_t object_id)
/* Get the type of the object and open it in the correct way */
switch(H5I_get_type(object_id))
{
- case(H5I_GROUP):
- case(H5I_DATATYPE):
- case(H5I_DATASET):
- if( H5I_object(object_id) == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object");
- if (H5I_dec_ref(object_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object");
- break;
+ case(H5I_GROUP):
+ case(H5I_DATATYPE):
+ case(H5I_DATASET):
+ if(H5I_object(object_id) == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object")
+ if(H5I_dec_ref(object_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
+ break;
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)");
- break;
- }
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
+ break;
+ } /* end switch */
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Oclose() */
/*-------------------------------------------------------------------------
@@ -447,6 +456,7 @@ H5Oincr_refcount(hid_t object_id)
{
H5O_loc_t *oloc;
int ret_value;
+
FUNC_ENTER_API(H5Oincr_refcount, FAIL)
H5TRACE1("Is","i",object_id);
@@ -458,7 +468,7 @@ H5Oincr_refcount(hid_t object_id)
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5O_incr_refcount() */
/*-------------------------------------------------------------------------
@@ -481,7 +491,8 @@ done:
*
*-------------------------------------------------------------------------
*/
-int H5Odecr_refcount(hid_t object_id)
+int
+H5Odecr_refcount(hid_t object_id)
{
H5O_loc_t *oloc;
int ret_value;
@@ -496,7 +507,7 @@ int H5Odecr_refcount(hid_t object_id)
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Odecr_refcount() */
/*-------------------------------------------------------------------------
@@ -1098,28 +1109,25 @@ done:
* Programmer: Robb Matzke
* Thursday, May 21, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
-H5O_copy_real (const H5O_msg_class_t *type, const void *mesg, void *dst)
+H5O_copy_real(const H5O_msg_class_t *type, const void *mesg, void *dst)
{
void *ret_value = NULL;
- FUNC_ENTER_NOAPI_NOINIT(H5O_copy_real);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_copy_real)
/* check args */
- assert (type);
- assert (type->copy);
+ HDassert(type);
+ HDassert(type->copy);
- if (mesg) {
- if (NULL==(ret_value=(type->copy)(mesg, dst, 0)))
- HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message");
- }
+ if(mesg)
+ if(NULL == (ret_value = (type->copy)(mesg, dst, 0)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_copy_real() */
@@ -1157,7 +1165,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
HDassert(loc->file);
HDassert(H5F_addr_defined(loc->addr));
if(adjust != 0 && 0 == (loc->file->intent & H5F_ACC_RDWR))
- HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
/* get header */
if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr,
@@ -1287,7 +1295,7 @@ H5O_count_real(H5O_loc_t *loc, const H5O_msg_class_t *type, hid_t dxpl_id)
/* Load the object header */
if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Loop over all messages, counting the ones of the type looked for */
for(u = acc = 0; u < oh->nmesgs; u++)
@@ -1514,7 +1522,7 @@ H5O_read_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, int sequence, v
* returning.
*/
if(NULL==(ret_value = (type->copy) (oh->mesg[idx].native, mesg, 0)))
- HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space")
} /* end else */
done:
@@ -1710,7 +1718,7 @@ H5O_modify_real(H5O_loc_t *loc, const H5O_msg_class_t *type, int overwrite,
HDassert(0 == (flags & ~H5O_FLAG_BITS));
if(0 == (loc->file->intent & H5F_ACC_RDWR))
- HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
@@ -1744,7 +1752,7 @@ H5O_modify_real(H5O_loc_t *loc, const H5O_msg_class_t *type, int overwrite,
} else if(oh->mesg[idx].flags & H5O_FLAG_CONSTANT) {
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
} else if(oh->mesg[idx].flags & H5O_FLAG_SHARED) {
- HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify shared (constant) message")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify shared (constant) message")
}
/* Write the information to the message */
@@ -1797,7 +1805,7 @@ H5O_protect(H5O_loc_t *loc, hid_t dxpl_id)
HDassert(H5F_addr_defined(loc->addr));
if(0 == (loc->file->intent & H5F_ACC_RDWR))
- HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file")
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file")
if(NULL == (ret_value = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header")
@@ -1980,7 +1988,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_msg_class_t *orig_t
HDmemset(sh_mesg,0,sizeof(H5O_shared_t));
if (NULL==orig_type->get_share)
- HGOTO_ERROR (H5E_OHDR, H5E_UNSUPPORTED, UFAIL, "message class is not sharable");
+ HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, UFAIL, "message class is not sharable");
if ((orig_type->get_share)(f, orig_mesg, sh_mesg/*out*/) < 0) {
/*
* If the message isn't shared then turn off the shared bit
@@ -2001,7 +2009,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_msg_class_t *orig_t
/* Compute the size needed to store the message on disk */
if ((size = ((*new_type)->raw_size) (f, *new_mesg)) >=H5O_MAX_SIZE)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large");
/* Allocate space in the object headed for the message */
if ((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
@@ -2009,7 +2017,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_msg_class_t *orig_t
/* Increment any links in message */
if((*new_type)->link && ((*new_type)->link)(f,dxpl_id,(*new_mesg)) < 0)
- HGOTO_ERROR (H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared object link count");
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared object link count");
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -2485,9 +2493,10 @@ done:
*/
static herr_t
H5O_remove_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, int sequence,
- H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id)
+ H5O_operator_t app_op, void *op_data, hbool_t adj_link, hid_t dxpl_id)
{
H5O_iter_ud1_t udata; /* User data for iterator */
+ H5O_mesg_operator_t op; /* Wrapper for operator */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_remove_real)
@@ -2498,19 +2507,20 @@ H5O_remove_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, int sequence,
HDassert(type);
if (0==(loc->file->intent & H5F_ACC_RDWR))
- HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Set up iterator operator data */
udata.f = loc->file;
udata.dxpl_id = dxpl_id;
udata.sequence = sequence;
udata.nfailed = 0;
- udata.op = op;
+ udata.op = app_op;
udata.op_data = op_data;
udata.adj_link = adj_link;
/* Iterate over the messages, deleting appropriate one(s) */
- if(H5O_iterate_real(loc, type, H5AC_WRITE, TRUE, (void *)H5O_remove_cb, &udata, dxpl_id) < 0)
+ op.lib_op = H5O_remove_cb;
+ if(H5O_iterate_real(loc, type, H5AC_WRITE, TRUE, op, &udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over messages")
/* Fail if we tried to remove any constant messages */
@@ -3622,11 +3632,11 @@ H5O_share (H5F_t *f, hid_t dxpl_id, const H5O_msg_class_t *type, const void *mes
/* Encode the message put it in the global heap */
if ((size = (type->raw_size)(f, mesg))>0) {
if (NULL==(buf = H5MM_malloc (size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
if ((type->encode)(f, buf, mesg) < 0)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
if (H5HG_insert (f, dxpl_id, size, buf, hobj) < 0)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL, "unable to store message in global heap");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to store message in global heap");
}
done:
@@ -3670,7 +3680,7 @@ H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg)
/* Compute the raw data size for the mesg */
if ((ret_value = (type->raw_size)(f, mesg))==0)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3709,7 +3719,7 @@ H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg)
/* Compute the raw data size for the mesg */
if((ret_value = (type->raw_size)(f, mesg)) == 0)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
/* Adjust size for alignment, if necessary */
ret_value = H5O_ALIGN(ret_value);
@@ -3760,7 +3770,7 @@ H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share)
/* Compute the raw data size for the mesg */
if((ret_value = (type->get_share)(f, mesg, share)) < 0)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve shared message information")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve shared message information")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4005,7 +4015,7 @@ H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id)
/* Encode */
if ((type->encode)(f, buf, obj) < 0)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4045,7 +4055,7 @@ H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id)
/* decode */
if((ret_value = (type->decode)(f, 0, buf))==NULL)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message");
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4084,11 +4094,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_iterate(const H5O_loc_t *loc, unsigned type_id, H5O_operator_t op,
+H5O_iterate(const H5O_loc_t *loc, unsigned type_id, H5O_operator_t app_op,
void *op_data, hid_t dxpl_id)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- herr_t ret_value; /* Return value */
+ H5O_mesg_operator_t op; /* Wrapper for operator */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_iterate, FAIL)
@@ -4101,7 +4112,8 @@ H5O_iterate(const H5O_loc_t *loc, unsigned type_id, H5O_operator_t op,
HDassert(type);
/* Call the "real" iterate routine */
- if((ret_value = H5O_iterate_real(loc, type, H5AC_READ, FALSE, (void *)op, op_data, dxpl_id)) < 0)
+ op.app_op = app_op;
+ if((ret_value = H5O_iterate_real(loc, type, H5AC_READ, FALSE, op, op_data, dxpl_id)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to iterate over object header messages")
done:
@@ -4144,7 +4156,7 @@ done:
*/
static herr_t
H5O_iterate_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, H5AC_protect_t prot,
- hbool_t internal, void *op, void *op_data, hid_t dxpl_id)
+ hbool_t internal, H5O_mesg_operator_t op, void *op_data, hid_t dxpl_id)
{
H5O_t *oh = NULL; /* Pointer to actual object header */
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Start iteration with no flags set on object header */
@@ -4160,7 +4172,7 @@ H5O_iterate_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, H5AC_protect
HDassert(loc->file);
HDassert(H5F_addr_defined(loc->addr));
HDassert(type);
- HDassert(op);
+ HDassert(op.app_op);
/* Protect the object header to iterate over */
if (NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, prot)))
@@ -4178,12 +4190,12 @@ H5O_iterate_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, H5AC_protect
/* Check for making an "internal" (i.e. within the H5O package) callback */
if(internal) {
/* Call the "internal" iterator callback */
- if((ret_value = ((H5O_operator_int_t)op)(idx_msg, sequence, &oh_flags, op_data)) != 0)
+ if((ret_value = (op.lib_op)(idx_msg, sequence, &oh_flags, op_data)) != 0)
break;
} /* end if */
else {
/* Call the iterator callback */
- if((ret_value = ((H5O_operator_t)op)(idx_msg->native, sequence, op_data)) != 0)
+ if((ret_value = (op.app_op)(idx_msg->native, sequence, op_data)) != 0)
break;
} /* end else */
@@ -4635,7 +4647,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Create memory image for the new chunk */
if(NULL == (oh_dst->chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image, chunk_size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the chunk image from source to destination in memory */
/* (This copies over all the messages which don't require special
@@ -4913,6 +4925,9 @@ H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* When an object is copied for the first time, increment it's link */
inc_link = TRUE;
+
+ /* indicate that a new object is created */
+ ret_value++;
} /* end if */
else {
/* Object has already been copied, set it's address in destination file */
@@ -5013,8 +5028,8 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
cpy_info.expand_soft_link = TRUE;
if((cpy_option & H5G_COPY_EXPAND_EXT_LINK_FLAG) > 0)
cpy_info.expand_ext_link = TRUE;
- if((cpy_option & H5G_COPY_EXPAND_OBJ_REFERENCE_FLAG) > 0)
- cpy_info.expand_obj_ref = TRUE;
+ if((cpy_option & H5G_COPY_EXPAND_REFERENCE_FLAG) > 0)
+ cpy_info.expand_ref = TRUE;
if((cpy_option & H5G_COPY_WITHOUT_ATTR_FLAG) > 0)
cpy_info.copy_without_attr = TRUE;
@@ -5071,7 +5086,7 @@ H5O_debug_id(unsigned type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *
/* Call the debug method in the class */
if ((ret_value = (type->debug)(f, dxpl_id, mesg, stream, indent, fwidth)) < 0)
- HGOTO_ERROR (H5E_OHDR, H5E_BADTYPE, FAIL, "unable to debug message");
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "unable to debug message");
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5156,7 +5171,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
/* debug each message */
if (NULL==(sequence = H5MM_calloc(NELMTS(H5O_msg_class_g)*sizeof(int))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
for (i=0, mesg_total=0; i < oh->nmesgs; i++) {
mesg_total += H5O_SIZEOF_MSGHDR(f) + oh->mesg[i].raw_size;
HDfprintf(stream, "%*sMessage %d...\n", indent, "", i);
@@ -5252,6 +5267,184 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_copy_obj_by_ref
+ *
+ * Purpose: Copy the object pointed by _src_ref.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * Aug 7 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_copy_obj_by_ref(H5O_loc_t *src_oloc, hid_t dxpl_id, H5O_loc_t *dst_oloc,
+ H5G_loc_t *dst_root_loc, H5O_copy_t *cpy_info)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(H5O_copy_obj_by_ref, FAIL)
+
+ HDassert(src_oloc);
+ HDassert(dst_oloc);
+
+ /* Perform the copy, or look up existing copy */
+ if((ret_value = H5O_copy_header_map(src_oloc, dst_oloc, dxpl_id, cpy_info, FALSE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+ /* Check if a new valid object is copied to the destination */
+ if(H5F_addr_defined(dst_oloc->addr) && (ret_value > SUCCEED)) {
+ char tmp_obj_name[80];
+ H5G_name_t new_path;
+ H5O_loc_t new_oloc;
+ H5G_loc_t new_loc;
+
+ /* Set up group location for new object */
+ new_loc.oloc = &new_oloc;
+ new_loc.path = &new_path;
+ H5G_loc_reset(&new_loc);
+ new_oloc.file = dst_oloc->file;
+ new_oloc.addr = dst_oloc->addr;
+
+ /* Pick a default name for the new object */
+ sprintf(tmp_obj_name, "~obj_pointed_by_%llu", (unsigned long_long)dst_oloc->addr);
+
+ /* Create a link to the newly copied object */
+ if(H5L_link(dst_root_loc, tmp_obj_name, &new_loc, H5P_DEFAULT, H5P_DEFAULT, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
+
+ H5G_loc_free(&new_loc);
+ } /* if (H5F_addr_defined(dst_oloc.addr)) */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_copy_obj_by_ref() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_copy_expand_ref
+ *
+ * Purpose: Copy the object pointed by _src_ref.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * Aug 7 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id,
+ H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type,
+ H5O_copy_t *cpy_info)
+{
+ H5O_loc_t dst_oloc; /* Copied object object location */
+ H5O_loc_t src_oloc; /* Temporary object location for source object */
+ H5G_loc_t dst_root_loc; /* The location of root group of the destination file */
+ size_t i; /* Local index variable */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(H5O_copy_expand_ref, FAIL)
+
+ /* Sanity checks */
+ HDassert(file_src);
+ HDassert(_src_ref);
+ HDassert(file_dst);
+ HDassert(_dst_ref);
+ HDassert(ref_count);
+ HDassert(cpy_info);
+
+ /* Initialize object locations */
+ H5O_loc_reset(&src_oloc);
+ H5O_loc_reset(&dst_oloc);
+ src_oloc.file = file_src;
+ dst_oloc.file = file_dst;
+
+ /* Set up the root group in the destination file */
+ if(NULL == (dst_root_loc.oloc = H5G_oloc(H5G_rootof(file_dst))))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group")
+ if(NULL == (dst_root_loc.path = H5G_nameof(H5G_rootof(file_dst))))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group")
+
+ /* Copy object references */
+ if(H5R_OBJECT == ref_type) {
+ hobj_ref_t *src_ref = (hobj_ref_t *)_src_ref;
+ hobj_ref_t *dst_ref = (hobj_ref_t *)_dst_ref;
+
+ /* Making equivalent references in the destination file */
+ for(i = 0; i < ref_count; i++) {
+ /* Set up for the object copy for the reference */
+ src_oloc.addr = src_ref[i];
+ dst_oloc.addr = HADDR_UNDEF;
+
+ /* Attempt to copy object from source to destination file */
+ if(H5O_copy_obj_by_ref(&src_oloc, dxpl_id, &dst_oloc, &dst_root_loc, cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+ /* Set the object reference info for the destination file */
+ dst_ref[i] = dst_oloc.addr;
+ } /* end for */
+ } /* end if */
+ /* Copy region references */
+ else if(H5R_DATASET_REGION == ref_type) {
+ hdset_reg_ref_t *src_ref = (hdset_reg_ref_t *)_src_ref;
+ hdset_reg_ref_t *dst_ref = (hdset_reg_ref_t *)_dst_ref;
+ uint8_t *buf; /* Buffer to store serialized selection in */
+ uint8_t *p; /* Pointer to OID to store */
+ H5HG_t hobjid; /* Heap object ID */
+ size_t buf_size; /* Length of object in heap */
+
+ /* Making equivalent references in the destination file */
+ for(i = 0; i < ref_count; i++) {
+ /* Get the heap ID for the dataset region */
+ p = (uint8_t *)(&src_ref[i]);
+ H5F_addr_decode(src_oloc.file, (const uint8_t **)&p, &(hobjid.addr));
+ INT32DECODE(p, hobjid.idx);
+
+ /* Get the dataset region from the heap (allocate inside routine) */
+ if((buf = H5HG_read(src_oloc.file, dxpl_id, &hobjid, NULL, &buf_size)) == NULL)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
+
+ /* Get the object oid for the dataset */
+ p = (uint8_t *)buf;
+ H5F_addr_decode(src_oloc.file, (const uint8_t **)&p, &(src_oloc.addr));
+ dst_oloc.addr = HADDR_UNDEF;
+
+ /* copy the object pointed by the ref to the destination */
+ if(H5O_copy_obj_by_ref(&src_oloc, dxpl_id, &dst_oloc, &dst_root_loc, cpy_info) < 0) {
+ H5MM_xfree(buf);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
+ } /* end if */
+
+ /* Serialize object ID */
+ p = (uint8_t *)buf;
+ H5F_addr_encode(dst_oloc.file, &p, dst_oloc.addr);
+
+ /* Save the serialized buffer to the destination */
+ if(H5HG_insert(dst_oloc.file, dxpl_id, buf_size, buf, &hobjid) < 0) {
+ H5MM_xfree(buf);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "Unable to write dataset region information")
+ } /* end if */
+
+ /* Set the dataset region reference info for the destination file */
+ p = (uint8_t *)(&dst_ref[i]);
+ H5F_addr_encode(dst_oloc.file, &p, hobjid.addr);
+ INT32ENCODE(p, hobjid.idx);
+
+ /* Free the buffer allocated in H5HG_read() */
+ H5MM_xfree(buf);
+ } /* end for */
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_copy_expand_ref() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_debug
*
* Purpose: Prints debugging info about an object header.
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 84bb09d..1ab461d 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -132,12 +132,12 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
assert(p);
if (NULL==(attr = H5FL_CALLOC(H5A_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Version number */
version = *p++;
if (version<H5O_ATTR_VERSION_1 || version>H5O_ATTR_VERSION_3)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for attribute message");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for attribute message")
/* Get the flags byte if we have a later version of the attribute */
if(version>H5O_ATTR_VERSION_1)
@@ -162,7 +162,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
/* Decode and store the name */
if (NULL==(attr->name=H5MM_strdup((const char *)p)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if(version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN(name_len); /* advance the memory pointer */
else
@@ -174,18 +174,18 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
/* Get the shared information */
if (NULL == (shared = (H5O_MSG_SHARED->decode) (f, dxpl_id, p)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
/* Get the actual datatype information */
if((attr->dt= H5O_shared_read(f, dxpl_id, shared, H5O_MSG_DTYPE, NULL))==NULL)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
/* Free the shared information */
H5O_free_real(H5O_MSG_SHARED, shared);
} /* end if */
else {
if((attr->dt=(H5O_MSG_DTYPE->decode)(f,dxpl_id,p))==NULL)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
} /* end else */
if(version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN(attr->dt_size);
@@ -194,10 +194,10 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
/* decode the attribute dataspace */
if (NULL==(attr->ds = H5FL_CALLOC(H5S_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if((extent=(H5O_MSG_SDSPACE->decode)(f,dxpl_id,p))==NULL)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information */
HDmemcpy(&(attr->ds->extent),extent, sizeof(H5S_extent_t));
@@ -207,7 +207,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
/* Default to entire dataspace being selected */
if(H5S_select_all(attr->ds,0)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
if(version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN(attr->ds_size);
@@ -220,7 +220,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
/* Go get the data */
if(attr->data_size) {
if (NULL==(attr->data = H5FL_BLK_MALLOC(attr_buf, attr->data_size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(attr->data,p,attr->data_size);
}
@@ -342,16 +342,16 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
/* Get shared message information from datatype */
if ((H5O_MSG_DTYPE->get_share)(f, attr->dt, &sh_mesg/*out*/)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype")
/* Encode shared message information for datatype */
if((H5O_MSG_SHARED->encode)(f,p,&sh_mesg)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype")
} /* end if */
else {
/* Encode datatype information */
if((H5O_MSG_DTYPE->encode)(f,p,attr->dt)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute datatype");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute datatype")
} /* end else */
if(version < H5O_ATTR_VERSION_2) {
HDmemset(p+attr->dt_size, 0, H5O_ALIGN(attr->dt_size)-attr->dt_size);
@@ -362,7 +362,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
/* encode the attribute dataspace */
if((H5O_MSG_SDSPACE->encode)(f,p,&(attr->ds->extent))<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute dataspace");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute dataspace")
if(version < H5O_ATTR_VERSION_2) {
HDmemset(p+attr->ds_size, 0, H5O_ALIGN(attr->ds_size)-attr->ds_size);
p += H5O_ALIGN(attr->ds_size);
@@ -409,7 +409,7 @@ H5O_attr_copy(const void *_src, void *_dst, unsigned update_flags)
/* copy */
if (NULL == (ret_value = H5A_copy(_dst,src,update_flags)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "can't copy attribute");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "can't copy attribute")
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -589,7 +589,7 @@ H5O_attr_delete(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_l
/* Decrement the reference count on the shared datatype, if requested */
if(adj_link)
if(H5T_link(attr->dt, -1, dxpl_id)<0)
- HGOTO_ERROR (H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count")
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count")
} /* end if */
done:
@@ -628,7 +628,7 @@ H5O_attr_link(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg)
if(H5T_committed(attr->dt)) {
/* Increment the reference count on the shared datatype */
if(H5T_link(attr->dt,1,dxpl_id)<0)
- HGOTO_ERROR (H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count");
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count")
} /* end if */
done:
@@ -685,13 +685,14 @@ H5O_attr_pre_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t UNUSED *typ
* November 1, 2005
*
* Modifications: Peter Cao
- * December 17, 2005
- * Datatype conversion for variable length datatype
+ * December 17, 2005: datatype conversion for variable length datatype
+ * August 1, 2006: fix reference datatype
+ *
*
*-------------------------------------------------------------------------
*/
static void *
-H5O_attr_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst,
+H5O_attr_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst,
hid_t dxpl_id, H5O_copy_t *cpy_info, void UNUSED *udata)
{
H5A_t *attr_src = (H5A_t *)native_src;
@@ -808,7 +809,7 @@ H5O_attr_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst,
if(NULL == (dt_mem = H5T_copy(attr_src->dt, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem)) < 0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register memory datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register memory datatype")
/* create variable-length datatype at the destinaton file */
if((tid_dst = H5I_register(H5I_DATATYPE, attr_dst->dt)) < 0)
@@ -874,12 +875,32 @@ H5O_attr_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst,
if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data")
- } /* type conversion */
+ } /* end if */
+ else if((H5T_get_class(attr_src->dt, FALSE) == H5T_REFERENCE) && (file_src != file_dst)) {
+ /* copy object pointed by reference. The current implementation does not deal with
+ nested reference such as reference in a compound structure */
+
+ /* Check for expanding references */
+ if(cpy_info->expand_ref) {
+ size_t ref_count;
+
+ /* Determine # of reference elements to copy */
+ ref_count = attr_dst->data_size / attr_dst->dt_size;
+
+ /* Copy objects referenced in source buffer to destination file and set destination elements */
+ if(H5O_copy_expand_ref(file_src, attr_src->data, dxpl_id,
+ file_dst, attr_dst->data, ref_count, H5T_get_ref_type(attr_src->dt), cpy_info) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy reference attribute")
+ } /* end if */
+ else
+ /* Reset value to zero */
+ HDmemset(attr_dst->data, 0, attr_dst->data_size);
+ } /* end if */
else {
HDassert(attr_dst->data_size == attr_src->data_size);
HDmemcpy(attr_dst->data, attr_src->data, attr_src->data_size);
} /* end else */
- } /* end if */
+ } /* end if(attr_src->data) */
/* Indicate that the fill values aren't to be written out */
attr_dst->initialized = TRUE;
@@ -980,7 +1001,7 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in
/* Get shared message information from datatype */
if ((H5O_MSG_DTYPE->get_share)(f, mesg->dt, &sh_mesg/*out*/)<0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't retrieve shared message information");
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't retrieve shared message information")
debug=H5O_MSG_SHARED->debug;
dt_mesg=&sh_mesg;
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 728ac6e..3ef502b 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -442,40 +442,40 @@ done:
herr_t
H5O_dest(H5F_t UNUSED *f, H5O_t *oh)
{
- unsigned i;
+ unsigned u; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_dest);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_dest)
/* check args */
- assert(oh);
+ HDassert(oh);
/* Verify that node is clean */
- assert (oh->cache_info.is_dirty==FALSE);
+ HDassert(oh->cache_info.is_dirty == FALSE);
/* destroy chunks */
- for (i = 0; i < oh->nchunks; i++) {
+ for(u = 0; u < oh->nchunks; u++) {
/* Verify that chunk is clean */
- assert (oh->chunk[i].dirty==0);
+ HDassert(oh->chunk[u].dirty == 0);
- oh->chunk[i].image = H5FL_BLK_FREE(chunk_image,oh->chunk[i].image);
- }
+ oh->chunk[u].image = H5FL_BLK_FREE(chunk_image, oh->chunk[u].image);
+ } /* end for */
if(oh->chunk)
- oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t,oh->chunk);
+ oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t, oh->chunk);
/* destroy messages */
- for (i = 0; i < oh->nmesgs; i++) {
+ for(u = 0; u < oh->nmesgs; u++) {
/* Verify that message is clean */
- assert (oh->mesg[i].dirty==0);
+ HDassert(oh->mesg[u].dirty == 0);
- H5O_free_mesg(&oh->mesg[i]);
- }
+ H5O_free_mesg(&oh->mesg[u]);
+ } /* end for */
if(oh->mesg)
- oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t,oh->mesg);
+ oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg);
/* destroy object header */
H5FL_FREE(H5O_t,oh);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_dest() */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index b5b441a..afe6e27 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -1236,7 +1236,8 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *type,
* of the datatype if it's a vlen datatype)
*/
if(udata) {
- if(H5T_detect_class(dt_src, H5T_VLEN) > 0) {
+ if((H5T_detect_class(dt_src, H5T_VLEN) > 0) ||
+ (H5T_get_class(dt_src, FALSE) == H5T_REFERENCE)) {
/* Create a memory copy of the variable-length datatype */
if(NULL == (udata->src_dtype = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index ff7f085..21c2820 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -622,7 +622,7 @@ done:
*/
static void *
H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hid_t dxpl_id,
- H5O_copy_t UNUSED *cpy_info, void *_udata)
+ H5O_copy_t *cpy_info, void *_udata)
{
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
H5O_layout_t *layout_src = (H5O_layout_t *) mesg_src;
@@ -650,20 +650,20 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hid_t dxp
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
/* copy compact raw data */
- if(H5D_compact_copy(layout_src, file_dst, layout_dst, udata->src_dtype, dxpl_id) < 0)
+ if(H5D_compact_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy chunked storage")
layout_dst->u.compact.dirty = TRUE;
/* Freed by copy routine */
udata->src_dtype = NULL;
- }
+ } /* end if */
break;
case H5D_CONTIGUOUS:
if(H5F_addr_defined(layout_src->u.contig.addr)) {
/* create contig layout */
- if(H5D_contig_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, dxpl_id) < 0)
+ if(H5D_contig_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy contiguous storage")
/* Freed by copy routine */
@@ -677,8 +677,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hid_t dxp
layout_dst->u.chunk.addr = HADDR_UNDEF;
/* create chunked layout */
- if(H5D_istore_copy(file_src, layout_src, file_dst, layout_dst,
- udata->src_dtype, udata->src_pline, dxpl_id) < 0)
+ if(H5D_istore_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, udata->src_pline, dxpl_id) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy chunked storage")
/* Freed by copy routine */
@@ -691,7 +690,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hid_t dxp
} /* end switch */
/* Set return value */
- ret_value=layout_dst;
+ ret_value = layout_dst;
done:
if(!ret_value)
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 4a6a0c5..10b6c31 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -74,7 +74,7 @@ typedef struct H5O_copy_t {
hbool_t copy_shallow; /* Flag to perform shallow hierarchy copy */
hbool_t expand_soft_link; /* Flag to expand soft links */
hbool_t expand_ext_link; /* Flag to expand external links */
- hbool_t expand_obj_ref; /* Flag to expand object references */
+ hbool_t expand_ref; /* Flag to expand object references */
hbool_t copy_without_attr; /* Flag to not copy attributes */
int curr_depth; /* Current depth in hierarchy copied */
int max_depth; /* Maximum depth in hierarchy to copy */
@@ -371,6 +371,9 @@ H5_DLL herr_t H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*o
H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
hid_t dxpl_id, H5O_copy_t *cpy_info, hbool_t inc_depth);
H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth);
+H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id,
+ H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type,
+ H5O_copy_t *cpy_info);
H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
int fwidth);
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index 23000f1..717ed38 100755
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -37,7 +37,7 @@
* H5G_COPY_SHALLOW_HIERARCHY_FLAG -- Copy only immediate members
* H5G_COPY_EXPAND_SOFT_LINK_FLAG -- Expand soft links into new objects/
* H5G_COPY_EXPAND_EXT_LINK_FLAG -- Expand external links into new objects
- * H5G_COPY_EXPAND_OBJ_REFERENCE_FLAG -- Copy objects that are pointed by references
+ * H5G_COPY_EXPAND_REFERENCE_FLAG -- Copy objects that are pointed by references
* H5G_COPY_WITHOUT_ATTR_FLAG -- Copy object without copying attributes
*
* Return: Non-negative on success/Negative on failure
diff --git a/src/H5R.c b/src/H5R.c
index 0a3af40..f28b904 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -35,9 +35,9 @@
/* Static functions */
static herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
-static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
-static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, void *_ref);
-static H5G_obj_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
+static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref);
+static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref);
+static H5G_obj_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref);
/*--------------------------------------------------------------------------
@@ -334,12 +334,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hid_t
-H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
+H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref)
{
H5O_loc_t oloc; /* Object location */
H5G_name_t path; /* Path of object */
H5G_loc_t loc; /* Group location */
- uint8_t *p; /* Pointer to OID to store */
+ const uint8_t *p; /* Pointer to OID to store */
int oid_type; /* type of object being dereferenced */
hid_t ret_value;
@@ -355,31 +355,27 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
switch(ref_type) {
case H5R_OBJECT:
- {
- hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Only object references currently supported */
-
- oloc.addr = *ref;
- } /* end case */
- break;
+ oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
+ break;
case H5R_DATASET_REGION:
{
- hdset_reg_ref_t *ref = (hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
+ const hdset_reg_ref_t *ref = (const hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
H5HG_t hobjid; /* Heap object ID */
uint8_t *buf; /* Buffer to store serialized selection in */
/* Get the heap ID for the dataset region */
- p = (uint8_t *)ref;
- H5F_addr_decode(oloc.file, (const uint8_t **)&p, &(hobjid.addr));
+ p = (const uint8_t *)ref;
+ H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
INT32DECODE(p, hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
- if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL)) == NULL)
+ if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
/* Get the object oid for the dataset */
- p = (uint8_t *)buf;
- H5F_addr_decode(oloc.file, (const uint8_t **)&p, &(oloc.addr));
+ p = buf;
+ H5F_addr_decode(oloc.file, &p, &(oloc.addr));
/* Free the buffer allocated in H5HG_read() */
H5MM_xfree(buf);
@@ -486,7 +482,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
-H5Rdereference(hid_t id, H5R_type_t ref_type, void *_ref)
+H5Rdereference(hid_t id, H5R_type_t ref_type, const void *_ref)
{
H5G_loc_t loc; /* Group location */
H5F_t *file = NULL; /* File object */
@@ -537,13 +533,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_t *
-H5R_get_region(H5F_t *file, hid_t dxpl_id, void *_ref)
+H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref)
{
H5O_loc_t oloc; /* Object location */
- uint8_t *p; /* Pointer to OID to store */
- hdset_reg_ref_t *ref = (hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
- H5HG_t hobjid; /* Heap object ID */
- uint8_t *buf; /* Buffer to store serialized selection in */
+ const uint8_t *p; /* Pointer to OID to store */
+ const hdset_reg_ref_t *ref = (const hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
+ H5HG_t hobjid; /* Heap object ID */
+ uint8_t *buf = NULL; /* Buffer to store serialized selection in */
H5S_t *ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5R_get_region)
@@ -556,17 +552,17 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, void *_ref)
oloc.file = file;
/* Get the heap ID for the dataset region */
- p = (uint8_t *)ref;
- H5F_addr_decode(oloc.file, (const uint8_t **)&p, &(hobjid.addr));
- INT32DECODE(p,hobjid.idx);
+ p = (const uint8_t *)ref;
+ H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
+ INT32DECODE(p, hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
- if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL)) == NULL)
+ if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information")
/* Get the object oid for the dataset */
- p = (uint8_t *)buf;
- H5F_addr_decode(oloc.file, (const uint8_t **)&p, &(oloc.addr));
+ p = buf;
+ H5F_addr_decode(oloc.file, &p, &(oloc.addr));
/* Open and copy the dataset's dataspace */
if((ret_value = H5S_read(&oloc, dxpl_id)) == NULL)
@@ -576,10 +572,11 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, void *_ref)
if(H5S_select_deserialize(ret_value, p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection")
+done:
/* Free the buffer allocated in H5HG_read() */
- H5MM_xfree(buf);
+ if(buf)
+ H5MM_xfree(buf);
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R_get_region() */
@@ -608,7 +605,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
-H5Rget_region(hid_t id, H5R_type_t ref_type, void *ref)
+H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
{
H5G_loc_t loc; /* Object's group location */
H5S_t *space = NULL; /* Dataspace object */
@@ -661,10 +658,10 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5G_obj_t
-H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
+H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref)
{
H5O_loc_t oloc; /* Object location */
- uint8_t *p; /* Pointer to OID to store */
+ const uint8_t *p; /* Pointer to OID to store */
H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5R_get_obj_type)
@@ -678,32 +675,28 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
switch(ref_type) {
case H5R_OBJECT:
- {
- hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Only object references currently supported */
-
/* Get the object oid */
- oloc.addr = *ref;
- } /* end case */
- break;
+ oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
+ break;
case H5R_DATASET_REGION:
{
- hdset_reg_ref_t *ref = (hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
+ const hdset_reg_ref_t *ref = (const hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
H5HG_t hobjid; /* Heap object ID */
uint8_t *buf; /* Buffer to store serialized selection in */
/* Get the heap ID for the dataset region */
- p = (uint8_t *)ref;
- H5F_addr_decode(oloc.file, (const uint8_t **)&p, &(hobjid.addr));
+ p = (const uint8_t *)ref;
+ H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
INT32DECODE(p, hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
- if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL)) == NULL)
+ if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, H5G_UNKNOWN, "Unable to read dataset region information")
/* Get the object oid for the dataset */
- p = (uint8_t *)buf;
- H5F_addr_decode(oloc.file, (const uint8_t **)&p, &(oloc.addr));
+ p = buf;
+ H5F_addr_decode(oloc.file, &p, &(oloc.addr));
/* Free the buffer allocated in H5HG_read() */
H5MM_xfree(buf);
@@ -725,7 +718,7 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, H5G_UNKNOWN, "dereferencing deleted object")
/* Get the OID type */
- ret_value = H5O_obj_type(&oloc,dxpl_id);
+ ret_value = H5O_obj_type(&oloc, dxpl_id);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -756,7 +749,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
H5G_obj_t
-H5Rget_obj_type(hid_t id, H5R_type_t ref_type, void *ref)
+H5Rget_obj_type(hid_t id, H5R_type_t ref_type, const void *ref)
{
H5G_loc_t loc; /* Object location */
H5G_obj_t ret_value;
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index efffb8c..fdc1d27 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -60,7 +60,7 @@ typedef haddr_t hobj_ref_t; /* Needs to be large enough to store largest haddr_t
typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];/* Buffer to store heap ID and index */
/* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) plus an int */
-/* Publicly visible datastructures */
+/* Publicly visible data structures */
#ifdef __cplusplus
extern "C" {
@@ -69,9 +69,9 @@ extern "C" {
/* Functions in H5R.c */
H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name,
H5R_type_t ref_type, hid_t space_id);
-H5_DLL hid_t H5Rdereference(hid_t dataset, H5R_type_t ref_type, void *ref);
-H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, void *ref);
-H5_DLL H5G_obj_t H5Rget_obj_type(hid_t id, H5R_type_t ref_type, void *_ref);
+H5_DLL hid_t H5Rdereference(hid_t dataset, H5R_type_t ref_type, const void *ref);
+H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
+H5_DLL H5G_obj_t H5Rget_obj_type(hid_t id, H5R_type_t ref_type, const void *_ref);
#ifdef __cplusplus
}
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 1cb229a..50c73fb 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2875,7 +2875,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
H5F_addr_decode(dst->shared->u.vlen.f, (const uint8_t **)&tmp, &(bg_hobjid.addr));
INT32DECODE(tmp, bg_hobjid.idx);
- if(H5HG_read(dst->shared->u.vlen.f,dxpl_id,&bg_hobjid,tmp_buf)==NULL)
+ if(H5HG_read(dst->shared->u.vlen.f,dxpl_id,&bg_hobjid,tmp_buf, NULL)==NULL)
HGOTO_ERROR (H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL sequence into background buffer");
} /* end if */
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 29e4ec8..5a8bd18 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -830,7 +830,7 @@ H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t UNUSED
/* Check if this sequence actually has any data */
if(hobjid.addr>0) {
/* Read the VL information from disk */
- if(H5HG_read(f,dxpl_id,&hobjid,buf)==NULL)
+ if(H5HG_read(f,dxpl_id,&hobjid,buf, NULL)==NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read VL information")
} /* end if */
diff --git a/test/gheap.c b/test/gheap.c
index a3a9f58..7cbcd9e 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -109,7 +109,7 @@ test_1 (hid_t fapl)
size = i+1;
memset (out, 'A'+i%26, size);
H5Eclear_stack(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in)) {
+ if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
@@ -196,7 +196,7 @@ test_2 (hid_t fapl)
size = 1024-i;
memset (out, 'A'+i%26, size);
H5Eclear_stack(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in)) {
+ if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
diff --git a/test/objcopy.c b/test/objcopy.c
index 3ac25e5..be6a80f 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -22,6 +22,14 @@
#include <time.h>
#include "h5test.h"
+/*
+ * This file needs to access private information from the H5S package.
+ * This file also needs to access the dataspace testing code.
+ */
+#define H5S_PACKAGE
+#define H5S_TESTING
+#include "H5Spkg.h" /* Dataspaces */
+
const char *FILENAME[] = {
"objcopy_src",
"objcopy_dst",
@@ -60,6 +68,7 @@ const char *FILENAME[] = {
#define NAME_GROUP_LOOP "g_loop"
#define NAME_GROUP_LOOP2 "g_loop2"
#define NAME_GROUP_LOOP3 "g_loop3"
+#define NAME_GROUP_REF "ref_grp"
#define NAME_LINK_DATASET "/g_links/dataset_simple"
#define NAME_LINK_HARD "/g_links/hard_link_to_dataset_simple"
#define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple"
@@ -91,7 +100,11 @@ static struct {
/* Local function prototypes */
static int
-compare_data(hid_t tid, size_t nelmts, const void *buf1, const void *buf2);
+compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, const void *buf1, const void *buf2);
+static int
+compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf);
+static int
+compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth);
/*-------------------------------------------------------------------------
@@ -181,6 +194,161 @@ addr_reset(void)
/*-------------------------------------------------------------------------
+ * Function: create_ref_attr
+ *
+ * Purpose: Create an attribute with object references
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * Friday, August 4, 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+attach_ref_attr(hid_t file_id, hid_t loc_id)
+{
+ char dsetname1[] = "dataset1_pointed_by_ref_attr";
+ char dsetname2[] = "dataset2_pointed_by_ref_attr";
+ hid_t did1 = (-1), did2 = (-1), aid = (-1), sid = (-1), sid_ref = (-1);
+ hsize_t dims[2] = {2,9};
+ hsize_t dims_ref[1] = {2};
+ hobj_ref_t ref[2];
+ int data1[2][9] = {{1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,18}};
+ int data2[2][9] = {{2,2,2,2,2,2,2,2,2},{2,2,2,2,2,2,2,2,18}};
+
+
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if((sid_ref = H5Screate_simple(1, dims_ref, NULL)) < 0) TEST_ERROR
+ if((did1 = H5Dcreate(file_id, dsetname1, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data1) < 0) TEST_ERROR
+ if((did2 = H5Dcreate(file_id, dsetname2, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR
+
+ if(H5Rcreate(&ref[0], file_id, dsetname1, H5R_OBJECT, -1) < 0) TEST_ERROR
+ if(H5Rcreate(&ref[1], file_id, dsetname2, H5R_OBJECT, -1) < 0) TEST_ERROR
+ if((aid = H5Acreate(loc_id, "obj_ref_attr", H5T_STD_REF_OBJ, sid_ref, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Awrite(aid, H5T_STD_REF_OBJ, ref) < 0) TEST_ERROR
+
+ if(H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid_ref) < 0) TEST_ERROR
+ if(H5Dclose(did1) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Aclose(aid) < 0) TEST_ERROR
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(sid);
+ H5Sclose(sid_ref);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ H5Pclose(aid);
+ } H5E_END_TRY;
+
+ return(-1);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_reg_ref_dataset
+ *
+ * Purpose: Create a dataset with region references
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * Friday, August 4, 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+create_reg_ref_dataset(hid_t file_id, hid_t loc_id)
+{
+ const char dsetnamev[] = "dataset_pointed_by_ref_dset";
+ const char dsetnamer[] = "dataset_with_reg_ref";
+ const char dsetnamer1[] = "compact_dataset_with_reg_ref";
+ const char dsetnamer2[] = "compressed_dataset_with_reg_ref";
+ hid_t space_id = (-1); /* dataspace identifiers */
+ hid_t spacer_id = (-1);
+ hid_t dsetv_id = (-1); /*dataset identifiers*/
+ hid_t dsetr_id = (-1);
+ hsize_t dims[2] = {2,9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr =1;
+ hsize_t chunk_size=1;
+ hdset_reg_ref_t ref[2];
+ int data[2][9] = {{1,1,2,3,3,4,5,5,6},{1,2,2,3,4,4,5,6,6}};
+ hsize_t start[2];
+ hsize_t count[2];
+ hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
+ size_t num_points = 3;
+ hid_t pid = (-1);
+
+ if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) TEST_ERROR
+ if((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0) TEST_ERROR
+ if((dsetv_id = H5Dcreate(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data) < 0) TEST_ERROR
+ if((dsetr_id = H5Dcreate(loc_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ start[0] = 0;
+ start[1] = 3;
+ count[0] = 2;
+ count[1] = 3;
+ if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR
+ if(H5Rcreate(&ref[0], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0) TEST_ERROR
+ if(H5Sselect_none(space_id) < 0) TEST_ERROR
+ if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t **)coord) < 0) TEST_ERROR
+ if(H5Rcreate(&ref[1], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0) TEST_ERROR
+ if(H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR
+ if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+
+ /* create and set compact plist */
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+
+ if((dsetr_id = H5Dcreate(loc_id, dsetnamer1, H5T_STD_REF_DSETREG, spacer_id, pid)) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0) TEST_ERROR
+ if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+
+ /* create and set comp & chunk plist */
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 1, &chunk_size) < 0) TEST_ERROR
+ if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+
+ if((dsetr_id = H5Dcreate(loc_id, dsetnamer2, H5T_STD_REF_DSETREG, spacer_id, pid)) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR
+ if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+
+ if(H5Sclose(space_id) < 0) TEST_ERROR
+ if(H5Sclose(spacer_id) < 0) TEST_ERROR
+ if(H5Dclose(dsetv_id) < 0) TEST_ERROR
+
+ return 0;
+
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(space_id);
+ H5Sclose(spacer_id);
+ H5Dclose(dsetr_id);
+ H5Dclose(dsetv_id);
+ H5Pclose(pid);
+ } H5E_END_TRY;
+
+ return(-1);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: attach_attribute_vl
*
* Purpose: Attach an vlen attribute to the object to be copied
@@ -256,11 +424,11 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
{
hid_t aid = -1, sid = -1;
char attr_name[ATTR_NAME_LEN];
- int attr_data[2], i=0;
- hsize_t dim1=2;
+ int attr_data[2], i = 0;
+ hsize_t dim1 = 2;
int ret_value = -1;
- if ( (sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
goto done;
for (i=0; i<NUM_ATTRIBUTES; i++) {
@@ -361,7 +529,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-compare_attribute(hid_t aid, hid_t aid2, const void *wbuf)
+compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf)
{
hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
hid_t tid = -1, tid2 = -1; /* Datatype IDs */
@@ -375,18 +543,18 @@ compare_attribute(hid_t aid, hid_t aid2, const void *wbuf)
/* Check the datatypes are equal */
/* Open the datatype for the source attribute */
- if ( (tid = H5Aget_type(aid)) < 0) TEST_ERROR;
+ if ( (tid = H5Aget_type(aid)) < 0) TEST_ERROR
/* Open the datatype for the destination attribute */
- if ( (tid2 = H5Aget_type(aid2)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Aget_type(aid2)) < 0) TEST_ERROR
/* Check that both datatypes are committed/not committed */
- if ( (is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR;
- if ( (is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR;
- if ( is_committed != is_committed2) TEST_ERROR;
+ if ( (is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
+ if ( (is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
+ if ( is_committed != is_committed2) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR;
+ if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* Determine the size of datatype (for later) */
if ( (elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
@@ -394,13 +562,13 @@ compare_attribute(hid_t aid, hid_t aid2, const void *wbuf)
/* Check the dataspaces are equal */
/* Open the dataspace for the source attribute */
- if ( (sid = H5Aget_space(aid)) < 0) TEST_ERROR;
+ if ( (sid = H5Aget_space(aid)) < 0) TEST_ERROR
/* Open the dataspace for the destination attribute */
- if ( (sid2 = H5Aget_space(aid2)) < 0) TEST_ERROR;
+ if ( (sid2 = H5Aget_space(aid2)) < 0) TEST_ERROR
/* Compare the dataspaces */
- if ( H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR;
+ if ( H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
/* Determine the number of elements in dataspace (for later) */
if ( (nelmts = H5Sget_simple_extent_npoints(sid2)) < 0) TEST_ERROR
@@ -408,23 +576,23 @@ compare_attribute(hid_t aid, hid_t aid2, const void *wbuf)
/* Check the raw data is equal */
/* Allocate & initialize space for the raw data buffers */
- if ( (rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR;
- if ( (rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR;
+ if ( (rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if ( (rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
/* Read data from the source attribute */
- if ( H5Aread(aid, tid, rbuf) < 0) TEST_ERROR;
+ if(H5Aread(aid, tid, rbuf) < 0) TEST_ERROR
/* Read data from the destination attribute */
- if ( H5Aread(aid2, tid2, rbuf2) < 0) TEST_ERROR;
+ if(H5Aread(aid2, tid2, rbuf2) < 0) TEST_ERROR
/* Check raw data read in against data written out */
if(wbuf) {
- if ( !compare_data(tid, (size_t)nelmts, wbuf, rbuf)) TEST_ERROR
- if ( !compare_data(tid2, (size_t)nelmts, wbuf, rbuf2)) TEST_ERROR
+ if(!compare_data(aid, 0, pid, tid, (size_t)nelmts, wbuf, rbuf)) TEST_ERROR
+ if(!compare_data(aid2, 0, pid, tid2, (size_t)nelmts, wbuf, rbuf2)) TEST_ERROR
} /* end if */
/* Don't have written data, just compare data between the two attributes */
else
- if ( !compare_data(tid, (size_t)nelmts, rbuf, rbuf2)) TEST_ERROR
+ if(!compare_data(aid, aid2, pid, tid, (size_t)nelmts, rbuf, rbuf2)) TEST_ERROR
/* Reclaim vlen data, if necessary */
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE)
@@ -437,16 +605,16 @@ compare_attribute(hid_t aid, hid_t aid2, const void *wbuf)
HDfree(rbuf2);
/* close the source dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close the destination dataspace */
- if ( H5Sclose(sid2) < 0) TEST_ERROR;
+ if ( H5Sclose(sid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
return TRUE;
@@ -481,28 +649,36 @@ error:
*-------------------------------------------------------------------------
*/
static int
-compare_std_attributes(hid_t oid, hid_t oid2, unsigned cpy_flags)
+compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
{
hid_t aid = -1, aid2 = -1; /* Attribute IDs */
int num_attrs; /* Number of attributes */
int num_attrs2; /* Number of attributes */
char attr_name[ATTR_NAME_LEN]; /* Attribute name */
int wattr_data[2]; /* Attribute buffer for writing */
+ unsigned cpy_flags; /* Object copy flags */
unsigned i; /* Local index variable */
+ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
+ if(pid != H5P_DEFAULT) {
+ if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ } /* end if */
+ else
+ cpy_flags = 0;
+
/* Check the number of attributes on source dataset */
- if ( (num_attrs = H5Aget_num_attrs(oid)) < 0) TEST_ERROR;
+ if((num_attrs = H5Aget_num_attrs(oid)) < 0) TEST_ERROR
/* Check the number of attributes on destination dataset */
- if ( (num_attrs2 = H5Aget_num_attrs(oid2)) < 0) TEST_ERROR;
+ if((num_attrs2 = H5Aget_num_attrs(oid2)) < 0) TEST_ERROR
if(cpy_flags & H5G_COPY_WITHOUT_ATTR_FLAG) {
/* Check that the destination has no attributes */
- if ( num_attrs2 != 0) TEST_ERROR;
+ if(num_attrs2 != 0) TEST_ERROR
} /* end if */
else {
/* Compare the number of attributes */
- if ( num_attrs != num_attrs2) TEST_ERROR;
+ if(num_attrs != num_attrs2) TEST_ERROR
/* Check the attributes are equal */
for(i = 0; i < (unsigned)num_attrs; i++) {
@@ -513,15 +689,15 @@ compare_std_attributes(hid_t oid, hid_t oid2, unsigned cpy_flags)
wattr_data[1] = 200 * i;
/* Open the attributes */
- if ( (aid = H5Aopen_name(oid, attr_name)) < 0) TEST_ERROR
- if ( (aid2 = H5Aopen_name(oid2, attr_name)) < 0) TEST_ERROR
+ if((aid = H5Aopen_name(oid, attr_name)) < 0) TEST_ERROR
+ if((aid2 = H5Aopen_name(oid2, attr_name)) < 0) TEST_ERROR
/* Check the attributes are equal */
- if ( !compare_attribute(aid, aid2, wattr_data)) TEST_ERROR
+ if(!compare_attribute(aid, aid2, pid, wattr_data)) TEST_ERROR
/* Close the attributes */
- if ( H5Aclose(aid) < 0) TEST_ERROR
- if ( H5Aclose(aid2) < 0) TEST_ERROR
+ if(H5Aclose(aid) < 0) TEST_ERROR
+ if(H5Aclose(aid2) < 0) TEST_ERROR
} /* end for */
} /* end if */
@@ -550,16 +726,13 @@ error:
*-------------------------------------------------------------------------
*/
static int
-compare_data(hid_t tid, size_t nelmts, const void *buf1, const void *buf2)
+compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, const void *buf1, const void *buf2)
{
size_t elmt_size; /* Size of an element */
/* Check size of each element */
if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
- /* Check for references, which aren't handled */
- if(H5Tdetect_class(tid, H5T_REFERENCE) == TRUE) TEST_ERROR
-
/* Check for vlen datatype */
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
const hvl_t *vl_buf1, *vl_buf2; /* Aliases for buffers to compare */
@@ -580,13 +753,121 @@ compare_data(hid_t tid, size_t nelmts, const void *buf1, const void *buf2)
if(vl_buf1->len != vl_buf2->len) TEST_ERROR
/* Check vlen data */
- if(!compare_data(base_tid, vl_buf1->len, vl_buf1->p, vl_buf2->p)) TEST_ERROR
+ if(!compare_data(parent1, parent2, pid, base_tid, vl_buf1->len, vl_buf1->p, vl_buf2->p)) TEST_ERROR
} /* end for */
if(H5Tclose(base_tid) < 0) TEST_ERROR
} /* end if */
+ else if(H5Tdetect_class(tid, H5T_REFERENCE) == TRUE) {
+ size_t u; /* Local index variable */
+
+ /* Check for "simple" vlen datatype */
+ if(H5Tget_class(tid) != H5T_REFERENCE) TEST_ERROR
+
+ /* Check for object or region reference */
+ if(H5Tequal(tid, H5T_STD_REF_OBJ) > 0) {
+ const hobj_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
+
+ /* Loop over elements in buffers */
+ ref_buf1 = buf1;
+ ref_buf2 = buf2;
+ for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
+ hid_t obj1_id, obj2_id; /* IDs for objects referenced */
+ H5G_obj_t obj1_type, obj2_type; /* Types of objects referenced */
+
+ /* Check for types of objects handled */
+ if((obj1_type = H5Rget_obj_type(parent1, H5R_OBJECT, ref_buf1)) < 0) TEST_ERROR
+ if((obj2_type = H5Rget_obj_type(parent2, H5R_OBJECT, ref_buf2)) < 0) TEST_ERROR
+ if(obj1_type != obj2_type) TEST_ERROR
+
+ /* Open referenced objects */
+ if((obj1_id = H5Rdereference(parent1, H5R_OBJECT, ref_buf1)) < 0) TEST_ERROR
+ if((obj2_id = H5Rdereference(parent2, H5R_OBJECT, ref_buf2)) < 0) TEST_ERROR
+
+ /* Check for types of objects handled */
+ switch(obj1_type)
+ {
+ case H5G_DATASET:
+ if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
+ break;
+
+ case H5G_GROUP:
+ if(compare_groups(obj1_id, obj2_id, pid, -1) != TRUE) TEST_ERROR
+ break;
+
+ case H5G_TYPE:
+ if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
+ break;
+
+ default:
+ TEST_ERROR
+ } /* end switch */
+
+ /* Close objects */
+ if(H5Oclose(obj1_id) < 0) TEST_ERROR
+ if(H5Oclose(obj2_id) < 0) TEST_ERROR
+ } /* end for */
+ } /* end if */
+ else if(H5Tequal(tid, H5T_STD_REF_DSETREG) > 0) {
+ const hdset_reg_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
+
+ /* Loop over elements in buffers */
+ ref_buf1 = buf1;
+ ref_buf2 = buf2;
+ for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
+ hid_t obj1_id, obj2_id; /* IDs for objects referenced */
+ hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */
+ H5G_obj_t obj1_type, obj2_type; /* Types of objects referenced */
+
+ /* Check for types of objects handled */
+ if((obj1_type = H5Rget_obj_type(parent1, H5R_DATASET_REGION, ref_buf1)) < 0) TEST_ERROR
+ if((obj2_type = H5Rget_obj_type(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
+ if(obj1_type != obj2_type) TEST_ERROR
+
+ /* Open referenced objects */
+ if((obj1_id = H5Rdereference(parent1, H5R_DATASET_REGION, ref_buf1)) < 0) TEST_ERROR
+ if((obj2_id = H5Rdereference(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
+
+ /* Check for types of objects handled */
+ switch(obj1_type)
+ {
+ case H5G_DATASET:
+ if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
+ break;
+
+ case H5G_GROUP:
+ if(compare_groups(obj1_id, obj2_id, pid, -1) != TRUE) TEST_ERROR
+ break;
+
+ case H5G_TYPE:
+ if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
+ break;
+
+ default:
+ TEST_ERROR
+ } /* end switch */
+
+ /* Close objects */
+ if(H5Oclose(obj1_id) < 0) TEST_ERROR
+ if(H5Oclose(obj2_id) < 0) TEST_ERROR
+
+ /* Get regions for referenced datasets */
+ if((obj1_sid = H5Rget_region(parent1, H5R_DATASET_REGION, ref_buf1)) < 0) TEST_ERROR
+ if((obj2_sid = H5Rget_region(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR
+
+ /* Check if dataspaces are the same shape */
+ if(H5S_select_shape_same_test(obj1_sid, obj2_sid) < 0) TEST_ERROR
+
+ /* Close dataspaces */
+ if(H5Sclose(obj1_sid) < 0) TEST_ERROR
+ if(H5Sclose(obj2_sid) < 0) TEST_ERROR
+ } /* end for */
+ } /* end if */
+ else
+ TEST_ERROR
+ } /* end else */
else
- if ( HDmemcmp(buf1, buf2, (size_t)(elmt_size * nelmts))) TEST_ERROR
+ if(HDmemcmp(buf1, buf2, (elmt_size * nelmts))) TEST_ERROR
/* Data should be the same. :-) */
return TRUE;
@@ -623,30 +904,22 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
void *rbuf2 = NULL; /* Buffer for reading raw data */
H5D_space_status_t space_status; /* Dataset's raw data space status */
H5D_space_status_t space_status2; /* Dataset's raw data space status */
- unsigned cpy_flags; /* Object copy flags */
-
- /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
- if(pid != H5P_DEFAULT) {
- if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR;
- } /* end if */
- else
- cpy_flags = 0;
/* Check the datatypes are equal */
/* Open the datatype for the source dataset */
- if ( (tid = H5Dget_type(did)) < 0) TEST_ERROR;
+ if ( (tid = H5Dget_type(did)) < 0) TEST_ERROR
/* Open the datatype for the destination dataset */
- if ( (tid2 = H5Dget_type(did2)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Dget_type(did2)) < 0) TEST_ERROR
/* Check that both datatypes are committed/not committed */
- if ( (is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR;
- if ( (is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR;
- if ( is_committed != is_committed2) TEST_ERROR;
+ if ( (is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
+ if ( (is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
+ if ( is_committed != is_committed2) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR;
+ if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* Determine the size of datatype (for later) */
if ( (elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
@@ -655,13 +928,13 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
/* Check the dataspaces are equal */
/* Open the dataspace for the source dataset */
- if ( (sid = H5Dget_space(did)) < 0) TEST_ERROR;
+ if ( (sid = H5Dget_space(did)) < 0) TEST_ERROR
/* Open the dataspace for the destination dataset */
- if ( (sid2 = H5Dget_space(did2)) < 0) TEST_ERROR;
+ if ( (sid2 = H5Dget_space(did2)) < 0) TEST_ERROR
/* Compare the dataspaces */
- if ( H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR;
+ if ( H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
/* Determine the number of elements in dataspace (for later) */
if ( (nelmts = H5Sget_simple_extent_npoints(sid)) < 0) TEST_ERROR
@@ -670,30 +943,30 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
/* Check the dataset creation property lists are equal */
/* Open the dataset creation property list for the source dataset */
- if ( (dcpl = H5Dget_create_plist(did)) < 0) TEST_ERROR;
+ if ( (dcpl = H5Dget_create_plist(did)) < 0) TEST_ERROR
/* Open the dataset creation property list for the destination dataset */
- if ( (dcpl2 = H5Dget_create_plist(did2)) < 0) TEST_ERROR;
+ if ( (dcpl2 = H5Dget_create_plist(did2)) < 0) TEST_ERROR
/* Compare the dataset creation property lists */
- if ( H5Pequal(dcpl, dcpl2) != TRUE) TEST_ERROR;
+ if ( H5Pequal(dcpl, dcpl2) != TRUE) TEST_ERROR
/* Get the number of filters on dataset */
- if ( (nfilters = H5Pget_nfilters(dcpl)) < 0) TEST_ERROR;
+ if ( (nfilters = H5Pget_nfilters(dcpl)) < 0) TEST_ERROR
/* close the source dataset creation property list */
- if ( H5Pclose(dcpl) < 0) TEST_ERROR;
+ if ( H5Pclose(dcpl) < 0) TEST_ERROR
/* close the destination dataset creation property list */
- if ( H5Pclose(dcpl2) < 0) TEST_ERROR;
+ if ( H5Pclose(dcpl2) < 0) TEST_ERROR
/* Check the allocated storage is the same */
/* Check that the space allocation status is the same */
- if(H5Dget_space_status(did, &space_status) < 0) TEST_ERROR;
- if(H5Dget_space_status(did2, &space_status2) < 0) TEST_ERROR;
- if(space_status != space_status2) TEST_ERROR;
+ if(H5Dget_space_status(did, &space_status) < 0) TEST_ERROR
+ if(H5Dget_space_status(did2, &space_status2) < 0) TEST_ERROR
+ if(space_status != space_status2) TEST_ERROR
/* Check that the space used is the same */
/* (Don't check if the dataset is filtered (i.e. compressed, etc.) and
@@ -705,27 +978,27 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
hsize_t storage_size = H5Dget_storage_size(did); /* Dataset's raw data storage size */
hsize_t storage_size2 = H5Dget_storage_size(did2); /* 2nd Dataset's raw data storage size */
- if(storage_size != storage_size2) TEST_ERROR;
+ if(storage_size != storage_size2) TEST_ERROR
} /* end if */
/* Check the raw data is equal */
/* Allocate & initialize space for the raw data buffers */
- if ( (rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR;
- if ( (rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR;
+ if((rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if((rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
/* Read data from datasets */
- if ( H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
- if ( H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR;
+ if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
+ if(H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
/* Check raw data read in against data written out */
if(wbuf) {
- if ( !compare_data(tid, (size_t)nelmts, wbuf, rbuf)) TEST_ERROR
- if ( !compare_data(tid2, (size_t)nelmts, wbuf, rbuf2)) TEST_ERROR
+ if(!compare_data(did, 0, pid, tid, (size_t)nelmts, wbuf, rbuf)) TEST_ERROR
+ if(!compare_data(did2, 0, pid, tid2, (size_t)nelmts, wbuf, rbuf2)) TEST_ERROR
} /* end if */
/* Don't have written data, just compare data between the two datasets */
else
- if ( !compare_data(tid, (size_t)nelmts, rbuf, rbuf2)) TEST_ERROR
+ if(!compare_data(did, did2, pid, tid, (size_t)nelmts, rbuf, rbuf2)) TEST_ERROR
/* Reclaim vlen data, if necessary */
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE)
@@ -738,20 +1011,20 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
HDfree(rbuf2);
/* close the source dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close the destination dataspace */
- if ( H5Sclose(sid2) < 0) TEST_ERROR;
+ if ( H5Sclose(sid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* Check if the attributes are equal */
- if ( compare_std_attributes(did, did2, cpy_flags) != TRUE) TEST_ERROR;
+ if ( compare_std_attributes(did, did2, pid) != TRUE) TEST_ERROR
/* Datasets should be the same. :-) */
@@ -796,19 +1069,19 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
/* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
if(pid != H5P_DEFAULT) {
- if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR;
+ if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
} /* end if */
else
cpy_flags = 0;
/* Check if both groups have the same # of objects */
- if(H5Gget_num_objs(gid, &num_objs) < 0) TEST_ERROR;
- if(H5Gget_num_objs(gid2, &num_objs2) < 0) TEST_ERROR;
+ if(H5Gget_num_objs(gid, &num_objs) < 0) TEST_ERROR
+ if(H5Gget_num_objs(gid2, &num_objs2) < 0) TEST_ERROR
if((cpy_flags & H5G_COPY_SHALLOW_HIERARCHY_FLAG) && depth == 0) {
- if(num_objs2 != 0) TEST_ERROR;
+ if(num_objs2 != 0) TEST_ERROR
} /* end if */
else {
- if(num_objs != num_objs2) TEST_ERROR;
+ if(num_objs != num_objs2) TEST_ERROR
} /* end if */
/* Check contents of groups */
@@ -826,28 +1099,28 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
/* Loop over contents of groups */
for(idx = 0; idx < num_objs; idx++) {
/* Check name of objects */
- if(H5Gget_objname_by_idx(gid, idx, objname, NAME_BUF_SIZE) < 0) TEST_ERROR;
- if(H5Gget_objname_by_idx(gid2, idx, objname2, NAME_BUF_SIZE) < 0) TEST_ERROR;
- if(HDstrcmp(objname, objname2)) TEST_ERROR;
+ if(H5Gget_objname_by_idx(gid, idx, objname, NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(H5Gget_objname_by_idx(gid2, idx, objname2, NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, objname2)) TEST_ERROR
/* Check type of objects */
- if((objtype = H5Gget_objtype_by_idx(gid, idx)) < 0) TEST_ERROR;
- if((objtype2 = H5Gget_objtype_by_idx(gid2, idx)) < 0) TEST_ERROR;
- if(objtype != objtype2) TEST_ERROR;
+ if((objtype = H5Gget_objtype_by_idx(gid, idx)) < 0) TEST_ERROR
+ if((objtype2 = H5Gget_objtype_by_idx(gid2, idx)) < 0) TEST_ERROR
+ if(objtype != objtype2) TEST_ERROR
/* Compare some pieces of the H5G_stat_t */
- if(H5Gget_objinfo(gid, objname, FALSE, &objstat) < 0) TEST_ERROR;
- if(H5Gget_objinfo(gid2, objname2, FALSE, &objstat2) < 0) TEST_ERROR;
- if(objstat.type != objstat2.type) TEST_ERROR;
+ if(H5Gget_objinfo(gid, objname, FALSE, &objstat) < 0) TEST_ERROR
+ if(H5Gget_objinfo(gid2, objname2, FALSE, &objstat2) < 0) TEST_ERROR
+ if(objstat.type != objstat2.type) TEST_ERROR
if(objstat.type != H5G_LINK && objstat.type != H5G_UDLINK) {
- if(objstat.nlink != objstat2.nlink) TEST_ERROR;
- if(objstat.ohdr.nmesgs != objstat2.ohdr.nmesgs) TEST_ERROR;
- if(objstat.ohdr.nchunks != objstat2.ohdr.nchunks) TEST_ERROR;
+ if(objstat.nlink != objstat2.nlink) TEST_ERROR
+ if(objstat.ohdr.nmesgs != objstat2.ohdr.nmesgs) TEST_ERROR
+ if(objstat.ohdr.nchunks != objstat2.ohdr.nchunks) TEST_ERROR
} /* end if */
/* Get link info */
- if(H5Lget_linkinfo(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lget_linkinfo(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lget_linkinfo(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_linkinfo(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR
/* Check for object already having been compared */
if(addr_lookup(&objstat))
@@ -863,49 +1136,49 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
char linkname2[NAME_BUF_SIZE]; /* Link value */
/* Check link values */
- if(H5Lget_linkval(gid, objname, NAME_BUF_SIZE, linkname, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lget_linkval(gid2, objname2, NAME_BUF_SIZE, linkname2, H5P_DEFAULT) < 0) TEST_ERROR;
- if(HDstrcmp(linkname, linkname2)) TEST_ERROR;
+ if(H5Lget_linkval(gid, objname, NAME_BUF_SIZE, linkname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_linkval(gid2, objname2, NAME_BUF_SIZE, linkname2, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(linkname, linkname2)) TEST_ERROR
}
break;
case H5G_GROUP:
/* Open groups */
- if((oid = H5Gopen(gid, objname)) < 0) TEST_ERROR;
- if((oid2 = H5Gopen(gid2, objname2)) < 0) TEST_ERROR;
+ if((oid = H5Gopen(gid, objname)) < 0) TEST_ERROR
+ if((oid2 = H5Gopen(gid2, objname2)) < 0) TEST_ERROR
/* Compare groups */
- if(compare_groups(oid, oid2, pid, depth - 1) != TRUE) TEST_ERROR;
+ if(compare_groups(oid, oid2, pid, depth - 1) != TRUE) TEST_ERROR
/* Close groups */
- if(H5Gclose(oid) < 0) TEST_ERROR;
- if(H5Gclose(oid2) < 0) TEST_ERROR;
+ if(H5Gclose(oid) < 0) TEST_ERROR
+ if(H5Gclose(oid2) < 0) TEST_ERROR
break;
case H5G_DATASET:
/* Open datasets */
- if((oid = H5Dopen(gid, objname)) < 0) TEST_ERROR;
- if((oid2 = H5Dopen(gid2, objname2)) < 0) TEST_ERROR;
+ if((oid = H5Dopen(gid, objname)) < 0) TEST_ERROR
+ if((oid2 = H5Dopen(gid2, objname2)) < 0) TEST_ERROR
/* Compare datasets */
- if(compare_datasets(oid, oid2, pid, NULL) != TRUE) TEST_ERROR;
+ if(compare_datasets(oid, oid2, pid, NULL) != TRUE) TEST_ERROR
/* Close datasets */
- if(H5Dclose(oid) < 0) TEST_ERROR;
- if(H5Dclose(oid2) < 0) TEST_ERROR;
+ if(H5Dclose(oid) < 0) TEST_ERROR
+ if(H5Dclose(oid2) < 0) TEST_ERROR
break;
case H5G_TYPE:
/* Open datatypes */
- if((oid = H5Topen(gid, objname)) < 0) TEST_ERROR;
- if((oid2 = H5Topen(gid2, objname2)) < 0) TEST_ERROR;
+ if((oid = H5Topen(gid, objname)) < 0) TEST_ERROR
+ if((oid2 = H5Topen(gid2, objname2)) < 0) TEST_ERROR
/* Compare datatypes */
- if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR;
+ if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR
/* Close datatypes */
- if(H5Tclose(oid) < 0) TEST_ERROR;
- if(H5Tclose(oid2) < 0) TEST_ERROR;
+ if(H5Tclose(oid) < 0) TEST_ERROR
+ if(H5Tclose(oid2) < 0) TEST_ERROR
break;
case H5G_UDLINK:
@@ -914,15 +1187,15 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
char linkval2[NAME_BUF_SIZE]; /* Link value */
/* Check that both links are the same type and the same size */
- if(linfo.linkclass != linfo2.linkclass) TEST_ERROR;
- if(linfo.u.link_size != linfo2.u.link_size) TEST_ERROR;
+ if(linfo.linkclass != linfo2.linkclass) TEST_ERROR
+ if(linfo.u.link_size != linfo2.u.link_size) TEST_ERROR
/* Get link udata */
- if(H5Lget_linkval(gid, objname, NAME_BUF_SIZE, linkval, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lget_linkval(gid2, objname2, NAME_BUF_SIZE, linkval2, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lget_linkval(gid, objname, NAME_BUF_SIZE, linkval, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_linkval(gid2, objname2, NAME_BUF_SIZE, linkval2, H5P_DEFAULT) < 0) TEST_ERROR
/* Compare link udata */
- if(HDmemcmp(linkval, linkval2, objstat.linklen)) TEST_ERROR;
+ if(HDmemcmp(linkval, linkval2, objstat.linklen)) TEST_ERROR
}
break;
@@ -934,7 +1207,9 @@ HDassert(0 && "Unknown type of object");
} /* end if */
/* Check if the attributes are equal */
- if ( compare_std_attributes(gid, gid2, cpy_flags) != TRUE) TEST_ERROR;
+ /* (don't check standard attributes when testing expanding references) */
+ if(!(cpy_flags & H5G_COPY_EXPAND_REFERENCE_FLAG))
+ if(compare_std_attributes(gid, gid2, pid) != TRUE) TEST_ERROR
/* Groups should be the same. :-) */
return TRUE;
@@ -979,53 +1254,53 @@ test_copy_named_datatype(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create named datatype */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR;
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATATYPE_SIMPLE, fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATATYPE_SIMPLE, fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the datatype for copy */
- if ( (tid = H5Topen(fid_src, NAME_DATATYPE_SIMPLE)) < 0) TEST_ERROR;
+ if ( (tid = H5Topen(fid_src, NAME_DATATYPE_SIMPLE)) < 0) TEST_ERROR
/* open the copied datatype */
- if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_SIMPLE)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_SIMPLE)) < 0) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR;
+ if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1072,53 +1347,53 @@ test_copy_named_datatype_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create named datatype */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR;
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATATYPE_VL, fid_dst, NAME_DATATYPE_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATATYPE_VL, fid_dst, NAME_DATATYPE_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the datatype for copy */
- if ( (tid = H5Topen(fid_src, NAME_DATATYPE_VL)) < 0) TEST_ERROR;
+ if ( (tid = H5Topen(fid_src, NAME_DATATYPE_VL)) < 0) TEST_ERROR
/* open the copied datatype */
- if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_VL)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_VL)) < 0) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR;
+ if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1165,59 +1440,59 @@ test_copy_named_datatype_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create first vlen datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create second (nested) vlen datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create named datatype */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL_VL, tid2)) < 0) TEST_ERROR;
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL_VL, tid2)) < 0) TEST_ERROR
/* close the first datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the second datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATATYPE_VL_VL, fid_dst, NAME_DATATYPE_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATATYPE_VL_VL, fid_dst, NAME_DATATYPE_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the datatype for copy */
- if ( (tid = H5Topen(fid_src, NAME_DATATYPE_VL_VL)) < 0) TEST_ERROR;
+ if ( (tid = H5Topen(fid_src, NAME_DATATYPE_VL_VL)) < 0) TEST_ERROR
/* open the copied datatype */
- if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_VL_VL)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_VL_VL)) < 0) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR;
+ if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1275,66 +1550,66 @@ test_copy_dataset_simple(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1385,63 +1660,63 @@ test_copy_dataset_simple_empty(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1505,73 +1780,73 @@ test_copy_dataset_compound(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR;
- if (H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR;
- if (H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR;
+ if ( (tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
+ if (H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if (H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_COMPOUND, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_COMPOUND, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if (H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_COMPOUND, fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_COMPOUND, fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1633,73 +1908,73 @@ test_copy_dataset_chunked(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1753,70 +2028,70 @@ test_copy_dataset_chunked_empty(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1879,7 +2154,7 @@ test_copy_dataset_chunked_sparse(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
@@ -1888,73 +2163,73 @@ test_copy_dataset_chunked_sparse(hid_t fapl)
max_dim2d[1]=H5S_UNLIMITED;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, max_dim2d)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, max_dim2d)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* Set extended dataset dimensions */
new_dim2d[0] = DIM_SIZE_1 * 2;
new_dim2d[1] = DIM_SIZE_2 * 2;
/* Extend dataset's dimensions */
- if ( H5Dextend(did, new_dim2d) < 0) TEST_ERROR;
+ if ( H5Dextend(did, new_dim2d) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2020,74 +2295,74 @@ test_copy_dataset_compressed(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create and set comp & chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR;
- if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -2149,73 +2424,73 @@ test_copy_dataset_compact(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_COMPACT, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_COMPACT, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_COMPACT, fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_COMPACT, fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_COMPACT)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_COMPACT)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_COMPACT)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_COMPACT)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2279,43 +2554,43 @@ test_copy_dataset_external(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* set dataset creation plist */
size = DIM_SIZE_1 * sizeof (int);
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_external(pid, FILE_EXT, (off_t)0, size) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_external(pid, FILE_EXT, (off_t)0, size) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_EXTERNAL, H5T_NATIVE_INT, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_EXTERNAL, H5T_NATIVE_INT, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close external plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if (H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Don't change the address in the destination file for this test, it causes the
* external file list's heap to be at a different location and generates a false
@@ -2324,32 +2599,32 @@ test_copy_dataset_external(hid_t fapl)
*/
#if 0
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
#endif /* 0 */
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_EXTERNAL, fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_EXTERNAL, fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2408,69 +2683,69 @@ test_copy_dataset_named_dtype(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create named datatype */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR;
+ if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2530,84 +2805,84 @@ test_copy_dataset_named_dtype_hier(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to place all objects in */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create named datatype _inside_ hierarchy to copy */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if ( (H5Tcommit(gid, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR;
+ if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ( (H5Tcommit(gid, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* create first dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* create second dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2669,84 +2944,84 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to place all objects in */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create named datatype _outside_ hierarchy to copy */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR;
+ if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* create first dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* create second dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2807,80 +3082,80 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to place all objects in */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create first dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* create second dataset at SRC file */
- if ( (did2 = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR2, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR2, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* Add attributes to datasets in a way that creates lots of chunks */
- if ( test_copy_attach_paired_attributes(did, did2, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_paired_attributes(did, did2, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the first dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the second dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2941,87 +3216,87 @@ test_copy_dataset_attr_named_dtype(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to place all objects in */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create named datatype _outside_ hierarchy to copy */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR;
+ if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* create first dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* create second dataset at SRC file */
- if ( (did2 = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* Add attributes to datasets in a way that creates lots of chunks */
- if ( test_copy_attach_paired_attributes(did, did2, tid) < 0) TEST_ERROR;
+ if ( test_copy_attach_paired_attributes(did, did2, tid) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the first dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the second dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3086,72 +3361,72 @@ test_copy_dataset_contig_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3217,79 +3492,79 @@ test_copy_dataset_chunked_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3354,79 +3629,79 @@ test_copy_dataset_compact_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3480,68 +3755,68 @@ test_copy_attribute_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach VL attribute to the dataset */
- if ( test_copy_attach_attribute_vl(did) < 0) TEST_ERROR;
+ if ( test_copy_attach_attribute_vl(did) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the attributes are equal */
- if ( (aid = H5Aopen_idx(did, 0)) < 0) TEST_ERROR;
- if ( (aid2 = H5Aopen_idx(did2, 0)) < 0) TEST_ERROR;
- if ( compare_attribute(aid, aid2, NULL) != TRUE) TEST_ERROR;
- if ( H5Aclose(aid) < 0) TEST_ERROR;
- if ( H5Aclose(aid2) < 0) TEST_ERROR;
+ if ( (aid = H5Aopen_idx(did, 0)) < 0) TEST_ERROR
+ if ( (aid2 = H5Aopen_idx(did2, 0)) < 0) TEST_ERROR
+ if ( compare_attribute(aid, aid2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if ( H5Aclose(aid) < 0) TEST_ERROR
+ if ( H5Aclose(aid2) < 0) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3615,80 +3890,80 @@ test_copy_dataset_compressed_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create and set comp & chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR;
- if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, tid, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, tid, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -3744,53 +4019,53 @@ test_copy_group_empty(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_EMPTY, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_EMPTY, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_EMPTY)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_EMPTY)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_EMPTY)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_EMPTY)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3850,78 +4125,78 @@ test_copy_group(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the group */
- if ( (did = H5Dcreate(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR;
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if (H5Dclose(did) < 0) TEST_ERROR
/* create a sub-group */
- if ( (gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR;
- if( H5Gclose(gid_sub) < 0) TEST_ERROR;
+ if ( (gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
+ if( H5Gclose(gid_sub) < 0) TEST_ERROR
/* create another sub-group */
- if ( (gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB_2, (size_t)0)) < 0) TEST_ERROR;
- if( H5Gclose(gid_sub) < 0) TEST_ERROR;
+ if ( (gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB_2, (size_t)0)) < 0) TEST_ERROR
+ if( H5Gclose(gid_sub) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3941,6 +4216,139 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_copy_root_group
+ *
+ * Purpose: Create a root group in SRC file and copy it to DST file
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Peter Cao
+ * August 8, 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_root_group(hid_t fapl)
+{
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t gid_sub = -1; /* Sub-group ID */
+ hsize_t dim2d[2];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ TESTING("H5Gcopy(): root group");
+
+ /* set initial data values */
+ for (i=0; i<DIM_SIZE_1; i++)
+ for (j=0; j<DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100*i+j;
+
+ /* Initialize the filenames */
+ h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
+ h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);
+
+ /* Reset file address checking info */
+ addr_reset();
+
+ /* create source file */
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* create group at the SRC file */
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+
+ /* attach attributes to the group */
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+
+ /* Set dataspace dimensions */
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
+
+ /* create dataspace */
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+
+ /* add a dataset to the group */
+ if((did = H5Dcreate(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ /* close the dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* create a sub-group */
+ if((gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid_sub) < 0) TEST_ERROR
+
+ /* create another sub-group */
+ if((gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB_2, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid_sub) < 0) TEST_ERROR
+
+ /* close the group */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* open the source file with read-only */
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ /* create destination file */
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+
+ /* copy the group from SRC to DST */
+ if(H5Gcopy(fid_src, "/", fid_dst, "/root_from_src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* open the group for copy */
+ if((gid = H5Gopen(fid_src, "/")) < 0) TEST_ERROR
+
+ /* open the destination group */
+ if((gid2 = H5Gopen(fid_dst, "/root_from_src")) < 0) TEST_ERROR
+
+ /* Check if the groups are equal */
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+
+ /* close the destination group */
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+
+ /* close the source group */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* close the DST file */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Gclose(gid_sub);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid_dst);
+ H5Fclose(fid_src);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_copy_root_group */
+
+
+/*-------------------------------------------------------------------------
* Function: test_copy_group_deep
*
* Purpose: Create a deep group hier. in SRC file and copy it to DST file
@@ -3983,87 +4391,87 @@ test_copy_group_deep(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create nested sub-groups & datasets */
for(i = 0; i < NUM_SUB_GROUPS; i++) {
sprintf(objname, "Group #%d", i);
- if ( (gid_sub = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid_sub = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
for(j = 0; j < NUM_SUB_GROUPS; j++) {
sprintf(objname, "Group #%d", j);
- if ( (gid_sub2 = H5Gcreate(gid_sub, objname, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid_sub2 = H5Gcreate(gid_sub, objname, (size_t)0)) < 0) TEST_ERROR
for(k = 0; k < NUM_DATASETS; k++) {
sprintf(objname, "Dataset #%d", k);
/* add a dataset to the group */
- if ( (did = H5Dcreate(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR;
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if ( H5Dclose(did) < 0) TEST_ERROR
} /* end for */
- if( H5Gclose(gid_sub2) < 0) TEST_ERROR;
+ if( H5Gclose(gid_sub2) < 0) TEST_ERROR
} /* end for */
- if( H5Gclose(gid_sub) < 0) TEST_ERROR;
+ if( H5Gclose(gid_sub) < 0) TEST_ERROR
} /* end for */
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4114,67 +4522,67 @@ test_copy_group_loop(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* create sub-groups */
- if ( (gid_sub = H5Gcreate(gid, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid_sub = H5Gcreate(gid, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
- if ( (gid_sub2 = H5Gcreate(gid, NAME_GROUP_SUB_SUB, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid_sub2 = H5Gcreate(gid, NAME_GROUP_SUB_SUB, (size_t)0)) < 0) TEST_ERROR
/* Create link to top group */
- if ( H5Glink2(gid, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR;
+ if ( H5Glink2(gid, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR
/* close sub sub group */
- if( H5Gclose(gid_sub2) < 0) TEST_ERROR;
+ if( H5Gclose(gid_sub2) < 0) TEST_ERROR
/* close sub group */
- if( H5Gclose(gid_sub) < 0) TEST_ERROR;
+ if( H5Gclose(gid_sub) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4231,79 +4639,79 @@ test_copy_group_wide_loop(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* create wide sub-group hierarchy, with multiple links to higher groups */
for(u = 0; u < NUM_WIDE_LOOP_GROUPS; u++) {
sprintf(objname, "%s-%u", NAME_GROUP_SUB, u);
- if ( (gid_sub = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid_sub = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
for(v = 0; v < NUM_WIDE_LOOP_GROUPS; v++) {
sprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v);
- if ( (gid_sub2 = H5Gcreate(gid_sub, objname, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid_sub2 = H5Gcreate(gid_sub, objname, (size_t)0)) < 0) TEST_ERROR
/* Create link to top group */
- if ( H5Glink2(gid, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR;
+ if ( H5Glink2(gid, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR
/* Create link to sub-group */
- if ( H5Glink2(gid_sub, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP2) < 0) TEST_ERROR;
+ if ( H5Glink2(gid_sub, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP2) < 0) TEST_ERROR
/* Create link to self :-) */
- if ( H5Glink2(gid_sub2, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP3) < 0) TEST_ERROR;
+ if ( H5Glink2(gid_sub2, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP3) < 0) TEST_ERROR
/* close sub sub group */
- if( H5Gclose(gid_sub2) < 0) TEST_ERROR;
+ if( H5Gclose(gid_sub2) < 0) TEST_ERROR
} /* end for */
/* close sub group */
- if( H5Gclose(gid_sub) < 0) TEST_ERROR;
+ if( H5Gclose(gid_sub) < 0) TEST_ERROR
} /* end for */
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4364,82 +4772,82 @@ test_copy_group_links(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the group */
- if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR;
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if (H5Dclose(did) < 0) TEST_ERROR
/* make a hard link to the dataset */
- if (H5Glink(fid_src, H5L_LINK_HARD, NAME_LINK_DATASET, NAME_LINK_HARD) < 0) TEST_ERROR;
+ if (H5Glink(fid_src, H5L_LINK_HARD, NAME_LINK_DATASET, NAME_LINK_HARD) < 0) TEST_ERROR
/* make a soft link to the dataset */
- if (H5Glink(fid_src, H5L_LINK_SOFT, NAME_LINK_DATASET, NAME_LINK_SOFT) < 0) TEST_ERROR;
+ if (H5Glink(fid_src, H5L_LINK_SOFT, NAME_LINK_DATASET, NAME_LINK_SOFT) < 0) TEST_ERROR
/* make a soft link to nowhere */
- if (H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR;
+ if (H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR
/* make a dangling external link */
- if (H5Lcreate_external("filename", "obj_name", fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if (H5Lcreate_external("filename", "obj_name", fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_LINK)) < 0) TEST_ERROR;
+ if ( (gid = H5Gopen(fid_src, NAME_GROUP_LINK)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_LINK)) < 0) TEST_ERROR;
+ if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_LINK)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR;
+ if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
+ if ( H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4499,73 +4907,73 @@ test_copy_soft_link(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the group */
- if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR;
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if (H5Dclose(did) < 0) TEST_ERROR
/* make a soft link to the dataset */
- if (H5Glink(fid_src, H5L_LINK_SOFT, NAME_LINK_DATASET, NAME_LINK_SOFT) < 0) TEST_ERROR;
+ if (H5Glink(fid_src, H5L_LINK_SOFT, NAME_LINK_DATASET, NAME_LINK_SOFT) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_LINK_SOFT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_LINK_SOFT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset through the soft link for copy */
- if ( (did = H5Dopen(fid_src, NAME_LINK_SOFT)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_LINK_SOFT)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4626,80 +5034,80 @@ test_copy_ext_link(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the group */
- if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR;
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if (H5Dclose(did) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* create file to hold external links to the src file */
- if ( (fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group in the file that will hold the external link */
- if ( (gid = H5Gcreate(fid_ext, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_ext, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
/* Create an external link to the dataset in the source file */
- if ( H5Lcreate_external(src_filename, NAME_LINK_DATASET, fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Lcreate_external(src_filename, NAME_LINK_DATASET, fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* close the group and file */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
- if (H5Fclose(fid_ext) < 0) TEST_ERROR;
+ if ( H5Gclose(gid) < 0) TEST_ERROR
+ if (H5Fclose(fid_ext) < 0) TEST_ERROR
/* open the "extern" file with read-only */
- if ( (fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset through the external link */
- if ( (did = H5Dopen(fid_ext, NAME_LINK_EXTERN)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_ext, NAME_LINK_EXTERN)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the EXT file */
- if ( H5Fclose(fid_ext) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_ext) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4759,57 +5167,57 @@ test_copy_exist(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE,fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE,fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* try to copy the dataset from SRC to DST again (should fail) */
H5E_BEGIN_TRY {
ret = H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
- if( ret >= 0) TEST_ERROR;
+ if( ret >= 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4868,82 +5276,82 @@ test_copy_path(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST (should fail - intermediate groups not there) */
H5E_BEGIN_TRY {
ret = H5Gcopy(fid_src, NAME_DATASET_SUB_SUB, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
- if( ret >= 0) TEST_ERROR;
+ if( ret >= 0) TEST_ERROR
/* Create the intermediate groups in destination file */
- if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if ( H5Gclose(gid) < 0) TEST_ERROR
- if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR;
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
+ if ( H5Gclose(gid) < 0) TEST_ERROR
- if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_SUB_SUB, (size_t)0)) < 0) TEST_ERROR;
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_SUB_SUB, (size_t)0)) < 0) TEST_ERROR
+ if ( H5Gclose(gid) < 0) TEST_ERROR
/* copy the dataset from SRC to DST, using full path */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SUB_SUB)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SUB_SUB)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4990,32 +5398,32 @@ test_copy_same_file_named_datatype(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create named datatype */
- if ( (H5Tcommit(fid, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR;
+ if ( (H5Tcommit(fid, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
- if ( H5Gcopy(fid, NAME_DATATYPE_SIMPLE, fid, NAME_DATATYPE_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid, NAME_DATATYPE_SIMPLE, fid, NAME_DATATYPE_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the copied datatype */
- if ( (tid2 = H5Topen(fid, NAME_DATATYPE_SIMPLE2)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Topen(fid, NAME_DATATYPE_SIMPLE2)) < 0) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR;
+ if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the file */
- if ( H5Fclose(fid) < 0) TEST_ERROR;
+ if ( H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5100,88 +5508,88 @@ test_copy_dataset_compact_named_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* make a copy of the datatype for later use */
- if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR;
+ if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
/* named data type */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR;
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid_copy) < 0) TEST_ERROR;
+ if ( H5Tclose(tid_copy) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5247,81 +5655,81 @@ test_copy_dataset_contig_named_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* make a copy of the datatype for later use */
- if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR;
+ if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
/* named data type */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR;
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid_copy) < 0) TEST_ERROR;
+ if ( H5Tclose(tid_copy) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5388,88 +5796,88 @@ test_copy_dataset_chunked_named_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* make a copy of the datatype for later use */
- if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR;
+ if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
/* named data type */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR;
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid_copy) < 0) TEST_ERROR;
+ if ( H5Tclose(tid_copy) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5537,89 +5945,89 @@ test_copy_dataset_compressed_named_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* make a copy of the datatype for later use */
- if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR;
+ if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
/* named data type */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR;
+ if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR;
- if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid_copy) < 0) TEST_ERROR;
+ if ( H5Tclose(tid_copy) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5700,82 +6108,82 @@ test_copy_dataset_compact_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create nested VL datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5831,14 +6239,14 @@ test_copy_dataset_contig_vl_vl(hid_t fapl)
buf[i].p=HDmalloc((i+1)*sizeof(hvl_t));
if(buf[i].p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
buf[i].len=i+1;
for(tvl=buf[i].p,j=0; j<(i+1); j++, tvl++) {
tvl->p=HDmalloc((j+1)*sizeof(unsigned int));
if(tvl->p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
tvl->len=j+1;
for(k=0; k<(j+1); k++)
@@ -5855,81 +6263,81 @@ test_copy_dataset_contig_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create nested VL datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5986,14 +6394,14 @@ test_copy_dataset_chunked_vl_vl(hid_t fapl)
buf[i].p=HDmalloc((i+1)*sizeof(hvl_t));
if(buf[i].p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
buf[i].len=i+1;
for(tvl=buf[i].p,j=0; j<(i+1); j++, tvl++) {
tvl->p=HDmalloc((j+1)*sizeof(unsigned int));
if(tvl->p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
tvl->len=j+1;
for(k=0; k<(j+1); k++)
@@ -6009,82 +6417,82 @@ test_copy_dataset_chunked_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create nested VL datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -6142,14 +6550,14 @@ test_copy_dataset_compressed_vl_vl(hid_t fapl)
buf[i].p=HDmalloc((i+1)*sizeof(hvl_t));
if(buf[i].p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
buf[i].len=i+1;
for(tvl=buf[i].p,j=0; j<(i+1); j++, tvl++) {
tvl->p=HDmalloc((j+1)*sizeof(unsigned int));
if(tvl->p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
tvl->len=j+1;
for(k=0; k<(j+1); k++)
@@ -6165,83 +6573,83 @@ test_copy_dataset_compressed_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+ if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+ if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create nested VL datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR;
+ if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR;
- if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR;
+ if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if ( H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR;
+ if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR;
+ if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR;
+ if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR;
+ if ( H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR;
+ if ( H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if ( H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR;
- if ( H5Tclose(tid2) < 0) TEST_ERROR;
+ if ( H5Tclose(tid) < 0) TEST_ERROR
+ if ( H5Tclose(tid2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if ( H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -6283,7 +6691,7 @@ test_copy_option(hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const
hid_t fid_src = -1, fid_dst = -1; /* File IDs */
hid_t sid = -1; /* Dataspace ID */
hid_t did = -1; /* Dataset ID */
- hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t gid=-1, gid2=-1, gid_ref=-1; /* Group IDs */
hid_t gid_sub=-1, gid_sub_sub=-1; /* Sub-group ID */
hid_t pid=-1, lcpl_id=-1; /* Property IDs */
unsigned cpy_flags; /* Object copy flags */
@@ -6309,168 +6717,185 @@ test_copy_option(hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR;
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR;
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR;
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the top group */
- if ( (did = H5Dcreate(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR;
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if((did = H5Dcreate(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* create a sub-group */
- if ( (gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR;
+ if((gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
/* add a dataset to the sub group */
- if ( (did = H5Dcreate(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR;
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if((did = H5Dcreate(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* create sub-sub-group */
- if ( (gid_sub_sub = H5Gcreate(gid_sub, NAME_GROUP_SUB_SUB2, (size_t)0)) < 0) TEST_ERROR;
+ if((gid_sub_sub = H5Gcreate(gid_sub, NAME_GROUP_SUB_SUB2, (size_t)0)) < 0) TEST_ERROR
/* add a dataset to the sub sub group */
- if ( (did = H5Dcreate(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR;
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if((did = H5Dcreate(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataset */
- if (H5Dclose(did) < 0) TEST_ERROR;
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR;
+ if(H5Sclose(sid) < 0) TEST_ERROR
- if( H5Gclose(gid_sub_sub) < 0) TEST_ERROR;
+ if(H5Gclose(gid_sub_sub) < 0) TEST_ERROR
- if( H5Gclose(gid_sub) < 0) TEST_ERROR;
+ if(H5Gclose(gid_sub) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
- if ((flag & H5G_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ if((flag & H5G_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
/* Create group to copy */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR;
- if (H5Glink(fid_src, H5L_LINK_SOFT, NAME_DATASET_SUB_SUB, NAME_LINK_SOFT) < 0) TEST_ERROR;
- if (H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR;
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_LINK_SOFT, NAME_DATASET_SUB_SUB, NAME_LINK_SOFT) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Create group to compare with */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK2, (size_t)0)) < 0) TEST_ERROR;
- if (H5Glink(fid_src, H5L_LINK_HARD, NAME_DATASET_SUB_SUB, NAME_LINK_SOFT2) < 0) TEST_ERROR;
- if (H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE2) < 0) TEST_ERROR;
- if ( H5Gclose(gid) < 0) TEST_ERROR;
- }
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK2, (size_t)0)) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_LINK_HARD, NAME_DATASET_SUB_SUB, NAME_LINK_SOFT2) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ } /* end if */
+
+ if((flag & H5G_COPY_EXPAND_REFERENCE_FLAG) > 0) {
+ if((gid_ref = H5Gcreate(fid_src, NAME_GROUP_REF, (size_t)0)) < 0) TEST_ERROR
+
+ /* create an attribute of object references */
+ if(attach_ref_attr(fid_src, gid_ref) < 0) TEST_ERROR
+
+ /* create a dataset of region references */
+ if(create_reg_ref_dataset(fid_src, gid_ref) < 0) TEST_ERROR
+
+ /* Close group holding reference objects */
+ if(H5Gclose(gid_ref) < 0) TEST_ERROR
+ } /* end if */
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
/* (except when expanding soft links */
- if ((flag & H5G_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR;
+ if((flag & H5G_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
} /* end if */
else
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination
files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR;
+ if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* create property to pass copy options */
- if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR;
+ if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
/* set options for object copy */
- if ( H5Pset_copy_object(pid, flag) < 0) TEST_ERROR;
+ if ( H5Pset_copy_object(pid, flag) < 0) TEST_ERROR
/* Verify object copy flags */
- if ( H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR;
- if ( cpy_flags != flag) TEST_ERROR;
+ if ( H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ if ( cpy_flags != flag) TEST_ERROR
/* copy the group from SRC to DST */
- if (crt_intermediate_grp) {
+ if(crt_intermediate_grp) {
/* Create link creation plist to pass in intermediate group creation */
- if ( (lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR;
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
#ifdef H5_GROUP_REVISION
- if ( H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR;
+ if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
#endif /* H5_GROUP_REVISION */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0) TEST_ERROR;
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0) TEST_ERROR
- if ( H5Pclose(lcpl_id) < 0) TEST_ERROR;
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, "/new_g0/new_g00")) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(fid_dst, "/new_g0/new_g00")) < 0) TEST_ERROR
- } else if ((flag & H5G_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
- if ( H5Gcopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) TEST_ERROR;
+ } else if((flag & H5G_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ if(H5Gcopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) TEST_ERROR
/* Unlink dataset to copy from original location */
/* (So group comparison works properly) */
- if ( H5Gunlink(fid_src, NAME_DATASET_SUB_SUB) < 0) TEST_ERROR;
+ if(H5Gunlink(fid_src, NAME_DATASET_SUB_SUB) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_LINK2)) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid_src, NAME_GROUP_LINK2)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_LINK)) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_LINK)) < 0) TEST_ERROR
} else if(flag & H5G_COPY_WITHOUT_ATTR_FLAG) {
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
} else if(flag & H5G_COPY_SHALLOW_HIERARCHY_FLAG) {
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Set the copy depth */
depth = 1;
+ } else if((flag & H5G_COPY_EXPAND_REFERENCE_FLAG) > 0) {
+ if(H5Gcopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* open the group for copy */
+ if((gid = H5Gopen(fid_src, NAME_GROUP_REF)) < 0) TEST_ERROR
+
+ /* open the destination group */
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_REF)) < 0) TEST_ERROR
} else {
/* Unknown flag */
- TEST_ERROR;
+ TEST_ERROR
} /* end else */
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, pid, depth) != TRUE) TEST_ERROR;
-
- /* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR;
-
- /* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR;
+ if(compare_groups(gid, gid2, pid, depth) != TRUE) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR;
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR;
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* close properties */
- if ( H5Pclose(pid) < 0) TEST_ERROR;
+ if(H5Pclose(pid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -6481,6 +6906,7 @@ error:
H5Pclose(pid);
H5Sclose(sid);
H5Dclose(did);
+ H5Gclose(gid_ref);
H5Gclose(gid_sub);
H5Gclose(gid2);
H5Gclose(gid);
@@ -6508,16 +6934,17 @@ error:
int
main(void)
{
- int nerrors = 0;
- hid_t fapl;
- const char *envval = NULL;
+ const char *envval;
/* Don't run this test using the core, split, or multi file drivers */
envval = HDgetenv("HDF5_DRIVER");
- if (envval == NULL)
+ if(envval == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, "stdio") && HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) {
+ if(HDstrcmp(envval, "stdio") && HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) {
+ int nerrors = 0;
+ hid_t fapl;
+
/* Setup */
h5_reset();
fapl = h5_fileaccess();
@@ -6554,6 +6981,7 @@ main(void)
nerrors += test_copy_dataset_chunked_vl_vl(fapl);
nerrors += test_copy_dataset_compressed_vl_vl(fapl);
nerrors += test_copy_group_empty(fapl);
+ nerrors += test_copy_root_group(fapl);
nerrors += test_copy_group(fapl);
nerrors += test_copy_group_deep(fapl);
nerrors += test_copy_group_loop(fapl);
@@ -6569,39 +6997,34 @@ main(void)
nerrors += test_copy_option(fapl, H5G_COPY_WITHOUT_ATTR_FLAG, FALSE, "H5Gcopy(): without attributes");
#ifdef H5_GROUP_REVISION
nerrors += test_copy_option(fapl, 0, TRUE, "H5Gcopy(): with missing groups");
-#endif /* H5_GROUP_REVISION */
+#endif
nerrors += test_copy_option(fapl, H5G_COPY_EXPAND_SOFT_LINK_FLAG, FALSE, "H5Gcopy(): expand soft link");
nerrors += test_copy_option(fapl, H5G_COPY_SHALLOW_HIERARCHY_FLAG, FALSE, "H5Gcopy(): shallow group copy");
+ nerrors += test_copy_option(fapl, H5G_COPY_EXPAND_REFERENCE_FLAG, FALSE, "H5Gcopy(): expand object reference");
- /* TODO: not implemented
- nerrors += test_copy_option(fapl, H5G_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Gcopy: expand external link");
- nerrors += test_copy_option(fapl, H5G_COPY_EXPAND_EXPAND_OBJ_REFERENCE_FLAG, FALSE, "H5Gcopy: expand object reference");
- */
- /* TODO: Add more tests for copying objects in same file */
-
-
- /* TODO: Add more tests for copying objects in mounted files
+/* TODO: not implemented
+ nerrors += test_copy_option(fapl, H5G_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Gcopy: expand external link");
nerrors += test_copy_mount(fapl);
- */
+ */
/* Reset file address checking info */
addr_reset();
/* Results */
- if (nerrors) {
+ if(nerrors) {
printf("***** %d OBJECT COPY TEST%s FAILED! *****\n",
nerrors, (1 == nerrors ? "" : "S"));
exit(1);
- }
+ } /* end if */
puts ("All object copying tests passed.");
+
h5_cleanup(FILENAME, fapl);
- }
+ } /* end if */
else
- {
puts("All object copying tests skipped - Incompatible with current Virtual File Driver");
- }
+
return 0;
} /* main */
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index c86726d..d88c9ba 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -77,7 +77,7 @@ usage: h5copy [OPTIONS] [OBJECTS...]\n\
H5G_COPY_SHALLOW_HIERARCHY_FLAG\n\
H5G_COPY_EXPAND_SOFT_LINK_FLAG\n\
H5G_COPY_EXPAND_EXT_LINK_FLAG\n\
- H5G_COPY_EXPAND_OBJ_REFERENCE_FLAG\n\
+ H5G_COPY_EXPAND_REFERENCE_FLAG\n\
H5G_COPY_WITHOUT_ATTR_FLAG\n\
H5G_COPY_ALL\n");
}
@@ -127,7 +127,7 @@ static int parse_flag(const char* str_flag, unsigned *flag)
}
else if (strcmp(str_flag,"ref")==0)
{
- fla = H5G_COPY_EXPAND_OBJ_REFERENCE_FLAG;
+ fla = H5G_COPY_EXPAND_REFERENCE_FLAG;
}
else if (strcmp(str_flag,"noattr")==0)
{