From d165e1d8e7c01f201dcb228464064a8f8e50174b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 2 Apr 2006 10:29:35 -0500 Subject: [svn-r12191] Purpose: Bug fix Description: Correct the handling of the group creation property list when copying objects with the "create intermediate groups" flag. Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest (once I pay attention to the compiler warnings... :-) --- src/H5G.c | 14 ++++++++------ src/H5Odtype.c | 2 +- src/H5Opline.c | 2 +- test/objcopy.c | 14 +++++++------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/H5G.c b/src/H5G.c index acdd54f..8b9f2fd 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -3013,7 +3013,7 @@ H5G_copy(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, hid_t pli if(H5O_copy_header(src_loc->oloc, &new_oloc, dxpl_id, cpy_option) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") - /* create group creatiion property to create missing groups */ + /* Create group creatiion property to create missing groups */ if((cpy_option & H5G_COPY_CREATE_INTERMEDIATE_GROUP_FLAG) > 0) { if(NULL == (gcrt_class = H5I_object_verify(H5P_GROUP_CREATE, H5I_GENPROP_CLS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); @@ -3022,15 +3022,17 @@ H5G_copy(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, hid_t pli if((gcplist_id = H5P_create_id(gcrt_class)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list"); gcplist_created = TRUE; - - if(H5P_set(gcplist_id, H5G_CRT_INTERMEDIATE_GROUP_NAME, &cpy_option) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set intermediate group creation flag") } else - plist_id = H5P_GROUP_CREATE_DEFAULT; + gcplist_id = H5P_GROUP_CREATE_DEFAULT; - if(NULL == (gcrt_plist = H5I_object(plist_id))) + if(NULL == (gcrt_plist = H5I_object(gcplist_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + /* Set the intermediate group creation property, if requested */ + if(gcplist_created) + if(H5P_set(gcrt_plist, H5G_CRT_INTERMEDIATE_GROUP_NAME, &cpy_option) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set intermediate group creation flag") + /* Insert the new object in the destination file's group */ if(H5G_insert(dst_loc, dst_name, &new_loc, dxpl_id, gcrt_plist) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert the name") diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 876d190..9f44924 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1216,7 +1216,7 @@ H5O_dtype_set_share(H5F_t UNUSED *f, void *_mesg/*in,out*/, *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type, void *mesg_src, void *_udata) +H5O_dtype_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *type, void *mesg_src, void *_udata) { H5T_t *dt_src = (H5T_t *)mesg_src; /* Source datatype */ H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 7746987..d27cfb2 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -441,7 +441,7 @@ H5O_pline_free (void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_pline_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type, void *mesg_src, void *_udata) +H5O_pline_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *type, void *mesg_src, void *_udata) { H5O_pline_t *pline_src = (H5O_pline_t *)mesg_src; /* Source datatype */ H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ diff --git a/test/objcopy.c b/test/objcopy.c index 579beac..b19e5dd 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -4848,7 +4848,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_mount(hid_t fapl) +test_copy_mount(hid_t UNUSED fapl) { TESTING("H5Gcopy(): objects between mounted files"); @@ -5635,14 +5635,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); - return; + 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); - return; + TEST_ERROR; } /* end if */ tvl->len=j+1; for(k=0; k<(j+1); k++) @@ -5790,14 +5790,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); - return; + 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); - return; + TEST_ERROR; } /* end if */ tvl->len=j+1; for(k=0; k<(j+1); k++) @@ -5946,14 +5946,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); - return; + 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); - return; + TEST_ERROR; } /* end if */ tvl->len=j+1; for(k=0; k<(j+1); k++) -- cgit v0.12