diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2013-05-11 16:42:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2013-05-11 16:42:54 (GMT) |
commit | afc68537cd8cbbea9473f27b7f003f5ca418f77f (patch) | |
tree | 79510c7cd19db4ab4f7e4e19c82ca9c2b6525151 /src/H5Ocopy.c | |
parent | 260ed1d2bc81e7fe39aec06706b72d36fa81ecf0 (diff) | |
download | hdf5-afc68537cd8cbbea9473f27b7f003f5ca418f77f.zip hdf5-afc68537cd8cbbea9473f27b7f003f5ca418f77f.tar.gz hdf5-afc68537cd8cbbea9473f27b7f003f5ca418f77f.tar.bz2 |
[svn-r23696] Description:
Bring r23695 from trunk to 1.8 branch:
Clean up warnings in H5Tconv.c (down to _only_ 9000 lines of output now!)
Merge changes from Coverity branch back to trunk:
r20684:
Fix for coverity bug #1721 which was due to the fix for coverity bug #943.
r20685:
Use HDstrncpy. --gh
r20761:
Purpose: Fix valgrind issues
Description:
Free image_data and data as appropriate in test_image.
r20762:
Purpose: Fix coverity issue 600
Description:
Add check for return value of H5O_close in H5Ocopy. Also cleaned up various
warnings.
r20763:
Purpose: Fix valgrind issues with h5stat
Description:
Modified h5stat to free "iter" before exit, and free "hand" before exit if
parse_command_line exits directly.
r20764:
fixed coverity issues:
69, 327, 614, 684, 685, 696, 697, 1681, 967, 826, 660, 80
r20765:
Fixed coverity bug 668
Pulled x * y * z multiply out of malloc operand into a separate n_elements variable to quiet integer overflow warning.
No actual integer overflow tests are performed since it's just a test program but I did add a check that n_elements is >= 1.
I also changed an error condition from doing its own close and returning -1 to "goto out;" like the rest of the program.
r20766:
Fixed coverity bug 667
Pulled x * y * z multiply out of malloc operand into a separate n_elements variable to quiet integer overflow warning.
No actual integer overflow tests are performed since it's just a test program.
Tested on:
Mac OSX/64 10.8.3 (amazon) w/C++ & FORTRAN
(h5committest upcoming)
Diffstat (limited to 'src/H5Ocopy.c')
-rw-r--r-- | src/H5Ocopy.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 4b5c365..5698fc0 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -286,9 +286,9 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, done: if(loc_found && H5G_loc_free(&src_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - if(obj_open) - H5O_close(&src_oloc); + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + if(obj_open && H5O_close(&src_oloc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") FUNC_LEAVE_API(ret_value) } /* end H5Ocopy() */ @@ -669,7 +669,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, } /* end if */ /* Add in destination's object header size now */ - dst_oh_size += H5O_SIZEOF_HDR(oh_dst); + dst_oh_size += (uint64_t)H5O_SIZEOF_HDR(oh_dst); /* Allocate space for chunk in destination file */ if(HADDR_UNDEF == (oh_dst->chunk[0].addr = H5MF_alloc(oloc_dst->file, H5FD_MEM_OHDR, dxpl_id, (hsize_t)dst_oh_size))) @@ -1274,7 +1274,8 @@ H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id, 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 */ - uint8_t *p; /* Pointer to OID to store */ + const uint8_t *q; /* Pointer to source OID to store */ + uint8_t *p; /* Pointer to destination OID to store */ size_t i; /* Local index variable */ herr_t ret_value = SUCCEED; @@ -1308,8 +1309,8 @@ H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id, /* Making equivalent references in the destination file */ for(i = 0; i < ref_count; i++) { /* Set up for the object copy for the reference */ - p = (uint8_t *)(&src_ref[i]); - H5F_addr_decode(src_oloc.file, (const uint8_t **)&p, &(src_oloc.addr)); + q = (uint8_t *)(&src_ref[i]); + H5F_addr_decode(src_oloc.file, (const uint8_t **)&q, &(src_oloc.addr)); dst_oloc.addr = HADDR_UNDEF; /* Attempt to copy object from source to destination file */ @@ -1337,9 +1338,9 @@ H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id, /* 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); + q = (const uint8_t *)(&src_ref[i]); + H5F_addr_decode(src_oloc.file, (const uint8_t **)&q, &(hobjid.addr)); + UINT32DECODE(q, hobjid.idx); if(hobjid.addr != (haddr_t)0) { /* Get the dataset region from the heap (allocate inside routine) */ @@ -1347,8 +1348,8 @@ H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id, 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)); + q = (const uint8_t *)buf; + H5F_addr_decode(src_oloc.file, (const uint8_t **)&q, &(src_oloc.addr)); dst_oloc.addr = HADDR_UNDEF; /* copy the object pointed by the ref to the destination */ @@ -1374,7 +1375,7 @@ H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id, /* 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); + UINT32ENCODE(p, hobjid.idx); /* Free the buffer allocated in H5HG_read() */ H5MM_xfree(buf); |