From 946fd98b8d5b653b89cfdce279195810f389dedf Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 25 May 2017 06:45:53 -0400 Subject: Fixed many minor warnings. --- hl/test/test_dset_opt.c | 2 +- hl/test/test_packet_vlen.c | 77 +++++++------- hl/tools/h5watch/extend_dset.c | 60 +++++------ src/H5Dint.c | 200 ++++++++++++++++++----------------- src/H5Dio.c | 1 - src/H5FDspace.c | 2 - src/H5MFdbg.c | 50 ++++----- src/H5MFsection.c | 2 +- src/H5Ocache_image.c | 2 +- test/flushrefresh.c | 1 + test/mf.c | 4 + test/plugin.c | 8 +- test/swmr_remove_writer.c | 2 +- test/use_common.c | 14 ++- tools/lib/h5diff_array.c | 12 +-- tools/src/h5repack/h5repack_verify.c | 2 +- 16 files changed, 225 insertions(+), 214 deletions(-) diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c index 4b5fa19..383a87a 100644 --- a/hl/test/test_dset_opt.c +++ b/hl/test/test_dset_opt.c @@ -47,7 +47,7 @@ #define CHUNK_NX 4 #define CHUNK_NY 4 -#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) +#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0)) /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS1 305 diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 35bd43a..1d6231e 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -928,64 +928,60 @@ error: /* An error has occurred. Clean up and exit. */ * 2016/01/27 -BMR *------------------------------------------------------------------------- */ -static herr_t verify_accessors(hid_t fid, const char *table_name, herr_t expected_value) +static herr_t verify_accessors(hid_t fid, const char *table_name, hbool_t uses_vlen_type) { - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */ - hid_t dtype_id=H5I_INVALID_HID; /* Dataset identifier */ + hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ + hid_t dset_id = H5I_INVALID_HID; /* Dataset associated with the pt */ + hid_t dtype_id = H5I_INVALID_HID; /* Dataset identifier */ char buf[NAME_BUF_SIZE]; ssize_t name_size; - herr_t is_varlen = 0; - herr_t ret = FAIL; /* Returned status from a callee */ + htri_t vlen_check_result = -1; /* Open the named packet table. */ - ptable = H5PTopen(fid, table_name); - if (ptable < 0) - goto error; + if((ptable = H5PTopen(fid, table_name)) < 0) + goto error; /* Get the associated dataset ID. */ - dset_id = H5PTget_dataset(ptable); - if (dset_id < 0) - goto error; + if((dset_id = H5PTget_dataset(ptable)) < 0) + goto error; /* Check if the packet table's name matches its associated dataset's. */ *buf = '\0'; - name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE); - if (name_size < 0) - goto error; + if((name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE)) < 0) + goto error; VERIFY(HDstrcmp(buf, table_name), "Names of dataset and packet table don't match"); /* Get the packet table's datatype ID */ - dtype_id = H5PTget_type(ptable); - if (dtype_id < 0) - goto error; + if((dtype_id = H5PTget_type(ptable)) < 0) + goto error; /* Check if the type class matches that of the packet table. */ - is_varlen = H5Tdetect_class(dtype_id, H5T_VLEN); - if (is_varlen == FAIL) /* failure occurred */ - goto error; - else if (is_varlen == expected_value) /* length types match */ - ret = SUCCEED; - else /* length types don't match */ - { - /* Give lengthtype "fixed-length" or "variable-length" depending on the - expected_value passed in, then print the error message. */ - char lenthtype[20]; - HDstrcpy(lenthtype, "fixed-length"); - if (expected_value == 1) - HDstrcpy(lenthtype, "variable-length"); - fprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype); - ret = FAIL; + if((vlen_check_result = H5Tdetect_class(dtype_id, H5T_VLEN)) < 0) + goto error; + + /* Check if length types match */ + if (vlen_check_result != (htri_t)uses_vlen_type) { + /* Give lengthtype "fixed-length" or "variable-length" depending on the + * expected_value passed in, then print the error message. + */ + char lenthtype[20]; + if (uses_vlen_type == TRUE) + HDstrcpy(lenthtype, "variable-length"); + else + HDstrcpy(lenthtype, "fixed-length"); + HDfprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype); + goto error; } /* Close the packet table */ if (H5PTclose(ptable) < 0) - goto error; + goto error; return SUCCEED; error: /* An error has occurred. Clean up and exit. */ - if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + if (H5PTis_valid(ptable) > 0) + H5PTclose(ptable); H5_FAILED(); return FAIL; } /* verify_accessors */ @@ -1010,25 +1006,26 @@ static int test_accessors(void) /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; ret = verify_accessors(fid, PT_VLEN_ATOMIC, TRUE); if (ret < 0) - goto error; + goto error; ret = verify_accessors(fid, PT_FIXED_LEN, FALSE); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; error: /* An error has occurred. Clean up and exit. */ - if (fid > 0) H5Fclose(fid); + if (fid > 0) + H5Fclose(fid); H5_FAILED(); return FAIL; } /* test_accessors */ diff --git a/hl/tools/h5watch/extend_dset.c b/hl/tools/h5watch/extend_dset.c index 957db10..4299586 100644 --- a/hl/tools/h5watch/extend_dset.c +++ b/hl/tools/h5watch/extend_dset.c @@ -78,7 +78,7 @@ extend_dset_two(const char *file, char *dname, int action1, int action2) hid_t sid = -1; /* dataspace id */ hid_t dtid = -1; /* dataset's datatype id */ int ndims; /* # of dimension sizes */ - unsigned i, j; /* local index variable */ + unsigned i; /* local index variable */ hsize_t ext_dims[2]; /* new dimension sizes after extension */ hsize_t cur_dims[2]; /* current dimension sizes */ size_t dtype_size; /* size of the dataset's datatype */ @@ -144,23 +144,23 @@ extend_dset_two(const char *file, char *dname, int action1, int action2) goto error; num_elmts = 1; - for(j = 0; j < (unsigned)ndims; j++) - num_elmts *= (unsigned)ext_dims[j]; + for(i = 0; i < (unsigned)ndims; i++) + num_elmts *= (unsigned)ext_dims[i]; /* Compound type */ if(!HDstrcmp(dname, DSET_CMPD_TWO)) { HDmemset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t)); - for(j = 0; j < num_elmts; j++) { - cbuf[j].field1 = action1; - cbuf[j].field2.a = action1; - cbuf[j].field2.c = action1; - cbuf[j].field2.b.a = action1; - cbuf[j].field2.b.b = action1; - cbuf[j].field2.b.c = action1; - cbuf[j].field3 = action1; - cbuf[j].field4.a = action1; - cbuf[j].field4.b = action1; + for(i = 0; i < num_elmts; i++) { + cbuf[i].field1 = action1; + cbuf[i].field2.a = action1; + cbuf[i].field2.c = action1; + cbuf[i].field2.b.a = action1; + cbuf[i].field2.b.b = action1; + cbuf[i].field2.b.c = action1; + cbuf[i].field3 = action1; + cbuf[i].field4.a = action1; + cbuf[i].field4.b = action1; } /* end for */ /* Write to the dataset */ @@ -169,8 +169,8 @@ extend_dset_two(const char *file, char *dname, int action1, int action2) } else { /* Integer type */ HDmemset(ibuf, 0, TEST_BUF_SIZE * sizeof(int)); - for(j = 0; j < num_elmts; j++) - ibuf[j] = action1; + for(i = 0; i < num_elmts; i++) + ibuf[i] = action1; /* Write to the dataset */ if(H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0) @@ -225,7 +225,7 @@ extend_dset_one(const char *file, char *dname, int action) hid_t dtid = -1; /* dataset's datatype id */ hid_t sid = -1; /* dataspace id */ hid_t mid = -1; /* memory space id */ - unsigned i, j; /* local index variable */ + unsigned i; /* local index variable */ hsize_t cur_dims[1]; /* current dimension sizes */ hsize_t ext_dims[1]; /* new dimension sizes after extension */ hsize_t offset[1]; /* starting offsets of appended data */ @@ -304,18 +304,18 @@ extend_dset_one(const char *file, char *dname, int action) if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) { HDmemset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t)); - for(j = 0; j < (unsigned)action; j++) { - cbuf[j].field1 = j + 1; - cbuf[j].field2.a = j + 2; - cbuf[j].field2.b.a = j + 2; - cbuf[j].field2.b.b = j + 2; - cbuf[j].field2.b.c = j + 2; - cbuf[j].field2.c = j + 2; - - cbuf[j].field3 = j + 3; - - cbuf[j].field4.a = j + 4; - cbuf[j].field4.b = j + 4; + for(i = 0; i < (unsigned)action; i++) { + cbuf[i].field1 = i + 1; + cbuf[i].field2.a = i + 2; + cbuf[i].field2.b.a = i + 2; + cbuf[i].field2.b.b = i + 2; + cbuf[i].field2.b.c = i + 2; + cbuf[i].field2.c = i + 2; + + cbuf[i].field3 = i + 3; + + cbuf[i].field4.a = i + 4; + cbuf[i].field4.b = i + 4; } /* end for */ /* Write to the extended region of the dataset */ @@ -324,8 +324,8 @@ extend_dset_one(const char *file, char *dname, int action) } else { /* Integer type */ HDmemset(ibuf, 0, TEST_BUF_SIZE * sizeof(int)); - for(j = 0; j < (unsigned)action; j++) - ibuf[j] = (int)j; + for(i = 0; i < (unsigned)action; i++) + ibuf[i] = (int)i; /* Write to the extended region of the dataset */ if(H5Dwrite(did, dtid, mid, sid, H5P_DEFAULT, ibuf) < 0) diff --git a/src/H5Dint.c b/src/H5Dint.c index 1813ca6..08b3eb8 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3004,10 +3004,10 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) { H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */ H5D_chk_idx_info_t idx_info; /* Index info for the current layout */ - H5O_layout_t newlayout; /* The new layout */ - hbool_t init_new_index = FALSE; /* Indicate that the new chunk index is initialized */ + H5O_layout_t *newlayout = NULL; /* The new layout */ + hbool_t init_new_index = FALSE; /* Indicate that the new chunk index is initialized */ hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */ - hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */ + hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL) @@ -3017,121 +3017,127 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) switch(dataset->shared->layout.type) { case H5D_CHUNKED: - HDassert(dataset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE); - - /* Set up the current index info */ - idx_info.f = dataset->oloc.file; - idx_info.dxpl_id = dxpl_id; - idx_info.pline = &dataset->shared->dcpl_cache.pline; - idx_info.layout = &dataset->shared->layout.u.chunk; - idx_info.storage = &dataset->shared->layout.storage.u.chunk; - - /* Copy the current layout info to the new layout */ - HDmemcpy(&newlayout, &dataset->shared->layout, sizeof(H5O_layout_t)); - - /* Set up info for version 1 B-tree in the new layout */ - newlayout.version = H5O_LAYOUT_VERSION_3; - newlayout.storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; - newlayout.storage.u.chunk.idx_addr = HADDR_UNDEF; - newlayout.storage.u.chunk.ops = H5D_COPS_BTREE; - newlayout.storage.u.chunk.u.btree.shared = NULL; - - /* Set up the index info to version 1 B-tree */ - new_idx_info.f = dataset->oloc.file; - new_idx_info.dxpl_id = dxpl_id; - new_idx_info.pline = &dataset->shared->dcpl_cache.pline; - new_idx_info.layout = &newlayout.u.chunk; - new_idx_info.storage = &newlayout.storage.u.chunk; - - /* Initialize version 1 B-tree */ - if(new_idx_info.storage->ops->init && - (new_idx_info.storage->ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") - init_new_index = TRUE; - - /* If the current chunk index exists */ - if(H5F_addr_defined(idx_info.storage->idx_addr)) { - - /* Create v1 B-tree chunk index */ - if((new_idx_info.storage->ops->create)(&new_idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") - - /* Iterate over the chunks in the current index and insert the chunk addresses - * into the version 1 B-tree chunk index */ - if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate/convert chunk index") - } /* end if */ + HDassert(dataset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE); + + if(NULL == (newlayout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") + + /* Set up the current index info */ + idx_info.f = dataset->oloc.file; + idx_info.dxpl_id = dxpl_id; + idx_info.pline = &dataset->shared->dcpl_cache.pline; + idx_info.layout = &dataset->shared->layout.u.chunk; + idx_info.storage = &dataset->shared->layout.storage.u.chunk; + + /* Copy the current layout info to the new layout */ + HDmemcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t)); + + /* Set up info for version 1 B-tree in the new layout */ + newlayout->version = H5O_LAYOUT_VERSION_3; + newlayout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; + newlayout->storage.u.chunk.idx_addr = HADDR_UNDEF; + newlayout->storage.u.chunk.ops = H5D_COPS_BTREE; + newlayout->storage.u.chunk.u.btree.shared = NULL; + + /* Set up the index info to version 1 B-tree */ + new_idx_info.f = dataset->oloc.file; + new_idx_info.dxpl_id = dxpl_id; + new_idx_info.pline = &dataset->shared->dcpl_cache.pline; + new_idx_info.layout = &(newlayout->u).chunk; + new_idx_info.storage = &(newlayout->storage).u.chunk; + + /* Initialize version 1 B-tree */ + if(new_idx_info.storage->ops->init && (new_idx_info.storage->ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") + init_new_index = TRUE; + + /* If the current chunk index exists */ + if(H5F_addr_defined(idx_info.storage->idx_addr)) { + + /* Create v1 B-tree chunk index */ + if((new_idx_info.storage->ops->create)(&new_idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") + + /* Iterate over the chunks in the current index and insert the chunk addresses + * into the version 1 B-tree chunk index + */ + if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate/convert chunk index") + } /* end if */ - /* Delete the old "current" layout message */ - if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message") + /* Delete the old "current" layout message */ + if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message") - delete_old_layout = TRUE; + delete_old_layout = TRUE; - /* Append the new layout message to the object header */ - if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &newlayout, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout header message") + /* Append the new layout message to the object header */ + if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, newlayout, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout header message") - add_new_layout = TRUE; + add_new_layout = TRUE; - /* Release the old (current) chunk index */ - if(idx_info.storage->ops->dest && (idx_info.storage->ops->dest)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + /* Release the old (current) chunk index */ + if(idx_info.storage->ops->dest && (idx_info.storage->ops->dest)(&idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") - /* Copy the new layout to the dataset's layout */ - HDmemcpy(&dataset->shared->layout, &newlayout, sizeof(H5O_layout_t)); + /* Copy the new layout to the dataset's layout */ + HDmemcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t)); - break; + break; - case H5D_CONTIGUOUS: + case H5D_CONTIGUOUS: case H5D_COMPACT: - HDassert(dataset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT); - dataset->shared->layout.version = H5O_LAYOUT_VERSION_DEFAULT; - if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") - break; + HDassert(dataset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT); + dataset->shared->layout.version = H5O_LAYOUT_VERSION_DEFAULT; + if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") + break; - case H5D_VIRTUAL: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "virtual dataset layout not supported") + case H5D_VIRTUAL: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "virtual dataset layout not supported") case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") } /* end switch */ done: if(ret_value < 0 && dataset->shared->layout.type == H5D_CHUNKED) { - /* Remove new layout message */ - if(add_new_layout) - if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE, dxpl_id) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message") - - /* Add back old layout message */ - if(delete_old_layout) - if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &dataset->shared->layout, dxpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to add layout header message") - - /* Clean up v1 b-tree chunk index */ - if(init_new_index) { - if(H5F_addr_defined(new_idx_info.storage->idx_addr)) { - /* Check for valid address i.e. tag */ - if(!H5F_addr_defined(dataset->oloc.addr)) - HDONE_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "address undefined") - - /* Expunge from cache all v1 B-tree type entries associated with tag */ - if(H5AC_expunge_tag_type_metadata(dataset->oloc.file, dxpl_id, dataset->oloc.addr, H5AC_BT_ID, H5AC__NO_FLAGS_SET)) - HDONE_ERROR(H5E_DATASET, H5E_CANTEXPUNGE, FAIL, "unable to expunge index metadata") - } /* end if */ + /* Remove new layout message */ + if(add_new_layout) + if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE, dxpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message") + + /* Add back old layout message */ + if(delete_old_layout) + if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &dataset->shared->layout, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to add layout header message") + + /* Clean up v1 b-tree chunk index */ + if(init_new_index) { + if(H5F_addr_defined(new_idx_info.storage->idx_addr)) { + /* Check for valid address i.e. tag */ + if(!H5F_addr_defined(dataset->oloc.addr)) + HDONE_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "address undefined") + + /* Expunge from cache all v1 B-tree type entries associated with tag */ + if(H5AC_expunge_tag_type_metadata(dataset->oloc.file, dxpl_id, dataset->oloc.addr, H5AC_BT_ID, H5AC__NO_FLAGS_SET)) + HDONE_ERROR(H5E_DATASET, H5E_CANTEXPUNGE, FAIL, "unable to expunge index metadata") + } /* end if */ - /* Delete v1 B-tree chunk index */ - if(new_idx_info.storage->ops->dest && (new_idx_info.storage->ops->dest)(&new_idx_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") - } /* end if */ + /* Delete v1 B-tree chunk index */ + if(new_idx_info.storage->ops->dest && (new_idx_info.storage->ops->dest)(&new_idx_info) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + } /* end if */ } /* end if */ + if(newlayout != NULL) + newlayout = (H5O_layout_t *)H5MM_xfree(newlayout); + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__format_convert() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 572e6cf..1766422 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -181,7 +181,6 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, if(direct_read) { unsigned u; - hsize_t dims[H5O_LAYOUT_NDIMS]; hsize_t internal_offset[H5O_LAYOUT_NDIMS]; if(H5D_CHUNKED != dset->shared->layout.type) diff --git a/src/H5FDspace.c b/src/H5FDspace.c index e451d6b..0af755f 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -99,9 +99,7 @@ H5FL_DEFINE(H5FD_free_t); static haddr_t H5FD_extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) { - hsize_t orig_size = size; /* Original allocation size */ haddr_t eoa; /* Address of end-of-allocated space */ - hsize_t extra; /* Extra space to allocate, to align request */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 49cfbfc..1ae902f 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -156,7 +156,7 @@ herr_t H5MF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, FILE *stream, int indent, int fwidth) { herr_t ret_value = SUCCEED; /* Return value */ - H5FD_mem_t type; /* Memory type for iteration */ + H5F_mem_page_t type; /* Memory type for iteration */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -168,31 +168,31 @@ H5MF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, FILE *stream, int ind HDassert(indent >= 0); HDassert(fwidth >= 0); - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) - if(H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) { - if(!f->shared->fs_man[type]) + for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, type)) + if(H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) { + if(!f->shared->fs_man[type]) if(H5MF_open_fstype(f, dxpl_id, type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") - - if(f->shared->fs_man[type]) { - H5MF_debug_iter_ud_t udata; /* User data for callbacks */ - - /* Prepare user data for section iteration callback */ - udata.fspace = f->shared->fs_man[type]; - udata.stream = stream; - udata.indent = indent; - udata.fwidth = fwidth; - - /* Iterate over all the free space sections */ - if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") - - /* Close the free space information */ - if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") - } /* end if */ - break; - } /* end if */ + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") + + if(f->shared->fs_man[type]) { + H5MF_debug_iter_ud_t udata; /* User data for callbacks */ + + /* Prepare user data for section iteration callback */ + udata.fspace = f->shared->fs_man[type]; + udata.stream = stream; + udata.indent = indent; + udata.fwidth = fwidth; + + /* Iterate over all the free space sections */ + if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + + /* Close the free space information */ + if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + } /* end if */ + break; + } /* end if */ done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 0dd26b3..02fc2d9 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -360,7 +360,7 @@ H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, static H5FS_section_info_t * H5MF_sect_split(H5FS_section_info_t *sect, hsize_t frag_size) { - H5MF_free_section_t *ret_value; /* Return value */ + H5MF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 29b2503..a427b49 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -323,7 +323,7 @@ H5O__mdci_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg) * time constraints, I don't want to go there now. */ if(H5F_FIRST_ALLOC_DEALLOC(f)) { - HDassert(HADDR_UNDEF !=H5F_EOA_PRE_FSM_FSALLOC(f)); + HDassert(HADDR_UNDEF != H5F_EOA_PRE_FSM_FSALLOC(f)); HDassert(H5F_addr_ge(mesg->addr, H5F_EOA_PRE_FSM_FSALLOC(f))); if(H5MF_tidy_self_referential_fsm_hack(f, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") diff --git a/test/flushrefresh.c b/test/flushrefresh.c index f35ed5e..0775dee 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -9,6 +9,7 @@ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * Programmer: Mike McGreevy diff --git a/test/mf.c b/test/mf.c index 3197989..60b74c4 100644 --- a/test/mf.c +++ b/test/mf.c @@ -138,8 +138,10 @@ static unsigned test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new static unsigned test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); static unsigned test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); static unsigned test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); +#ifdef PB_OUT static unsigned test_mf_fs_persist_split(void); static unsigned test_mf_fs_persist_multi(void); +#endif static unsigned test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl); static unsigned test_page_small(const char *env_h5_drvr, hid_t fapl); static unsigned test_page_large(const char *env_h5_drvr, hid_t fapl); @@ -6091,6 +6093,7 @@ error: * Verify that the file's free-space manager(s) are persistent for a split-file *------------------------------------------------------------------------- */ +#ifdef PB_OUT static unsigned test_mf_fs_persist_split(void) { @@ -6716,6 +6719,7 @@ error: } H5E_END_TRY; return(1); } /* test_mf_fs_persist_multi() */ +#endif /* PB_OUT */ /* *------------------------------------------------------------------------- diff --git a/test/plugin.c b/test/plugin.c index 8b4324d..1254e9a 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -574,7 +574,9 @@ test_noread_with_filters(hid_t file) /* disable filter plugin */ if(H5PLget_loading_state(&plugin_state) < 0) TEST_ERROR - plugin_state = plugin_state & ~H5PL_FILTER_PLUGIN; + + plugin_state = plugin_state & (unsigned)(~H5PL_FILTER_PLUGIN); + if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR if((dset = H5Dopen2(file, DSET_DYNLIB1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR @@ -672,8 +674,8 @@ static herr_t test_groups_with_filters(hid_t file) { herr_t ret_value = -1; - hid_t gid; - hid_t group; + hid_t gid = -1; + hid_t group = -1; int i; char gname[256]; diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c index 82c2f8b..43743d9 100644 --- a/test/swmr_remove_writer.c +++ b/test/swmr_remove_writer.c @@ -187,7 +187,7 @@ remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks, unsigned lon symbol->nrecords = 0; else symbol->nrecords -= remove_size; - dim[1] = symbol->nrecords; + dim[1] = symbol->nrecords; if(H5Dset_extent(symbol->dsid, dim) < 0) return -1; diff --git a/test/use_common.c b/test/use_common.c index 908cac9..5aa6692 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -48,6 +48,8 @@ parse_option(int argc, char * const argv[]) { int ret_value=0; int c; + int use_swmr; /* Need an int to detect errors */ + /* command line options: See function usage for a description */ const char *nagg_options = "f:hi:l:n:s:y:z:"; @@ -96,11 +98,13 @@ parse_option(int argc, char * const argv[]) }; break; case 's': /* use swmr file open mode */ - if ((UC_opts.use_swmr = HDatoi(optarg)) < 0) { - fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n"); - usage(progname_g); - Hgoto_error(-1); - }; + use_swmr = HDatoi(optarg); + if (use_swmr != 0 && use_swmr != 1) { + HDfprintf(stderr, "swmr value should be 0(no) or 1(yes)\n"); + usage(progname_g); + Hgoto_error(-1); + } + UC_opts.use_swmr = (hbool_t)use_swmr; break; case 'y': /* Number of planes per chunk */ if ((UC_opts.chunkplanes = HDstrtoul(optarg, NULL, 0)) <= 0) { diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 499d5eb..0b1a96e 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -140,7 +140,7 @@ typedef struct mcomp_t static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id,hid_t region1_id, hid_t region2_id, diff_opt_t *options); static hbool_t all_zero(const void *_mem, size_t size); static int ull2float(unsigned long long ull_value, float *f_value); -static hsize_t character_compare(char *mem1,char *mem2,hsize_t i,unsigned u,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph); +static hsize_t character_compare(char *mem1,char *mem2,hsize_t i,size_t u,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph); static hsize_t character_compare_opt(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph); static hbool_t equal_float(float value, float expected, diff_opt_t *options); static hbool_t equal_double(double value, double expected, diff_opt_t *options); @@ -149,7 +149,7 @@ static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t #endif static int print_data(diff_opt_t *options); static void print_pos(int *ph,int pp,hsize_t curr_pos,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 ); -static void print_char_pos(int *ph,int pp,hsize_t curr_pos,unsigned u,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 ); +static void print_char_pos(int *ph,int pp,hsize_t curr_pos,size_t u,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 ); static void h5diff_print_char(char ch); static hsize_t diff_datum(void *_mem1, void *_mem2, @@ -575,7 +575,7 @@ static hsize_t diff_datum(void *_mem1, { unsigned char *mem1 = (unsigned char*)_mem1; unsigned char *mem2 = (unsigned char*)_mem2; - unsigned u; + size_t u; hid_t memb_type; size_t type_size; H5T_sign_t type_sign; @@ -2813,7 +2813,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, - unsigned u, + size_t u, int rank, hsize_t *dims, hsize_t *acc, @@ -5906,7 +5906,7 @@ static void print_char_pos( int *ph, /* print header */ int pp, /* print percentage */ hsize_t curr_pos, - unsigned u, + size_t u, hsize_t *acc, hsize_t *pos, int rank, @@ -5944,7 +5944,7 @@ void print_char_pos( int *ph, /* print header */ } else { - parallel_print("%u", (unsigned)u); + parallel_print("%zu", u); } parallel_print("]" ); } diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index 4ff4875..1a0dab7 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -249,7 +249,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options * the same as the input file's strategy. */ if(options->fs_strategy) { - if(out_strategy != (options->fs_strategy == (-1) ? 0 : options->fs_strategy)) { + if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy)) { error_msg("file space strategy not set as unexpected\n"); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); } -- cgit v0.12