From 74c6f4d9df218dfce5e203137759841f57fa4228 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Oct 2021 19:14:08 +0000 Subject: Committing clang-format changes --- src/H5FDonion.c | 56 ++++++++++++++++++++++++++++++-------------------------- test/onion.c | 36 ++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 44 deletions(-) diff --git a/src/H5FDonion.c b/src/H5FDonion.c index 77269b7..ffd29d7 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -687,7 +687,7 @@ done: /* TODO: Use the VFD's del callback instead of remove (this requires * storing a copy of the fapl that was used to open it) */ - //if (HDremove(file->name_recov) < 0) + // if (HDremove(file->name_recov) < 0) // HDONE_ERROR(H5E_VFL, H5E_CANTDELETE, FAIL, "can't remove delete backing recovery file") HDremove(file->name_recov); } @@ -1868,7 +1868,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma if (NULL == (name_recovery = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to allocate recovery name string") HDsnprintf(name_recovery, HDstrlen(name_onion) + 10, "%s.recovery", name_onion); - file->name_recov = name_recovery; + file->name_recov = name_recovery; if (NULL == (file->name_recov = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to allocate recovery name string") @@ -1977,17 +1977,17 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Create backing files for onion history */ - if ((file->backing_onion = H5FD_open(name_onion, (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC), - backing_fapl_id, maxaddr)) < 0) { + if ((file->backing_onion = + H5FD_open(name_onion, (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC), + backing_fapl_id, maxaddr)) < 0) { HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "cannot open the backing onion file") } - /*if ((file->backing_recov = H5FD_open(name_recovery, (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC), - backing_fapl_id, maxaddr)) < 0) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "cannot open the backing recovery file") - } else { - printf("\n\n\n\n\nOPENED BACKING RECOVERY FILE: %s\n\n\n\n\n", name_recovery); - }*/ + /*if ((file->backing_recov = H5FD_open(name_recovery, (H5F_ACC_RDWR | H5F_ACC_CREAT | + H5F_ACC_TRUNC), backing_fapl_id, maxaddr)) < 0) { HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, + NULL, "cannot open the backing recovery file") } else { printf("\n\n\n\n\nOPENED BACKING + RECOVERY FILE: %s\n\n\n\n\n", name_recovery); + }*/ /// snipped from here @@ -2012,11 +2012,15 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer") saved_size = size; whs_p->n_revisions = 0; - //whs_p->n_revisions = 1; - //whs_p->record_pointer_list = (struct H5FD__onion_record_pointer*)H5MM_calloc(whs_p->n_revisions * sizeof(struct H5FD__onion_record_pointer)); - - // whs_p->record_pointer_list = (struct H5FD__onion_record_pointer *)HDmalloc(0); - //whs_p->record_pointer_list = (struct H5FD__onion_record_pointer*)HDcalloc(whs_p->n_revisions, sizeof(struct H5FD__onion_record_pointer)); + // whs_p->n_revisions = 1; + // whs_p->record_pointer_list = (struct + // H5FD__onion_record_pointer*)H5MM_calloc(whs_p->n_revisions * sizeof(struct + // H5FD__onion_record_pointer)); + + // whs_p->record_pointer_list = (struct H5FD__onion_record_pointer *)HDmalloc(0); + // whs_p->record_pointer_list = (struct + // H5FD__onion_record_pointer*)HDcalloc(whs_p->n_revisions, sizeof(struct + // H5FD__onion_record_pointer)); size = H5FD_onion_whole_history_encode(whs_p, wh_buf, &whs_p->checksum); // MOVED HERE file->header.whole_history_size = size; /* record for later use */ @@ -2040,7 +2044,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma rec_p->archival_index.list = NULL; - // TODO: Remove these 2 lines or are they needed? + // TODO: Remove these 2 lines or are they needed? /*if (NULL == (file->rev_index = H5FD_onion_revision_index_init(file->fa.page_size))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "can't initialize revision index")*/ @@ -2065,9 +2069,9 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma // buf = NULL; if (head_buf != NULL) - free(head_buf); - if (wh_buf != NULL) - free(wh_buf); + free(head_buf); + if (wh_buf != NULL) + free(wh_buf); // if (FAIL == ret_value) { // HDremove(name_recovery); /* destroy new temp file, if 'twas created */ @@ -2462,14 +2466,14 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, if (0 == i) page_gap_head = offset & (((uint32_t)1 << page_size_log2) - 1); - // If we have a page_gap_head and the number of bytes to write is evenly divisible by the page size we need to add an additional page - // to make up for the page_gap_head - if (page_gap_head > 0 && bytes_to_write % page_size == 0) { - n_pages++; - } + // If we have a page_gap_head and the number of bytes to write is evenly divisible by the page size we + // need to add an additional page to make up for the page_gap_head + if (page_gap_head > 0 && bytes_to_write % page_size == 0) { + n_pages++; + } if (n_pages - 1 == i) { page_gap_tail = page_size - bytes_to_write - page_gap_head; - } + } page_n_used = page_size - page_gap_head - page_gap_tail; /* Modify page in revision index, if present */ @@ -2531,7 +2535,7 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, } /* end if page exists in neither index */ /* Copy input buffer to temporary page buffer */ - assert((page_size - page_gap_head) >= page_n_used); + assert((page_size - page_gap_head) >= page_n_used); HDmemcpy(page_buf + page_gap_head, buf, page_n_used); write_buf = page_buf; diff --git a/test/onion.c b/test/onion.c index 8eff8ae..76a1135 100644 --- a/test/onion.c +++ b/test/onion.c @@ -1387,10 +1387,10 @@ test_revision_record_encode_decode(void) size_t i = 0; uint64_t size_ret; struct H5FD__onion_revision_record r_out; - uint32_t sum_out = 0; - char username[8] = "JohnDoe"; - char comment[25] = "Example comment message."; - struct H5FD__onion_revision_record record = { + uint32_t sum_out = 0; + char username[8] = "JohnDoe"; + char comment[25] = "Example comment message."; + struct H5FD__onion_revision_record record = { H5FD__ONION_REVISION_RECORD_MAGIC, H5FD__ONION_REVISION_RECORD_VERSION_CURR, 5, /* revision ID */ @@ -1402,13 +1402,13 @@ test_revision_record_encode_decode(void) 25, /* comment size */ { H5FD__ONION_ARCHIVAL_INDEX_MAGIC, H5FD__ONION_ARCHIVAL_INDEX_VERSION_CURR, - 12, /* page_size_log2 */ - 4, /* n_entries */ - NULL, /* list - populated below */ - }, /* archival index struct */ - username, /* username */ + 12, /* page_size_log2 */ + 4, /* n_entries */ + NULL, /* list - populated below */ + }, /* archival index struct */ + username, /* username */ comment, /* comment */ - 0, /* checksum - computed for us */ + 0, /* checksum - computed for us */ }; uint64_t exp_size = H5FD__ONION_ENCODED_SIZE_REVISION_RECORD + (H5FD__ONION_ENCODED_SIZE_INDEX_ENTRY * record.archival_index.n_entries) + @@ -3250,12 +3250,12 @@ test_integration_create(void) * CLEANUP */ - if (H5Dclose(dset) < 0) - TEST_ERROR - dset = H5I_INVALID_HID; - if (H5Fclose(file_id) < 0) - TEST_ERROR - file_id = H5I_INVALID_HID; + if (H5Dclose(dset) < 0) + TEST_ERROR + dset = H5I_INVALID_HID; + if (H5Fclose(file_id) < 0) + TEST_ERROR + file_id = H5I_INVALID_HID; if (H5Pclose(fapl_id) < 0) TEST_ERROR; fapl_id = H5I_INVALID_HID; @@ -3277,8 +3277,8 @@ error: onion_filepaths_destroy(paths); } - if (dset != H5I_INVALID_HID) - (void)H5Dclose(dset); + if (dset != H5I_INVALID_HID) + (void)H5Dclose(dset); if (file_id != H5I_INVALID_HID) (void)H5Fclose(file_id); if (fapl_id != H5I_INVALID_HID) -- cgit v0.12