diff options
Diffstat (limited to 'src')
38 files changed, 2710 insertions, 2245 deletions
diff --git a/src/H5B2cache.c b/src/H5B2cache.c index af329c7..09d4ee2 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -204,7 +204,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version") /* B-tree class */ - id = *p++; + id = (H5B2_subid_t)*p++; if(id >= H5B2_NUM_BTREE_ID) HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "invalid B-tree type") @@ -166,8 +166,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D_create_named(&loc, name, type_id, space, lcpl_id, - dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D_create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") @@ -328,7 +327,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") /* Open the dataset */ - if((dset = H5D_open(&dset_loc, dapl_id, dxpl_id)) == NULL) + if(NULL == (dset = H5D_open(&dset_loc, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open dataset") /* Register an atom for the dataset */ diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index c4e9e90..79f7789 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -192,9 +192,9 @@ H5B_class_t H5B_BTREE[1] = {{ H5D_btree_cmp3, /*cmp3 */ H5D_btree_found, /*found */ H5D_btree_insert, /*insert */ - H5B_LEFT, /*critical key */ FALSE, /*follow min branch? */ FALSE, /*follow max branch? */ + H5B_LEFT, /*critical key */ H5D_btree_remove, /*remove */ H5D_btree_decode_key, /*decode */ H5D_btree_encode_key, /*encode */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 923b888..b06bce1 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -165,8 +165,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Build and open the new dataset */ - if(NULL == (dset = H5D_create_named(&loc, name, type_id, space, - H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) + if(NULL == (dset = H5D_create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ @@ -239,7 +238,7 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") /* Open the dataset */ - if((dset = H5D_open(&dset_loc, dapl_id, dxpl_id)) == NULL) + if(NULL == (dset = H5D_open(&dset_loc, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open dataset") /* Register an atom for the dataset */ diff --git a/src/H5Dint.c b/src/H5Dint.c index ac1252c..9f6f93f 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -797,6 +797,12 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) if(NULL == (oh = H5O_pin(oloc, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") + /* Update the datatype and dataspace header messages */ + if(H5S_append(file, dxpl_id, oh, dset->shared->space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update dataspace header message") + if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT, 0, type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update datatype header message") + /* Write new fill value message */ if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message") @@ -818,12 +824,6 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message") } /* end if */ - /* Update the datatype and dataspace header messages */ - if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT, 0, type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update datatype header message") - if(H5S_append(file, dxpl_id, oh, dset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update dataspace header message") - /* Update/create the layout (and I/O pipeline & EFL) messages */ if(H5D_layout_oh_create(file, dxpl_id, oh, dset, dapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout/pline/efl header message") @@ -1048,7 +1048,6 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count") if(H5FO_insert(new_dset->oloc.file, new_dset->oloc.addr, new_dset->shared, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, NULL, "can't insert dataset into list of open objects") - new_dset->shared->fo_count = 1; /* Success */ @@ -1361,7 +1360,7 @@ H5D_close(H5D_t *dataset) /* check args */ HDassert(dataset && dataset->oloc.file && dataset->shared); - HDassert(dataset->shared->fo_count >0); + HDassert(dataset->shared->fo_count > 0); /* Dump debugging info */ #ifdef H5D_CHUNK_DEBUG diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 0a5fc6e..bebe1dc 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -119,6 +119,8 @@ H5D_layout_set_io_ops(const H5D_t *dataset) dataset->shared->layout.ops = H5D_LOPS_COMPACT; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown storage method") } /* end switch */ /*lint !e788 All appropriate cases are covered */ @@ -227,6 +229,8 @@ H5D_layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include } /* end else */ break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class") } /* end switch */ @@ -605,6 +609,8 @@ H5D_layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t case H5D_COMPACT: break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown storage method") } /* end switch */ /*lint !e788 All appropriate cases are covered */ diff --git a/src/H5Doh.c b/src/H5Doh.c index 8236ccd..bbf2cb2 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -294,9 +294,8 @@ H5O_dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id) HDassert(crt_info); HDassert(obj_loc); - /* Create the the dqtaset */ - if(NULL == (dset = H5D_create(f, crt_info->type_id, crt_info->space, - crt_info->dcpl_id, crt_info->dapl_id, dxpl_id))) + /* Create the the dataset */ + if(NULL == (dset = H5D_create(f, crt_info->type_id, crt_info->space, crt_info->dcpl_id, crt_info->dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") /* Set up the new dataset's location */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 658e64c..50c8cde 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -251,7 +251,7 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *u H5E_THROW(H5E_VERSION, "wrong extensible array header version") /* Extensible array class */ - id = *p++; + id = (H5EA_cls_id_t)*p++; if(id >= H5EA_NUM_CLS_ID) H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") hdr->cparam.cls = H5EA_client_class_g[id]; diff --git a/src/H5Eint.c b/src/H5Eint.c index d64fcbd..0bf9083 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -227,7 +227,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5E_walk1_cb) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk1_cb) /* Check arguments */ HDassert(err_desc); @@ -274,7 +274,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) MPI_Initialized(&mpi_initialized); if(mpi_initialized) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - fprintf (stream, "MPI-process %d", mpi_rank); + fprintf(stream, "MPI-process %d", mpi_rank); } /* end if */ else fprintf(stream, "thread 0"); @@ -349,7 +349,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5E_walk2_cb) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk2_cb) /* Check arguments */ HDassert(err_desc); diff --git a/src/H5FAcache.c b/src/H5FAcache.c index f9bf595..9caa0f3 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -211,7 +211,7 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *u H5E_THROW(H5E_VERSION, "wrong fixed array header version") /* Fixed array class */ - id = *p++; + id = (H5FA_cls_id_t)*p++; if(id >= H5FA_NUM_CLS_ID) H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") hdr->cparam.cls = H5FA_client_class_g[id]; diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index ea2ec55..6951e98 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -145,7 +145,7 @@ typedef struct H5FL_reg_head_t { #define H5FL_DEFINE_STATIC(t) static H5FL_DEFINE_COMMON(t) #define H5FL_MALLOC(t) (t *)H5MM_malloc(sizeof(t)) #define H5FL_CALLOC(t) (t *)H5MM_calloc(sizeof(t)) -#define H5FL_FREE(t,obj) H5MM_xfree(obj) +#define H5FL_FREE(t,obj) (t *)H5MM_xfree(obj) #endif /* H5_NO_REG_FREE_LISTS */ /* Data structure to store information about each block allocated */ @@ -215,7 +215,7 @@ typedef struct H5FL_blk_head_t { #define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t) #define H5FL_BLK_MALLOC(t,size) (uint8_t *)H5MM_malloc(size) #define H5FL_BLK_CALLOC(t,size) (uint8_t *)H5MM_calloc(size) -#define H5FL_BLK_FREE(t,blk) H5MM_xfree(blk) +#define H5FL_BLK_FREE(t,blk) (uint8_t *)H5MM_xfree(blk) #define H5FL_BLK_REALLOC(t,blk,new_size) (uint8_t *)H5MM_realloc(blk,new_size) #define H5FL_BLK_AVAIL(t,size) (FALSE) #endif /* H5_NO_BLK_FREE_LISTS */ @@ -344,7 +344,7 @@ typedef struct H5FL_seq_head_t { #define H5FL_SEQ_DEFINE_STATIC(t) static H5FL_SEQ_DEFINE_COMMON(t) #define H5FL_SEQ_MALLOC(t,elem) (t *)H5MM_malloc((elem)*sizeof(t)) #define H5FL_SEQ_CALLOC(t,elem) (t *)H5MM_calloc((elem)*sizeof(t)) -#define H5FL_SEQ_FREE(t,obj) H5MM_xfree(obj) +#define H5FL_SEQ_FREE(t,obj) (t *)H5MM_xfree(obj) #define H5FL_SEQ_REALLOC(t,obj,new_elem) (t *)H5MM_realloc(obj,(new_elem)*sizeof(t)) #endif /* H5_NO_SEQ_FREE_LISTS */ @@ -372,18 +372,18 @@ typedef struct H5FL_fac_head_t { */ #ifndef H5_NO_FAC_FREE_LISTS /* Allocate a block from a factory */ -#define H5FL_FAC_MALLOC(t) H5FL_fac_malloc(t H5FL_TRACK_INFO) +#define H5FL_FAC_MALLOC(f) H5FL_fac_malloc(f H5FL_TRACK_INFO) /* Allocate a block from a factory and clear it to all zeros */ -#define H5FL_FAC_CALLOC(t) H5FL_fac_calloc(t H5FL_TRACK_INFO) +#define H5FL_FAC_CALLOC(f) H5FL_fac_calloc(f H5FL_TRACK_INFO) /* Return a block to a factory */ -#define H5FL_FAC_FREE(t,obj) H5FL_fac_free(t,obj) +#define H5FL_FAC_FREE(f, obj) H5FL_fac_free(f, obj) #else /* H5_NO_FAC_FREE_LISTS */ -#define H5FL_FAC_MALLOC(t) H5MM_malloc(t->size) -#define H5FL_FAC_CALLOC(t) H5MM_calloc(t->size) -#define H5FL_FAC_FREE(t,obj) H5MM_xfree(obj) +#define H5FL_FAC_MALLOC(f) H5MM_malloc(f->size) +#define H5FL_FAC_CALLOC(f) H5MM_calloc(f->size) +#define H5FL_FAC_FREE(f, obj) H5MM_xfree(obj) #endif /* H5_NO_FAC_FREE_LISTS */ /* diff --git a/src/H5FScache.c b/src/H5FScache.c index b17a7f1..145d664 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -179,7 +179,7 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot, HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't wrap buffer") /* Compute the size of the free space header on disk */ - size = H5FS_HEADER_SIZE(f); + size = (size_t)H5FS_HEADER_SIZE(f); /* Get a pointer to a buffer that's large enough for header */ if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size))) @@ -348,7 +348,7 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't wrap buffer") /* Compute the size of the free space header on disk */ - size = H5FS_HEADER_SIZE(f); + size = (size_t)H5FS_HEADER_SIZE(f); /* Get a pointer to a buffer that's large enough for header */ if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size))) @@ -542,7 +542,7 @@ H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t UNUSED *fspace, size_t *size_pt HDassert(size_ptr); /* Set size value */ - *size_ptr = H5FS_HEADER_SIZE(f); + *size_ptr = (size_t)H5FS_HEADER_SIZE(f); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_cache_hdr_size() */ diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index 8cf64ef..9e7e40d 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -290,6 +290,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") break; + case H5FS_NUM_CLIENT_ID: default: HDfprintf(stream, "Unknown client!\n"); break; diff --git a/src/H5FSsection.c b/src/H5FSsection.c index ad622f0..bd31b63 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -144,7 +144,7 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); /* Set non-zero values */ sinfo->nbins = H5V_log2_gen(fspace->max_sect_size); - sinfo->sect_prefix_size = H5FS_SINFO_PREFIX_SIZE(f); + sinfo->sect_prefix_size = (size_t)H5FS_SINFO_PREFIX_SIZE(f); sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8; sinfo->sect_len_size = H5V_limit_enc_size((uint64_t)fspace->max_sect_size); #ifdef H5FS_SINFO_DEBUG diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 18635c1..cc4822a 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -96,7 +96,7 @@ H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats) stats->serial_sect_count = frsp->serial_sect_count; stats->ghost_sect_count = frsp->ghost_sect_count; stats->addr = frsp->addr; - stats->hdr_size = H5FS_HEADER_SIZE(f); + stats->hdr_size = (size_t)H5FS_HEADER_SIZE(f); stats->sect_addr = frsp->sect_addr; stats->alloc_sect_size = frsp->alloc_sect_size; stats->sect_size = frsp->sect_size; diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 7ee21f3..7698654 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -32,6 +32,7 @@ #include "H5Fpkg.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ @@ -458,7 +459,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) sblock->super_vers = super_vers; /* Compute the size of the superblock */ - superblock_size = H5F_SUPERBLOCK_SIZE(super_vers, f); + superblock_size = (size_t)H5F_SUPERBLOCK_SIZE(super_vers, f); /* Compute the size of the driver information block */ H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t); @@ -722,7 +723,7 @@ H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_ /* Set the superblock size */ if(super_size) - *super_size = H5F_SUPERBLOCK_SIZE(f->shared->sblock->super_vers, f); + *super_size = (size_t)H5F_SUPERBLOCK_SIZE(f->shared->sblock->super_vers, f); /* Set the superblock extension size */ if(super_ext_size) { diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 00d53e9..78cb3565 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -178,7 +178,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED HDassert(((size_t)(p - sbuf)) == fixed_size); /* Determine the size of the variable-length part of the superblock */ - variable_size = H5F_SUPERBLOCK_VARLEN_SIZE(super_vers, f); + variable_size = (size_t)H5F_SUPERBLOCK_VARLEN_SIZE(super_vers, f); HDassert(variable_size > 0); HDassert(fixed_size + variable_size <= sizeof(sbuf)); @@ -667,9 +667,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, *p++ = 0; /* reserved*/ *p++ = (uint8_t)HDF5_SHAREDHEADER_VERSION; /* (hard-wired) */ - HDassert(H5F_SIZEOF_ADDR(f) <= 255); *p++ = (uint8_t)H5F_SIZEOF_ADDR(f); - HDassert(H5F_SIZEOF_SIZE(f) <= 255); *p++ = (uint8_t)H5F_SIZEOF_SIZE(f); *p++ = 0; /* reserved */ @@ -737,9 +735,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, H5O_loc_t *root_oloc; /* Pointer to root group's object location */ /* Size of file addresses & offsets, and status flags */ - HDassert(H5F_SIZEOF_ADDR(f) <= 255); *p++ = (uint8_t)H5F_SIZEOF_ADDR(f); - HDassert(H5F_SIZEOF_SIZE(f) <= 255); *p++ = (uint8_t)H5F_SIZEOF_SIZE(f); *p++ = sblock->status_flags; @@ -757,13 +753,13 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, H5F_addr_encode(f, &p, root_oloc->addr); /* Compute superblock checksum */ - chksum = H5_checksum_metadata(buf, (size_t)(H5F_SUPERBLOCK_SIZE(sblock->super_vers, f) - H5F_SIZEOF_CHKSUM), 0); + chksum = H5_checksum_metadata(buf, ((size_t)H5F_SUPERBLOCK_SIZE(sblock->super_vers, f) - H5F_SIZEOF_CHKSUM), 0); /* Superblock checksum */ UINT32ENCODE(p, chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == H5F_SUPERBLOCK_SIZE(sblock->super_vers, f)); + HDassert((size_t)(p - buf) == (size_t)H5F_SUPERBLOCK_SIZE(sblock->super_vers, f)); } /* end else */ /* Retrieve the total size of the superblock info */ @@ -915,7 +911,7 @@ H5F_sblock_size(const H5F_t *f, const H5F_super_t *sblock, size_t *size_ptr) HDassert(size_ptr); /* Set size value */ - *size_ptr = H5F_SUPERBLOCK_SIZE(sblock->super_vers, f); + *size_ptr = (size_t)H5F_SUPERBLOCK_SIZE(sblock->super_vers, f); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5F_sblock_size() */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 52d14fe..0739b40 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -223,7 +223,6 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ { H5WB_t *wb = NULL; /* Wrapped buffer for node data */ uint8_t node_buf[H5G_NODE_BUF_SIZE]; /* Buffer for node */ - unsigned u; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5G_node_flush) diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 0eb4764..61432b6 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -162,6 +162,8 @@ H5G_map_obj_type(H5O_type_t obj_type) ret_value = H5G_TYPE; break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: ret_value = H5G_UNKNOWN; } /* end switch */ diff --git a/src/H5Gent.c b/src/H5Gent.c index 8e87995..69037d4 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -129,6 +129,8 @@ H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) UINT32DECODE(*pp, ent->cache.slink.lval_offset); break; + case H5G_CACHED_ERROR: + case H5G_NCACHED: default: HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type") } /* end switch */ @@ -232,6 +234,8 @@ H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) UINT32ENCODE(*pp, ent->cache.slink.lval_offset); break; + case H5G_CACHED_ERROR: + case H5G_NCACHED: default: HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type") } /* end switch */ @@ -393,6 +397,9 @@ H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, } /* end case */ break; + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: default: HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type") } /* end switch */ @@ -471,6 +478,8 @@ H5G_ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given, name not displayed!"); break; + case H5G_CACHED_ERROR: + case H5G_NCACHED: default: HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type); break; diff --git a/src/H5Glink.c b/src/H5Glink.c index 05df268..d8e87b3 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -299,6 +299,9 @@ H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info) info->u.val_size = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/ break; + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: default: { const H5L_class_t *link_class; /* User-defined link class */ diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 6145839..d95d705 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -61,7 +61,7 @@ typedef struct { /* User data for checking if an object exists */ typedef struct { /* upward */ - hbool_t exists; /* Whether the object exists */ + htri_t exists; /* Whether the object exists */ } H5G_loc_exists_t; /* User data for looking up an object in a group by index */ @@ -69,7 +69,7 @@ typedef struct { /* downward */ hid_t lapl_id; /* LAPL to use for operation */ hid_t dxpl_id; /* DXPL to use for operation */ - H5_index_t idx_type; /* Index to use */ + H5_index_t idx_type; /* Index to use */ H5_iter_order_t order; /* Iteration order within index */ hsize_t n; /* Offset within index */ @@ -245,6 +245,10 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_REFERENCE: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference") + case H5I_UNINIT: + case H5I_BADID: + case H5I_VFL: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object ID") } /* end switch */ @@ -710,7 +714,7 @@ H5G_loc_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't check if object exists") /* Set return value */ - ret_value = (htri_t)udata.exists; + ret_value = udata.exists; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gname.c b/src/H5Gname.c index 581b649..b298ccf 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -687,6 +687,19 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) obj_path = H5T_nameof((H5T_t *)obj_ptr); break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object") } /* end switch */ @@ -962,6 +975,9 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, search_datatype = TRUE; break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + /* Search and replace names through datatype IDs */ default: HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not valid object type") } /* end switch */ @@ -973,6 +989,9 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, search_group = search_dataset = search_datatype = TRUE; break; + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: default: /* User-defined link */ /* Check for unknown library-defined link type */ if(lnk->type < H5L_TYPE_UD_MIN) diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 3c07313..6661058 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -91,9 +91,9 @@ H5B_class_t H5B_SNODE[1] = {{ H5G_node_cmp3, /*cmp3 */ H5G_node_found, /*found */ H5G_node_insert, /*insert */ - H5B_RIGHT, /*critical key */ TRUE, /*follow min branch? */ TRUE, /*follow max branch? */ + H5B_RIGHT, /*critical key */ H5G_node_remove, /*remove */ H5G_node_decode_key, /*decode */ H5G_node_encode_key, /*encode */ @@ -1404,7 +1404,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ /* Iterate over the symbol table node entries, adding to link table */ for(u = 0; u < sn->nsyms; u++) { const char *name; /* Pointer to link name in heap */ - unsigned linkno; /* Link allocated */ + size_t linkno; /* Link allocated */ /* Get pointer to link's name in the heap */ name = (const char *)H5HL_offset_into(udata->heap, sn->entry[u].name_off); diff --git a/src/H5Gstab.c b/src/H5Gstab.c index cba725f..74ef829 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -1089,6 +1089,10 @@ H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata) udata->type = H5G_LINK; break; + case H5G_CACHED_ERROR: + case H5G_NOTHING_CACHED: + case H5G_CACHED_STAB: + case H5G_NCACHED: default: { H5O_loc_t tmp_oloc; /* Temporary object location */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 62c6bab..9e6fca0 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -538,6 +538,19 @@ H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigne obj_path = H5T_nameof((H5T_t *)obj_ptr); break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type") } /* end switch */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index e9f3010..0779c89 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -280,6 +280,18 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get root group location from file ID") break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, FAIL, "not a valid location or object ID") } /* end switch */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 9c17ef6..2da0375 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -715,7 +715,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows haddr_t heap_addr; /* Address of heap header in the file */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t u; /* Local index variable */ + unsigned u; /* Local index variable */ H5HF_indirect_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_load) @@ -1689,7 +1689,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) #endif /* NDEBUG */ /* Bring the chunk into the cache */ - /* (which adds to the object header */ + /* (which adds to the object header) */ chk_udata.chunk_size = cont_msg_info.msgs[curr_msg].size; if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, NULL, &chk_udata, prot))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk") @@ -1972,10 +1972,10 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) /* Check version, to determine how to store time information */ if(oh->version == H5O_VERSION_1) { - unsigned idx; /* Index of modification time message to update */ + int idx; /* Index of modification time message to update */ /* Look for existing message */ - for(idx = 0; idx < oh->nmesgs; idx++) + for(idx = 0; idx < (int)oh->nmesgs; idx++) if(H5O_MSG_MTIME == oh->mesg[idx].type || H5O_MSG_MTIME_NEW == oh->mesg[idx].type) break; @@ -1988,7 +1988,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) HGOTO_DONE(SUCCEED); /*nothing to do*/ /* Allocate space for the modification time message */ - if(UFAIL == (idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now))) + if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message") /* Set the message's flags if appropriate */ @@ -2095,8 +2095,8 @@ done: herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags) { - unsigned idx; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + int idx; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_bogus_oh, FAIL) @@ -2104,7 +2104,7 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags) HDassert(oh); /* Look for existing message */ - for(idx = 0; idx < oh->nmesgs; idx++) + for(idx = 0; idx < (int)oh->nmesgs; idx++) if(H5O_MSG_BOGUS == oh->mesg[idx].type) break; diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 90e86d6..f0836e9 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -58,18 +58,15 @@ /* Local Prototypes */ /********************/ -static herr_t H5O_add_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - H5O_chunk_proxy_t *chk_proxy, unsigned *chk_flags, - unsigned idx, uint8_t *new_gap_loc, size_t new_gap_size); -static herr_t H5O_eliminate_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - H5O_chunk_proxy_t *chk_proxy, unsigned *chk_flags, +static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, + unsigned *chk_flags, unsigned idx, uint8_t *new_gap_loc, size_t new_gap_size); +static herr_t H5O_eliminate_gap(H5O_t *oh, unsigned *chk_flags, H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size); static herr_t H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type, void *new_native, size_t new_size); static htri_t H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - unsigned chunkno, size_t size, unsigned * msg_idx); -static unsigned H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - size_t size); + unsigned chunkno, size_t size, int *msg_idx); +static int H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size); static htri_t H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u); static htri_t H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh); static htri_t H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh); @@ -111,8 +108,8 @@ H5FL_EXTERN(H5O_cont_t); *------------------------------------------------------------------------- */ static herr_t -H5O_add_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_proxy, - unsigned *chk_flags, unsigned idx, uint8_t *new_gap_loc, size_t new_gap_size) +H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, unsigned *chk_flags, + unsigned idx, uint8_t *new_gap_loc, size_t new_gap_size) { hbool_t merged_with_null; /* Whether the gap was merged with a null message */ unsigned u; /* Local index variable */ @@ -123,23 +120,35 @@ H5O_add_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_proxy, /* check args */ HDassert(oh); HDassert(oh->version > H5O_VERSION_1); - HDassert(chk_proxy); HDassert(chk_flags); HDassert(new_gap_loc); HDassert(new_gap_size); +#ifndef NDEBUG +if(chunkno > 0) { + unsigned chk_proxy_status = 0; /* Object header chunk proxy entry cache status */ + + /* Check the object header chunk proxy's status in the metadata cache */ + if(H5AC_get_entry_status(f, oh->chunk[chunkno].addr, &chk_proxy_status) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check metadata cache status for object header chunk proxy") + + /* Make certain that object header is protected */ + HDassert(chk_proxy_status & H5AC_ES__IS_PROTECTED); +} /* end if */ +#endif /* NDEBUG */ + /* Check for existing null message in chunk */ merged_with_null = FALSE; for(u = 0; u < oh->nmesgs && !merged_with_null; u++) { /* Find a null message in the chunk with the new gap */ /* (a null message that's not the one we are eliminating) */ - if(H5O_NULL_ID == oh->mesg[u].type->id && oh->mesg[u].chunkno == chk_proxy->chunkno + if(H5O_NULL_ID == oh->mesg[u].type->id && oh->mesg[u].chunkno == chunkno && u != idx) { /* Sanity check - chunks with null messages shouldn't have a gap */ - HDassert(oh->chunk[chk_proxy->chunkno].gap == 0); + HDassert(oh->chunk[chunkno].gap == 0); /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(f, dxpl_id, oh, chk_proxy, chk_flags, &oh->mesg[u], new_gap_loc, new_gap_size) < 0) + if(H5O_eliminate_gap(oh, chk_flags, &oh->mesg[u], new_gap_loc, new_gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't eliminate gap in chunk") /* Set flag to indicate that the gap was handled */ @@ -151,15 +160,15 @@ H5O_add_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_proxy, if(!merged_with_null) { /* Adjust message offsets after new gap forward in chunk */ for(u = 0; u < oh->nmesgs; u++) - if(oh->mesg[u].chunkno == chk_proxy->chunkno && oh->mesg[u].raw > new_gap_loc) + if(oh->mesg[u].chunkno == chunkno && oh->mesg[u].raw > new_gap_loc) oh->mesg[u].raw -= new_gap_size; /* Slide raw message info forward in chunk image */ HDmemmove(new_gap_loc, new_gap_loc + new_gap_size, - (size_t)((oh->chunk[chk_proxy->chunkno].image + (oh->chunk[chk_proxy->chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))) - (new_gap_loc + new_gap_size))); + (size_t)((oh->chunk[chunkno].image + (oh->chunk[chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))) - (new_gap_loc + new_gap_size))); /* Add existing gap size to new gap size */ - new_gap_size += oh->chunk[chk_proxy->chunkno].gap; + new_gap_size += oh->chunk[chunkno].gap; /* Merging with existing gap will allow for a new null message */ if(new_gap_size >= (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) { @@ -171,16 +180,16 @@ H5O_add_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_proxy, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Increment new gap size */ - oh->chunk[chk_proxy->chunkno].gap += new_gap_size; + oh->chunk[chunkno].gap += new_gap_size; /* Create new null message, with the tail of the previous null message */ null_msg = &(oh->mesg[oh->nmesgs++]); null_msg->type = H5O_MSG_NULL; null_msg->native = NULL; null_msg->raw_size = new_gap_size - H5O_SIZEOF_MSGHDR_OH(oh); - null_msg->raw = (oh->chunk[chk_proxy->chunkno].image + oh->chunk[chk_proxy->chunkno].size) + null_msg->raw = (oh->chunk[chunkno].image + oh->chunk[chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + null_msg->raw_size); - null_msg->chunkno = chk_proxy->chunkno; + null_msg->chunkno = chunkno; /* Zero out new null message's raw data */ if(null_msg->raw_size) @@ -190,10 +199,10 @@ H5O_add_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_proxy, null_msg->dirty = TRUE; /* Reset size of gap in chunk */ - oh->chunk[chk_proxy->chunkno].gap = 0; + oh->chunk[chunkno].gap = 0; } /* end if */ else - oh->chunk[chk_proxy->chunkno].gap = new_gap_size; + oh->chunk[chunkno].gap = new_gap_size; /* Mark the chunk as modified */ *chk_flags |= H5AC__DIRTIED_FLAG; @@ -225,19 +234,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_eliminate_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_proxy, - unsigned *chk_flags, H5O_mesg_t *mesg, uint8_t *gap_loc, size_t gap_size) +H5O_eliminate_gap(H5O_t *oh, unsigned *chk_flags, H5O_mesg_t *mesg, + uint8_t *gap_loc, size_t gap_size) { uint8_t *move_start, *move_end; /* Pointers to area of messages to move */ hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */ - herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_eliminate_gap) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_eliminate_gap) /* check args */ HDassert(oh); HDassert(oh->version > H5O_VERSION_1); - HDassert(chk_proxy); HDassert(chk_flags); HDassert(mesg); HDassert(gap_loc); @@ -309,8 +316,7 @@ H5O_eliminate_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_pro mesg->dirty = TRUE; *chk_flags |= H5AC__DIRTIED_FLAG; -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5O_eliminate_gap() */ @@ -361,7 +367,7 @@ H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx, alloc_msg->raw_size = new_size; /* Add the gap to the chunk */ - if(H5O_add_gap(f, dxpl_id, oh, chk_proxy, &chk_flags, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0) + if(H5O_add_gap(f, oh, alloc_msg->chunkno, &chk_flags, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") } /* end if */ else { @@ -394,7 +400,7 @@ H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx, unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */ /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(f, dxpl_id, oh, chk_proxy, &chk_flags, null_msg, + if(H5O_eliminate_gap(oh, &chk_flags, null_msg, ((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)), oh->chunk[null_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -499,7 +505,7 @@ done: */ static htri_t H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, - size_t size, unsigned * msg_idx) + size_t size, int *msg_idx) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ unsigned chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting chunk */ @@ -682,7 +688,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, chk_flags |= H5AC__SIZE_CHANGED_FLAG; /* Set return value */ - *msg_idx = (unsigned)extend_msg; + *msg_idx = extend_msg; done: /* Release chunk */ @@ -728,7 +734,7 @@ done: * *------------------------------------------------------------------------- */ -static unsigned +static int H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) { /* Struct for storing information about "best" messages to allocate from */ @@ -753,7 +759,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) unsigned chunkno; /* Chunk allocated */ haddr_t new_chunk_addr; unsigned u; /* Local index variable */ - unsigned ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_alloc_new_chunk) @@ -773,7 +779,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) * ordering (although ordering is *not* guaranteed!). * */ - cont_size = H5O_ALIGN_OH(oh, H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f)); + cont_size = H5O_ALIGN_OH(oh, (size_t)(H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f))); for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) { if(curr_msg->type->id == H5O_NULL_ID) { if(cont_size == curr_msg->raw_size) { @@ -787,6 +793,9 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) else if(curr_msg->type->id == H5O_CONT_ID) { /* Don't consider continuation messages (for now) */ } /* end if */ + else if(curr_msg->locked) { + /* Don't consider locked messages */ + } /* end if */ else { unsigned msg_chunkno = curr_msg->chunkno; /* Chunk that the message is in */ uint8_t *end_chunk_data = (oh->chunk[msg_chunkno].image + oh->chunk[msg_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[msg_chunkno].gap); /* End of message data in chunk */ @@ -839,7 +848,8 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) found_other.null_msgno = null_msgno; } /* end if */ } /* end else */ - } else if(found_null < 0 && found_attr.msgno < 0 && found_other.msgno < 0 && msg_chunkno == oh->nchunks - 1) + } /* end if */ + else if(found_null < 0 && found_attr.msgno < 0 && found_other.msgno < 0 && msg_chunkno == oh->nchunks - 1) /* Keep track of the total size of smaller messages in the last * chunk, in case we need to move more than 1 message. */ @@ -889,17 +899,17 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) /* allocate space in file to hold the new chunk */ new_chunk_addr = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)size); if(HADDR_UNDEF == new_chunk_addr) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "unable to allocate space for new chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for new chunk") /* * Create the new chunk giving it a file address. */ if(oh->nchunks >= oh->alloc_nchunks) { - unsigned na = MAX(H5O_NCHUNKS, oh->alloc_nchunks * 2); /* Double # of chunks allocated */ - H5O_chunk_t *x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, (size_t)na); + size_t na = MAX(H5O_NCHUNKS, oh->alloc_nchunks * 2); /* Double # of chunks allocated */ + H5O_chunk_t *x; - if(!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed") + if(NULL == (x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, na))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") oh->alloc_nchunks = na; oh->chunk = x; } /* end if */ @@ -909,7 +919,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) oh->chunk[chunkno].size = size; oh->chunk[chunkno].gap = 0; if(NULL == (oh->chunk[chunkno].image = p = H5FL_BLK_CALLOC(chunk_image, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* If this is a later version of the object header format, put the magic * # at the beginning of the chunk image. @@ -925,8 +935,9 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) */ if(oh->nmesgs + 3 > oh->alloc_nmesgs) if(H5O_alloc_msgs(oh, (size_t)3) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") + /* Check if we need to move multiple messages, in order to make room for the new message */ if(multi_size > 0) { /* Move all non-null messages in the last chunk to the new chunk. This * should be extremely rare so we don't care too much about minimizing @@ -936,7 +947,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) /* Protect last chunk */ if(NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, chunkno - 1))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, UFAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") /* Copy each message to the new location */ for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) @@ -946,7 +957,8 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) if(u < oh->nmesgs - 1) HDmemmove(curr_msg, curr_msg + 1, ((oh->nmesgs - 1) - u) * sizeof(H5O_mesg_t)); oh->nmesgs--; - } else { + } /* end if */ + else { /* Copy the raw data */ HDmemcpy(p, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh)); @@ -971,7 +983,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) + ((chunkno == 1) ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)) - H5O_SIZEOF_CHKSUM_OH(oh) + H5O_SIZEOF_MSGHDR_OH(oh); null_msg->raw_size = oh->chunk[chunkno - 1].size - - ((chunkno == 1) ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)) + - ((chunkno == 1) ? (size_t)H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)) - H5O_SIZEOF_MSGHDR_OH(oh); null_msg->chunkno = chunkno - 1; @@ -982,7 +994,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) /* Release chunk, marking it dirty */ if(H5O_chunk_unprotect(f, dxpl_id, chk_proxy, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, UFAIL, "unable to unprotect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") } else if(found_null < 0) { /* Move message (that will be replaced with continuation message) * to new chunk, if necessary. @@ -991,7 +1003,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) /* Protect chunk */ if(NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, oh->mesg[found_other.msgno].chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, UFAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") /* Create null message for space that message to copy currently occupies */ found_null = (int)oh->nmesgs++; @@ -1048,7 +1060,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) /* Release chunk, marking it dirty */ if(H5O_chunk_unprotect(f, dxpl_id, chk_proxy, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, UFAIL, "unable to unprotect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") } /* end if */ HDassert(found_null >= 0); @@ -1064,21 +1076,21 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) /* Insert the new chunk into the cache */ if(H5O_chunk_add(f, dxpl_id, oh, chunkno) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't add new chunk to cache") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't add new chunk to cache") /* Initialize the continuation information */ if(NULL == (cont = H5FL_MALLOC(H5O_cont_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") cont->addr = oh->chunk[chunkno].addr; cont->size = oh->chunk[chunkno].size; cont->chunkno = chunkno; /* Split the null message and point at continuation message */ if(H5O_alloc_null(f, dxpl_id, oh, (unsigned)found_null, H5O_MSG_CONT, cont, cont_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't split null message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message") /* Set return value */ - ret_value = idx; + ret_value = (int)idx; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1091,7 +1103,6 @@ done: * Purpose: Allocate enough space in the object header for this message. * * Return: Success: Index of message - * * Failure: Negative * * Programmer: Robb Matzke @@ -1100,16 +1111,16 @@ done: * *------------------------------------------------------------------------- */ -unsigned +int H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg) { - size_t raw_size; /* Raw size of message */ - size_t aligned_size; /* Size of message including alignment */ - unsigned idx; /* Index of message which fits allocation */ - unsigned ret_value; /* Return value */ + size_t raw_size; /* Raw size of message */ + size_t aligned_size; /* Size of message including alignment */ + int idx; /* Index of message which fits allocation */ + int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_alloc, UFAIL) + FUNC_ENTER_NOAPI(H5O_alloc, FAIL) /* check args */ HDassert(oh); @@ -1121,16 +1132,16 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, if(0 == raw_size) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "can't compute object header message size") if(raw_size >= H5O_MESG_MAX_SIZE) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "object header message is too large") aligned_size = H5O_ALIGN_OH(oh, raw_size); /* look for a null message which is large enough */ - for(idx = 0; idx < oh->nmesgs; idx++) + for(idx = 0; idx < (int)oh->nmesgs; idx++) if(H5O_NULL_ID == oh->mesg[idx].type->id && oh->mesg[idx].raw_size >= aligned_size) break; /* if we didn't find one, then allocate more header space */ - if(idx >= oh->nmesgs) { + if(idx >= (int)oh->nmesgs) { unsigned chunkno; /* check to see if we can extend one of the chunks. If we can, @@ -1140,37 +1151,31 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, * must have file space allocated to them. */ for(chunkno = 0; chunkno < oh->nchunks; chunkno++) { - htri_t tri_result; + htri_t tri_result; /* Status from attempting to extend chunk */ - HDassert(H5F_addr_defined(oh->chunk[chunkno].addr)); - - tri_result = H5O_alloc_extend_chunk(f, dxpl_id, oh, chunkno, raw_size, &idx); + if((tri_result = H5O_alloc_extend_chunk(f, dxpl_id, oh, chunkno, raw_size, &idx)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, FAIL, "H5O_alloc_extend_chunk failed unexpectedly") if(tri_result == TRUE) break; - else if(tri_result == FALSE) - idx = UFAIL; - else - HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, UFAIL, "H5O_alloc_extend_chunk failed unexpectedly") } /* end for */ - /* If idx is still UFAIL, we were not able to extend a chunk, - * create a new one. - */ - if(idx == UFAIL) - if((idx = H5O_alloc_new_chunk(f, dxpl_id, oh, raw_size)) == UFAIL) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, UFAIL, "unable to create a new object header data chunk") + /* If we were not able to extend a chunk, create a new one */ + if(idx >= (int)oh->nmesgs) + if((idx = H5O_alloc_new_chunk(f, dxpl_id, oh, raw_size)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create a new object header data chunk") } /* end if */ + HDassert(idx >= 0 && idx < (int)oh->nmesgs); /* Split the null message and point at continuation message */ - if(H5O_alloc_null(f, dxpl_id, oh, idx, type, NULL, aligned_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't split null message") + if(H5O_alloc_null(f, dxpl_id, oh, (unsigned)idx, type, NULL, aligned_size) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message") /* Mark object header as dirty in cache */ if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, UFAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") /* Set return value */ - ret_value = idx; + ret_value = (int)idx; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1235,7 +1240,7 @@ H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg, /* Check if chunk has a gap currently */ if(oh->chunk[mesg->chunkno].gap) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(f, dxpl_id, oh, chk_proxy, &chk_flags, mesg, + if(H5O_eliminate_gap(oh, &chk_flags, mesg, ((oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)), oh->chunk[mesg->chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -1290,13 +1295,23 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u) size_t gap_size; /* Size of gap produced */ unsigned v; /* Local index variable */ - /* Find size of all nonnull messages in the chunk pointed to by the continuation message */ + /* Spin through messages */ nonnull_size = 0; - for(v = 0, curr_msg = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg++) - if(curr_msg->chunkno == deleted_chunkno && curr_msg->type->id != H5O_NULL_ID) { - HDassert(curr_msg->type->id != H5O_CONT_ID); - nonnull_size += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); + for(v = 0, curr_msg = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg++) { + if(curr_msg->chunkno == deleted_chunkno) { + /* If there's a locked message, we can't move all messages out of + * chunk to delete, so get out now. + */ + if(curr_msg->locked) + HGOTO_DONE(FALSE) + + /* Find size of all non-null messages in the chunk pointed to by the continuation message */ + if(curr_msg->type->id != H5O_NULL_ID) { + HDassert(curr_msg->type->id != H5O_CONT_ID); + nonnull_size += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); + } /* end if */ } /* end if */ + } /* end for */ /* Size of gap in chunk w/continuation message */ gap_size = oh->chunk[cont_msg->chunkno].gap; @@ -1361,7 +1376,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u) /* Check if there is space that should be a gap */ if(gap_size > 0) { /* Convert remnant into gap in chunk */ - if(H5O_add_gap(f, dxpl_id, oh, chk_proxy, &chk_flags, cont_u, move_start, gap_size) < 0) + if(H5O_add_gap(f, oh, cont_chunkno, &chk_flags, cont_u, move_start, gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") } /* end if */ @@ -1522,145 +1537,148 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh) } /* end else-if */ } /* end if */ - /* Loop over messages again, looking for large enough null message in earlier chunk */ - for(v = 0, null_msg = &oh->mesg[0]; v < oh->nmesgs; v++, null_msg++) { - if(H5O_NULL_ID == null_msg->type->id && curr_msg->chunkno > null_msg->chunkno - && curr_msg->raw_size <= null_msg->raw_size) { - H5O_chunk_proxy_t *null_chk_proxy; /* Chunk that null message is in */ - H5O_chunk_proxy_t *curr_chk_proxy; /* Chunk that message is in */ - unsigned null_chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting null chunk */ - unsigned curr_chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting curr chunk */ - unsigned old_chunkno; /* Old message information */ - uint8_t *old_raw; - - /* Keep old information about non-null message */ - old_chunkno = curr_msg->chunkno; - old_raw = curr_msg->raw; - - /* Protect chunks */ - if(NULL == (null_chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, null_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") - if(NULL == (curr_chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, curr_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") - - /* Copy raw data for non-null message to new chunk */ - HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh)); - - /* Point non-null message at null message's space */ - curr_msg->chunkno = null_msg->chunkno; - curr_msg->raw = null_msg->raw; - curr_chk_flags |= H5AC__DIRTIED_FLAG; - - /* Change information for null message */ - if(curr_msg->raw_size == null_msg->raw_size) { - /* Point null message at old non-null space */ - /* (Instead of freeing it and allocating new message) */ - null_msg->chunkno = old_chunkno; - null_msg->raw = old_raw; - - /* Mark null message dirty */ - null_msg->dirty = TRUE; - null_chk_flags |= H5AC__DIRTIED_FLAG; - - /* Release current chunk, marking it dirty */ - if(H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + /* Don't let locked messages be moved into earlier chunk */ + if(!curr_msg->locked) { + /* Loop over messages again, looking for large enough null message in earlier chunk */ + for(v = 0, null_msg = &oh->mesg[0]; v < oh->nmesgs; v++, null_msg++) { + if(H5O_NULL_ID == null_msg->type->id && curr_msg->chunkno > null_msg->chunkno + && curr_msg->raw_size <= null_msg->raw_size) { + H5O_chunk_proxy_t *null_chk_proxy; /* Chunk that null message is in */ + H5O_chunk_proxy_t *curr_chk_proxy; /* Chunk that message is in */ + unsigned null_chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting null chunk */ + unsigned curr_chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting curr chunk */ + unsigned old_chunkno; /* Old message information */ + uint8_t *old_raw; - /* Check for gap in null message's chunk */ - if(oh->chunk[old_chunkno].gap > 0) { - /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(f, dxpl_id, oh, null_chk_proxy, &null_chk_flags, null_msg, - ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), - oh->chunk[old_chunkno].gap) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") - } /* end if */ + /* Keep old information about non-null message */ + old_chunkno = curr_msg->chunkno; + old_raw = curr_msg->raw; - /* Release null chunk, marking it dirty */ - if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") - } /* end if */ - else { - unsigned new_null_msg; /* Message index for new null message */ + /* Protect chunks */ + if(NULL == (null_chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, null_msg->chunkno))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + if(NULL == (curr_chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, curr_msg->chunkno))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") - /* Check if null message is large enough to still exist */ - if((null_msg->raw_size - curr_msg->raw_size) < (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) { - size_t gap_size = null_msg->raw_size - curr_msg->raw_size; /* Size of gap produced */ + /* Copy raw data for non-null message to new chunk */ + HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh)); - /* Adjust the size of the null message being eliminated */ - null_msg->raw_size = curr_msg->raw_size; + /* Point non-null message at null message's space */ + curr_msg->chunkno = null_msg->chunkno; + curr_msg->raw = null_msg->raw; + curr_chk_flags |= H5AC__DIRTIED_FLAG; + + /* Change information for null message */ + if(curr_msg->raw_size == null_msg->raw_size) { + /* Point null message at old non-null space */ + /* (Instead of freeing it and allocating new message) */ + null_msg->chunkno = old_chunkno; + null_msg->raw = old_raw; /* Mark null message dirty */ null_msg->dirty = TRUE; null_chk_flags |= H5AC__DIRTIED_FLAG; - /* Add the gap to the chunk */ - if(H5O_add_gap(f, dxpl_id, oh, null_chk_proxy, &null_chk_flags, v, null_msg->raw + null_msg->raw_size, gap_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") + /* Release current chunk, marking it dirty */ + if(H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_flags) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") - /* Re-use message # for new null message taking place of non-null message */ - new_null_msg = v; + /* Check for gap in null message's chunk */ + if(oh->chunk[old_chunkno].gap > 0) { + /* Eliminate the gap in the chunk */ + if(H5O_eliminate_gap(oh, &null_chk_flags, null_msg, + ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), + oh->chunk[old_chunkno].gap) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") + } /* end if */ + + /* Release null chunk, marking it dirty */ + if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_flags) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") } /* end if */ else { - /* Adjust null message's size & offset */ - null_msg->raw += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); - null_msg->raw_size -= curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); + unsigned new_null_msg; /* Message index for new null message */ - /* Mark null message dirty */ - null_msg->dirty = TRUE; - null_chk_flags |= H5AC__DIRTIED_FLAG; + /* Check if null message is large enough to still exist */ + if((null_msg->raw_size - curr_msg->raw_size) < (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) { + size_t gap_size = null_msg->raw_size - curr_msg->raw_size; /* Size of gap produced */ - /* Create new null message for previous location of non-null message */ - if(oh->nmesgs >= oh->alloc_nmesgs) { - if(H5O_alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") + /* Adjust the size of the null message being eliminated */ + null_msg->raw_size = curr_msg->raw_size; - /* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */ - curr_msg = &oh->mesg[u]; - } /* end if */ + /* Mark null message dirty */ + null_msg->dirty = TRUE; + null_chk_flags |= H5AC__DIRTIED_FLAG; - /* Get message # for new null message */ - new_null_msg = oh->nmesgs++; - } /* end else */ + /* Add the gap to the chunk */ + if(H5O_add_gap(f, oh, null_msg->chunkno, &null_chk_flags, v, null_msg->raw + null_msg->raw_size, gap_size) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") - /* Release null message's chunk, marking it dirty */ - if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") - - /* Initialize new null message to take over non-null message's location */ - oh->mesg[new_null_msg].type = H5O_MSG_NULL; - oh->mesg[new_null_msg].native = NULL; - oh->mesg[new_null_msg].raw = old_raw; - oh->mesg[new_null_msg].raw_size = curr_msg->raw_size; - oh->mesg[new_null_msg].chunkno = old_chunkno; - - /* Mark new null message dirty */ - oh->mesg[new_null_msg].dirty = TRUE; - curr_chk_flags |= H5AC__DIRTIED_FLAG; + /* Re-use message # for new null message taking place of non-null message */ + new_null_msg = v; + } /* end if */ + else { + /* Adjust null message's size & offset */ + null_msg->raw += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); + null_msg->raw_size -= curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh); + + /* Mark null message dirty */ + null_msg->dirty = TRUE; + null_chk_flags |= H5AC__DIRTIED_FLAG; + + /* Create new null message for previous location of non-null message */ + if(oh->nmesgs >= oh->alloc_nmesgs) { + if(H5O_alloc_msgs(oh, (size_t)1) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") + + /* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */ + curr_msg = &oh->mesg[u]; + } /* end if */ + + /* Get message # for new null message */ + new_null_msg = oh->nmesgs++; + } /* end else */ + + /* Release null message's chunk, marking it dirty */ + if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_flags) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") - /* Check for gap in new null message's chunk */ - if(oh->chunk[old_chunkno].gap > 0) { - /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(f, dxpl_id, oh, curr_chk_proxy, &curr_chk_flags, &oh->mesg[new_null_msg], - ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), - oh->chunk[old_chunkno].gap) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") - } /* end if */ + /* Initialize new null message to take over non-null message's location */ + oh->mesg[new_null_msg].type = H5O_MSG_NULL; + oh->mesg[new_null_msg].native = NULL; + oh->mesg[new_null_msg].raw = old_raw; + oh->mesg[new_null_msg].raw_size = curr_msg->raw_size; + oh->mesg[new_null_msg].chunkno = old_chunkno; + + /* Mark new null message dirty */ + oh->mesg[new_null_msg].dirty = TRUE; + curr_chk_flags |= H5AC__DIRTIED_FLAG; + + /* Check for gap in new null message's chunk */ + if(oh->chunk[old_chunkno].gap > 0) { + /* Eliminate the gap in the chunk */ + if(H5O_eliminate_gap(oh, &curr_chk_flags, &oh->mesg[new_null_msg], + ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), + oh->chunk[old_chunkno].gap) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") + } /* end if */ - /* Release new null message's chunk, marking it dirty */ - if(H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") - } /* end else */ + /* Release new null message's chunk, marking it dirty */ + if(H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_flags) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + } /* end else */ - /* Indicate that we packed messages */ - packed_msg = TRUE; + /* Indicate that we packed messages */ + packed_msg = TRUE; - /* Break out of loop */ - /* (If it's possible to move message to even earlier chunk - * we'll get it on the next pass - QAK) - */ - break; - } /* end if */ - } /* end for */ + /* Break out of loop */ + /* (If it's possible to move message to even earlier chunk + * we'll get it on the next pass - QAK) + */ + break; + } /* end if */ + } /* end for */ + } /* end if */ /* If we packed messages, get out of loop and start over */ /* (Don't know if this has any benefit one way or the other -QAK) */ @@ -2155,7 +2173,7 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno) } /* end for */ /* Check if the chunk is too small, extend if necessary */ - total_msg_size = new_size - (chunkno == 0 ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)); + total_msg_size = new_size - (size_t)(chunkno == 0 ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)); if(total_msg_size < min_chunk_size) { HDassert(oh->alloc_nmesgs > oh->nmesgs); oh->nmesgs++; @@ -2175,8 +2193,8 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno) /* Check for changing the chunk #0 data size enough to need adjusting the flags */ if(oh->version > H5O_VERSION_1 && chunkno == 0) { - uint64_t chunk0_newsize = new_size - H5O_SIZEOF_HDR(oh); /* New size of chunk 0's data */ - size_t orig_prfx_size = 1 << (oh->flags & H5O_HDR_CHUNK0_SIZE); /* Original prefix size */ + uint64_t chunk0_newsize = new_size - (size_t)H5O_SIZEOF_HDR(oh); /* New size of chunk 0's data */ + size_t orig_prfx_size = (size_t)1 << (oh->flags & H5O_HDR_CHUNK0_SIZE); /* Original prefix size */ /* Check for moving to a 1-byte size encoding */ if(orig_prfx_size > 1 && chunk0_newsize <= 255) { @@ -2200,13 +2218,13 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno) if(adjust_size_flags) { /* Adjust object header prefix flags */ - oh->flags &= ~H5O_HDR_CHUNK0_SIZE; + oh->flags &= (uint8_t)~H5O_HDR_CHUNK0_SIZE; oh->flags |= new_size_flags; /* Slide chunk 0 data down */ HDmemmove(chunk->image + H5O_SIZEOF_HDR(oh) - sizeof_chksum, chunk->image + H5O_SIZEOF_HDR(oh) - sizeof_chksum + less_prfx_size, - new_size - H5O_SIZEOF_HDR(oh)); + new_size - (size_t)H5O_SIZEOF_HDR(oh)); /* Adjust chunk size */ new_size -= less_prfx_size; diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 95f3d3a..caa5e52 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -922,10 +922,10 @@ H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) /* Increase chunk array size, if necessary */ if(cont_msg_info->nmsgs >= cont_msg_info->alloc_nmsgs) { - unsigned na = MAX(H5O_NCHUNKS, cont_msg_info->alloc_nmsgs * 2); /* Double # of messages allocated */ - H5O_cont_t *x = H5FL_SEQ_REALLOC(H5O_cont_t, cont_msg_info->msgs, (size_t)na); + size_t na = MAX(H5O_NCHUNKS, cont_msg_info->alloc_nmsgs * 2); /* Double # of messages allocated */ + H5O_cont_t *x; - if(!x) + if(NULL == (x = H5FL_SEQ_REALLOC(H5O_cont_t, cont_msg_info->msgs, na))) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "memory allocation failed") cont_msg_info->alloc_nmsgs = na; cont_msg_info->msgs = x; @@ -980,10 +980,10 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, /* Increase chunk array size, if necessary */ if(oh->nchunks >= oh->alloc_nchunks) { - unsigned na = MAX(H5O_NCHUNKS, oh->alloc_nchunks * 2); /* Double # of chunks allocated */ - H5O_chunk_t *x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, (size_t)na); + size_t na = MAX(H5O_NCHUNKS, oh->alloc_nchunks * 2); /* Double # of chunks allocated */ + H5O_chunk_t *x; - if(!x) + if(NULL == (x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, na))) HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed") oh->alloc_nchunks = na; oh->chunk = x; diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 03865fb..f1668f7 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -113,16 +113,20 @@ H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) chk_proxy->oh = oh; chk_proxy->chunkno = idx; + /* Increment reference count on object header */ + if(H5O_inc_rc(oh) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header") + /* Insert the chunk proxy into the cache */ if(H5AC_set(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk") chk_proxy = NULL; - /* Increment reference count on object header */ - if(H5O_inc_rc(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header") - done: + if(ret_value < 0) + if(chk_proxy) + chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_chunk_add() */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 9123b4a..30db1ce 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -207,7 +207,7 @@ herr_t H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, void *mesg) { - unsigned idx; /* Index of message to modify */ + int idx; /* Index of message to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_msg_append_real, FAIL) @@ -220,11 +220,11 @@ H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *t HDassert(mesg); /* Allocate space for a new message */ - if((idx = H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg)) == UFAIL) + if((idx = H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message") /* Copy the information for the message */ - if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) + if(H5O_copy_mesg(f, dxpl_id, oh, (unsigned)idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message") #ifdef H5O_DEBUG H5O_assert(oh); @@ -477,11 +477,11 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, /* Get the object header */ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") /* Call the "real" read routine */ if(NULL == (ret_value = H5O_msg_read_oh(loc->file, dxpl_id, oh, type_id, mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message") done: if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) @@ -802,7 +802,7 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Count the messages of the correct type */ ret_value = H5O_msg_count_real(oh, type); @@ -883,7 +883,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Call the "real" exists routine */ if((ret_value = H5O_msg_exists_oh(oh, type_id)) < 0) @@ -1223,7 +1223,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, /* Protect the object header to iterate over */ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Call the "real" iterate routine */ if((ret_value = H5O_msg_iterate_real(loc->file, oh, type, op, op_data, dxpl_id)) < 0) @@ -1888,12 +1888,12 @@ done: * *------------------------------------------------------------------------- */ -unsigned +int H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned *mesg_flags, void *native) { - htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ - unsigned ret_value = UFAIL; /* Return value */ + htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ + int ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_msg_alloc) @@ -1907,28 +1907,28 @@ H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, /* Check if message is already shared */ if((shared_mesg = H5O_msg_is_shared(type->id, native)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, UFAIL, "error determining if message is shared") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "error determining if message is shared") else if(shared_mesg > 0) { /* Increment message's reference count */ if(type->link && (type->link)(f, dxpl_id, oh, native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared message ref count") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared message ref count") *mesg_flags |= H5O_MSG_FLAG_SHARED; } /* end if */ else { /* Attempt to share message */ if(H5SM_try_share(f, dxpl_id, oh, type->id, native, mesg_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, UFAIL, "error determining if message should be shared") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") } /* end else */ /* Allocate space in the object header for the message */ - if((ret_value = H5O_alloc(f, dxpl_id, oh, type, native)) == UFAIL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message") + if((ret_value = H5O_alloc(f, dxpl_id, oh, type, native)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for message") /* Get the message's "creation index", if it has one */ if(type->get_crt_index) { /* Retrieve the creation index from the native message */ if((type->get_crt_index)(native, &oh->mesg[ret_value].crt_idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, UFAIL, "unable to retrieve creation index") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index") } /* end if */ done: @@ -1970,7 +1970,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, /* Protect chunk */ if(NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, idx_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") /* Reset existing native information for the header's message */ H5O_msg_reset_real(type, idx_msg->native); @@ -1988,7 +1988,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, /* Release chunk */ if(H5O_chunk_unprotect(f, dxpl_id, chk_proxy, chk_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") chk_proxy = NULL; /* Update the modification time, if requested */ @@ -1999,7 +1999,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, done: /* Release chunk, if not already released */ if(chk_proxy && H5O_chunk_unprotect(f, dxpl_id, chk_proxy, chk_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_copy_mesg() */ @@ -2241,3 +2241,176 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_flush_msgs() */ + +/*------------------------------------------------------------------------- + * Function: H5O_msg_chunkno + * + * Purpose: Queries the object header chunk index for a message. + * + * Return: Success: >=0 value indicating the chunk number for + * the message + * Failure: <0 + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Apr 22 2010 + * + *------------------------------------------------------------------------- + */ +int +H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) +{ + H5O_t *oh = NULL; /* Object header to use */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + H5O_mesg_t *idx_msg; /* Pointer to message to modify */ + unsigned idx; /* Index of message to modify */ + int ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_msg_get_chunkno, FAIL) + + /* check args */ + HDassert(loc); + HDassert(loc->file); + HDassert(H5F_addr_defined(loc->addr)); + HDassert(type_id < NELMTS(H5O_msg_class_g)); + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + HDassert(type); + + /* Get the object header */ + if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + + /* Locate message of correct type */ + for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) + if(type == idx_msg->type) + break; + if(idx == oh->nmesgs) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") + + /* Set return value */ + ret_value = idx_msg->chunkno; + +done: + if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_msg_get_chunkno() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_msg_lock + * + * Purpose: Locks a message into a particular chunk, preventing it from + * being moved into another chunk. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Apr 22 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_msg_lock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) +{ + H5O_t *oh = NULL; /* Object header to use */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + H5O_mesg_t *idx_msg; /* Pointer to message to modify */ + unsigned idx; /* Index of message to modify */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_msg_lock, FAIL) + + /* check args */ + HDassert(loc); + HDassert(loc->file); + HDassert(H5F_addr_defined(loc->addr)); + HDassert(type_id < NELMTS(H5O_msg_class_g)); + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + HDassert(type); + + /* Get the object header */ + if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + + /* Locate message of correct type */ + for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) + if(type == idx_msg->type) + break; + if(idx == oh->nmesgs) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") + + /* Fail if the message is already locked */ + if(idx_msg->locked) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOCK, FAIL, "message already locked") + + /* Make the message locked */ + idx_msg->locked = TRUE; + +done: + if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_msg_lock() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_msg_unlock + * + * Purpose: Unlocks a message, allowing it to be moved into another chunk. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Apr 22 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_msg_unlock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) +{ + H5O_t *oh = NULL; /* Object header to use */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + H5O_mesg_t *idx_msg; /* Pointer to message to modify */ + unsigned idx; /* Index of message to modify */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_msg_unlock, FAIL) + + /* check args */ + HDassert(loc); + HDassert(loc->file); + HDassert(H5F_addr_defined(loc->addr)); + HDassert(type_id < NELMTS(H5O_msg_class_g)); + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + HDassert(type); + + /* Get the object header */ + if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + + /* Locate message of correct type */ + for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) + if(type == idx_msg->type) + break; + if(idx == oh->nmesgs) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") + + /* Fail if the message is not locked */ + if(!idx_msg->locked) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNLOCK, FAIL, "message not locked") + + /* Make the message unlocked */ + idx_msg->locked = FALSE; + +done: + if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_msg_unlock() */ + diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 2699add..9351f50 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -244,6 +244,7 @@ struct H5O_msg_class_t { struct H5O_mesg_t { const H5O_msg_class_t *type; /*type of message */ hbool_t dirty; /*raw out of date wrt native */ + hbool_t locked; /*message is locked into chunk */ uint8_t flags; /*message flags */ H5O_msg_crt_idx_t crt_idx; /*message creation index */ unsigned chunkno; /*chunk number for this mesg */ @@ -533,7 +534,7 @@ H5_DLL herr_t H5O_dec_rc(H5O_t *oh); H5_DLL herr_t H5O_free(H5O_t *oh); /* Object header message routines */ -H5_DLL unsigned H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, +H5_DLL int H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned *mesg_flags, void *mesg); H5_DLL herr_t H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, @@ -567,7 +568,7 @@ H5_DLL herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, /* Object header allocation routines */ H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc); -H5_DLL unsigned H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, +H5_DLL int H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg); H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh, hid_t dxpl_id); H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index a23767b..1355582 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -21,8 +21,6 @@ * * Purpose: Object header private include file. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5Oprivate_H @@ -745,6 +743,9 @@ H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, const unsigned char *buf); H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, void *mesg); +H5_DLL int H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id); +H5_DLL herr_t H5O_msg_lock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id); +H5_DLL herr_t H5O_msg_unlock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id); /* Object copying routines */ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, diff --git a/src/H5system.c b/src/H5system.c index 5725218..7776cbb 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -138,23 +138,26 @@ HDfprintf(FILE *stream, const char *fmt, ...) s = fmt + 1; /* Flags */ - while (HDstrchr ("-+ #", *s)) { - switch (*s) { - case '-': - leftjust = 1; - break; - case '+': - plussign = 1; - break; - case ' ': - ldspace = 1; - break; - case '#': - prefix = 1; - break; - } /*lint !e744 Switch statement doesn't _need_ default */ + while(HDstrchr ("-+ #", *s)) { + switch(*s) { + case '-': + leftjust = 1; + break; + + case '+': + plussign = 1; + break; + + case ' ': + ldspace = 1; + break; + + case '#': + prefix = 1; + break; + } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */ s++; - } + } /* end while */ /* Field width */ if (HDisdigit (*s)) { diff --git a/src/H5timer.c b/src/H5timer.c index e417f8b..8334402 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -131,16 +131,16 @@ H5_timer_begin (H5_timer_t *timer) #ifdef H5_HAVE_GETRUSAGE HDgetrusage (RUSAGE_SELF, &rusage); timer->utime = (double)rusage.ru_utime.tv_sec + - ((double)rusage.ru_utime.tv_usec/1e6); + ((double)rusage.ru_utime.tv_usec / 1e6); timer->stime = (double)rusage.ru_stime.tv_sec + - ((double)rusage.ru_stime.tv_usec/1e6); + ((double)rusage.ru_stime.tv_usec / 1e6); #else timer->utime = 0.0; timer->stime = 0.0; #endif #ifdef H5_HAVE_GETTIMEOFDAY HDgettimeofday (&etime, NULL); - timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec/1e6); + timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / 1e6); #else timer->etime = 0.0; #endif @@ -216,37 +216,34 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds) { double bw; - if (nseconds<=0.0) { + if(nseconds <= 0.0) HDstrcpy(buf, " NaN"); - } else { + else { bw = nbytes/nseconds; - if (fabs(bw) < 0.0000000001) { + if(fabs(bw) < 0.0000000001) /* That is == 0.0, but direct comparison between floats is bad */ HDstrcpy(buf, "0.000 B/s"); - } else if (bw<1.0) { + else if(bw < 1.0) sprintf(buf, "%10.4e", bw); - } else if (bw<1024.0) { + else if(bw < 1024.0) { sprintf(buf, "%05.4f", bw); HDstrcpy(buf+5, " B/s"); - } else if (bw<1024.0*1024.0) { - sprintf(buf, "%05.4f", bw/1024.0); + } else if(bw < (1024.0 * 1024.0)) { + sprintf(buf, "%05.4f", bw / 1024.0); HDstrcpy(buf+5, " kB/s"); - } else if (bw<1024.0*1024.0*1024.0) { - sprintf(buf, "%05.4f", bw/(1024.0*1024.0)); + } else if(bw < (1024.0 * 1024.0 * 1024.0)) { + sprintf(buf, "%05.4f", bw / (1024.0 * 1024.0)); HDstrcpy(buf+5, " MB/s"); - } else if (bw<1024.0*1024.0*1024.0*1024.0) { - sprintf(buf, "%05.4f", - bw/(1024.0*1024.0*1024.0)); + } else if(bw < (1024.0 * 1024.0 * 1024.0 * 1024.0)) { + sprintf(buf, "%05.4f", bw / (1024.0 * 1024.0 * 1024.0)); HDstrcpy(buf+5, " GB/s"); - } else if (bw<1024.0*1024.0*1024.0*1024.0*1024.0) { - sprintf(buf, "%05.4f", - bw/(1024.0*1024.0*1024.0*1024.0)); + } else if(bw < (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)) { + sprintf(buf, "%05.4f", bw / (1024.0 * 1024.0 * 1024.0 * 1024.0)); HDstrcpy(buf+5, " TB/s"); } else { sprintf(buf, "%10.4e", bw); - if (HDstrlen(buf)>10) { + if(HDstrlen(buf) > 10) sprintf(buf, "%10.3e", bw); - } } } } /* end H5_bandwidth() */ diff --git a/src/H5trace.c b/src/H5trace.c index 84f8436..8e645af 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -115,65 +115,54 @@ * Programmer: Robb Matzke * Tuesday, June 16, 1998 * - * Modifications: - * Robb Matzke, 1999-08-02 - * Added the `a' type letter for haddr_t arguments and `Mt' for - * H5FD_mem_t arguments. - * - * Robb Matzke, 1999-10-25 - * The `Ej' and `En' types are H5E_major_t and H5E_minor_t error - * types. We only print the integer value here. - * - * Robb Matzke, 2002-08-08 - * Better output for nested calls. Show only top-level calls - * if so desired. Show event times if so desired. *------------------------------------------------------------------------- */ double -H5_trace (const double *returning, const char *func, const char *type, ...) +H5_trace(const double *returning, const char *func, const char *type, ...) { va_list ap; char buf[64], *rest; const char *argname; - int argno=0, ptr, asize_idx; + int argno = 0, ptr, asize_idx; hssize_t asize[16]; hssize_t i; void *vp = NULL; FILE *out = H5_debug_g.trace; H5_timer_t event_time; static H5_timer_t first_time = {0.0, 0.0, 0.0}; - static int current_depth=0; - static int last_call_depth=0; + static int current_depth = 0; + static int last_call_depth = 0; /* FUNC_ENTER() should not be called */ - if (!out) return 0.0; /*tracing is off*/ - va_start (ap, type); + if(!out) + return 0.0; /*tracing is off*/ + va_start(ap, type); - if (H5_debug_g.ttop) { - if (returning) { - if (current_depth>1) { + if(H5_debug_g.ttop) { + if(returning) { + if(current_depth > 1) { --current_depth; return 0.0; - } - } else { - if (current_depth>0) { + } /* end if */ + } /* end if */ + else { + if(current_depth > 0) { /*do not update last_call_depth*/ current_depth++; return 0.0; - } - } - } + } /* end if */ + } /* end else */ + } /* end if */ /* Get tim for event */ - if (fabs(first_time.etime) < 0.0000000001) + if(fabs(first_time.etime) < 0.0000000001) /* That is == 0.0, but direct comparison between floats is bad */ H5_timer_begin(&first_time); - if (H5_debug_g.ttimes) { + if(H5_debug_g.ttimes) H5_timer_begin(&event_time); - } else { + else HDmemset(&event_time, 0, sizeof event_time); - } /* Print the first part of the line. This is the indication of the * nesting depth followed by the function name and either start of @@ -181,2014 +170,2228 @@ H5_trace (const double *returning, const char *func, const char *type, ...) * function return and no other calls have been made to H5_trace() * since the one for the function call, then we're continuing * the same line. */ - if (returning) { - assert(current_depth>0); + if(returning) { + HDassert(current_depth > 0); --current_depth; - if (current_depth<last_call_depth) { + if(current_depth < last_call_depth) { /* We are at the beginning of a line */ - if (H5_debug_g.ttimes) { + if(H5_debug_g.ttimes) { char tmp[128]; + sprintf(tmp, "%.6f", event_time.etime-first_time.etime); fprintf(out, " %*s ", (int)strlen(tmp), ""); - } - for (i=0; i<current_depth; i++) + } /* end if */ + for(i = 0; i < current_depth; i++) fputc('+', out); fprintf(out, "%*s%s = ", 2*current_depth, "", func); - } else { + } /* end if */ + else { /* Continue current line with return value */ fprintf(out, " = "); - } - } else { - if (current_depth>last_call_depth) + } /* end else */ + } /* end if */ + else { + if(current_depth>last_call_depth) fputs(" = <delayed>\n", out); - if (H5_debug_g.ttimes) - fprintf(out, "@%.6f ", event_time.etime-first_time.etime); - for (i=0; i<current_depth; i++) + if(H5_debug_g.ttimes) + fprintf(out, "@%.6f ", event_time.etime - first_time.etime); + for(i = 0; i < current_depth; i++) fputc('+', out); fprintf(out, "%*s%s(", 2*current_depth, "", func); - } + } /* end else */ /* Clear array sizes */ - for (i=0; i<(hssize_t)NELMTS(asize); i++) asize[i] = -1; + for(i = 0; i < (hssize_t)NELMTS(asize); i++) + asize[i] = -1; /* Parse the argument types */ - for (argno=0; *type; argno++, type+=HDisupper(*type)?2:1) { + for(argno = 0; *type; argno++, type += (HDisupper(*type) ? 2 : 1)) { /* Count levels of indirection */ - for (ptr=0; '*'==*type; type++) ptr++; - if ('['==*type) { - if ('a'==type[1]) { - asize_idx = (int)HDstrtol(type+2, &rest, 10); - assert(']'==*rest); - type = rest+1; + for(ptr = 0; '*' == *type; type++) + ptr++; + if('[' == *type) { + if('a' == type[1]) { + asize_idx = (int)HDstrtol(type + 2, &rest, 10); + HDassert(']'==*rest); + type = rest + 1; } else { rest = (char *)HDstrchr(type, ']'); - assert(rest); - type = rest+1; + HDassert(rest); + type = rest + 1; asize_idx = -1; } - } else { + } /* end if */ + else asize_idx = -1; - } /* * The argument name. Leave off the `_id' part. If the argument * name is the null pointer then don't print the argument or the * following `='. This is used for return values. */ - argname = va_arg (ap, char*); /*lint !e64 Type mismatch not really occuring */ - if (argname) { - unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname)-3); /*lint !e666 Allow expression with side effects */ - if (!HDstrcmp (argname+n, "_id")) { - HDstrncpy (buf, argname, (size_t)MIN ((int)sizeof(buf)-1, n)); - buf[MIN((int)sizeof(buf)-1, n)] = '\0'; + argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */ + if(argname) { + unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */ + + if(!HDstrcmp(argname + n, "_id")) { + HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n)); + buf[MIN((int)sizeof(buf) - 1, n)] = '\0'; argname = buf; - } - fprintf (out, "%s%s=", argno?", ":"", argname); - } else { + } /* end if */ + fprintf(out, "%s%s=", argno?", ":"", argname); + } /* end if */ + else argname = ""; - } /* The value */ - if (ptr) vp = va_arg (ap, void*); /*lint !e64 Type mismatch not really occuring */ - switch (type[0]) { - case 'a': - if (ptr) { - if (vp) { - fprintf(out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - haddr_t addr = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ - HDfprintf(out, "%a", addr); - } - break; - - case 'b': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - hbool_t bool_var = va_arg (ap, hbool_t); /*lint !e732 Loss of sign not really occuring */ - if (TRUE==bool_var) fprintf (out, "TRUE"); - else if (!bool_var) fprintf (out, "FALSE"); - else fprintf (out, "TRUE(%u)", (unsigned)bool_var); - } - break; - - case 'd': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - double dbl = va_arg (ap, double); - fprintf (out, "%g", dbl); - } - break; - - case 'D': - switch(type[1]) { - case 'a': - if(ptr) { - if(vp) - fprintf (out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)va_arg(ap, int); + if(ptr) + vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */ + switch(type[0]) { + case 'a': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + haddr_t addr = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ - switch(alloc_time) { - case H5D_ALLOC_TIME_ERROR: - fprintf(out, "H5D_ALLOC_TIME_ERROR"); - break; + HDfprintf(out, "%a", addr); + } /* end else */ + break; - case H5D_ALLOC_TIME_DEFAULT: - fprintf(out, "H5D_ALLOC_TIME_DEFAULT"); - break; + case 'b': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + hbool_t bool_var = va_arg(ap, hbool_t); /*lint !e732 Loss of sign not really occuring */ + + if(TRUE == bool_var) + fprintf(out, "TRUE"); + else if(!bool_var) + fprintf(out, "FALSE"); + else + fprintf(out, "TRUE(%u)", (unsigned)bool_var); + } + break; - case H5D_ALLOC_TIME_EARLY: - fprintf(out, "H5D_ALLOC_TIME_EARLY"); - break; + case 'd': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + double dbl = va_arg(ap, double); - case H5D_ALLOC_TIME_LATE: - fprintf(out, "H5D_ALLOC_TIME_LATE"); - break; + fprintf(out, "%g", dbl); + } /* end else */ + break; - case H5D_ALLOC_TIME_INCR: - fprintf(out, "H5D_ALLOC_TIME_INCR"); - break; + case 'D': + switch(type[1]) { + case 'a': + if(ptr) { + if(vp) + fprintf (out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)va_arg(ap, int); + + switch(alloc_time) { + case H5D_ALLOC_TIME_ERROR: + fprintf(out, "H5D_ALLOC_TIME_ERROR"); + break; + + case H5D_ALLOC_TIME_DEFAULT: + fprintf(out, "H5D_ALLOC_TIME_DEFAULT"); + break; + + case H5D_ALLOC_TIME_EARLY: + fprintf(out, "H5D_ALLOC_TIME_EARLY"); + break; + + case H5D_ALLOC_TIME_LATE: + fprintf(out, "H5D_ALLOC_TIME_LATE"); + break; + + case H5D_ALLOC_TIME_INCR: + fprintf(out, "H5D_ALLOC_TIME_INCR"); + break; + + default: + fprintf(out, "%ld", (long)alloc_time); + break; + } /* end switch */ + } /* end else */ + break; - default: - fprintf(out, "%ld", (long)alloc_time); - break; - } /* end switch */ - } /* end else */ - break; - - case 'c': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)va_arg(ap, int); + case 'c': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)va_arg(ap, int); + + switch(opt) { + case H5FD_MPIO_COLLECTIVE_IO: + fprintf(out, "H5FD_MPIO_COLLECTIVE_IO"); + break; + + case H5FD_MPIO_INDIVIDUAL_IO: + fprintf(out, "H5FD_MPIO_INDIVIDUAL_IO"); + break; + + default: + fprintf(out, "%ld", (long)opt); + break; + } /* end switch */ + } /* end else */ + break; - switch(opt) { - case H5FD_MPIO_COLLECTIVE_IO: - fprintf(out, "H5FD_MPIO_COLLECTIVE_IO"); - break; + case 'f': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_fill_time_t fill_time = (H5D_fill_time_t)va_arg(ap, int); + + switch(fill_time) { + case H5D_FILL_TIME_ERROR: + fprintf(out, "H5D_FILL_TIME_ERROR"); + break; + + case H5D_FILL_TIME_ALLOC: + fprintf(out, "H5D_FILL_TIME_ALLOC"); + break; + + case H5D_FILL_TIME_NEVER: + fprintf(out, "H5D_FILL_TIME_NEVER"); + break; + + case H5D_FILL_TIME_IFSET: + fprintf(out, "H5D_FILL_TIME_IFSET"); + break; + + default: + fprintf(out, "%ld", (long)fill_time); + break; + } /* end switch */ + } /* end else */ + break; - case H5FD_MPIO_INDIVIDUAL_IO: - fprintf(out, "H5FD_MPIO_INDIVIDUAL_IO"); - break; + case 'F': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_fill_value_t fill_value = (H5D_fill_value_t)va_arg(ap, int); + + switch(fill_value) { + case H5D_FILL_VALUE_ERROR: + fprintf(out, "H5D_FILL_VALUE_ERROR"); + break; + + case H5D_FILL_VALUE_UNDEFINED: + fprintf(out, "H5D_FILL_VALUE_UNDEFINED"); + break; + + case H5D_FILL_VALUE_DEFAULT: + fprintf(out, "H5D_FILL_VALUE_DEFAULT"); + break; + + case H5D_FILL_VALUE_USER_DEFINED: + fprintf(out, "H5D_FILL_VALUE_USER_DEFINED"); + break; + + default: + fprintf(out, "%ld", (long)fill_value); + break; + } /* end switch */ + } /* end else */ + break; - default: - fprintf(out, "%ld", (long)opt); - break; - } /* end switch */ - } /* end else */ - break; - - case 'f': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5D_fill_time_t fill_time = (H5D_fill_time_t)va_arg(ap, int); + case 'h': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)va_arg(ap, int); + + switch(opt) { + case H5FD_MPIO_CHUNK_DEFAULT: + fprintf(out, "H5FD_MPIO_CHUNK_DEFAULT"); + break; + + case H5FD_MPIO_CHUNK_ONE_IO: + fprintf(out, "H5FD_MPIO_CHUNK_ONE_IO"); + break; + + case H5FD_MPIO_CHUNK_MULTI_IO: + fprintf(out, "H5FD_MPIO_CHUNK_MULTI_IO"); + break; + + default: + fprintf(out, "%ld", (long)opt); + break; + } /* end switch */ + } /* end else */ + break; - switch(fill_time) { - case H5D_FILL_TIME_ERROR: - fprintf(out, "H5D_FILL_TIME_ERROR"); - break; + case 'l': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_layout_t layout = (H5D_layout_t)va_arg(ap, int); + + switch(layout) { + case H5D_LAYOUT_ERROR: + fprintf(out, "H5D_LAYOUT_ERROR"); + break; + + case H5D_COMPACT: + fprintf(out, "H5D_COMPACT"); + break; + + case H5D_CONTIGUOUS: + fprintf(out, "H5D_CONTIGUOUS"); + break; + + case H5D_CHUNKED: + fprintf(out, "H5D_CHUNKED"); + break; + + case H5D_NLAYOUTS: + fprintf(out, "H5D_NLAYOUTS"); + break; + + default: + fprintf(out, "%ld", (long)layout); + break; + } /* end switch */ + } /* end else */ + break; - case H5D_FILL_TIME_ALLOC: - fprintf(out, "H5D_FILL_TIME_ALLOC"); - break; + case 's': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_space_status_t space_status = (H5D_space_status_t)va_arg(ap, int); + + switch(space_status) { + case H5D_SPACE_STATUS_NOT_ALLOCATED: + fprintf(out, "H5D_SPACE_STATUS_NOT_ALLOCATED"); + break; + + case H5D_SPACE_STATUS_PART_ALLOCATED: + fprintf(out, "H5D_SPACE_STATUS_PART_ALLOCATED"); + break; + + case H5D_SPACE_STATUS_ALLOCATED: + fprintf(out, "H5D_SPACE_STATUS_ALLOCATED"); + break; + + case H5D_SPACE_STATUS_ERROR: + fprintf(out, "H5D_SPACE_STATUS_ERROR"); + break; + + default: + fprintf(out, "%ld", (long)space_status); + break; + } /* end switch */ + } /* end else */ + break; - case H5D_FILL_TIME_NEVER: - fprintf(out, "H5D_FILL_TIME_NEVER"); - break; + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)va_arg(ap, int); + + switch(transfer) { + case H5FD_MPIO_INDEPENDENT: + fprintf(out, "H5FD_MPIO_INDEPENDENT"); + break; + + case H5FD_MPIO_COLLECTIVE: + fprintf(out, "H5FD_MPIO_COLLECTIVE"); + break; + + default: + fprintf(out, "%ld", (long)transfer); + break; + } /* end switch */ + } /* end else */ + break; - case H5D_FILL_TIME_IFSET: - fprintf(out, "H5D_FILL_TIME_IFSET"); - break; + default: + fprintf (out, "BADTYPE(D%c)", type[1]); + goto error; + } /* end switch */ + break; - default: - fprintf(out, "%ld", (long)fill_time); - break; - } /* end switch */ - } /* end else */ - break; - - case 'F': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5D_fill_value_t fill_value = (H5D_fill_value_t)va_arg(ap, int); + case 'e': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + herr_t status = va_arg(ap, herr_t); - switch(fill_value) { - case H5D_FILL_VALUE_ERROR: - fprintf(out, "H5D_FILL_VALUE_ERROR"); - break; + if(status >= 0) + fprintf(out, "SUCCEED"); + else + fprintf(out, "FAIL"); + } /* end else */ + break; - case H5D_FILL_VALUE_UNDEFINED: - fprintf(out, "H5D_FILL_VALUE_UNDEFINED"); - break; + case 'E': + switch(type[1]) { + case 'd': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5E_direction_t direction = (H5E_direction_t)va_arg(ap, int); + + switch(direction) { + case H5E_WALK_UPWARD: + fprintf(out, "H5E_WALK_UPWARD"); + break; + + case H5E_WALK_DOWNWARD: + fprintf(out, "H5E_WALK_DOWNWARD"); + break; + + default: + fprintf(out, "%ld", (long)direction); + break; + } /* end switch */ + } /* end else */ + break; - case H5D_FILL_VALUE_DEFAULT: - fprintf(out, "H5D_FILL_VALUE_DEFAULT"); - break; + case 'e': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5E_error2_t *error = va_arg(ap, H5E_error2_t *); /*lint !e64 Type mismatch not really occuring */ - case H5D_FILL_VALUE_USER_DEFINED: - fprintf(out, "H5D_FILL_VALUE_USER_DEFINED"); - break; + fprintf(out, "0x%lx", (unsigned long)error); + } /* end else */ + break; - default: - fprintf(out, "%ld", (long)fill_value); - break; - } /* end switch */ - } /* end else */ - break; - - case 'h': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)va_arg(ap, int); + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5E_type_t etype = (H5E_type_t)va_arg(ap, int); + + switch(etype) { + case H5E_MAJOR: + fprintf(out, "H5E_MAJOR"); + break; + + case H5E_MINOR: + fprintf(out, "H5E_MINOR"); + break; + + default: + fprintf(out, "%ld", (long)etype); + break; + } /* end switch */ + } /* end else */ + break; - switch(opt) { - case H5FD_MPIO_CHUNK_DEFAULT: - fprintf(out, "H5FD_MPIO_CHUNK_DEFAULT"); - break; + default: + fprintf(out, "BADTYPE(E%c)", type[1]); + goto error; + } /* end switch */ + break; - case H5FD_MPIO_CHUNK_ONE_IO: - fprintf(out, "H5FD_MPIO_CHUNK_ONE_IO"); - break; + case 'F': + switch(type[1]) { + case 'd': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5F_close_degree_t degree = (H5F_close_degree_t)va_arg(ap, int); + + switch(degree) { + case H5F_CLOSE_DEFAULT: + fprintf(out, "H5F_CLOSE_DEFAULT"); + break; + + case H5F_CLOSE_WEAK: + fprintf(out, "H5F_CLOSE_WEAK"); + break; + + case H5F_CLOSE_SEMI: + fprintf(out, "H5F_CLOSE_SEMI"); + break; + + case H5F_CLOSE_STRONG: + fprintf(out, "H5F_CLOSE_STRONG"); + break; + + default: + fprintf(out, "%ld", (long)degree); + break; + } /* end switch */ + } /* end else */ + break; - case H5FD_MPIO_CHUNK_MULTI_IO: - fprintf(out, "H5FD_MPIO_CHUNK_MULTI_IO"); - break; + case 'f': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5F_file_space_type_t fs_type = (H5F_file_space_type_t)va_arg(ap, int); + + switch(fs_type) { + case H5F_FILE_SPACE_DEFAULT: + fprintf(out, "H5F_FILE_SPACE_DEFAULT"); + break; + + case H5F_FILE_SPACE_ALL_PERSIST: + fprintf(out, "H5F_FILE_SPACE_ALL_PERSIST"); + break; + + case H5F_FILE_SPACE_ALL: + fprintf(out, "H5F_FILE_SPACE_ALL"); + break; + + case H5F_FILE_SPACE_AGGR_VFD: + fprintf(out, "H5F_FILE_SPACE_AGGR_VFD"); + break; + + case H5F_FILE_SPACE_VFD: + fprintf(out, "H5F_FILE_SPACE_VFD"); + break; + + case H5F_FILE_SPACE_NTYPES: + default: + fprintf(out, "%ld", (long)fs_type); + break; + } /* end switch */ + } /* end else */ + break; - default: - fprintf(out, "%ld", (long)opt); - break; - } /* end switch */ - } /* end else */ - break; - - case 'l': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5D_layout_t layout = va_arg (ap, H5D_layout_t); /*lint !e64 Type mismatch not really occuring */ - switch (layout) { - case H5D_LAYOUT_ERROR: - fprintf (out, "H5D_LAYOUT_ERROR"); - break; - case H5D_COMPACT: - fprintf (out, "H5D_COMPACT"); - break; - case H5D_CONTIGUOUS: - fprintf (out, "H5D_CONTIGUOUS"); - break; - case H5D_CHUNKED: - fprintf (out, "H5D_CHUNKED"); - break; - case H5D_NLAYOUTS: - fprintf (out, "H5D_NLAYOUTS"); - break; - default: - fprintf (out, "%ld", (long)layout); - break; - } - } - break; - - case 's': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5D_space_status_t space_status = va_arg(ap, H5D_space_status_t); /*lint !e64 Type mismatch not really occuring */ - switch (space_status) { - case H5D_SPACE_STATUS_NOT_ALLOCATED: - fprintf (out, "H5D_SPACE_STATUS_NOT_ALLOCATED"); - break; - case H5D_SPACE_STATUS_PART_ALLOCATED: - fprintf (out, "H5D_SPACE_STATUS_PART_ALLOCATED"); - break; - case H5D_SPACE_STATUS_ALLOCATED: - fprintf (out, "H5D_SPACE_STATUS_ALLOCATED"); - break; - case H5D_SPACE_STATUS_ERROR: - fprintf (out, "H5D_SPACE_STATUS_ERROR"); - break; - default: - fprintf (out, "%ld", (long)space_status); - break; - } - } - break; - - case 't': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5FD_mpio_xfer_t transfer = va_arg(ap, H5FD_mpio_xfer_t); /*lint !e64 Type mismatch not really occuring */ - switch (transfer) { - case H5FD_MPIO_INDEPENDENT: - fprintf (out, "H5FD_MPIO_INDEPENDENT"); - break; - case H5FD_MPIO_COLLECTIVE: - fprintf (out, "H5FD_MPIO_COLLECTIVE"); - break; - default: - fprintf (out, "%ld", (long)transfer); - break; - } - } - break; - - default: - fprintf (out, "BADTYPE(D%c)", type[1]); - goto error; - } /* end switch */ - break; - - case 'e': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - herr_t status = va_arg (ap, herr_t); - if (status>=0) fprintf (out, "SUCCEED"); - else fprintf (out, "FAIL"); - } - break; - - case 'E': - switch (type[1]) { - case 'd': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5E_direction_t direction = va_arg (ap, H5E_direction_t); /*lint !e64 Type mismatch not really occuring */ - switch (direction) { - case H5E_WALK_UPWARD: - fprintf (out, "H5E_WALK_UPWARD"); - break; - case H5E_WALK_DOWNWARD: - fprintf (out, "H5E_WALK_DOWNWARD"); - break; - default: - fprintf (out, "%ld", (long)direction); - break; - } - } - break; - - case 'e': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5E_error2_t *error = va_arg(ap, H5E_error2_t *); /*lint !e64 Type mismatch not really occuring */ - fprintf(out, "0x%lx", (unsigned long)error); - } /* end else */ - break; - - case 't': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5E_type_t etype = va_arg (ap, H5E_type_t); /*lint !e64 Type mismatch not really occuring */ - switch (etype) { - case H5E_MAJOR: - fprintf (out, "H5E_MAJOR"); - break; - case H5E_MINOR: - fprintf (out, "H5E_MINOR"); - break; - default: - fprintf (out, "%ld", (long)etype); - break; - } - } - break; - - default: - fprintf (out, "BADTYPE(E%c)", type[1]); - goto error; - } - break; - - case 'F': - switch(type[1]) { - case 'd': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } else { - H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */ - - switch(degree) { - case H5F_CLOSE_DEFAULT: - fprintf(out, "H5F_CLOSE_DEFAULT"); - break; - case H5F_CLOSE_WEAK: - fprintf(out, "H5F_CLOSE_WEAK"); - break; - case H5F_CLOSE_SEMI: - fprintf(out, "H5F_CLOSE_SEMI"); - break; - case H5F_CLOSE_STRONG: - fprintf(out, "H5F_CLOSE_STRONG"); - break; - default: - fprintf(out, "%ld", (long)degree); - break; - } - } - break; - - case 'f': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5F_file_space_type_t fs_type = va_arg(ap, H5F_file_space_type_t); /*lint !e64 Type mismatch not really occuring */ + case 'm': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5F_mem_t mem_type = (H5F_mem_t)va_arg(ap, int); + + switch(mem_type) { + case H5FD_MEM_NOLIST: + fprintf(out, "H5FD_MEM_NOLIST"); + break; + + case H5FD_MEM_DEFAULT: + fprintf(out, "H5FD_MEM_DEFAULT"); + break; + + case H5FD_MEM_SUPER: + fprintf(out, "H5FD_MEM_SUPER"); + break; + + case H5FD_MEM_BTREE: + fprintf(out, "H5FD_MEM_BTREE"); + break; + + case H5FD_MEM_DRAW: + fprintf(out, "H5FD_MEM_DRAW"); + break; + + case H5FD_MEM_GHEAP: + fprintf(out, "H5FD_MEM_GHEAP"); + break; + + case H5FD_MEM_LHEAP: + fprintf(out, "H5FD_MEM_LHEAP"); + break; + + case H5FD_MEM_OHDR: + fprintf(out, "H5FD_MEM_OHDR"); + break; + + case H5FD_MEM_NTYPES: + default: + fprintf(out, "%ld", (long)mem_type); + break; + } /* end switch */ + } /* end else */ + break; - switch(fs_type) { - case H5F_FILE_SPACE_DEFAULT: - fprintf(out, "H5F_FILE_SPACE_DEFAULT"); - break; - case H5F_FILE_SPACE_ALL_PERSIST: - fprintf(out, "H5F_FILE_SPACE_ALL_PERSIST"); - break; - case H5F_FILE_SPACE_ALL: - fprintf(out, "H5F_FILE_SPACE_ALL"); - break; - case H5F_FILE_SPACE_AGGR_VFD: - fprintf(out, "H5F_FILE_SPACE_AGGR_VFD"); - break; - case H5F_FILE_SPACE_VFD: - fprintf(out, "H5F_FILE_SPACE_VFD"); - break; - case H5F_FILE_SPACE_NTYPES: - default: - fprintf(out, "%ld", (long)fs_type); - break; - } /* end switch */ - } /* end else */ - break; - - case 'm': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5F_mem_t mem_type = va_arg(ap, H5F_mem_t); /*lint !e64 Type mismatch not really occuring */ + case 's': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5F_scope_t scope = (H5F_scope_t)va_arg(ap, int); + + switch(scope) { + case H5F_SCOPE_LOCAL: + fprintf(out, "H5F_SCOPE_LOCAL"); + break; + + case H5F_SCOPE_GLOBAL: + fprintf(out, "H5F_SCOPE_GLOBAL"); + break; + + default: + fprintf(out, "%ld", (long)scope); + break; + } /* end switch */ + } /* end else */ + break; - switch(mem_type) { - case H5FD_MEM_NOLIST: - fprintf(out, "H5FD_MEM_NOLIST"); - break; - case H5FD_MEM_DEFAULT: - fprintf(out, "H5FD_MEM_DEFAULT"); - break; - case H5FD_MEM_SUPER: - fprintf(out, "H5FD_MEM_SUPER"); - break; - case H5FD_MEM_BTREE: - fprintf(out, "H5FD_MEM_BTREE"); - break; - case H5FD_MEM_DRAW: - fprintf(out, "H5FD_MEM_DRAW"); - break; - case H5FD_MEM_GHEAP: - fprintf(out, "H5FD_MEM_GHEAP"); - break; - case H5FD_MEM_LHEAP: - fprintf(out, "H5FD_MEM_LHEAP"); - break; - case H5FD_MEM_OHDR: - fprintf(out, "H5FD_MEM_OHDR"); - break; - case H5FD_MEM_NTYPES: - default: - fprintf(out, "%ld", (long)mem_type); - break; - } /* end switch */ - } /* end else */ - break; - - case 's': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } else { - H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */ - - switch(scope) { - case H5F_SCOPE_LOCAL: - fprintf(out, "H5F_SCOPE_LOCAL"); - break; - case H5F_SCOPE_GLOBAL: - fprintf(out, "H5F_SCOPE_GLOBAL"); - break; - default: - fprintf(out, "%ld", (long)scope); - break; - } - } - break; - - case 'v': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } else { - H5F_libver_t libver_vers = va_arg(ap, H5F_libver_t); /*lint !e64 Type mismatch not really occuring */ - - switch(libver_vers) { - case H5F_LIBVER_EARLIEST: - fprintf(out, "H5F_LIBVER_EARLIEST"); - break; - case H5F_LIBVER_LATEST: - fprintf(out, "H5F_LIBVER_LATEST"); - break; - default: - fprintf(out, "%ld", (long)libver_vers); - break; - } - } - break; + case 'v': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5F_libver_t libver_vers = (H5F_libver_t)va_arg(ap, int); + + switch(libver_vers) { + case H5F_LIBVER_EARLIEST: + fprintf(out, "H5F_LIBVER_EARLIEST"); + break; + + case H5F_LIBVER_LATEST: + fprintf(out, "H5F_LIBVER_LATEST"); + break; + + default: + fprintf(out, "%ld", (long)libver_vers); + break; + } /* end switch */ + } /* end else */ + break; - default: - fprintf(out, "BADTYPE(F%c)", type[1]); - goto error; - } - break; + default: + fprintf(out, "BADTYPE(F%c)", type[1]); + goto error; + } /* end switch */ + break; - case 'G': - switch(type[1]) { + case 'G': + switch(type[1]) { #ifndef H5_NO_DEPRECATED_SYMBOLS - case 'o': - if(ptr) { - if(vp) - fprintf (out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } else { - H5G_obj_t obj_type = va_arg(ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */ - - switch(obj_type) { - case H5G_UNKNOWN: - fprintf(out, "H5G_UNKNOWN"); - break; - - case H5G_GROUP: - fprintf(out, "H5G_GROUP"); - break; - - case H5G_DATASET: - fprintf(out, "H5G_DATASET"); - break; + case 'o': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5G_obj_t obj_type = (H5G_obj_t)va_arg(ap, int); + + switch(obj_type) { + case H5G_UNKNOWN: + fprintf(out, "H5G_UNKNOWN"); + break; + + case H5G_GROUP: + fprintf(out, "H5G_GROUP"); + break; + + case H5G_DATASET: + fprintf(out, "H5G_DATASET"); + break; + + case H5G_TYPE: + fprintf(out, "H5G_TYPE"); + break; + + case H5G_LINK: + fprintf(out, "H5G_LINK"); + break; + + case H5G_UDLINK: + fprintf(out, "H5G_UDLINK"); + break; + + case H5G_RESERVED_5: + case H5G_RESERVED_6: + case H5G_RESERVED_7: + fprintf(out, "H5G_RESERVED(%ld)", (long)obj_type); + break; + + default: + fprintf(out, "%ld", (long)obj_type); + break; + } /* end switch */ + } /* end else */ + break; - case H5G_TYPE: - fprintf(out, "H5G_TYPE"); - break; + case 's': + if(ptr) { + if(vp) + fprintf (out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */ - case H5G_LINK: - fprintf(out, "H5G_LINK"); - break; + fprintf(out, "0x%lx", (unsigned long)statbuf); + } + break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ - case H5G_UDLINK: - fprintf(out, "H5G_UDLINK"); - break; + default: + fprintf(out, "BADTYPE(G%c)", type[1]); + goto error; + } + break; - case H5G_RESERVED_5: - case H5G_RESERVED_6: - case H5G_RESERVED_7: - fprintf(out, "H5G_RESERVED(%ld)",(long)obj_type); - break; + case 'h': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + hsize_t *p = (hsize_t *)vp; + + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) { + if(H5S_UNLIMITED == p[i]) + HDfprintf(out, "%sH5S_UNLIMITED", (i ? ", " : "")); + else + HDfprintf(out, "%s%Hu", (i ? ", " : ""), p[i]); + } /* end for */ + fprintf(out, "}"); + } /* end if */ + } /* end if */ + else + fprintf(out, "NULL"); + } /* end if */ + else { + hsize_t hsize = va_arg(ap, hsize_t); /*lint !e732 Loss of sign not really occuring */ - default: - fprintf(out, "%ld", (long)obj_type); - break; - } /* end switch */ + if(H5S_UNLIMITED == hsize) + HDfprintf(out, "H5S_UNLIMITED"); + else { + HDfprintf(out, "%Hu", hsize); + asize[argno] = (hssize_t)hsize; } /* end else */ - break; - - case 's': - if(ptr) { - if(vp) - fprintf (out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } else { - H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */ - - fprintf(out, "0x%lx", (unsigned long)statbuf); - } - break; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + } /* end else */ + break; - default: - fprintf(out, "BADTYPE(G%c)", type[1]); - goto error; - } - break; - - case 'h': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - if (asize_idx>=0 && asize[asize_idx]>=0) { - hsize_t *p = (hsize_t*)vp; - fprintf(out, " {"); - for (i=0; i<asize[asize_idx]; i++) { - if (H5S_UNLIMITED==p[i]) { - HDfprintf(out, "%sH5S_UNLIMITED", i?", ":""); - } else { - HDfprintf(out, "%s%Hu", i?", ":"", p[i]); - } - } - fprintf(out, "}"); - } - } else { - fprintf(out, "NULL"); - } - } else { - hsize_t hsize = va_arg (ap, hsize_t); /*lint !e732 Loss of sign not really occuring */ - if (H5S_UNLIMITED==hsize) { - HDfprintf(out, "H5S_UNLIMITED"); - } else { - HDfprintf (out, "%Hu", hsize); - asize[argno] = (hssize_t)hsize; - } - } - break; - - case 'H': - switch (type[1]) { - case 's': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - if (asize_idx>=0 && asize[asize_idx]>=0) { - hssize_t *p = (hssize_t*)vp; - fprintf(out, " {"); - for (i=0; i<asize[asize_idx]; i++) { - HDfprintf(out, "%s%Hd", i?", ":"", p[i]); - } - fprintf(out, "}"); - } - } else { - fprintf(out, "NULL"); - } - } else { - hssize_t hssize = va_arg (ap, hssize_t); - HDfprintf (out, "%Hd", hssize); - asize[argno] = (hssize_t)hssize; - } - break; - - default: - fprintf (out, "BADTYPE(H%c)", type[1]); - goto error; - } - break; - - case 'i': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - hid_t obj = va_arg (ap, hid_t); - - if(H5P_DEFAULT == obj) - fprintf(out, "H5P_DEFAULT"); - else if(obj < 0) - fprintf(out, "FAIL"); - else { - switch(H5I_TYPE(obj)) { /* Use internal H5I macro instead of function call */ - case H5I_UNINIT: - fprintf(out, "%ld (uninit - error)", (long)obj); - break; - - case H5I_BADID: - fprintf(out, "%ld (error)", (long)obj); - break; - - case H5I_FILE: - fprintf(out, "%ld (file)", (long)obj); - break; - - case H5I_GROUP: - fprintf(out, "%ld (group)", (long)obj); - break; - - case H5I_DATATYPE: - if(obj == H5T_NATIVE_SCHAR_g) - fprintf(out, "H5T_NATIVE_SCHAR"); - else if(obj == H5T_NATIVE_UCHAR_g) - fprintf(out, "H5T_NATIVE_UCHAR"); - else if(obj == H5T_NATIVE_SHORT_g) - fprintf(out, "H5T_NATIVE_SHORT"); - else if(obj == H5T_NATIVE_USHORT_g) - fprintf(out, "H5T_NATIVE_USHORT"); - else if(obj == H5T_NATIVE_INT_g) - fprintf(out, "H5T_NATIVE_INT"); - else if(obj == H5T_NATIVE_UINT_g) - fprintf(out, "H5T_NATIVE_UINT"); - else if(obj == H5T_NATIVE_LONG_g) - fprintf(out, "H5T_NATIVE_LONG"); - else if(obj == H5T_NATIVE_ULONG_g) - fprintf(out, "H5T_NATIVE_ULONG"); - else if(obj == H5T_NATIVE_LLONG_g) - fprintf(out, "H5T_NATIVE_LLONG"); - else if(obj == H5T_NATIVE_ULLONG_g) - fprintf(out, "H5T_NATIVE_ULLONG"); - else if(obj == H5T_NATIVE_FLOAT_g) - fprintf(out, "H5T_NATIVE_FLOAT"); - else if(obj == H5T_NATIVE_DOUBLE_g) - fprintf(out, "H5T_NATIVE_DOUBLE"); -#if H5_SIZEOF_LONG_DOUBLE !=0 - else if(obj == H5T_NATIVE_LDOUBLE_g) - fprintf(out, "H5T_NATIVE_LDOUBLE"); -#endif - else if(obj == H5T_IEEE_F32BE_g) - fprintf(out, "H5T_IEEE_F32BE"); - else if(obj == H5T_IEEE_F32LE_g) - fprintf(out, "H5T_IEEE_F32LE"); - else if(obj == H5T_IEEE_F64BE_g) - fprintf(out, "H5T_IEEE_F64BE"); - else if(obj == H5T_IEEE_F64LE_g) - fprintf(out, "H5T_IEEE_F64LE"); - else if(obj == H5T_STD_I8BE_g) - fprintf(out, "H5T_STD_I8BE"); - else if(obj == H5T_STD_I8LE_g) - fprintf(out, "H5T_STD_I8LE"); - else if(obj == H5T_STD_I16BE_g) - fprintf(out, "H5T_STD_I16BE"); - else if(obj == H5T_STD_I16LE_g) - fprintf(out, "H5T_STD_I16LE"); - else if(obj == H5T_STD_I32BE_g) - fprintf(out, "H5T_STD_I32BE"); - else if(obj == H5T_STD_I32LE_g) - fprintf(out, "H5T_STD_I32LE"); - else if(obj == H5T_STD_I64BE_g) - fprintf(out, "H5T_STD_I64BE"); - else if(obj == H5T_STD_I64LE_g) - fprintf(out, "H5T_STD_I64LE"); - else if(obj == H5T_STD_U8BE_g) - fprintf(out, "H5T_STD_U8BE"); - else if(obj == H5T_STD_U8LE_g) - fprintf(out, "H5T_STD_U8LE"); - else if(obj == H5T_STD_U16BE_g) - fprintf(out, "H5T_STD_U16BE"); - else if(obj == H5T_STD_U16LE_g) - fprintf(out, "H5T_STD_U16LE"); - else if(obj == H5T_STD_U32BE_g) - fprintf(out, "H5T_STD_U32BE"); - else if(obj == H5T_STD_U32LE_g) - fprintf(out, "H5T_STD_U32LE"); - else if(obj == H5T_STD_U64BE_g) - fprintf(out, "H5T_STD_U64BE"); - else if(obj == H5T_STD_U64LE_g) - fprintf(out, "H5T_STD_U64LE"); - else if(obj == H5T_STD_B8BE_g) - fprintf(out, "H5T_STD_B8BE"); - else if(obj == H5T_STD_B8LE_g) - fprintf(out, "H5T_STD_B8LE"); - else if(obj == H5T_STD_B16BE_g) - fprintf(out, "H5T_STD_B16BE"); - else if(obj == H5T_STD_B16LE_g) - fprintf(out, "H5T_STD_B16LE"); - else if(obj == H5T_STD_B32BE_g) - fprintf(out, "H5T_STD_B32BE"); - else if(obj == H5T_STD_B32LE_g) - fprintf(out, "H5T_STD_B32LE"); - else if(obj == H5T_STD_B64BE_g) - fprintf(out, "H5T_STD_B64BE"); - else if(obj == H5T_STD_B64LE_g) - fprintf(out, "H5T_STD_B64LE"); - else if(obj == H5T_C_S1_g) - fprintf(out, "H5T_C_S1"); - else if(obj == H5T_FORTRAN_S1_g) - fprintf(out, "H5T_FORTRAN_S1"); + case 'H': + switch(type[1]) { + case 's': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + hssize_t *p = (hssize_t *)vp; + + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) + HDfprintf(out, "%s%Hd", (i ? ", " : ""), p[i]); + fprintf(out, "}"); + } /* end if */ + } /* end if */ else - fprintf(out, "%ld (dtype)", (long)obj); - break; - - case H5I_DATASPACE: - fprintf(out, "%ld (dspace)", (long)obj); - /* Save the rank of simple data spaces for arrays */ - /* This may generate recursive call to the library... -QAK */ - { - H5S_t *space; - - if(NULL != (space = (H5S_t *)H5I_object(obj))) - if(H5S_SIMPLE == H5S_GET_EXTENT_TYPE(space)) - asize[argno] = H5S_GET_EXTENT_NDIMS(space); - } - break; - - case H5I_DATASET: - fprintf(out, "%ld (dset)", (long)obj); - break; - - case H5I_ATTR: - fprintf(out, "%ld (attr)", (long)obj); - break; - - case H5I_REFERENCE: - fprintf(out, "%ld (reference)", (long)obj); - break; - - case H5I_VFL: - fprintf(out, "%ld (file driver)", (long)obj); - break; - - case H5I_GENPROP_CLS: - fprintf(out, "%ld (genprop class)", (long)obj); - break; - - case H5I_GENPROP_LST: - fprintf(out, "%ld (genprop list)", (long)obj); - break; - - case H5I_ERROR_CLASS: - fprintf(out, "%ld (err class)", (long)obj); - break; - - case H5I_ERROR_MSG: - fprintf(out, "%ld (err msg)", (long)obj); - break; - - case H5I_ERROR_STACK: - fprintf(out, "%ld (err stack)", (long)obj); - break; - - case H5I_NTYPES: - fprintf (out, "%ld (ntypes - error)", (long)obj); - break; - - default: - fprintf(out, "%ld (unknown class)", (long)obj); - break; - } /* end switch */ - } /* end else */ - } /* end else */ - break; - - case 'I': - switch (type[1]) { - case 'i': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5_index_t idx_type = va_arg(ap, H5_index_t); /*lint !e64 Type mismatch not really occuring */ + fprintf(out, "NULL"); + } /* end if */ + else { + hssize_t hssize = va_arg(ap, hssize_t); - switch(idx_type) { - case H5_INDEX_UNKNOWN: - fprintf(out, "H5_INDEX_UNKNOWN"); - break; - case H5_INDEX_NAME: - fprintf(out, "H5_INDEX_NAME"); - break; - case H5_INDEX_CRT_ORDER: - fprintf(out, "H5_INDEX_CRT_ORDER"); - break; - case H5_INDEX_N: - fprintf(out, "H5_INDEX_N"); - break; - default: - fprintf(out, "%ld", (long)idx_type); - break; - } /* end switch */ - } /* end else */ - break; - - case 'o': - if (ptr) { - if (vp) - fprintf (out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ + HDfprintf(out, "%Hd", hssize); + asize[argno] = (hssize_t)hssize; + } /* end else */ + break; + + default: + fprintf (out, "BADTYPE(H%c)", type[1]); + goto error; + } /* end switch */ + break; + + case 'i': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + hid_t obj = va_arg(ap, hid_t); + + if(H5P_DEFAULT == obj) + fprintf(out, "H5P_DEFAULT"); + else if(obj < 0) + fprintf(out, "FAIL"); else { - H5_iter_order_t order = va_arg (ap, H5_iter_order_t); /*lint !e64 Type mismatch not really occuring */ - switch(order) { - case H5_ITER_UNKNOWN: - fprintf(out, "H5_ITER_UNKNOWN"); - break; - case H5_ITER_INC: - fprintf(out, "H5_ITER_INC"); - break; - case H5_ITER_DEC: - fprintf(out, "H5_ITER_DEC"); - break; - case H5_ITER_NATIVE: - fprintf(out, "H5_ITER_NATIVE"); - break; - case H5_ITER_N: - fprintf(out, "H5_ITER_N"); - break; - default: - fprintf(out, "%ld", (long)order); - break; - } /* end switch */ - } /* end else */ - break; - - case 's': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - if (asize_idx>=0 && asize[asize_idx]>=0) { - int *p = (int*)vp; - fprintf(out, " {"); - for (i=0; i<asize[asize_idx]; i++) { - fprintf(out, "%s%d", i?", ":"", p[i]); - } - fprintf(out, "}"); - } - } else { - fprintf(out, "NULL"); - } - } else { - int is = va_arg (ap, int); - fprintf (out, "%d", is); - asize[argno] = is; - } - break; - - case 't': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5I_type_t id_type = va_arg (ap, H5I_type_t); /*lint !e64 Type mismatch not really occuring */ - switch (id_type) { + switch(H5I_TYPE(obj)) { /* Use internal H5I macro instead of function call */ case H5I_UNINIT: - fprintf (out, "H5I_UNINIT"); + fprintf(out, "%ld (uninit - error)", (long)obj); break; + case H5I_BADID: - fprintf (out, "H5I_BADID"); + fprintf(out, "%ld (error)", (long)obj); break; + case H5I_FILE: - fprintf (out, "H5I_FILE"); + fprintf(out, "%ld (file)", (long)obj); break; + case H5I_GROUP: - fprintf (out, "H5I_GROUP"); + fprintf(out, "%ld (group)", (long)obj); break; + case H5I_DATATYPE: - fprintf (out, "H5I_DATATYPE"); + if(obj == H5T_NATIVE_SCHAR_g) + fprintf(out, "H5T_NATIVE_SCHAR"); + else if(obj == H5T_NATIVE_UCHAR_g) + fprintf(out, "H5T_NATIVE_UCHAR"); + else if(obj == H5T_NATIVE_SHORT_g) + fprintf(out, "H5T_NATIVE_SHORT"); + else if(obj == H5T_NATIVE_USHORT_g) + fprintf(out, "H5T_NATIVE_USHORT"); + else if(obj == H5T_NATIVE_INT_g) + fprintf(out, "H5T_NATIVE_INT"); + else if(obj == H5T_NATIVE_UINT_g) + fprintf(out, "H5T_NATIVE_UINT"); + else if(obj == H5T_NATIVE_LONG_g) + fprintf(out, "H5T_NATIVE_LONG"); + else if(obj == H5T_NATIVE_ULONG_g) + fprintf(out, "H5T_NATIVE_ULONG"); + else if(obj == H5T_NATIVE_LLONG_g) + fprintf(out, "H5T_NATIVE_LLONG"); + else if(obj == H5T_NATIVE_ULLONG_g) + fprintf(out, "H5T_NATIVE_ULLONG"); + else if(obj == H5T_NATIVE_FLOAT_g) + fprintf(out, "H5T_NATIVE_FLOAT"); + else if(obj == H5T_NATIVE_DOUBLE_g) + fprintf(out, "H5T_NATIVE_DOUBLE"); +#if H5_SIZEOF_LONG_DOUBLE !=0 + else if(obj == H5T_NATIVE_LDOUBLE_g) + fprintf(out, "H5T_NATIVE_LDOUBLE"); +#endif + else if(obj == H5T_IEEE_F32BE_g) + fprintf(out, "H5T_IEEE_F32BE"); + else if(obj == H5T_IEEE_F32LE_g) + fprintf(out, "H5T_IEEE_F32LE"); + else if(obj == H5T_IEEE_F64BE_g) + fprintf(out, "H5T_IEEE_F64BE"); + else if(obj == H5T_IEEE_F64LE_g) + fprintf(out, "H5T_IEEE_F64LE"); + else if(obj == H5T_STD_I8BE_g) + fprintf(out, "H5T_STD_I8BE"); + else if(obj == H5T_STD_I8LE_g) + fprintf(out, "H5T_STD_I8LE"); + else if(obj == H5T_STD_I16BE_g) + fprintf(out, "H5T_STD_I16BE"); + else if(obj == H5T_STD_I16LE_g) + fprintf(out, "H5T_STD_I16LE"); + else if(obj == H5T_STD_I32BE_g) + fprintf(out, "H5T_STD_I32BE"); + else if(obj == H5T_STD_I32LE_g) + fprintf(out, "H5T_STD_I32LE"); + else if(obj == H5T_STD_I64BE_g) + fprintf(out, "H5T_STD_I64BE"); + else if(obj == H5T_STD_I64LE_g) + fprintf(out, "H5T_STD_I64LE"); + else if(obj == H5T_STD_U8BE_g) + fprintf(out, "H5T_STD_U8BE"); + else if(obj == H5T_STD_U8LE_g) + fprintf(out, "H5T_STD_U8LE"); + else if(obj == H5T_STD_U16BE_g) + fprintf(out, "H5T_STD_U16BE"); + else if(obj == H5T_STD_U16LE_g) + fprintf(out, "H5T_STD_U16LE"); + else if(obj == H5T_STD_U32BE_g) + fprintf(out, "H5T_STD_U32BE"); + else if(obj == H5T_STD_U32LE_g) + fprintf(out, "H5T_STD_U32LE"); + else if(obj == H5T_STD_U64BE_g) + fprintf(out, "H5T_STD_U64BE"); + else if(obj == H5T_STD_U64LE_g) + fprintf(out, "H5T_STD_U64LE"); + else if(obj == H5T_STD_B8BE_g) + fprintf(out, "H5T_STD_B8BE"); + else if(obj == H5T_STD_B8LE_g) + fprintf(out, "H5T_STD_B8LE"); + else if(obj == H5T_STD_B16BE_g) + fprintf(out, "H5T_STD_B16BE"); + else if(obj == H5T_STD_B16LE_g) + fprintf(out, "H5T_STD_B16LE"); + else if(obj == H5T_STD_B32BE_g) + fprintf(out, "H5T_STD_B32BE"); + else if(obj == H5T_STD_B32LE_g) + fprintf(out, "H5T_STD_B32LE"); + else if(obj == H5T_STD_B64BE_g) + fprintf(out, "H5T_STD_B64BE"); + else if(obj == H5T_STD_B64LE_g) + fprintf(out, "H5T_STD_B64LE"); + else if(obj == H5T_C_S1_g) + fprintf(out, "H5T_C_S1"); + else if(obj == H5T_FORTRAN_S1_g) + fprintf(out, "H5T_FORTRAN_S1"); + else + fprintf(out, "%ld (dtype)", (long)obj); break; + case H5I_DATASPACE: - fprintf (out, "H5I_DATASPACE"); + fprintf(out, "%ld (dspace)", (long)obj); + /* Save the rank of simple data spaces for arrays */ + /* This may generate recursive call to the library... -QAK */ + { + H5S_t *space; + + if(NULL != (space = (H5S_t *)H5I_object(obj))) + if(H5S_SIMPLE == H5S_GET_EXTENT_TYPE(space)) + asize[argno] = H5S_GET_EXTENT_NDIMS(space); + } break; + case H5I_DATASET: - fprintf (out, "H5I_DATASET"); + fprintf(out, "%ld (dset)", (long)obj); break; + case H5I_ATTR: - fprintf (out, "H5I_ATTR"); + fprintf(out, "%ld (attr)", (long)obj); break; + case H5I_REFERENCE: - fprintf (out, "H5I_REFERENCE"); + fprintf(out, "%ld (reference)", (long)obj); break; + case H5I_VFL: - fprintf (out, "H5I_VFL"); + fprintf(out, "%ld (file driver)", (long)obj); break; + case H5I_GENPROP_CLS: - fprintf (out, "H5I_GENPROP_CLS"); + fprintf(out, "%ld (genprop class)", (long)obj); break; + case H5I_GENPROP_LST: - fprintf (out, "H5I_GENPROP_LST"); + fprintf(out, "%ld (genprop list)", (long)obj); break; + case H5I_ERROR_CLASS: - fprintf (out, "H5I_ERROR_CLASS"); + fprintf(out, "%ld (err class)", (long)obj); break; + case H5I_ERROR_MSG: - fprintf (out, "H5I_ERROR_MSG"); + fprintf(out, "%ld (err msg)", (long)obj); break; + case H5I_ERROR_STACK: - fprintf (out, "H5I_ERROR_STACK"); + fprintf(out, "%ld (err stack)", (long)obj); break; + case H5I_NTYPES: - fprintf (out, "H5I_NTYPES"); + fprintf (out, "%ld (ntypes - error)", (long)obj); break; + default: - fprintf (out, "%ld", (long)id_type); + fprintf(out, "%ld (unknown class)", (long)obj); break; - } - } - break; - - case 'u': - if(ptr) { - if(vp) { - fprintf(out, "0x%lx", (unsigned long)vp); - if(asize_idx >= 0 && asize[asize_idx] >= 0) { - unsigned *p = (unsigned*)vp; - - fprintf(out, " {"); - for(i = 0; i < asize[asize_idx]; i++) - HDfprintf(out, "%s%u", i?", ":"", p[i]); - fprintf(out, "}"); + } /* end switch */ + } /* end else */ + } /* end else */ + break; + + case 'I': + switch (type[1]) { + case 'i': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5_index_t idx_type = (H5_index_t)va_arg(ap, int); + + switch(idx_type) { + case H5_INDEX_UNKNOWN: + fprintf(out, "H5_INDEX_UNKNOWN"); + break; + + case H5_INDEX_NAME: + fprintf(out, "H5_INDEX_NAME"); + break; + + case H5_INDEX_CRT_ORDER: + fprintf(out, "H5_INDEX_CRT_ORDER"); + break; + + case H5_INDEX_N: + fprintf(out, "H5_INDEX_N"); + break; + + default: + fprintf(out, "%ld", (long)idx_type); + break; + } /* end switch */ + } /* end else */ + break; + + case 'o': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5_iter_order_t order = (H5_iter_order_t)va_arg(ap, int); + + switch(order) { + case H5_ITER_UNKNOWN: + fprintf(out, "H5_ITER_UNKNOWN"); + break; + + case H5_ITER_INC: + fprintf(out, "H5_ITER_INC"); + break; + + case H5_ITER_DEC: + fprintf(out, "H5_ITER_DEC"); + break; + + case H5_ITER_NATIVE: + fprintf(out, "H5_ITER_NATIVE"); + break; + + case H5_ITER_N: + fprintf(out, "H5_ITER_N"); + break; + + default: + fprintf(out, "%ld", (long)order); + break; + } /* end switch */ + } /* end else */ + break; + + case 's': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + int *p = (int*)vp; + + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) + fprintf(out, "%s%d", (i ? ", " : ""), p[i]); + fprintf(out, "}"); + } /* end if */ } /* end if */ + else + fprintf(out, "NULL"); } /* end if */ - else - fprintf(out, "NULL"); - } /* end if */ - else { - unsigned iu = va_arg(ap, unsigned); /*lint !e732 Loss of sign not really occuring */ + else { + int is = va_arg(ap, int); - fprintf(out, "%u", iu); - asize[argno] = iu; - } /* end else */ - break; - - default: - fprintf (out, "BADTYPE(I%c)", type[1]); - goto error; - } /* end switch */ - break; - - case 'L': - switch(type[1]) { - case 'l': - if(ptr) { - if(vp) - fprintf (out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5L_type_t link_type = va_arg(ap, H5L_type_t); /*lint !e64 Type mismatch not really occuring */ + fprintf (out, "%d", is); + asize[argno] = is; + } /* end else */ + break; - switch(link_type) { - case H5L_TYPE_ERROR: - fprintf(out, "H5L_TYPE_ERROR"); - break; - case H5L_TYPE_HARD: - fprintf(out, "H5L_TYPE_HARD"); - break; - case H5L_TYPE_SOFT: - fprintf(out, "H5L_TYPE_SOFT"); - break; - case H5L_TYPE_EXTERNAL: - fprintf(out, "H5L_TYPE_EXTERNAL"); - break; - case H5L_TYPE_MAX: - fprintf(out, "H5L_TYPE_MAX"); - break; - default: - fprintf(out, "%ld", (long)link_type); - break; - } /* end switch */ - } /* end else */ - break; - - default: - fprintf(out, "BADTYPE(G%c)", type[1]); - goto error; - } /* end switch */ - break; - - case 'M': - switch (type[1]) { - case 'c': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5I_type_t id_type = (H5I_type_t)va_arg(ap, int); + + switch (id_type) { + case H5I_UNINIT: + fprintf(out, "H5I_UNINIT"); + break; + + case H5I_BADID: + fprintf(out, "H5I_BADID"); + break; + + case H5I_FILE: + fprintf(out, "H5I_FILE"); + break; + + case H5I_GROUP: + fprintf(out, "H5I_GROUP"); + break; + + case H5I_DATATYPE: + fprintf(out, "H5I_DATATYPE"); + break; + + case H5I_DATASPACE: + fprintf(out, "H5I_DATASPACE"); + break; + + case H5I_DATASET: + fprintf(out, "H5I_DATASET"); + break; + + case H5I_ATTR: + fprintf(out, "H5I_ATTR"); + break; + + case H5I_REFERENCE: + fprintf(out, "H5I_REFERENCE"); + break; + + case H5I_VFL: + fprintf(out, "H5I_VFL"); + break; + + case H5I_GENPROP_CLS: + fprintf(out, "H5I_GENPROP_CLS"); + break; + + case H5I_GENPROP_LST: + fprintf(out, "H5I_GENPROP_LST"); + break; + + case H5I_ERROR_CLASS: + fprintf(out, "H5I_ERROR_CLASS"); + break; + + case H5I_ERROR_MSG: + fprintf(out, "H5I_ERROR_MSG"); + break; + + case H5I_ERROR_STACK: + fprintf(out, "H5I_ERROR_STACK"); + break; + + case H5I_NTYPES: + fprintf(out, "H5I_NTYPES"); + break; + + default: + fprintf(out, "%ld", (long)id_type); + break; + } /* end switch */ + } /* end else */ + break; + + case 'u': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + unsigned *p = (unsigned*)vp; + + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) + HDfprintf(out, "%s%u", i?", ":"", p[i]); + fprintf(out, "}"); + } /* end if */ + } /* end if */ + else + fprintf(out, "NULL"); + } /* end if */ + else { + unsigned iu = va_arg(ap, unsigned); /*lint !e732 Loss of sign not really occuring */ + + fprintf(out, "%u", iu); + asize[argno] = iu; + } /* end else */ + break; + + default: + fprintf (out, "BADTYPE(I%c)", type[1]); + goto error; + } /* end switch */ + break; + + case 'L': + switch(type[1]) { + case 'l': + if(ptr) { + if(vp) + fprintf (out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5L_type_t link_type = (H5L_type_t)va_arg(ap, int); + + switch(link_type) { + case H5L_TYPE_ERROR: + fprintf(out, "H5L_TYPE_ERROR"); + break; + + case H5L_TYPE_HARD: + fprintf(out, "H5L_TYPE_HARD"); + break; + + case H5L_TYPE_SOFT: + fprintf(out, "H5L_TYPE_SOFT"); + break; + + case H5L_TYPE_EXTERNAL: + fprintf(out, "H5L_TYPE_EXTERNAL"); + break; + + case H5L_TYPE_MAX: + fprintf(out, "H5L_TYPE_MAX"); + break; + + default: + fprintf(out, "%ld", (long)link_type); + break; + } /* end switch */ + } /* end else */ + break; + + default: + fprintf(out, "BADTYPE(G%c)", type[1]); + goto error; + } /* end switch */ + break; + + case 'M': + switch(type[1]) { + case 'c': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ #ifdef H5_HAVE_PARALLEL - MPI_Comm comm = va_arg (ap, MPI_Comm); - fprintf (out, "%ld", (long)comm); -#endif - } - break; - case 'i': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { + else { + MPI_Comm comm = va_arg(ap, MPI_Comm); + + fprintf(out, "%ld", (long)comm); + } /* end else */ +#endif /* H5_HAVE_PARALLEL */ + break; + + case 'i': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ #ifdef H5_HAVE_PARALLEL - MPI_Info info = va_arg (ap, MPI_Info); - fprintf (out, "%ld", (long)info); -#endif - } - break; - case 't': - if (ptr) { - if (vp) { - fprintf(out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5FD_mem_t mt = va_arg(ap, H5FD_mem_t); /*lint !e64 Type mismatch not really occuring */ - switch (mt) { - case H5FD_MEM_NOLIST: - fprintf(out, "H5FD_MEM_NOLIST"); - break; - case H5FD_MEM_DEFAULT: - fprintf(out, "H5FD_MEM_DEFAULT"); - break; - case H5FD_MEM_SUPER: - fprintf(out, "H5FD_MEM_SUPER"); - break; - case H5FD_MEM_BTREE: - fprintf(out, "H5FD_MEM_BTREE"); - break; - case H5FD_MEM_DRAW: - fprintf(out, "H5FD_MEM_DRAW"); - break; - case H5FD_MEM_GHEAP: - fprintf(out, "H5FD_MEM_GHEAP"); - break; - case H5FD_MEM_LHEAP: - fprintf(out, "H5FD_MEM_LHEAP"); - break; - case H5FD_MEM_OHDR: - fprintf(out, "H5FD_MEM_OHDR"); - break; - case H5FD_MEM_NTYPES: - fprintf(out, "H5FD_MEM_NTYPES"); - break; - default: - fprintf(out, "%ld", (long)mt); - break; - } - } - break; - - default: - goto error; - } - break; - - case 'o': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - off_t offset = va_arg (ap, off_t); - fprintf (out, "%ld", (long)offset); - } - break; - - case 'O': - switch(type[1]) { - case 't': - if(ptr) { - if(vp) - fprintf(out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); + else { + MPI_Info info = va_arg(ap, MPI_Info); + + fprintf(out, "%ld", (long)info); + } /* end else */ +#endif /* H5_HAVE_PARALLEL */ + break; + + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5FD_mem_t mt = (H5FD_mem_t)va_arg(ap, int); + + switch(mt) { + case H5FD_MEM_NOLIST: + fprintf(out, "H5FD_MEM_NOLIST"); + break; + + case H5FD_MEM_DEFAULT: + fprintf(out, "H5FD_MEM_DEFAULT"); + break; + + case H5FD_MEM_SUPER: + fprintf(out, "H5FD_MEM_SUPER"); + break; + + case H5FD_MEM_BTREE: + fprintf(out, "H5FD_MEM_BTREE"); + break; + + case H5FD_MEM_DRAW: + fprintf(out, "H5FD_MEM_DRAW"); + break; + + case H5FD_MEM_GHEAP: + fprintf(out, "H5FD_MEM_GHEAP"); + break; + + case H5FD_MEM_LHEAP: + fprintf(out, "H5FD_MEM_LHEAP"); + break; + + case H5FD_MEM_OHDR: + fprintf(out, "H5FD_MEM_OHDR"); + break; + + case H5FD_MEM_NTYPES: + fprintf(out, "H5FD_MEM_NTYPES"); + break; + + default: + fprintf(out, "%ld", (long)mt); + break; + } /* end switch */ + } /* end else */ + break; + + default: + goto error; + } /* end switch */ + break; + + case 'o': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + off_t offset = va_arg(ap, off_t); + + fprintf (out, "%ld", (long)offset); + } /* end else */ + break; + + case 'O': + switch(type[1]) { + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5O_type_t objtype = (H5O_type_t)va_arg(ap, int); + + switch(objtype) { + case H5O_TYPE_UNKNOWN: + fprintf(out, "H5O_TYPE_UNKNOWN"); + break; + + case H5O_TYPE_GROUP: + fprintf(out, "H5O_TYPE_GROUP"); + break; + + case H5O_TYPE_DATASET: + fprintf(out, "H5O_TYPE_DATASET"); + break; + + case H5O_TYPE_NAMED_DATATYPE: + fprintf(out, "H5O_TYPE_NAMED_DATATYPE"); + break; + + case H5O_TYPE_NTYPES: + fprintf(out, "H5O_TYPE_TYPES"); + break; + + default: + fprintf(out, "BADTYPE(%ld)", (long)objtype); + break; + } /* end switch */ + } /* end else */ + break; + + default: + fprintf(out, "BADTYPE(S%c)", type[1]); + goto error; + } /* end switch */ + break; + + case 'p': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + hid_t pclass_id = va_arg(ap, hid_t); + char *class_name = NULL; + H5P_genclass_t *pclass; + + /* Get the class name and print it */ + /* (This may generate recursive call to the library... -QAK) */ + if(NULL != (pclass = (H5P_genclass_t *)H5I_object(pclass_id)) && + NULL != (class_name = H5P_get_class_name(pclass))) { + fprintf(out, "%s", class_name); + H5MM_xfree(class_name); } /* end if */ - else { - H5O_type_t objtype = va_arg(ap, H5O_type_t); /*lint !e64 Type mismatch not really occuring */ - switch(objtype) { - case H5O_TYPE_UNKNOWN: - fprintf(out, "H5O_TYPE_UNKNOWN"); - break; - case H5O_TYPE_GROUP: - fprintf(out, "H5O_TYPE_GROUP"); - break; - case H5O_TYPE_DATASET: - fprintf(out, "H5O_TYPE_DATASET"); - break; - case H5O_TYPE_NAMED_DATATYPE: - fprintf(out, "H5O_TYPE_NAMED_DATATYPE"); - break; - case H5O_TYPE_NTYPES: - fprintf(out, "H5O_TYPE_TYPES"); - break; - default: - fprintf(out, "BADTYPE(%ld)", (long)objtype); - break; - } /* end switch */ - } /* end else */ - break; - - default: - fprintf(out, "BADTYPE(S%c)", type[1]); - goto error; - } /* end switch */ - break; - - case 'p': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - hid_t pclass_id = va_arg (ap, hid_t); - char *class_name = NULL; - H5P_genclass_t *pclass; - - /* Get the class name and print it */ - /* This may generate recursive call to the library... -QAK */ - if(NULL != (pclass = (H5P_genclass_t *)H5I_object(pclass_id)) && - (class_name = H5P_get_class_name(pclass))!=NULL) { - fprintf(out, "%s", class_name); - H5MM_xfree(class_name); + else + fprintf(out, "%ld", (long)pclass_id); + } /* end else */ + break; + + case 'r': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); } /* end if */ else { - fprintf (out, "%ld", (long)pclass_id); + hobj_ref_t ref = va_arg(ap, hobj_ref_t); /*lint !e732 Loss of sign not really occuring */ + + HDfprintf(out, "Reference Object=%a", ref); } /* end else */ - } - break; - - case 'r': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); + break; + + case 'R': + switch(type[1]) { + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5R_type_t reftype = (H5R_type_t)va_arg(ap, int); + + switch(reftype) { + case H5R_BADTYPE: + fprintf(out, "H5R_BADTYPE"); + break; + + case H5R_OBJECT: + fprintf(out, "H5R_OBJECT"); + break; + + case H5R_DATASET_REGION: + fprintf(out, "H5R_DATASET_REGION"); + break; + + case H5R_MAXTYPE: + fprintf(out, "H5R_MAXTYPE"); + break; + + default: + fprintf(out, "BADTYPE(%ld)", (long)reftype); + break; + } /* end switch */ + } /* end else */ + break; + + default: + fprintf(out, "BADTYPE(S%c)", type[1]); + goto error; } - } else { - hobj_ref_t ref = va_arg (ap, hobj_ref_t); /*lint !e732 Loss of sign not really occuring */ - HDfprintf(out, "Reference Object=%a", ref); - } - break; - - case 'R': - switch (type[1]) { - case 't': - if (ptr) { - if (vp) { - fprintf(out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5R_type_t reftype = va_arg(ap, H5R_type_t); /*lint !e64 Type mismatch not really occuring */ - switch (reftype) { - case H5R_BADTYPE: - fprintf(out, "H5R_BADTYPE"); - break; - case H5R_OBJECT: - fprintf(out, "H5R_OBJECT"); - break; - case H5R_DATASET_REGION: - fprintf(out, "H5R_DATASET_REGION"); - break; - case H5R_MAXTYPE: - fprintf(out, "H5R_MAXTYPE"); - break; - default: - fprintf(out, "BADTYPE(%ld)", (long)reftype); - break; - } - } - break; + break; - default: - fprintf(out, "BADTYPE(S%c)", type[1]); - goto error; - } - break; - - case 'S': - switch (type[1]) { - case 'c': - if (ptr) { - if (vp) { - fprintf(out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5S_class_t cls = va_arg(ap, H5S_class_t); /*lint !e64 Type mismatch not really occuring */ - switch (cls) { - case H5S_NO_CLASS: - fprintf(out, "H5S_NO_CLASS"); - break; - case H5S_SCALAR: - fprintf(out, "H5S_SCALAR"); - break; - case H5S_SIMPLE: - fprintf(out, "H5S_SIMPLE"); - break; - case H5S_NULL: - fprintf(out, "H5S_NULL"); - break; - default: - fprintf(out, "%ld", (long)cls); - break; - } - } - break; - - case 's': - if (ptr) { - if (vp) { - fprintf(out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5S_seloper_t so = va_arg(ap, H5S_seloper_t); /*lint !e64 Type mismatch not really occuring */ - switch (so) { - case H5S_SELECT_NOOP: - fprintf(out, "H5S_NOOP"); - break; - case H5S_SELECT_SET: - fprintf(out, "H5S_SELECT_SET"); - break; - case H5S_SELECT_OR: - fprintf(out, "H5S_SELECT_OR"); - break; - case H5S_SELECT_AND: - fprintf(out, "H5S_SELECT_AND"); - break; - case H5S_SELECT_XOR: - fprintf(out, "H5S_SELECT_XOR"); - break; - case H5S_SELECT_NOTB: - fprintf(out, "H5S_SELECT_NOTB"); - break; - case H5S_SELECT_NOTA: - fprintf(out, "H5S_SELECT_NOTA"); - break; - case H5S_SELECT_APPEND: - fprintf(out, "H5S_SELECT_APPEND"); - break; - case H5S_SELECT_PREPEND: - fprintf(out, "H5S_SELECT_PREPEND"); - break; - case H5S_SELECT_INVALID: - fprintf(out, "H5S_SELECT_INVALID"); - break; - default: - fprintf(out, "%ld", (long)so); - break; - } - } - break; + case 'S': + switch(type[1]) { + case 'c': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5S_class_t cls = (H5S_class_t)va_arg(ap, int); + + switch(cls) { + case H5S_NO_CLASS: + fprintf(out, "H5S_NO_CLASS"); + break; + + case H5S_SCALAR: + fprintf(out, "H5S_SCALAR"); + break; + + case H5S_SIMPLE: + fprintf(out, "H5S_SIMPLE"); + break; + + case H5S_NULL: + fprintf(out, "H5S_NULL"); + break; + + default: + fprintf(out, "%ld", (long)cls); + break; + } /* end switch */ + } /* end else */ + break; - case 't': - if (ptr) { - if (vp) { + case 's': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5S_seloper_t so = (H5S_seloper_t)va_arg(ap, int); + + switch(so) { + case H5S_SELECT_NOOP: + fprintf(out, "H5S_NOOP"); + break; + + case H5S_SELECT_SET: + fprintf(out, "H5S_SELECT_SET"); + break; + + case H5S_SELECT_OR: + fprintf(out, "H5S_SELECT_OR"); + break; + + case H5S_SELECT_AND: + fprintf(out, "H5S_SELECT_AND"); + break; + + case H5S_SELECT_XOR: + fprintf(out, "H5S_SELECT_XOR"); + break; + + case H5S_SELECT_NOTB: + fprintf(out, "H5S_SELECT_NOTB"); + break; + + case H5S_SELECT_NOTA: + fprintf(out, "H5S_SELECT_NOTA"); + break; + + case H5S_SELECT_APPEND: + fprintf(out, "H5S_SELECT_APPEND"); + break; + + case H5S_SELECT_PREPEND: + fprintf(out, "H5S_SELECT_PREPEND"); + break; + + case H5S_SELECT_INVALID: + fprintf(out, "H5S_SELECT_INVALID"); + break; + + default: + fprintf(out, "%ld", (long)so); + break; + } /* end switch */ + } /* end else */ + break; + + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5S_sel_type st = (H5S_sel_type)va_arg(ap, int); + + switch(st) { + case H5S_SEL_ERROR: + fprintf(out, "H5S_SEL_ERROR"); + break; + + case H5S_SEL_NONE: + fprintf(out, "H5S_SEL_NONE"); + break; + + case H5S_SEL_POINTS: + fprintf(out, "H5S_SEL_POINTS"); + break; + + case H5S_SEL_HYPERSLABS: + fprintf(out, "H5S_SEL_HYPERSLABS"); + break; + + case H5S_SEL_ALL: + fprintf(out, "H5S_SEL_ALL"); + break; + + case H5S_SEL_N: + fprintf(out, "H5S_SEL_N"); + break; + + default: + fprintf(out, "%ld", (long)st); + break; + } /* end switch */ + } /* end else */ + break; + + default: + fprintf(out, "BADTYPE(S%c)", type[1]); + goto error; + } /* end switch */ + break; + + case 's': + if(ptr) { + if(vp) fprintf(out, "0x%lx", (unsigned long)vp); - } else { + else fprintf(out, "NULL"); - } - } else { - H5S_sel_type st = va_arg(ap, H5S_sel_type); /*lint !e64 Type mismatch not really occuring */ - switch (st) { - case H5S_SEL_ERROR: - fprintf(out, "H5S_SEL_ERROR"); + } /* end if */ + else { + const char *str = va_arg(ap, const char *); /*lint !e64 Type mismatch not really occuring */ + + fprintf(out, "\"%s\"", str); + } /* end else */ + break; + + case 'T': + switch(type[1]) { + case 'c': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_cset_t cset = (H5T_cset_t)va_arg(ap, int); + + switch(cset) { + case H5T_CSET_ERROR: + fprintf(out, "H5T_CSET_ERROR"); + break; + + case H5T_CSET_ASCII: + fprintf(out, "H5T_CSET_ASCII"); + break; + + case H5T_CSET_UTF8: + fprintf(out, "H5T_CSET_UTF8"); + break; + + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: + fprintf(out, "H5T_CSET_RESERVED_%ld", (long)cset); + break; + + default: + fprintf(out, "%ld", (long)cset); + break; + } /* end switch */ + } /* end else */ + break; + + case 'd': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_direction_t direct = (H5T_direction_t)va_arg(ap, int); + + switch(direct) { + case H5T_DIR_DEFAULT: + fprintf(out, "H5T_DIR_DEFAULT"); + break; + + case H5T_DIR_ASCEND: + fprintf(out, "H5T_DIR_ASCEND"); + break; + + case H5T_DIR_DESCEND: + fprintf(out, "H5T_DIR_DESCEND"); + break; + + default: + fprintf(out, "%ld", (long)direct); + break; + } /* end switch */ + } /* end else */ + break; + + case 'e': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_pers_t pers = (H5T_pers_t)va_arg(ap, int); + + switch(pers) { + case H5T_PERS_DONTCARE: + fprintf(out, "H5T_PERS_DONTCARE"); + break; + + case H5T_PERS_SOFT: + fprintf(out, "H5T_PERS_SOFT"); + break; + + case H5T_PERS_HARD: + fprintf(out, "H5T_PERS_HARD"); + break; + + default: + fprintf(out, "%ld", (long)pers); + break; + } /* end switch */ + } /* end else */ break; - case H5S_SEL_NONE: - fprintf(out, "H5S_SEL_NONE"); + + case 'n': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_norm_t norm = (H5T_norm_t)va_arg(ap, int); + + switch(norm) { + case H5T_NORM_ERROR: + fprintf(out, "H5T_NORM_ERROR"); + break; + + case H5T_NORM_IMPLIED: + fprintf(out, "H5T_NORM_IMPLIED"); + break; + + case H5T_NORM_MSBSET: + fprintf(out, "H5T_NORM_MSBSET"); + break; + + case H5T_NORM_NONE: + fprintf(out, "H5T_NORM_NONE"); + break; + + default: + fprintf(out, "%ld", (long)norm); + break; + } /* end switch */ + } /* end else */ break; - case H5S_SEL_POINTS: - fprintf(out, "H5S_SEL_POINTS"); + + case 'o': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_order_t order = (H5T_order_t)va_arg(ap, int); + + switch(order) { + case H5T_ORDER_ERROR: + fprintf(out, "H5T_ORDER_ERROR"); + break; + + case H5T_ORDER_LE: + fprintf(out, "H5T_ORDER_LE"); + break; + + case H5T_ORDER_BE: + fprintf(out, "H5T_ORDER_BE"); + break; + + case H5T_ORDER_VAX: + fprintf(out, "H5T_ORDER_VAX"); + break; + + case H5T_ORDER_NONE: + fprintf(out, "H5T_ORDER_NONE"); + break; + + default: + fprintf(out, "%ld", (long)order); + break; + } /* end switch */ + } /* end else */ break; - case H5S_SEL_HYPERSLABS: - fprintf(out, "H5S_SEL_HYPERSLABS"); + + case 'p': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_pad_t pad = (H5T_pad_t)va_arg(ap, int); + + switch(pad) { + case H5T_PAD_ERROR: + fprintf(out, "H5T_PAD_ERROR"); + break; + + case H5T_PAD_ZERO: + fprintf(out, "H5T_PAD_ZERO"); + break; + + case H5T_PAD_ONE: + fprintf(out, "H5T_PAD_ONE"); + break; + + case H5T_PAD_BACKGROUND: + fprintf(out, "H5T_PAD_BACKGROUND"); + break; + + case H5T_NPAD: + fprintf(out, "H5T_NPAD"); + break; + + default: + fprintf(out, "%ld", (long)pad); + break; + } /* end switch */ + } /* end else */ + break; + + case 's': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_sign_t sign = (H5T_sign_t)va_arg(ap, int); + + switch(sign) { + case H5T_SGN_ERROR: + fprintf(out, "H5T_SGN_ERROR"); + break; + + case H5T_SGN_NONE: + fprintf(out, "H5T_SGN_NONE"); + break; + + case H5T_SGN_2: + fprintf(out, "H5T_SGN_2"); + break; + + case H5T_NSGN: + fprintf(out, "H5T_NSGN"); + break; + + default: + fprintf(out, "%ld", (long)sign); + break; + } /* end switch */ + } /* end else */ break; - case H5S_SEL_ALL: - fprintf(out, "H5S_SEL_ALL"); + + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_class_t type_class = (H5T_class_t)va_arg(ap, int); + + switch(type_class) { + case H5T_NO_CLASS: + fprintf(out, "H5T_NO_CLASS"); + break; + + case H5T_INTEGER: + fprintf(out, "H5T_INTEGER"); + break; + + case H5T_FLOAT: + fprintf(out, "H5T_FLOAT"); + break; + + case H5T_TIME: + fprintf(out, "H5T_TIME"); + break; + + case H5T_STRING: + fprintf(out, "H5T_STRING"); + break; + + case H5T_BITFIELD: + fprintf(out, "H5T_BITFIELD"); + break; + + case H5T_OPAQUE: + fprintf(out, "H5T_OPAQUE"); + break; + + case H5T_COMPOUND: + fprintf(out, "H5T_COMPOUND"); + break; + + case H5T_REFERENCE: + fprintf(out, "H5T_REFERENCE"); + break; + + case H5T_ENUM: + fprintf(out, "H5T_ENUM"); + break; + + case H5T_VLEN: + fprintf(out, "H5T_VLEN"); + break; + + case H5T_ARRAY: + fprintf(out, "H5T_ARRAY"); + break; + + case H5T_NCLASSES: + fprintf(out, "H5T_NCLASSES"); + break; + + default: + fprintf(out, "%ld", (long)type_class); + break; + } /* end switch */ + } /* end else */ break; - case H5S_SEL_N: - fprintf(out, "H5S_SEL_N"); + + case 'z': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5T_str_t str = (H5T_str_t)va_arg(ap, int); + + switch(str) { + case H5T_STR_ERROR: + fprintf(out, "H5T_STR_ERROR"); + break; + + case H5T_STR_NULLTERM: + fprintf(out, "H5T_STR_NULLTERM"); + break; + + case H5T_STR_NULLPAD: + fprintf(out, "H5T_STR_NULLPAD"); + break; + + case H5T_STR_SPACEPAD: + fprintf(out, "H5T_STR_SPACEPAD"); + break; + + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: + fprintf(out, "H5T_STR_RESERVED(%ld)",(long)str); + break; + + default: + fprintf(out, "%ld", (long)str); + break; + } /* end switch */ + } /* end else */ break; + default: - fprintf(out, "%ld", (long)st); - break; - } - } + fprintf (out, "BADTYPE(T%c)", type[1]); + goto error; + } /* end switch */ break; - default: - fprintf(out, "BADTYPE(S%c)", type[1]); - goto error; - } - break; - - case 's': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - const char *str = va_arg (ap, const char*); /*lint !e64 Type mismatch not really occuring */ - fprintf (out, "\"%s\"", str); - } - break; - - case 'T': - switch (type[1]) { - case 'c': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_cset_t cset = va_arg (ap, H5T_cset_t); /*lint !e64 Type mismatch not really occuring */ - switch (cset) { - case H5T_CSET_ERROR: - fprintf (out, "H5T_CSET_ERROR"); - break; - case H5T_CSET_ASCII: - fprintf (out, "H5T_CSET_ASCII"); - break; - case H5T_CSET_UTF8: - fprintf (out, "H5T_CSET_UTF8"); - break; - case H5T_CSET_RESERVED_2: - case H5T_CSET_RESERVED_3: - case H5T_CSET_RESERVED_4: - case H5T_CSET_RESERVED_5: - case H5T_CSET_RESERVED_6: - case H5T_CSET_RESERVED_7: - case H5T_CSET_RESERVED_8: - case H5T_CSET_RESERVED_9: - case H5T_CSET_RESERVED_10: - case H5T_CSET_RESERVED_11: - case H5T_CSET_RESERVED_12: - case H5T_CSET_RESERVED_13: - case H5T_CSET_RESERVED_14: - case H5T_CSET_RESERVED_15: - fprintf (out, "H5T_CSET_RESERVED(%ld)",(long)cset); - break; - default: - fprintf (out, "%ld", (long)cset); - break; - } - } - break; - - case 'd': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_direction_t direct = va_arg (ap, H5T_direction_t); /*lint !e64 Type mismatch not really occuring */ - switch (direct) { - case H5T_DIR_DEFAULT: - fprintf (out, "H5T_DIR_DEFAULT"); - break; - case H5T_DIR_ASCEND: - fprintf (out, "H5T_DIR_ASCEND"); - break; - case H5T_DIR_DESCEND: - fprintf (out, "H5T_DIR_DESCEND"); - break; - default: - fprintf (out, "%ld", (long)direct); - break; - } - } - break; - - case 'e': - if (ptr) { - if (vp) { - fprintf(out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_pers_t pers = va_arg(ap, H5T_pers_t); /*lint !e64 Type mismatch not really occuring */ - switch (pers) { - case H5T_PERS_DONTCARE: - fprintf(out, "H5T_PERS_DONTCARE"); - break; - case H5T_PERS_SOFT: - fprintf(out, "H5T_PERS_SOFT"); - break; - case H5T_PERS_HARD: - fprintf(out, "H5T_PERS_HARD"); - break; - default: - fprintf(out, "%ld", (long)pers); - break; - } - } - break; - - case 'n': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_norm_t norm = va_arg (ap, H5T_norm_t); /*lint !e64 Type mismatch not really occuring */ - switch (norm) { - case H5T_NORM_ERROR: - fprintf (out, "H5T_NORM_ERROR"); - break; - case H5T_NORM_IMPLIED: - fprintf (out, "H5T_NORM_IMPLIED"); - break; - case H5T_NORM_MSBSET: - fprintf (out, "H5T_NORM_MSBSET"); - break; - case H5T_NORM_NONE: - fprintf (out, "H5T_NORM_NONE"); - break; - default: - fprintf (out, "%ld", (long)norm); - break; - } - } - break; - - case 'o': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_order_t order = va_arg (ap, H5T_order_t); /*lint !e64 Type mismatch not really occuring */ - switch (order) { - case H5T_ORDER_ERROR: - fprintf (out, "H5T_ORDER_ERROR"); - break; - case H5T_ORDER_LE: - fprintf (out, "H5T_ORDER_LE"); - break; - case H5T_ORDER_BE: - fprintf (out, "H5T_ORDER_BE"); - break; - case H5T_ORDER_VAX: - fprintf (out, "H5T_ORDER_VAX"); - break; - case H5T_ORDER_NONE: - fprintf (out, "H5T_ORDER_NONE"); - break; - default: - fprintf (out, "%ld", (long)order); - break; - } - } - break; - - case 'p': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_pad_t pad = va_arg (ap, H5T_pad_t); /*lint !e64 Type mismatch not really occuring */ - switch (pad) { - case H5T_PAD_ERROR: - fprintf (out, "H5T_PAD_ERROR"); - break; - case H5T_PAD_ZERO: - fprintf (out, "H5T_PAD_ZERO"); - break; - case H5T_PAD_ONE: - fprintf (out, "H5T_PAD_ONE"); - break; - case H5T_PAD_BACKGROUND: - fprintf (out, "H5T_PAD_BACKGROUND"); - break; - case H5T_NPAD: - fprintf (out, "H5T_NPAD"); - break; - default: - fprintf (out, "%ld", (long)pad); - break; - } - } - break; - - case 's': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_sign_t sign = va_arg (ap, H5T_sign_t); /*lint !e64 Type mismatch not really occuring */ - switch (sign) { - case H5T_SGN_ERROR: - fprintf (out, "H5T_SGN_ERROR"); - break; - case H5T_SGN_NONE: - fprintf (out, "H5T_SGN_NONE"); - break; - case H5T_SGN_2: - fprintf (out, "H5T_SGN_2"); - break; - case H5T_NSGN: - fprintf (out, "H5T_NSGN"); - break; - default: - fprintf (out, "%ld", (long)sign); - break; - } - } - break; - - case 't': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_class_t type_class = va_arg(ap, H5T_class_t); /*lint !e64 Type mismatch not really occuring */ - switch (type_class) { - case H5T_NO_CLASS: - fprintf(out, "H5T_NO_CLASS"); - break; - case H5T_INTEGER: - fprintf(out, "H5T_INTEGER"); - break; - case H5T_FLOAT: - fprintf(out, "H5T_FLOAT"); - break; - case H5T_TIME: - fprintf(out, "H5T_TIME"); - break; - case H5T_STRING: - fprintf(out, "H5T_STRING"); - break; - case H5T_BITFIELD: - fprintf(out, "H5T_BITFIELD"); - break; - case H5T_OPAQUE: - fprintf(out, "H5T_OPAQUE"); - break; - case H5T_COMPOUND: - fprintf(out, "H5T_COMPOUND"); - break; - case H5T_REFERENCE: - fprintf(out, "H5T_REFERENCE"); - break; - case H5T_ENUM: - fprintf(out, "H5T_ENUM"); - break; - case H5T_VLEN: - fprintf(out, "H5T_VLEN"); - break; - case H5T_ARRAY: - fprintf(out, "H5T_ARRAY"); - break; - case H5T_NCLASSES: - fprintf(out, "H5T_NCLASSES"); - break; - default: - fprintf(out, "%ld", (long)type_class); - break; - } - } - break; - - case 'z': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5T_str_t str = va_arg(ap, H5T_str_t); /*lint !e64 Type mismatch not really occuring */ - switch (str) { - case H5T_STR_ERROR: - fprintf(out, "H5T_STR_ERROR"); - break; - case H5T_STR_NULLTERM: - fprintf(out, "H5T_STR_NULLTERM"); - break; - case H5T_STR_NULLPAD: - fprintf(out, "H5T_STR_NULLPAD"); - break; - case H5T_STR_SPACEPAD: - fprintf(out, "H5T_STR_SPACEPAD"); - break; - case H5T_STR_RESERVED_3: - case H5T_STR_RESERVED_4: - case H5T_STR_RESERVED_5: - case H5T_STR_RESERVED_6: - case H5T_STR_RESERVED_7: - case H5T_STR_RESERVED_8: - case H5T_STR_RESERVED_9: - case H5T_STR_RESERVED_10: - case H5T_STR_RESERVED_11: - case H5T_STR_RESERVED_12: - case H5T_STR_RESERVED_13: - case H5T_STR_RESERVED_14: - case H5T_STR_RESERVED_15: - fprintf(out, "H5T_STR_RESERVED(%ld)",(long)str); - break; - default: - fprintf(out, "%ld", (long)str); - break; - } - } - break; - - default: - fprintf (out, "BADTYPE(T%c)", type[1]); - goto error; - } - break; - - case 't': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - htri_t tri_var = va_arg (ap, htri_t); - if (tri_var>0) fprintf (out, "TRUE"); - else if (!tri_var) fprintf (out, "FALSE"); - else fprintf (out, "FAIL(%d)", (int)tri_var); - } - break; - - case 'x': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - if (asize_idx>=0 && asize[asize_idx]>=0) { - void **p = (void**)vp; - fprintf(out, " {"); - for (i=0; i<asize[asize_idx]; i++) { - if (p[i]) { - fprintf(out, "%s0x%lx", i?", ":"", - (unsigned long)(p[i])); - } else { - fprintf(out, "%sNULL", i?", ":""); - } - } - fprintf(out, "}"); - } - } else { - fprintf(out, "NULL"); - } - } else { - vp = va_arg (ap, void*); /*lint !e64 Type mismatch not really occuring */ - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } - break; - - case 'z': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - if (asize_idx>=0 && asize[asize_idx]>=0) { - size_t *p = (size_t*)vp; - fprintf(out, " {"); - for (i=0; i<asize[asize_idx]; i++) { - HDfprintf(out, "%s%Zu", i?", ":"", p[i]); - } - fprintf(out, "}"); - } - } else { - fprintf(out, "NULL"); - } - } else { - size_t size = va_arg (ap, size_t); /*lint !e732 Loss of sign not really occuring */ + case 't': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + htri_t tri_var = va_arg (ap, htri_t); + + if(tri_var>0) + fprintf (out, "TRUE"); + else if(!tri_var) + fprintf (out, "FALSE"); + else + fprintf(out, "FAIL(%d)", (int)tri_var); + } /* end else */ + break; - HDfprintf (out, "%Zu", size); - asize[argno] = (hssize_t)size; - } - break; - - case 'Z': - switch (type[1]) { - case 'a': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5Z_SO_scale_type_t scale_type = va_arg (ap, H5Z_SO_scale_type_t); /*lint !e64 Type mismatch not really occuring */ - switch(scale_type) { - case H5Z_SO_FLOAT_DSCALE: - fprintf(out, "H5Z_SO_FLOAT_DSCALE"); - break; - case H5Z_SO_FLOAT_ESCALE: - fprintf(out, "H5Z_SO_FLOAT_ESCALE"); - break; - case H5Z_SO_INT: - fprintf(out, "H5Z_SO_INT"); - break; - default: - fprintf(out, "%ld", (long)scale_type); - break; - } - } - break; - case 'c': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5Z_class2_t *filter = va_arg (ap, H5Z_class2_t*); /*lint !e64 Type mismatch not really occuring */ - fprintf (out, "0x%lx", (unsigned long)filter); - } - break; - - case 'e': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5Z_EDC_t edc = va_arg (ap, H5Z_EDC_t); /*lint !e64 Type mismatch not really occuring */ - - if (H5Z_DISABLE_EDC==edc) { - fprintf (out, "H5Z_DISABLE_EDC"); - } else if (H5Z_ENABLE_EDC==edc) { - fprintf (out, "H5Z_ENABLE_EDC"); - } else { - fprintf (out, "%ld", (long)edc); - } - } - break; - - case 'f': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5Z_filter_t id = va_arg (ap, H5Z_filter_t); + case 'x': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + void **p = (void**)vp; + + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) { + if(p[i]) + fprintf(out, "%s0x%lx", (i ? ", " : ""), (unsigned long)(p[i])); + else + fprintf(out, "%sNULL", (i ? ", " : "")); + } /* end for */ + fprintf(out, "}"); + } /* end if */ + } /* end if */ + else + fprintf(out, "NULL"); + } /* end if */ + else { + vp = va_arg (ap, void *); /*lint !e64 Type mismatch not really occuring */ - if (H5Z_FILTER_DEFLATE==id) { - fprintf (out, "H5Z_FILTER_DEFLATE"); - } else { - fprintf (out, "%ld", (long)id); - } - } - break; - - case 's': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - if (asize_idx>=0 && asize[asize_idx]>=0) { - ssize_t *p = (ssize_t*)vp; - fprintf(out, " {"); - for (i=0; i<asize[asize_idx]; i++) { - HDfprintf(out, "%s%Zd", i?", ":"", p[i]); - } - fprintf(out, "}"); - } - } else { - fprintf(out, "NULL"); - } - } else { - ssize_t ssize = va_arg (ap, ssize_t); + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end else */ + break; - HDfprintf (out, "%Zd", ssize); - asize[argno] = (hssize_t)ssize; - } - break; + case 'z': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + size_t *p = (size_t *)vp; - default: - fprintf (out, "BADTYPE(Z%c)", type[1]); - goto error; - } - break; + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) + HDfprintf(out, "%s%Zu", (i ? ", " : ""), p[i]); + fprintf(out, "}"); + } /* end if */ + } /* end if */ + else + fprintf(out, "NULL"); + } /* end if */ + else { + size_t size = va_arg(ap, size_t); /*lint !e732 Loss of sign not really occuring */ - default: - if (HDisupper (type[0])) { - fprintf (out, "BADTYPE(%c%c)", type[0], type[1]); - } else { - fprintf (out, "BADTYPE(%c)", type[0]); - } - goto error; - } - } + HDfprintf(out, "%Zu", size); + asize[argno] = (hssize_t)size; + } /* end else */ + break; + + case 'Z': + switch (type[1]) { + case 'a': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)va_arg(ap, int); + + switch(scale_type) { + case H5Z_SO_FLOAT_DSCALE: + fprintf(out, "H5Z_SO_FLOAT_DSCALE"); + break; + + case H5Z_SO_FLOAT_ESCALE: + fprintf(out, "H5Z_SO_FLOAT_ESCALE"); + break; + + case H5Z_SO_INT: + fprintf(out, "H5Z_SO_INT"); + break; + + default: + fprintf(out, "%ld", (long)scale_type); + break; + } /* end switch */ + } /* end else */ + break; + + case 'c': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*); /*lint !e64 Type mismatch not really occuring */ + + fprintf(out, "0x%lx", (unsigned long)filter); + } /* end else */ + break; + + case 'e': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5Z_EDC_t edc = (H5Z_EDC_t)va_arg(ap, int); + + if(H5Z_DISABLE_EDC == edc) + fprintf(out, "H5Z_DISABLE_EDC"); + else if (H5Z_ENABLE_EDC == edc) + fprintf(out, "H5Z_ENABLE_EDC"); + else + fprintf(out, "%ld", (long)edc); + } /* end else */ + break; + case 'f': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5Z_filter_t id = va_arg(ap, H5Z_filter_t); + + if(H5Z_FILTER_DEFLATE == id) + fprintf(out, "H5Z_FILTER_DEFLATE"); + else + fprintf(out, "%ld", (long)id); + } /* end else */ + break; + + case 's': + if(ptr) { + if(vp) { + fprintf(out, "0x%lx", (unsigned long)vp); + if(asize_idx >= 0 && asize[asize_idx] >= 0) { + ssize_t *p = (ssize_t *)vp; + + fprintf(out, " {"); + for(i = 0; i < asize[asize_idx]; i++) + HDfprintf(out, "%s%Zd", (i ? ", " : ""), p[i]); + fprintf(out, "}"); + } /* end if */ + } /* end if */ + else + fprintf(out, "NULL"); + } /* end if */ + else { + ssize_t ssize = va_arg(ap, ssize_t); + + HDfprintf(out, "%Zd", ssize); + asize[argno] = (hssize_t)ssize; + } /* end else */ + break; + + default: + fprintf(out, "BADTYPE(Z%c)", type[1]); + goto error; + } /* end switch */ + break; + + default: + if(HDisupper(type[0])) + fprintf(out, "BADTYPE(%c%c)", type[0], type[1]); + else + fprintf(out, "BADTYPE(%c)", type[0]); + goto error; + } /* end switch */ + } /* end for */ /* Display event time for return */ - if (returning && H5_debug_g.ttimes) - fprintf(out, " @%.6f [dt=%.6f]", - event_time.etime - first_time.etime, - event_time.etime - *returning); - - error: - va_end (ap); - if (returning) { - fprintf (out, ";\n"); - } else { + if(returning && H5_debug_g.ttimes) + fprintf(out, " @%.6f [dt=%.6f]", (event_time.etime - first_time.etime), + (event_time.etime - *returning)); + +error: + va_end(ap); + if(returning) + fprintf(out, ";\n"); + else { last_call_depth = current_depth++; fprintf (out, ")"); - } - HDfflush (out); + } /* end else */ + HDfflush(out); + return event_time.etime; } /* end H5_trace() */ |