diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-02-24 17:59:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-02-24 17:59:14 (GMT) |
commit | 33a65add7db18a4efd2b34ac8261c2065820ebf9 (patch) | |
tree | 782730a42955d1a247fec9356c5d05f83cce4903 /src | |
parent | e63f0baf7e3a8e36c19f52d7692b483b7440e5eb (diff) | |
download | hdf5-33a65add7db18a4efd2b34ac8261c2065820ebf9.zip hdf5-33a65add7db18a4efd2b34ac8261c2065820ebf9.tar.gz hdf5-33a65add7db18a4efd2b34ac8261c2065820ebf9.tar.bz2 |
[svn-r16514] Description:
Merge r16440:16500 from trunk into 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/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) 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, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src')
68 files changed, 944 insertions, 676 deletions
@@ -440,7 +440,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, attr->shared->initialized = TRUE; /*for now, set to false later*/ /* Copy the object header information */ - if(H5O_loc_copy(&(attr->shared->oloc), loc->oloc, H5_COPY_DEEP) < 0) + if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry") /* Deep copy of the group hierarchy path */ @@ -450,9 +450,9 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, /* Check if any of the pieces should be (or are already) shared in the * SOHM table */ - if(H5SM_try_share(attr->shared->oloc.file, dxpl_id, NULL, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0) + if(H5SM_try_share(attr->oloc.file, dxpl_id, NULL, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "trying to share datatype failed") - if(H5SM_try_share(attr->shared->oloc.file, dxpl_id, NULL, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0) + if(H5SM_try_share(attr->oloc.file, dxpl_id, NULL, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "trying to share dataspace failed") /* Check whether datatype is committed & increment ref count @@ -469,8 +469,8 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * datatype and dataspace messages themselves, or the size of the "shared" * messages if either or both of them are shared. */ - attr->shared->dt_size = H5O_msg_raw_size(attr->shared->oloc.file, H5O_DTYPE_ID, FALSE, attr->shared->dt); - attr->shared->ds_size = H5O_msg_raw_size(attr->shared->oloc.file, H5O_SDSPACE_ID, FALSE, attr->shared->ds); + attr->shared->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_DTYPE_ID, FALSE, attr->shared->dt); + attr->shared->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SDSPACE_ID, FALSE, attr->shared->ds); /* Get # of elements for attribute's dataspace */ if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) @@ -482,16 +482,16 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, attr->shared->data_size = nelmts * H5T_GET_SIZE(attr->shared->dt); /* Hold the symbol table entry (and file) open */ - if(H5O_open(&(attr->shared->oloc)) < 0) + if(H5O_open(&(attr->oloc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open") attr->obj_opened = TRUE; /* Set the version to encode the attribute with */ - if(H5A_set_version(attr->shared->oloc.file, attr) < 0) + if(H5A_set_version(attr->oloc.file, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version") /* Insert the attribute into the object header */ - if(H5O_attr_create(&(attr->shared->oloc), dxpl_id, attr) < 0) + if(H5O_attr_create(&(attr->oloc), dxpl_id, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create attribute in object header") /* Register the new attribute and get an ID for it */ @@ -737,7 +737,7 @@ H5A_open_common(const H5G_loc_t *loc, H5A_t *attr) #if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG) /* Clear object location */ - if(H5O_loc_reset(&(attr->shared->oloc)) < 0) + if(H5O_loc_reset(&(attr->oloc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to reset location") #endif /* H5_USING_MEMCHECKER */ @@ -746,7 +746,7 @@ H5A_open_common(const H5G_loc_t *loc, H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path") /* Deep copy of the symbol table entry */ - if(H5O_loc_copy(&(attr->shared->oloc), loc->oloc, H5_COPY_DEEP) < 0) + if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry") /* Deep copy of the group hier. path */ @@ -754,7 +754,7 @@ H5A_open_common(const H5G_loc_t *loc, H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy entry") /* Hold the symbol table entry (and file) open */ - if(H5O_open(&(attr->shared->oloc)) < 0) + if(H5O_open(&(attr->oloc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open") attr->obj_opened = TRUE; @@ -1032,7 +1032,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) } /* end else */ /* Modify the attribute in the object header */ - if(H5O_attr_write(&(attr->shared->oloc), dxpl_id, attr) < 0) + if(H5O_attr_write(&(attr->oloc), dxpl_id, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute") } /* end if */ @@ -2432,7 +2432,7 @@ H5A_close(H5A_t *attr) HDassert(attr->shared); /* Close the object's symbol-table entry */ - if(attr->obj_opened && (H5O_close(&(attr->shared->oloc)) < 0)) + if(attr->obj_opened && (H5O_close(&(attr->oloc)) < 0)) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release object header info") /* Reference count can be 0. It only happens when H5A_create fails. */ @@ -2486,7 +2486,7 @@ H5A_oloc(H5A_t *attr) HDassert(attr); /* Set return value */ - ret_value = &(attr->shared->oloc); + ret_value = &(attr->oloc); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 07550da..da4ad86 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -168,7 +168,7 @@ H5A_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5A_dense_fh_name_cmp) /* Decode attribute information */ - if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_ATTR_ID, (const unsigned char *)obj))) + if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute") /* Compare the string values */ diff --git a/src/H5Adense.c b/src/H5Adense.c index 76ab95d..bc5ddfb 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -806,7 +806,7 @@ H5A_dense_copy_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) * HDF5 routine, it could attempt to re-protect that direct block for the * heap, causing the HDF5 routine called to fail) */ - if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_ATTR_ID, (const unsigned char *)obj))) + if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, FAIL, "can't decode attribute") /* Set the creation order index for the attribute */ diff --git a/src/H5Aint.c b/src/H5Aint.c index a2cc6ec..c7013a2 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -680,8 +680,8 @@ done: * Purpose: Retrieves the "attribute info" message for an object. Also * sets the number of attributes correctly, if it isn't set up yet. * - * Return: Success: Ptr to message in native format. - * Failure: NULL + * Return: Success: TRUE/FALSE whether message was found & retrieved + * Failure: FAIL if error occurred * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -689,35 +689,40 @@ done: * *------------------------------------------------------------------------- */ -H5O_ainfo_t * +htri_t H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) { - H5O_ainfo_t *ret_value; /* Return value */ + htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5A_get_ainfo, NULL) + FUNC_ENTER_NOAPI(H5A_get_ainfo, FAIL) /* check arguments */ HDassert(f); HDassert(oh); + HDassert(ainfo); + + /* Check if the "attribute info" message exists */ + if((ret_value = H5O_msg_exists_oh(oh, H5O_AINFO_ID)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "unable to check object header") + if(ret_value > 0) { + /* Retrieve the "attribute info" structure */ + if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_AINFO_ID, ainfo)) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't read AINFO message") - /* Retrieve the "attribute info" structure */ - if((ret_value = (H5O_ainfo_t *)H5O_msg_read_oh(f, dxpl_id, oh, H5O_AINFO_ID, ainfo))) { /* Check if we don't know how many attributes there are */ - if(ret_value->nattrs == HSIZET_MAX) { + if(ainfo->nattrs == HSIZET_MAX) { /* Check if we are using "dense" attribute storage */ - if(H5F_addr_defined(ret_value->fheap_addr)) { + if(H5F_addr_defined(ainfo->fheap_addr)) { /* Retrieve # of records in "name" B-tree */ /* (should be same # of records in all indices) */ - if(H5B2_get_nrec(f, dxpl_id, H5A_BT2_NAME, ret_value->name_bt2_addr, &ret_value->nattrs) < 0) + if(H5B2_get_nrec(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &ainfo->nattrs) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't retrieve # of records in index") } /* end if */ else /* Retrieve # of attributes from object header */ - ret_value->nattrs = oh->attr_msgs_seen; + ainfo->nattrs = oh->attr_msgs_seen; } /* end if */ } /* end if */ - else - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "attribute info message not present") done: FUNC_LEAVE_NOAPI(ret_value) @@ -829,7 +834,7 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared attr structure") /* Don't have an opened group location for copy */ - H5O_loc_reset(&(attr_dst->shared->oloc)); + H5O_loc_reset(&(attr_dst->oloc)); H5G_name_reset(&(attr_dst->path)); attr_dst->obj_opened = FALSE; diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 9027864..b166b06 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -76,7 +76,6 @@ typedef struct H5A_shared_t { unsigned version; /* Version to encode attribute with */ hbool_t initialized;/* Indicate whether the attribute has been modified */ - H5O_loc_t oloc; /* Object location for object attribute is on */ char *name; /* Attribute's name */ H5T_cset_t encoding; /* Character encoding of attribute name */ @@ -96,6 +95,7 @@ typedef struct H5A_shared_t { /* Define the main attribute structure */ struct H5A_t { H5O_shared_t sh_loc; /* Shared message info (must be first) */ + H5O_loc_t oloc; /* Object location for object attribute is on */ hbool_t obj_opened; /* Object header entry opened? */ H5G_name_t path; /* Group hierarchy path */ H5A_shared_t *shared; /* Shared attribute information */ @@ -218,8 +218,7 @@ H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr); H5_DLL herr_t H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo); H5_DLL herr_t H5A_free(H5A_t *attr); H5_DLL herr_t H5A_close(H5A_t *attr); -H5_DLL H5O_ainfo_t *H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - H5O_ainfo_t *ainfo); +H5_DLL htri_t H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo); H5_DLL herr_t H5A_set_version(const H5F_t *f, H5A_t *attr); /* Attribute "dense" storage routines */ diff --git a/src/H5Atest.c b/src/H5Atest.c index de03a25..df88472 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -139,7 +139,7 @@ H5A_get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr)); /* Retrieve ref count for shared or shareable attribute */ - if(H5SM_get_refcount(attr->shared->oloc.file, H5AC_ind_dxpl_id, H5O_ATTR_ID, + if(H5SM_get_refcount(attr->oloc.file, H5AC_ind_dxpl_id, H5O_ATTR_ID, &attr->sh_loc, ref_count) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") @@ -712,7 +712,7 @@ H5Dget_access_plist(hid_t dset_id) if (dset->shared->layout.type == H5D_CHUNKED) { if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(dset->shared->cache.chunk.nslots)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots") - if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(dset->shared->cache.chunk.nbytes)) < 0) + if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(dset->shared->cache.chunk.nbytes_max)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size") if (H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &(dset->shared->cache.chunk.w0)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 8318af1..a99998f 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -194,14 +194,17 @@ static herr_t H5D_chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *typ H5D_chunk_map_t *fm); static herr_t H5D_chunk_io_term(const H5D_chunk_map_t *fm); -/* "Null" layout operation callbacks */ -static ssize_t H5D_null_readvv(const H5D_io_info_t *io_info, - size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], +/* "Nonexistent" layout operation callback */ +static ssize_t +H5D_nonexistent_readvv(const H5D_io_info_t *io_info, + size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); /* Helper routines */ static void *H5D_chunk_alloc(size_t size, const H5O_pline_t *pline); static void *H5D_chunk_xfree(void *chk, const H5O_pline_t *pline); +static herr_t H5D_chunk_cinfo_cache_update(H5D_chunk_cached_t *last, + const H5D_chunk_ud_t *udata); static herr_t H5D_free_chunk_info(void *item, void *key, void *opdata); static herr_t H5D_create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); @@ -240,8 +243,8 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ /* Local Variables */ /*******************/ -/* "null" storage layout I/O ops */ -const H5D_layout_ops_t H5D_LOPS_NULL[1] = {{ +/* "nonexistent" storage layout I/O ops */ +const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{ NULL, NULL, NULL, @@ -251,7 +254,7 @@ const H5D_layout_ops_t H5D_LOPS_NULL[1] = {{ NULL, NULL, #endif /* H5_HAVE_PARALLEL */ - H5D_null_readvv, + H5D_nonexistent_readvv, NULL, NULL }}; @@ -1373,7 +1376,7 @@ done: *------------------------------------------------------------------------- */ hbool_t -H5D_chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr) +H5D_chunk_cacheable(const H5D_io_info_t *io_info) { const H5D_t *dataset = io_info->dset; hbool_t ret_value; @@ -1402,8 +1405,7 @@ H5D_chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr) * cache, just write the data to it directly. */ H5_CHECK_OVERFLOW(dataset->shared->layout.u.chunk.size, uint32_t, size_t); - if((size_t)dataset->shared->layout.u.chunk.size > dataset->shared->cache.chunk.nbytes - && H5F_addr_defined(caddr)) + if((size_t)dataset->shared->layout.u.chunk.size > dataset->shared->cache.chunk.nbytes_max) ret_value = FALSE; else ret_value = TRUE; @@ -1481,7 +1483,7 @@ H5D_chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm) { H5SL_node_t *chunk_node; /* Current node in chunk skip list */ - H5D_io_info_t nul_io_info; /* "null" I/O info object */ + H5D_io_info_t nonexistent_io_info; /* "nonexistent" I/O info object */ H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */ H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ H5D_io_info_t cpt_io_info; /* Compact I/O info object */ @@ -1500,9 +1502,9 @@ H5D_chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HDassert(type_info); HDassert(fm); - /* Set up "null" I/O info object */ - HDmemcpy(&nul_io_info, io_info, sizeof(nul_io_info)); - nul_io_info.layout_ops = *H5D_LOPS_NULL; + /* Set up "nonexistent" I/O info object */ + HDmemcpy(&nonexistent_io_info, io_info, sizeof(nonexistent_io_info)); + nonexistent_io_info.layout_ops = *H5D_LOPS_NONEXISTENT; /* Set up contiguous I/O info object */ HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); @@ -1552,17 +1554,10 @@ H5D_chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* Check for non-existant chunk & skip it if appropriate */ - if(!H5F_addr_defined(udata.addr) && !H5D_chunk_in_cache(io_info->dset, chunk_info->coords, chunk_info->index) - && skip_missing_chunks) { - /* No chunk cached */ - chunk = NULL; - - /* Point I/O info at "null" I/O info for this chunk */ - chk_io_info = &nul_io_info; - } /* end if */ - else { + if(H5F_addr_defined(udata.addr) || H5D_chunk_in_cache(io_info->dset, chunk_info->coords, chunk_info->index) + || !skip_missing_chunks) { /* Load the chunk into cache and lock it. */ - if(H5D_chunk_cacheable(io_info, udata.addr)) { + if(H5D_chunk_cacheable(io_info)) { /* Pass in chunk's coordinates in a union. */ io_info->store->chunk.offset = chunk_info->coords; io_info->store->chunk.index = chunk_info->index; @@ -1580,10 +1575,7 @@ H5D_chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Point I/O info at contiguous I/O info for this chunk */ chk_io_info = &cpt_io_info; } /* end if */ - else { - /* Sanity check */ - HDassert(H5F_addr_defined(udata.addr)); - + else if(H5F_addr_defined(udata.addr)) { /* Set up the storage address information for this chunk */ ctg_store.contig.dset_addr = udata.addr; @@ -1592,17 +1584,24 @@ H5D_chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Point I/O info at temporary I/O info for this chunk */ chk_io_info = &ctg_io_info; + } /* end else if */ + else { + /* No chunk cached */ + chunk = NULL; + + /* Point I/O info at "nonexistent" I/O info for this chunk */ + chk_io_info = &nonexistent_io_info; } /* end else */ - } /* end else */ - /* Perform the actual read operation */ - if((io_info->io_ops.single_read)(chk_io_info, type_info, - (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed") + /* Perform the actual read operation */ + if((io_info->io_ops.single_read)(chk_io_info, type_info, + (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed") - /* Release the cache lock on the chunk. */ - if(chunk && H5D_chunk_unlock(io_info, FALSE, idx_hint, chunk, src_accessed_bytes) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + /* Release the cache lock on the chunk. */ + if(chunk && H5D_chunk_unlock(io_info, FALSE, idx_hint, chunk, src_accessed_bytes) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + } /* end if */ /* Advance to next chunk in list */ chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node); @@ -1623,6 +1622,12 @@ done: * Programmer: Raymond Lu * Thursday, April 10, 2003 * + * Modification:Raymond Lu + * 4 Feb 2009 + * One case that was considered cacheable was when the chunk + * was bigger than the cache size but not allocated on disk. + * I moved it to uncacheable branch to bypass the cache to + * improve performance. *------------------------------------------------------------------------- */ static herr_t @@ -1679,7 +1684,7 @@ H5D_chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, * simply allocate space instead of load the chunk. */ if(H5D_chunk_get_info(io_info->dset, io_info->dxpl_id, chunk_info->coords, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - if(H5D_chunk_cacheable(io_info, udata.addr)) { + if(H5D_chunk_cacheable(io_info)) { hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */ /* Pass in chunk's coordinates in a union. */ @@ -1705,8 +1710,30 @@ H5D_chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, chk_io_info = &cpt_io_info; } /* end if */ else { - /* Sanity check */ - HDassert(H5F_addr_defined(udata.addr)); + /* If the chunk hasn't been allocated on disk, do so now. */ + if(!H5F_addr_defined(udata.addr)) { + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + + /* Compose chunked index info struct */ + idx_info.f = io_info->dset->oloc.file; + idx_info.dxpl_id = io_info->dxpl_id; + idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline); + idx_info.layout = &(io_info->dset->shared->layout); + + /* Set up the size of chunk for user data */ + udata.nbytes = io_info->dset->shared->layout.u.chunk.size; + + /* Create the chunk */ + if((io_info->dset->shared->layout.u.chunk.ops->insert)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") + + /* Make sure the address of the chunk is returned. */ + if(!H5F_addr_defined(udata.addr)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") + + /* Cache the new chunk information */ + H5D_chunk_cinfo_cache_update(&io_info->dset->shared->cache.chunk.last, &udata); + } /* end if */ /* Set up the storage address information for this chunk */ ctg_store.contig.dset_addr = udata.addr; @@ -1827,19 +1854,19 @@ H5D_chunk_init(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, const H5D_t *dset) if(rdcc->nslots == H5D_CHUNK_CACHE_NSLOTS_DEFAULT) rdcc->nslots = H5F_RDCC_NSLOTS(f); - if(H5P_get(dapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc->nbytes) < 0) + if(H5P_get(dapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc->nbytes_max) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size"); - if(rdcc->nbytes == H5D_CHUNK_CACHE_NBYTES_DEFAULT) - rdcc->nbytes = H5F_RDCC_NBYTES(f); + if(rdcc->nbytes_max == H5D_CHUNK_CACHE_NBYTES_DEFAULT) + rdcc->nbytes_max = H5F_RDCC_NBYTES(f); if(H5P_get(dapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc->w0) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks"); if(rdcc->w0 < 0) rdcc->w0 = H5F_RDCC_W0(f); - /* If nbytes or nslots is 0, set them both to 0 and avoid allocating space */ - if(!rdcc->nbytes || !rdcc->nslots) - rdcc->nbytes = rdcc->nslots = 0; + /* If nbytes_max or nslots is 0, set them both to 0 and avoid allocating space */ + if(!rdcc->nbytes_max || !rdcc->nslots) + rdcc->nbytes_max = rdcc->nslots = 0; else { rdcc->slot = H5FL_SEQ_CALLOC(H5D_rdcc_ent_ptr_t, rdcc->nslots); if(NULL == rdcc->slot) @@ -2338,7 +2365,7 @@ H5D_chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * /* Remove from cache */ rdcc->slot[ent->idx] = NULL; ent->idx = UINT_MAX; - rdcc->nbytes -= ent->chunk_size; + rdcc->nbytes_used -= ent->chunk_size; --rdcc->nused; /* Free */ @@ -2368,7 +2395,7 @@ H5D_chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, size_t size) { const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); - size_t total = rdcc->nbytes; + size_t total = rdcc->nbytes_max; const int nmeth = 2; /*number of methods */ int w[1]; /*weighting as an interval */ H5D_rdcc_ent_t *p[2], *cur; /*list pointers */ @@ -2392,7 +2419,7 @@ H5D_chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, p[0] = rdcc->head; p[1] = NULL; - while((p[0] || p[1]) && (rdcc->nbytes + size) > total) { + while((p[0] || p[1]) && (rdcc->nbytes_used + size) > total) { int i; /* Local index variable */ /* Introduce new pointers */ @@ -2405,7 +2432,7 @@ H5D_chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, n[i] = p[i] ? p[i]->next : NULL; /* Give each method a chance */ - for(i = 0; i < nmeth && (rdcc->nbytes + size) > total; i++) { + for(i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) { if(0 == i && p[0] && !p[0]->locked && ((0 == p[0]->rd_count && 0 == p[0]->wr_count) || (0 == p[0]->rd_count && p[0]->chunk_size == p[0]->wr_count) || @@ -2625,7 +2652,7 @@ H5D_chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, } /* end else */ HDassert(found || chunk_size > 0); - if(!found && rdcc->nslots > 0 && chunk_size <= rdcc->nbytes && + if(!found && rdcc->nslots > 0 && chunk_size <= rdcc->nbytes_max && (!ent || !ent->locked)) { /* * Add the chunk to the cache only if the slot is not already locked. @@ -2655,7 +2682,7 @@ H5D_chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, HDassert(NULL == rdcc->slot[idx]); rdcc->slot[idx] = ent; ent->idx = idx; - rdcc->nbytes += chunk_size; + rdcc->nbytes_used += chunk_size; rdcc->nused++; /* Add it to the linked list */ @@ -4625,28 +4652,38 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_null_readvv + * Function: H5D_nonexistent_readvv + * + * Purpose: When the chunk doesn't exist on disk and the chunk is bigger + * than the cache size, performs fill value I/O operation on + * memory buffer, advancing through two I/O vectors, until one + * runs out. * - * Purpose: Performs "no-op" I/O operation, advancing through two I/O - * vectors, until one runs out. + * Note: This algorithm is pretty inefficient about initializing and + * terminating the fill buffer info structure and it would be + * faster to refactor this into a "real" initialization routine, + * and a "vectorized fill" routine. -QAK * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, April 1, 2008 + * Programmer: Raymond Lu + * 6 Feb 2009 * *------------------------------------------------------------------------- */ static ssize_t -H5D_null_readvv(const H5D_io_info_t UNUSED *io_info, +H5D_nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]) { - size_t u, v; /* Local index variables */ - size_t size; /* Size of sequence in bytes */ - ssize_t bytes_processed = 0; /* Eventual return value */ + H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ + H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ + hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ + ssize_t bytes_processed = 0; /* Eventual return value */ + size_t u, v; /* Local index variables */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_null_readvv) + FUNC_ENTER_NOAPI_NOINIT(H5D_nonexistent_readvv) /* Check args */ HDassert(chunk_len_arr); @@ -4656,12 +4693,35 @@ H5D_null_readvv(const H5D_io_info_t UNUSED *io_info, /* Work through all the sequences */ for(u = *mem_curr_seq, v = *chunk_curr_seq; u < mem_max_nseq && v < chunk_max_nseq; ) { + unsigned char *buf; /* Temporary pointer into read buffer */ + size_t size; /* Size of sequence in bytes */ + /* Choose smallest buffer to write */ if(chunk_len_arr[v] < mem_len_arr[u]) size = chunk_len_arr[v]; else size = mem_len_arr[u]; + /* Compute offset in memory */ + buf = (unsigned char *)io_info->u.rbuf + mem_offset_arr[v]; + + /* Initialize the fill value buffer */ + if(H5D_fill_init(&fb_info, buf, FALSE, + NULL, NULL, NULL, NULL, + &dset->shared->dcpl_cache.fill, dset->shared->type, + dset->shared->type_id, (size_t)0, size, io_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") + fb_info_init = TRUE; + + /* Check for VL datatype & fill the buffer with VL datatype fill values */ + if(fb_info.has_vlen_fill_type && H5D_fill_refill_vl(&fb_info, fb_info.elmts_per_buf, io_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") + + /* Release the fill buffer info */ + if(H5D_fill_term(&fb_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + fb_info_init = FALSE; + /* Update source information */ chunk_len_arr[v] -= size; chunk_offset_arr[v] += size; @@ -4682,6 +4742,14 @@ H5D_null_readvv(const H5D_io_info_t UNUSED *io_info, *mem_curr_seq = u; *chunk_curr_seq = v; - FUNC_LEAVE_NOAPI(bytes_processed) -} /* H5D_null_readvv() */ + /* Set return value */ + ret_value = bytes_processed; + +done: + /* Release the fill buffer info, if it's been initialized */ + if(fb_info_init && H5D_fill_term(&fb_info) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D_nonexistent_readvv() */ diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 03e3434..5ba1c5f 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -404,7 +404,7 @@ H5D_earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long_long)idx); + sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); @@ -563,7 +563,7 @@ H5D_earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long_long)idx); + sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, elmt->filter_mask); diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 99ad001..19be413 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1224,7 +1224,7 @@ if(H5DEBUG(D)) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list") /* Load the chunk into cache and lock it. */ - if(H5D_chunk_cacheable(io_info, udata.addr)) { + if(H5D_chunk_cacheable(io_info)) { hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */ /* Compute # of bytes accessed in chunk */ @@ -1449,7 +1449,7 @@ if(H5DEBUG(D)) { HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't switch to independent I/O") /* Load the chunk into cache and lock it. */ - if(H5D_chunk_cacheable(io_info, udata.addr)) { + if(H5D_chunk_cacheable(io_info)) { hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */ /* Compute # of bytes accessed in chunk */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 5cef2fe..4d5bd45 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -366,11 +366,12 @@ typedef struct H5D_rdcc_t { unsigned nmisses;/* Number of cache misses */ unsigned nflushes;/* Number of cache flushes */ } stats; - size_t nbytes; /* Current cached raw data in bytes */ + size_t nbytes_max; /* Maximum cached raw data in bytes */ size_t nslots; /* Number of chunk slots allocated */ double w0; /* Chunk preemption policy */ struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */ struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */ + size_t nbytes_used; /* Current cached raw data in bytes */ int nused; /* Number of chunk slots in use */ H5D_chunk_cached_t last; /* Cached copy of last chunk information */ struct H5D_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/ @@ -573,7 +574,7 @@ H5_DLL herr_t H5D_contig_copy(H5F_t *f_src, const H5O_layout_t *layout_src, H5F_ H5O_layout_t *layout_dst, H5T_t *src_dtype, H5O_copy_t *cpy_info, hid_t dxpl_id); /* Functions that operate on chunked dataset storage */ -H5_DLL hbool_t H5D_chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr); +H5_DLL hbool_t H5D_chunk_cacheable(const H5D_io_info_t *io_info); H5_DLL herr_t H5D_chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); H5_DLL herr_t H5D_chunk_create(H5D_t *dset /*in,out*/, hid_t dxpl_id); H5_DLL herr_t H5D_chunk_init(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, const H5D_t *dset); @@ -670,6 +671,7 @@ H5_DLL htri_t H5D_mpio_opt_possible(const H5D_io_info_t *io_info, H5_DLL herr_t H5D_layout_version_test(hid_t did, unsigned *version); H5_DLL herr_t H5D_layout_contig_size_test(hid_t did, hsize_t *size); H5_DLL herr_t H5D_layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type); +H5_DLL herr_t H5D_current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused); #endif /* H5D_TESTING */ #endif /*_H5Dpkg_H*/ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index b71ba30..34ea99f 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -176,3 +176,49 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D_layout_idx_type_test() */ + +/*-------------------------------------------------------------------------- + NAME + H5D_current_cache_size_test + PURPOSE + Determine current the size of the dataset's chunk cache + USAGE + herr_t H5D_layout_contig_size_test(did, size) + hid_t did; IN: Dataset to query + hsize_t *size; OUT: Pointer to location to place size info + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Checks the size of a contiguous dataset's storage. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5D_current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused) +{ + H5D_t *dset; /* Pointer to dataset to query */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI(H5D_current_cache_size_test, FAIL) + + /* Check args */ + if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + + if(nbytes_used) { + HDassert(dset->shared->layout.type == H5D_CHUNKED); + *nbytes_used = dset->shared->cache.chunk.nbytes_used; + } /* end if */ + + if(nused) { + HDassert(dset->shared->layout.type == H5D_CHUNKED); + *nused = dset->shared->cache.chunk.nused; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D_current_cache_size_test() */ + @@ -199,7 +199,7 @@ H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, const H5EA_class_t *cls)) HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); #endif /* QAK */ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, cls, NULL, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header, address = %llu", (unsigned long_long)ea_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header, address = %llu", (unsigned long long)ea_addr) /* Check for pending array deletion */ if(hdr->pending_delete) @@ -365,7 +365,7 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); /* Protect index block */ if(NULL == (iblock = H5EA__iblock_protect(hdr, dxpl_id, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long_long)hdr->idx_blk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr) /* Check if element is in index block */ if(idx < hdr->cparam.idx_blk_elmts) { @@ -420,7 +420,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_i /* Protect data block */ if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, iblock->dblk_addrs[dblk_idx], hdr->sblk_info[sblk_idx].dblk_nelmts, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long_long)iblock->dblk_addrs[dblk_idx]) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)iblock->dblk_addrs[dblk_idx]) /* Adjust index to offset in data block */ elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; @@ -455,7 +455,7 @@ HDfprintf(stderr, "%s: New super block address is: %a\n", FUNC, sblk_addr); /* Protect super block */ if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, iblock->sblk_addrs[sblk_off], sblk_idx, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long_long)iblock->sblk_addrs[sblk_off]) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)iblock->sblk_addrs[sblk_off]) /* Compute the data block index in super block */ dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts); @@ -532,7 +532,7 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ /* Protect data block page */ if(NULL == (dblk_page = H5EA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long_long)dblk_page_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr) /* Set pointer to elements */ elmts = dblk_page->elmts; @@ -540,7 +540,7 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ else { /* Protect data block */ if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long_long)sblock->dblk_addrs[dblk_idx]) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)sblock->dblk_addrs[dblk_idx]) /* Set pointer to elements */ elmts = dblock->elmts; @@ -639,7 +639,7 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); /* Protect index block */ if(NULL == (iblock = H5EA__iblock_protect(hdr, dxpl_id, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long_long)hdr->idx_blk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr) /* Check if element is in index block */ if(idx < hdr->cparam.idx_blk_elmts) { @@ -681,7 +681,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u\n", FUNC, dblk_idx); else { /* Protect data block */ if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, iblock->dblk_addrs[dblk_idx], hdr->sblk_info[sblk_idx].dblk_nelmts, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long_long)iblock->dblk_addrs[dblk_idx]) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)iblock->dblk_addrs[dblk_idx]) /* Adjust index to offset in data block */ elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; @@ -705,7 +705,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u\n", FUNC, dblk_idx); else { /* Protect super block */ if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, iblock->sblk_addrs[sblk_off], sblk_idx, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long_long)iblock->sblk_addrs[sblk_off]) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)iblock->sblk_addrs[sblk_off]) /* Compute the data block index in super block */ dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts); @@ -779,7 +779,7 @@ HDfprintf(stderr, "%s: elmt_idx = %Hu, dblk_page_addr = %a\n", FUNC, elmt_idx, d /* Protect data block page */ if(NULL == (dblk_page = H5EA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long_long)dblk_page_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr) /* Set pointer to elements */ elmts = dblk_page->elmts; @@ -788,7 +788,7 @@ HDfprintf(stderr, "%s: elmt_idx = %Hu, dblk_page_addr = %a\n", FUNC, elmt_idx, d else { /* Protect data block */ if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long_long)sblock->dblk_addrs[dblk_idx]) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)sblock->dblk_addrs[dblk_idx]) /* Set pointer to elements */ elmts = dblock->elmts; @@ -924,7 +924,7 @@ H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr)) HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); #endif /* QAK */ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, NULL, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long_long)ea_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) /* Check for files using shared array header */ if(hdr->file_rc) diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 0cafe3d..2c903b2 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -208,7 +208,7 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Protect index block */ if(NULL == (iblock = H5EA__iblock_protect(hdr, dxpl_id, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long_long)hdr->idx_blk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr) /* Print opening message */ HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, ""); @@ -321,7 +321,7 @@ H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Protect super block */ if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, addr, sblk_idx, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long_long)addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)addr) /* Print opening message */ HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, ""); @@ -405,7 +405,7 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Protect data block */ if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, addr, dblk_nelmts, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long_long)addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)addr) /* Print opening message */ HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, ""); diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 4b9cc9d..a8edae1 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -223,7 +223,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Protect the data block page */ if(NULL == (ret_value = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, NULL, hdr, rw))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long_long)dblk_page_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr) CATCH @@ -260,7 +260,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Unprotect the data block page */ if(H5AC_unprotect(dblk_page->hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", (unsigned long_long)dblk_page->addr) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", (unsigned long long)dblk_page->addr) CATCH diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index aec5af2..af2828a 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -317,7 +317,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Protect the data block */ if(NULL == (ret_value = (H5EA_dblock_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_DBLOCK, dblk_addr, &dblk_nelmts, hdr, rw))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long_long)dblk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)dblk_addr) CATCH @@ -352,7 +352,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Unprotect the data block */ if(H5AC_unprotect(dblock->hdr->f, dxpl_id, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", (unsigned long_long)dblock->addr) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", (unsigned long long)dblock->addr) CATCH @@ -391,7 +391,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Protect data block */ if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, dblk_addr, dblk_nelmts, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long_long)dblk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)dblk_addr) /* Check if this is a paged data block */ if(dblk_nelmts > hdr->dblk_page_nelmts) { diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 6fd6f2a..2d93015 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -292,7 +292,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Protect the index block */ if(NULL == (ret_value = (H5EA_iblock_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, NULL, hdr, rw))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long_long)hdr->idx_blk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr) CATCH @@ -327,7 +327,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Unprotect the index block */ if(H5AC_unprotect(iblock->hdr->f, dxpl_id, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", (unsigned long_long)iblock->addr) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", (unsigned long long)iblock->addr) CATCH @@ -364,7 +364,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Protect index block */ if(NULL == (iblock = H5EA__iblock_protect(hdr, dxpl_id, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long_long)hdr->idx_blk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr) /* Check for index block having data block pointers */ if(iblock->ndblk_addrs > 0) { diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index 4ad83b0..3cb97a9 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -289,7 +289,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Protect the super block */ if(NULL == (ret_value = (H5EA_sblock_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblk_addr, &sblk_idx, hdr, rw))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long_long)sblk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)sblk_addr) CATCH @@ -324,7 +324,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Unprotect the super block */ if(H5AC_unprotect(sblock->hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", (unsigned long_long)sblock->addr) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", (unsigned long long)sblock->addr) CATCH @@ -363,7 +363,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Protect super block */ if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, sblk_addr, sblk_idx, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long_long)sblk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)sblk_addr) /* Iterate over data blocks */ for(u = 0; u < sblock->ndblks; u++) { diff --git a/src/H5EAtest.c b/src/H5EAtest.c index de63d11..5337aea 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -322,9 +322,9 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long_long)idx); + sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, - (unsigned long_long)*(const uint64_t *)elmt); + (unsigned long long)*(const uint64_t *)elmt); END_FUNC(STATIC) /* end H5EA__test_debug() */ @@ -428,7 +428,7 @@ H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_obj_count) /* H5F_get_objects doesn't fail */ - ret_value=H5F_get_objects(f, types, 0, NULL, app_ref); + ret_value = H5F_get_objects(f, types, 0, NULL, app_ref); FUNC_LEAVE_NOAPI(ret_value) } @@ -518,8 +518,6 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list * Programmer: Raymond Lu * Wednesday, Dec 5, 2001 * - * Modification: - * *--------------------------------------------------------------------------- */ static size_t @@ -587,7 +585,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_ ret_value = obj_id_count; FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5F_get_objects() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 2be54f8..e0421a7 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1945,9 +1945,9 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) if (HADDR_UNDEF!=file->memb_addr[mt]) { haddr_t eoa = H5FDget_eoa(file->memb[mt], mt); fprintf(stderr, " %6d %20llu %20llu %20llu %s\n", - (int)mt, (unsigned long_long)(file->memb_addr[mt]), - (unsigned long_long)eoa, - (unsigned long_long)(file->memb_next[mt]), + (int)mt, (unsigned long long)(file->memb_addr[mt]), + (unsigned long long)eoa, + (unsigned long long)(file->memb_next[mt]), file->memb_name[mt]); } } diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index d060a11..c16fc16 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -164,7 +164,7 @@ H5G_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5G_dense_fh_name_cmp) /* Decode link information */ - if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Compare the string values */ diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 6c3a171..2bca4fa 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -566,7 +566,7 @@ H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_uda FUNC_ENTER_NOAPI_NOINIT(H5G_dense_lookup_by_idx_fh_cb) /* Decode link information & keep a copy */ - if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Copy link information */ @@ -852,7 +852,7 @@ H5G_dense_iterate_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) * HDF5 routine, it could attempt to re-protect that direct block for the * heap, causing the HDF5 routine called to fail - QAK) */ - if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") done: @@ -1047,7 +1047,7 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_u FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_name_by_idx_fh_cb) /* Decode link information */ - if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Get the length of the name */ @@ -1245,7 +1245,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_fh_cb) /* Decode link information */ - if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Check for removing the link from the creation order index */ @@ -1408,7 +1408,7 @@ H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_uda FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_by_idx_fh_cb) /* Decode link information */ - if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5_ITER_ERROR, "can't decode link") /* Can't operate on link here because the fractal heap block is locked */ diff --git a/src/H5Gobj.c b/src/H5Gobj.c index a6b2d7f..3220b67 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -317,8 +317,8 @@ H5G_obj_ent_encode(const H5F_t *f, uint8_t **pp, const H5O_loc_t *oloc) * Purpose: Retrieves the "link info" message for an object. Also * sets the number of links correctly, if it isn't set up yet. * - * Return: Success: Ptr to message in native format. - * Failure: NULL + * Return: Success: TRUE/FALSE whether message was found & retrieved + * Failure: FAIL if error occurred * * Programmer: Quincey Koziol * koziol@hdfgroup.org diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 847c54e..8ab35cb 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -387,7 +387,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); UINT32DECODE(p, hdr->pline_root_direct_filter_mask); /* Decode I/O filter information */ - if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, dxpl_id, H5O_PLINE_ID, p))) + if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, dxpl_id, NULL, H5O_PLINE_ID, p))) HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters") p += hdr->filter_len; @@ -1393,9 +1393,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_link + * Function: H5O_link_oh * - * Purpose: Adjust the link count for an object header by adding + * Purpose: Adjust the link count for an open object header by adding * ADJUST to the link count. * * Return: Success: New link count @@ -1409,24 +1409,12 @@ done: *------------------------------------------------------------------------- */ int -H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) +H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) { - H5O_t *oh = NULL; - H5AC_protect_t oh_acc; /* Access mode for protecting object header */ - unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Whether the object was deleted */ + haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_link, FAIL) - - /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - - /* get header */ - oh_acc = adjust ? H5AC_WRITE : H5AC_READ; - if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + FUNC_ENTER_NOAPI(H5O_link_oh, FAIL) /* Check for adjusting link count */ if(adjust) { @@ -1435,38 +1423,38 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) if((unsigned)(-adjust) > oh->nlink) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative") oh->nlink += adjust; - oh_flags |= H5AC__DIRTIED_FLAG; + *oh_flags |= H5AC__DIRTIED_FLAG; /* Check if the object should be deleted */ if(oh->nlink == 0) { /* Check if the object is still open by the user */ - if(H5FO_opened(loc->file, loc->addr) != NULL) { + if(H5FO_opened(f, addr) != NULL) { /* Flag the object to be deleted when it's closed */ - if(H5FO_mark(loc->file, loc->addr, TRUE) < 0) + if(H5FO_mark(f, addr, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") } /* end if */ else { /* Delete object right now */ - if(H5O_delete_oh(loc->file, dxpl_id, oh) < 0) + if(H5O_delete_oh(f, dxpl_id, oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file") /* Mark the object header as deleted */ - oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + *oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; } /* end else */ } /* end if */ } else { /* A new object, or one that will be deleted */ if(oh->nlink == 0) { /* Check if the object is current open, but marked for deletion */ - if(H5FO_marked(loc->file, loc->addr) > 0) { + if(H5FO_marked(f, addr) > 0) { /* Remove "delete me" flag on the object */ - if(H5FO_mark(loc->file, loc->addr, FALSE) < 0) + if(H5FO_mark(f, addr, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") } /* end if */ } /* end if */ oh->nlink += adjust; - oh_flags |= H5AC__DIRTIED_FLAG; + *oh_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Check for operations on refcount message */ @@ -1475,7 +1463,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) if(oh->has_refcount_msg) { /* Check for removing refcount message */ if(oh->nlink <= 1) { - if(H5O_msg_remove_real(loc->file, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0) + if(H5O_msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete refcount message") oh->has_refcount_msg = FALSE; } /* end if */ @@ -1483,7 +1471,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) else { H5O_refcount_t refcount = oh->nlink; - if(H5O_msg_write_real(loc->file, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) + if(H5O_msg_write_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update refcount message") } /* end else */ } /* end if */ @@ -1492,7 +1480,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) if(oh->nlink > 1) { H5O_refcount_t refcount = oh->nlink; - if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) + if(H5O_msg_append_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new refcount message") oh->has_refcount_msg = TRUE; } /* end if */ @@ -1504,6 +1492,51 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) ret_value = oh->nlink; done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_link_oh() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_link + * + * Purpose: Adjust the link count for an object header by adding + * ADJUST to the link count. + * + * Return: Success: New link count + * + * Failure: Negative + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 5 1997 + * + *------------------------------------------------------------------------- + */ +int +H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) +{ + H5O_t *oh = NULL; + H5AC_protect_t oh_acc; /* Access mode for protecting object header */ + unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Whether the object was deleted */ + int ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_link, FAIL) + + /* check args */ + HDassert(loc); + HDassert(loc->file); + HDassert(H5F_addr_defined(loc->addr)); + + /* get header */ + oh_acc = adjust ? H5AC_WRITE : H5AC_READ; + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + + /* Call the "real" link routine */ + if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &oh_flags)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust object link count") + +done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") @@ -2383,7 +2416,8 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o } /* end for */ /* Retrieve # of attributes */ - oinfo->num_attrs = H5O_attr_count_real(oloc->file, dxpl_id, oh); + if(H5O_attr_count_real(oloc->file, dxpl_id, oh, &oinfo->num_attrs) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Get B-tree & heap metadata storage size, if requested */ if(want_ih_info) { diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 7f6a55d..667f28c 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -35,8 +35,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_ainfo_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_ainfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_ainfo_copy(const void *_mesg, void *_dest); static size_t H5O_ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -105,8 +105,8 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t); *------------------------------------------------------------------------- */ static void * -H5O_ainfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_ainfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_ainfo_t *ainfo = NULL; /* Attribute info */ unsigned char flags; /* Flags for encoding attribute info */ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 6d5d736..b2d38da 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -674,6 +674,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_mesg_t *curr_msg; /* Pointer to current message to operate on */ size_t cont_size; /*continuation message size */ + size_t multi_size = 0; /* Size of all the messages in the last chunk */ int found_null = (-1); /* Best fit null message */ alloc_info found_attr = {-1, 0, 0, 0, 0}; /* Best fit attribute message */ alloc_info found_other = {-1, 0, 0, 0, 0}; /* Best fit other message */ @@ -769,11 +770,15 @@ H5O_alloc_new_chunk(H5F_t *f, found_other.null_msgno = null_msgno; } /* end if */ } /* end else */ - } /* end if */ + } else if(found_null < 0 && found_attr.msgno < 0 && found_other.msgno < 0 && msg_chunkno == oh->nchunks - 1) + /* Keep track of the total size of smaller messages in the last + * chunk, in case we need to move more than 1 message. + */ + multi_size += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); } /* end else */ } /* end for */ - if(found_null < 0 && found_attr.msgno < 0 && found_other.msgno < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "unable to locate message to move") + if(found_null >= 0 || found_attr.msgno >= 0 || found_other.msgno >= 0) + multi_size = 0; /* * If we must move some other message to make room for the null @@ -782,14 +787,20 @@ H5O_alloc_new_chunk(H5F_t *f, * * Move other messages first, and attributes only as a last resort. * + * If all else fails, move every message in the last chunk. + * */ - if(found_null < 0) { - if(found_other.msgno < 0) - found_other = found_attr; + if(multi_size == 0) { + if(found_null < 0) { + if(found_other.msgno < 0) + found_other = found_attr; - HDassert(found_other.msgno >= 0); - size += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size; + HDassert(found_other.msgno >= 0); + size += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size; + } /* end if */ } /* end if */ + else + size += multi_size; /* * The total chunk size must include the requested space plus enough @@ -848,10 +859,58 @@ H5O_alloc_new_chunk(H5F_t *f, if(H5O_alloc_msgs(oh, (size_t)3) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "can't allocate more space for messages") - /* Move message (that will be replaced with continuation message) - * to new chunk, if necessary. - */ - if(found_null < 0) { + if(multi_size > 0) { + /* Move all non-null messages in the last chunk to the new chunk. This + * should be extremely rare so we don't care too much about minimizing + * the space used */ + H5O_mesg_t *null_msg; /* Pointer to new null message */ + + /* Copy each message to the new location */ + for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) + if(curr_msg->chunkno == chunkno - 1) { + if(curr_msg->type->id == H5O_NULL_ID) { + /* Delete the null message */ + if(u < oh->nmesgs - 1) + HDmemmove(curr_msg, curr_msg + 1, ((oh->nmesgs - 1) - u) * sizeof(H5O_mesg_t)); + oh->nmesgs--; + } else { + /* Copy the raw data */ + HDmemcpy(p, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), + curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh)); + + /* Update the message info */ + curr_msg->chunkno = chunkno; + curr_msg->raw = p + H5O_SIZEOF_MSGHDR_OH(oh); + + /* Account for copied message in new chunk */ + p += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size; + size -= H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size; + } /* end else */ + } /* end if */ + + /* Create a null message spanning the entire last chunk */ + found_null = oh->nmesgs++; + null_msg = &(oh->mesg[found_null]); + null_msg->type = H5O_MSG_NULL; + null_msg->dirty = TRUE; + null_msg->native = NULL; + null_msg->raw = oh->chunk[chunkno-1].image + + ((chunkno == 1) ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)) + - H5O_SIZEOF_CHKSUM_OH(oh) + H5O_SIZEOF_MSGHDR_OH(oh); + null_msg->raw_size = oh->chunk[chunkno-1].size + - ((chunkno == 1) ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)) + - H5O_SIZEOF_MSGHDR_OH(oh); + null_msg->chunkno = chunkno - 1; + + HDassert(null_msg->raw_size >= cont_size); + + /* Remove any gap in the chunk */ + oh->chunk[chunkno-1].gap = 0; + + } else if(found_null < 0) { + /* Move message (that will be replaced with continuation message) + * to new chunk, if necessary. + */ H5O_mesg_t *null_msg; /* Pointer to new null message */ /* Create null message for space that message to copy currently occupies */ @@ -1788,9 +1847,10 @@ H5O_alloc_shrink_chunk(H5F_t *f, uint8_t *old_image = chunk->image; /* Old address of chunk's image in memory */ size_t old_size = chunk->size; /* Old size of chunk */ size_t new_size = chunk->size - chunk->gap; /* Size of shrunk chunk */ + size_t total_msg_size; /* Size of the messages in this chunk */ + size_t min_chunk_size = H5O_ALIGN_OH(oh, H5O_MIN_SIZE); /* Minimum chunk size */ size_t sizeof_chksum = H5O_SIZEOF_CHKSUM_OH(oh); /* Size of chunk checksum */ size_t sizeof_msghdr = H5O_SIZEOF_MSGHDR_OH(oh); /* Size of message header */ - size_t sizeof_chkhdr = H5O_SIZEOF_CHKHDR_OH(oh); /* Size of chunk header */ uint8_t new_size_flags = 0; /* New chunk #0 size flags */ hbool_t adjust_size_flags = FALSE; /* Whether to adjust the chunk #0 size flags */ size_t less_prfx_size = 0; /* Bytes removed from object header prefix */ @@ -1808,61 +1868,67 @@ H5O_alloc_shrink_chunk(H5F_t *f, */ for (u = oh->nmesgs - 1, curr_msg = &oh->mesg[u]; u < oh->nmesgs; u--, curr_msg--) { if ((H5O_NULL_ID == curr_msg->type->id) && (chunkno == curr_msg->chunkno)) { - /* Check if the message is the only one in the chunk */ - if (chunkno > 0 && (sizeof_msghdr + curr_msg->raw_size) == (new_size - sizeof_chkhdr)) { - /* Shrink the message to the minimum size */ - new_size -= curr_msg->raw_size; - curr_msg->raw_size = 0; - curr_msg->dirty = TRUE; - HDassert(new_size == sizeof_msghdr + sizeof_chkhdr); - - /* There are no more messages in this chunk, so we can exit the loop */ - break; - } /* end if */ - else { - /* Remove the message entirely */ - size_t shrink_size = curr_msg->raw_size + sizeof_msghdr; /* Amount to shrink the chunk by */ - /* If the current message is not at the end of the chunk, copy the - * data after it (except the checksum). - */ - if (curr_msg->raw + curr_msg->raw_size - < old_image + new_size - sizeof_chksum) { - unsigned v; /* Index */ - H5O_mesg_t *curr_msg2; - uint8_t *src = curr_msg->raw + curr_msg->raw_size; /* Source location */ - - /* Slide down the raw data */ - HDmemmove(curr_msg->raw - sizeof_msghdr, src, - (size_t)(old_image + new_size - sizeof_chksum - src)); - - /* Update the raw data pointers for messages after this one */ - for (v = 0, curr_msg2 = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg2++) - if ((chunkno == curr_msg2->chunkno) && (curr_msg2->raw > curr_msg->raw)) - curr_msg2->raw -= shrink_size; - } /* end if */ + size_t shrink_size = curr_msg->raw_size + sizeof_msghdr; /* Amount to shrink the chunk by */ + + /* If the current message is not at the end of the chunk, copy the + * data after it (except the checksum). + */ + if (curr_msg->raw + curr_msg->raw_size + < old_image + new_size - sizeof_chksum) { + unsigned v; /* Index */ + H5O_mesg_t *curr_msg2; + uint8_t *src = curr_msg->raw + curr_msg->raw_size; /* Source location */ + + /* Slide down the raw data */ + HDmemmove(curr_msg->raw - sizeof_msghdr, src, + (size_t)(old_image + new_size - sizeof_chksum - src)); + + /* Update the raw data pointers for messages after this one */ + for (v = 0, curr_msg2 = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg2++) + if ((chunkno == curr_msg2->chunkno) && (curr_msg2->raw > curr_msg->raw)) + curr_msg2->raw -= shrink_size; + } /* end if */ - /* Adjust the new chunk size */ - new_size -= shrink_size; + /* Adjust the new chunk size */ + new_size -= shrink_size; - /* Release any information/memory for the message */ - H5O_msg_free_mesg(curr_msg); + /* Release any information/memory for the message */ + H5O_msg_free_mesg(curr_msg); - /* Remove the deleted null message from list of messages */ - if (u < (oh->nmesgs - 1)) - HDmemmove(&oh->mesg[u], &oh->mesg[u+1], ((oh->nmesgs - 1) - u) * sizeof(H5O_mesg_t)); + /* Remove the deleted null message from list of messages */ + if (u < (oh->nmesgs - 1)) + HDmemmove(&oh->mesg[u], &oh->mesg[u+1], ((oh->nmesgs - 1) - u) * sizeof(H5O_mesg_t)); - /* Decrement # of messages */ - /* (Don't bother reducing size of message array for now) */ - oh->nmesgs--; - } /* end else */ + /* Decrement # of messages */ + /* (Don't bother reducing size of message array for now) */ + oh->nmesgs--; } /* end if */ } /* end for */ + /* Check if the chunk is too small, extend if necessary */ + total_msg_size = new_size - (chunkno == 0 ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)); + if(total_msg_size < min_chunk_size) { + HDassert(oh->alloc_nmesgs > oh->nmesgs); + oh->nmesgs++; + + /* Initialize new null message to make the chunk large enough */ + oh->mesg[oh->nmesgs].type = H5O_MSG_NULL; + oh->mesg[oh->nmesgs].dirty = TRUE; + oh->mesg[oh->nmesgs].native = NULL; + oh->mesg[oh->nmesgs].raw = old_image + new_size + sizeof_msghdr - sizeof_chksum; + oh->mesg[oh->nmesgs].raw_size = MAX(H5O_ALIGN_OH(oh, min_chunk_size - total_msg_size), + sizeof_msghdr) - sizeof_msghdr; + oh->mesg[oh->nmesgs].chunkno = chunkno; + + /* update the new chunk size */ + new_size += oh->mesg[oh->nmesgs].raw_size + sizeof_msghdr; + } + /* Check for changing the chunk #0 data size enough to need adjusting the flags */ if(oh->version > H5O_VERSION_1 && chunkno == 0) { uint64_t chunk0_newsize = new_size - H5O_SIZEOF_HDR(oh); /* New size of chunk 0's data */ size_t orig_prfx_size = 1 << (oh->flags & H5O_HDR_CHUNK0_SIZE); /* Original prefix size */ - + /* Check for moving to a 1-byte size encoding */ if (orig_prfx_size > 1 && chunk0_newsize <= 255) { less_prfx_size = orig_prfx_size - 1; @@ -1926,6 +1992,8 @@ H5O_alloc_shrink_chunk(H5F_t *f, } /* end if */ } /* end for */ + HDassert(new_size <= old_size); + /* Free the unused space in the file */ if (H5MF_xfree(f, H5FD_MEM_OHDR, dxpl_id, chunk->addr + new_size, (hsize_t)(old_size - new_size)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to shrink object header chunk") @@ -1933,3 +2001,4 @@ H5O_alloc_shrink_chunk(H5F_t *f, done: FUNC_LEAVE_NOAPI(ret_value) } /* H5O_alloc_shrink_chunk() */ + diff --git a/src/H5Oattr.c b/src/H5Oattr.c index b875d02..27b9d5e 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -27,8 +27,8 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static void *H5O_attr_copy(const void *_mesg, void *_dest); static size_t H5O_attr_size(const H5F_t *f, const void *_mesg); static herr_t H5O_attr_free(void *mesg); @@ -121,7 +121,7 @@ H5FL_EXTERN(H5S_extent_t); function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, +H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned UNUSED mesg_flags, unsigned *ioflags, const uint8_t *p) { H5A_t *attr = NULL; @@ -182,7 +182,8 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, p += name_len; /* advance the memory pointer */ /* Decode the attribute's datatype */ - if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p))) + if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, open_oh, + ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p))) HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype") if(attr->shared->version < H5O_ATTR_VERSION_2) p += H5O_ALIGN_OLD(attr->shared->dt_size); @@ -196,7 +197,8 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Decode attribute's dataspace extent */ - if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL) + if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, open_oh, + ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL) HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace") /* Copy the extent information to the dataspace */ @@ -810,7 +812,7 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in mesg->obj_opened); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object:", - mesg->shared->oloc.addr); + mesg->oloc.addr); /* Check for attribute creation order index on the attribute */ if(mesg->shared->crt_idx != H5O_MAX_CRT_ORDER_IDX) diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index ea9a7f5..81c2d3b 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -239,15 +239,16 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) /* Check if this object already has attribute information */ if(oh->version > H5O_VERSION_1) { - hbool_t new_ainfo = FALSE; /* Flag to indicate that the attribute information is new */ - - if(NULL == H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) { - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + hbool_t new_ainfo = FALSE; /* Flag to indicate that the attribute information is new */ + htri_t ainfo_exists; /* Whether the attribute info was retrieved */ + /* Check for (& retrieve if available) attribute info */ + if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + if(!ainfo_exists) { /* Initialize attribute information */ - ainfo.track_corder = (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? TRUE : FALSE; - ainfo.index_corder = (oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? TRUE : FALSE; + ainfo.track_corder = (hbool_t)((oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? TRUE : FALSE); + ainfo.index_corder = (hbool_t)((oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? TRUE : FALSE); ainfo.max_crt_idx = 0; ainfo.corder_bt2_addr = HADDR_UNDEF; ainfo.nattrs = 0; @@ -491,22 +492,29 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't check for attribute info message") + } /* end if */ /* If found the attribute is already opened, make a copy of it to share the - object information. If not, open attribute as a new object */ + * object information. If not, open attribute as a new object + */ if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") else if(found_open_attr == TRUE) { if(NULL == (ret_value = H5A_copy(NULL, exist_attr))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute") - } else { - if(H5F_addr_defined(ainfo.fheap_addr)) { /* open attribute with dense storage */ + } /* end else if */ + else { + /* Check for attributes in dense storage */ + if(H5F_addr_defined(ainfo.fheap_addr)) { + /* Open attribute with dense storage */ if(NULL == (ret_value = H5A_dense_open(loc->file, dxpl_id, &ainfo, name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") - } else { + } /* end if */ + else { H5O_iter_opn_t udata; /* User data for callback */ H5O_mesg_operator_t op; /* Wrapper for operator */ @@ -528,7 +536,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) HDassert(udata.attr); ret_value = udata.attr; } /* end else */ - } + } /* end else */ done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) @@ -595,12 +603,11 @@ H5A_t * H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t dxpl_id) { + H5O_t *oh = NULL; /* Object header */ H5A_attr_iter_op_t attr_op; /* Attribute operator */ H5A_t *exist_attr = NULL; /* Opened attribute object */ htri_t found_open_attr = FALSE; /* Whether opened object is found */ H5A_t *ret_value = NULL; /* Return value */ - H5O_t *oh = NULL; /* Object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_open_by_idx) @@ -615,38 +622,30 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, if(H5O_attr_iterate_real((hid_t)-1, loc, dxpl_id, idx_type, order, n, NULL, &attr_op, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, NULL, "can't locate attribute") - /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unable to load object header") - /* Check for attribute info stored */ - ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); - /* Find out whether it has already been opened. If it has, close the object - * and make a copy of the already opened object to share the object info. */ + * and make a copy of the already opened object to share the object info. + */ if(ret_value) { - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, - ret_value->shared->name)) < 0) + if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, ret_value->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") /* If found that the attribute is already opened, make a copy of it - and close the object just opened. */ + * and close the object just opened. + */ if(found_open_attr && exist_attr) { if(H5A_close(ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute") - if(NULL == (ret_value = H5A_copy(NULL, exist_attr))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute") - } - } + } /* end if */ + } /* end if */ done: - if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, - H5AC__NO_FLAGS_SET) < 0) + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_ATTR, H5E_PROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -668,14 +667,13 @@ done: * *------------------------------------------------------------------------- */ -static -htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) +static htri_t +H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) { - htri_t ret_value = FALSE; - int num_open_attr = 0; - hid_t *attr_id_list = NULL; - unsigned long loc_fnum, attr_fnum; - int i; + hid_t *attr_id_list = NULL; /* List of IDs for opened attributes */ + unsigned long loc_fnum; /* File serial # for object */ + size_t num_open_attr; /* Number of opened attributes */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_find_opened_attr) @@ -684,39 +682,48 @@ htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "can't get file serial number") /* Count all opened attributes */ - if((num_open_attr = H5F_get_obj_count(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, FALSE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get number of opened attributes") + num_open_attr = H5F_get_obj_count(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, FALSE); /* Find out whether the attribute has been opened */ if(num_open_attr) { - attr_id_list = (hid_t*)H5MM_malloc(num_open_attr*sizeof(hid_t)); + size_t u; /* Local index variable */ + + /* Allocate space for the attribute ID list */ + if(NULL == (attr_id_list = (hid_t *)H5MM_malloc(num_open_attr * sizeof(hid_t)))) + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "unable to allocate memory for attribute ID list") /* Retrieve the IDs of all opened attributes */ - if(H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't IDs of opened attributes") + H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE); + + /* Iterate over the attributes */ + for(u = 0; u < num_open_attr; u++) { + unsigned long attr_fnum; /* Attributes file serial number */ - for(i=0; i<num_open_attr; i++) { - if(NULL == (*attr = (H5A_t *)H5I_object_verify(attr_id_list[i], H5I_ATTR))) + /* Get pointer to attribute */ + if(NULL == (*attr = (H5A_t *)H5I_object_verify(attr_id_list[u], H5I_ATTR))) HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "not an attribute") /* Get file serial number for attribute */ - if(H5F_get_fileno((*attr)->shared->oloc.file, &attr_fnum) < 0) + if(H5F_get_fileno((*attr)->oloc.file, &attr_fnum) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "can't get file serial number") - /* Verify whether it's the right object. The attribute name, object address - * to which the attribute is attached, and file serial number should all - * match. */ - if(!strcmp(name_to_open, (*attr)->shared->name) && - loc->addr == (*attr)->shared->oloc.addr && - loc_fnum == attr_fnum) { + /* Verify whether it's the right object. The attribute name, object + * address to which the attribute is attached, and file serial + * number should all match. + */ + if(!HDstrcmp(name_to_open, (*attr)->shared->name) && + loc->addr == (*attr)->oloc.addr && + loc_fnum == attr_fnum) { ret_value = TRUE; break; - } - } - H5MM_free(attr_id_list); - } + } /* end if */ + } /* end for */ + } /* end if */ done: + if(attr_id_list) + H5MM_free(attr_id_list); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_find_opened_attr */ @@ -886,9 +893,11 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { @@ -1118,9 +1127,11 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { @@ -1206,15 +1217,16 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, HDassert(attr_op); /* Protect the object header to iterate over */ - if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, - NULL, NULL, H5AC_READ))) + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { @@ -1228,8 +1240,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, oh = NULL; /* Iterate over attributes in dense storage */ - if((ret_value = H5A_dense_iterate(loc->file, dxpl_id, loc_id, &ainfo, - idx_type, order, skip, last_attr, attr_op, op_data)) < 0) + if((ret_value = H5A_dense_iterate(loc->file, dxpl_id, loc_id, &ainfo, idx_type, order, skip, last_attr, attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); } /* end if */ else { @@ -1491,7 +1502,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_ainfo_t *ainfo_ptr = NULL; /* Pointer to attribute information for object */ + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1507,9 +1518,11 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == (ainfo_ptr = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo))) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { @@ -1539,7 +1552,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) } /* end else */ /* Update the attribute information after removing an attribute */ - if(ainfo_ptr) + if(ainfo_exists) if(H5O_attr_remove_update(loc, oh, &ainfo, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") @@ -1577,7 +1590,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, { H5O_t *oh = NULL; /* Pointer to actual object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_ainfo_t *ainfo_ptr = NULL; /* Pointer to attribute information for object */ + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */ H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1593,9 +1606,11 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == (ainfo_ptr = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo))) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { @@ -1633,7 +1648,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, } /* end else */ /* Update the attribute information after removing an attribute */ - if(ainfo_ptr) + if(ainfo_exists) if(H5O_attr_remove_update(loc, oh, &ainfo, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") @@ -1666,40 +1681,44 @@ done: * *------------------------------------------------------------------------- */ -hsize_t -H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh) +herr_t +H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs) { - hsize_t ret_value; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_count_real) + FUNC_ENTER_NOAPI_NOINIT(H5O_attr_count_real) /* Check arguments */ HDassert(f); HDassert(oh); + HDassert(nattrs); /* Check for attributes stored densely */ if(oh->version > H5O_VERSION_1) { + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ H5O_ainfo_t ainfo; /* Attribute information for object */ /* Attempt to get the attribute information from the object header */ - if(H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) - ret_value = ainfo.nattrs; - else { - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); - - ret_value = 0; - } /* end else */ + if((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + else if(ainfo_exists > 0) + *nattrs = ainfo.nattrs; + else + *nattrs = 0; } /* end if */ else { + hsize_t attr_count; /* Number of attributes found */ unsigned u; /* Local index variable */ /* Loop over all messages, counting the attributes */ - for(u = ret_value = 0; u < oh->nmesgs; u++) + attr_count = 0; + for(u = 0; u < oh->nmesgs; u++) if(oh->mesg[u].type == H5O_MSG_ATTR) - ret_value++; + attr_count++; + *nattrs = attr_count; } /* end else */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_count_real */ @@ -1775,9 +1794,11 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Check for attributes stored densely */ if(H5F_addr_defined(ainfo.fheap_addr)) { @@ -1802,7 +1823,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute") /* Check that we found the attribute */ - ret_value = udata.found; + ret_value = (htri_t)udata.found; } /* end else */ done: @@ -1840,12 +1861,12 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) /* Attributes are only stored in fractal heap & indexed w/v2 B-tree in later versions */ if(oh->version > H5O_VERSION_1) { H5O_ainfo_t ainfo; /* Attribute information for object */ + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ - /* Check for attribute info stored */ - if(NULL == H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); - else { + /* Check for (& retrieve if available) attribute info */ + if((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + else if(ainfo_exists > 0) { /* Get storage size of creation order index, if it's used */ if(H5F_addr_defined(ainfo.corder_bt2_addr)) if(H5B2_iterate_size(f, dxpl_id, H5A_BT2_CORDER, ainfo.corder_bt2_addr, &(bh_info->index_size)) < 0) @@ -1899,8 +1920,9 @@ done: int H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - int ret_value; /* Return value */ + H5O_t *oh = NULL; /* Pointer to actual object header */ + hsize_t nattrs; /* Number of attributes */ + int ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_count) @@ -1912,7 +1934,11 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Retrieve # of attributes on object */ - ret_value = (int)H5O_attr_count_real(loc->file, dxpl_id, oh); + if(H5O_attr_count_real(loc->file, dxpl_id, oh, &nattrs) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count") + + /* Set return value */ + ret_value = (int)nattrs; done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5Obogus.c b/src/H5Obogus.c index c257ca4..cee3199 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -38,8 +38,8 @@ #ifdef H5O_ENABLE_BOGUS /* PRIVATE PROTOTYPES */ -static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static size_t H5O_bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, @@ -87,8 +87,8 @@ const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_bogus_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_bogus_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_bogus_t *mesg = NULL; void *ret_value; /* Return value */ diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 36e4c1a..99e6bdd 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -28,8 +28,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void *H5O_btreek_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_btreek_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_btreek_copy(const void *_mesg, void *_dest); static size_t H5O_btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -79,8 +79,8 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_btreek_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_btreek_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_btreek_t *mesg; /* Native message */ void *ret_value; /* Return value */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index db093a4..551eca8 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -536,7 +536,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, unsigned ioflags = 0; /* Flags for decode routine */ /* Decode continuation message */ - cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(f, dxpl_id, 0, &ioflags, oh->mesg[curmesg].raw); + cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(f, dxpl_id, NULL, 0, &ioflags, oh->mesg[curmesg].raw); cont->chunkno = oh->nchunks; /*the next chunk to allocate */ /* Save 'native' form of continuation message */ @@ -559,7 +559,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, /* Decode ref. count message */ HDassert(oh->version > H5O_VERSION_1); - refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(f, dxpl_id, 0, &ioflags, oh->mesg[curmesg].raw); + refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(f, dxpl_id, NULL, 0, &ioflags, oh->mesg[curmesg].raw); /* Save 'native' form of ref. count message */ oh->mesg[curmesg].native = refcount; diff --git a/src/H5Ocont.c b/src/H5Ocont.c index b3f178d..df336dd 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -37,8 +37,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O_cont_free(void *mesg); @@ -90,8 +90,8 @@ H5FL_DEFINE(H5O_cont_t); *------------------------------------------------------------------------- */ static void * -H5O_cont_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_cont_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_cont_t *cont = NULL; void *ret_value; diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 5334539..7b76f3d 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -1035,7 +1035,7 @@ H5O_copy_obj_by_ref(H5O_loc_t *src_oloc, hid_t dxpl_id, H5O_loc_t *dst_oloc, new_oloc.addr = dst_oloc->addr; /* Pick a default name for the new object */ - sprintf(tmp_obj_name, "~obj_pointed_by_%llu", (unsigned long_long)dst_oloc->addr); + sprintf(tmp_obj_name, "~obj_pointed_by_%llu", (unsigned long long)dst_oloc->addr); /* Create a link to the newly copied object */ if(H5L_link(dst_root_loc, tmp_obj_name, &new_loc, H5P_DEFAULT, H5P_DEFAULT, dxpl_id) < 0) diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 9aafe41..864fe9e 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -28,8 +28,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void *H5O_drvinfo_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_drvinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_drvinfo_copy(const void *_mesg, void *_dest); static size_t H5O_drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -80,8 +80,8 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_drvinfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_drvinfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_drvinfo_t *mesg; /* Native message */ void *ret_value; /* Return value */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 71692c1..24e443c 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -29,8 +29,8 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static void *H5O_dtype_copy(const void *_mesg, void *_dest); static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg); static herr_t H5O_dtype_reset(void *_mesg); @@ -990,7 +990,7 @@ done: function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_dtype_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, +H5O_dtype_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, unsigned UNUSED mesg_flags, unsigned *ioflags/*in,out*/, const uint8_t *p) { H5T_t *dt = NULL; diff --git a/src/H5Oefl.c b/src/H5Oefl.c index ee51e1c..5702b34 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -29,8 +29,8 @@ #include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ -static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_efl_copy(const void *_mesg, void *_dest); static size_t H5O_efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -84,8 +84,8 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_efl_t *mesg = NULL; int version; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 02706ec..d5345aa 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -33,12 +33,12 @@ #include "H5Sprivate.h" /* Dataspaces */ -static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_fill_old_size(const H5F_t *f, const void *_mesg); -static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg); static void *H5O_fill_copy(const void *_mesg, void *_dest); @@ -182,8 +182,8 @@ H5FL_BLK_EXTERN(type_conv); *------------------------------------------------------------------------- */ static void * -H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_fill_t *fill = NULL; void *ret_value; @@ -296,8 +296,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_fill_old_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_fill_old_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_fill_t *fill = NULL; /* Decoded fill value message */ void *ret_value; /* Return value */ diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 2323fff..83a6085 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_ginfo_copy(const void *_mesg, void *_dest); static size_t H5O_ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -95,8 +95,8 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t); *------------------------------------------------------------------------- */ static void * -H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */ unsigned char flags; /* Flags for encoding group info */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 1975173..50a6094 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -34,8 +34,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_layout_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_layout_copy(const void *_mesg, void *_dest); static size_t H5O_layout_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -94,8 +94,8 @@ H5FL_DEFINE(H5O_layout_t); *------------------------------------------------------------------------- */ static void * -H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_layout_t *mesg = NULL; unsigned u; diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index d1eb2c0..5ba237a 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -35,8 +35,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_linfo_copy(const void *_mesg, void *_dest); static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -111,8 +111,8 @@ H5FL_DEFINE_STATIC(H5O_linfo_t); *------------------------------------------------------------------------- */ static void * -H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_linfo_t *linfo = NULL; /* Link info */ unsigned char index_flags; /* Flags for encoding link index info */ diff --git a/src/H5Olink.c b/src/H5Olink.c index a4449f0..96d4747 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -38,8 +38,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_link_copy(const void *_mesg, void *_dest); static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -116,8 +116,8 @@ H5FL_DEFINE_STATIC(H5O_link_t); *------------------------------------------------------------------------- */ static void * -H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_link_t *lnk = NULL; /* Pointer to link message */ size_t len = 0; /* Length of a string in the message */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index a63299a..286240c 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1804,10 +1804,16 @@ done: * slu@ncsa.uiuc.edu * July 14, 2004 * + * Modifications: Neil Fortner + * Feb 4 2009 + * Added open_oh parameter. This parameter is optional and + * contains this message's protected object header + * *------------------------------------------------------------------------- */ void * -H5O_msg_decode(H5F_t *f, hid_t dxpl_id, unsigned type_id, const unsigned char *buf) +H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, + const unsigned char *buf) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ void *ret_value; /* Return value */ @@ -1822,7 +1828,7 @@ H5O_msg_decode(H5F_t *f, hid_t dxpl_id, unsigned type_id, const unsigned char *b HDassert(type); /* decode */ - if((ret_value = (type->decode)(f, dxpl_id, 0, &ioflags, buf)) == NULL) + if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf)) == NULL) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message") done: diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 46272a0..1bbcfe3 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -28,13 +28,13 @@ #include "H5Opkg.h" /* Object headers */ -static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static size_t H5O_mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); -static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_mtime_copy(const void *_mesg, void *_dest); static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -119,8 +119,8 @@ H5FL_DEFINE(time_t); *------------------------------------------------------------------------- */ static void * -H5O_mtime_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_mtime_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { time_t *mesg; uint32_t tmp_time; /* Temporary copy of the time */ @@ -172,8 +172,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { time_t *mesg, the_time; int i; diff --git a/src/H5Oname.c b/src/H5Oname.c index 915546b..5ffa870 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_name_copy(const void *_mesg, void *_dest); static size_t H5O_name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -84,8 +84,8 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_name_t *mesg; void *ret_value; /* Return value */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index fa69b93..9981461 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -187,7 +187,7 @@ \ /* Decode the message */ \ HDassert(msg_type->decode); \ - if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (MSG)->flags, &ioflags, (MSG)->raw))) \ + if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw))) \ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \ \ /* Mark the message dirty if it was changed by decoding */ \ @@ -222,7 +222,7 @@ struct H5O_msg_class_t { const char *name; /*for debugging */ size_t native_size; /*size of native message */ unsigned share_flags; /* Message sharing settings */ - void *(*decode)(H5F_t*, hid_t, unsigned, unsigned *, const uint8_t *); + void *(*decode)(H5F_t*, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *); herr_t (*encode)(H5F_t*, hbool_t, uint8_t*, const void *); void *(*copy)(const void *, void *); /*copy native value */ size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */ @@ -515,8 +515,8 @@ H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link); /* Shared object operators */ -H5_DLL void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, - const uint8_t *buf, const H5O_msg_class_t *type); +H5_DLL void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type); H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); H5_DLL herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, @@ -534,6 +534,9 @@ H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, H5_DLL herr_t H5O_attr_reset(void *_mesg); H5_DLL herr_t H5O_attr_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg); H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg); +H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, + hsize_t *nattrs); + /* These functions operate on object locations */ H5_DLL H5O_loc_t *H5O_get_loc(hid_t id); diff --git a/src/H5Opline.c b/src/H5Opline.c index fed2861..20a9d26 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_pline_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_pline_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_pline_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static void *H5O_pline_copy(const void *_mesg, void *_dest); static size_t H5O_pline_size(const H5F_t *f, const void *_mesg); static herr_t H5O_pline_reset(void *_mesg); @@ -107,8 +107,8 @@ H5FL_DEFINE(H5O_pline_t); *------------------------------------------------------------------------- */ static void * -H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_pline_t *pline = NULL; /* Pipeline message */ H5Z_filter_info_t *filter; /* Filter to decode */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 80a924f..c623b73 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -584,6 +584,7 @@ H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5_DLL herr_t H5O_open(H5O_loc_t *loc); H5_DLL herr_t H5O_close(H5O_loc_t *loc); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id); +H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags); H5_DLL H5O_t *H5O_protect(H5O_loc_t *loc, hid_t dxpl_id); H5_DLL herr_t H5O_unprotect(H5O_loc_t *loc, H5O_t *oh); H5_DLL herr_t H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id); @@ -644,8 +645,8 @@ H5_DLL herr_t H5O_msg_get_crt_index(unsigned type_id, const void *mesg, H5O_msg_crt_idx_t *crt_idx); H5_DLL herr_t H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared, unsigned char *buf, const void *obj); -H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, unsigned type_id, - const unsigned char *buf); +H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned type_id, const unsigned char *buf); H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, void *mesg); @@ -687,8 +688,5 @@ H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, /* Shared message operators */ H5_DLL herr_t H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src); -/* Attribute operators */ -H5_DLL hsize_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh); - #endif /* _H5Oprivate_H */ diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index b2f02b2..2f00e86 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_refcount_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_refcount_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_refcount_copy(const void *_mesg, void *_dest); static size_t H5O_refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -90,8 +90,8 @@ H5FL_DEFINE_STATIC(H5O_refcount_t); *------------------------------------------------------------------------- */ static void * -H5O_refcount_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_refcount_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_refcount_t *refcount = NULL; /* Reference count */ void *ret_value; /* Return value */ diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index fe7bf02..23af101 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -26,8 +26,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_sdspace_copy(const void *_mesg, void *_dest); static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg); @@ -109,8 +109,8 @@ H5FL_ARR_EXTERN(hsize_t); within this function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5S_extent_t *sdim = NULL;/* New extent dimensionality structure */ void *ret_value; diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 062443a..fd7cc8b 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -107,7 +107,7 @@ *------------------------------------------------------------------------- */ static void * -H5O_shared_read(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, +H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t *shared, const H5O_msg_class_t *type) { H5HF_t *fheap = NULL; @@ -159,7 +159,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap.") /* Decode the message */ - if(NULL == (ret_value = (type->decode)(f, dxpl_id, 0, ioflags, mesg_ptr))) + if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_ptr))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.") } /* end if */ else { @@ -167,12 +167,22 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, HDassert(shared->type == H5O_SHARE_TYPE_COMMITTED); - /* Get the shared message from an object header */ + /* Build the object location for the shared message's object header */ oloc.file = f; oloc.addr = shared->u.loc.oh_addr; oloc.holding_file = FALSE; - if(NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL, dxpl_id))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") + + if(open_oh && oloc.addr == H5O_OH_GET_ADDR(open_oh)) { + /* The shared message is in the already opened object header. This + * is possible, for example, if an attribute's datatype is shared in + * the same object header the attribute is in. Read the message + * directly. */ + if(NULL == (ret_value = H5O_msg_read_oh(f, dxpl_id, open_oh, type->id, NULL))) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") + } else + /* The shared message is in another object header */ + if(NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL, dxpl_id))) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") } /* end else */ /* Mark the message as shared */ @@ -228,7 +238,7 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_loc_t oloc; /* Location for object header where message is stored */ /* - * The shared message is stored in some other object header. + * The shared message is stored in some object header. * The other object header must be in the same file as the * new object header. Adjust the reference count on that * object header. @@ -236,13 +246,26 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, if(shared->file->shared != f->shared) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "interfile hard links are not allowed") - /* Get the shared message from an object header */ + /* Build the object location for the shared message's object header */ oloc.file = f; oloc.addr = shared->u.loc.oh_addr; oloc.holding_file = FALSE; - if(H5O_link(&oloc, adjust, dxpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + if(open_oh && oloc.addr == H5O_OH_GET_ADDR(open_oh)) { + /* The shared message is in the already opened object header. This + * is possible, for example, if an attribute's datatype is shared in + * the same object header the attribute is in. Adjust the link + * count directly. */ + unsigned oh_flags = H5AC__NO_FLAGS_SET; /* This is used only to satisfy H5O_link_oh */ + + if(H5O_link_oh(f, adjust, dxpl_id, open_oh, &oh_flags) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + + HDassert(!(oh_flags & H5AC__DELETED_FLAG)); + } else + /* The shared message is in another object header */ + if(H5O_link(&oloc, adjust, dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") } /* end if */ else { HDassert(shared->type == H5O_SHARE_TYPE_SOHM || shared->type == H5O_SHARE_TYPE_HERE); @@ -277,7 +300,7 @@ done: *------------------------------------------------------------------------- */ void * -H5O_shared_decode(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, +H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type) { H5O_shared_t sh_mesg; /* Shared message info */ @@ -344,7 +367,7 @@ H5O_shared_decode(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, sh_mesg.msg_type_id = type->id; /* Retrieve actual message, through decoded shared message info */ - if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, ioflags, &sh_mesg, type))) + if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, open_oh, ioflags, &sh_mesg, type))) HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message") done: @@ -708,7 +731,7 @@ H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) "SOHM"); HDfprintf(stream, "%*s%-*s %016llx\n", indent, "", fwidth, "Heap ID:", - (unsigned long_long)mesg->u.heap_id); + (unsigned long long)mesg->u.heap_id); break; case H5O_SHARE_TYPE_HERE: diff --git a/src/H5Oshared.h b/src/H5Oshared.h index d52cd8f..c0f5cd6 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -48,7 +48,7 @@ *------------------------------------------------------------------------- */ static H5_inline void * -H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, +H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p) { void *ret_value; /* Return value */ @@ -68,7 +68,7 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, /* Check for shared message */ if(mesg_flags & H5O_MSG_FLAG_SHARED) { /* Retrieve native message info indirectly through shared message */ - if(NULL == (ret_value = H5O_shared_decode(f, dxpl_id, ioflags, p, H5O_SHARED_TYPE))) + if(NULL == (ret_value = H5O_shared_decode(f, dxpl_id, open_oh, ioflags, p, H5O_SHARED_TYPE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message") /* We currently do not support automatically fixing shared messages */ @@ -81,7 +81,7 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, } /* end if */ else { /* Decode native message directly */ - if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, mesg_flags, ioflags, p))) + if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, open_oh, mesg_flags, ioflags, p))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message") } /* end else */ diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index 74fe739..51c1c55 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -28,8 +28,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void *H5O_shmesg_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_shmesg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_shmesg_copy(const void *_mesg, void *_dest); static size_t H5O_shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -76,8 +76,8 @@ const H5O_msg_class_t H5O_MSG_SHMESG[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_shmesg_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_shmesg_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_shmesg_table_t *mesg; /* Native message */ void *ret_value; /* Return value */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 9524f43..a93a46d 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -36,8 +36,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_stab_copy(const void *_mesg, void *_dest); static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -96,8 +96,8 @@ H5FL_DEFINE_STATIC(H5O_stab_t); *------------------------------------------------------------------------- */ static void * -H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_stab_t *stab = NULL; void *ret_value; /* Return value */ diff --git a/src/H5Otest.c b/src/H5Otest.c index 8116ffa..c2b30fa 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -112,9 +112,11 @@ H5O_is_attr_dense_test(hid_t oid) /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Check if dense storage is being used */ if(H5F_addr_defined(ainfo.fheap_addr)) { @@ -157,7 +159,7 @@ H5O_is_attr_empty_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_ainfo_t *ainfo_ptr = NULL; /* Pointer to attribute information for object */ + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ H5O_loc_t *oloc; /* Pointer to object's location */ hsize_t nattrs; /* Number of attributes */ htri_t ret_value; /* Return value */ @@ -173,17 +175,18 @@ H5O_is_attr_empty_test(hid_t oid) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Check for attribute info stored */ - ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == (ainfo_ptr = H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo))) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if((ainfo_exists = H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Retrieve the number of attribute messages in header */ nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR); /* Check for later version of object header format & attribute info available */ if(oh->version > H5O_VERSION_1) { - if(ainfo_ptr) { + if(ainfo_exists) { /* Check for using dense storage */ if(H5F_addr_defined(ainfo.fheap_addr)) { /* Check for any messages in object header */ @@ -252,9 +255,11 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Retrieve the number of attribute messages in header */ obj_nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR); @@ -327,9 +332,11 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1 && NULL == H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo)) - /* Clear error stack from not finding attribute info */ - H5E_clear_stack(NULL); + if(oh->version > H5O_VERSION_1) { + /* Check for (& retrieve if available) attribute info */ + if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + } /* end if */ /* Check for 'dense' attribute storage file addresses being defined */ if(!H5F_addr_defined(ainfo.fheap_addr)) @@ -1565,7 +1565,7 @@ H5S_decode(const unsigned char *buf) /* Decode the extent part of dataspace */ /* (pass mostly bogus file pointer and bogus DXPL) */ - if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, H5O_SDSPACE_ID, buf))==NULL) + if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, buf))==NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object") buf += extent_size; @@ -1402,7 +1402,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg) * master table needs to be unprotected when we do this. */ if(mesg_buf) { - if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, type_id, (const unsigned char *)mesg_buf))) + if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, (const unsigned char *)mesg_buf))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode shared message.") if(H5O_msg_delete(f, dxpl_id, open_oh, type_id, native_mesg) < 0) @@ -1052,7 +1052,7 @@ H5T_init_interface(void) status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T_conv_ldouble_double, H5AC_dxpl_id, FALSE); #endif /*H5T_CONV_INTERNAL_FP_LDOUBLE*/ - /* from long_long */ + /* from long long */ status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T_conv_llong_ullong, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T_conv_ullong_llong, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T_conv_llong_long, H5AC_dxpl_id, FALSE); @@ -2920,7 +2920,7 @@ H5T_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype") /* Decode the serialized datatype message */ - if((ret_value = H5O_msg_decode(f, H5AC_dxpl_id, H5O_DTYPE_ID, buf)) == NULL) + if((ret_value = H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf)) == NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") done: @@ -2992,7 +2992,7 @@ H5T_create(H5T_class_t type, size_t size) subtype = H5T_NATIVE_INT_g; } else if (sizeof(long)==size) { subtype = H5T_NATIVE_LONG_g; - } else if (sizeof(long_long)==size) { + } else if (sizeof(long long)==size) { subtype = H5T_NATIVE_LLONG_g; } else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no applicable native integer type"); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 05277a8..90b7a21 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -241,7 +241,7 @@ #define H5T_CONV_sS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)<=sizeof(DT)); \ - H5T_CONV(H5T_CONV_xX, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_xX, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_sU_CORE(S,D,ST,DT,D_MIN,D_MAX) { \ @@ -266,7 +266,7 @@ #define H5T_CONV_sU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)<=sizeof(DT)); \ - H5T_CONV(H5T_CONV_sU, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_sU, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_uS_CORE(S,D,ST,DT,D_MIN,D_MAX) { \ @@ -291,17 +291,17 @@ #define H5T_CONV_uS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)<=sizeof(DT)); \ - H5T_CONV(H5T_CONV_uS, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_uS, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_uU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)<=sizeof(DT)); \ - H5T_CONV(H5T_CONV_xX, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_xX, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_Ss(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)>=sizeof(DT)); \ - H5T_CONV(H5T_CONV_Xx, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_Xx, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_Su_CORE(S,D,ST,DT,D_MIN,D_MAX) { \ @@ -337,17 +337,17 @@ #define H5T_CONV_Su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)>=sizeof(DT)); \ - H5T_CONV(H5T_CONV_Su, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_Su, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_Us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)>=sizeof(DT)); \ - H5T_CONV(H5T_CONV_Ux, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_Ux, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_Uu(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)>=sizeof(DT)); \ - H5T_CONV(H5T_CONV_Ux, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_Ux, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_su_CORE(S,D,ST,DT,D_MIN,D_MAX) { \ @@ -374,7 +374,7 @@ #define H5T_CONV_su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)==sizeof(DT)); \ - H5T_CONV(H5T_CONV_su, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_su, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_us_CORE(S,D,ST,DT,D_MIN,D_MAX) { \ @@ -401,7 +401,7 @@ #define H5T_CONV_us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)==sizeof(DT)); \ - H5T_CONV(H5T_CONV_us, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + H5T_CONV(H5T_CONV_us, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ } #define H5T_CONV_fF(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ @@ -5019,7 +5019,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_schar_llong * - * Purpose: Converts `signed char' to `long_long' + * Purpose: Converts `signed char' to `long long' * * Return: Success: Non-negative * @@ -5042,7 +5042,7 @@ H5T_conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_schar_llong, FAIL) - H5T_CONV_sS(SCHAR, LLONG, signed char, long_long, -, -); + H5T_CONV_sS(SCHAR, LLONG, signed char, long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5052,7 +5052,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_schar_ullong * - * Purpose: Converts `signed char' to `unsigned long_long' + * Purpose: Converts `signed char' to `unsigned long long' * * Return: Success: Non-negative * @@ -5075,7 +5075,7 @@ H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_schar_ullong, FAIL) - H5T_CONV_sU(SCHAR, ULLONG, signed char, unsigned long_long, -, -); + H5T_CONV_sU(SCHAR, ULLONG, signed char, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5085,7 +5085,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_uchar_llong * - * Purpose: Converts `unsigned char' to `long_long' + * Purpose: Converts `unsigned char' to `long long' * * Return: Success: Non-negative * @@ -5108,7 +5108,7 @@ H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_uchar_llong, FAIL) - H5T_CONV_uS(UCHAR, LLONG, unsigned char, long_long, -, LLONG_MAX); + H5T_CONV_uS(UCHAR, LLONG, unsigned char, long long, -, LLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5118,7 +5118,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_uchar_ullong * - * Purpose: Converts `unsigned char' to `unsigned long_long' + * Purpose: Converts `unsigned char' to `unsigned long long' * * Return: Success: Non-negative * @@ -5141,7 +5141,7 @@ H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_uchar_ullong, FAIL) - H5T_CONV_uU(UCHAR, ULLONG, unsigned char, unsigned long_long, -, -); + H5T_CONV_uU(UCHAR, ULLONG, unsigned char, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5613,7 +5613,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_short_llong * - * Purpose: Converts `short' to `long_long' + * Purpose: Converts `short' to `long long' * * Return: Success: Non-negative * @@ -5636,7 +5636,7 @@ H5T_conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_short_llong, FAIL) - H5T_CONV_sS(SHORT, LLONG, short, long_long, -, -); + H5T_CONV_sS(SHORT, LLONG, short, long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5646,7 +5646,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_short_ullong * - * Purpose: Converts `short' to `unsigned long_long' + * Purpose: Converts `short' to `unsigned long long' * * Return: Success: Non-negative * @@ -5669,7 +5669,7 @@ H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_short_ullong, FAIL) - H5T_CONV_sU(SHORT, ULLONG, short, unsigned long_long, -, -); + H5T_CONV_sU(SHORT, ULLONG, short, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5679,7 +5679,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ushort_llong * - * Purpose: Converts `unsigned short' to `long_long' + * Purpose: Converts `unsigned short' to `long long' * * Return: Success: Non-negative * @@ -5702,7 +5702,7 @@ H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ushort_llong, FAIL) - H5T_CONV_uS(USHORT, LLONG, unsigned short, long_long, -, LLONG_MAX); + H5T_CONV_uS(USHORT, LLONG, unsigned short, long long, -, LLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5712,7 +5712,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ushort_ullong * - * Purpose: Converts `unsigned short' to `unsigned long_long' + * Purpose: Converts `unsigned short' to `unsigned long long' * * Return: Success: Non-negative * @@ -5735,7 +5735,7 @@ H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ushort_ullong, FAIL) - H5T_CONV_uU(USHORT, ULLONG, unsigned short, unsigned long_long, -, -); + H5T_CONV_uU(USHORT, ULLONG, unsigned short, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6201,7 +6201,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_int_llong * - * Purpose: Converts `int' to `long_long' + * Purpose: Converts `int' to `long long' * * Return: Success: Non-negative * @@ -6223,7 +6223,7 @@ H5T_conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_int_llong, FAIL) - H5T_CONV_sS(INT, LLONG, int, long_long, -, -); + H5T_CONV_sS(INT, LLONG, int, long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6233,7 +6233,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_int_ullong * - * Purpose: Converts `int' to `unsigned long_long' + * Purpose: Converts `int' to `unsigned long long' * * Return: Success: Non-negative * @@ -6255,7 +6255,7 @@ H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_int_ullong, FAIL) - H5T_CONV_sU(INT, ULLONG, int, unsigned long_long, -, -); + H5T_CONV_sU(INT, ULLONG, int, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6265,7 +6265,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_uint_llong * - * Purpose: Converts `unsigned int' to `long_long' + * Purpose: Converts `unsigned int' to `long long' * * Return: Success: Non-negative * @@ -6287,7 +6287,7 @@ H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_uint_llong, FAIL) - H5T_CONV_uS(UINT, LLONG, unsigned, long_long, -, LLONG_MAX); + H5T_CONV_uS(UINT, LLONG, unsigned, long long, -, LLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6297,7 +6297,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_uint_ullong * - * Purpose: Converts `unsigned int' to `unsigned long_long' + * Purpose: Converts `unsigned int' to `unsigned long long' * * Return: Success: Non-negative * @@ -6320,7 +6320,7 @@ H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_uint_ullong, FAIL) - H5T_CONV_uU(UINT, ULLONG, unsigned, unsigned long_long, -, -); + H5T_CONV_uU(UINT, ULLONG, unsigned, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6782,7 +6782,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_long_llong * - * Purpose: Converts `long' to `long_long' + * Purpose: Converts `long' to `long long' * * Return: Success: Non-negative * @@ -6804,7 +6804,7 @@ H5T_conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_long_llong, FAIL) - H5T_CONV_sS(LONG, LLONG, long, long_long, -, -); + H5T_CONV_sS(LONG, LLONG, long, long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6814,7 +6814,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_long_ullong * - * Purpose: Converts `long' to `unsigned long_long' + * Purpose: Converts `long' to `unsigned long long' * * Return: Success: Non-negative * @@ -6837,7 +6837,7 @@ H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_long_ullong, FAIL) - H5T_CONV_sU(LONG, ULLONG, long, unsigned long_long, -, -); + H5T_CONV_sU(LONG, ULLONG, long, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6847,7 +6847,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ulong_llong * - * Purpose: Converts `unsigned long' to `long_long' + * Purpose: Converts `unsigned long' to `long long' * * Return: Success: Non-negative * @@ -6870,7 +6870,7 @@ H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ulong_llong, FAIL) - H5T_CONV_uS(ULONG, LLONG, unsigned long, long_long, -, LLONG_MAX); + H5T_CONV_uS(ULONG, LLONG, unsigned long, long long, -, LLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6880,7 +6880,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ulong_ullong * - * Purpose: Converts `unsigned long' to `unsigned long_long' + * Purpose: Converts `unsigned long' to `unsigned long long' * * Return: Success: Non-negative * @@ -6903,7 +6903,7 @@ H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ulong_ullong, FAIL) - H5T_CONV_uU(ULONG, ULLONG, unsigned long, unsigned long_long, -, -); + H5T_CONV_uU(ULONG, ULLONG, unsigned long, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6913,7 +6913,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_schar * - * Purpose: Converts `long_long' to `signed char' + * Purpose: Converts `long long' to `signed char' * * Return: Success: Non-negative * @@ -6936,7 +6936,7 @@ H5T_conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_schar, FAIL) - H5T_CONV_Ss(LLONG, SCHAR, long_long, signed char, SCHAR_MIN, SCHAR_MAX); + H5T_CONV_Ss(LLONG, SCHAR, long long, signed char, SCHAR_MIN, SCHAR_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6946,7 +6946,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_uchar * - * Purpose: Converts `long_long' to `unsigned char' + * Purpose: Converts `long long' to `unsigned char' * * Return: Success: Non-negative * @@ -6969,7 +6969,7 @@ H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_uchar, FAIL) - H5T_CONV_Su(LLONG, UCHAR, long_long, unsigned char, -, UCHAR_MAX); + H5T_CONV_Su(LLONG, UCHAR, long long, unsigned char, -, UCHAR_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6979,7 +6979,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_schar * - * Purpose: Converts `unsigned long_long' to `signed char' + * Purpose: Converts `unsigned long long' to `signed char' * * Return: Success: Non-negative * @@ -7002,7 +7002,7 @@ H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_schar, FAIL) - H5T_CONV_Us(ULLONG, SCHAR, unsigned long_long, signed char, -, SCHAR_MAX); + H5T_CONV_Us(ULLONG, SCHAR, unsigned long long, signed char, -, SCHAR_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7012,7 +7012,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_uchar * - * Purpose: Converts `unsigned long_long' to `unsigned char' + * Purpose: Converts `unsigned long long' to `unsigned char' * * Return: Success: Non-negative * @@ -7035,7 +7035,7 @@ H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_uchar, FAIL) - H5T_CONV_Uu(ULLONG, UCHAR, unsigned long_long, unsigned char, -, UCHAR_MAX); + H5T_CONV_Uu(ULLONG, UCHAR, unsigned long long, unsigned char, -, UCHAR_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7045,7 +7045,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_short * - * Purpose: Converts `long_long' to `short' + * Purpose: Converts `long long' to `short' * * Return: Success: Non-negative * @@ -7068,7 +7068,7 @@ H5T_conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_short, FAIL) - H5T_CONV_Ss(LLONG, SHORT, long_long, short, SHRT_MIN, SHRT_MAX); + H5T_CONV_Ss(LLONG, SHORT, long long, short, SHRT_MIN, SHRT_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7078,7 +7078,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_ushort * - * Purpose: Converts `long_long' to `unsigned short' + * Purpose: Converts `long long' to `unsigned short' * * Return: Success: Non-negative * @@ -7101,7 +7101,7 @@ H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_ushort, FAIL) - H5T_CONV_Su(LLONG, USHORT, long_long, unsigned short, -, USHRT_MAX); + H5T_CONV_Su(LLONG, USHORT, long long, unsigned short, -, USHRT_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7111,7 +7111,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_short * - * Purpose: Converts `unsigned long_long' to `short' + * Purpose: Converts `unsigned long long' to `short' * * Return: Success: Non-negative * @@ -7134,7 +7134,7 @@ H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_short, FAIL) - H5T_CONV_Us(ULLONG, SHORT, unsigned long_long, short, -, SHRT_MAX); + H5T_CONV_Us(ULLONG, SHORT, unsigned long long, short, -, SHRT_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7144,7 +7144,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_ushort * - * Purpose: Converts `unsigned long_long' to `unsigned short' + * Purpose: Converts `unsigned long long' to `unsigned short' * * Return: Success: Non-negative * @@ -7167,7 +7167,7 @@ H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_ushort, FAIL) - H5T_CONV_Uu(ULLONG, USHORT, unsigned long_long, unsigned short, -, USHRT_MAX); + H5T_CONV_Uu(ULLONG, USHORT, unsigned long long, unsigned short, -, USHRT_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7177,7 +7177,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_int * - * Purpose: Converts `long_long' to `int' + * Purpose: Converts `long long' to `int' * * Return: Success: Non-negative * @@ -7199,7 +7199,7 @@ H5T_conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_int, FAIL) - H5T_CONV_Ss(LLONG, INT, long_long, int, INT_MIN, INT_MAX); + H5T_CONV_Ss(LLONG, INT, long long, int, INT_MIN, INT_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7209,7 +7209,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_uint * - * Purpose: Converts `long_long' to `unsigned int' + * Purpose: Converts `long long' to `unsigned int' * * Return: Success: Non-negative * @@ -7231,7 +7231,7 @@ H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_uint, FAIL) - H5T_CONV_Su(LLONG, UINT, long_long, unsigned, -, UINT_MAX); + H5T_CONV_Su(LLONG, UINT, long long, unsigned, -, UINT_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7241,7 +7241,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_int * - * Purpose: Converts `unsigned long_long' to `int' + * Purpose: Converts `unsigned long long' to `int' * * Return: Success: Non-negative * @@ -7263,7 +7263,7 @@ H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_int, FAIL) - H5T_CONV_Us(ULLONG, INT, unsigned long_long, int, -, INT_MAX); + H5T_CONV_Us(ULLONG, INT, unsigned long long, int, -, INT_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7273,7 +7273,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_uint * - * Purpose: Converts `unsigned long_long' to `unsigned int' + * Purpose: Converts `unsigned long long' to `unsigned int' * * Return: Success: Non-negative * @@ -7296,7 +7296,7 @@ H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_uint, FAIL) - H5T_CONV_Uu(ULLONG, UINT, unsigned long_long, unsigned, -, UINT_MAX); + H5T_CONV_Uu(ULLONG, UINT, unsigned long long, unsigned, -, UINT_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7306,7 +7306,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_long * - * Purpose: Converts `long_long' to `long' + * Purpose: Converts `long long' to `long' * * Return: Success: Non-negative * @@ -7328,7 +7328,7 @@ H5T_conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_long, FAIL) - H5T_CONV_Ss(LLONG, LONG, long_long, long, LONG_MIN, LONG_MAX); + H5T_CONV_Ss(LLONG, LONG, long long, long, LONG_MIN, LONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7338,7 +7338,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_ulong * - * Purpose: Converts `long_long' to `unsigned long' + * Purpose: Converts `long long' to `unsigned long' * * Return: Success: Non-negative * @@ -7361,7 +7361,7 @@ H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_ulong, FAIL) - H5T_CONV_Su(LLONG, ULONG, long_long, unsigned long, -, ULONG_MAX); + H5T_CONV_Su(LLONG, ULONG, long long, unsigned long, -, ULONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7371,7 +7371,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_long * - * Purpose: Converts `unsigned long_long' to `long' + * Purpose: Converts `unsigned long long' to `long' * * Return: Success: Non-negative * @@ -7394,7 +7394,7 @@ H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_long, FAIL) - H5T_CONV_Us(ULLONG, LONG, unsigned long_long, long, -, LONG_MAX); + H5T_CONV_Us(ULLONG, LONG, unsigned long long, long, -, LONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7404,7 +7404,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_ulong * - * Purpose: Converts `unsigned long_long' to `unsigned long' + * Purpose: Converts `unsigned long long' to `unsigned long' * * Return: Success: Non-negative * @@ -7427,7 +7427,7 @@ H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_ulong, FAIL) - H5T_CONV_Uu(ULLONG, ULONG, unsigned long_long, unsigned long, -, ULONG_MAX); + H5T_CONV_Uu(ULLONG, ULONG, unsigned long long, unsigned long, -, ULONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7437,7 +7437,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_llong_ullong * - * Purpose: Converts `long_long' to `unsigned long_long' + * Purpose: Converts `long long' to `unsigned long long' * * Return: Success: non-negative * @@ -7460,7 +7460,7 @@ H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_ullong, FAIL) - H5T_CONV_su(LLONG, ULLONG, long_long, unsigned long_long, -, -); + H5T_CONV_su(LLONG, ULLONG, long long, unsigned long long, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7470,7 +7470,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_conv_ullong_llong * - * Purpose: Converts `unsigned long_long' to `long_long' + * Purpose: Converts `unsigned long long' to `long long' * * Return: Success: non-negative * @@ -7493,7 +7493,7 @@ H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_llong, FAIL) - H5T_CONV_us(ULLONG, LLONG, unsigned long_long, long_long, -, LLONG_MAX); + H5T_CONV_us(ULLONG, LLONG, unsigned long long, long long, -, LLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -8529,7 +8529,7 @@ H5T_conv_llong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_float, FAIL) - H5T_CONV_xF(LLONG, FLOAT, long_long, float, -, -); + H5T_CONV_xF(LLONG, FLOAT, long long, float, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -8561,7 +8561,7 @@ H5T_conv_llong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_double, FAIL) - H5T_CONV_xF(LLONG, DOUBLE, long_long, double, -, -); + H5T_CONV_xF(LLONG, DOUBLE, long long, double, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -8594,7 +8594,7 @@ H5T_conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_llong_ldouble, FAIL) - H5T_CONV_xF(LLONG, LDOUBLE, long_long, long double, -, -); + H5T_CONV_xF(LLONG, LDOUBLE, long long, long double, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -8628,7 +8628,7 @@ H5T_conv_ullong_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_float, FAIL) - H5T_CONV_xF(ULLONG, FLOAT, unsigned long_long, float, -, -); + H5T_CONV_xF(ULLONG, FLOAT, unsigned long long, float, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -8662,7 +8662,7 @@ H5T_conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_double, FAIL) - H5T_CONV_xF(ULLONG, DOUBLE, unsigned long_long, double, -, -); + H5T_CONV_xF(ULLONG, DOUBLE, unsigned long long, double, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -8696,7 +8696,7 @@ H5T_conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ullong_ldouble, FAIL) - H5T_CONV_xF(ULLONG, LDOUBLE, unsigned long_long, long double, -, -); + H5T_CONV_xF(ULLONG, LDOUBLE, unsigned long long, long double, -, -); done: FUNC_LEAVE_NOAPI(ret_value) @@ -9514,7 +9514,7 @@ H5T_conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_float_llong, FAIL) - H5T_CONV_Fx(FLOAT, LLONG, float, long_long, LLONG_MIN, LLONG_MAX); + H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -9548,7 +9548,7 @@ H5T_conv_float_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_float_ullong, FAIL) - H5T_CONV_Fx(FLOAT, ULLONG, float, unsigned long_long, 0, ULLONG_MAX); + H5T_CONV_Fx(FLOAT, ULLONG, float, unsigned long long, 0, ULLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -9582,7 +9582,7 @@ H5T_conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_double_llong, FAIL) - H5T_CONV_Fx(DOUBLE, LLONG, double, long_long, LLONG_MIN, LLONG_MAX); + H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -9616,7 +9616,7 @@ H5T_conv_double_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_double_ullong, FAIL) - H5T_CONV_Fx(DOUBLE, ULLONG, double, unsigned long_long, 0, ULLONG_MAX); + H5T_CONV_Fx(DOUBLE, ULLONG, double, unsigned long long, 0, ULLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -9650,7 +9650,7 @@ H5T_conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ldouble_llong, FAIL) - H5T_CONV_Fx(LDOUBLE, LLONG, long double, long_long, LLONG_MIN, LLONG_MAX); + H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) @@ -9684,7 +9684,7 @@ H5T_conv_ldouble_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, FUNC_ENTER_NOAPI(H5T_conv_ldouble_ullong, FAIL) - H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long_long, 0, ULLONG_MAX); + H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long long, 0, ULLONG_MAX); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Tnative.c b/src/H5Tnative.c index f347d93..75b5d03 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -550,22 +550,22 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, native_size = sizeof(long); } else if(prec<=H5Tget_precision(H5T_NATIVE_LLONG)) { match=H5T_NATIVE_INT_MATCH_LLONG; - native_size = sizeof(long_long); + native_size = sizeof(long long); } else { /* If no native type matches the querried datatype, simply choose the type of biggest size. */ match=H5T_NATIVE_INT_MATCH_LLONG; - native_size = sizeof(long_long); + native_size = sizeof(long long); } } else if(direction == H5T_DIR_DESCEND) { if(prec>=H5Tget_precision(H5T_NATIVE_LLONG)) { match=H5T_NATIVE_INT_MATCH_LLONG; - native_size = sizeof(long_long); + native_size = sizeof(long long); } else if(prec>=H5Tget_precision(H5T_NATIVE_LONG)) { if(prec==H5Tget_precision(H5T_NATIVE_LONG)) { match=H5T_NATIVE_INT_MATCH_LONG; native_size = sizeof(long); } else { match=H5T_NATIVE_INT_MATCH_LLONG; - native_size = sizeof(long_long); + native_size = sizeof(long long); } } else if(prec>=H5Tget_precision(H5T_NATIVE_INT)) { diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 95539ab..330a731 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -388,7 +388,7 @@ H5_DLLVAR hid_t H5T_VAX_F64_g; * precision and byte order as the last component, they have a C-like type * name. If the type begins with `U' then it is the unsigned version of the * integer type; other integer types are signed. The type LLONG corresponds - * to C's `long_long' and LDOUBLE is `long double' (these types might be the + * to C's `long long' and LDOUBLE is `long double' (these types might be the * same as `LONG' and `DOUBLE' respectively). */ #define H5T_NATIVE_CHAR (CHAR_MIN?H5T_NATIVE_SCHAR:H5T_NATIVE_UCHAR) diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 28d8f93..10618c3 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -50,19 +50,19 @@ static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t spac static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); static void H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, size_t dtype_size); -static unsigned H5Z_scaleoffset_log2(unsigned long_long num); +static unsigned H5Z_scaleoffset_log2(unsigned long long num); static void H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_type type, unsigned filavail, const void *filval_buf, - uint32_t *minbits, unsigned long_long *minval); + uint32_t *minbits, unsigned long long *minval); static void H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_type type, unsigned filavail, const void *filval_buf, - uint32_t minbits, unsigned long_long minval); + uint32_t minbits, unsigned long long minval); static herr_t H5Z_scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_type type, unsigned filavail, const void *filval_buf, - uint32_t *minbits, unsigned long_long *minval, double D_val); + uint32_t *minbits, unsigned long long *minval, double D_val); static herr_t H5Z_scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_type type, unsigned filavail, const void *filval_buf, - uint32_t minbits, unsigned long_long minval, double D_val); + uint32_t minbits, unsigned long long minval, double D_val); static void H5Z_scaleoffset_next_byte(size_t *j, int *buf_len); static void H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, int k, int begin_i, unsigned char *buffer, size_t *j, int *buf_len, @@ -188,8 +188,8 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_save_filval(unsigned int, cd_values, *(int *)&fill_val) \ else if(sizeof(type) == sizeof(long)) \ H5Z_scaleoffset_save_filval(unsigned long, cd_values, *(long *)&fill_val) \ - else if(sizeof(type) == sizeof(long_long)) \ - H5Z_scaleoffset_save_filval(unsigned long_long, cd_values, *(long_long *)&fill_val)\ + else if(sizeof(type) == sizeof(long long)) \ + H5Z_scaleoffset_save_filval(unsigned long long, cd_values, *(long long *)&fill_val)\ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ } @@ -216,8 +216,8 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_get_filval_1(i, int, filval_buf, *(int *)&filval) \ else if(sizeof(type)==sizeof(long)) \ H5Z_scaleoffset_get_filval_1(i, long, filval_buf, *(long *)&filval) \ - else if(sizeof(type)==sizeof(long_long)) \ - H5Z_scaleoffset_get_filval_1(i, long_long, filval_buf, *(long_long *)&filval) \ + else if(sizeof(type)==sizeof(long long)) \ + H5Z_scaleoffset_get_filval_1(i, long long, filval_buf, *(long long *)&filval) \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ } @@ -303,10 +303,10 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ > HDpow(2.0, (double)(sizeof(long)*8 - 1))) { \ *minbits = sizeof(long)*8; goto done; \ } \ - } else if(sizeof(type)==sizeof(long_long)) { \ + } else if(sizeof(type)==sizeof(long long)) { \ if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(long_long)*8 - 1))) { \ - *minbits = sizeof(long_long)*8; goto done; \ + > HDpow(2.0, (double)(sizeof(long long)*8 - 1))) { \ + *minbits = sizeof(long long)*8; goto done; \ } \ } else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ @@ -323,7 +323,7 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_1(type, max, min, minbits) \ span = max - min + 1; \ - *minbits = H5Z_scaleoffset_log2((unsigned long_long)(span+1)); \ + *minbits = H5Z_scaleoffset_log2((unsigned long long)(span+1)); \ } else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min) \ if(*minbits != sizeof(type)*8) /* change values if minbits != full precision */ \ @@ -334,7 +334,7 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_1(type, max, min, minbits) \ span = max - min + 1; \ - *minbits = H5Z_scaleoffset_log2((unsigned long_long)span); \ + *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ } else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_2(i, d_nelmts, buf, min) \ if(*minbits != sizeof(type)*8) /* change values if minbits != full precision */ \ @@ -355,7 +355,7 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) \ span = max - min + 1; \ - *minbits = H5Z_scaleoffset_log2((unsigned long_long)(span+1)); \ + *minbits = H5Z_scaleoffset_log2((unsigned long long)(span+1)); \ } else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min) \ if(*minbits != sizeof(type)*8) /* change values if minbits != full precision */ \ @@ -366,7 +366,7 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) \ span = max - min + 1; \ - *minbits = H5Z_scaleoffset_log2((unsigned long_long)span); \ + *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ } else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_2(i, d_nelmts, buf, min) \ if(*minbits != sizeof(type)*8) /* change values if minbits != full precision */ \ @@ -394,12 +394,12 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ } \ - else if(sizeof(type)==sizeof(long_long)) \ + else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) { \ if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ - *(long_long *)&buf[i] = ((unsigned long_long)1 << *minbits) - 1; \ + *(long long *)&buf[i] = ((unsigned long long)1 << *minbits) - 1; \ else \ - *(long_long *)&buf[i] = H5Z_scaleoffset_rnd( \ + *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ } \ else \ @@ -417,9 +417,9 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ for(i = 0; i < d_nelmts; i++) \ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ - else if(sizeof(type)==sizeof(long_long)) \ + else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - *(long_long *)&buf[i] = H5Z_scaleoffset_rnd( \ + *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ @@ -434,9 +434,9 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < sizeof(long); i++) \ ((unsigned char *)minval)[i] = (unsigned char)((*(long *)&min & ((long)0xff << i*8)) >> i*8); \ - else if(sizeof(type)==sizeof(long_long)) \ - for(i = 0; i < sizeof(long_long); i++) \ - ((unsigned char *)minval)[i] = (unsigned char)((*(long_long *)&min & ((long_long)0xff << i*8)) >> i*8);\ + else if(sizeof(type)==sizeof(long long)) \ + for(i = 0; i < sizeof(long long); i++) \ + ((unsigned char *)minval)[i] = (unsigned char)((*(long long *)&min & ((long long)0xff << i*8)) >> i*8);\ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ } @@ -446,21 +446,21 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ minbits, minval, D_val) \ { \ type *buf = data, min = 0, max = 0, filval = 0; \ - unsigned long_long span; unsigned i; *minval = 0; \ + unsigned long long span; unsigned i; *minval = 0; \ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_2(i, type, filval_buf, filval) \ H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ span = H5Z_scaleoffset_rnd(max*HDpow(10.0,D_val) - min*HDpow(10.0,D_val)) + 1; \ - *minbits = H5Z_scaleoffset_log2((unsigned long_long)(span+1)); \ + *minbits = H5Z_scaleoffset_log2((unsigned long long)(span+1)); \ if(*minbits != sizeof(type)*8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_1(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ } else { /* fill value undefined */ \ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ span = H5Z_scaleoffset_rnd(max*HDpow(10.0,D_val) - min*HDpow(10.0,D_val)) + 1; \ - *minbits = H5Z_scaleoffset_log2((unsigned long_long)span); \ + *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ if(*minbits != sizeof(type)*8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_2(i, type, buf, d_nelmts, min, D_val) \ } \ @@ -506,10 +506,10 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ for(i = 0; i < sizeof(long); i++) { \ mask = ((unsigned char *)&minval)[i]; mask <<= i*8; *(long *)&min |= mask; \ } \ - } else if(sizeof(type)==sizeof(long_long)) { \ - long_long mask; \ - for(i = 0; i < sizeof(long_long); i++) { \ - mask = ((unsigned char *)&minval)[i]; mask <<= i*8; *(long_long *)&min |= mask;\ + } else if(sizeof(type)==sizeof(long long)) { \ + long long mask; \ + for(i = 0; i < sizeof(long long); i++) { \ + mask = ((unsigned char *)&minval)[i]; mask <<= i*8; *(long long *)&min |= mask;\ } \ } else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ @@ -526,10 +526,10 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ for(i = 0; i < d_nelmts; i++) \ buf[i] = (*(long *)&buf[i]==(((unsigned long)1 << minbits) - 1))? \ filval:(*(long *)&buf[i])/HDpow(10.0, D_val) + min; \ - else if(sizeof(type)==sizeof(long_long)) \ + else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (*(long_long *)&buf[i]==(((unsigned long_long)1 << minbits) - 1))? \ - filval:(*(long_long *)&buf[i])/HDpow(10.0, D_val) + min; \ + buf[i] = (*(long long *)&buf[i]==(((unsigned long long)1 << minbits) - 1))? \ + filval:(*(long long *)&buf[i])/HDpow(10.0, D_val) + min; \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -543,9 +543,9 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (*(long *)&buf[i])/HDpow(10.0, D_val) + min; \ - else if(sizeof(type)==sizeof(long_long)) \ + else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (*(long_long *)&buf[i])/HDpow(10.0, D_val) + min; \ + buf[i] = (*(long long *)&buf[i])/HDpow(10.0, D_val) + min; \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -651,7 +651,7 @@ H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dty else if(dtype_size == sizeof(unsigned short)) type = t_ushort; else if(dtype_size == sizeof(unsigned int)) type = t_uint; else if(dtype_size == sizeof(unsigned long)) type = t_ulong; - else if(dtype_size == sizeof(unsigned long_long)) type = t_ulong_long; + else if(dtype_size == sizeof(unsigned long long)) type = t_ulong_long; else HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype") } @@ -661,7 +661,7 @@ H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dty else if(dtype_size == sizeof(short)) type = t_short; else if(dtype_size == sizeof(int)) type = t_int; else if(dtype_size == sizeof(long)) type = t_long; - else if(dtype_size == sizeof(long_long)) type = t_long_long; + else if(dtype_size == sizeof(long long)) type = t_long_long; else HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype") } @@ -713,7 +713,7 @@ H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, else if(scale_type == t_ulong) H5Z_scaleoffset_set_filval_1(unsigned long, dcpl_plist, type, cd_values, need_convert, dxpl_id) else if(scale_type == t_ulong_long) - H5Z_scaleoffset_set_filval_1(unsigned long_long, dcpl_plist, type, cd_values, need_convert, dxpl_id) + H5Z_scaleoffset_set_filval_1(unsigned long long, dcpl_plist, type, cd_values, need_convert, dxpl_id) else if(scale_type == t_schar) H5Z_scaleoffset_set_filval_3(signed char, dcpl_plist, type, cd_values, need_convert, dxpl_id) else if(scale_type == t_short) @@ -723,7 +723,7 @@ H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, else if(scale_type == t_long) H5Z_scaleoffset_set_filval_2(long, dcpl_plist, type, cd_values, need_convert, dxpl_id) else if(scale_type == t_long_long) - H5Z_scaleoffset_set_filval_2(long_long, dcpl_plist, type, cd_values, need_convert, dxpl_id) + H5Z_scaleoffset_set_filval_2(long long, dcpl_plist, type, cd_values, need_convert, dxpl_id) else if(scale_type == t_float) H5Z_scaleoffset_set_filval_4(float, dcpl_plist, type, cd_values, need_convert, dxpl_id) else if(scale_type == t_double) @@ -920,7 +920,7 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu int scale_factor = 0; /* scale factor */ double D_val = 0.0; /* decimal scale factor */ uint32_t minbits = 0; /* minimum number of bits to store values */ - unsigned long_long minval= 0; /* minimum value of input buffer */ + unsigned long long minval= 0; /* minimum value of input buffer */ enum H5Z_scaleoffset_type type; /* memory type corresponding to dataset datatype */ int need_convert = FALSE; /* flag indicating convertion of byte order */ unsigned char *outbuf = NULL; /* pointer to new output buffer */ @@ -1009,7 +1009,7 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu * retrieve them corresponding to how they are stored during compression */ uint32_t minbits_mask = 0; - unsigned long_long minval_mask = 0; + unsigned long long minval_mask = 0; unsigned minval_size = 0; minbits = 0; @@ -1020,11 +1020,11 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu } /* retrieval of minval takes into consideration situation where sizeof - * unsigned long_long (datatype of minval) may change from compression + * unsigned long long (datatype of minval) may change from compression * to decompression, only smaller size is used */ - minval_size = sizeof(unsigned long_long) <= ((unsigned char *)*buf)[4] ? - sizeof(unsigned long_long) : ((unsigned char *)*buf)[4]; + minval_size = sizeof(unsigned long long) <= ((unsigned char *)*buf)[4] ? + sizeof(unsigned long long) : ((unsigned char *)*buf)[4]; minval = 0; for(i = 0; i < minval_size; i++) { minval_mask = ((unsigned char *)*buf)[5+i]; @@ -1129,10 +1129,10 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu for(i = 0; i < 4; i++) ((unsigned char *)outbuf)[i] = (minbits & ((uint32_t)0xff << i*8)) >> i*8; - ((unsigned char *)outbuf)[4] = sizeof(unsigned long_long); + ((unsigned char *)outbuf)[4] = sizeof(unsigned long long); - for(i = 0; i < sizeof(unsigned long_long); i++) - ((unsigned char *)outbuf)[5+i] = (unsigned char)((minval & ((unsigned long_long)0xff << i*8)) >> i*8); + for(i = 0; i < sizeof(unsigned long long); i++) + ((unsigned char *)outbuf)[5+i] = (unsigned char)((minval & ((unsigned long long)0xff << i*8)) >> i*8); /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { @@ -1221,11 +1221,11 @@ static double H5Z_scaleoffset_rnd(double val) /* return ceiling of floating-point log2 function * receive unsigned integer as argument 3/10/2005 */ -static unsigned H5Z_scaleoffset_log2(unsigned long_long num) +static unsigned H5Z_scaleoffset_log2(unsigned long long num) { unsigned v = 0; - unsigned long_long lower_bound = 1; /* is power of 2, largest value <= num */ - unsigned long_long val = num; + unsigned long long lower_bound = 1; /* is power of 2, largest value <= num */ + unsigned long long val = num; while(val >>= 1) { v++; lower_bound <<= 1; } @@ -1236,7 +1236,7 @@ static unsigned H5Z_scaleoffset_log2(unsigned long_long num) /* precompress for integer type */ static void H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_type type, - unsigned filavail, const void *filval_buf, uint32_t *minbits, unsigned long_long *minval) + unsigned filavail, const void *filval_buf, uint32_t *minbits, unsigned long long *minval) { if(type == t_uchar) H5Z_scaleoffset_precompress_1(unsigned char, data, d_nelmts, @@ -1251,7 +1251,7 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse H5Z_scaleoffset_precompress_1(unsigned long, data, d_nelmts, filavail, filval_buf, minbits, minval) else if(type == t_ulong_long) - H5Z_scaleoffset_precompress_1(unsigned long_long, data, d_nelmts, + H5Z_scaleoffset_precompress_1(unsigned long long, data, d_nelmts, filavail, filval_buf, minbits, minval) else if(type == t_schar) { signed char *buf = data, min = 0, max = 0, filval = 0; @@ -1264,7 +1264,7 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse if((unsigned char)(max - min) > (unsigned char)(~(unsigned char)0 - 2)) { *minbits = sizeof(signed char)*8; return; } span = max - min + 1; - *minbits = H5Z_scaleoffset_log2((unsigned long_long)(span+1)); + *minbits = H5Z_scaleoffset_log2((unsigned long long)(span+1)); } else /* minbits already set, only calculate min */ H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min) if(*minbits != sizeof(signed char)*8) /* change values if minbits != full precision */ @@ -1278,7 +1278,7 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse *minval = min; return; } span = max - min + 1; - *minbits = H5Z_scaleoffset_log2((unsigned long_long)span); + *minbits = H5Z_scaleoffset_log2((unsigned long long)span); } else /* minbits already set, only calculate min */ H5Z_scaleoffset_min_2(i, d_nelmts, buf, min) if(*minbits != sizeof(signed char)*8) /* change values if minbits != full precision */ @@ -1296,16 +1296,16 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse H5Z_scaleoffset_precompress_2(long, data, d_nelmts, filavail, filval_buf, minbits, minval) else if(type == t_long_long) - H5Z_scaleoffset_precompress_2(long_long, data, d_nelmts, + H5Z_scaleoffset_precompress_2(long long, data, d_nelmts, filavail, filval_buf, minbits, minval) } /* postdecompress for integer type */ static void H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_type type, - unsigned filavail, const void *filval_buf, uint32_t minbits, unsigned long_long minval) + unsigned filavail, const void *filval_buf, uint32_t minbits, unsigned long long minval) { - long_long sminval = *(long_long*)&minval; /* for signed integer types */ + long long sminval = *(long long*)&minval; /* for signed integer types */ if(type == t_uchar) H5Z_scaleoffset_postdecompress_1(unsigned char, data, d_nelmts, filavail, @@ -1320,7 +1320,7 @@ H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleof H5Z_scaleoffset_postdecompress_1(unsigned long, data, d_nelmts, filavail, filval_buf, minbits, minval) else if(type == t_ulong_long) - H5Z_scaleoffset_postdecompress_1(unsigned long_long, data, d_nelmts, filavail, + H5Z_scaleoffset_postdecompress_1(unsigned long long, data, d_nelmts, filavail, filval_buf, minbits, minval) else if(type == t_schar) { signed char *buf = data, filval = 0; unsigned i; @@ -1342,7 +1342,7 @@ H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleof H5Z_scaleoffset_postdecompress_2(long, data, d_nelmts, filavail, filval_buf, minbits, sminval) else if(type == t_long_long) - H5Z_scaleoffset_postdecompress_2(long_long, data, d_nelmts, filavail, + H5Z_scaleoffset_postdecompress_2(long long, data, d_nelmts, filavail, filval_buf, minbits, sminval) } @@ -1350,7 +1350,7 @@ H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleof success: non-negative, failure: negative 4/15/05 */ static herr_t H5Z_scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_type type, -unsigned filavail, const void *filval_buf, uint32_t *minbits, unsigned long_long *minval, double D_val) +unsigned filavail, const void *filval_buf, uint32_t *minbits, unsigned long long *minval, double D_val) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1371,9 +1371,9 @@ done: success: non-negative, failure: negative 4/15/05 */ static herr_t H5Z_scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_type type, -unsigned filavail, const void *filval_buf, uint32_t minbits, unsigned long_long minval, double D_val) +unsigned filavail, const void *filval_buf, uint32_t minbits, unsigned long long minval, double D_val) { - long_long sminval = *(long_long*)&minval; /* for signed integer types */ + long long sminval = *(long long*)&minval; /* for signed integer types */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5Z_scaleoffset_postdecompress_fd, FAIL) diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index b26a4b3..2b35786 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -193,9 +193,9 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); else if((TYPE) == H5T_NATIVE_ULONG) \ H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_LLONG) \ - H5Z_XFORM_LL_DO_OP1((RESL), (RESR), long_long, OP, (SIZE)) \ + H5Z_XFORM_LL_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_ULLONG) \ - H5Z_XFORM_ULL_DO_OP1((RESL), (RESR), unsigned long_long, OP, (SIZE)) \ + H5Z_XFORM_ULL_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_FLOAT) \ H5Z_XFORM_DO_OP1((RESL), (RESR), float, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_DOUBLE) \ @@ -225,9 +225,9 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); else if((TYPE) == H5T_NATIVE_ULONG) \ H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_LLONG) \ - H5Z_XFORM_LL_DO_OP1((RESL), (RESR), long_long, OP, (SIZE)) \ + H5Z_XFORM_LL_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_ULLONG) \ - H5Z_XFORM_ULL_DO_OP1((RESL), (RESR), unsigned long_long, OP, (SIZE)) \ + H5Z_XFORM_ULL_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_FLOAT) \ H5Z_XFORM_DO_OP1((RESL), (RESR), float, OP, (SIZE)) \ else if((TYPE) == H5T_NATIVE_DOUBLE) \ @@ -942,9 +942,9 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size else if(array_type == H5T_NATIVE_ULONG) H5Z_XFORM_DO_OP5(unsigned long, array_size) else if(array_type == H5T_NATIVE_LLONG) - H5Z_XFORM_DO_OP5(long_long, array_size) + H5Z_XFORM_DO_OP5(long long, array_size) else if(array_type == H5T_NATIVE_ULLONG) - H5Z_XFORM_DO_OP5(unsigned long_long, array_size) + H5Z_XFORM_DO_OP5(unsigned long long, array_size) else if(array_type == H5T_NATIVE_FLOAT) H5Z_XFORM_DO_OP5(float, array_size) else if(array_type == H5T_NATIVE_DOUBLE) diff --git a/src/H5detect.c b/src/H5detect.c index e29157d..b67c2b0 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -1396,8 +1396,8 @@ detect_C99_integers64(void) #endif #if H5_SIZEOF_LONG_LONG>0 - DETECT_I(long_long, LLONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long_long, ULLONG, d_g[nd_g]); nd_g++; + DETECT_I(long long, LLONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; #else /* * This architecture doesn't support an integer type larger than `long' diff --git a/src/H5private.h b/src/H5private.h index 2f75f86..ea55a61 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -404,12 +404,12 @@ * most part. */ #ifndef LLONG_MAX -# define LLONG_MAX ((long_long)(((unsigned long_long)1 \ - <<(8*sizeof(long_long)-1))-1)) -# define LLONG_MIN ((long_long)(-LLONG_MAX)-1) +# define LLONG_MAX ((long long)(((unsigned long long)1 \ + <<(8*sizeof(long long)-1))-1)) +# define LLONG_MIN ((long long)(-LLONG_MAX)-1) #endif #ifndef ULLONG_MAX -# define ULLONG_MAX ((unsigned long_long)((long_long)(-1))) +# define ULLONG_MAX ((unsigned long long)((long long)(-1))) #endif #ifndef SIZET_MAX # define SIZET_MAX ((size_t)(ssize_t)(-1)) diff --git a/src/H5public.h b/src/H5public.h index db2d407..e13091b 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -71,10 +71,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 30 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 32 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.30" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.32" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) @@ -110,24 +110,6 @@ typedef int herr_t; typedef unsigned int hbool_t; typedef int htri_t; -/* - * Although `long long' is part of the revised ANSI-C some compilers don't - * support it yet. We define `long_long' as the longest integral integer type - * supported by the compiler, usually 64 bits. It must be legal to qualify - * `long_long' with `unsigned'. - */ -#if H5_SIZEOF_LONG_LONG>0 -# define long_long long long -#elif H5_SIZEOF___INT64>0 -# define long_long __int64 /*Win32*/ -# undef H5_SIZEOF_LONG_LONG -# define H5_SIZEOF_LONG_LONG H5_SIZEOF___INT64 -#else -# define long_long long int -# undef H5_SIZEOF_LONG_LONG -# define H5_SIZEOF_LONG_LONG H5_SIZEOF_LONG -#endif - /* Define the ssize_t type if it not is defined */ #if H5_SIZEOF_SSIZE_T==0 /* Undefine this size, we will re-define it in one of the sections below */ @@ -139,7 +121,7 @@ typedef int ssize_t; typedef long ssize_t; # define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG #elif H5_SIZEOF_SIZE_T==H5_SIZEOF_LONG_LONG -typedef long_long ssize_t; +typedef long long ssize_t; # define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG #else /* Can't find matching type for ssize_t */ # error "nothing appropriate for ssize_t" @@ -151,8 +133,8 @@ typedef long_long ssize_t; * type. */ #if H5_SIZEOF_LONG_LONG >= 8 -typedef unsigned long_long hsize_t; -typedef signed long_long hssize_t; +typedef unsigned long long hsize_t; +typedef signed long long hssize_t; # define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG # define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG #else @@ -184,8 +166,8 @@ typedef signed long_long hssize_t; # define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG # endif /* H5_HAVE_PARALLEL */ #elif H5_SIZEOF_LONG_LONG>=8 - typedef unsigned long_long haddr_t; -# define HADDR_UNDEF ((haddr_t)(long_long)(-1)) + typedef unsigned long long haddr_t; +# define HADDR_UNDEF ((haddr_t)(long long)(-1)) # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT @@ -237,7 +219,7 @@ typedef signed long_long hssize_t; # undef H5_SIZEOF_INT64_T # define H5_SIZEOF_INT64_T H5_SIZEOF_LONG #elif H5_SIZEOF_LONG_LONG>=8 - typedef long_long int64_t; + typedef long long int64_t; # undef H5_SIZEOF_INT64_T # define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG #else @@ -257,7 +239,7 @@ typedef signed long_long hssize_t; # undef H5_SIZEOF_UINT64_T # define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG #elif H5_SIZEOF_LONG_LONG>=8 - typedef unsigned long_long uint64_t; + typedef unsigned long long uint64_t; # undef H5_SIZEOF_UINT64_T # define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG #else diff --git a/src/Makefile.in b/src/Makefile.in index 96b1f3a..dc6e787 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -408,7 +408,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 20 +LT_VERS_REVISION = 22 LT_VERS_AGE = 0 H5detect_CFLAGS = -g |