From d16a803257ca2b2d4c03db4c7b5649fed690bfcf Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 13 May 2007 23:05:28 -0500 Subject: [svn-r13750] Description: Various minor cleanups found while working on the "unique, but sharable" ISOHM changes. Tested on: Mac OS X/32 10.4.9 (amazon) FreeBSD/32 6.2 (duty) --- src/H5Atest.c | 2 +- src/H5FD.c | 6 ++++++ src/H5Gtraverse.c | 10 ++++++---- src/H5HF.c | 9 +++++++++ src/H5HFman.c | 2 +- src/H5MF.c | 8 ++++---- src/H5SMtest.c | 2 +- src/H5Spkg.h | 2 +- test/links.c | 10 ++++++---- test/objcopy.c | 9 +++++++++ test/tattr.c | 2 +- 11 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/H5Atest.c b/src/H5Atest.c index f8a0f02..df88472 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -138,7 +138,7 @@ H5A_get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) /* Sanity check */ HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr)); - /* Retrieve ref count for shared attribute */ + /* Retrieve ref count for shared or shareable attribute */ if(H5SM_get_refcount(attr->oloc.file, H5AC_ind_dxpl_id, H5O_ATTR_ID, &attr->sh_loc, ref_count) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") diff --git a/src/H5FD.c b/src/H5FD.c index cb15467..8849084 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -1880,6 +1880,9 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); } } else { /* Allocate another metadata block */ +#ifdef H5FD_ALLOC_DEBUG +HDfprintf(stderr, "%s: Allocating 'metadata' block\n", FUNC); +#endif /* H5FD_ALLOC_DEBUG */ if(HADDR_UNDEF==(new_meta = H5FD_real_alloc(file, H5FD_MEM_DEFAULT, dxpl_id, file->def_meta_block_size))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata block") @@ -1996,6 +1999,9 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); } } else { /* Allocate another "small data" block */ +#ifdef H5FD_ALLOC_DEBUG +HDfprintf(stderr, "%s: Allocating 'small data' block\n", FUNC); +#endif /* H5FD_ALLOC_DEBUG */ if(HADDR_UNDEF==(new_data = H5FD_real_alloc(file, type, dxpl_id, file->def_sdata_block_size))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data block") diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 99a9113..72a9d07 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -266,7 +266,9 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* We have a copy of the location and we're holding the file open. * Close the open ID the user passed back. */ - H5Idec_ref(cb_return); + if(H5I_dec_ref(cb_return) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") + cb_return = (-1); done: /* Close location given to callback. */ @@ -276,11 +278,11 @@ done: if(ret_value < 0 && cb_return > 0) if(H5I_dec_ref(cb_return) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") + HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") - /* Close the LAPL, if we copied the default one */ + /* Close the LAPL, if we copied one */ if(lapl_id > 0 && H5I_dec_ref(lapl_id) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close copied link access property list") + HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close copied link access property list") FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_traverse_ud() */ diff --git a/src/H5HF.c b/src/H5HF.c index b617ec9..768b7e7 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -156,6 +156,9 @@ H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) H5HF_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5HF_create, NULL) +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ /* * Check arguments. @@ -579,6 +582,9 @@ H5HF_write(H5HF_t *fh, hid_t dxpl_id, void *_id, hbool_t UNUSED *id_changed, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_write, FAIL) +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ /* * Check arguments. @@ -716,6 +722,9 @@ H5HF_remove(H5HF_t *fh, hid_t dxpl_id, const void *_id) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_remove, FAIL) +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ /* * Check arguments. diff --git a/src/H5HFman.c b/src/H5HFman.c index bd5c680..cf3f939 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -282,7 +282,7 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, /* Skip over the flag byte */ id++; - /* Decode the object offset within the heap & it's length */ + /* Decode the object offset within the heap & its length */ #ifdef QAK HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size); #endif /* QAK */ diff --git a/src/H5MF.c b/src/H5MF.c index 8dff17d..6d44c69 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -216,6 +216,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } + /*------------------------------------------------------------------------- * Function: H5MF_alloc_overflow * @@ -227,10 +228,9 @@ done: * 1 if overflow would result (the allocation should not be allowed) * * Programmer: James Laird - * Nat Furrer + * Nat Furrer * Tuesday, June 1, 2004 * - * Modifications: *------------------------------------------------------------------------- */ hbool_t @@ -267,9 +267,9 @@ H5MF_alloc_overflow(H5F_t *f, hsize_t size) space_needed = space_needed >> 16; if(space_needed != 0) - ret_value=TRUE; + ret_value = TRUE; else - ret_value=FALSE; + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) } diff --git a/src/H5SMtest.c b/src/H5SMtest.c index dc619e3..5de8ce1 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -97,7 +97,7 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id, if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") - /* Find the correct index and try to delete from it */ + /* Find the correct index for this message type */ if((index_num = H5SM_get_index(table, type_id)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") header = &(table->indexes[index_num]); diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 990c525..907b6fd 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -160,7 +160,7 @@ typedef struct { /* Main dataspace structure (typedef'd in H5Sprivate.h) */ struct H5S_t { - H5S_extent_t extent; /* Dataspace extent */ + H5S_extent_t extent; /* Dataspace extent (must stay first) */ H5S_select_t select; /* Dataspace selection */ }; diff --git a/test/links.c b/test/links.c index ca0945c..67301dc 100644 --- a/test/links.c +++ b/test/links.c @@ -3390,13 +3390,15 @@ external_link_closing(hid_t fapl, hbool_t new_format) /* Test move */ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, - "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Open file 4 so we can do some fancy things */ if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, - "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lmove(fid4, "dataset1", fid1, - "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Close file 4 again */ if(H5Fclose(fid4) < 0) TEST_ERROR @@ -3526,7 +3528,7 @@ error: H5Fclose(fid1); } H5E_END_TRY; return -1; -} +} /* external_link_closing() */ /*------------------------------------------------------------------------- diff --git a/test/objcopy.c b/test/objcopy.c index c773440..27a29d1 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -32,6 +32,8 @@ #include "H5Spkg.h" /* Dataspaces */ #include "H5Dprivate.h" /* Datasets (for EFL property name) */ +#include "H5Fprivate.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ const char *FILENAME[] = { @@ -1148,7 +1150,9 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) /* Release raw data buffers */ HDfree(rbuf); + rbuf = NULL; HDfree(rbuf2); + rbuf2 = NULL; /* close the source dataspace */ if(H5Sclose(sid) < 0) TEST_ERROR @@ -3408,6 +3412,11 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Fclose(fid_src) < 0) TEST_ERROR + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + if(H5F_sfile_assert_num(0) != 0) TEST_ERROR + + /* open the source file with read-only */ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR diff --git a/test/tattr.c b/test/tattr.c index 0b47ed8..d50e7d9 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -6988,7 +6988,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Create "big" dataspace for "large" attributes */ big_sid = H5Screate_simple(SPACE1_RANK, big_dims, NULL); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(big_sid, FAIL, "H5Screate_simple"); /* Loop over type of shared components */ for(test_shared = 0; test_shared < 3; test_shared++) { -- cgit v0.12