diff options
Diffstat (limited to 'src')
97 files changed, 1083 insertions, 779 deletions
@@ -470,7 +470,7 @@ H5dont_atexit(void) * library, which are supposed to free any unused memory they have * allocated. * - * These should probably be registered dynamically in a linked list of + * These should probably be registered dynamicly in a linked list of * functions to call, but there aren't that many right now, so we * hard-wire them... * @@ -785,7 +785,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) HDfprintf (stderr, "%s", H5libhdf5_settings); break; default: - /* 2 or higher: continue silently */ + /* 2 or higer: continue silently */ break; } /* end switch */ @@ -318,7 +318,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi size") if(NULL == (aux_ptr = H5FL_CALLOC(H5AC_aux_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxiliary structure") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxilary structure") aux_ptr->magic = H5AC__H5AC_AUX_T_MAGIC; aux_ptr->mpi_comm = mpi_comm; @@ -432,7 +432,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co done: #ifdef H5_HAVE_PARALLEL - /* if there is a failure, try to tidy up the auxiliary structure */ + /* if there is a failure, try to tidy up the auxilary structure */ if(ret_value < 0) { if(aux_ptr != NULL) { if(aux_ptr->d_slist_ptr != NULL) @@ -1878,7 +1878,7 @@ done: * from the cache, clear it, and free it without writing it to * disk. * - * This version of the function is a complete re-write to + * This verion of the function is a complete re-write to * use the new metadata cache. While there isn't all that * much difference between the old and new Purpose sections, * the original version is given below. diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index b60b933..7671abc 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -933,7 +933,7 @@ done: * * Purpose: Update the dirty_bytes count for a newly inserted entry. * - * If mpi_rank isn't 0, this simply means adding the size + * If mpi_rank isnt 0, this simply means adding the size * of the entry to the dirty_bytes count. * * If mpi_rank is 0, we must also add the entry to the @@ -1332,7 +1332,7 @@ done: * clean. * * This function is the main routine for handling this - * notification procedure. It must be called + * notification proceedure. It must be called * simultaniously on all processes that have the relevant * file open. To this end, it is called only during a * sync point, with a barrier prior to the call. @@ -1340,7 +1340,7 @@ done: * Note that any metadata entry writes by process 0 will * occur after the barrier and just before this call. * - * Typically, calls to this function will be triggered in + * Typicaly, calls to this function will be triggered in * one of two ways: * * 1) Dirty byte creation exceeds some user specified value. @@ -2128,7 +2128,7 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu /* clear collective access flag on half of the entries in the cache and mark them as independent in case they need to be - evicted later. All ranks are guaranteed to mark the same entries + evicted later. All ranks are guranteed to mark the same entries since we don't modify the order of the collectively accessed entries except through collective access. */ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index 9bf84bf..409d914 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -189,7 +189,7 @@ H5FL_EXTERN(H5AC_aux_t); * is permitted to write to file. * * dirty_bytes_threshold: Integer field containing the dirty bytes - * generation threshold. Whenever dirty byte creation + * generation threashold. Whenever dirty byte creation * exceeds this value, the metadata cache on process 0 * broadcasts a list of the entries it has flushed since * the last broadcast (or since the beginning of execution) diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index a48aa69..654a877 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -39,7 +39,7 @@ extern "C" { * structure H5AC_cache_config_t * * H5AC_cache_config_t is a public structure intended for use in public APIs. - * At least in its initial incarnation, it is basically a copy of struct + * At least in its initial incarnation, it is basicaly a copy of struct * H5C_auto_size_ctl_t, minus the report_fcn field, and plus the * dirty_bytes_threshold field. * @@ -212,7 +212,7 @@ extern "C" { * * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated * type whose value indicates whether and by which algorithm we should - * make flash increases in the size of the cache to accommodate insertion + * make flash increases in the size of the cache to accomodate insertion * of large entries and large increases in the size of a single entry. * * The addition of the flash increment mode was occasioned by performance @@ -379,7 +379,7 @@ extern "C" { * synchronize updates between caches. (See above for outline and * motivation.) * - * This value MUST be consistent across all processes accessing the + * This value MUST be consistant across all processes accessing the * file. This field is ignored unless HDF5 has been compiled for * parallel. * diff --git a/src/H5Aint.c b/src/H5Aint.c index 55560c7..e666e8c 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1152,7 +1152,7 @@ H5A__free(H5A_t *attr) HDassert(attr); - /* Free dynamically allocated items */ + /* Free dynamicly allocated items */ if(attr->shared->name) { H5MM_xfree(attr->shared->name); attr->shared->name = NULL; @@ -1235,7 +1235,7 @@ H5A__close(H5A_t *attr) /* Reference count can be 0. It only happens when H5A__create fails. */ if(attr->shared->nrefs <= 1) { - /* Free dynamically allocated items */ + /* Free dynamicly allocated items */ if(H5A__free(attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") diff --git a/src/H5Apkg.h b/src/H5Apkg.h index af16b55..3315cc1 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -86,7 +86,7 @@ typedef struct H5A_shared_t { void *data; /* Attribute data (on a temporary basis) */ size_t data_size; /* Size of data on disk */ H5O_msg_crt_idx_t crt_idx; /* Attribute's creation index in the object header */ - unsigned nrefs; /* Ref count for times this object is referred */ + unsigned nrefs; /* Ref count for times this object is refered */ } H5A_shared_t; /* Define the main attribute structure */ @@ -769,7 +769,7 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, * the specified type. * * On return, if LT_KEY_CHANGED is non-zero, then LT_KEY is - * the new native left key. Similarly for RT_KEY_CHANGED + * the new native left key. Similarily for RT_KEY_CHANGED * and RT_KEY. * * If the node splits, then MD_KEY contains the key that diff --git a/src/H5B2internal.c b/src/H5B2internal.c index 7f6b80a..95ed769 100644 --- a/src/H5B2internal.c +++ b/src/H5B2internal.c @@ -1192,7 +1192,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, if(swap_loc) idx = 0; else { - /* Count from the original index value again */ + /* Count from the orginal index value again */ n = orig_n; /* Reset "found" flag - the record may have shifted during the diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index e203b87..270b4e6 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -122,7 +122,7 @@ typedef struct H5B_class_t { H5B_ins_t (*insert)(H5F_t*, haddr_t, void*, hbool_t*, void*, void*, void*, hbool_t*, haddr_t*); - /* min insert uses min leaf, not new(), similarly for max insert */ + /* min insert uses min leaf, not new(), similarily for max insert */ hbool_t follow_min; hbool_t follow_max; @@ -793,8 +793,8 @@ H5C_prep_for_file_close(H5F_t *f) * close, and since the close warning is issued after all * non FSM related space allocations and just before the * first sync point on close, this call will leave the caches - * in a consistent state across the processes if they were - * consistent before. + * in a consistant state across the processes if they were + * consistant before. * * 2) Since the FSM settle routines are only invoked once during * file close, invoking them now will prevent their invocation @@ -2255,7 +2255,7 @@ H5C_protect(H5F_t * f, if(entry_ptr != NULL) { if(entry_ptr->ring != ring) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occurred for cache entry") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occured for cache entry") HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); @@ -3095,7 +3095,7 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) * * All this is a bit awkward, but until the metadata cache entries * are contiguous, with only one dirty flag, we have to let the supplied - * functions deal with the resetting the is_dirty flag. + * functions deal with the reseting the is_dirty flag. */ if(entry_ptr->clear_on_unprotect) { /* Sanity check */ @@ -5029,7 +5029,7 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) { /* get the hit rate for the reporting function. Should still - * be good as we haven't reset the hit rate statistics. + * be good as we havent reset the hit rate statistics. */ if(H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") @@ -5272,7 +5272,7 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG; evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG; - /* The flush procedure here is a bit strange. + /* The flush proceedure here is a bit strange. * * In the outer while loop we make at least one pass through the * cache, and then repeat until either all the pinned entries in @@ -5421,7 +5421,7 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) * * While this optimization used to be easy, with the possibility * of new entries being added to the slist in the midst of the - * flush, we must keep the slist in canonical form at all + * flush, we must keep the slist in cannonical form at all * times. */ if(((!entry_ptr->flush_me_last) || @@ -6280,7 +6280,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) entry_addr = entry_ptr->addr; /* Internal cache data structures should now be up to date, and - * consistent with the status of the entry. + * consistant with the status of the entry. * * Now discard the entry if appropriate. */ @@ -6301,10 +6301,10 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); /* If the entry is not a prefetched entry, verify that the flush - * dependency parents addresses array has been transferred. + * dependency parents addresses array has been transfered. * * If the entry is prefetched, the free_isr routine will dispose of - * the flush dependency parents addresses array if necessary. + * the flush dependency parents adresses array if necessary. */ if(!entry_ptr->prefetched) { HDassert(0 == entry_ptr->fd_parent_count); @@ -8587,7 +8587,7 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) * tests will be necessary. */ if(cache_ptr->aux_ptr != NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occurred in parallel case") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case") #endif /* If required, resize the buffer and update the entry and the cache @@ -8787,7 +8787,7 @@ H5C_remove_entry(void *_entry) cache->entry_watched_for_removal = NULL; /* Internal cache data structures should now be up to date, and - * consistent with the status of the entry. + * consistant with the status of the entry. * * Now clean up internal cache fields if appropriate. */ diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 26b6506..51de5c4 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1494,7 +1494,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) * if the underlying file alignment is greater than 1. * * Clean this up eventually by extending the size of the cache - * image block to the next alignment boundary, and then setting + * image block to the next alignement boundary, and then setting * the image_data_len to the actual size of the cache_image. * * On the off chance that there is some other way to get a @@ -1554,7 +1554,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) * metadata cache image superblock extension message, set * cache_ptr->image_ctl.generate_image to FALSE. This will * allow the file close to continue normally without the - * unnecessary generation of the metadata cache image. + * unecessary generation of the metadata cache image. */ if(cache_ptr->num_entries_in_image > 0) { if(H5C__prep_for_file_close__setup_image_entries_array(cache_ptr) < 0) diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index ecaed62..e342d69 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -380,7 +380,7 @@ H5C_apply_candidate_list(H5F_t * f, * Note that we are doing things in this round about manner so as * to preserve the order of the LRU list to the best of our ability. * If we don't do this, my experiments indicate that we will have a - * noticeably poorer hit ratio as a result. + * noticably poorer hit ratio as a result. */ if(H5C__flush_candidate_entries(f, entries_to_flush, entries_to_clear) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates failed") diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 98d7a01..c5dc8f3 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -58,7 +58,7 @@ * We maintain doubly linked lists of instances of H5C_cache_entry_t for a * variety of reasons -- protected list, LRU list, and the clean and dirty * LRU lists at present. The following macros support linking and unlinking - * of instances of H5C_cache_entry_t by both their regular and auxiliary next + * of instances of H5C_cache_entry_t by both their regular and auxilary next * and previous pointers. * * The size and length fields are also maintained. @@ -2006,7 +2006,7 @@ if ( ( (cache_ptr)->index_size != \ * a bit more performance out of the cache. * * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with + * white space in the macro. If they cause dificulties with * the pre-processor, I'll have to remove them. * * JRM - 7/28/04 @@ -2117,7 +2117,7 @@ if ( ( (cache_ptr)->index_size != \ * a bit more performance out of the cache. * * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with + * white space in the macro. If they cause dificulties with * pre-processor, I'll have to remove them. * * JRM - 7/28/04 @@ -2375,7 +2375,7 @@ if ( ( (cache_ptr)->index_size != \ * a bit more performance out of the cache. * * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with + * white space in the macro. If they cause dificulties with * pre-processor, I'll have to remove them. * * JRM - 7/28/04 @@ -2513,7 +2513,7 @@ if ( ( (cache_ptr)->index_size != \ * a bit more performance out of the cache. * * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with + * white space in the macro. If they cause dificulties with * pre-processor, I'll have to remove them. * * JRM - 7/28/04 @@ -3057,7 +3057,7 @@ if ( ( (cache_ptr)->index_size != \ * squeeze a bit more performance out of the cache. * * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with + * white space in the macro. If they cause dificulties with * pre-processor, I'll have to remove them. * * JRM - 7/28/04 @@ -3892,7 +3892,7 @@ typedef struct H5C_tag_info_t { * 2) A pinned entry can be accessed or modified at any time. * This places an additional burden on the associated pre-serialize * and serialize callbacks, which must ensure the the entry is in - * a consistent state before creating an image of it. + * a consistant state before creating an image of it. * * 3) A pinned entry can be marked as dirty (and possibly * change size) while it is unprotected. @@ -4604,7 +4604,7 @@ typedef struct H5C_tag_info_t { * improper behavior if the next entry in the list is the target of one on * these operations. * - * The following fields are use to count such occurrences. They are used + * The following fields are use to count such occurances. They are used * both in tests (to verify that the scan has been restarted), and to * obtain estimates of how frequently these restarts occur. * @@ -4624,7 +4624,7 @@ typedef struct H5C_tag_info_t { * than the target entry as the result of call(s) to the * pre_serialize or serialize callbacks. * - * Note that at present, this condition can only be triggered + * Note that at present, this condition can only be triggerd * by a call to H5C_serialize_single_entry(). * * The remaining stats are collected only when both H5C_COLLECT_CACHE_STATS diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 38a86ee..522b3cf 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -87,7 +87,7 @@ #define H5C__MIN_MAX_CACHE_SIZE ((size_t)(1024)) /* Default max cache size and min clean size are give here to make - * them generally accessible. + * them generally accessable. */ #define H5C__DEFAULT_MAX_CACHE_SIZE ((size_t)(4 * 1024 * 1024)) #define H5C__DEFAULT_MIN_CLEAN_SIZE ((size_t)(2 * 1024 * 1024)) @@ -901,7 +901,7 @@ typedef struct H5C_class_t { H5C_get_fsf_size_t fsf_size; } H5C_class_t; -/* Type definitions of callback functions used by the cache as a whole */ +/* Type defintions of callback functions used by the cache as a whole */ typedef herr_t (*H5C_write_permitted_func_t)(const H5F_t *f, hbool_t *write_permitted_ptr); typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr, @@ -925,7 +925,7 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr, * flush dependency -- with the implied setup and takedown overhead and * added complexity. Further, the flush ordering between rings need only * be enforced on flush operations, and thus the use of flush dependencies - * instead would apply unnecessary constraints on flushes under normal + * instead would apply unecessary constraints on flushes under normal * operating circumstances. * * As of this writing, all metadata entries pretaining to data sets and @@ -1092,7 +1092,7 @@ typedef int H5C_ring_t; * 2) A pinned entry can be accessed or modified at any time. * This places an extra burden on the pre-serialize and * serialize callbacks, which must ensure that a pinned - * entry is consistent and ready to write to disk before + * entry is consistant and ready to write to disk before * generating an image. * * 3) A pinned entry can be marked as dirty (and possibly @@ -1152,7 +1152,7 @@ typedef int H5C_ring_t; * flush_immediately: Boolean flag used only in Phdf5 -- and then only * for H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED. * - * When a distributed metadata write is triggered at a + * When a destributed metadata write is triggered at a * sync point, this field is used to mark entries that * must be flushed before leaving the sync point. At all * other times, this field should be set to FALSE. @@ -1430,7 +1430,7 @@ typedef int H5C_ring_t; * The flush dependency height of any entry involved in a * flush dependency relationship is defined to be the * longest flush dependency path from that entry to an entry - * with no flush dependency children. + * with no flush depenency children. * * Since the image_fd_height is used to order entries in the * cache image so that fd parents preceed fd children, for @@ -1468,8 +1468,8 @@ typedef int H5C_ring_t; * * Further, if the prefetched entry is a flush dependency parent, * all its flush dependency children (which must also be - * prefetched entries), must be transferred to the new cache - * entry returned by the deserialization callback. + * prefetched entries), must be tranfered to the new cache + * entry returned by the deserailization callback. * * Finally, if the prefetched entry is a flush dependency child, * this flush dependency must be destroyed prior to the @@ -1737,7 +1737,7 @@ typedef struct H5C_cache_entry_t { * The flush dependency height of any entry involved in a * flush dependency relationship is defined to be the * longest flush dependency path from that entry to an entry - * with no flush dependency children. + * with no flush depenency children. * * Since the image_fd_height is used to order entries in the * cache image so that fd parents preceed fd children, for @@ -1946,7 +1946,7 @@ typedef struct H5C_image_entry_t { * * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated * type whose value indicates whether and by what algorithm we should - * make flash increases in the size of the cache to accommodate insertion + * make flash increases in the size of the cache to accomodate insertion * of large entries and large increases in the size of a single entry. * * The addition of the flash increment mode was occasioned by performance @@ -2182,9 +2182,9 @@ typedef struct H5C_auto_size_ctl_t { * current value, any value in excess of 255 will be the functional * equivalent of H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. * - * flags: Unsigned integer containing flags controlling which aspects of the + * flags: Unsigned integer containing flags controling which aspects of the * cache image functinality is actually executed. The primary impetus - * behind this field is to allow development of tests for partial + * behind this field is to allow developement of tests for partial * implementations that will require little if any modification to run * with the full implementation. In normal operation, all flags should * be set. diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 8abfe27..c23f089 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -666,13 +666,12 @@ done: static herr_t H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) { - const H5O_layout_chunk_t *layout; /* Chunk layout description */ - H5D_btree_key_t *key = (H5D_btree_key_t *) _key; /* Pointer to decoded key */ - hsize_t tmp_offset; /* Temporary coordinate offset, from file */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5O_layout_chunk_t *layout; /* Chunk layout description */ + H5D_btree_key_t *key = (H5D_btree_key_t *) _key; /* Pointer to decoded key */ + hsize_t tmp_offset; /* Temporary coordinate offset, from file */ + unsigned u; /* Local index variable */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(shared); @@ -685,21 +684,16 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key /* decode */ UINT32DECODE(raw, key->nbytes); UINT32DECODE(raw, key->filter_mask); - for(u = 0; u < layout->ndims; u++) - { - if (layout->dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) - + for(u = 0; u < layout->ndims; u++) { /* Retrieve coordinate offset */ - UINT64DECODE(raw, tmp_offset); + UINT64DECODE(raw, tmp_offset); HDassert(0 == (tmp_offset % layout->dim[u])); /* Convert to a scaled offset */ key->scaled[u] = tmp_offset / layout->dim[u]; } /* end for */ -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__btree_decode_key() */ diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index d60e79e..f9074be 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -378,7 +378,7 @@ H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx) { H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ - unsigned u; /* Local index variable */ + unsigned u; /* Local index varible */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4906f3c..d45ced0 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -695,7 +695,7 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, /* Compute the # of chunks in dataset dimensions */ for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) { - /* Round up to the next integer # of chunks, to accommodate partial chunks */ + /* Round up to the next integer # of chunks, to accomodate partial chunks */ layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; if(H5S_UNLIMITED == max_dims[u]) layout->max_chunks[u] = H5S_UNLIMITED; @@ -947,8 +947,6 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */ /* Initial scaled dimension sizes */ - if(dset->shared->layout.u.chunk.dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) rdcc->scaled_dims[u] = dset->shared->curr_dims[u] / dset->shared->layout.u.chunk.dim[u]; if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) ) @@ -1933,7 +1931,7 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, coords_in_chunk[u] = coords[u] - (scaled[u] * fm->layout->u.chunk.dim[u]); /* Add point to file selection for chunk */ - if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, coords_in_chunk) < 0) + if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (hsize_t)1, coords_in_chunk) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element") /* Increment the number of elemented selected in chunk */ @@ -2013,7 +2011,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u } /* end else */ /* Move memory selection iterator to next element in selection */ - if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0) + if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (hsize_t)1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location") done: @@ -2935,41 +2933,8 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5F_set_coll_md_read(idx_info.f, temp_cmr); #endif /* H5_HAVE_PARALLEL */ - /* - * Cache the information retrieved. - * - * Note that if we are writing to the dataset in parallel and filters - * are involved, we skip caching this information as it is highly likely - * that the chunk information will be invalidated as a result of the - * filter operation (e.g. the chunk gets re-allocated to a different - * address in the file and/or gets re-allocated with a different size). - * If we were to cache this information, subsequent reads/writes would - * retrieve the invalid information and cause a variety of issues. - * - * It has been verified that in the serial library, when writing to chunks - * with the real chunk cache disabled and with filters involved, the - * functions within this file are correctly called in such a manner that - * this single chunk cache is always updated correctly. Therefore, this - * check is not needed for the serial library. - * - * This is an ugly and potentially frail check, but the - * H5D__chunk_cinfo_cache_reset() function is not currently available - * to functions outside of this file, so outside functions can not - * invalidate this single chunk cache. Even if the function were available, - * this check prevents us from doing the work of going through and caching - * each chunk in the write operation, when we're only going to invalidate - * the cache at the end of a parallel write anyway. - * - * - JTH (7/13/2018) - */ -#ifdef H5_HAVE_PARALLEL - if ( !( (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) - && (H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) - && dset->shared->dcpl_cache.pline.nused - ) - ) -#endif - H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, udata); + /* Cache the information retrieved */ + H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, udata); } /* end if */ } /* end else */ @@ -3051,7 +3016,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) } /* end if */ else { /* - * If we are resetting and something goes wrong after this + * If we are reseting and something goes wrong after this * point then it's too late to recover because we may have * destroyed the original data by calling H5Z_pipeline(). * The only safe option is to continue with the reset @@ -4484,7 +4449,7 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) /* Start off with this dimension marked as not needing to be modified */ new_full_dim[op_dim] = FALSE; - /* Calculate offset of first previously incomplete chunk in this + /* Calulate offset of first previously incomplete chunk in this * dimension */ old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]); @@ -5005,7 +4970,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) HGOTO_DONE(SUCCEED) } /* end if */ - /* Round up to the next integer # of chunks, to accommodate partial chunks */ + /* Round up to the next integer # of chunks, to accomodate partial chunks */ /* Use current dims because the indices have already been updated! -NAF */ /* (also compute the number of elements per chunk) */ /* (also copy the chunk dimensions into 'hsize_t' array for creating dataspace) */ diff --git a/src/H5Dint.c b/src/H5Dint.c index e8874a2..d08adbe 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -604,7 +604,7 @@ H5D__cache_dataspace_info(const H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't cache dataspace dimensions") dset->shared->ndims = (unsigned)sndims; - /* Compute the initial 'power2up' values */ + /* Compute the inital 'power2up' values */ for(u = 0; u < dset->shared->ndims; u++) { hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */ @@ -782,7 +782,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */ /* Shallow copy the fill value property */ - /* (we only want to make certain that the shared component isn't modified) */ + /* (we only want to make certain that the shared component isnt' modified) */ HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop)); /* Reset shared component info */ @@ -2506,7 +2506,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") /* Select point to read in */ - if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (hsize_t)1, point) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ @@ -2580,11 +2580,10 @@ done: herr_t H5D__set_extent(H5D_t *dset, const hsize_t *size) { - hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ - htri_t changed; /* Whether the dataspace changed size */ - size_t u, v; /* Local index variable */ - unsigned dim_idx; /* Dimension index */ - herr_t ret_value = SUCCEED; /* Return value */ + hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ + htri_t changed; /* Whether the dataspace changed size */ + size_t u, v; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) @@ -2621,11 +2620,11 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) hbool_t update_chunks = FALSE; /* Flag to indicate chunk cache update is needed */ /* Determine if we are shrinking and/or expanding any dimensions */ - for(dim_idx = 0; dim_idx < dset->shared->ndims; dim_idx++) { + for(u = 0; u < (size_t)dset->shared->ndims; u++) { /* Check for various status changes */ - if(size[dim_idx] < curr_dims[dim_idx]) + if(size[u] < curr_dims[u]) shrink = TRUE; - if(size[dim_idx] > curr_dims[dim_idx]) + if(size[u] > curr_dims[u]) expand = TRUE; /* Chunked storage specific checks */ @@ -2633,33 +2632,30 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) hsize_t scaled; /* Scaled value */ /* Compute the scaled dimension size value */ - if(dset->shared->layout.u.chunk.dim[dim_idx] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", dim_idx) - - scaled = size[dim_idx] / dset->shared->layout.u.chunk.dim[dim_idx]; + scaled = size[u] / dset->shared->layout.u.chunk.dim[u]; /* Check if scaled dimension size changed */ - if(scaled != dset->shared->cache.chunk.scaled_dims[dim_idx]) { + if(scaled != dset->shared->cache.chunk.scaled_dims[u]) { hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */ /* Update the scaled dimension size value for the current dimension */ - dset->shared->cache.chunk.scaled_dims[dim_idx] = scaled; + dset->shared->cache.chunk.scaled_dims[u] = scaled; /* Check if algorithm for computing hash values will change */ if((scaled > dset->shared->cache.chunk.nslots && - dset->shared->cache.chunk.scaled_dims[dim_idx] <= dset->shared->cache.chunk.nslots) + dset->shared->cache.chunk.scaled_dims[u] <= dset->shared->cache.chunk.nslots) || (scaled <= dset->shared->cache.chunk.nslots && - dset->shared->cache.chunk.scaled_dims[dim_idx] > dset->shared->cache.chunk.nslots)) + dset->shared->cache.chunk.scaled_dims[u] > dset->shared->cache.chunk.nslots)) update_chunks = TRUE; if(!(scaled_power2up = H5VM_power2up(scaled))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") /* Check if the number of bits required to encode the scaled size value changed */ - if(dset->shared->cache.chunk.scaled_power2up[dim_idx] != scaled_power2up) { + if(dset->shared->cache.chunk.scaled_power2up[u] != scaled_power2up) { /* Update the 'power2up' & 'encode_bits' values for the current dimension */ - dset->shared->cache.chunk.scaled_power2up[dim_idx] = scaled_power2up; - dset->shared->cache.chunk.scaled_encode_bits[dim_idx] = H5VM_log2_gen(scaled_power2up); + dset->shared->cache.chunk.scaled_power2up[u] = scaled_power2up; + dset->shared->cache.chunk.scaled_encode_bits[u] = H5VM_log2_gen(scaled_power2up); /* Indicate that the cached chunk indices need to be updated */ update_chunks = TRUE; @@ -2668,7 +2664,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) } /* end if */ /* Update the cached copy of the dataset's dimensions */ - dset->shared->curr_dims[dim_idx] = size[dim_idx]; + dset->shared->curr_dims[u] = size[u]; } /* end for */ /*------------------------------------------------------------------------- diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index d721ae6..e621e04 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -234,7 +234,7 @@ static herr_t H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info H5D_filtered_collective_io_info_t *local_chunk_array, size_t *local_chunk_array_num_entries); static herr_t H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries, size_t array_entry_size, void **gathered_array, size_t *gathered_array_num_entries, - hbool_t allgather, int root, MPI_Comm comm, int (*sort_func)(const void *, const void *)); + int nprocs, hbool_t allgather, int root, MPI_Comm comm, int (*sort_func)(const void *, const void *)); static herr_t H5D__mpio_filtered_collective_write_type( H5D_filtered_collective_io_info_t *chunk_list, size_t num_entries, MPI_Datatype *new_mem_type, hbool_t *mem_type_derived, @@ -418,16 +418,19 @@ done: * Function: H5D__mpio_array_gatherv * * Purpose: Given an array, specified in local_array, by each processor - * calling this function, collects each array into a single + * calling this function, gathers each array into a single * array which is then either gathered to the processor * specified by root, when allgather is false, or is * distributed back to all processors when allgather is true. * - * The number of entries in the array contributed by an - * individual processor and the size of each entry should be - * specified in local_array_num_entries and array_entry_size, + * The size of each entry and number of entries in the array + * contributed by an individual processor should be specified + * in array_entry_size and local_array_num_entries, * respectively. * + * The number of processors participating in the gather + * operation should be specified for nprocs. + * * The MPI communicator to use should be specified for comm. * * If the sort_func argument is supplied, the array is sorted @@ -445,13 +448,14 @@ done: static herr_t H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries, size_t array_entry_size, void **_gathered_array, size_t *_gathered_array_num_entries, - hbool_t allgather, int root, MPI_Comm comm, int (*sort_func)(const void *, const void *)) + int nprocs, hbool_t allgather, int root, MPI_Comm comm, int (*sort_func)(const void *, const void *)) { size_t gathered_array_num_entries = 0; /* The size of the newly-constructed array */ + size_t i; void *gathered_array = NULL; /* The newly-constructed array returned to the caller */ - int *receive_counts_array = NULL; /* Array containing number of entries each processor is contributing */ - int *displacements_array = NULL; /* Array of displacements where each processor places its data in the final array */ - int mpi_code, mpi_rank, mpi_size; + int *receive_counts_array = NULL; /* Array containing number of entries each process is contributing */ + int *displacements_array = NULL; /* Array of displacements where each process places its data in the final array */ + int mpi_code; int sendcount; herr_t ret_value = SUCCEED; @@ -460,62 +464,34 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries, HDassert(_gathered_array); HDassert(_gathered_array_num_entries); - MPI_Comm_size(comm, &mpi_size); - MPI_Comm_rank(comm, &mpi_rank); - - /* - * Determine the size of the end result array by collecting the number - * of entries contributed by each processor into a single total. - */ + /* Determine the size of the end result array */ if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1, MPI_INT, MPI_SUM, comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code) - /* If 0 entries resulted from the collective operation, no processor is contributing anything and there is nothing to do */ + /* If 0 entries resulted from the collective operation, no one is writing anything */ if (gathered_array_num_entries > 0) { - /* - * If gathering to all processors, all processors need to allocate space for the resulting array, as well as - * the receive counts and displacements arrays for the collective MPI_Allgatherv call. Otherwise, only the - * root processor needs to allocate the space for an MPI_Gatherv call. - */ - if (allgather || (mpi_rank == root)) { - if (NULL == (gathered_array = H5MM_malloc(gathered_array_num_entries * array_entry_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate gathered array") + if (NULL == (gathered_array = H5MM_malloc(gathered_array_num_entries * array_entry_size))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate gathered array") - if (NULL == (receive_counts_array = (int *) H5MM_malloc((size_t) mpi_size * sizeof(int)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate receive counts array") + if (NULL == (receive_counts_array = (int *) H5MM_malloc((size_t) nprocs * sizeof(int)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate receive counts array") - if (NULL == (displacements_array = (int *) H5MM_malloc((size_t) mpi_size * sizeof(int)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate receive displacements array") - } /* end if */ + if (NULL == (displacements_array = (int *) H5MM_malloc((size_t) nprocs * sizeof(int)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate receive displacements array") - /* - * If gathering to all processors, inform each processor of how many entries each other processor is - * contributing to the resulting array by collecting the counts into each processor's "receive counts" - * array. Otherwise, inform only the root processor of how many entries each other processor is contributing. - */ - if (allgather) { - if (MPI_SUCCESS != (mpi_code = MPI_Allgather(&local_array_num_entries, 1, MPI_INT, receive_counts_array, 1, MPI_INT, comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Allgather failed", mpi_code) - } /* end if */ - else { - if (MPI_SUCCESS != (mpi_code = MPI_Gather(&local_array_num_entries, 1, MPI_INT, receive_counts_array, 1, MPI_INT, root, comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Gather failed", mpi_code) - } /* end else */ + /* Inform each process of how many entries each other process is contributing to the resulting array */ + if (MPI_SUCCESS != (mpi_code = MPI_Allgather(&local_array_num_entries, 1, MPI_INT, receive_counts_array, 1, MPI_INT, comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Allgather failed", mpi_code) - if (allgather || (mpi_rank == root)) { - size_t i; + /* Multiply each receive count by the size of the array entry, since the data is sent as bytes */ + for (i = 0; i < (size_t) nprocs; i++) + H5_CHECKED_ASSIGN(receive_counts_array[i], int, (size_t) receive_counts_array[i] * array_entry_size, size_t); - /* Multiply each receive count by the size of the array entry, since the data is sent as bytes. */ - for (i = 0; i < (size_t) mpi_size; i++) - H5_CHECKED_ASSIGN(receive_counts_array[i], int, (size_t) receive_counts_array[i] * array_entry_size, size_t); + /* Set receive buffer offsets for MPI_Allgatherv */ + displacements_array[0] = 0; + for (i = 1; i < (size_t) nprocs; i++) + displacements_array[i] = displacements_array[i - 1] + receive_counts_array[i - 1]; - /* Set receive buffer offsets for the collective MPI_Allgatherv/MPI_Gatherv call. */ - displacements_array[0] = 0; - for (i = 1; i < (size_t) mpi_size; i++) - displacements_array[i] = displacements_array[i - 1] + receive_counts_array[i - 1]; - } /* end if */ - - /* As the data is sent as bytes, calculate the true sendcount for the data. */ H5_CHECKED_ASSIGN(sendcount, int, local_array_num_entries * array_entry_size, size_t); if (allgather) { @@ -526,11 +502,10 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries, else { if (MPI_SUCCESS != (mpi_code = MPI_Gatherv(local_array, sendcount, MPI_BYTE, gathered_array, receive_counts_array, displacements_array, MPI_BYTE, root, comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Gatherv failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_Allgatherv failed", mpi_code) } /* end else */ - if (sort_func && (allgather || (mpi_rank == root))) - HDqsort(gathered_array, gathered_array_num_entries, array_entry_size, sort_func); + if (sort_func) HDqsort(gathered_array, gathered_array_num_entries, array_entry_size, sort_func); } /* end if */ *_gathered_array = gathered_array; @@ -731,7 +706,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf io_option = H5D_MULTI_CHUNK_IO; /* via default path. branch by num threshold */ else { - unsigned one_link_chunk_io_threshold; /* Threshold to use single collective I/O for all chunks */ + unsigned one_link_chunk_io_threshold; /* Threshhold to use single collective I/O for all chunks */ int mpi_size; /* Number of processes in MPI job */ if(H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0) @@ -1320,7 +1295,8 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in * of the chunks in the file. */ if (H5D__mpio_array_gatherv(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t), - (void **) &collective_chunk_list, &collective_chunk_list_num_entries, true, 0, io_info->comm, NULL) < 0) + (void **) &collective_chunk_list, &collective_chunk_list_num_entries, mpi_size, + true, 0, io_info->comm, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather new chunk sizes") /* Collectively re-allocate the modified chunks (from each process) in the file */ @@ -1792,7 +1768,8 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i * of the chunks in the file */ if (H5D__mpio_array_gatherv(&chunk_list[i], have_chunk_to_process ? 1 : 0, sizeof(H5D_filtered_collective_io_info_t), - (void **) &collective_chunk_list, &collective_chunk_list_num_entries, true, 0, io_info->comm, NULL) < 0) + (void **) &collective_chunk_list, &collective_chunk_list_num_entries, mpi_size, + true, 0, io_info->comm, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather new chunk sizes") /* Participate in the collective re-allocation of all chunks modified @@ -2653,6 +2630,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty int *send_displacements = NULL; int scatter_recvcount_int; int mpi_rank, mpi_size, mpi_code; + hid_t fapl_id = -1; /* File access property list for H5S_encode() */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -2667,6 +2645,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") + if((fapl_id = H5F_get_access_plist(io_info->dset->oloc.file, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl") + if (*local_chunk_array_num_entries) if (NULL == (send_requests = (MPI_Request *) H5MM_malloc(*local_chunk_array_num_entries * sizeof(MPI_Request)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate send requests buffer") @@ -2678,8 +2659,8 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty * call, the gathered list will initially be sorted in increasing order of chunk offset in the file. */ if (H5D__mpio_array_gatherv(local_chunk_array, *local_chunk_array_num_entries, sizeof(H5D_filtered_collective_io_info_t), - (void **) &shared_chunks_info_array, &shared_chunks_info_array_num_entries, false, 0, - io_info->comm, H5D__cmp_filtered_collective_io_info_entry) < 0) + (void **) &shared_chunks_info_array, &shared_chunks_info_array_num_entries, mpi_size, + false, 0, io_info->comm, H5D__cmp_filtered_collective_io_info_entry) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather array") /* Rank 0 redistributes any shared chunks to new owners as necessary */ @@ -2772,7 +2753,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Determine size of serialized chunk file dataspace, plus the size of * the data being written */ - if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) + if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size, fapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size") if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) @@ -2785,10 +2766,10 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Serialize the chunk's file dataspace into the buffer */ mod_data_p = mod_data[num_send_requests]; - if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) + if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size, fapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace") - /* Initialize iterator for memory selection */ + /* Intialize iterator for memory selection */ if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") mem_iter_init = TRUE; @@ -3004,7 +2985,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk { H5D_chunk_info_t *chunk_info = NULL; H5S_sel_iter_t *mem_iter = NULL; /* Memory iterator for H5D__scatter_mem/H5D__gather_mem */ - H5S_sel_iter_t *file_iter = NULL; + unsigned char *mod_data = NULL; /* Chunk modification data sent by a process to a chunk's owner */ H5Z_EDC_t err_detect; /* Error detection info */ H5Z_cb_t filter_cb; /* I/O filter callback function */ unsigned filter_mask = 0; @@ -3012,13 +2993,11 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk hssize_t extent_npoints; hsize_t true_chunk_size; hbool_t mem_iter_init = FALSE; - hbool_t file_iter_init = FALSE; size_t buf_size; size_t i; H5S_t *dataspace = NULL; /* Other process' dataspace for the chunk */ - void *tmp_gath_buf = NULL; /* Temporary gather buffer to gather into from application buffer - before scattering out to the chunk data buffer (when writing data), - or vice versa (when reading data) */ + void *tmp_gath_buf = NULL; /* Temporary gather buffer for owner of the chunk to gather into from + application write buffer before scattering out to the chunk data buffer */ int mpi_code; herr_t ret_value = SUCCEED; @@ -3098,6 +3077,9 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") mem_iter_init = TRUE; + if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + /* If this is a read operation, scatter the read chunk data to the user's buffer. * * If this is a write operation, update the chunk data buffer with the modifications @@ -3106,39 +3088,16 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk */ switch (io_info->op_type) { case H5D_IO_OP_READ: - if (NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate file iterator") - - if (H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") - file_iter_init = TRUE; - - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - - if (NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer") - - if (!H5D__gather_mem(chunk_entry->buf, chunk_info->fspace, file_iter, (size_t) iter_nelmts, tmp_gath_buf)) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't gather from chunk buffer") - - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - - if (H5D__scatter_mem(tmp_gath_buf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer") - + if (H5D__scatter_mem(chunk_entry->buf, chunk_info->mspace, mem_iter, (size_t)iter_nelmts, io_info->u.rbuf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer") break; case H5D_IO_OP_WRITE: - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - if (NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer") /* Gather modification data from the application write buffer into a temporary buffer */ - if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, tmp_gath_buf)) + if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t)iter_nelmts, tmp_gath_buf)) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't gather from write buffer") if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) @@ -3156,7 +3115,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk /* Scatter the owner's modification data into the chunk data buffer according to * the file space. */ - if(H5D__scatter_mem(tmp_gath_buf, chunk_info->fspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0) + if(H5D__scatter_mem(tmp_gath_buf, chunk_info->fspace, mem_iter, (size_t)iter_nelmts, chunk_entry->buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to chunk data buffer") if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) @@ -3222,12 +3181,10 @@ done: H5MM_free(chunk_entry->async_info.receive_buffer_array); if (chunk_entry->async_info.receive_requests_array) H5MM_free(chunk_entry->async_info.receive_requests_array); + if (mod_data) + H5MM_free(mod_data); if (tmp_gath_buf) H5MM_free(tmp_gath_buf); - if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator") - if (file_iter) - H5MM_free(file_iter); if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator") if (mem_iter) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 7f1ac86..d80e086 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -417,6 +417,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) hsize_t tmp_nentries; /* Temp. variable for # of VDS entries */ uint32_t chksum; /* Checksum for heap data */ size_t i; /* Local index variable */ + H5P_genplist_t *fapl_plist; /* The file access property list */ + hid_t new_fapl_id; /* The file access property list ID */ + H5F_libver_t low_bound = H5F_LIBVER_V110; /* Set the low bound in fapl to latest */ + H5F_libver_t high_bound = H5F_LIBVER_V110; /* Set the high bound in fapl to latest */ + H5F_t *tmp_f = NULL; /* Pointer to faked file structure */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -428,6 +433,24 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Create block if # of used entries > 0 */ if(layout->storage.u.virt.list_nused > 0) { + + /* Make a copy of the default file access property list */ + if(NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Set latest format in fapl_plist for virtual layout encoding */ + if(H5P_set(fapl_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low_bound) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions") + if(H5P_set(fapl_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high_bound) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions") + /* Copy and return the fapl id */ + if((new_fapl_id = H5P_copy_plist(fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") + + /* Allocate "fake" file structure with the fapl setting */ + if(NULL == (tmp_f = H5F_fake_alloc((uint8_t)0, new_fapl_id))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") + /* Allocate array for caching results of strlen */ if(NULL == (str_size = (size_t *)H5MM_malloc(2 * layout->storage.u.virt.list_nused * sizeof(size_t)))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array") @@ -457,12 +480,12 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) block_size += str_size[(2 * i) + 1]; /* Source selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_select, tmp_f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; /* Virtual dataset selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_dset.virtual_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, tmp_f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; } /* end for */ @@ -499,11 +522,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) heap_block_p += str_size[(2 * i) + 1]; /* Source selection */ - if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_select, &heap_block_p, tmp_f) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection") /* Virtual selection */ - if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p, tmp_f) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection") } /* end for */ @@ -517,9 +540,14 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) } /* end if */ done: + /* Release fake file structure */ + if(tmp_f && H5F_fake_free(tmp_f) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release fake file struct") + heap_block = (uint8_t *)H5MM_xfree(heap_block); str_size = (size_t *)H5MM_xfree(str_size); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_store_layout() */ @@ -796,7 +824,7 @@ H5D__virtual_copy(H5F_t *f_dst, H5O_layout_t *layout_dst) if(f_dst == f_src) { /* Increase reference count on global heap object */ if((heap_rc = H5HG_link(f_dst, (H5HG_t *)&(layout_dst->u.virt.serial_list_hobjid), 1)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap reference count") + HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap refence count") } /* end if */ else #endif /* NOT_YET */ @@ -847,7 +875,7 @@ H5D__virtual_delete(H5F_t *f, H5O_storage_t *storage) #ifdef NOT_YET /* Unlink the global heap block */ if((heap_rc = H5HG_link(f, (H5HG_t *)&(storage->u.virt.serial_list_hobjid), -1)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap reference count") + HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap refence count") if(heap_rc == 0) #endif /* NOT_YET */ /* Delete the global heap block */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index fc3eb9c..9ff9f1f 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -227,7 +227,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eclear1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Clears the error stack for the specified error stack. * * Return: Non-negative on success/Negative on failure @@ -258,7 +258,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eprint1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Prints the error stack in some default way. This is just a * convenience function for H5Ewalk() with a function that * prints error messages. Users are encouraged to write there @@ -296,7 +296,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Ewalk1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Walks the error stack for the current thread and calls some * function for each error along the way. * @@ -335,7 +335,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eget_auto1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Returns the current settings for the automatic error stack * traversal function and its data for specific error stack. * Either (or both) arguments may be null in which case the @@ -386,7 +386,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eset_auto1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Turns on or off automatic printing of errors for certain * error stack. When turned on (non-null FUNC pointer) any * API function which returns an error indication will first diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 906ec28..811ea8e 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -951,7 +951,7 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN do { /* Read the aligned data in file first. Not able to handle interrupted * system calls and partial results like sec2 driver does because the - * data may no longer be aligned. It's especially true when the data in + * data may no longer be aligned. It's expecially true when the data in * file is smaller than ALLOC_SIZE. */ HDmemset(copy_buf, 0, alloc_size); @@ -1138,9 +1138,9 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U /* * Read the aligned data first if the aligned region doesn't fall - * entirely in the range to be written. Not able to handle interrupted + * entirely in the range to be writen. Not able to handle interrupted * system calls and partial results like sec2 driver does because the - * data may no longer be aligned. It's especially true when the data in + * data may no longer be aligned. It's expecially true when the data in * file is smaller than ALLOC_SIZE. Only read the entire section if * both ends are misaligned, otherwise only read the block on the * misaligned end. diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index e52a71a..3c1c7bb 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -548,7 +548,7 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out* /*------------------------------------------------------------------------- * Function: H5FD_family_sb_decode * - * Purpose: This function has 2 separate purpose. One is to decodes the + * Purpose: This function has 2 seperate purpose. One is to decodes the * superblock information for this driver. The NAME argument is * the eight-character (plus null termination) name stored in i * the file. The FILE argument is updated according to the diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 87f8b6a..ee3277d 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1462,7 +1462,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, /* Only look for MPI views for raw data transfers */ if(type == H5FD_MEM_DRAW) { - H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ + H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ /* Get the transfer mode from the API context */ if(H5CX_get_io_xfer_mode(&xfer_mode) < 0) @@ -1717,7 +1717,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, #endif int size_i; hbool_t use_view_this_time = FALSE; - H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ + H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index aa1b118..8ae23d2 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -263,7 +263,7 @@ H5FD_multi_term(void) /*------------------------------------------------------------------------- * Function: H5Pset_fapl_split * - * Purpose: Compatibility function. Makes the multi driver act like the + * Purpose: Compatability function. Makes the multi driver act like the * old split driver which stored meta data in one file and raw * data in another file. * @@ -18,7 +18,7 @@ * Purpose: Manage priority queues of free-lists (of blocks of bytes). * These are used in various places in the library which allocate and * free differently blocks of bytes repeatedly. Usually the same size - * of block is allocated and freed repeatedly in a loop, while writing out + * of block is allocated and freed repeatly in a loop, while writing out * chunked data for example, but the blocks may also be of different sizes * from different datasets and an attempt is made to optimize access to * the proper free list of blocks by using these priority queues to @@ -499,7 +499,7 @@ H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Clear to zeros */ - /* (Accommodate tracking information, if present) */ + /* (Accomodate tracking information, if present) */ HDmemset(ret_value,0,head->size - H5FL_TRACK_SIZE); done: @@ -2220,7 +2220,7 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Clear to zeros */ - /* (Accommodate tracking information, if present) */ + /* (Accomodate tracking information, if present) */ HDmemset(ret_value,0,head->size - H5FL_TRACK_SIZE); done: @@ -135,7 +135,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl fspace->alignment = alignment; fspace->align_thres = threshold; - /* Check if the free space tracker is supposed to be persistent */ + /* Check if the free space tracker is supposed to be persistant */ if(fs_addr) { /* Allocate space for the free space header */ if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, (hsize_t)fspace->hdr_size))) @@ -423,7 +423,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu, fspace->serial_sect_count = HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_DEBUG */ /* If there are sections to serialize, update them */ - /* (if the free space manager is persistent) */ + /* (if the free space manager is persistant) */ if(fspace->serial_sect_count > 0 && H5F_addr_defined(fspace->addr)) { #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); @@ -794,7 +794,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); /* Sanity check */ HDassert(fspace); - /* Check if the free space manager is persistent */ + /* Check if the free space manager is persistant */ if(H5F_addr_defined(fspace->addr)) /* Mark header as dirty in cache */ if(H5AC_mark_entry_dirty(fspace) < 0) @@ -883,7 +883,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") /* Since space has been allocated for the section info and the sinfo - * has been inserted into the cache, relinquish ownership (i.e. float) + * has been inserted into the cache, relinquish owership (i.e. float) * the section info. */ fspace->sinfo = NULL; diff --git a/src/H5FScache.c b/src/H5FScache.c index fa04ba1..875a383 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -457,7 +457,7 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, * H5F_addr_defined(fspace->addr) * * will both be TRUE. If this contition does not hold, then - * either the free space info is not persistent + * either the free space info is not persistant * (!H5F_addr_defined(fspace->addr)???) or the section info * contains no free space data that must be written to file * ( fspace->serial_sect_count == 0 ). @@ -487,7 +487,7 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, * * Case 1) If either fspace->serial_sect_count == 0 or * ! H5F_addr_defined(fspace->addr) do nothing as either - * the free space manager data is not persistent, or the + * the free space manager data is not persistant, or the * section info is empty. * * Otherwise, allocate space for the section info in real @@ -1454,7 +1454,7 @@ H5FS__sinfo_serialize_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat /* Call 'serialize' callback for this section */ if(sect_cls->serialize) { if((*sect_cls->serialize)(sect_cls, sect, *udata->image) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSERIALIZE, FAIL, "can't synchronize section") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSERIALIZE, FAIL, "can't syncronize section") /* Update offset in serialization buffer */ (*udata->image) += sect_cls->serial_size; diff --git a/src/H5FSsection.c b/src/H5FSsection.c index a58347f..11cd722 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -2432,7 +2432,7 @@ done: * returns to 1) above. * * Similarly, if it allocates space for its own header, it - * can go into an infinite loop as it: + * can go into an infinte loop as it: * * 1) allocates space for the header * @@ -2479,7 +2479,7 @@ done: * enabled when the free space managers are read. To allow * for this, we must ensure that space allocated for the * free space manager header and section info is either larger - * than a page, or resides completely within a page. + * than a page, or resides completely withing a page. * * Do this by allocating space for the free space header and * section info starting at page boundaries, and extending @@ -2532,7 +2532,7 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, HDassert(fspace->sect_addr == HADDR_UNDEF); HDassert(fspace->alloc_sect_size == 0); - /* persistent free space managers must be enabled */ + /* persistant free space managers must be enabled */ HDassert(f->shared->fs_persist); /* At present, all free space strategies enable the free space managers. @@ -2576,7 +2576,7 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, f, hdr_alloc_size, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate file space for hdr") - /* if the file alignment is 1, there should be no + /* if the file alignement is 1, there should be no * eoa fragment. Otherwise, drop any fragment on the floor. */ HDassert((eoa_frag_size == 0) || (f->shared->alignment != 1)); @@ -2616,7 +2616,7 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, f, sinfo_alloc_size, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTALLOC, FAIL, "can't allocate file space") - /* if the file alignment is 1, there should be no + /* if the file alignement is 1, there should be no * eoa fragment. Otherwise, drop the fragment on the floor. */ HDassert((eoa_frag_size == 0) || (f->shared->alignment != 1)); @@ -2637,7 +2637,7 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, * On reflection, no. * * On a regular file close, any eviction will not change the - * the contents of the free space manager(s), as all entries + * the contents of the free space manger(s), as all entries * should have correct file space allocated by the time this * function is called. * @@ -2658,7 +2658,7 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* since space has been allocated for the section info and the sinfo - * has been inserted into the cache, relinquish ownership (i.e. float) + * has been inserted into the cache, relinquish owership (i.e. float) * the section info. */ fspace->sinfo = NULL; diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 6417956..703c9cc 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -149,7 +149,7 @@ done: * Purpose: Enable switching between latest or non-latest format while * a file is open. * This is deprecated starting release 1.10.2 and is modified - * to call the private H5F_set_libver_bounds() to set the + * to call the private H5F__set_libver_bounds() to set the * bounds. * * Before release 1.10.2, the library supports only two diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 6072f2e..d199cf0 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -18,6 +18,8 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ /* PRIVATE PROTOTYPES */ @@ -40,9 +42,10 @@ *------------------------------------------------------------------------- */ H5F_t * -H5F_fake_alloc(uint8_t sizeof_size) +H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id) { H5F_t *f = NULL; /* Pointer to fake file struct */ + H5P_genplist_t *plist; /* Property list */ H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -59,6 +62,16 @@ H5F_fake_alloc(uint8_t sizeof_size) else f->shared->sizeof_size = sizeof_size; + /* Set low/high bounds according to the setting in fapl_id */ + /* See H5F_new() in H5Fint.c */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") + + if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &(f->shared->low_bound)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'low' bound for library format versions") + if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &(f->shared->high_bound)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'high' bound for library format versions") + /* Set return value */ ret_value = f; diff --git a/src/H5Fint.c b/src/H5Fint.c index abc638a..031f37c 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2762,7 +2762,7 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) /*------------------------------------------------------------------------- - * Function: H5F_set_libver_bounds() + * Function: H5F__set_libver_bounds() * * Purpose: Set the file's low and high bound to the input parameters * 'low' and 'high' respectively. @@ -2818,7 +2818,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_set_libver_bounds() */ +} /* H5F__set_libver_bounds() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2ab41de..f815005 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -321,7 +321,7 @@ struct H5F_file_t { haddr_t fs_addr[H5F_MEM_PAGE_NTYPES]; /* Address of free space manager info for each type */ H5FS_t *fs_man[H5F_MEM_PAGE_NTYPES]; /* Free space manager for each file space type */ hbool_t first_alloc_dealloc; /* TRUE iff free space managers */ - /* are persistent and have not */ + /* are persistant and have not */ /* been used accessed for either */ /* allocation or deallocation */ /* since file open. */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 979ba7d..fae962f 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -557,7 +557,7 @@ typedef struct H5F_t H5F_t; #define H5F_FILE_SPACE_PAGE_SIZE_DEF 4096 /* For paged aggregation: minimum value for file space page size */ #define H5F_FILE_SPACE_PAGE_SIZE_MIN 512 -/* For paged aggregation: maximum value for file space page size: 1 gigabyte */ +/* For paged aggregation: maxiumum value for file space page size: 1 gigabyte */ #define H5F_FILE_SPACE_PAGE_SIZE_MAX 1024*1024*1024 /* For paged aggregation: drop free-space with size <= this threshold for small meta section */ @@ -821,7 +821,7 @@ H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *ad H5_DLL void H5F_sfile_assert_num(unsigned n); /* Routines for creating & destroying "fake" file structures */ -H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size); +H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id); H5_DLL herr_t H5F_fake_free(H5F_t *f); /* Superblock related routines */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 9339b3d..97a6d6f 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -823,13 +823,13 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) f->shared->eoa_pre_fsm_fsalloc = fsinfo.eoa_pre_fsm_fsalloc; /* f->shared->eoa_pre_fsm_fsalloc must always be HADDR_UNDEF - * in the absence of persistent free space managers. + * in the absence of persistant free space managers. */ /* If the following two conditions are true: * (1) skipping EOF check (skip_eof_check) * (2) dropping free-space to the floor (null_fsm_addr) * skip the asserts as "eoa_pre_fsm_fsalloc" may be undefined - * for a crashed file with persistent free space managers. + * for a crashed file with persistant free space managers. * #1 and #2 are enabled when the tool h5clear --increment * option is used. */ @@ -839,7 +839,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) } /* end if */ /* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file - * with persistent free space managers, therefore, set + * with persistant free space managers, therefore, set * "first_alloc_dealloc" when the condition * "dropping free-space to the floor is true. * This will ensure that no action is done to settle things on file diff --git a/src/H5Gname.c b/src/H5Gname.c index c1156ca..1ca06b9 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -1058,7 +1058,7 @@ done: * Function: H5G_name_replace * * Purpose: Search the list of open IDs and replace names according to a - * particular operation. The operation occurred on the + * particular operation. The operation occured on the * SRC_FILE/SRC_FULL_PATH_R object. The new name (if there is * one) is NEW_NAME_R. Additional entry location information * (currently only needed for the 'move' operation) is passed in diff --git a/src/H5Gobj.c b/src/H5Gobj.c index e93896c..af0e72c 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -222,7 +222,7 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, size_t pline_size = 0; /* Size of the pipeline message */ size_t link_size; /* Size of a link message */ - /* Calculate message size information, for creating group's object header */ + /* Calculate message size infomation, for creating group's object header */ linfo_size = H5O_msg_size_f(f, gcpl_id, H5O_LINFO_ID, linfo, (size_t)0); HDassert(linfo_size); diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 0c5d3aa..84d5c5f 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -702,12 +702,12 @@ H5HF__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t len, * * Do this with a call to H5HF__cache_verify_hdr_descendants_clean(). * - * Note that descendants need not be clean if the pre_serialize call + * Note that decendants need not be clean if the pre_serialize call * is made during a cache serialization instead of an entry or cache * flush. * * Note also that with the recent change in the definition of flush - * dependency, not all descendants need be clean -- only direct flush + * dependency, not all decendants need be clean -- only direct flush * dependency children. * * Finally, observe that the H5HF__cache_verify_hdr_descendants_clean() @@ -2643,11 +2643,11 @@ H5HF__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) * * The implementation of flush dependencies has been changed. * Prior to this change, a flush dependency parent could be - * flushed if and only if all its flush dependency descendants + * flushed if and only if all its flush dependency decendants * were clean. In the new definition, a flush dependency * parent can be flushed if all its immediate flush dependency * children are clean, regardless of any other dirty - * descendants. + * decendants. * * Further, metadata cache entries are now allowed to have * multiple flush dependency parents. @@ -2815,7 +2815,7 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, H5_BEGIN_TAG(hdr->heap_addr) if(NULL == (root_iblock = (H5HF_indirect_t *)H5AC_protect(f, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed.") + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") H5_END_TAG @@ -2889,7 +2889,7 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, H5_BEGIN_TAG(hdr->heap_addr) if(NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(f, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed.") + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") H5_END_TAG @@ -2912,7 +2912,7 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, if(unprotect_root_iblock) { HDassert(root_iblock); if(H5AC_unprotect(f, H5AC_FHEAP_IBLOCK, root_iblock_addr, root_iblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() failed.") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() faild.") } /* end if */ } /* end else */ } /* end if */ @@ -2982,7 +2982,7 @@ done: * Function: H5HF__cache_verify_iblock_descendants_clean * * Purpose: Sanity checking routine that verifies that all indirect - * and direct blocks that are descendants of the supplied + * and direct blocks that are decendents of the supplied * instance of H5HF_indirect_t are clean. Set *clean * to TRUE if this is the case, and to FALSE otherwise. * @@ -3009,11 +3009,11 @@ done: * * The implementation of flush dependencies has been changed. * Prior to this change, a flush dependency parent could be - * flushed if and only if all its flush dependency descendants + * flushed if and only if all its flush dependency decendants * were clean. In the new definition, a flush dependency * parent can be flushed if all its immediate flush dependency * children are clean, regardless of any other dirty - * descendants. + * decendants. * * Further, metadata cache entries are now allowed to have * multiple flush dependency parents. @@ -3126,11 +3126,11 @@ done: * * The implementation of flush dependencies has been changed. * Prior to this change, a flush dependency parent could be - * flushed if and only if all its flush dependency descendants + * flushed if and only if all its flush dependency decendants * were clean. In the new definition, a flush dependency * parent can be flushed if all its immediate flush dependency * children are clean, regardless of any other dirty - * descendants. + * decendants. * * Further, metadata cache entries are now allowed to have * multiple flush dependency parents. @@ -3290,11 +3290,11 @@ done: * * The implementation of flush dependencies has been changed. * Prior to this change, a flush dependency parent could be - * flushed if and only if all its flush dependency descendants + * flushed if and only if all its flush dependency decendants * were clean. In the new definition, a flush dependency * parent can be flushed if all its immediate flush dependency * children are clean, regardless of any other dirty - * descendants. + * decendants. * * Further, metadata cache entries are now allowed to have * multiple flush dependency parents. @@ -3468,7 +3468,7 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5_BEGIN_TAG(iblock->hdr->heap_addr) if(NULL == (child_iblock = (H5HF_indirect_t *) H5AC_protect(f, H5AC_FHEAP_IBLOCK, child_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed.") + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") H5_END_TAG @@ -3480,7 +3480,7 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, /* pointer to the entry. This is very slimy -- */ /* come up with a better solution. */ if(H5AC_get_entry_ptr_from_addr(f, child_iblock_addr, (void **)(&child_iblock)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() failed.") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() faild.") HDassert(child_iblock); } /* end else */ } /* end if */ @@ -3519,7 +3519,7 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, /* if we protected the child iblock, unprotect it now */ if(unprotect_child_iblock) { if(H5AC_unprotect(f, H5AC_FHEAP_IBLOCK, child_iblock_addr, child_iblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() failed.") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() faild.") } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index 6e9429a..563e8c5 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -338,7 +338,7 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u, end_entry = %u\n", "H5HF_sect /* Check for multi-row span */ if(start_row != end_row) { - /* Accommodate partial starting row */ + /* Accomodate partial starting row */ if(start_col > 0) { acc_span_size = dtable->row_block_size[start_row] * (dtable->cparam.width - start_col); @@ -352,7 +352,7 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u, end_entry = %u\n", "H5HF_sect start_row++; } /* end while */ - /* Accommodate partial ending row */ + /* Accomodate partial ending row */ acc_span_size += dtable->row_block_size[start_row] * (end_col + 1); } /* end if */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 8166d88..b1b8574 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -46,13 +46,13 @@ /* Limit on the size of the max. direct block size */ /* (This is limited to 32-bits currently, because I think it's unlikely to * need to be larger, the 32-bit limit for H5VM_log2_of2(n), and - * some offsets/sizes are encoded with a maximum of 32-bits - QAK) + * some offsets/sizes are encoded with a maxiumum of 32-bits - QAK) */ #define H5HF_MAX_DIRECT_SIZE_LIMIT ((hsize_t)2 * 1024 * 1024 * 1024) /* Limit on the width of the doubling table */ /* (This is limited to 16-bits currently, because I think it's unlikely to - * need to be larger, and its encoded with a maximum of 16-bits - QAK) + * need to be larger, and its encoded with a maxiumum of 16-bits - QAK) */ #define H5HF_WIDTH_LIMIT (64 * 1024) #endif /* NDEBUG */ diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 5260ae2..5d659a6 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -311,7 +311,7 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) - /* Iterate over all sections, resetting the parent pointers in 'single' sections */ + /* Iterate over all sections, reseting the parent pointers in 'single' sections */ if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_revert_root_cb, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers") diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 5cf1c08..79462e9 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -109,7 +109,7 @@ H5HF_tiny_init(H5HF_hdr_t *hdr) /* Check if tiny objects need an extra byte for their length */ /* (account for boundary condition when length of an object would need an * extra byte, but using that byte means that the extra length byte is - * unnecessary) + * unneccessary) */ if((hdr->id_len - 1) <= H5HF_TINY_LEN_SHORT) { hdr->tiny_max_len = hdr->id_len - 1; diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 3a770ae..50b2669 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -300,7 +300,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, image += heap->obj[0].size; } /* end if */ else { - size_t need = 0; + size_t need; unsigned idx; uint8_t *begin = image; @@ -420,7 +420,7 @@ H5HG__cache_heap_image_len(const void *_thing, size_t *image_len) * * Purpose: Given an appropriately sized buffer and an instance of * H5HG_heap_t, serialize the global heap for writing to file, - * and copy the serialized version into the buffer. + * and copy the serialized verion into the buffer. * * * Return: Success: SUCCEED @@ -37,7 +37,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ -#include "H5FSpkg.h" /* File free space */ +#include "H5FSpkg.h" /* File access */ #include "H5Iprivate.h" /* IDs */ #include "H5MFpkg.h" /* File memory management */ #include "H5VMprivate.h" /* Vectors and arrays */ @@ -322,7 +322,7 @@ H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type) HDassert(H5F_addr_defined(f->shared->fs_addr[type])); HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); - /* Set up the alignment and threshold to use depending on the manager type */ + /* Set up the aligment and threshold to use depending on the manager type */ if(H5F_PAGED_AGGR(f)) { alignment = (type == H5F_MEM_PAGE_GENERIC) ? f->shared->fs_page_size : (hsize_t)H5F_ALIGN_DEF; threshold = H5F_ALIGN_THRHD_DEF; @@ -896,7 +896,7 @@ H5MF__sects_dump(f, stderr); static haddr_t H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) { - H5F_mem_page_t ptype; /* Free-space manager type */ + H5F_mem_page_t ptype; /* Free-space mananger type */ H5MF_free_section_t *node = NULL; /* Free space section pointer */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ @@ -1692,7 +1692,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); } /* end if */ /* Set the ring type in the API context. In most cases, we will - * need H5AC_RING_RDFSM, so initially set the ring in + * need H5AC_RING_RDFSM, so initialy set the ring in * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); @@ -1788,7 +1788,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert(f->shared->sblock); /* Set the ring type in the API context. In most cases, we will - * need H5AC_RING_RDFSM, so initially set the ring in + * need H5AC_RING_RDFSM, so initialy set the ring in * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); @@ -1956,7 +1956,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert(f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2); /* Set the ring type in the API context. In most cases, we will - * need H5AC_RING_RDFSM, so initially set the ring in + * need H5AC_RING_RDFSM, so initialy set the ring in * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); @@ -2244,7 +2244,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) HDassert(f->shared->lf); /* Set the ring type in the API context. In most cases, we will - * need H5AC_RING_RDFSM, so initially set the ring in + * need H5AC_RING_RDFSM, so initialy set the ring in * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); @@ -2419,7 +2419,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t sect_udata.sect_idx = 0; /* Set the ring type in the API context. In most cases, we will - * need H5AC_RING_RDFSM, so initially set the ring in + * need H5AC_RING_RDFSM, so initialy set the ring in * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); @@ -2712,7 +2712,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregators") /* Set the ring type in the DXPL. In most cases, we will - * need H5AC_RING_MDFSM first, so initially set the ring in + * need H5AC_RING_MDFSM first, so initialy set the ring in * the DXPL to that value. We will alter this later if * needed. */ @@ -2829,7 +2829,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * extension messages will choke if the target message is * unexpectedly either absent or present. * - * Update: This is probably unnecessary, as I gather that the + * Update: This is probably unecessary, as I gather that the * file space manager info message is guaranteed to exist. * Leave it in for now, but consider removing it. */ @@ -3049,7 +3049,7 @@ done: * further space allocations involving them should take * place during file close. * - * On entry to this routine, the free space manager(s) involved + * On entry to this routine. the free space manager(s) involved * in allocation of file space for free space managers should * still be floating. (i.e. should not have any file space * allocated to them.) @@ -3083,7 +3083,7 @@ done: * of these free space manager(s) only to have the allocation * result in the free space manager being empty and thus * obliging us to free the space again. Thus there is the - * potential for an infinite loop if we want to avoid saving + * potential for an infinte loop if we want to avoid saving * empty free space managers. * * Similarly, it is possible that we could allocate space @@ -3265,7 +3265,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * everything other than the self referential FSMs (and possibly the * cache image) has been allocated at this point, this allows us to * to float the self referential FSMs on the first file space allocation / - * deallocation and then set the EOA to this value before we handle + * deallocaiton and then set the EOA to this value before we handle * the allocation / deallocation. (If a cache image exists, the * first allocation / deallocation will be the deallocation of space * for the cache image). @@ -3280,7 +3280,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * extension message. * * As of this writing, we are solving this problem by - * simply not supporting persistent FSMs with the split + * simply not supporting persistant FSMs with the split * and multi file drivers. * * Current plans are to do away with the multi file @@ -3296,8 +3296,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* ******************* PROBLEM: ******************** * - * If the file has an alignment other than 1, and if - * the EOA is not a multiple of this alignment, allocating space + * If the file has an alignement other than 1, and if + * the EOA is not a multiple of this alignment, allocating sapce * for the section via the VFD info has the potential of generating * a fragment that will be added to the free space manager. This * of course undoes everything we have been doing here. @@ -3324,7 +3324,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * end of file via H5FD_alloc(). * * In the past, this issue of allocating space without touching the - * free space managers has been dealt with by calling + * free space managers has been deal with by calling * H5MF_aggr_vfd_alloc(), which in turn calls H5MF_aggr_alloc(). * This is problematic since (if I read the code correctly) it will * re-constitute the metadata aggregator, which will add any leftover @@ -3369,7 +3369,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* All free space managers should have file space allocated for them * now, and should see no further allocations / deallocations. Store - * the pre and post file space allocation for self referential FSMs EOA + * the pre and post file space allocaton for self referential FSMs EOA * for use when we actually write the free space manager superblock * extension message. */ @@ -3433,7 +3433,7 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) /* In principle, fsm_type should always be less than * H5F_MEM_PAGE_LARGE_SUPER whenever paged aggregation * is not enabled. However, since there is code that does - * not observe this principle, force the result to FALSE if + * not observe this prinicple, force the result to FALSE if * fsm_type is greater than or equal to H5F_MEM_PAGE_LARGE_SUPER. */ if(fsm_type >= H5F_MEM_PAGE_LARGE_SUPER) @@ -3532,7 +3532,7 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) * * 3) Load the self referential FSMs. In passing verify that * the lowest address of a FSM header is equal to - * f->shared->eoa_pre_fsm_fsalloc. + * f->shared->eoa_pre_fsm_fsalloc.' * * Note that we don't have to use any special I/O for * this -- we can use the regular I/O methods even if diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 3db7f73..5ab1834 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -407,7 +407,7 @@ H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, if(f->shared->feature_flags & aggr->feature_flag) { /* * If the block being tested adjoins the beginning of the aggregator - * block, check if the aggregator can accommodate the extension. + * block, check if the aggregator can accomodate the extension. */ if(H5F_addr_eq(blk_end, aggr->addr)) { haddr_t eoa; /* EOA for the file */ @@ -946,7 +946,7 @@ done: * Function: H5Odisable_mdc_flushes * * Purpose: To "cork" an object: - * --keep dirty entries associated with the object in the metadata cache + * --keep dirty entries assoicated with the object in the metadata cache * * Return: Success: Non-negative * Failure: Negative diff --git a/src/H5Oattr.c b/src/H5Oattr.c index a62a3a3..f2c31d7 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -249,7 +249,7 @@ done: if(NULL == ret_value) if(attr) { if(attr->shared) { - /* Free any dynamically allocated items */ + /* Free any dynamicly allocated items */ if(H5A__free(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info") diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 640d1c7..9d125e8 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -1093,7 +1093,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, mesg->native = NULL; /* Delete old attribute */ - /* (doesn't decrement the link count on shared components because + /* (doesn't decrement the link count on shared components becuase * the "native" pointer has been reset) */ if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0) @@ -1448,12 +1448,6 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) } /* end if */ } /* end if */ - /* Update the message after removing the attribute */ - /* This is particularly needed when removing the last attribute that is - accessed via fractal heap/v2 B-tree (HDFFV-9277) */ - if(H5O__msg_write_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message") - /* Check if we have deleted all the attributes and the attribute info * message should be deleted itself. */ @@ -1461,6 +1455,9 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) if(H5O__msg_remove_real(loc->file, oh, H5O_MSG_AINFO, H5O_ALL, NULL, NULL, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute info") } /* end if */ + else + if(H5O__msg_write_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message") done: /* Release resources */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 59e1705..3607839 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1430,10 +1430,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for combining two adjacent 'null' messages */ if((udata->file_intent & H5F_ACC_RDWR) && - H5O_NULL_ID == id && oh->nmesgs > 0 && - H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id && - oh->mesg[oh->nmesgs - 1].chunkno == chunkno) { - + H5O_NULL_ID == id && oh->nmesgs > 0 && + H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id && + oh->mesg[oh->nmesgs - 1].chunkno == chunkno) { size_t mesgno; /* Current message to operate on */ /* Combine adjacent null messages */ @@ -1468,13 +1467,13 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Point unknown messages at 'unknown' message class */ /* (Usually from future versions of the library) */ - if(id >= H5O_UNKNOWN_ID || + if(id >= H5O_UNKNOWN_ID || #ifdef H5O_ENABLE_BOGUS - id == H5O_BOGUS_VALID_ID || + id == H5O_BOGUS_VALID_ID || #endif - NULL == H5O_msg_class_g[id]) { + NULL == H5O_msg_class_g[id]) { - H5O_unknown_t *unknown; /* Pointer to "unknown" message info */ + H5O_unknown_t *unknown; /* Pointer to "unknown" message info */ /* Allocate "unknown" message info */ if(NULL == (unknown = H5FL_MALLOC(H5O_unknown_t))) @@ -1491,9 +1490,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for "fail if unknown" message flags */ if(((udata->file_intent & H5F_ACC_RDWR) && - (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) - || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found") + (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) + || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found") /* Check for "mark if unknown" message flag, etc. */ else if((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) && !(flags & H5O_MSG_FLAG_WAS_UNKNOWN) && @@ -1544,8 +1543,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image H5O_refcount_t *refcount; /* Decode ref. count message */ - if(oh->version <= H5O_VERSION_1) - HGOTO_ERROR(H5E_OHDR, H5E_VERSION, FAIL, "object header version does not support reference count message") + HDassert(oh->version > H5O_VERSION_1); refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(udata->f, NULL, 0, &ioflags, mesg->raw_size, mesg->raw); /* Save 'native' form of ref. count message */ @@ -1553,8 +1551,6 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Set object header values */ oh->has_refcount_msg = TRUE; - if(!refcount) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't decode refcount") oh->nlink = *refcount; } /* end if */ /* Check if message is a link message */ @@ -1618,10 +1614,6 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image } /* end if */ done: - if(ret_value < 0 && udata->cont_msg_info->msgs) { - udata->cont_msg_info->msgs = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs); - udata->cont_msg_info->alloc_nmsgs = 0; - } FUNC_LEAVE_NOAPI(ret_value) } /* H5O__chunk_deserialize() */ diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 591ac4a..ad64297 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -313,7 +313,7 @@ H5O__mdci_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) * space allocations / deallocations prior to the free of the * cache image. Verify this to the extent possible. * - * If the hack to work around the persistent self referential + * If the hack to work around the persistant self referential * free space manager issue is NOT in use, just call H5MF_xfree() * to release the cache iamge. In principle, we should be able * to just reduce the EOA to the base address of the cache diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2e628f4..e6865f1 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -1106,7 +1106,7 @@ H5O__copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, HDassert(H5F_addr_defined(oloc_src->addr)); HDassert(oloc_dst->file); - /* Initialize copy info before errors can be thrown */ + /* Intialize copy info before errors can be thrown */ HDmemset(&cpy_info, 0, sizeof(H5O_copy_t)); /* Get the copy property list */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 8a6004d..932241f 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -194,7 +194,7 @@ H5FL_BLK_EXTERN(type_conv); static void * H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, - size_t p_size, const uint8_t *p) + size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_fill_t *fill = NULL; void *ret_value = NULL; /* Return value */ @@ -228,8 +228,6 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, INT32DECODE(p, fill->size); if(fill->size > 0) { H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - if((size_t)fill->size > p_size) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small") if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") HDmemcpy(fill->buf, p, (size_t)fill->size); @@ -309,13 +307,11 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, +H5O_fill_old_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, - size_t p_size, const uint8_t *p) + size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_fill_t *fill = NULL; /* Decoded fill value message */ - htri_t exists = FALSE; - H5T_t *dt = NULL; void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -336,21 +332,6 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, /* Only decode the fill value itself if there is one */ if(fill->size > 0) { - H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - if((size_t)fill->size > p_size) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small") - - /* Get the datatype message */ - if((exists = H5O_msg_exists_oh(open_oh, H5O_DTYPE_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read object header") - if(exists) { - if((dt = H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message") - /* Verify size */ - if(fill->size != H5T_GET_SIZE(dt)) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size") - } - if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") HDmemcpy(fill->buf, p, (size_t)fill->size); @@ -363,9 +344,6 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, ret_value = (void*)fill; done: - if(dt) - H5O_msg_free(H5O_DTYPE_ID, dt); - if(!ret_value && fill) { if(fill->buf) H5MM_xfree(fill->buf); diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 5f16837..afaddfa 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -125,8 +125,8 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Dimensionality */ ndims = *p++; - if(!ndims || ndims > H5O_LAYOUT_NDIMS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is out of range") + if(ndims > H5O_LAYOUT_NDIMS) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large") /* Layout class */ mesg->type = (H5D_layout_t)*p++; @@ -548,8 +548,10 @@ done: static herr_t H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { - const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; - unsigned u; + const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; + uint8_t *heap_block = NULL; + size_t *str_size = NULL; + unsigned u; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -685,6 +687,10 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, } /* end switch */ done: + + heap_block = (uint8_t *)H5MM_xfree(heap_block); + str_size = (size_t *)H5MM_xfree(str_size); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__layout_encode() */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index e156dcd..930be9b 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -239,7 +239,7 @@ done: * Purpose: Modifies an existing message or creates a new message. * * The UPDATE_FLAGS argument are flags that allow the caller - * to skip updating the modification time or resetting the message + * to skip updating the modification time or reseting the message * data. This is useful when several calls to H5O_msg_write will be * made in a sequence. * @@ -296,7 +296,7 @@ done: * Purpose: Modifies an existing message or creates a new message. * * The UPDATE_FLAGS argument are flags that allow the caller - * to skip updating the modification time or resetting the message + * to skip updating the modification time or reseting the message * data. This is useful when several calls to H5O_msg_write will be * made in a sequence. * @@ -343,7 +343,7 @@ done: * Purpose: Modifies an existing message or creates a new message. * * The UPDATE_FLAGS argument are flags that allow the caller - * to skip updating the modification time or resetting the message + * to skip updating the modification time or reseting the message * data. This is useful when several calls to H5O_msg_write will be * made in a sequence. * diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 328ba4b..047f90e 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -640,7 +640,7 @@ done: /*------------------------------------------------------------------------- * Function: H5O__shared_post_copy_file * - * Purpose: Delete a shared message and replace with a new one. + * Purpose: Delate a shared message and replace with a new one. * The function is needed at cases such as coping a shared reg_ref attribute. * When a shared reg_ref attribute is copied from one file to * another, the values in file need to be replaced. The only way @@ -399,7 +399,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some transformation/translation of the + set for the property or may perform some tranformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -581,7 +581,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some transformation/translation of the + set for the property or may perform some tranformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -840,6 +840,10 @@ herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc) { H5P_genplist_t *plist; /* Property list to query */ + H5P_genplist_t *fapl_plist; + hid_t new_fapl_id; + H5F_libver_t low_bound = H5F_LIBVER_V110; + H5F_libver_t high_bound = H5F_LIBVER_V110; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) @@ -850,7 +854,7 @@ H5Pencode(hid_t plist_id, void *buf, size_t *nalloc) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Call the internal encode routine */ - if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0) + if((ret_value = H5P__encode(plist, TRUE, buf, nalloc, H5P_FILE_ACCESS_DEFAULT)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list"); done: diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index da06297..ad2ae4c 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -121,7 +121,7 @@ static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); /* Property list callbacks */ -static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); static herr_t H5P__dapl_vds_file_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_vds_file_pref_get(hid_t prop_id, const char* name, size_t size, void* value); @@ -135,7 +135,7 @@ static herr_t H5P__dapl_vds_file_pref_close(const char* name, size_t size, void* /* Property list callbacks */ static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_efile_pref_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__dapl_efile_pref_dec(const void **_pp, void *value); static herr_t H5P__dapl_efile_pref_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_efile_pref_copy(const char* name, size_t size, void* value); @@ -562,7 +562,7 @@ H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) +H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const char *efile_pref = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -1157,7 +1157,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size) +H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5D_vds_view_t *view = (const H5D_vds_view_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index cb13ff3..b451ed3 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -147,7 +147,7 @@ static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ static herr_t H5P__dcrt_layout_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_layout_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dcrt_layout_dec(const void **pp, void *value); static herr_t H5P__dcrt_layout_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_layout_copy(const char *name, size_t size, void *value); @@ -155,14 +155,14 @@ static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t s static herr_t H5P__dcrt_layout_close(const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_fill_value_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_fill_value_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dcrt_fill_value_dec(const void **pp, void *value); static herr_t H5P__dcrt_fill_value_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_copy(const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_close(const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dcrt_ext_file_list_dec(const void **pp, void *value); static herr_t H5P__dcrt_ext_file_list_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_copy(const char *name, size_t size, void *value); @@ -367,21 +367,41 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) +H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size, void *_udata) { const H5O_layout_t *layout = (const H5O_layout_t *)value; /* Create local aliases for values */ + H5P_enc_cb_info_t *udata = (H5P_enc_cb_info_t *)_udata; /* User data for encode callback */ uint8_t **pp = (uint8_t **)_pp; uint8_t *tmp_p; size_t tmp_size; size_t u; /* Local index variable */ + H5P_genplist_t *fapl_plist; /* The file access property list */ + hid_t new_fapl_id; /* The file access property list ID */ + H5F_libver_t low_bound = H5F_LIBVER_V110; /* Set the low bound in fapl to latest */ + H5F_libver_t high_bound = H5F_LIBVER_V110; /* Set the high bound in fapl to latest */ herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_STATIC /* Sanity check */ HDassert(layout); HDassert(size); + /* Make a copy of the default file access property list */ + if(NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Set latest format in fapl_plist */ + /* This will eventually be used by VDS to encode datasets via H5S_encode() */ + if(H5P_set(fapl_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low_bound) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions") + if(H5P_set(fapl_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high_bound) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions") + + if((new_fapl_id = H5P_copy_plist(fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") + if(NULL != *pp) { /* Encode layout type */ *(*pp)++ = (uint8_t)layout->type; @@ -427,14 +447,15 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) * list before we get here. */ tmp_size = (size_t)-1; tmp_p = *pp; - if(H5S_encode(layout->storage.u.virt.list[u].source_select, pp, &tmp_size) < 0) + + if(H5S_encode(layout->storage.u.virt.list[u].source_select, pp, &tmp_size, new_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") *size += (size_t)(*pp - tmp_p); /* Virtual dataset selection. Same notes as above apply. */ tmp_size = (size_t)-1; tmp_p = *pp; - if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, pp, &tmp_size) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, pp, &tmp_size, new_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") *size += (size_t)(*pp - tmp_p); } /* end for */ @@ -467,14 +488,14 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) /* Source selection */ tmp_size = (size_t)0; tmp_p = NULL; - if(H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size, new_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") *size += tmp_size; /* Virtual dataset selection */ tmp_size = (size_t)0; tmp_p = NULL; - if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size, new_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") *size += tmp_size; } /* end for */ @@ -980,7 +1001,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) +H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_fill_t *fill = (const H5O_fill_t *)value; /* Create local aliases for values */ size_t dt_size = 0; /* Size of encoded datatype */ @@ -1332,7 +1353,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__dcrt_ext_file_list_get * - * Purpose: Copies an external file list property when it's retrieved from a property list + * Purpose: Copies an external file lsit property when it's retrieved from a property list * * Return: Success: Non-negative * Failure: Negative @@ -1383,7 +1404,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) +H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_efl_t *efl = (const H5O_efl_t *)value; /* Create local aliases for values */ size_t len = 0; /* String length of slot name */ @@ -2245,7 +2266,7 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, done: /* Set VDS layout information in property list */ - /* (Even on failure, so there's not a mangled layout struct in the list) */ + /* (Even on faliure, so there's not a mangled layout struct in the list) */ if(retrieved_layout) { if(H5P_poke(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0) { HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 226d206..7f96333 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -202,7 +202,7 @@ GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some transformation/translation of the + set for the property or may perform some tranformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -383,7 +383,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some transformation/translation of the + set for the property or may perform some tranformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index e6eed32..0daed29 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -172,21 +172,21 @@ static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ -static herr_t H5P__dxfr_bkgr_buf_type_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_bkgr_buf_type_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_bkgr_buf_type_dec(const void **pp, void *value); -static herr_t H5P__dxfr_btree_split_ratio_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_btree_split_ratio_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_btree_split_ratio_dec(const void **pp, void *value); -static herr_t H5P__dxfr_io_xfer_mode_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_io_xfer_mode_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_io_xfer_mode_dec(const void **pp, void *value); -static herr_t H5P__dxfr_mpio_collective_opt_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_mpio_collective_opt_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_mpio_collective_opt_dec(const void **pp, void *value); -static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_mpio_chunk_opt_hard_dec(const void **pp, void *value); -static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_edc_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size, void *udata); static herr_t H5P__dxfr_xform_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value); @@ -421,7 +421,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5T_bkg_t *bkgr_buf_type = (const H5T_bkg_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -494,7 +494,7 @@ H5P__dxfr_bkgr_buf_type_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const double *btree_split_ratio = (const double *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -655,7 +655,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5Z_data_xform_t *data_xform_prop = *(const H5Z_data_xform_t * const *)value; /* Create local alias for values */ const char *pexp = NULL; /* Pointer to transform expression */ @@ -1035,7 +1035,7 @@ done: * for the type conversion buffer and background buffer and * optionally supply pointers to application-allocated buffers. * If the buffer size is smaller than the entire amount of data - * being transferred between application and file, and a type + * being transfered between application and file, and a type * conversion buffer or background buffer is required then * strip mining will be used. * @@ -1743,7 +1743,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5FD_mpio_xfer_t *xfer_mode = (const H5FD_mpio_xfer_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1816,7 +1816,7 @@ H5P__dxfr_io_xfer_mode_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5FD_mpio_collective_opt_t *coll_opt = (const H5FD_mpio_collective_opt_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1889,7 +1889,7 @@ H5P__dxfr_mpio_collective_opt_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5FD_mpio_chunk_opt_t *chunk_opt = (const H5FD_mpio_chunk_opt_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -2074,7 +2074,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size) +H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5Z_EDC_t *check = (const H5Z_EDC_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index 73c48d7..3332098 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -49,9 +49,10 @@ /* Typedef for iterator when encoding a property list */ typedef struct { - hbool_t encode; /* Whether the property list should be encoded */ - size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ - void **pp; /* Pointer to encoding buffer pointer */ + hbool_t encode; /* Whether the property list should be encoded */ + size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ + void **pp; /* Pointer to encoding buffer pointer */ + hid_t fapl_id; /* File access property list */ } H5P_enc_iter_ud_t; @@ -90,7 +91,7 @@ typedef struct { *------------------------------------------------------------------------- */ herr_t -H5P__encode_size_t(const void *value, void **_pp, size_t *size) +H5P__encode_size_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint64_t enc_value = (uint64_t)*(const size_t *)value; /* Property value to encode */ uint8_t **pp = (uint8_t **)_pp; @@ -132,7 +133,7 @@ H5P__encode_size_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) +H5P__encode_hsize_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint64_t enc_value = (uint64_t)*(const hsize_t *)value; /* Property value to encode */ unsigned enc_size = H5VM_limit_enc_size(enc_value); /* Size of encoded property */ @@ -173,7 +174,7 @@ H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_unsigned(const void *value, void **_pp, size_t *size) +H5P__encode_unsigned(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -212,7 +213,7 @@ H5P__encode_unsigned(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) +H5P__encode_uint8_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -248,7 +249,7 @@ H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) +H5P__encode_hbool_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -283,7 +284,7 @@ H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ herr_t -H5P__encode_double(const void *value, void **_pp, size_t *size) +H5P__encode_double(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { uint8_t **pp = (uint8_t **)_pp; @@ -332,7 +333,8 @@ static int H5P__encode_cb(H5P_genprop_t *prop, void *_udata) { H5P_enc_iter_ud_t *udata = (H5P_enc_iter_ud_t *)_udata; /* Pointer to user data */ - int ret_value = H5_ITER_CONT; /* Return value */ + H5P_enc_cb_info_t cb_udata; /* User data for property iteration callback */ + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC @@ -355,7 +357,8 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata) /* Encode (or not, if *(udata->pp) is NULL) the property value */ prop_value_len = 0; - if((prop->encode)(prop->value, udata->pp, &prop_value_len) < 0) + cb_udata.fapl_id = udata->fapl_id; + if((prop->encode)(prop->value, udata->pp, &prop_value_len, &cb_udata) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, H5_ITER_ERROR, "property encoding routine failed") *(udata->enc_size_ptr) += prop_value_len; } /* end if */ @@ -390,7 +393,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, - size_t *nalloc) + size_t *nalloc, hid_t fapl_id) { H5P_enc_iter_ud_t udata; /* User data for property iteration callback */ uint8_t *p = (uint8_t *)buf; /* Temporary pointer to encoding buffer */ @@ -425,6 +428,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, udata.encode = encode; udata.enc_size_ptr = &encode_size; udata.pp = (void **)&p; + udata.fapl_id = fapl_id; /* Iterate over all properties in property list, encoding them */ idx = 0; diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7ba9c11..a7c8218 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -297,18 +297,18 @@ static int H5P__facc_file_image_info_cmp(const void *value1, const void *value2, static herr_t H5P__facc_file_image_info_close(const char *name, size_t size, void *value); /* encode & decode callbacks */ -static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__facc_cache_config_dec(const void **_pp, void *value); static int H5P__facc_cache_config_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__facc_fclose_degree_dec(const void **pp, void *value); -static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__facc_multi_type_dec(const void **_pp, void *value); static herr_t H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_libver_type_dec(const void **_pp, void *value); /* Metadata cache log location property callbacks */ -static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P_facc_mdc_log_location_dec(const void **_pp, void *value); static herr_t H5P_facc_mdc_log_location_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P_facc_mdc_log_location_copy(const char *name, size_t size, void *value); @@ -317,7 +317,7 @@ static herr_t H5P_facc_mdc_log_location_close(const char *name, size_t size, voi /* Metadata cache image property callbacks */ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_config2, size_t H5_ATTR_UNUSED size); -static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); @@ -396,7 +396,7 @@ static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_D static const H5AC_cache_image_config_t H5F_def_mdc_initCacheImageCfg_g = H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEF; /* Default metadata cache image settings */ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF; /* Default page buffer size */ static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */ -static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer mininum raw data size */ +static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer minumum raw data size */ /*------------------------------------------------------------------------- @@ -1713,7 +1713,7 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown image config version.") /* If we ever support multiple versions of H5AC_cache_config_t, we - * will have to get the canonical version here, and then translate + * will have to get the cannonical version here, and then translate * to the version of the structure supplied. */ @@ -1808,7 +1808,7 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") /* If we ever support multiple versions of H5AC_cache_config_t, we - * will have to get the canonical version here, and then translate + * will have to get the cannonical version here, and then translate * to the version of the structure supplied. */ @@ -2322,7 +2322,7 @@ done: * necessary to represent features used. * (This is the "make certain to take advantage of <new feature> * in the file format" use case (maybe <new feature> is smaller - * or scales better than an earlier version, which would otherwise + * or scales better than an ealier version, which would otherwise * be used)) * * LOW = H5F_FORMAT_1_2_0, HIGH = H5F_FORMAT_1_6_0 => creates objects @@ -2549,7 +2549,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) /* validate parameters */ if(!(((buf_ptr == NULL) && (buf_len == 0)) || ((buf_ptr != NULL) && (buf_len > 0)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistent buf_ptr and buf_len") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistant buf_ptr and buf_len") /* Get the plist structure */ if(NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -2652,7 +2652,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") - /* verify file image field consistency */ + /* verify file image field consistancy */ HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || ((image_info.buffer == NULL) && (image_info.size == 0))); @@ -2728,7 +2728,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info") - /* verify file image field consistency */ + /* verify file image field consistancy */ HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); @@ -2804,7 +2804,7 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") - /* verify file image field consistency */ + /* verify file image field consistancy */ HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); @@ -2858,7 +2858,7 @@ H5P__file_image_info_copy(void *value) info = (H5FD_file_image_info_t *)value; - /* verify file image field consistency */ + /* verify file image field consistancy */ HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); @@ -2932,7 +2932,7 @@ H5P__file_image_info_free(void *value) info = (H5FD_file_image_info_t *)value; - /* Verify file image field consistency */ + /* Verify file image field consistancy */ HDassert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); @@ -3019,7 +3019,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) +H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5AC_cache_image_config_t *config = (const H5AC_cache_image_config_t *)value; /* Create local aliases for value */ uint8_t **pp = (uint8_t **)_pp; @@ -3445,7 +3445,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) +H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5AC_cache_config_t *config = (const H5AC_cache_config_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; @@ -3725,7 +3725,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) +H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5F_close_degree_t *fclose_degree = (const H5F_close_degree_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -3798,7 +3798,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) +H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5FD_mem_t *type = (const H5FD_mem_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -4298,7 +4298,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) +H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const char *log_location = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -4598,7 +4598,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) +H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5P_coll_md_read_flag_t *coll_md_read_flag = (const H5P_coll_md_read_flag_t *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index f90dae5..720c526 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -132,13 +132,13 @@ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass); /* property callbacks */ -static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__fcrt_btree_rank_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value); @@ -545,7 +545,7 @@ H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value exceeds maximum B-tree entries"); if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); btree_k[H5B_SNODE_ID] = ik; if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes"); @@ -650,10 +650,10 @@ H5Pset_istore_k(hid_t plist_id, unsigned ik) /* Set value */ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); btree_k[H5B_CHUNK_ID] = ik; if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree internal nodes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree interanl nodes"); done: FUNC_LEAVE_API(ret_value) @@ -698,7 +698,7 @@ H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */ ) /* Get value */ if(ik) { if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree internal nodes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); *ik = btree_k[H5B_CHUNK_ID]; } /* end if */ @@ -722,7 +722,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size) +H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const unsigned *btree_k = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1013,7 +1013,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size) +H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const unsigned *type_flags = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1106,7 +1106,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size) +H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const unsigned *minsizes = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1388,7 +1388,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size) +H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5F_fspace_strategy_t *strategy = (const H5F_fspace_strategy_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 6f1fab1..a719616 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -69,9 +69,9 @@ static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ -static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__gcrt_group_info_dec(const void **_pp, void *value); -static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__gcrt_link_info_dec(const void **_pp, void *value); @@ -546,7 +546,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size) +H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; @@ -634,7 +634,7 @@ H5P__gcrt_group_info_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size) +H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pint.c b/src/H5Pint.c index 6a0cc14..0e78463 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -1398,7 +1398,7 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * NAME H5P_access_class PURPOSE - Internal routine to increment or decrement list & class dependencies on a + Internal routine to increment or decrement list & class dependancies on a property list class USAGE herr_t H5P_access_class(pclass,mod) @@ -1407,7 +1407,7 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * RETURNS Returns non-negative on success, negative on failure. DESCRIPTION - Increment/Decrement the class or list dependencies for a given class. + Increment/Decrement the class or list dependancies for a given class. This routine is the final arbiter on decisions about actually releasing a class in memory, such action is only taken when the reference counts for both dependent classes & lists reach zero. @@ -1425,19 +1425,19 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) HDassert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX); switch(mod) { - case H5P_MOD_INC_CLS: /* Increment the dependent class count*/ + case H5P_MOD_INC_CLS: /* Increment the dependant class count*/ pclass->classes++; break; - case H5P_MOD_DEC_CLS: /* Decrement the dependent class count*/ + case H5P_MOD_DEC_CLS: /* Decrement the dependant class count*/ pclass->classes--; break; - case H5P_MOD_INC_LST: /* Increment the dependent list count*/ + case H5P_MOD_INC_LST: /* Increment the dependant list count*/ pclass->plists++; break; - case H5P_MOD_DEC_LST: /* Decrement the dependent list count*/ + case H5P_MOD_DEC_LST: /* Decrement the dependant list count*/ pclass->plists--; break; @@ -1586,12 +1586,12 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t /* Allocate room for the class */ if(NULL == (pclass = H5FL_CALLOC(H5P_genclass_t))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "property list class allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class allocation failed") /* Set class state */ pclass->parent = par_class; if(NULL == (pclass->name = H5MM_xstrdup(name))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "property list class name allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class name allocation failed") pclass->type = type; pclass->nprops = 0; /* Classes are created without properties initially */ pclass->plists = 0; /* No properties lists of this class yet */ @@ -2026,7 +2026,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some transformation/translation of the + set for the property or may perform some tranformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -2258,7 +2258,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some transformation/translation of the + set for the property or may perform some tranformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -2499,7 +2499,7 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being - set for the property or may perform some transformation/translation of the + set for the property or may perform some tranformation/translation of the value set. The 'get' callback would then [probably] reverse the transformation, etc. A single 'get' or 'set' callback could handle multiple properties by performing different actions based on the property @@ -2636,7 +2636,7 @@ H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op /* Find property in changed list */ if(NULL != (prop = (H5P_genprop_t *)H5SL_search(plist->props, name))) { - /* Call the 'found in property list' callback */ + /* Call the 'found in propery list' callback */ if((*plist_op)(plist, name, prop, udata) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property") } /* end if */ @@ -4020,7 +4020,7 @@ H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, /* Check for iterating over all properties, or just non-default ones */ if(iter_all_prop) { - /* Walk up the class hierarchy */ + /* Walk up the class hiearchy */ tclass = plist->pclass; while(tclass != NULL) { /* Iterate over properties in property list class */ @@ -4737,7 +4737,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) /* Sanity check */ HDassert(name); - /* Get property list classes */ + /* Get propery list classes */ if(NULL == (src_pclass = (H5P_genclass_t *)H5I_object(src_id))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "source property class object doesn't exist") if(NULL == (dst_pclass = (H5P_genclass_t *)H5I_object(dst_id))) @@ -4854,8 +4854,8 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The property list class 'close' callback routine is not called from - here, it must have been checked for and called properly prior to this routine - being called. + here, it must have been check for and called properly prior to this routine + being called EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -4981,7 +4981,7 @@ H5P_close(void *_plist) tclass=tclass->parent; } /* end while */ - /* Decrement class's dependent property list value! */ + /* Decrement class's dependant property list value! */ if(H5P_access_class(plist->pclass,H5P_MOD_DEC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count") diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 18b81ac..4a95991 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -114,7 +114,7 @@ static herr_t H5P__lacc_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ static herr_t H5P__lacc_elink_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_pref_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__lacc_elink_pref_dec(const void **_pp, void *value); static herr_t H5P__lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_pref_copy(const char* name, size_t size, void* value); @@ -122,7 +122,7 @@ static int H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size static herr_t H5P__lacc_elink_pref_close(const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__lacc_elink_fapl_dec(const void **_pp, void *value); static herr_t H5P__lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_copy(const char* name, size_t size, void* value); @@ -338,13 +338,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) +H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size, void *_udata) { - const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */ + const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */ uint8_t **pp = (uint8_t **)_pp; + H5P_enc_cb_info_t *udata = (H5P_enc_cb_info_t *)_udata; /* User data for encode callback */ H5P_genplist_t *fapl_plist; /* Pointer to property list */ hbool_t non_default_fapl = FALSE; /* Whether the FAPL is non-default */ - size_t fapl_size = 0; /* FAPL's encoded size */ + size_t fapl_size = 0; /* FAPL's encoded size */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -364,7 +365,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) /* Encode the property list, if non-default */ /* (if *pp == NULL, will only compute the size) */ if(non_default_fapl) { - if(H5P__encode(fapl_plist, TRUE, NULL, &fapl_size) < 0) + if(H5P__encode(fapl_plist, TRUE, NULL, &fapl_size, udata->fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") if(*pp) { @@ -379,7 +380,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) UINT64ENCODE_VAR(*pp, enc_value, enc_size); /* encode the plist */ - if(H5P__encode(fapl_plist, TRUE, *pp, &fapl_size) < 0) + if(H5P__encode(fapl_plist, TRUE, *pp, &fapl_size, udata->fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") *pp += fapl_size; @@ -688,7 +689,7 @@ H5P__lacc_elink_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) +H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const char *elink_pref = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index be41e32..b3c472e 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -90,7 +90,7 @@ static herr_t H5P__ocrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ -static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__ocrt_pipeline_dec(const void **_pp, void *value); static herr_t H5P__ocrt_pipeline_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__ocrt_pipeline_get(hid_t prop_id, const char *name, size_t size, void *value); @@ -1459,7 +1459,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) +H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5O_pline_t *pline = (const H5O_pline_t *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 60b2363..2cf1342 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -51,10 +51,10 @@ typedef enum { /* Define enum for modifications to class */ typedef enum { H5P_MOD_ERR=(-1), /* Indicate an error */ - H5P_MOD_INC_CLS, /* Increment the dependent class count*/ - H5P_MOD_DEC_CLS, /* Decrement the dependent class count*/ - H5P_MOD_INC_LST, /* Increment the dependent list count*/ - H5P_MOD_DEC_LST, /* Decrement the dependent list count*/ + H5P_MOD_INC_CLS, /* Increment the dependant class count*/ + H5P_MOD_DEC_CLS, /* Decrement the dependant class count*/ + H5P_MOD_INC_LST, /* Increment the dependant list count*/ + H5P_MOD_DEC_LST, /* Decrement the dependant list count*/ H5P_MOD_INC_REF, /* Increment the ID reference count*/ H5P_MOD_DEC_REF, /* Decrement the ID reference count*/ H5P_MOD_MAX /* Upper limit on class modifications */ @@ -89,7 +89,7 @@ struct H5P_genclass_t { size_t nprops; /* Number of properties in class */ unsigned plists; /* Number of property lists that have been created since the last modification to the class */ unsigned classes; /* Number of classes that have been derived since the last modification to the class */ - unsigned ref_count; /* Number of outstanding ID's open on this class object */ + unsigned ref_count; /* Number of oustanding ID's open on this class object */ hbool_t deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */ unsigned revision; /* Revision number of a particular class (global) */ H5SL_t *props; /* Skip list containing properties */ @@ -176,21 +176,21 @@ H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type); /* Encode/decode routines */ H5_DLL herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, - void *buf, size_t *nalloc); + void *buf, size_t *nalloc, hid_t fapl_id); H5_DLL hid_t H5P__decode(const void *buf); -H5_DLL herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_size_t(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_unsigned(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_uint8_t(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_hbool_t(const void *value, void **_pp, size_t *size); -H5_DLL herr_t H5P__encode_double(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_size_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_unsigned(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_uint8_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_hbool_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_double(const void *value, void **_pp, size_t *size, void *udat); H5_DLL herr_t H5P__decode_hsize_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_size_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_unsigned(const void **_pp, void *value); H5_DLL herr_t H5P__decode_uint8_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_hbool_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_double(const void **_pp, void *value); -H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size, void *udata); H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); /* Private OCPL routines */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 1a2bb95..a18df06 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -84,6 +84,16 @@ typedef enum H5P_plist_type_t { /* Function pointer for library classes with properties to register */ typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); +/* Move encode/decode callback typedefs from H5Ppublic.h: not exposed to user */ +/* Add a parameter to encode callback */ +typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size, void *udata); +typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); + +/* User data passed to encode callback */ +typedef struct H5P_enc_cb_info_t { + hid_t fapl_id; /* File access property list */ +} H5P_enc_cb_info_t; + /* * Each library property list class has a variable of this type that contains * class variables and methods used to initialize the class. diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 58f3d18..77aa816 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -116,8 +116,6 @@ typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, vo typedef H5P_prp_cb1_t H5P_prp_create_func_t; typedef H5P_prp_cb2_t H5P_prp_set_func_t; typedef H5P_prp_cb2_t H5P_prp_get_func_t; -typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size); -typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); typedef H5P_prp_cb2_t H5P_prp_delete_func_t; typedef H5P_prp_cb1_t H5P_prp_copy_func_t; typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); @@ -139,7 +137,7 @@ typedef enum H5D_mpio_actual_chunk_opt_mode_t { typedef enum H5D_mpio_actual_io_mode_t { /* The following four values are conveniently defined as a bit field so that - * we can switch from the default to independent or collective and then to + * we can switch from the default to indpendent or collective and then to * mixed without having to check the original value. * * NO_COLLECTIVE means that either collective I/O wasn't requested or that diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index fb91356..b84d69b 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -69,7 +69,7 @@ static herr_t H5P__strcrt_reg_prop(H5P_genclass_t *pclass); /* encode & decode callbacks */ -static herr_t H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size, void *udata); static herr_t H5P__strcrt_char_encoding_dec(const void **_pp, void *value); @@ -227,7 +227,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size) +H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) { const H5T_cset_t *encoding = (const H5T_cset_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Rint.c b/src/H5Rint.c index acf6b56..12b4878 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -290,7 +290,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE); /* Get the amount of space required to serialize the selection */ - if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) + if ((buf_size = H5S_SELECT_SERIAL_SIZE(space, loc->oloc->file)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") /* Increase buffer size to allow for the dataset OID */ @@ -306,7 +306,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr); /* Serialize the selection into heap buffer */ - if (H5S_SELECT_SERIALIZE(space, &p) < 0) + if (H5S_SELECT_SERIALIZE(space, &p, loc->oloc->file) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") /* Save the serialized buffer for later */ @@ -1604,7 +1604,7 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc) if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0) + if(H5S_encode(dspace, (unsigned char **)&buf, nalloc, H5P_FILE_ACCESS_DEFAULT)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") done: @@ -1629,7 +1629,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) +H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id) { H5F_t *f = NULL; /* Fake file structure*/ size_t extent_size; /* Size of serialized dataspace extent */ @@ -1640,7 +1640,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0, fapl_id))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed for extent */ @@ -1648,7 +1648,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size") /* Find out the size of buffer needed for selection */ - if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0) + if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj, f)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size") H5_CHECKED_ASSIGN(select_size, size_t, sselect_size, hssize_t); @@ -1678,7 +1678,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) /* Encode the selection part of dataspace. */ *p = pp; - if(H5S_SELECT_SERIALIZE(obj, p) < 0) + if(H5S_SELECT_SERIALIZE(obj, p, f) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space") } /* end else */ @@ -1772,8 +1772,8 @@ H5S_decode(const unsigned char **p) sizeof_size = *pp++; /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc(sizeof_size))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") + if(NULL == (f = H5F_fake_alloc(sizeof_size, H5P_FILE_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode size of extent information */ UINT32DECODE(pp, extent_size); diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index bb458a7..a9a4fd9 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -96,7 +96,7 @@ #define H5SM_B2_SPLIT_PERCENT 100 #define H5SM_B2_MERGE_PERCENT 40 -#define H5SM_LIST_VERSION 0 /* Version of Shared Object Header Message List Indexes */ +#define H5SM_LIST_VERSION 0 /* Verion of Shared Object Header Message List Indexes */ /****************************/ /* Package Typedefs */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 28395b1..d933f3c 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -36,8 +36,8 @@ static herr_t H5S__all_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S__all_release(H5S_t *space); static htri_t H5S__all_is_valid(const H5S_t *space); -static hssize_t H5S__all_serial_size(const H5S_t *space); -static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p); +static hssize_t H5S__all_serial_size(const H5S_t *space, H5F_t *f); +static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); static herr_t H5S__all_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -56,7 +56,7 @@ static herr_t H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); static herr_t H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S__all_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S__all_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); static herr_t H5S__all_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S__all_iter_release(H5S_sel_iter_t *sel_iter); @@ -268,7 +268,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) USAGE herr_t H5S__all_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - size_t nelem; IN: Number of elements to advance by + hsize_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -279,7 +279,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__all_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S__all_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) { FUNC_ENTER_STATIC_NOERR @@ -432,7 +432,7 @@ H5S__all_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offset fits within the + Determines if the current selection at the current offet fits within the extent for the dataspace. Offset is irrelevant for this type of selection. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -457,8 +457,9 @@ H5S__all_is_valid(const H5S_t H5_ATTR_UNUSED *space) Determine the number of bytes needed to store the serialized "all" selection information. USAGE - hssize_t H5S__all_serial_size(space) + hssize_t H5S_all_serial_size(space, f) H5S_t *space; IN: Dataspace pointer to query + H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -470,7 +471,7 @@ H5S__all_is_valid(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S__all_serial_size(const H5S_t H5_ATTR_UNUSED *space) +H5S__all_serial_size (const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f) { FUNC_ENTER_STATIC_NOERR @@ -490,11 +491,12 @@ H5S__all_serial_size(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_all_serialize(space, p) + herr_t H5S__all_serialize(space, p, f) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -506,7 +508,7 @@ H5S__all_serial_size(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__all_serialize(const H5S_t *space, uint8_t **p) +H5S__all_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) { uint8_t *pp = (*p); /* Local pointer for decoding */ @@ -518,8 +520,8 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p) HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)H5S_ALL_VERSION_1); /* Store the version number */ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 7a6d1be..f2050b6 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -28,7 +28,12 @@ #include "H5Spkg.h" /* Dataspace functions */ #include "H5VMprivate.h" /* Vector functions */ -/* Local Macros */ +/* Format version bounds for dataspace hyperslab selection */ +const unsigned H5O_sds_hyper_ver_bounds[] = { + H5S_HYPER_VERSION_1, /* H5F_LIBVER_EARLIEST */ + H5S_HYPER_VERSION_1, /* H5F_LIBVER_V18 */ + H5S_HYPER_VERSION_2 /* H5F_LIBVER_LATEST */ +}; /* Local datatypes */ @@ -80,8 +85,8 @@ static herr_t H5S__hyper_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S__hyper_release(H5S_t *space); static htri_t H5S__hyper_is_valid(const H5S_t *space); -static hssize_t H5S__hyper_serial_size(const H5S_t *space); -static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p); +static hssize_t H5S__hyper_serial_size(const H5S_t *space, H5F_t *f); +static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); static herr_t H5S__hyper_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -102,10 +107,9 @@ static herr_t H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords static herr_t H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *sel_iter); -static herr_t H5S__hyper_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S__hyper_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); static herr_t H5S__hyper_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S__hyper_iter_release(H5S_sel_iter_t *sel_iter); - /* Static function for optimizing hyperslab */ static hbool_t H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab_info[], unsigned rank); @@ -684,7 +688,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S__hyper_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) { unsigned ndims; /* Number of dimensions of dataset */ int fast_dim; /* Rank of the fastest changing dimension for the dataspace */ @@ -731,17 +735,17 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) /* Loop through, advancing the offset & counts, until all the nelements are accounted for */ while(nelem > 0) { /* Start with the fastest changing dimension */ - temp_dim = fast_dim; - while(temp_dim >= 0) { - if(temp_dim == fast_dim) { - size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ + temp_dim=fast_dim; + while(temp_dim>=0) { + if(temp_dim==fast_dim) { + hsize_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ hsize_t block_elem; /* Number of elements left in a block */ /* Compute the number of elements left in block */ block_elem = tdiminfo[temp_dim].block - iter_offset[temp_dim]; /* Compute the number of actual elements to advance */ - actual_elem = (size_t)MIN(nelem, block_elem); + actual_elem=MIN(nelem,block_elem); /* Move the iterator over as many elements as possible */ iter_offset[temp_dim] += actual_elem; @@ -804,8 +808,8 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) curr_span = ispan[curr_dim]; /* Increment absolute position */ - if(curr_dim == fast_dim) { - size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ + if(curr_dim==fast_dim) { + hsize_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ hsize_t span_elem; /* Number of elements left in a span */ /* Compute the number of elements left in block */ @@ -853,7 +857,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) /* Check if we are finished with the spans in the tree */ if(curr_dim >= 0) { - /* Walk back down the iterator positions, resetting them */ + /* Walk back down the iterator positions, reseting them */ while(curr_dim < fast_dim) { HDassert(curr_span); HDassert(curr_span->down); @@ -1037,7 +1041,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) /* Check if we are finished with the spans in the tree */ if(curr_dim >= 0) { - /* Walk back down the iterator positions, resetting them */ + /* Walk back down the iterator positions, reseting them */ while(curr_dim < fast_dim) { HDassert(curr_span); HDassert(curr_span->down); @@ -1704,7 +1708,7 @@ done: RETURNS TRUE if the selection fits within the extent, FALSE if it does not DESCRIPTION - Determines if the current selection at the current offset fits within the + Determines if the current selection at the current offet fits within the extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -1762,7 +1766,7 @@ done: TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offset fits within the + Determines if the current selection at the current offet fits within the extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -1947,13 +1951,140 @@ done: /*-------------------------------------------------------------------------- NAME + H5S_hyper_set_offset_size + PURPOSE + Determine the offset size (4 or 8 bytes) to use for encoding hyperslab selection info + USAGE + hssize_t H5S_hyper_set_offset_size(space, block_count, bounds_end, version, offset_size) + const H5S_t *space: IN: The maximum size of the hyperslab selection info + hsize_t block_count: IN: The number of blocks in the selection + hsize_t bounds_end: IN: The selection high bounds + uint32_t version: IN: The version used for encoding + uint8_t *offset_size: OUT: The offset size + + RETURNS + The offset size + DESCRIPTION + Determine the offset size for encoding hyperslab selection info based on the + the input parameter "version". This is for release 1.10. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_hyper_set_offset_size(const H5S_t *space, hsize_t block_count, hsize_t bounds_end[], uint32_t version, uint8_t *offset_size) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + switch(version) { + case H5S_HYPER_VERSION_1: + *offset_size = H5S_INFO_SIZE_4; + break; + + case H5S_HYPER_VERSION_2: + *offset_size = H5S_INFO_SIZE_8; + break; + + default: + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper offset size") + break; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5S_hyper_set_offset_size() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_hyper_set_version + PURPOSE + Determine the version to use for encoding hyperslab selection info + See tables 2 & 3 in the RFC: H5Sencode/H5Sdecode Format Change + USAGE + hssize_t H5S_hyper_set_version(space, block_count, bounds_end, f, version) + const H5S_t *space: IN: The dataspace + hsize_t block_count: IN: The number of blocks in the selection + hsize_t bounds_end: IN: The selection high bounds + H5F_t *f: IN: The file pointer + uint32_t *version: OUT: The version to use for encoding + + RETURNS + The version to use + DESCRIPTION + Determine the version to use for encoding hyperslab selection info based + on whether the number of blocks or the selection high bounds exceeds (2^32 - 1). + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_hyper_set_version(const H5S_t *space, hsize_t block_count, hsize_t bounds_end[], H5F_t *f, uint32_t *version) +{ + hbool_t count_up_version = FALSE; /* Whether number of blocks exceed (2^32 - 1) */ + hbool_t bound_up_version = FALSE; /* Whether high bounds exceed (2^32 - 1) */ + unsigned u; /* Local index veriable */ + uint32_t tmp_version; /* Temporay version */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Determine whether the number of blocks or the high bounds in the selection exceed (2^32 - 1) */ + if(block_count > H5S_UINT32_MAX) + count_up_version = TRUE; + else { + for(u = 0; u < space->extent.rank; u++) + if(bounds_end[u] > H5S_UINT32_MAX) + bound_up_version = TRUE; + } + + /* Use version 2 for unlimited selection */ + if(space->select.sel_info.hslab->unlim_dim >= 0) + tmp_version = H5S_HYPER_VERSION_2; + else if(H5S__hyper_is_regular(space)) { + + /* If exceed (2^32 -1) */ + if(count_up_version || bound_up_version) + tmp_version = H5S_HYPER_VERSION_2; + else + /* block_count < 4: version 1 */ + /* block_count >= 4: determined by low bound */ + tmp_version = (block_count < 4) ? H5S_HYPER_VERSION_1 : H5O_sds_hyper_ver_bounds[H5F_LOW_BOUND(f)]; + + } else { + /* Fail for irregular hyperslab if exceeds 32 bits */ + if(count_up_version) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of blocks in hyperslab selection exceeds 2^32") + else if(bound_up_version) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in hyperslab selection exceeds 2^32") + tmp_version = H5S_HYPER_VERSION_1; + } + + /* Version bounds check */ + if(tmp_version > H5O_sds_hyper_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace hyperslab selection version out of bounds") + + *version = tmp_version; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5S_hyper_set_version() */ + + +/*-------------------------------------------------------------------------- + NAME H5S__hyper_serial_size PURPOSE Determine the number of bytes needed to store the serialized hyperslab selection information. USAGE - hssize_t H5S__hyper_serial_size(space) + hssize_t H5S_hyper_serial_size(space, H5F_t *f) H5S_t *space; IN: Dataspace pointer to query + H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -1965,51 +2096,72 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S__hyper_serial_size(const H5S_t *space) +H5S__hyper_serial_size(const H5S_t *space, H5F_t *f) { - hsize_t block_count; /* block counter for regular hyperslabs */ - unsigned u; /* Counter */ - hssize_t ret_value = -1; /* return value */ + hsize_t block_count = 0; /* block counter for regular hyperslabs */ + hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds */ + hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds */ + uint32_t version; /* Version number */ + uint8_t offset_size; /* Offset size */ + unsigned u; /* Local index variable */ + hssize_t ret_value = -1; /* return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_NOAPI_NOINIT HDassert(space); - /* Check for version (right now, an unlimited dimension is the only thing - * that would bump the version) */ - if(space->select.sel_info.hslab->unlim_dim >= 0) + /* Get bounding box for the selection */ + HDmemset(bounds_end, 0, sizeof(bounds_end)); + if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */ + /* Determine the number of blocks */ + if(H5S__hyper_is_regular(space)) { + /* Check each dimension */ + for(block_count = 1, u = 0; u < space->extent.rank; u++) + block_count *= space->select.sel_info.hslab->opt_diminfo[u].count; + } /* end if */ + else + /* Spin through hyperslab spans, adding 8 * rank bytes for each block */ + block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); + + /* Get bounding box for the selection */ + if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + } + + /* Determine the version */ + if(H5S_hyper_set_version(space, block_count, bounds_end, f, &version) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + /* Determine the offset size */ + if(H5S_hyper_set_offset_size(space, block_count, bounds_end, version, &offset_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + if(version == H5S_HYPER_VERSION_2) { /* Version 2 */ /* Size required is always: * <type (4 bytes)> + <version (4 bytes)> + <flags (1 byte)> + * <length (4 bytes)> + <rank (4 bytes)> + - * (4 (start/stride/count/block) * <rank> * <value (8 bytes)>) = - * 17 + (4 * rank * 8) bytes + * (4 (start/stride/count/block) * <offset_size (8 bytes)> * <rank>) = + * 17 + (4 * 8 * rank) bytes */ - ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)space->extent.rank - * (hssize_t)8); - else { + HDassert(offset_size == 8); + ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)8 * (hssize_t)space->extent.rank); + } else { + HDassert(version == H5S_HYPER_VERSION_1); + HDassert(offset_size == 4); /* Version 1 */ /* Basic number of bytes required to serialize hyperslab selection: * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> + - * <length (4 bytes)> + <rank (4 bytes)> + <# of blocks (4 bytes)> - * = 24 bytes + * <length (4 bytes)> + <rank (4 bytes)> + <# of blocks (4 bytes)> + + * (2 (starting/ending offset) * <offset_size (4 bytes)> * <rank> * <# of blocks) = + * = 24 bytes + (2 * 4 * rank * block_count) */ ret_value = 24; - - /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { - /* Check each dimension */ - for(block_count = 1, u = 0; u < space->extent.rank; u++) - block_count *= space->select.sel_info.hslab->opt_diminfo[u].count; - } /* end if */ - else - /* Spin through hyperslab spans, adding 8 * rank bytes for each block */ - block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); - H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, hssize_t); - ret_value += (hssize_t)(8 * block_count * space->extent.rank); + ret_value += (hssize_t)(8 * space->extent.rank * block_count); } /* end else */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_serial_size() */ @@ -2052,7 +2204,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, HDassert(rank < H5O_LAYOUT_NDIMS); HDassert(p && pp); - /* Walk through the list of spans, recursing or outputting them */ + /* Walk through the list of spans, recursing or outputing them */ curr = spans->head; while(curr != NULL) { /* Recurse if this node has down spans */ @@ -2101,11 +2253,12 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_hyper_serialize(space, p) + herr_t H5S__hyper_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -2117,16 +2270,30 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__hyper_serialize(const H5S_t *space, uint8_t **p) +H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) { - uint8_t *pp; /* Local pointer for decoding */ - uint8_t *lenp; /* Pointer to length location for later storage */ - uint32_t len = 0; /* Number of bytes used */ + const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ + uint8_t *pp = (*p); /* Local pointer for decoding */ + hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ + hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ + hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ + hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ + hsize_t temp_off; /* Offset in a given dimension */ + uint8_t *lenp; /* pointer to length location for later storage */ + uint32_t len = 0; /* number of bytes used */ uint32_t version; /* Version number */ uint8_t flags = 0; /* Flags for message */ - hsize_t block_count; /* Block counter for regular hyperslabs */ + hsize_t block_count; /* block counter for regular hyperslabs */ + unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */ + unsigned ndims; /* Rank of the dataspace */ + unsigned u; /* Local counting variable */ + int done; /* Whether we are done with the iteration */ + uint8_t offset_size; + hsize_t bounds_start[H5S_MAX_RANK]; + hsize_t bounds_end[H5S_MAX_RANK]; + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_NOAPI_NOINIT /* Sanity checks */ HDassert(space); @@ -2134,62 +2301,76 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) pp = (*p); HDassert(pp); - /* Calculate version */ - if(space->select.sel_info.hslab->unlim_dim >= 0) { - version = 2; - flags |= H5S_SELECT_FLAG_UNLIM; - } /* end if */ - else - version = 1; + /* Set some convienence values */ + ndims = space->extent.rank; + diminfo = space->select.sel_info.hslab->opt_diminfo; + + if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */ + /* Calculate the # of blocks */ + if(H5S__hyper_is_regular(space)) { + /* Check each dimension */ + for(block_count = 1, u = 0; u < ndims; u++) + block_count *= diminfo[u].count; + } /* end if */ + else + /* Spin through hyperslab spans, adding 8 * rank bytes for each block */ + block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); + + /* Get bounding box */ + if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + } + + /* Determine the version to use */ + if(H5S_hyper_set_version(space, block_count, bounds_end, f, &version) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + /* Determine the size of offset info */ + if(H5S_hyper_set_offset_size(space, block_count, bounds_end, version, &offset_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + if(H5S__hyper_is_regular(space) && version == H5S_HYPER_VERSION_2) + flags |= H5S_HYPER_REGULAR; /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ UINT32ENCODE(pp, version); /* Store the version number */ - if(version >= 2) - *(pp)++ = flags; /* Store the flags */ + + if(version == 2) + *(pp)++ = flags; /* Store the flags */ else UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ - lenp = pp; /* keep the pointer to the length location for later */ - pp += 4; /* skip over space for length */ + lenp = pp; /* keep the pointer to the length location for later */ + pp += 4; /* skip over space for length */ + + len += 4; /* ndims */ /* Encode number of dimensions */ - UINT32ENCODE(pp, (uint32_t)space->extent.rank); - len += 4; + UINT32ENCODE(pp, (uint32_t)ndims); - /* If there is an unlimited dimension, only encode opt_unlim_diminfo */ - if(flags & H5S_SELECT_FLAG_UNLIM) { + /* If flags indicates a regular hyperslab or unlimited dimension, encode opt_diminfo */ + if(flags & H5S_HYPER_REGULAR) { unsigned i; HDassert(H5S_UNLIMITED == HSIZE_UNDEF); + HDassert(version == H5S_HYPER_VERSION_2); /* Iterate over dimensions */ + /* Encode start/stride/block/count */ for(i = 0; i < space->extent.rank; i++) { - /* Encode start/stride/block/count */ - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].start); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].stride); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].count); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].block); + UINT64ENCODE(pp, diminfo[i].start); + UINT64ENCODE(pp, diminfo[i].stride); + UINT64ENCODE(pp, diminfo[i].count); + UINT64ENCODE(pp, diminfo[i].block); } /* end for */ + len += (4 * space->extent.rank * 8); } /* end if */ /* Check for a "regular" hyperslab selection */ - else if(space->select.sel_info.hslab->diminfo_valid) { - const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ - hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ - unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */ - unsigned ndims; /* Rank of the dataspace */ - unsigned u; /* Local counting variable */ - hbool_t done; /* Whether we are done with the iteration */ + else if(H5S__hyper_is_regular(space)) { + HDassert(version == H5S_HYPER_VERSION_1); - /* Set some convenience values */ - ndims = space->extent.rank; + /* Set some convienence values */ fast_dim = ndims - 1; - diminfo = space->select.sel_info.hslab->opt_diminfo; - - /* Check each dimension */ - for(block_count = 1, u = 0; u < ndims; u++) - block_count *= diminfo[u].count; - /* Encode number of hyperslabs */ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); UINT32ENCODE(pp, (uint32_t)block_count); @@ -2265,18 +2446,16 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) } /* end while */ } /* end if */ else { - hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ - hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ - + HDassert(version == H5S_HYPER_VERSION_1); /* Encode number of hyperslabs */ - block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); UINT32ENCODE(pp, (uint32_t)block_count); - len += 4; + + len+=4; /* block_count */ /* Add 8 bytes times the rank for each hyperslab selected */ - H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, size_t); - len += (uint32_t)(8 * space->extent.rank * block_count); + H5_CHECK_OVERFLOW((8 * ndims * block_count), hsize_t, size_t); + len += (uint32_t)(8 * ndims * block_count); /* Encode each hyperslab in selection */ H5S__hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &pp); @@ -2288,8 +2467,9 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) /* Update encoding pointer */ *p = pp; - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5S__hyper_serialize() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5S_hyper_serialize() */ /*-------------------------------------------------------------------------- @@ -2339,8 +2519,7 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl /* (The header and rank have already beed decoded) */ rank = space->extent.rank; /* Retrieve rank from space */ - /* If there is an unlimited dimension, only encode opt_unlim_diminfo */ - if(flags & H5S_SELECT_FLAG_UNLIM) { + if(flags & H5S_HYPER_REGULAR) { hsize_t stride[H5O_LAYOUT_NDIMS]; /* Hyperslab stride information */ hsize_t count[H5O_LAYOUT_NDIMS]; /* Hyperslab count information */ @@ -2458,7 +2637,7 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[], HDassert(numblocks && *numblocks > 0); HDassert(buf && *buf); - /* Walk through the list of spans, recursing or outputting them */ + /* Walk through the list of spans, recursing or outputing them */ curr = spans->head; while(curr != NULL && *numblocks > 0) { /* Recurse if this node has down spans */ @@ -3509,7 +3688,7 @@ done: NAME H5S__hyper_add_span_element_helper PURPOSE - Add a single element to a span tree + Add a single elment to a span tree USAGE herr_t H5S_hyper_add_span_element_helper(prev_span, span_tree, rank, coords) H5S_hyper_span_info_t *span_tree; IN/OUT: Pointer to span tree to append to @@ -3713,7 +3892,7 @@ done: NAME H5S_hyper_add_span_element PURPOSE - Add a single element to a span tree + Add a single elment to a span tree USAGE herr_t H5S_hyper_add_span_element(space, span_tree, rank, coords) H5S_t *space; IN/OUT: Pointer to dataspace to add coordinate to @@ -5903,8 +6082,7 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride last_span = NULL; /* Generate all the span segments for this dimension */ - for(u = 0, stride_iter = 0; u < count[i]; u++, stride_iter += stride[i]) - { + for(u = 0, stride_iter = 0; u < count[i]; u++, stride_iter += stride[i]) { H5S_hyper_span_t *span; /* New hyperslab span */ /* Allocate a span node */ @@ -5946,8 +6124,7 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride } /* end for */ /* Indicate that there is a pointer to this tree */ - if(down) - down->count = 1; + down->count = 1; /* Success! Return the head of the list in the slowest changing dimension */ ret_value = down; @@ -7475,7 +7652,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported operation with unlimited selection") /* Get bounds of existing selection */ - if(H5S_hyper_bounds(space, bounds_start, bounds_end) < 0) + if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") /* Patch count and block to remove unlimited and include the @@ -8103,7 +8280,7 @@ H5S__hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter, /* Check if we have more spans in the tree */ if(curr_dim >= 0) { - /* Walk back down the iterator positions, resetting them */ + /* Walk back down the iterator positions, reseting them */ while((unsigned)curr_dim < fast_dim) { HDassert(curr_span); HDassert(curr_span->down); @@ -8282,7 +8459,7 @@ H5S__hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter, break; } /* end if */ else { - /* Walk back down the iterator positions, resetting them */ + /* Walk back down the iterator positions, reseting them */ while((unsigned)curr_dim < fast_dim) { HDassert(curr_span); HDassert(curr_span->down); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index db81ffc..5c65119 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -909,9 +909,10 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, else inner_type = outer_type; } /* end for */ -/****************************************** -* End of loop, walking through dimensions. -*******************************************/ +/*************************** +* End of loop, walking +* thru dimensions. +***************************/ /* At this point inner_type is actually the outermost type, even for 0-trip loop */ *new_type = inner_type; diff --git a/src/H5Snone.c b/src/H5Snone.c index a46a71a..4a7a7a3 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -37,8 +37,8 @@ static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_none_release(H5S_t *space); static htri_t H5S_none_is_valid(const H5S_t *space); -static hssize_t H5S_none_serial_size(const H5S_t *space); -static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p); +static hssize_t H5S_none_serial_size(const H5S_t *space, H5F_t *f); +static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); static herr_t H5S_none_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -57,7 +57,7 @@ static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); static herr_t H5S_none_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter); @@ -251,7 +251,7 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) USAGE herr_t H5S_none_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - size_t nelem; IN: Number of elements to advance by + hsize_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -262,7 +262,7 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem) +H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED nelem) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -408,7 +408,7 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offset fits within the + Determines if the current selection at the current offet fits within the extent for the dataspace. Offset is irrelevant for this type of selection. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -433,8 +433,9 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) Determine the number of bytes needed to store the serialized "none" selection information. USAGE - hssize_t H5S_none_serial_size(space) + hssize_t H5S_none_serial_size(space, f) H5S_t *space; IN: Dataspace pointer to query + H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -446,7 +447,7 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) +H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -466,11 +467,12 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_none_serialize(space, p) + herr_t H5S_none_serialize(space, p, f) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -482,7 +484,7 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_serialize(const H5S_t *space, uint8_t **p) +H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) { uint8_t *pp = (*p); /* Local pointer for decoding */ @@ -494,8 +496,8 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p) HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)H5S_NONE_VERSION_1); /* Store the version number */ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 6ded287..f6bd3d1 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -33,8 +33,28 @@ #define H5S_VALID_PERM 0x02 /* Flags for serialization of selections */ -#define H5S_SELECT_FLAG_UNLIM 0x01 -#define H5S_SELECT_FLAG_BITS (H5S_SELECT_FLAG_UNLIM) +#define H5S_HYPER_REGULAR 0x01 +#define H5S_SELECT_FLAG_BITS (H5S_HYPER_REGULAR) + +/* Versions for H5S_SEL_HYPER selection info */ +#define H5S_HYPER_VERSION_1 1 +#define H5S_HYPER_VERSION_2 2 + +/* Versions for H5S_SEL_POINTS selection info */ +#define H5S_POINT_VERSION_1 1 + +/* Versions for H5S_SEL_NONE selection info */ +#define H5S_NONE_VERSION_1 1 + +/* Versions for H5S_SEL_ALL selection info */ +#define H5S_ALL_VERSION_1 1 + +/* Size of point/offset info for H5S_SEL_POINTS/H5S_SEL_HYPER */ +#define H5S_INFO_SIZE_4 0x04 /* 4 bytes: 32 bits */ +#define H5S_INFO_SIZE_8 0x08 /* 8 bytes: 64 bits */ +#define H5S_SELECT_INFO_SIZE_BITS (H5S_INFO_SIZE_4|H5S_INFO_SIZE_8) + +#define H5S_UINT32_MAX 4294967295 /* 2^32 - 1 */ /* Length of stack-allocated sequences for "project intersect" routines */ #define H5S_PROJECT_INTERSECT_NSEQS 256 @@ -139,9 +159,9 @@ typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space); /* Method to determine if current selection is valid for dataspace */ typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space); /* Method to determine number of bytes required to store current selection */ -typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space); +typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space, H5F_t *f); /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */ -typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p); +typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p, H5F_t *f); /* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); @@ -225,7 +245,7 @@ typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter); /* Method to determine if there are more blocks left in the current selection */ typedef htri_t (*H5S_sel_iter_has_next_block_func_t)(const H5S_sel_iter_t *iter); /* Method to move selection iterator to the next element in the selection */ -typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, size_t nelem); +typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, hsize_t nelem); /* Method to move selection iterator to the next block in the selection */ typedef herr_t (*H5S_sel_iter_next_block_func_t)(H5S_sel_iter_t *iter); /* Method to release iterator for current selection */ @@ -265,8 +285,9 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_none[1]; */ H5_DLLVAR const H5S_select_class_t H5S_sel_point[1]; -/* Array of versions for Dataspace */ +/* Array of versions for Dataspace and hyperslab selections */ H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS]; +H5_DLLVAR const unsigned H5O_sds_hyper_ver_bounds[H5F_LIBVER_NBOUNDS]; /* Extent functions */ H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent); diff --git a/src/H5Spoint.c b/src/H5Spoint.c index fb8e311..ab40e44 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -38,8 +38,8 @@ static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_point_release(H5S_t *space); static htri_t H5S_point_is_valid(const H5S_t *space); -static hssize_t H5S_point_serial_size(const H5S_t *space); -static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p); +static hssize_t H5S_point_serial_size(const H5S_t *space, H5F_t *f); +static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); static herr_t H5S_point_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -58,7 +58,7 @@ static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S_point_iter_release(H5S_sel_iter_t *sel_iter); @@ -278,7 +278,7 @@ done: USAGE herr_t H5S_point_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - size_t nelem; IN: Number of elements to advance by + hsize_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -289,7 +289,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S_point_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -376,7 +376,7 @@ H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter) USAGE herr_t H5S_point_add(space, num_elem, coord) H5S_t *space; IN: Dataspace of selection to modify - size_t num_elem; IN: Number of elements in COORD array. + hsize_t num_elem; IN: Number of elements in COORD array. const hsize_t *coord[]; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure @@ -388,7 +388,7 @@ H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) +H5S_point_add(H5S_t *space, H5S_seloper_t op, hsize_t num_elem, const hsize_t *coord) { H5S_pnt_node_t *top = NULL, *curr = NULL, *new_node = NULL; /* Point selection nodes */ unsigned u; /* Counter */ @@ -527,7 +527,7 @@ H5S_point_release (H5S_t *space) herr_t H5S_select_elements(dsid, op, num_elem, coord) hid_t dsid; IN: Dataspace ID of selection to modify H5S_seloper_t op; IN: Operation to perform on current selection - size_t num_elem; IN: Number of elements in COORD array. + hsize_t num_elem; IN: Number of elements in COORD array. const hsize_t *coord; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure @@ -549,7 +549,7 @@ H5S_point_release (H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, +H5S_select_elements(H5S_t *space, H5S_seloper_t op, hsize_t num_elem, const hsize_t *coord) { herr_t ret_value = SUCCEED; /* return value */ @@ -676,7 +676,7 @@ done: TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offset fits within the + Determines if the current selection at the current offet fits within the extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -752,6 +752,93 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Sget_select_elem_npoints() */ +/*-------------------------------------------------------------------------- + NAME + H5S_point_set_version + PURPOSE + Determine the version to use for encoding points selection info + USAGE + hssize_t H5S_point_set_version(space, bounds_end, f, version) + const H5S_t *space; IN: The dataspace + hsize_t bounds_end: IN: The selection high bounds + H5F_t *f: IN: The file pointer + uint32_t *version: OUT: The version to use for encoding + RETURNS + The version to use + DESCRIPTION + Determine the version to use for encoding points selection info: + For 1.10, return 1 + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_point_set_version(const H5S_t *space, hsize_t bounds_end[], H5F_t *f, uint32_t *version) +{ + hbool_t exceed = FALSE; + unsigned u; + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI_NOINIT + + *version = H5S_POINT_VERSION_1; + + /* Determine whether the number of points or the high bounds in the selection exceed (2^32 - 1) */ + for(u = 0; u < space->extent.rank; u++) + if(bounds_end[u] > H5S_UINT32_MAX) { + exceed = TRUE; + break; + } + + if(space->select.num_elem > H5S_UINT32_MAX) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of points in point selection exceeds 2^32") + else if(exceed) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in point selection exceeds 2^32") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5S_point_set_version() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_point_set_info_size + PURPOSE + Determine the size of point info to use for encoding selection info + USAGE + hssize_t H5S_point_set_info_size(space, bounds_end, version, point_size) + const H5S_t *space: IN: Dataspace ID of selection to query + hsize_t bounds_end[]: IN: The selection high bounds + uint32_t version: IN: The version used for encoding + uint8_t *point_size: OUT: The size of point info + RETURNS + The size of the points selection info + DESCRIPTION + Determine the size for encoding points selection info: + For 1.10, return 4 + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_point_set_info_size(const H5S_t *space, hsize_t H5_ATTR_UNUSED bounds_end[], uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED *point_size) +{ + hsize_t max_size = 0; + unsigned u; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(version == H5S_POINT_VERSION_1); + + *point_size = H5S_INFO_SIZE_4; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5S_point_set_info_size() */ + /*-------------------------------------------------------------------------- NAME @@ -760,8 +847,9 @@ done: Determine the number of bytes needed to store the serialized point selection information. USAGE - hssize_t H5S_point_serial_size(space) + hssize_t H5S_point_serial_size(space, f) H5S_t *space; IN: Dataspace pointer to query + H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -773,29 +861,54 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_point_serial_size (const H5S_t *space) +H5S_point_serial_size (const H5S_t *space, H5F_t *f) { H5S_pnt_node_t *curr; /* Point information nodes */ + hsize_t bounds_start[H5S_MAX_RANK]; + hsize_t bounds_end[H5S_MAX_RANK]; + uint32_t version; /* Version number */ + uint8_t point_size; /* Size of point info */ hssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT HDassert(space); - /* Basic number of bytes required to serialize point selection: + /* Get bounding box for the selection */ + HDmemset(bounds_end, 0, sizeof(bounds_end)); + if(H5S_point_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + + /* Determine the version */ + if(H5S_point_set_version(space, bounds_end, f, &version) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + /* Determine the size of point info */ + if(H5S_point_set_info_size(space, bounds_end, version, &point_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + HDassert(version == H5S_POINT_VERSION_1); + HDassert(point_size == H5S_INFO_SIZE_4); + + /* Basic number of bytes required to serialize point selection: */ + /* * <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> + - * <length (4 bytes)> + <rank (4 bytes)> + <# of points (4 bytes)> = 24 bytes + * <length (4 bytes)> + <rank (4 bytes)> */ - ret_value = 24; + ret_value=20; + + /* <num points (depend on point_size)> */ + ret_value += point_size; /* Count points in selection */ curr=space->select.sel_info.pnt_lst->head; while(curr!=NULL) { - /* Add 4 bytes times the rank for each element selected */ - ret_value+=4*space->extent.rank; - curr=curr->next; + /* Add <point_size> bytes times the rank for each element selected */ + ret_value += point_size * space->extent.rank; + curr = curr->next; } /* end while */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_point_serial_size() */ @@ -806,11 +919,12 @@ H5S_point_serial_size (const H5S_t *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_point_serialize(space, p) + herr_t H5S_point_serialize(space, p, f) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -822,41 +936,63 @@ H5S_point_serial_size (const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_serialize (const H5S_t *space, uint8_t **p) +H5S_point_serialize (const H5S_t *space, uint8_t **p, H5F_t *f) { H5S_pnt_node_t *curr; /* Point information nodes */ uint8_t *pp = (*p); /* Local pointer for decoding */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len=0; /* number of bytes used */ unsigned u; /* local counting variable */ + uint32_t version; /* Version number */ + uint8_t point_size; /* Size of point info */ + hsize_t bounds_start[H5S_MAX_RANK]; + hsize_t bounds_end[H5S_MAX_RANK]; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT /* Check args */ HDassert(space); HDassert(p); HDassert(pp); + /* Get bounding box for the selection */ + HDmemset(bounds_end, 0, sizeof(bounds_end)); + if(H5S_point_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + + /* Determine the version */ + if(H5S_point_set_version(space, bounds_end, f, &version) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + /* Determine the size of point info */ + if(H5S_point_set_info_size(space, bounds_end, version, &point_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + + HDassert(point_size == H5S_INFO_SIZE_4); + HDassert(version == H5S_POINT_VERSION_1); + /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, version); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ - lenp = pp; /* Keep the pointer to the length location for later */ - pp += 4; /* Skip over space for length */ + lenp = pp; /* Keep the pointer to the length location for later */ + pp += 4; /* Skip over space for length */ + len += 8; /* Add in advance # of bytes for num of dimensions and num elements */ /* Encode number of dimensions */ UINT32ENCODE(pp, (uint32_t)space->extent.rank); - len+=4; + /* Encode number of elements */ UINT32ENCODE(pp, (uint32_t)space->select.num_elem); - len+=4; /* Encode each point in selection */ curr=space->select.sel_info.pnt_lst->head; while(curr!=NULL) { /* Add 4 bytes times the rank for each element selected */ - len+=4*space->extent.rank; + len += 4 * space->extent.rank; /* Encode each point */ for(u=0; u<space->extent.rank; u++) @@ -871,7 +1007,8 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) /* Update encoding pointer */ *p = pp; - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_serialize() */ @@ -906,7 +1043,7 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */ hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */ const uint8_t *pp = (*p); /* Local pointer for decoding */ - size_t num_elem = 0; /* Number of elements in selection */ + hsize_t num_elem = 0; /* Number of elements in selection */ unsigned rank; /* Rank of points */ unsigned i, j; /* local counting variables */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1620,7 +1757,7 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "unsupported operation attempted") /* Call the real element selection routine */ - if((ret_value = H5S_select_elements(space, op, num_elem, coord)) < 0) + if((ret_value = H5S_select_elements(space, op, (hsize_t)num_elem, coord)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't select elements") done: diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 15ce75d..e46c43b 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -148,8 +148,9 @@ typedef struct H5S_sel_iter_op_t { #define H5S_GET_SELECT_TYPE(S) ((S)->select.type->type) #define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.type->get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_VALID(S) ((*(S)->select.type->is_valid)(S)) -#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.type->serial_size)(S)) -#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.type->serialize)(S,BUF)) +#define H5S_SELECT_RELEASE(S) ((*(S)->select.type->release)(S)) +#define H5S_SELECT_SERIAL_SIZE(S,F) ((*(S)->select.type->serial_size)(S,F)) +#define H5S_SELECT_SERIALIZE(S,BUF,F) ((*(S)->select.type->serialize)(S,BUF,F)) #define H5S_SELECT_BOUNDS(S,START,END) ((*(S)->select.type->bounds)(S,START,END)) #define H5S_SELECT_OFFSET(S, OFFSET) ((*(S)->select.type->offset)(S, OFFSET)) #define H5S_SELECT_IS_CONTIGUOUS(S) ((*(S)->select.type->is_contiguous)(S)) @@ -173,8 +174,9 @@ typedef struct H5S_sel_iter_op_t { #define H5S_GET_SELECT_TYPE(S) (H5S_get_select_type(S)) #define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_VALID(S) (H5S_select_valid(S)) -#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S)) -#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF)) +#define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) +#define H5S_SELECT_SERIAL_SIZE(S,F) (H5S_select_serial_size(S,F)) +#define H5S_SELECT_SERIALIZE(S,BUF,F) (H5S_select_serialize(S,BUF,F)) #define H5S_SELECT_BOUNDS(S,START,END) (H5S_get_select_bounds(S,START,END)) #define H5S_SELECT_OFFSET(S, OFFSET) (H5S_get_select_offset(S, OFFSET)) #define H5S_SELECT_IS_CONTIGUOUS(S) (H5S_select_is_contiguous(S)) @@ -193,7 +195,6 @@ typedef struct H5S_sel_iter_op_t { #endif /* H5S_MODULE */ /* Handle these callbacks in a special way, since they have prologs that need to be executed */ #define H5S_SELECT_COPY(DST,SRC,SHARE) (H5S_select_copy(DST,SRC,SHARE)) -#define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) #define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF)) @@ -219,7 +220,7 @@ H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space/*o H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]); H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds); -H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc); +H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id); H5_DLL H5S_t *H5S_decode(const unsigned char **p); H5_DLL herr_t H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -254,8 +255,8 @@ H5_DLL herr_t H5S_select_release(H5S_t *ds); H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); -H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space); -H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p); +H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space, H5F_t *f); +H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); H5_DLL htri_t H5S_select_is_regular(const H5S_t *space); @@ -275,7 +276,7 @@ H5_DLL herr_t H5S_select_none(H5S_t *space); /* Operations on point selections */ H5_DLL herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op, - size_t num_elem, const hsize_t *coord); + hsize_t num_elem, const hsize_t *coord); /* Operations on hyperslab selections */ H5_DLL herr_t H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], @@ -305,7 +306,7 @@ H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space, H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size); H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords); H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter); -H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Sselect.c b/src/H5Sselect.c index ec74523..873f555 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -160,7 +160,7 @@ H5S_select_release(H5S_t *ds) HDassert(ds); /* Call the selection type's release function */ - if((ds->select.type) && ((ret_value = (*ds->select.type->release)(ds)) < 0)) + if((ret_value = (*ds->select.type->release)(ds)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection") done: @@ -223,7 +223,7 @@ done: *------------------------------------------------------------------------- */ hssize_t -H5S_select_serial_size(const H5S_t *space) +H5S_select_serial_size(const H5S_t *space, H5F_t *f) { hssize_t ret_value = -1; /* Return value */ @@ -232,7 +232,7 @@ H5S_select_serial_size(const H5S_t *space) HDassert(space); /* Call the selection type's serial_size function */ - ret_value=(*space->select.type->serial_size)(space); + ret_value=(*space->select.type->serial_size)(space, f); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_serial_size() */ @@ -249,6 +249,7 @@ H5S_select_serial_size(const H5S_t *space) uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. + H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -263,7 +264,7 @@ H5S_select_serial_size(const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_serialize(const H5S_t *space, uint8_t **p) +H5S_select_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) { herr_t ret_value=SUCCEED; /* Return value */ @@ -273,7 +274,7 @@ H5S_select_serialize(const H5S_t *space, uint8_t **p) HDassert(p); /* Call the selection type's serialize function */ - ret_value=(*space->select.type->serialize)(space,p); + ret_value=(*space->select.type->serialize)(space,p,f); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_serialize() */ @@ -361,7 +362,7 @@ H5S_get_select_npoints(const H5S_t *space) TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offset fits within the + Determines if the current selection at the current offet fits within the extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -403,7 +404,7 @@ done: TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. DESCRIPTION - Determines if the current selection at the current offset fits within the + Determines if the current selection at the current offet fits within the extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -1222,7 +1223,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) USAGE herr_t H5S_select_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN/OUT: Selection iterator to change - size_t nelem; IN: Number of elements to advance by + hsize_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success, negative on failure. DESCRIPTION @@ -1237,7 +1238,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S_select_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) { herr_t ret_value = FAIL; /* Return value */ @@ -309,7 +309,7 @@ static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, /* Library Private Variables */ /*****************************/ -/* The native endianness of the platform */ +/* The native endianess of the platform */ H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR; @@ -2961,7 +2961,7 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0, H5P_FILE_ACCESS_DEFAULT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed */ @@ -3016,7 +3016,7 @@ H5T_decode(size_t buf_size, const unsigned char *buf) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0, H5P_FILE_ACCESS_DEFAULT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode the type of the information */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 1719f8f..4e4a551 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -385,7 +385,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) if(H5T_set_version(file, type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype") - /* Calculate message size information, for creating object header */ + /* Calculate message size infomation, for creating object header */ dtype_size = H5O_msg_size_f(file, tcpl_id, H5O_DTYPE_ID, type, (size_t)0); HDassert(dtype_size); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 803a6da..f3af9e1 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -109,7 +109,7 @@ * least as large as the destination. Overflows can occur when * the destination is narrower than the source. * - * xF: Integers to float-point(float or double) values where the destination + * xF: Integers to float-point(float or double) values where the desination * is at least as wide as the source. This case cannot generate * overflows. * @@ -2102,7 +2102,7 @@ H5T__conv_struct_subset(const H5T_cdata_t *cdata) * * For each element do * For I=1..NELMTS do - * If sizeof destination type <= sizeof source type then + * If sizeof detination type <= sizeof source type then * Convert member to destination type; * Move member as far left as possible; * @@ -2314,7 +2314,7 @@ done: * function. The algorithm is basically: * * For each member of the struct - * If sizeof destination type <= sizeof source type then + * If sizeof detination type <= sizeof source type then * Convert member to destination type for all elements * Move memb to BKG buffer for all elements * Else @@ -2421,7 +2421,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, offset -= src_memb->size; if(dst_memb->size > src->shared->size-offset) { cdata->priv = H5T_conv_struct_free(priv); - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion is unsupported by this function") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "convertion is unsupported by this function") } /* end if */ } /* end if */ } /* end for */ @@ -4250,7 +4250,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * The exponent is too small to fit in the exponent field, * but by shifting the mantissa to the right we can - * accommodate that value. The mantissa of course is no + * accomodate that value. The mantissa of course is no * longer normalized. */ mrsh += (size_t)(1 - expo); diff --git a/src/H5Toffset.c b/src/H5Toffset.c index c0e94fc..668e730 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -33,12 +33,12 @@ static herr_t H5T_set_offset(const H5T_t *dt, size_t offset); * Function: H5Tget_offset * * Purpose: Retrieves the bit offset of the first significant bit. The - * significant bits of an atomic datum can be offset from the + * signficant bits of an atomic datum can be offset from the * beginning of the memory for that datum by an amount of * padding. The `offset' property specifies the number of bits * of padding that appear to the "right of" the value. That is, * if we have a 32-bit datum with 16-bits of precision having - * the value 0x1122 then it will be laid out in memory as (from + * the value 0x1122 then it will be layed out in memory as (from * small byte address toward larger byte addresses): * * Big Big Little Little @@ -84,12 +84,12 @@ done: * Function: H5T_get_offset * * Purpose: Retrieves the bit offset of the first significant bit. The - * significant bits of an atomic datum can be offset from the + * signficant bits of an atomic datum can be offset from the * beginning of the memory for that datum by an amount of * padding. The `offset' property specifies the number of bits * of padding that appear to the "right of" the value. That is, * if we have a 32-bit datum with 16-bits of precision having - * the value 0x1122 then it will be laid out in memory as (from + * the value 0x1122 then it will be layed out in memory as (from * small byte address toward larger byte addresses): * * Big Big Little Little @@ -134,12 +134,12 @@ done: * Function: H5Tset_offset * * Purpose: Sets the bit offset of the first significant bit. The - * significant bits of an atomic datum can be offset from the + * signficant bits of an atomic datum can be offset from the * beginning of the memory for that datum by an amount of * padding. The `offset' property specifies the number of bits * of padding that appear to the "right of" the value. That is, * if we have a 32-bit datum with 16-bits of precision having - * the value 0x1122 then it will be laid out in memory as (from + * the value 0x1122 then it will be layed out in memory as (from * small byte address toward larger byte addresses): * * Big Big Little Little @@ -203,12 +203,12 @@ done: * Function: H5T_set_offset * * Purpose: Sets the bit offset of the first significant bit. The - * significant bits of an atomic datum can be offset from the + * signficant bits of an atomic datum can be offset from the * beginning of the memory for that datum by an amount of * padding. The `offset' property specifies the number of bits * of padding that appear to the "right of" the value. That is, * if we have a 32-bit datum with 16-bits of precision having - * the value 0x1122 then it will be laid out in memory as (from + * the value 0x1122 then it will be layed out in memory as (from * small byte address toward larger byte addresses): * * Big Big Little Little diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index e1b996c..96132b0 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -295,7 +295,7 @@ typedef enum H5T_state_t { H5T_STATE_OPEN /*named constant, open object header */ } H5T_state_t; - /* This struct is shared between all occurrences of an open named type */ + /* This struct is shared between all occurances of an open named type */ typedef struct H5T_shared_t { hsize_t fo_count; /* number of references to this file object */ H5T_state_t state; /*current state of the type */ diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 89cdcfd..8051b6d 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -100,7 +100,7 @@ typedef struct H5T_subset_info_t { /* Forward declarations for prototype arguments */ struct H5O_t; -/* The native endianness of the platform */ +/* The native endianess of the platform */ H5_DLLVAR H5T_order_t H5T_native_order_g; /* Private functions */ diff --git a/src/H5Znbit.c b/src/H5Znbit.c index fe0041c..c0afc38 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -558,7 +558,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, H5T_t *dtype_base = NULL; /* Array datatype's base datatype */ H5T_class_t dtype_base_class; /* Array datatype's base datatype's class */ size_t dtype_size; /* Array datatype's size (in bytes) */ - htri_t is_vlstring; /* flag indicating if datatype is variable-length string */ + htri_t is_vlstring; /* flag indicating if datatype is varible-length string */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -667,7 +667,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, size_t dtype_member_offset; /* Compound datatype's current member datatype's offset (in bytes) */ size_t dtype_next_member_offset;/* Compound datatype's next member datatype's offset (in bytes) */ size_t dtype_size; /* Compound datatype's size (in bytes) */ - htri_t is_vlstring; /* flag indicating if datatype is variable-length string */ + htri_t is_vlstring; /* flag indicating if datatype is varible-length string */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index 0df05f0..fcb2d37 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -50,7 +50,7 @@ typedef int H5Z_filter_t; * unlimited amount, but currently each * filter uses a bit in a 32-bit field, * so the format would have to be - * changed to accommodate that) + * changed to accomodate that) */ /* Flags for filter definition (stored) */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index cdf31a4..d139696 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -988,7 +988,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) if(status == H5D_FILL_VALUE_UNDEFINED) cd_values[H5Z_SCALEOFFSET_PARM_FILAVAIL] = H5Z_SCALEOFFSET_FILL_UNDEFINED; else { - int need_convert = FALSE; /* Flag indicating conversion of byte order */ + int need_convert = FALSE; /* Flag indicating convertion of byte order */ cd_values[H5Z_SCALEOFFSET_PARM_FILAVAIL] = H5Z_SCALEOFFSET_FILL_DEFINED; @@ -1047,7 +1047,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value uint32_t minbits = 0; /* minimum number of bits to store values */ unsigned long long minval= 0; /* minimum value of input buffer */ enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */ - int need_convert = FALSE; /* flag indicating conversion of byte order */ + int need_convert = FALSE; /* flag indicating convertion of byte order */ unsigned char *outbuf = NULL; /* pointer to new output buffer */ unsigned buf_offset = 21; /* buffer offset because of parameters stored in file */ unsigned i; /* index */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 67646a0..d4b59a6 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -329,7 +329,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); } /* The difference of this macro from H5Z_XFORM_DO_OP3 is that it handles the operations when the left operand is empty, like -x or +x. - * The reason that it's separated from H5Z_XFORM_DO_OP3 is because compilers don't accept operations like *x or /x. So in H5Z_do_op, + * The reason that it's seperated from H5Z_XFORM_DO_OP3 is because compilers don't accept operations like *x or /x. So in H5Z_do_op, * these two macros are called in different ways. (SLU 2012/3/20) */ #define H5Z_XFORM_DO_OP6(OP) \ @@ -967,7 +967,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_new_node - * Purpose: Create and initialize a new H5Z_node structure. + * Purpose: Create and initilize a new H5Z_node structure. * Return: Success: Valid H5Z_node ptr * NULLure: NULL * Programmer: Bill Wendling @@ -999,7 +999,7 @@ done: * Purpose: If the transform is trivial, this function applies it. * Otherwise, it calls H5Z_xform_eval_full to do the full * transform. - * Return: SUCCEED if transform applied successfully, FAIL otherwise + * Return: SUCCEED if transform applied succesfully, FAIL otherwise * Programmer: Leon Arber * 5/1/04 * Modifications: @@ -1485,7 +1485,7 @@ H5Z_xform_reduce_tree(H5Z_node* tree) * Purpose: If the root of the tree passed in points to a simple * arithmetic operation and the left and right subtrees are both * integer or floating point values, this function does that - * operation, free the left and right subtrees, and replaces + * operation, free the left and rigt subtrees, and replaces * the root with the result of the operation. * Return: None. * Programmer: Leon Arber diff --git a/src/H5detect.c b/src/H5detect.c index 2d33a3d..1c5554e 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -43,7 +43,7 @@ static const char *FileHeader = "\n\ * system or configure has detected those Unix * features which aren't available. We're not * running on a Vax or other machine with mixed - * endianness. + * endianess. * * Modifications: * @@ -55,13 +55,13 @@ static const char *FileHeader = "\n\ #include "H5Rpublic.h" #if defined(__has_attribute) -# if __has_attribute(no_sanitize_address) -# define HDF_NO_UBSAN __attribute__((no_sanitize_address)) -# else -# define HDF_NO_UBSAN -# endif +#if __has_attribute(no_sanitize) +#define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) #else -# define HDF_NO_UBSAN +#define HDF_NO_UBSAN +#endif +#else +#define HDF_NO_UBSAN #endif #define MAXDETECT 64 @@ -695,7 +695,7 @@ H5T__init_native(void)\n\ FUNC_ENTER_PACKAGE\n"); for(i = 0; i < nd; i++) { - /* The native endianness of this machine */ + /* The native endianess of this machine */ /* The INFO.perm now contains `-1' for bytes that aren't used and * are always zero. This happens on the Cray for `short' where * sizeof(short) is 8, but only the low-order 4 bytes are ever used. @@ -1079,8 +1079,8 @@ fix_order(int n, int last, int *perm, const char **mesg) } else { /* * Bi-endian machines like VAX. - * (NOTE: This is not an actual determination of the VAX-endianness. - * It could have some other endianness and fall into this + * (NOTE: This is not an actual determination of the VAX-endianess. + * It could have some other endianess and fall into this * case - JKM & QAK) */ HDassert(0 == n % 2); @@ -1111,7 +1111,7 @@ fix_order(int n, int last, int *perm, const char **mesg) * * This function assumes that the exponent occupies higher * order bits than the mantissa and that the most significant - * bit of the mantissa is next to the least significant bit + * bit of the mantissa is next to the least signficant bit * of the exponent. * * @@ -1271,7 +1271,7 @@ mark. Bits of integer types are printed as\n\ If the most significant bit of the normalized\n\ mantissa (always a `1' except for `0.0') is\n\ not stored then an `implicit=yes' appears\n\ -under the field description. In this case,\n\ +under the field description. In thie case,\n\ the radix point is still assumed to be\n\ before the first `M' but after the implicit\n\ bit.\n"; @@ -1675,13 +1675,11 @@ detect_alignments(void) */ static int verify_signal_handlers(int signum, void (*handler)(int)) { -#if defined(__has_feature) /* Clang */ +#if defined(__has_feature) #if __has_feature(address_sanitizer) || __has_feature(thread_sanitizer) /* Under the address and thread sanitizers, don't raise any signals. */ return 0; #endif -#elif defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_THREAD__) /* GCC */ - return 0; #endif void (*save_handler)(int) = HDsignal(signum, handler); volatile int i, val; diff --git a/src/H5private.h b/src/H5private.h index 8974e46..6334f39 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -116,7 +116,7 @@ #endif /* - * flock() in sys/file.h is used for the implementation of file locking. + * flock() in sys/file.h is used for the implemention of file locking. */ #if defined(H5_HAVE_FLOCK) && defined(H5_HAVE_SYS_FILE_H) # include <sys/file.h> @@ -132,7 +132,7 @@ /* * Unix ioctls. These are used by h5ls (and perhaps others) to determine a - * reasonable output width. + * resonable output width. */ #ifdef H5_HAVE_SYS_IOCTL_H # include <sys/ioctl.h> diff --git a/src/H5public.h b/src/H5public.h index 6d767b4..5d96b2a 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -115,7 +115,7 @@ extern "C" { /* * Status return values. Failed integer functions in HDF5 result almost * always in a negative value (unsigned failing functions sometimes return - * zero for failure) while successful return is non-negative (often zero). + * zero for failure) while successfull return is non-negative (often zero). * The negative failure value is most commonly -1, but don't bet on it. The * proper way to detect failure is something like: * @@ -298,7 +298,7 @@ typedef enum { } H5_iter_order_t; /* Iteration callback values */ -/* (Actually, any positive value will cause the iterator to stop and pass back +/* (Actually, any postive value will cause the iterator to stop and pass back * that positive value to the function that called the iterator) */ #define H5_ITER_ERROR (-1) diff --git a/src/H5system.c b/src/H5system.c index 186d8fa..719b7e0 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -294,13 +294,13 @@ HDfprintf(FILE *stream, const char *fmt, ...) unsigned short x = (unsigned short)va_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!*modifier) { - unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occurring */ + unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occuring */ n = fprintf(stream, format_templ, x); } else if(!HDstrcmp(modifier, "l")) { - unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occurring */ + unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ n = fprintf(stream, format_templ, x); } else { - uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occurring */ + uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */ n = fprintf(stream, format_templ, x); } break; @@ -333,7 +333,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'a': { - haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occurring */ + haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ if(H5F_addr_defined(x)) { len = 0; @@ -387,7 +387,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 's': case 'p': { - char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occurring */ + char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occuring */ n = fprintf(stream, format_templ, x); } break; |