diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-04-19 20:15:21 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-04-19 20:15:21 (GMT) |
commit | 099b37d073e633b0cb4d8c3f41ddf5788e63e6ee (patch) | |
tree | 3316f03ab81dbbab9160aac62fefe3f78b50c1d4 /src | |
parent | 94cf912176257c753eaddde0acabc9a11be2e48d (diff) | |
download | hdf5-099b37d073e633b0cb4d8c3f41ddf5788e63e6ee.zip hdf5-099b37d073e633b0cb4d8c3f41ddf5788e63e6ee.tar.gz hdf5-099b37d073e633b0cb4d8c3f41ddf5788e63e6ee.tar.bz2 |
[svn-r20559] Description:
Bring r20407:20557 from trunk to revise_chunks branch
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (ember) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Diffstat (limited to 'src')
41 files changed, 501 insertions, 235 deletions
@@ -27,6 +27,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ #include "H5SLprivate.h" /* Skip lists */ @@ -313,6 +314,16 @@ H5_term_library(void) } /* end if */ #endif + /* Free open debugging streams */ + while(H5_debug_g.open_stream) { + H5_debug_open_stream_t *tmp_open_stream; + + tmp_open_stream = H5_debug_g.open_stream; + (void)HDfclose(H5_debug_g.open_stream->stream); + H5_debug_g.open_stream = H5_debug_g.open_stream->next; + (void)H5MM_free(tmp_open_stream); + } /* end while */ + /* Mark library as closed */ H5_INIT_GLOBAL = FALSE; done: @@ -536,9 +547,21 @@ H5_debug_mask(const char *s) } } else if (HDisdigit(*s)) { - int fd = (int)HDstrtol (s, &rest, 0); - if ((stream=HDfdopen(fd, "w"))!=NULL) - (void)HDsetvbuf (stream, NULL, _IOLBF, (size_t)0); + int fd = (int)HDstrtol(s, &rest, 0); + H5_debug_open_stream_t *open_stream; + + if((stream = HDfdopen(fd, "w")) != NULL) { + (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0); + + if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { + (void)HDfclose(stream); + return; + } /* end if */ + + open_stream->stream = stream; + open_stream->next = H5_debug_g.open_stream; + H5_debug_g.open_stream = open_stream; + } /* end if */ s = rest; } else { s++; @@ -389,14 +389,18 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, /* Check if the dataspace has an extent set (or is NULL) */ if(!(H5S_has_extent(space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set") + HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "dataspace extent has not been set") + + /* Check if the datatype is "sensible" for use in a dataset */ + if(H5T_is_sensible(type) != TRUE) + HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "datatype is not sensible") /* Build the attribute information */ if(NULL == (attr = H5FL_CALLOC(H5A_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed for attribute info") if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate shared attr structure") + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "can't allocate shared attr structure") /* If the creation property list is H5P_DEFAULT, use the default character encoding */ if(acpl_id == H5P_DEFAULT) diff --git a/src/H5Aint.c b/src/H5Aint.c index 3ffc6d3..4e610e4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -232,9 +232,12 @@ H5A_compact_build_table(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_index_t idx_type, /* Correct # of attributes in table */ atable->nattrs = udata.curr_attr; - /* Sort attribute table in correct iteration order */ - if(H5A_attr_sort_table(atable, idx_type, order) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table") + /* Don't sort an empty table. */ + if(atable->nattrs > 0) { + /* Sort attribute table in correct iteration order */ + if(H5A_attr_sort_table(atable, idx_type, order) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table") + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -888,8 +891,9 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset datatype sharing") } /* end else */ - /* Copy the dataspace for the attribute */ - attr_dst->shared->ds = H5S_copy(attr_src->shared->ds, FALSE, FALSE); + /* Copy the dataspace for the attribute. Make sure the maximal dimension is also copied. + * Otherwise the comparison in the test may complain about it. SLU 2011/4/12 */ + attr_dst->shared->ds = H5S_copy(attr_src->shared->ds, FALSE, TRUE); HDassert(attr_dst->shared->ds); /* Reset the dataspace's sharing in the source file before trying to share diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 6a3b5da..f47bb9f 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -833,7 +833,7 @@ H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal, *------------------------------------------------------------------------- */ static H5B2_leaf_t * -H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) +H5B2_cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata) { H5B2_leaf_cache_ud_t *udata = (H5B2_leaf_cache_ud_t *)_udata; H5B2_leaf_t *leaf = NULL; /* Pointer to lead node loaded */ diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index a7f6819..5a0b341 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -169,7 +169,7 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* Print relevant node info */ HDfprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, ""); for(u = 0; u < (unsigned)(hdr->depth + 1); u++) { - sprintf(temp_str, "Depth %u:", u); + HDsnprintf(temp_str, sizeof(temp_str), "Depth %u:", u); HDfprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, hdr->node_info[u].max_nrec, hdr->node_info[u].split_nrec, hdr->node_info[u].merge_nrec); @@ -281,7 +281,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* Print all node pointers and records */ for(u = 0; u < internal->nrec; u++) { /* Print node pointer */ - sprintf(temp_str, "Node pointer #%u: (all/node/addr)", u); + HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, internal->node_ptrs[u].all_nrec, @@ -289,7 +289,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, internal->node_ptrs[u].addr); /* Print record */ - sprintf(temp_str, "Record #%u:", u); + HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u); HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_INT_NREC(internal, hdr, u)); @@ -298,7 +298,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end for */ /* Print final node pointer */ - sprintf(temp_str, "Node pointer #%u: (all/node/addr)", u); + HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, internal->node_ptrs[u].all_nrec, @@ -410,7 +410,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* Print all node pointers and records */ for(u = 0; u < leaf->nrec; u++) { /* Print record */ - sprintf(temp_str, "Record #%u:", u); + HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u); HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_LEAF_NREC(leaf, hdr, u)); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 5972756..abebe2a 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -386,8 +386,9 @@ done: static herr_t H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset) { - const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ - hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ + const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ + hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ + hsize_t dims[H5O_LAYOUT_NDIMS]; /* Dimension size of data in elements */ uint64_t chunk_size; /* Size of chunk in bytes */ int ndims; /* Rank of dataspace */ unsigned u; /* Local index variable */ @@ -421,7 +422,7 @@ H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset) dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(type); /* Get local copy of dataset dimensions (for sanity checking) */ - if(H5S_get_simple_extent_dims(dset->shared->space, NULL, max_dim) < 0) + if(H5S_get_simple_extent_dims(dset->shared->space, dims, max_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to query maximum dimensions") /* Sanity check dimensions */ @@ -432,9 +433,10 @@ H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset) /* * The chunk size of a dimension with a fixed size cannot exceed - * the maximum dimension size + * the maximum dimension size. If any dimension size is zero, there + * will be no such restriction. */ - if(max_dim[u] != H5S_UNLIMITED && max_dim[u] < dset->shared->layout.u.chunk.dim[u]) + if(dims[u] && max_dims[u] != H5S_UNLIMITED && max_dims[u] < dset->shared->layout.u.chunk.dim[u]) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be <= maximum dimension size for fixed-sized dimensions") } /* end for */ diff --git a/src/H5Dint.c b/src/H5Dint.c index f3e0b3c..a4f5c8d 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1750,16 +1750,23 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al case H5D_COMPACT: /* Check if space is already allocated */ if(NULL == layout->storage.u.compact.buf) { - /* Reserve space in layout header message for the entire array. */ - HDassert(layout->storage.u.compact.size > 0); - if(NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset") - if(!full_overwrite) - HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size); - layout->storage.u.compact.dirty = TRUE; - - /* Indicate that we should initialize storage space */ - must_init_space = TRUE; + /* Reserve space in layout header message for the entire array. + * Starting from the 1.8.7 release, we allow dataspace to have + * zero dimension size. So the storage size can be zero. + * SLU 2011/4/4 */ + if(layout->storage.u.compact.size > 0) { + if(NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset") + if(!full_overwrite) + HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size); + layout->storage.u.compact.dirty = TRUE; + + /* Indicate that we should initialize storage space */ + must_init_space = TRUE; + } else { + layout->storage.u.compact.dirty = FALSE; + must_init_space = FALSE; + } } /* end if */ break; diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 1b5e100..0153a1e 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -284,7 +284,9 @@ herr_t, SUCCEED, -, H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)) /* Local variables */ +#ifndef NDEBUG H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ +#endif /* NDEBUG */ uint64_t *elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ @@ -2974,7 +2974,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Frelease_file_cache + * Function: H5Fclear_elink_file_cache * * Purpose: Releases the external file cache associated with the * provided file, potentially closing any cached files @@ -2988,12 +2988,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Frelease_file_cache(hid_t file_id) +H5Fclear_elink_file_cache(hid_t file_id) { H5F_t *file; /* File */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Frelease_file_cache, FAIL) + FUNC_ENTER_API(H5Fclear_elink_file_cache, FAIL) H5TRACE1("e", "i", file_id); /* Check args */ @@ -3007,5 +3007,5 @@ H5Frelease_file_cache(hid_t file_id) done: FUNC_LEAVE_API(ret_value) -} /* end H5Frelease_file_cache() */ +} /* end H5Fclear_elink_file_cache() */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index bd09ea4..5fd0294 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -628,7 +628,7 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out* FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_family_sb_encode) /* Name and version number */ - HDstrncpy(name, "NCSAfami", (size_t)8); + HDstrncpy(name, "NCSAfami", (size_t)9); name[8] = '\0'; /* Store member file size. Use the member file size from the property here. @@ -690,9 +690,9 @@ H5FD_family_sb_decode(H5FD_t *_file, const char UNUSED *name, const unsigned cha /* Check if member size from file access property is correct */ if(msize != file->pmem_size) { - char err_msg[128]; + char err_msg[128]; - sprintf(err_msg, "Family member size should be %lu. But the size from file access property is %lu", (unsigned long)msize, (unsigned long)file->pmem_size); + HDsnprintf(err_msg, sizeof(err_msg), "Family member size should be %lu. But the size from file access property is %lu", (unsigned long)msize, (unsigned long)file->pmem_size); HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, err_msg) } /* end if */ @@ -806,14 +806,14 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, file->flags = flags; /* Check that names are unique */ - sprintf(memb_name, name, 0); - sprintf(temp, name, 1); + HDsnprintf(memb_name, sizeof(memb_name), name, 0); + HDsnprintf(temp, sizeof(temp), name, 1); if(!HDstrcmp(memb_name, temp)) HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique") /* Open all the family members */ while(1) { - sprintf(memb_name, name, file->nmembs); + HDsnprintf(memb_name, sizeof(memb_name), name, file->nmembs); /* Enlarge member array */ if(file->nmembs >= file->amembs) { @@ -1094,7 +1094,7 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) /* Create another file if necessary */ if(u >= file->nmembs || !file->memb[u]) { file->nmembs = MAX(file->nmembs, u+1); - sprintf(memb_name, file->name, u); + HDsnprintf(memb_name, sizeof(memb_name), file->name, u); H5E_BEGIN_TRY { H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t); file->memb[u] = H5FDopen(memb_name, file->flags | H5F_ACC_CREAT, diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 6aca9e8..540177b 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -215,7 +215,7 @@ H5_DLL ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size); H5_DLL herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo); H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/); -H5_DLL herr_t H5Frelease_file_cache(hid_t file_id); +H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -843,9 +843,6 @@ H5G_term_interface(void) /* Destroy the group object id group */ H5I_dec_type_ref(H5I_GROUP); - /* Free the global component buffer */ - H5G_traverse_term_interface(); - /* Mark closed */ H5_interface_initialize_g = 0; n = 1; /*H5I*/ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index c905722..1815691 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -893,7 +893,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, +H5G_get_objinfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */ @@ -910,7 +910,6 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ /* Common code to retrieve the file's fileno */ - /* (Use the object location's file info, if it's available) */ if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno") @@ -922,6 +921,7 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t /* Go retrieve the object information */ /* (don't need index & heap info) */ + HDassert(obj_loc); if(H5O_get_info(obj_loc->oloc, udata->dxpl_id, FALSE, &oinfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 5a2d736..5f32eb5 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1239,7 +1239,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, H5O_link_t lnk; /* Link to insert */ const char *name; /* Name of source object */ H5G_entry_t tmp_src_ent; /* Temperary copy. Change will not affect the cache */ - H5O_type_t obj_type; /* Target object type */ + H5O_type_t obj_type = H5O_TYPE_UNKNOWN; /* Target object type */ H5G_copy_file_ud_t *cpy_udata; /* Copy file udata */ H5G_obj_create_t gcrt_info; /* Group creation info */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 78e66d0..c966e16 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -391,7 +391,6 @@ H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name, /* * Group hierarchy traversal routines */ -H5_DLL herr_t H5G_traverse_term_interface(void); H5_DLL herr_t H5G_traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned target, size_t *nlinks, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists, hid_t lapl_id, hid_t dxpl_id); @@ -609,6 +608,7 @@ H5_DLL herr_t H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *c H5_DLL herr_t H5G_lheap_size_test(hid_t gid, size_t *lheap_size); H5_DLL herr_t H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *user_path_hidden); H5_DLL herr_t H5G_verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent); +H5_DLL herr_t H5G_verify_cached_stabs_test(hid_t gid); #endif /* H5G_TESTING */ #endif /* _H5Gpkg_H */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 7d0ad48..afa137c 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -711,6 +711,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, H5HL_t *heap = NULL; /* Pointer to local heap */ H5O_stab_t stab; /* Info about local heap & B-tree */ H5G_bt_it_gnbi_t udata; /* Iteration information */ + hbool_t udata_valid = FALSE; /* Whether iteration information is valid */ ssize_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_get_name_by_idx, FAIL) @@ -744,6 +745,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, udata.common.op = H5G_stab_get_name_by_idx_cb; udata.heap = heap; udata.name = NULL; + udata_valid = TRUE; /* Iterate over the group members */ if(H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_node_by_idx, &udata) < 0) @@ -769,7 +771,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") /* Free the duplicated name */ - if(udata.name != NULL) + if(udata_valid && udata.name != NULL) H5MM_xfree(udata.name); FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 96ecfda..ec55e47 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -641,3 +641,167 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_verify_cached_stab_test() */ + +/*------------------------------------------------------------------------- + * Function: H5G_verify_cached_stabs_test_cb + * + * Purpose: Verify that all entries in this node contain cached symbol + * table information if and only if the entry refers to a + * group with a symbol table, and that that information is + * correct. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Apr 8, 2011 + * + *------------------------------------------------------------------------- + */ +static int +H5G_verify_cached_stabs_test_cb(H5F_t *f, hid_t dxpl_id, + const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, + void UNUSED *udata) +{ + H5G_node_t *sn = NULL; + H5O_loc_t targ_oloc; + H5O_t *targ_oh = NULL; + htri_t stab_exists; + H5O_stab_t stab; + unsigned i; + int ret_value = H5_ITER_CONT; + + FUNC_ENTER_NOAPI(H5G_verify_cached_stabs_test_cb, H5_ITER_ERROR) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + + /* Load the node */ + if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ))) + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") + + /* Check each target object to see if its stab message (if present) matches + * the cached stab (if present). If one exists, both must exist. */ + /* Initialize constant fields in target oloc */ + targ_oloc.file = f; + targ_oloc.holding_file = FALSE; + + /* Iterate over entries */ + for(i=0; i<sn->nsyms; i++) { + /* Update oloc address */ + targ_oloc.addr = sn->entry[i].header; + + /* Load target object header */ + if(NULL == (targ_oh = H5O_protect(&targ_oloc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to protect target object header") + + /* Check if a symbol table message exists */ + if((stab_exists = H5O_msg_exists_oh(targ_oh, H5O_STAB_ID)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "unable to check for STAB message") + + if(stab_exists) { + /* Read symbol table message */ + if(NULL == H5O_msg_read_oh(f, dxpl_id, targ_oh, H5O_STAB_ID, &stab)) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to read STAB message") + + /* Check if the stab matches the cached stab info */ + if(sn->entry[i].type != H5G_CACHED_STAB) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "STAB message is not cached in group node") + + if((sn->entry[i].cache.stab.btree_addr != stab.btree_addr) + || (sn->entry[i].cache.stab.heap_addr != stab.heap_addr)) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "cached symbol table information is incorrect") + } /* end if */ + else if(sn->entry[i].type == H5G_CACHED_STAB) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached") + + /* Unprotect target object */ + if(H5O_unprotect(&targ_oloc, dxpl_id, targ_oh, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release object header"); + targ_oh = NULL; + } /* end for */ + +done: + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") + + if(targ_oh) { + HDassert(ret_value == H5_ITER_ERROR); + if(H5O_unprotect(&targ_oloc, dxpl_id, targ_oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release object header"); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_verify_cached_stabs_test_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_verify_cached_stabs_test + * + * Purpose: If the provided group contains a symbol table, verifies + * that all links in the group contain cached symbol table + * information if and only if the link points to a group + * with a symbol table, and that that information is correct. + * If the provided group does not contain a symbol table, + * does nothing. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * nfortne2@hdfgroup.org + * April 6 2011 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_verify_cached_stabs_test(hid_t gid) +{ + H5G_t *grp = NULL; /* Group */ + htri_t stab_exists; + H5O_stab_t stab; /* Symbol table message */ + H5G_bt_common_t udata = {NULL, NULL}; /* Dummy udata so H5B_iterate doesn't freak out */ + haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5G_verify_cached_stabs_test, FAIL) + + /* check args */ + HDassert(gid >= 0); + + /* Check args */ + if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + + /* Set up metadata tagging */ + if(H5AC_tag(H5AC_ind_dxpl_id, grp->oloc.addr, &prev_tag) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to apply metadata tag") + + /* Check for group having a symbol table message */ + /* Check for the group having a group info message */ + if((stab_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, + H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + + /* No need to check anything if the symbol table doesn't exist */ + if(!stab_exists) + HGOTO_DONE(SUCCEED); + + /* Read the stab */ + if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, H5AC_ind_dxpl_id)) + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get symbol table info") + + /* Iterate over the b-tree, checking validity of cached information */ + if((ret_value = H5B_iterate(grp->oloc.file, H5AC_ind_dxpl_id, H5B_SNODE, + stab.btree_addr, H5G_verify_cached_stabs_test_cb, &udata)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "iteration operator failed"); + + /* Reset metadata tagging */ + if(H5AC_tag(H5AC_ind_dxpl_id, prev_tag, NULL) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to apply metadata tag") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_verify_cached_stabs_test() */ + diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index bb8e590..4397d1c 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -38,6 +38,7 @@ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppublic.h" /* Property Lists */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /* Private typedefs */ @@ -54,8 +55,6 @@ typedef struct { /* Private macros */ /* Local variables */ -static char *H5G_comp_g = NULL; /*component buffer */ -static size_t H5G_comp_alloc_g = 0; /*sizeof component buffer */ /* PRIVATE PROTOTYPES */ static herr_t H5G_traverse_slink_cb(H5G_loc_t *grp_loc, const char *name, @@ -74,34 +73,6 @@ static herr_t H5G_traverse_real(const H5G_loc_t *loc, const char *name, /*------------------------------------------------------------------------- - * Function: H5G_traverse_term_interface - * - * Purpose: Terminates part of the H5G interface - free the global - * component buffer. - * - * Return: Success: Non-negative. - * - * Failure: Negative. - * - * Programmer: Quincey Koziol - * Monday, September 26, 2005 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_traverse_term_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_traverse_term_interface) - - /* Free the global component buffer */ - H5G_comp_g = (char *)H5MM_xfree(H5G_comp_g); - H5G_comp_alloc_g = 0; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_traverse_term_interface() */ - - -/*------------------------------------------------------------------------- * Function: H5G_traverse_slink_cb * * Purpose: Callback for soft link traversal. This routine sets the @@ -570,8 +541,11 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5O_link_t lnk; /* Link information for object */ hbool_t link_valid = FALSE; /* Flag to indicate that the link information is valid */ hbool_t obj_loc_valid = FALSE; /* Flag to indicate that the object location is valid */ - H5G_own_loc_t own_loc=H5G_OWN_NONE; /* Enum to indicate whether callback took ownership of locations*/ + H5G_own_loc_t own_loc = H5G_OWN_NONE; /* Enum to indicate whether callback took ownership of locations*/ hbool_t group_copy = FALSE; /* Flag to indicate that the group entry is copied */ + char comp_buf[1024]; /* Temporary buffer for path components */ + char *comp; /* Pointer to buffer for path components */ + H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */ hbool_t last_comp = FALSE; /* Flag to indicate that a component is the last component in the name */ herr_t ret_value = SUCCEED; /* Return value */ @@ -596,8 +570,8 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, HDassert(root_grp); /* Set the location entry to the root group's info */ - loc.oloc=&(root_grp->oloc); - loc.path=&(root_grp->path); + loc.oloc = &(root_grp->oloc); + loc.path = &(root_grp->path); } /* end if */ else { loc.oloc = _loc->oloc; @@ -625,17 +599,13 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, if(H5G_loc_reset(&obj_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset location") - /* Check for needing a larger buffer for the individual path name components */ - if((HDstrlen(name) + 1) > H5G_comp_alloc_g) { - char *new_comp; /* New component buffer */ - size_t new_alloc; /* New component buffer size */ + /* Wrap the local buffer for serialized header info */ + if(NULL == (wb = H5WB_wrap(comp_buf, sizeof(comp_buf)))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer") - new_alloc = MAX3(1024, (2 * H5G_comp_alloc_g), (HDstrlen(name) + 1)); - if(NULL == (new_comp = (char *)H5MM_realloc(H5G_comp_g, new_alloc))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "unable to allocate component buffer") - H5G_comp_g = new_comp; - H5G_comp_alloc_g = new_alloc; - } /* end if */ + /* Get a pointer to a buffer that's large enough */ + if(NULL == (comp = (char *)H5WB_actual(wb, (HDstrlen(name) + 1)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Traverse the path */ while((name = H5G_component(name, &nchars)) && *name) { @@ -647,13 +617,13 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, * Copy the component name into a null-terminated buffer so * we can pass it down to the other symbol table functions. */ - HDmemcpy(H5G_comp_g, name, nchars); - H5G_comp_g[nchars] = '\0'; + HDmemcpy(comp, name, nchars); + comp[nchars] = '\0'; /* * The special name `.' is a no-op. */ - if('.' == H5G_comp_g[0] && !H5G_comp_g[1]) { + if('.' == comp[0] && !comp[1]) { name += nchars; continue; } /* end if */ @@ -669,7 +639,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, } /* end if */ /* Get information for object in current group */ - if((lookup_status = H5G_obj_lookup(grp_loc.oloc, H5G_comp_g, &lnk/*out*/, dxpl_id)) < 0) + if((lookup_status = H5G_obj_lookup(grp_loc.oloc, comp, &lnk/*out*/, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't look up component") obj_exists = FALSE; @@ -677,7 +647,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, if(lookup_status) { /* Sanity check link and indicate it's valid */ HDassert(lnk.type >= H5L_TYPE_HARD); - HDassert(!HDstrcmp(H5G_comp_g, lnk.name)); + HDassert(!HDstrcmp(comp, lnk.name)); link_valid = TRUE; /* Build object location from the link */ @@ -714,7 +684,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, } /* end else */ /* Call 'operator' routine */ - if((op)(&grp_loc, H5G_comp_g, cb_lnk, cb_loc, op_data, &own_loc) < 0) + if((op)(&grp_loc, comp, cb_lnk, cb_loc, op_data, &own_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CALLBACK, FAIL, "traversal operator failed") HGOTO_DONE(SUCCEED) @@ -796,7 +766,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry") /* Insert new group into current group's symbol table */ - if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0) + if(H5G_loc_insert(&grp_loc, comp, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group") /* Decrement refcount on intermediate group's object header in memory */ @@ -877,6 +847,10 @@ done: if(H5O_msg_reset(H5O_LINK_ID, &lnk) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link message") + /* Release temporary component buffer */ + if(wb && H5WB_unwrap(wb) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't release wrapped buffer") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_traverse_real() */ @@ -965,7 +965,7 @@ done: * * Purpose: Substitute a new object pointer for the specified ID. * - * Return: Success: Non-null previsou object pointer associated + * Return: Success: Non-null previous object pointer associated * with the specified ID. * Failure: NULL * diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 51694a3..f419e44 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -268,12 +268,13 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p * Compound datatypes... */ dt->shared->u.compnd.nmembs = flags & 0xffff; - HDassert(dt->shared->u.compnd.nmembs > 0); + if(dt->shared->u.compnd.nmembs == 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid number of members: %u", dt->shared->u.compnd.nmembs) dt->shared->u.compnd.nalloc = dt->shared->u.compnd.nmembs; dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_calloc(dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t)); dt->shared->u.compnd.memb_size = 0; if(NULL == dt->shared->u.compnd.memb) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed") for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { unsigned ndims = 0; /* Number of dimensions of the array field */ htri_t can_upgrade; /* Whether we can upgrade this type's version */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 0d71be9..b97138f 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -81,6 +81,11 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ * Programmer: Robb Matzke * Tuesday, November 25, 1997 * + * Modification: + * Raymond Lu + * 11 April 2011 + * We allow zero dimension size starting from the 1.8.7 release. + * The dataset size of external storage can be zero. *------------------------------------------------------------------------- */ static void * @@ -156,7 +161,6 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, /* Size */ H5F_DECODE_LENGTH (f, p, mesg->slot[u].size); - HDassert(mesg->slot[u].size > 0); } /* end for */ if(H5HL_unprotect(heap) < 0) @@ -468,7 +468,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, HDassert(old_pclass == orig_pclass); /* Close the previous class */ - if(H5P_close_class(orig_pclass) < 0) + if(H5P_close_class(old_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 97b492d..fc58a6d 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -53,7 +53,7 @@ /* Define default layout information */ #define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} #define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} -#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{NULL}}} +#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{HADDR_UNDEF, NULL}}} #define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0}}}} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }} @@ -1105,6 +1105,11 @@ done: * Changed the way to check parameter and set property for * generic property list. * + * Raymond Lu + * 7 April 2011 + * Starting from the 1.8.7 release, we allow dataspace to have + * zero dimension size. So the external storage size for + * dataset can be zero. *------------------------------------------------------------------------- */ herr_t @@ -1124,8 +1129,6 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") if (offset<0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset") - if (size<=0) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "zero size") /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) diff --git a/src/H5Pint.c b/src/H5Pint.c index 67bb101..4ae274e 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -4188,7 +4188,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) HDassert(old_dst_pclass == orig_dst_pclass); /* Close the previous class */ - if(H5P_close_class(orig_dst_pclass) < 0) + if(H5P_close_class(old_dst_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index ac46228..dec2cfe 100755 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -1025,14 +1025,6 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Get the pipeline property to query */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Get pointer to filter in pipeline */ - if(NULL == (filter = H5Z_filter_info(&pline, id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid") - /* Get filter information */ if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) @@ -66,9 +66,11 @@ H5RS_xstrdup(const char *s) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5RS_xstrdup) if(s) { - ret_value = (char *)H5FL_BLK_MALLOC(str_buf, HDstrlen(s) + 1); + size_t len = HDstrlen(s) + 1; + + ret_value = (char *)H5FL_BLK_MALLOC(str_buf, len); HDassert(ret_value); - HDstrcpy(ret_value, s); + HDstrncpy(ret_value, s, len); } /* end if */ else ret_value = NULL; @@ -352,7 +354,7 @@ H5RS_dup_str(const char *s) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy name for full path */ - HDstrcpy(new_str, s); + HDstrncpy(new_str, s, (path_len + 1)); /* Create reference counted string for path */ ret_value = H5RS_own(new_str); @@ -1160,14 +1160,17 @@ H5Sis_simple(hid_t space_id) Christian Chilan 01/17/2007 Verifies that each element of DIMS is not equal to H5S_UNLIMITED. + Raymond Lu 03/30/2011 + We allow 0 dimension size for non-unlimited dimension starting from 1.8.7 + release. --------------------------------------------------------------------------*/ herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], const hsize_t max[/*rank*/]) { H5S_t *space; /* dataspace to modify */ - int u; /* local counting variable */ - herr_t ret_value=SUCCEED; /* Return value */ + int u; /* local counting variable */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Sset_extent_simple, FAIL) H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max); @@ -1183,8 +1186,6 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], for (u=0; u<rank; u++) { if (H5S_UNLIMITED==dims[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED") - if (((max!=NULL && max[u]!=H5S_UNLIMITED) || max==NULL) && dims[u]==0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dimension size") } } if (max!=NULL) { @@ -1258,13 +1259,15 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, } /* end for */ space->extent.nelem = nelem; - /* Copy the maximum dimensions if specified */ + /* Copy the maximum dimensions if specified. Otherwise, the maximal dimensions are the + * same as the dimension */ + space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank); if(max != NULL) { - space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank); HDmemcpy(space->extent.max, max, sizeof(hsize_t) * rank); - } /* end if */ - else - space->extent.max = NULL; + } else { + for(u = 0; u < space->extent.rank; u++) + space->extent.max[u] = dims[u]; + } } /* end else */ /* Selection related cleanup */ @@ -1303,6 +1306,11 @@ done: * Programmer: Quincey Koziol * Tuesday, January 27, 1998 * + * Modification: + * Raymond Lu 03/30/2011 + * We allow 0-dimension for non-unlimited dimension starting + * from 1.8.7 release. + * *------------------------------------------------------------------------- */ hid_t @@ -1332,17 +1340,9 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], for(i = 0; i < rank; i++) { if(H5S_UNLIMITED == dims[i]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED") - if(maxdims) { - if(H5S_UNLIMITED != maxdims[i] && maxdims[i]<dims[i]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maxdims is smaller than dims") - if(H5S_UNLIMITED != maxdims[i] && dims[i] == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero sized dimension for non-unlimited dimension") - } /* end if */ - else { - if(dims[i] == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero sized dimension for non-unlimited dimension") - } /* end else */ - } /* end else */ + if(maxdims && H5S_UNLIMITED != maxdims[i] && maxdims[i]<dims[i]) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maxdims is smaller than dims") + } /* end for */ /* Create the space and set the extent */ if(NULL == (space = H5S_create_simple((unsigned)rank,dims,maxdims))) @@ -1827,7 +1827,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) /* Check for invalid dimension size modification */ if(space->extent.max && H5S_UNLIMITED != space->extent.max[u] && space->extent.max[u] < size[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "dimension cannot be modified") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "dimension cannot exceed the existing maximal size") /* Indicate that dimension size can be modified */ ret_value = TRUE; @@ -1906,7 +1906,7 @@ H5S_set_extent_real(H5S_t *space, const hsize_t *size) /* Change the dataspace size & re-compute the number of elements in the extent */ for(u = 0, nelem = 1; u < space->extent.rank; u++ ) { space->extent.size[u] = size[u]; - nelem *= space->extent.size[u]; + nelem *= size[u]; } /* end for */ space->extent.nelem = nelem; @@ -583,8 +583,10 @@ H5SL_new_node(void *item, const void *key, uint32_t hashval) ret_value->item = item; ret_value->level = 0; ret_value->hashval = hashval; - if(NULL == (ret_value->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0]))) + if(NULL == (ret_value->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0]))) { + ret_value = H5FL_FREE(H5SL_node_t, ret_value); HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") + } /* end if */ ret_value->log_nalloc = 0; done: diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 4aa887b..2622101 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -4191,16 +4191,24 @@ H5S_hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) H5S_hyper_span_t *new_span; /* Temporary hyperslab span */ /* Allocate a new span_info node */ - if(NULL == (new_span_info = H5FL_MALLOC(H5S_hyper_span_info_t))) + if(NULL == (new_span_info = H5FL_MALLOC(H5S_hyper_span_info_t))) { + if(prev_span) + if(H5S_hyper_free_span(prev_span) < 0) + HERROR(H5E_DATASPACE, H5E_CANTFREE, "can't free hyperslab span"); HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span info") + } /* end if */ /* Check for linking into higher span */ if(prev_span) prev_span->down = new_span_info; /* Allocate a new node */ - if(NULL == (new_span = H5S_hyper_new_span(0, 0, NULL, NULL))) + if(NULL == (new_span = H5S_hyper_new_span(0, 0, NULL, NULL))) { + HDassert(new_span_info); + if(!prev_span) + (void)H5FL_FREE(H5S_hyper_span_info_t, new_span_info); HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") + } /* end if */ /* Set the span_info information */ new_span_info->count = 1; @@ -4225,6 +4233,15 @@ H5S_hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) prev_span->down->count++; done: + if(ret_value < 0 && new_space->select.sel_info.hslab->span_lst) { + if(new_space->select.sel_info.hslab->span_lst->head) + if(H5S_hyper_free_span( + new_space->select.sel_info.hslab->span_lst->head) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't free hyperslab span") + + new_space->select.sel_info.hslab->span_lst = H5FL_FREE(H5S_hyper_span_info_t, new_space->select.sel_info.hslab->span_lst); + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_project_simple_higher() */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index cb7e98f..e544371 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1551,8 +1551,8 @@ herr_t H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) { - H5S_t *space; /* Dataspace to modify selection of */ - herr_t ret_value; /* Return value */ + H5S_t *space; /* Dataspace to modify selection of */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5Sselect_elements, FAIL) H5TRACE4("e", "iSsz*h", spaceid, op, num_elem, coord); diff --git a/src/H5Spublic.h b/src/H5Spublic.h index c62a7b7..6e87a65 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -114,6 +114,8 @@ H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t count[], const hsize_t _block[]); /* #define NEW_HYPERSLAB_API */ +/* Note that these haven't been working for a while and were never + * publicly released - QAK */ #ifdef NEW_HYPERSLAB_API H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 2a0e63f..db18780 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -874,13 +874,13 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s FUNC_ENTER_NOAPI_NOFUNC(H5S_select_iter_init) /* Check args */ - assert(sel_iter); - assert(space); + HDassert(sel_iter); + HDassert(space); /* Initialize common information */ /* Save the dataspace's rank */ - sel_iter->rank=space->extent.rank; + sel_iter->rank = space->extent.rank; /* Point to the dataspace dimensions, if there are any */ if(sel_iter->rank > 0) @@ -889,10 +889,11 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s sel_iter->dims = NULL; /* Save the element size */ - sel_iter->elmt_size=elmt_size; + sel_iter->elmt_size = elmt_size; /* Call initialization routine for selection type */ - ret_value= (*space->select.type->iter_init)(sel_iter, space); + ret_value = (*space->select.type->iter_init)(sel_iter, space); + HDassert(sel_iter->type); FUNC_LEAVE_NOAPI(ret_value) } /* H5S_select_iter_init() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index e109f95..d3779e5 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -221,7 +221,7 @@ done: /* If the datatype was committed but something failed after that, we need * to return it to the state it was in before it was committed. */ - if(ret_value < 0 && ocrt_info.new_obj) { + if(ret_value < 0 && (NULL != ocrt_info.new_obj)) { if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { /* Remove the datatype from the list of opened objects in the file */ if(H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) diff --git a/src/H5Tenum.c b/src/H5Tenum.c index ec3f2e1..8ef88f5 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -415,65 +415,73 @@ done: static char * H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t size) { - unsigned lt, md=0, rt; /*indices for binary search */ - int cmp=(-1); /*comparison result */ - H5T_t *copied_dt = NULL; /*do sorting in copied datatype */ - char *ret_value; /* Return value */ + H5T_t *copied_dt = NULL; /* Do sorting in copied datatype */ + unsigned lt, md = 0, rt; /* Indices for binary search */ + int cmp = (-1); /* Comparison result */ + hbool_t alloc_name = FALSE; /* Whether name has been allocated */ + char *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5T_enum_nameof, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5T_enum_nameof) /* Check args */ - assert(dt && H5T_ENUM==dt->shared->type); - assert(value); - assert(name || 0==size); - if (name && size>0) *name = '\0'; + HDassert(dt && H5T_ENUM == dt->shared->type); + HDassert(value); + HDassert(name || 0 == size); + + if(name && size > 0) + *name = '\0'; /* Sanity check */ - if (dt->shared->u.enumer.nmembs == 0) + if(dt->shared->u.enumer.nmembs == 0) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "datatype has no members") /* Do a binary search over the values to find the correct one. Do sorting * and search on the copied datatype to protect the original order. */ - if (NULL==(copied_dt=H5T_copy(dt, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy data type"); - if(H5T_sort_value(copied_dt, NULL)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, NULL, "value sort failed") + if(NULL == (copied_dt = H5T_copy(dt, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy data type") + if(H5T_sort_value(copied_dt, NULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOMPARE, NULL, "value sort failed") lt = 0; rt = copied_dt->shared->u.enumer.nmembs; - - while (lt<rt) { - md = (lt+rt)/2; - cmp = HDmemcmp(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size); - if (cmp<0) { + while(lt < rt) { + md = (lt + rt) / 2; + cmp = HDmemcmp(value, copied_dt->shared->u.enumer.value + md * copied_dt->shared->size, copied_dt->shared->size); + if(cmp < 0) rt = md; - } else if (cmp>0) { - lt = md+1; - } else { + else if(cmp > 0) + lt = md + 1; + else break; - } - } + } /* end while */ + /* Value was not yet defined. This fixes bug # 774, 2002/06/05 EIP */ - if (cmp!=0) + if(cmp != 0) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "value is currently not defined") /* Save result name */ - if(!name && NULL == (name = (char *)H5MM_malloc(HDstrlen(copied_dt->shared->u.enumer.name[md]) + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(!name) { + if(NULL == (name = (char *)H5MM_malloc( + HDstrlen(copied_dt->shared->u.enumer.name[md]) + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + alloc_name = TRUE; + } /* end if */ HDstrncpy(name, copied_dt->shared->u.enumer.name[md], size); - if (HDstrlen(copied_dt->shared->u.enumer.name[md])>=size) + if(HDstrlen(copied_dt->shared->u.enumer.name[md]) >= size) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, NULL, "name has been truncated") /* Set return value */ - ret_value=name; + ret_value = name; done: if(copied_dt) if(H5T_close(copied_dt) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close data type"); + if(!ret_value && alloc_name) + H5MM_free(name); FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_enum_nameof() */ /*------------------------------------------------------------------------- @@ -501,8 +509,8 @@ done: herr_t H5Tenum_valueof(hid_t type, const char *name, void *value/*out*/) { - H5T_t *dt = NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5T_t *dt; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tenum_valueof, FAIL) H5TRACE3("e", "i*sx", type, name, value); @@ -512,17 +520,17 @@ H5Tenum_valueof(hid_t type, const char *name, void *value/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if(H5T_ENUM != dt->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an enumeration data type") - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if (!value) + if(!value) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no value buffer") - if (H5T_enum_valueof(dt, name, value)<0) + if(H5T_enum_valueof(dt, name, value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "valueof query failed") done: FUNC_LEAVE_API(ret_value) -} +} /* H5Tenum_valueof() */ /*------------------------------------------------------------------------- @@ -551,11 +559,11 @@ static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/) { unsigned lt, md=0, rt; /*indices for binary search */ - int cmp=(-1); /*comparison result */ + int cmp=(-1); /*comparison result */ H5T_t *copied_dt = NULL; /*do sorting in copied datatype */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_enum_valueof, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5T_enum_valueof) /* Check args */ assert(dt && H5T_ENUM==dt->shared->type); diff --git a/src/H5detect.c b/src/H5detect.c index 29955a1..0461cfd 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -739,7 +739,7 @@ H5TN_init_interface(void)\n\ done:\n\ if(ret_value < 0) {\n\ if(dt != NULL) {\n\ - H5FL_FREE(H5T_shared_t, dt->shared);\n\ + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);\n\ dt = H5FL_FREE(H5T_t, dt);\n\ } /* end if */\n\ } /* end if */\n\ diff --git a/src/H5private.h b/src/H5private.h index 9cebdaa..7950117 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1530,6 +1530,11 @@ typedef enum { H5_NPKGS /*Must be last */ } H5_pkg_t; +typedef struct H5_debug_open_stream_t { + FILE *stream; /* Open output stream */ + struct H5_debug_open_stream_t *next; /* Next open output stream */ +} H5_debug_open_stream_t; + typedef struct H5_debug_t { FILE *trace; /*API trace output stream */ hbool_t ttop; /*Show only top-level calls? */ @@ -1538,6 +1543,7 @@ typedef struct H5_debug_t { const char *name; /*package name */ FILE *stream; /*output stream or NULL */ } pkg[H5_NPKGS]; + H5_debug_open_stream_t *open_stream; /* Stack of open output streams */ } H5_debug_t; extern H5_debug_t H5_debug_g; diff --git a/src/H5system.c b/src/H5system.c index 02ea625..afe07b0 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -604,25 +604,36 @@ HDremove_all(const char *fname) * *------------------------------------------------------------------------- */ -#if !defined(H5_HAVE_GETTIMEOFDAY) && defined(_WIN32) +#ifdef _WIN32 -/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */ +/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */ #define _W32_FT_OFFSET (116444736000000000ULL) int -Wgettimeofday(struct timeval *tv, void *tz) +Wgettimeofday(struct timeval *tv, struct timezone *tz) { union { unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */ FILETIME ft; } _now; - if(tv) - { + static int tzsetflag; + + if(tv) { GetSystemTimeAsFileTime (&_now.ft); tv->tv_usec=(long)((_now.ns100 / 10ULL) % 1000000ULL ); tv->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL); } + + if(tz) { + if(!tzsetflag) { + _tzset(); + tzsetflag = 1; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + /* Always return 0 as per Open Group Base Specifications Issue 6. Do not set errno on error. */ return 0; diff --git a/src/H5timer.c b/src/H5timer.c index 8334402..7bdee8a 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -39,9 +39,9 @@ # include <sys/resource.h> #endif -#ifdef H5_HAVE_GETTIMEOFDAY +#if defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_SYS_TIME_H) #include <sys/time.h> -#endif /* H5_HAVE_GETTIMEOFDAY */ +#endif /****************/ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 6ccc86a..a428899 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -44,16 +44,21 @@ typedef __int64 h5_stat_size_t; #define HDstat(S,B) _stati64(S,B) #define HDgetcwd(S,Z) _getcwd(S,Z) #define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z) -#ifndef H5_HAVE_GETTIMEOFDAY - #ifdef __cplusplus + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#ifdef __cplusplus extern "C" { - #endif /* __cplusplus */ - H5_DLL int Wgettimeofday(struct timeval *tv, void *tz); - #ifdef __cplusplus +#endif /* __cplusplus */ +H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); +#ifdef __cplusplus } - #endif /* __cplusplus */ - #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) -#endif /* H5_HAVE_GETTIMEOFDAY */ +#endif /* __cplusplus */ +#define HDgettimeofday(V,Z) Wgettimeofday(V,Z) + #define HDgetdrive() _getdrive() #define HDlseek(F,O,W) _lseeki64(F,O,W) #define HDoff_t __int64 diff --git a/src/Makefile.in b/src/Makefile.in index 411f6e6..6c95491 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -150,16 +150,19 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Zscaleoffset.lo \ H5Ztrans.lo libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) -libhdf5_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libhdf5_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libhdf5_la_LDFLAGS) $(LDFLAGS) -o $@ PROGRAMS = $(noinst_PROGRAMS) H5detect_SOURCES = H5detect.c H5detect_OBJECTS = H5detect-H5detect.$(OBJEXT) H5detect_LDADD = $(LDADD) -H5detect_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(H5detect_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +H5detect_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(H5detect_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ H5make_libsettings_SOURCES = H5make_libsettings.c H5make_libsettings_OBJECTS = H5make_libsettings.$(OBJEXT) H5make_libsettings_LDADD = $(LDADD) @@ -169,13 +172,26 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libhdf5_la_SOURCES) H5detect.c H5make_libsettings.c DIST_SOURCES = $(libhdf5_la_SOURCES) H5detect.c H5make_libsettings.c DATA = $(settings_DATA) @@ -193,13 +209,16 @@ AMTAR = @AMTAR@ # but which should not be exported to h5cc for building other programs. # AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. +# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ -AM_LDFLAGS = @AM_LDFLAGS@ +AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@ AM_MAKEFLAGS = @AM_MAKEFLAGS@ AR = @AR@ +AS = @AS@ # Set the paths for AFS installs of autotools for Linux machines # Ideally, these tools should never be needed during the build. @@ -259,7 +278,10 @@ GREP = @GREP@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ +H5_CXX_SHARED = @H5_CXX_SHARED@ H5_FCFLAGS = @H5_FCFLAGS@ +H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ +H5_LDFLAGS = @H5_LDFLAGS@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ @@ -663,7 +685,7 @@ clean-libLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done libhdf5.la: $(libhdf5_la_OBJECTS) $(libhdf5_la_DEPENDENCIES) - $(libhdf5_la_LINK) -rpath $(libdir) $(libhdf5_la_OBJECTS) $(libhdf5_la_LIBADD) $(LIBS) + $(AM_V_CCLD)$(libhdf5_la_LINK) -rpath $(libdir) $(libhdf5_la_OBJECTS) $(libhdf5_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ @@ -675,10 +697,10 @@ clean-noinstPROGRAMS: rm -f $$list H5detect$(EXEEXT): $(H5detect_OBJECTS) $(H5detect_DEPENDENCIES) @rm -f H5detect$(EXEEXT) - $(H5detect_LINK) $(H5detect_OBJECTS) $(H5detect_LDADD) $(LIBS) + $(AM_V_CCLD)$(H5detect_LINK) $(H5detect_OBJECTS) $(H5detect_LDADD) $(LIBS) H5make_libsettings$(EXEEXT): $(H5make_libsettings_OBJECTS) $(H5make_libsettings_DEPENDENCIES) @rm -f H5make_libsettings$(EXEEXT) - $(LINK) $(H5make_libsettings_OBJECTS) $(H5make_libsettings_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(H5make_libsettings_OBJECTS) $(H5make_libsettings_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -955,36 +977,41 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5trace.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< H5detect-H5detect.o: H5detect.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.o -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.o -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='H5detect.c' object='H5detect-H5detect.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c H5detect-H5detect.obj: H5detect.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.obj -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.obj -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='H5detect.c' object='H5detect-H5detect.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 2e8bc52..a873062 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -23,10 +23,11 @@ Compiling Options: CPPFLAGS: @CPPFLAGS@ H5_CPPFLAGS: @H5_CPPFLAGS@ AM_CPPFLAGS: @AM_CPPFLAGS@ - Shared Libraries: @enable_shared@ - Static Libraries: @enable_static@ + Shared C Library: @enable_shared@ + Static C Library: @enable_static@ Statically Linked Executables: @STATIC_EXEC@ LDFLAGS: @LDFLAGS@ + H5_LDFLAGS: @H5_LDFLAGS@ AM_LDFLAGS: @AM_LDFLAGS@ Extra libraries: @LIBS@ Archiver: @AR@ @@ -41,11 +42,16 @@ Languages: @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ +@BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_FORTRAN_SHARED@ +@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @enable_static@ + C++: @HDF_CXX@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CXX_VERSION@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ +@BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_CXX_SHARED@ +@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @enable_static@ Features: --------- |