From 8368e9b6844a7554ea91067ac5eb4b91734e8639 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 10 Dec 2014 15:29:47 -0500 Subject: [svn-r25881] Description: Minor code/comment cleanups, found while reviewing 'avoid truncate' code. Tested on: MacOSX/64 10.10.1 (amazon) w/serial & parallel (Too minor to require h5committest) --- src/H5FDmulti.c | 82 ++++++++++------------------------------------------ src/H5Fsuper_cache.c | 8 +++-- 2 files changed, 21 insertions(+), 69 deletions(-) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 38097c8..b7caa68 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -196,8 +196,6 @@ static const H5FD_class_t H5FD_multi_g = { * Programmer: Robb Matzke * Friday, August 13, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static char * @@ -230,8 +228,6 @@ my_strdup(const char *s) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t @@ -283,14 +279,6 @@ H5FD_multi_term(void) * Programmer: Robb Matzke * Wednesday, August 11, 1999 * - * Modifications: - * Albert Cheng, Sep 17, 2001 - * Added feature that if the raw or meta extension string contains - * a "%s", it will be substituted by the filename given for H5Fopen - * or H5Fcreate. This is same as the multi-file syntax. If no %s - * is found, one is inserted at the beginning. This is the previous - * behavior. - * *------------------------------------------------------------------------- */ herr_t @@ -440,11 +428,6 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * - * Raymond Lu, 2001-10-25 - * Use new generic property list for argument checking. - * *------------------------------------------------------------------------- */ herr_t @@ -547,11 +530,6 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * - * Raymond Lu, 2001-10-25 - * Use new generic property list for argument checking. - * *------------------------------------------------------------------------- */ herr_t @@ -616,8 +594,6 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, * Programmer: Robb Matzke * Monday, August 16, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t @@ -669,8 +645,6 @@ H5FD_multi_sb_size(H5FD_t *_file) * Programmer: Robb Matzke * Monday, August 16, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -908,8 +882,6 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) * Programmer: Robb Matzke * Friday, August 13, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -936,8 +908,6 @@ H5FD_multi_fapl_get(H5FD_t *_file) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -992,8 +962,6 @@ H5FD_multi_fapl_copy(const void *_old_fa) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1032,8 +1000,6 @@ H5FD_multi_fapl_free(void *_fa) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -1132,8 +1098,6 @@ error: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1197,8 +1161,6 @@ H5FD_multi_close(H5FD_t *_file) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1240,8 +1202,6 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * Programmer: Quincey Koziol * Tuesday, September 26, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1315,7 +1275,6 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) { const H5FD_multi_t *file = (const H5FD_multi_t*)_file; haddr_t eoa = 0; - haddr_t memb_eoa = 0; static const char *func="H5FD_multi_get_eoa"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1329,21 +1288,25 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) */ if(H5FD_MEM_DEFAULT == type) { UNIQUE_MEMBERS(file->fa.memb_map, mt) { + haddr_t memb_eoa; + if (file->memb[mt]) { /* Retrieve EOA */ H5E_BEGIN_TRY { memb_eoa = H5FDget_eoa(file->memb[mt], mt); } H5E_END_TRY; - if (HADDR_UNDEF==memb_eoa) + if(HADDR_UNDEF == memb_eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) - } else if (file->fa.relax) { + if(memb_eoa>0) + memb_eoa += file->fa.memb_addr[mt]; + } else if(file->fa.relax) { /* * The member is not open yet (maybe it doesn't exist). Make the * best guess about the end-of-file. */ memb_eoa = file->memb_next[mt]; - assert(HADDR_UNDEF!=memb_eoa); + assert(HADDR_UNDEF != memb_eoa); } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) } @@ -1353,23 +1316,26 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) } END_MEMBERS; } else { H5FD_mem_t mmt = file->fa.memb_map[type]; - if (H5FD_MEM_DEFAULT==mmt) mmt = type; - if (file->memb[mmt]) { + if(H5FD_MEM_DEFAULT==mmt) + mmt = type; + + if(file->memb[mmt]) { H5E_BEGIN_TRY { eoa = H5FDget_eoa(file->memb[mmt], mmt); } H5E_END_TRY; - if (HADDR_UNDEF==eoa) + if(HADDR_UNDEF == eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) - if (eoa>0) eoa += file->fa.memb_addr[mmt]; - } else if (file->fa.relax) { + if(eoa > 0) + eoa += file->fa.memb_addr[mmt]; + } else if(file->fa.relax) { /* * The member is not open yet (maybe it doesn't exist). Make the * best guess about the end-of-file. */ eoa = file->memb_next[mmt]; - assert(HADDR_UNDEF!=eoa); + assert(HADDR_UNDEF != eoa); } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) } @@ -1461,12 +1427,6 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 5 January 2007 - * Multi driver no longer has EOA for the whole file. Calculate - * it in the same way as EOF instead. - * *------------------------------------------------------------------------- */ static haddr_t @@ -1531,8 +1491,6 @@ H5FD_multi_get_eof(const H5FD_t *_file) * Programmer: Raymond Lu * Sept. 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1566,8 +1524,6 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) * Programmer: Robb Matzke * Thursday, August 12, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t @@ -1615,8 +1571,6 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) * Programmer: Robb Matzke * Thursday, August 12, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1867,8 +1821,6 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) * Programmer: Robb Matzke * Monday, August 23, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1910,8 +1862,6 @@ compute_next(H5FD_multi_t *file) * Programmer: Robb Matzke * Monday, August 23, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static int diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 45fad37..fac3bed 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -121,7 +121,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) H5F_file_t *shared; /* shared part of `file' */ H5FD_t *lf; /* file driver part of `shared' */ haddr_t stored_eoa; /*relative end-of-addr in file */ - haddr_t eof; /*end of file address */ + haddr_t eof; /* end of file address */ uint8_t sizeof_addr; /* Size of offsets in the file (in bytes) */ uint8_t sizeof_size; /* Size of lengths in the file (in bytes) */ const size_t fixed_size = H5F_SUPERBLOCK_FIXED_SIZE; /*fixed sizeof superblock */ @@ -476,11 +476,13 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) * individually. */ if(HADDR_UNDEF == (eof = H5FD_get_eof(lf))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to determine file size") /* (Account for the stored EOA being absolute offset -QAK) */ if((eof + sblock->base_addr) < stored_eoa) - HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, NULL, "truncated file: eof = %llu, sblock->base_addr = %llu, stored_eoa = %llu", (unsigned long long)eof, (unsigned long long)sblock->base_addr, (unsigned long long)stored_eoa) + HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, NULL, + "truncated file: eof = %llu, sblock->base_addr = %llu, stored_eoa = %llu", + (unsigned long long)eof, (unsigned long long)sblock->base_addr, (unsigned long long)stored_eoa) /* * Tell the file driver how much address space has already been -- cgit v0.12