From c226e58005f54b29dc9fc5f762f7aa6382e790ff Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 31 Aug 2015 14:04:23 -0500 Subject: [svn-r27626] Various minor warning fixes before major SWMR and VDS merges. gcc 4.9.2 was used to create the warning list - implicit casts - shadowed variables - various enum issues - other minor fixes (comments, unused macros, etc.) Tested on: h5committest --- src/H5FDstdio.c | 42 ++++---- src/H5Fsuper.c | 10 +- src/H5PL.c | 2 + src/H5Tfixed.c | 16 +-- src/H5Topaque.c | 20 ++-- src/H5Tpad.c | 18 ++-- src/H5Tprecis.c | 32 ++++-- src/H5Tstrpad.c | 16 +-- src/H5Tvisit.c | 13 +++ src/H5Tvlen.c | 26 ++++- src/H5Znbit.c | 123 +++++++++++++++++++--- src/H5Zscaleoffset.c | 2 + src/H5Ztrans.c | 201 +++++++++++++++++++---------------- test/dsets.c | 2 +- test/earray.c | 4 +- test/farray.c | 8 +- test/fheap.c | 12 +-- test/fillval.c | 2 +- test/gen_udlinks.c | 4 + test/tattr.c | 12 +-- test/tfile.c | 110 ++++++++++--------- test/tgenprop.c | 82 +++++++-------- test/th5s.c | 2 +- test/tmisc.c | 42 ++++---- test/ttst.c | 6 +- test/tvltypes.c | 52 +++++---- tools/h5diff/h5diffgentest.c | 10 +- tools/h5dump/h5dump.c | 4 +- tools/h5dump/h5dump.h | 19 ++-- tools/h5dump/h5dump_ddl.c | 17 +++ tools/h5dump/h5dump_xml.c | 245 ++++++++++++++++++++++++++----------------- tools/h5jam/h5jamgentest.c | 2 +- tools/h5ls/h5ls.c | 5 +- tools/lib/h5diff_array.c | 40 +++---- tools/lib/h5diff_dset.c | 47 ++++----- tools/lib/h5diff_util.c | 49 ++++++--- tools/lib/h5tools.c | 16 ++- tools/lib/h5tools_dump.c | 8 +- tools/lib/h5tools_ref.c | 4 +- tools/lib/h5tools_str.c | 14 ++- tools/lib/h5tools_type.c | 193 +++++++++++++++++----------------- tools/lib/h5tools_utils.c | 3 + tools/lib/io_timer.c | 12 ++- tools/misc/h5debug.c | 12 ++- tools/misc/h5mkgrp.c | 2 +- tools/misc/h5repart.c | 10 +- tools/perform/chunk.c | 6 +- tools/perform/overhead.c | 2 +- tools/perform/sio_engine.c | 2 +- tools/perform/sio_perf.c | 20 ++-- 50 files changed, 948 insertions(+), 653 deletions(-) diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 65b75a3..686e1fc 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -43,17 +43,7 @@ #include #include -/* This is not defined in the Windows header files */ -#ifndef F_OK -#define F_OK 00 -#endif - -#endif - -#ifdef MAX -#undef MAX -#endif /* MAX */ -#define MAX(X,Y) ((X)>(Y)?(X):(Y)) +#endif /* H5_HAVE_WIN32_API */ /* The driver identification number, initialized at runtime */ static hid_t H5FD_STDIO_g = 0; @@ -331,7 +321,7 @@ H5Pset_fapl_stdio(hid_t fapl_id) *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, +H5FD_stdio_open( const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, haddr_t maxaddr) { FILE *f = NULL; @@ -556,7 +546,7 @@ H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) +H5FD_stdio_query(const H5FD_t *_f, unsigned long /*OUT*/ *flags) { /* Quiet the compiler */ _f=_f; @@ -593,7 +583,7 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, hid_t /*H5_ATTR_UNUSED*/ dxpl_id, hsize_t size) +H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl_id, hsize_t size) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; haddr_t addr; @@ -638,7 +628,7 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, hid_t /*H5_A *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type) +H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) { const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; @@ -669,7 +659,7 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, haddr_t addr) +H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, haddr_t addr) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; @@ -704,10 +694,13 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, haddr_t ad *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type) +H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) { const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; + /* Quiet the compiler */ + type = type; + /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -728,7 +721,7 @@ H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +H5FD_stdio_get_handle(H5FD_t *_file, hid_t /*UNUSED*/ fapl, void **file_handle) { H5FD_stdio_t *file = (H5FD_stdio_t *)_file; static const char *func = "H5FD_stdio_get_handle"; /* Function Name for error reporting */ @@ -766,8 +759,8 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, - void *buf/*out*/) +H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl_id, + haddr_t addr, size_t size, void /*OUT*/ *buf) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_read"; /* Function Name for error reporting */ @@ -871,8 +864,8 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, - size_t size, const void *buf) +H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl_id, + haddr_t addr, size_t size, const void *buf) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_write"; /* Function Name for error reporting */ @@ -961,7 +954,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) +H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, unsigned closing) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */ @@ -1006,7 +999,8 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) +H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, + hbool_t /*UNUSED*/ closing) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_truncate"; /* Function Name for error reporting */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index e83330d..ce3f2ea 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -914,20 +914,20 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) /* Check for driver info to store */ if(driver_size > 0) { - H5O_drvinfo_t drvinfo; /* Driver info */ + H5O_drvinfo_t info; /* Driver info */ uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */ /* Sanity check */ HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); /* Encode driver-specific data */ - if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) + if(H5FD_sb_encode(f->shared->lf, info.name, dbuf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") /* Write driver info information to the superblock extension */ - drvinfo.len = driver_size; - drvinfo.buf = dbuf; - if(H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0) + info.len = driver_size; + info.buf = dbuf; + if(H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &info, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message") } /* end if */ diff --git a/src/H5PL.c b/src/H5PL.c index f4cd3e7..bfe79aa 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -329,6 +329,8 @@ H5PL_load(H5PL_type_t type, int id) if((H5PL_plugin_g & H5PL_FILTER_PLUGIN) == 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) break; + case H5PL_TYPE_ERROR: + case H5PL_TYPE_NONE: default: HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id) } diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c index b2401d4..daa7886 100644 --- a/src/H5Tfixed.c +++ b/src/H5Tfixed.c @@ -79,8 +79,8 @@ H5Tget_sign(hid_t type_id) H5TRACE1("Ts", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer datatype") ret_value = H5T_get_sign(dt); @@ -158,18 +158,18 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign) H5TRACE2("e", "iTs", type_id, sign); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") if (sign < H5T_SGN_NONE || sign >= H5T_NSGN) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_INTEGER!=dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") /* Commit */ dt->shared->u.atomic.u.i.sign = sign; diff --git a/src/H5Topaque.c b/src/H5Topaque.c index e93bf65..f37d14b 100644 --- a/src/H5Topaque.c +++ b/src/H5Topaque.c @@ -77,18 +77,18 @@ H5Tset_tag(hid_t type_id, const char *tag) H5TRACE2("e", "i*s", type_id, tag); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_OPAQUE!=dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type") if (!tag) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag") if (HDstrlen(tag) >= H5T_OPAQUE_TAG_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tag too long") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tag too long") /* Commit */ H5MM_xfree(dt->shared->u.opaque.tag); @@ -124,16 +124,16 @@ H5Tget_tag(hid_t type_id) H5TRACE1("*s", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_OPAQUE != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "operation not defined for data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "operation not defined for data type class") /* result */ if (NULL==(ret_value=H5MM_strdup(dt->shared->u.opaque.tag))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tpad.c b/src/H5Tpad.c index 88a5e13..38de494 100644 --- a/src/H5Tpad.c +++ b/src/H5Tpad.c @@ -80,12 +80,12 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb/*out*/, H5T_pad_t *msb/*out*/) H5TRACE3("e", "ixx", type_id, lsb, msb); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") /* Get values */ if (lsb) @@ -124,18 +124,18 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb) H5TRACE3("e", "iTpTp", type_id, lsb, msb); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") if (lsb < H5T_PAD_ZERO || lsb >= H5T_NPAD || msb < H5T_PAD_ZERO || msb >= H5T_NPAD) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") /* Commit */ dt->shared->u.atomic.lsb_pad = lsb; diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index b3975af..73a4e32 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -87,12 +87,12 @@ H5Tget_precision(hid_t type_id) H5TRACE1("z", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") /* Get precision */ if((ret_value = H5T_get_precision(dt)) == 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, 0, "cant't get precision for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, 0, "cant't get precision for specified datatype") done: FUNC_LEAVE_API(ret_value) @@ -176,22 +176,22 @@ H5Tset_precision(hid_t type_id, size_t prec) H5TRACE2("e", "iz", type_id, prec); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") if (prec == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after members are defined") if (H5T_STRING==dt->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "precision for this type is read-only") if (H5T_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype") /* Do the work */ if (H5T_set_precision(dt, prec)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision") done: FUNC_LEAVE_API(ret_value) @@ -283,9 +283,19 @@ H5T_set_precision(const H5T_t *dt, size_t prec) dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first") break; + + case H5T_NO_CLASS: + case H5T_STRING: + case H5T_OPAQUE: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + case H5T_NCLASSES: default: HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") - } /* end switch */ /*lint !e788 All appropriate cases are covered */ + } /* end switch */ /* Commit */ dt->shared->size = size; diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c index e8ac4f5..c71827b 100644 --- a/src/H5Tstrpad.c +++ b/src/H5Tstrpad.c @@ -83,12 +83,12 @@ H5Tget_strpad(hid_t type_id) H5TRACE1("Tz", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a datatype") while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_STR_ERROR, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_STR_ERROR, "operation not defined for datatype class") /* result */ if(H5T_IS_FIXED_STRING(dt->shared)) @@ -140,16 +140,16 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad) H5TRACE2("e", "iTz", type_id, strpad); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") if (strpad < H5T_STR_NULLTERM || strpad >= H5T_NSTR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type") while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") /* Commit */ if(H5T_IS_FIXED_STRING(dt->shared)) diff --git a/src/H5Tvisit.c b/src/H5Tvisit.c index 68cabda..4ede3f3 100644 --- a/src/H5Tvisit.c +++ b/src/H5Tvisit.c @@ -136,6 +136,19 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value) HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "can't visit parent datatype") break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + /* Not real values */ + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") + break; + + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: default: /* Visit "simple" datatypes here */ if(visit_flags & H5T_VISIT_SIMPLE) diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 4ee3d0d..64337b8 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -113,7 +113,7 @@ H5Tvlen_create(hid_t base_id) H5TRACE1("i", "i", base_id); /* Check args */ - if(NULL == (base = H5I_object_verify(base_id, H5I_DATATYPE))) + if(NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") /* Create up VL datatype */ @@ -288,6 +288,8 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) */ break; + case H5T_LOC_MAXLOC: + /* MAXLOC is invalid */ default: HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location") } /* end switch */ /*lint !e788 All appropriate cases are covered */ @@ -716,11 +718,11 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co /* Use the user's memory allocation routine if one is defined */ if(vl_alloc_info->alloc_func!=NULL) { - if(NULL==(t=(vl_alloc_info->alloc_func)((seq_len+1)*base_size,vl_alloc_info->alloc_info))) + if(NULL==(t = (char *)(vl_alloc_info->alloc_func)((seq_len+1)*base_size,vl_alloc_info->alloc_info))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end if */ else { /* Default to system malloc */ - if(NULL==(t=H5MM_malloc((seq_len+1)*base_size))) + if(NULL==(t = (char *)H5MM_malloc((seq_len+1)*base_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end else */ @@ -1119,8 +1121,24 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi } /* end else */ break; + /* Don't do anything for simple types */ + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + break; + + /* Should never have these values */ + case H5T_NO_CLASS: + case H5T_NCLASSES: default: + HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype class") break; + } /* end switch */ /*lint !e788 All appropriate cases are covered */ done: @@ -1167,7 +1185,7 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const HDassert(H5I_DATATYPE == H5I_get_type(type_id)); /* Check args */ - if(NULL == (dt = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Pull the free function and free info pointer out of the op_data and call the recurse datatype free function */ diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 38610b6..479cd6c 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -266,9 +266,23 @@ H5Z_calc_parms_array(const H5T_t *type) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; - default: /* Other datatype class: nbit does no compression */ + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + /* Other datatype classes: nbit does no compression */ H5Z_calc_parms_nooptype(); break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ done: @@ -351,9 +365,23 @@ H5Z_calc_parms_compound(const H5T_t *type) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; - default: /* Other datatype class: nbit does no compression */ + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + /* Other datatype classes: nbit does no compression */ H5Z_calc_parms_nooptype(); break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ /* Close member datatype */ @@ -444,7 +472,7 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]) /* Get datatype's size */ if((dtype_size = H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for datatype size */ cd_values[cd_values_index++] = dtype_size; @@ -463,6 +491,10 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]) cd_values[cd_values_index++] = H5Z_NBIT_ORDER_BE; break; + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_ERROR: + case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") } /* end switch */ @@ -561,7 +593,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; - default: /* other datatype that nbit does no compression */ + case H5T_VLEN: /* Check if base datatype is a variable-length string */ if((is_vlstring = H5T_is_variable_str(dtype_base)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot determine if datatype is a variable-length string") @@ -573,6 +605,23 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) if(H5Z_set_parms_nooptype(dtype_base, cd_values) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; + + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + if(H5Z_set_parms_nooptype(dtype_base, cd_values) == FAIL) + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ done: @@ -666,16 +715,16 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; - default: /* other datatype that nbit does no compression */ + case H5T_VLEN: /* Check if datatype is a variable-length string */ if((is_vlstring = H5T_is_variable_str(dtype_member)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot determine if datatype is a variable-length string") /* Because for some no-op datatype (VL datatype and VL string datatype), its - * size can not be retrieved correctly by using function call H5T_get_size, - * special handling is needed for getting the size. Here the difference between + * size can not be retrieved correctly by using function call H5T_get_size, + * special handling is needed for getting the size. Here the difference between * adjacent member offset is used (if alignment is present, the result can be - * larger, but it does not affect the nbit filter's correctness). + * larger, but it does not affect the nbit filter's correctness). */ if(dtype_member_class == H5T_VLEN || is_vlstring) { /* Set datatype class code */ @@ -688,9 +737,25 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) /* Set "local" parameter for datatype size */ cd_values[cd_values_index++] = dtype_next_member_offset - dtype_member_offset; - } else - if(H5Z_set_parms_nooptype(dtype_member, cd_values)==FAIL) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + } + break; + + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + /* other datatype that nbit does no compression */ + if(H5Z_set_parms_nooptype(dtype_member, cd_values) == FAIL) + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit was passed bad datatype") break; } /* end switch */ @@ -770,8 +835,22 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; - default: /* no need to calculate other datatypes at top level */ - break; + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + /* No need to calculate other datatypes at top level */ + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ /* Check if the number of parameters exceed what cd_values[] can store */ @@ -826,8 +905,22 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; - default: /* no need to set parameters for other datatypes at top level */ - break; + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + /* No need to set parameters for other datatypes at top level */ + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ /* Check if calculation of parameters matches with setting of parameters */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 673b9e0..46dd3c1 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -977,6 +977,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_ORDER_ERROR: case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") @@ -1075,6 +1076,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value case H5T_ORDER_ERROR: case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "bad H5T_NATIVE_INT endianness order") diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 7a94487..db61cc5 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -731,11 +731,20 @@ H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) case H5Z_XFORM_END: HGOTO_DONE(term) - default: + case H5Z_XFORM_INTEGER: + case H5Z_XFORM_FLOAT: + case H5Z_XFORM_SYMBOL: + case H5Z_XFORM_PLUS: + case H5Z_XFORM_MINUS: + case H5Z_XFORM_LPAREN: H5Z_unget_token(current); HGOTO_DONE(term) - } - } + + case H5Z_XFORM_ERROR: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "bad transform type passed to data transform expression") + } /* end switch */ + } /* end for */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -773,112 +782,115 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) current = H5Z_get_token(current); switch (current->tok_type) { - case H5Z_XFORM_INTEGER: - factor = H5Z_new_node(H5Z_XFORM_INTEGER); - - if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - sscanf(current->tok_begin, "%ld", &factor->value.int_val); - break; + case H5Z_XFORM_INTEGER: + factor = H5Z_new_node(H5Z_XFORM_INTEGER); - case H5Z_XFORM_FLOAT: - factor = H5Z_new_node(H5Z_XFORM_FLOAT); + if (!factor) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + sscanf(current->tok_begin, "%ld", &factor->value.int_val); + break; - if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - sscanf(current->tok_begin, "%lf", &factor->value.float_val); - break; + case H5Z_XFORM_FLOAT: + factor = H5Z_new_node(H5Z_XFORM_FLOAT); - case H5Z_XFORM_SYMBOL: - factor = H5Z_new_node(H5Z_XFORM_SYMBOL); + if (!factor) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + sscanf(current->tok_begin, "%lf", &factor->value.float_val); + break; - if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + case H5Z_XFORM_SYMBOL: + factor = H5Z_new_node(H5Z_XFORM_SYMBOL); - factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]); - dat_val_pointers->num_ptrs++; - break; + if (!factor) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - case H5Z_XFORM_LPAREN: - factor = H5Z_parse_expression(current, dat_val_pointers); + factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]); + dat_val_pointers->num_ptrs++; + break; - if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + case H5Z_XFORM_LPAREN: + factor = H5Z_parse_expression(current, dat_val_pointers); - current = H5Z_get_token(current); + if (!factor) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - if (current->tok_type != H5Z_XFORM_RPAREN) { - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") - } - break; + current = H5Z_get_token(current); - case H5Z_XFORM_RPAREN: - /* We shouldn't see a ) right now */ - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' ") + if (current->tok_type != H5Z_XFORM_RPAREN) { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") + } + break; - case H5Z_XFORM_PLUS: - /* unary + */ - new_node = H5Z_parse_factor(current, dat_val_pointers); + case H5Z_XFORM_RPAREN: + /* We shouldn't see a ) right now */ + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' ") + + case H5Z_XFORM_PLUS: + /* unary + */ + new_node = H5Z_parse_factor(current, dat_val_pointers); + + if (new_node) { + if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && + new_node->type != H5Z_XFORM_SYMBOL) { + H5Z_xform_destroy_parse_tree(new_node); + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - if (new_node) { - if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && - new_node->type != H5Z_XFORM_SYMBOL) { - H5Z_xform_destroy_parse_tree(new_node); - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + factor = new_node; + new_node = H5Z_new_node(H5Z_XFORM_PLUS); - factor = new_node; - new_node = H5Z_new_node(H5Z_XFORM_PLUS); + if (!new_node) { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - if (!new_node) { + new_node->rchild = factor; + factor = new_node; + } else { H5Z_xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } + break; - new_node->rchild = factor; - factor = new_node; - } else { - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - break; + case H5Z_XFORM_MINUS: + /* unary - */ + new_node = H5Z_parse_factor(current, dat_val_pointers); - case H5Z_XFORM_MINUS: - /* unary - */ - new_node = H5Z_parse_factor(current, dat_val_pointers); + if (new_node) { + if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && + new_node->type != H5Z_XFORM_SYMBOL) { + H5Z_xform_destroy_parse_tree(new_node); + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - if (new_node) { - if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && - new_node->type != H5Z_XFORM_SYMBOL) { - H5Z_xform_destroy_parse_tree(new_node); - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + factor = new_node; + new_node = H5Z_new_node(H5Z_XFORM_MINUS); - factor = new_node; - new_node = H5Z_new_node(H5Z_XFORM_MINUS); + if (!new_node) { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - if (!new_node) { + new_node->rchild = factor; + factor = new_node; + } else { H5Z_xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } + break; - new_node->rchild = factor; - factor = new_node; - } else { - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - break; - - case H5Z_XFORM_END: - break; + case H5Z_XFORM_END: + break; - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Invalid token while parsing data transform expression") + case H5Z_XFORM_MULT: + case H5Z_XFORM_DIVIDE: + case H5Z_XFORM_ERROR: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Invalid token while parsing data transform expression") } @@ -1091,23 +1103,30 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ switch (tree->type) { case H5Z_XFORM_PLUS: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, +, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, +, array_size) + break; case H5Z_XFORM_MINUS: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, -, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, -, array_size) + break; case H5Z_XFORM_MULT: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, *, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, *, array_size) + break; case H5Z_XFORM_DIVIDE: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, /, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, /, array_size) + break; + case H5Z_XFORM_ERROR: + case H5Z_XFORM_INTEGER: + case H5Z_XFORM_FLOAT: + case H5Z_XFORM_SYMBOL: + case H5Z_XFORM_LPAREN: + case H5Z_XFORM_RPAREN: + case H5Z_XFORM_END: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree") } /* end switch */ /* The result stores a pointer to the new data */ diff --git a/test/dsets.c b/test/dsets.c index e6b2ee4..136fec2 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -7567,7 +7567,7 @@ test_chunk_expand(hid_t fapl) if(TRUE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR diff --git a/test/earray.c b/test/earray.c index feaa15e..b510992 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2894,7 +2894,7 @@ main(void) init_cparam(&cparam); /* Iterate over the testing parameters */ - for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) { + for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; H5_INC_ENUM(earray_test_type_t, curr_test)) { /* Initialize the testing parameters */ init_tparam(&tparam, &cparam); @@ -2926,7 +2926,7 @@ main(void) nerrors += test_flush_depend(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ - for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; curr_iter++) { + for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; H5_INC_ENUM(earray_iter_type_t, curr_iter)) { hsize_t sblk; /* Super block index */ hsize_t dblk; /* Data block index */ hsize_t nelmts; /* # of elements to test */ diff --git a/test/farray.c b/test/farray.c index 4c18916..43b63c6 100644 --- a/test/farray.c +++ b/test/farray.c @@ -1554,11 +1554,11 @@ main(void) } /* Iterate over the testing parameters */ - for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; curr_test++) { + for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; H5_INC_ENUM(farray_test_type_t, curr_test)) { /* Initialize the testing parameters */ - HDmemset(&tparam, 0, sizeof(tparam)); - tparam.nelmts = TEST_NELMTS; + HDmemset(&tparam, 0, sizeof(tparam)); + tparam.nelmts = TEST_NELMTS; /* Set appropriate testing parameters for each test */ switch(curr_test) { @@ -1589,7 +1589,7 @@ main(void) nerrors += test_delete_open(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ - for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; curr_iter++) { + for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; H5_INC_ENUM(farray_iter_type_t, curr_iter)) { /* Set appropriate parameters for each type of iteration */ switch(curr_iter) { diff --git a/test/fheap.c b/test/fheap.c index c300028..bb30e05 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16380,7 +16380,7 @@ main(void) /* Iterate over the testing parameters */ #ifndef QAK - for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; curr_test++) { + for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; H5_INC_ENUM(fheap_test_type_t, curr_test)) { #else /* QAK */ HDfprintf(stderr, "Uncomment test loop!\n"); curr_test = FHEAP_TEST_NORMAL; @@ -16430,7 +16430,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); #ifndef QAK2 /* Filling with different sized objects */ - for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; fill++) { + for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; H5_INC_ENUM(fheap_test_fill_t, fill)) { #else /* QAK2 */ HDfprintf(stderr, "Uncomment test loop!\n"); fill = FHEAP_TEST_FILL_LARGE; @@ -16542,9 +16542,9 @@ HDfprintf(stderr, "Uncomment tests!\n"); fheap_test_del_drain_t drain_half; /* Deletion draining */ /* More complex removal patterns */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { tparam.del_dir = del_dir; - for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; drain_half++) { + for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; H5_INC_ENUM(fheap_test_del_drain_t, drain_half)) { tparam.drain_half = drain_half; #else /* QAK2 */ HDfprintf(stderr, "Uncomment test loops!\n"); @@ -16683,7 +16683,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); } /* end switch */ /* Try several different methods of deleting objects */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { tparam.del_dir = del_dir; /* Test 'huge' object insert & delete */ @@ -16726,7 +16726,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); { fheap_test_del_dir_t del_dir; /* Deletion direction */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { tparam.del_dir = del_dir; /* Controlled tests */ diff --git a/test/fillval.c b/test/fillval.c index c791504..b7b2ff5 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -845,7 +845,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, if(datatype==H5T_INTEGER) { /*check for overflow*/ HDassert((nelmts * sizeof(int)) == (hsize_t)((size_t)(nelmts * sizeof(int)))); - buf = HDmalloc((size_t)(nelmts * sizeof(int))); + buf = (int *)HDmalloc((size_t)(nelmts * sizeof(int))); if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0) goto error; diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c index a1312d2..fc044da 100644 --- a/test/gen_udlinks.c +++ b/test/gen_udlinks.c @@ -57,6 +57,10 @@ main (void) strcpy(filename1, NAME_BE_1); strcpy(filename2, NAME_BE_2); break; + case H5T_ORDER_ERROR: + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: default: goto error; } diff --git a/test/tattr.c b/test/tattr.c index 137c7c9..6642cf1 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -5919,9 +5919,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -6868,9 +6868,9 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) iter_info.visited = visited; /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -7223,9 +7223,9 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ diff --git a/test/tfile.c b/test/tfile.c index 4913a15..33c947f 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -827,7 +827,9 @@ test_file_close(void) ret = H5Gclose(group_id3); CHECK(ret, FAIL, "H5Gclose"); break; - default: + + case H5F_CLOSE_DEFAULT: + default: CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree"); break; } @@ -1314,6 +1316,19 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, VERIFY(oid_list[i], did, "H5Fget_obj_ids"); break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATATYPE: + 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: ERROR("H5Fget_obj_ids"); } /* end switch */ @@ -3079,67 +3094,68 @@ test_filespace_info(void) my_fapl = fapl; } /* end else */ - /* Test with different sized free space section threshold */ - for(fs_size = 0; fs_size <= TEST_THRESHOLD10; fs_size++) { + /* Test with different sized free space section threshold */ + for(fs_size = 0; fs_size <= TEST_THRESHOLD10; fs_size++) { - /* Test with different file space handling strategies */ - for(fs_type = 0; fs_type < H5F_FILE_SPACE_NTYPES; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) { + /* Test with different file space handling strategies */ + for(fs_type = H5F_FILE_SPACE_DEFAULT; fs_type < H5F_FILE_SPACE_NTYPES; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) { - /* Get a copy of the default file creation property */ - fcpl1 = H5Pcopy(fcpl); - CHECK(fcpl1, FAIL, "H5Pcopy"); + /* Get a copy of the default file creation property */ + fcpl1 = H5Pcopy(fcpl); + CHECK(fcpl1, FAIL, "H5Pcopy"); - /* Set file space strategy and free space section threshold */ - ret = H5Pset_file_space(fcpl1, fs_type, fs_size); - CHECK(ret, FAIL, "H5Pget_file_space"); + /* Set file space strategy and free space section threshold */ + ret = H5Pset_file_space(fcpl1, fs_type, fs_size); + CHECK(ret, FAIL, "H5Pget_file_space"); - /* Get the file space info from the creation property */ - ret = H5Pget_file_space(fcpl1, &strategy, &threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); + /* Get the file space info from the creation property */ + ret = H5Pget_file_space(fcpl1, &strategy, &threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); - /* A 0 value for strategy retains existing strategy in use */ - VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space"); - /* A 0 value for threshold retains existing threshold in use */ - VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space"); + /* A 0 value for strategy retains existing strategy in use */ + VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space"); + /* A 0 value for threshold retains existing threshold in use */ + VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space"); - /* Create the file with the specified file space info */ - fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl1, my_fapl); - CHECK(ret, FAIL, "H5Fcreate"); + /* Create the file with the specified file space info */ + fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl1, my_fapl); + CHECK(ret, FAIL, "H5Fcreate"); - /* Close the file */ - ret = H5Fclose(fid1); - CHECK(ret, FAIL, "H5Fclose"); + /* Close the file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); - /* Re-open the file */ - fid2 = H5Fopen(filename, H5F_ACC_RDWR, my_fapl); - CHECK(ret, FAIL, "H5Fopen"); + /* Re-open the file */ + fid2 = H5Fopen(filename, H5F_ACC_RDWR, my_fapl); + CHECK(ret, FAIL, "H5Fopen"); - /* Get the file's creation property */ - fcpl2 = H5Fget_create_plist(fid2); - CHECK(fcpl2, FAIL, "H5Fget_create_plist"); + /* Get the file's creation property */ + fcpl2 = H5Fget_create_plist(fid2); + CHECK(fcpl2, FAIL, "H5Fget_create_plist"); - strategy = threshold = 0; + strategy = H5F_FILE_SPACE_DEFAULT; + threshold = 0; - /* Get the file space info from the creation property list */ - ret = H5Pget_file_space(fcpl2, &strategy, &threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); + /* Get the file space info from the creation property list */ + ret = H5Pget_file_space(fcpl2, &strategy, &threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space"); - VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space"); + VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space"); + VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space"); - /* Close the file */ - ret = H5Fclose(fid2); - CHECK(ret, FAIL, "H5Fclose"); + /* Close the file */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); - /* Release file-creation template */ - ret = H5Pclose(fcpl1); - CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pclose(fcpl2); - CHECK(ret, FAIL, "H5Pclose"); - } /* end for file space strategy type */ - } /* end for free space threshold */ + /* Release file-creation template */ + ret = H5Pclose(fcpl1); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(fcpl2); + CHECK(ret, FAIL, "H5Pclose"); + } /* end for file space strategy type */ + } /* end for free space threshold */ - h5_cleanup(FILESPACE_NAME, my_fapl); + h5_cleanup(FILESPACE_NAME, my_fapl); } /* end for new/old format */ diff --git a/test/tgenprop.c b/test/tgenprop.c index 10cae6d..fda4161 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -61,6 +61,18 @@ double prop4_def=1.41F; /* Property 4 default value */ #define PROP4_SIZE sizeof(prop4_def) #define PROP4_DEF_VALUE (&prop4_def) +/* Structs used during iteration */ +typedef struct iter_data_t { + int iter_count; + char **names; +} iter_data_t; + +typedef struct count_data_t { + int count; + hid_t id; +} count_data_t; + + /**************************************************************** ** ** test_genprop_basic_class(): Test basic generic property list code. @@ -284,17 +296,12 @@ test_genprop_basic_class_prop(void) ** ****************************************************************/ static int -test_genprop_iter1(hid_t id, const char *name, void *iter_data) +test_genprop_iter1(hid_t H5_ATTR_UNUSED id, const char *name, + void *iter_data) { - struct { /* Struct for iterations */ - int iter_count; - const char **names; - } *iter_struct = iter_data; - - /* Shut compiler up */ - id = id; + iter_data_t *idata = (iter_data_t *)iter_data; - return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++])); + return HDstrcmp(name,idata->names[idata->iter_count++]); } /**************************************************************** @@ -373,43 +380,34 @@ test_genprop_class_iter(void) static herr_t test_genprop_cls_crt_cb1(hid_t list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=list_id; + cdata->count++; + cdata->id = list_id; - return(SUCCEED); + return SUCCEED; } static herr_t test_genprop_cls_cpy_cb1(hid_t new_list_id, hid_t H5_ATTR_UNUSED old_list_id, void *copy_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=copy_data; + count_data_t *cdata = (count_data_t *)copy_data; - count_struct->count++; - count_struct->id=new_list_id; + cdata->count++; + cdata->id = new_list_id; - return(SUCCEED); + return SUCCEED; } static herr_t test_genprop_cls_cls_cb1(hid_t list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=list_id; + cdata->count++; + cdata->id = list_id; - return(SUCCEED); + return SUCCEED; } /**************************************************************** @@ -843,17 +841,12 @@ test_genprop_basic_list_prop(void) ** ****************************************************************/ static int -test_genprop_iter2(hid_t id, const char *name, void *iter_data) +test_genprop_iter2(hid_t H5_ATTR_UNUSED id, const char *name, + void *iter_data) { - struct { /* Struct for iterations */ - int iter_count; - const char **names; - } *iter_struct=iter_data; - - /* Shut compiler up */ - id=id; + iter_data_t *idata = (iter_data_t *)iter_data; - return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++])); + return HDstrcmp(name,idata->names[idata->iter_count++]); } /**************************************************************** @@ -995,15 +988,12 @@ prop_cb_info prop3_cb_info; /* Callback statistics for property #3 */ static herr_t test_genprop_cls_cpy_cb2(hid_t new_list_id, hid_t H5_ATTR_UNUSED old_list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=new_list_id; + cdata->count++; + cdata->id = new_list_id; - return(SUCCEED); + return SUCCEED; } /**************************************************************** diff --git a/test/th5s.c b/test/th5s.c index 9d08abe..a478803 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -565,7 +565,7 @@ test_h5s_zero_dim(void) wdata_real[i][j][k] = i + j + k; /* Test with different space allocation times */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { /* Make sure we can create the space with the dimension size 0 (starting from v1.8.7). * The dimension doesn't need to be unlimited. */ diff --git a/test/tmisc.c b/test/tmisc.c index 11c6de7..6a68857 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -713,7 +713,7 @@ create_struct3(void) misc5_struct3_hndl *str3hndl; /* New 'struct3' created */ herr_t ret; /* For error checking */ - str3hndl = HDmalloc(sizeof(misc5_struct3_hndl)); + str3hndl = (misc5_struct3_hndl *)HDmalloc(sizeof(misc5_struct3_hndl)); CHECK(str3hndl,NULL,"malloc"); str3hndl->st3h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct3)); @@ -722,10 +722,10 @@ create_struct3(void) ret = H5Tinsert(str3hndl->st3h_base, "st3_el1", HOFFSET( misc5_struct3, st3_el1), H5T_NATIVE_INT); CHECK(ret,FAIL,"H5Tinsert"); - str3hndl->st3h_id=H5Tvlen_create(str3hndl->st3h_base); + str3hndl->st3h_id = H5Tvlen_create(str3hndl->st3h_base); CHECK(str3hndl->st3h_id,FAIL,"H5Tvlen_create"); - return(str3hndl); + return str3hndl; } static void @@ -733,10 +733,10 @@ delete_struct3(misc5_struct3_hndl *str3hndl) { herr_t ret; /* For error checking */ - ret=H5Tclose(str3hndl->st3h_id); + ret = H5Tclose(str3hndl->st3h_id); CHECK(ret,FAIL,"H5Tclose"); - ret=H5Tclose(str3hndl->st3h_base); + ret = H5Tclose(str3hndl->st3h_base); CHECK(ret,FAIL,"H5Tclose"); HDfree(str3hndl); @@ -756,7 +756,7 @@ create_struct2(void) misc5_struct2_hndl *str2hndl; /* New 'struct2' created */ herr_t ret; /* For error checking */ - str2hndl = HDmalloc(sizeof(misc5_struct2_hndl)); + str2hndl = (misc5_struct2_hndl *)HDmalloc(sizeof(misc5_struct2_hndl)); CHECK(str2hndl, NULL, "malloc"); str2hndl->st2h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct2)); @@ -765,16 +765,16 @@ create_struct2(void) ret = H5Tinsert(str2hndl->st2h_base, "st2_el1", HOFFSET(misc5_struct2, st2_el1), H5T_NATIVE_INT); CHECK(ret, FAIL, "H5Tinsert"); - str2hndl->st2h_st3hndl=create_struct3(); + str2hndl->st2h_st3hndl = create_struct3(); CHECK(str2hndl->st2h_st3hndl,NULL,"create_struct3"); - ret=H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id); + ret = H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id); CHECK(ret,FAIL,"H5Tinsert"); - str2hndl->st2h_id= H5Tvlen_create(str2hndl->st2h_base); + str2hndl->st2h_id = H5Tvlen_create(str2hndl->st2h_base); CHECK(str2hndl->st2h_id,FAIL,"H5Tvlen_create"); - return(str2hndl); + return str2hndl; } static void @@ -798,10 +798,10 @@ set_struct2(misc5_struct2 *buf) { unsigned i; /* Local index variable */ - buf->st2_el1=MISC5_DBGELVAL2; - buf->st2_el2.len=MISC5_DBGNELM3; + buf->st2_el1 = MISC5_DBGELVAL2; + buf->st2_el2.len = MISC5_DBGNELM3; - buf->st2_el2.p=HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); + buf->st2_el2.p = HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); CHECK(buf->st2_el2.p,NULL,"malloc"); for(i=0; i<(buf->st2_el2.len); i++) @@ -822,7 +822,7 @@ create_struct1(void) misc5_struct1_hndl *str1hndl; /* New 'struct1' created */ herr_t ret; /* For error checking */ - str1hndl = HDmalloc(sizeof(misc5_struct1_hndl)); + str1hndl = (misc5_struct1_hndl *)HDmalloc(sizeof(misc5_struct1_hndl)); CHECK(str1hndl, NULL, "malloc"); str1hndl->st1h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct1)); @@ -834,13 +834,13 @@ create_struct1(void) str1hndl->st1h_st2hndl=create_struct2(); CHECK(str1hndl->st1h_st2hndl,NULL,"create_struct2"); - ret=H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id); + ret = H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id); CHECK(ret,FAIL,"H5Tinsert"); - str1hndl->st1h_id=H5Tvlen_create(str1hndl->st1h_base); + str1hndl->st1h_id = H5Tvlen_create(str1hndl->st1h_base); CHECK(str1hndl->st1h_id,FAIL,"H5Tvlen_create"); - return(str1hndl); + return str1hndl; } static void @@ -848,12 +848,12 @@ delete_struct1(misc5_struct1_hndl *str1hndl) { herr_t ret; /* For error checking */ - ret=H5Tclose(str1hndl->st1h_id); + ret = H5Tclose(str1hndl->st1h_id); CHECK(ret,FAIL,"H5Tclose"); delete_struct2(str1hndl->st1h_st2hndl); - ret=H5Tclose(str1hndl->st1h_base); + ret = H5Tclose(str1hndl->st1h_base); CHECK(ret,FAIL,"H5Tclose"); HDfree(str1hndl); @@ -1243,10 +1243,10 @@ test_misc8(void) MESSAGE(5, ("Testing dataset storage sizes\n")); /* Allocate space for the data to write & read */ - wdata=HDmalloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); + wdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); CHECK(wdata,NULL,"malloc"); #ifdef VERIFY_DATA - rdata=HDmalloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); + rdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); CHECK(rdata,NULL,"malloc"); #endif /* VERIFY_DATA */ diff --git a/test/ttst.c b/test/ttst.c index 4ffe4cd..b869b63 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -95,13 +95,13 @@ test_tst_init(void) } /* end for */ /* Allocate space for the array of unique words */ - uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Allocate space for the array of randomized order unique words also */ - rand_uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + rand_uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Allocate space for the array of sorted order unique words also */ - sort_uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + sort_uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Insert unique words from test set into unique word set */ w=0; diff --git a/test/tvltypes.c b/test/tvltypes.c index d1a4235..b7bbaee 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -1021,7 +1021,7 @@ test_vltypes_compound_vlen_vlen(void) wdata[i].f=(float)((i*20)/3.0F); wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t)); wdata[i].v.len=i+L1_INCM; - for(t1=(wdata[i].v).p,j=0; j<(i+L1_INCM); j++, t1++) { + for(t1=(hvl_t *)((wdata[i].v).p),j=0; j<(i+L1_INCM); j++, t1++) { t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int)); t1->len=j+L2_INCM; for(k=0; klen != t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -1161,13 +1161,13 @@ static void test_vltypes_compound_vlstr(void) { typedef enum { - red, - blue, - green + red, + blue, + green } e1; typedef struct { char *string; - e1 color; + e1 color; } s2; typedef struct { /* Struct that the compound type are composed of */ hvl_t v; @@ -1199,12 +1199,12 @@ test_vltypes_compound_vlstr(void) for(i=0; istring = (char*)HDmalloc(strlen(str)*sizeof(char)+1); + for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) { + strcat(str, "m"); + t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); strcpy(t1->string, str); - /*t1->color = red;*/ - t1->color = blue; + /*t1->color = red;*/ + t1->color = blue; } } /* end for */ @@ -1342,7 +1342,7 @@ test_vltypes_compound_vlstr(void) continue; } /* end if */ - for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; jstring, t2->string) ) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; @@ -1400,7 +1400,7 @@ test_vltypes_compound_vlstr(void) continue; } /* end if */ - for(t1=wdata2[i].v.p, t2=rdata2[i].v.p, j=0; jstring, t2->string) ) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; @@ -1871,7 +1871,7 @@ test_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len=i+1; - for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) { + for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+1); j++, t1++) { t1->p=HDmalloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -1977,7 +1977,7 @@ test_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; jlen!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2062,7 +2062,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len = i + increment; - for(t1 = wdata[i].p, j = 0; j < (i + increment); j++, t1++) { + for(t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) { t1->p = HDmalloc((j + 1) * sizeof(unsigned int)); if(t1->p == NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); @@ -2157,7 +2157,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; jlen!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2238,7 +2238,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len=i+increment; - for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) { + for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+increment); j++, t1++) { t1->p=HDmalloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -2333,7 +2333,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; jlen!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2496,7 +2496,7 @@ test_vltypes_fill_value(void) /* Allocate space for the buffer to read data */ - rbuf = HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct)); + rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct)); CHECK(rbuf, NULL, "HDmalloc"); @@ -2538,7 +2538,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fcreate"); /* Create datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2597,6 +2597,8 @@ test_vltypes_fill_value(void) } break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: assert(0 && "Unknown layout type!"); break; @@ -2648,7 +2650,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Read empty datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2698,6 +2700,8 @@ test_vltypes_fill_value(void) dset_elmts = SPACE4_DIM_LARGE; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: assert(0 && "Unknown layout type!"); break; @@ -2843,7 +2847,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Write one element & fill values to datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2893,6 +2897,8 @@ test_vltypes_fill_value(void) dset_elmts = SPACE4_DIM_LARGE; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: assert(0 && "Unknown layout type!"); break; diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index cfaffe6..a871709 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -5023,10 +5023,10 @@ static void test_data_nocomparables (const char * fname, int make_diffs) /* attr2 - non-compatible : same rank, different dimention */ - write_attr(did2,1, attr2_dim_ptr,"attr2", H5T_NATIVE_INT, data3); + write_attr(did2,1,(hsize_t *)attr2_dim_ptr,"attr2", H5T_NATIVE_INT, data3); /* attr3 - non-compatible : different rank */ - write_attr(did2, rank_attr,attr3_dim_ptr,"attr3", H5T_NATIVE_INT, attr_data_ptr3); + write_attr(did2, rank_attr,(hsize_t *)attr3_dim_ptr,"attr3", H5T_NATIVE_INT, attr_data_ptr3); /* attr4 - compatible : different data values */ write_attr(did2,1,dims1_1,"attr4", H5T_NATIVE_INT, attr_data_ptr4); @@ -6551,7 +6551,7 @@ void write_dset_in(hid_t loc_id, /* allocate and initialize array data to write */ size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double); - dbuf = HDmalloc( size ); + dbuf = (double *)HDmalloc( size ); for( j = 0; j < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; j++) dbuf[j] = j; @@ -7018,10 +7018,10 @@ void gen_datareg(hid_t fid, int i; /* allocate the buffer for write the references */ - rbuf = HDcalloc((size_t)2, sizeof(hdset_reg_ref_t)); + rbuf = (hdset_reg_ref_t *)HDcalloc((size_t)2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ - buf = HDmalloc(10 * 10 * sizeof(int)); + buf = (int *)HDmalloc(10 * 10 * sizeof(int)); for(i = 0; i < 10 * 10; i++) buf[i] = i; diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 3c60bb0..68889c9 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -389,10 +389,10 @@ table_list_add(hid_t oid, unsigned long file_no) /* Allocate space if necessary */ if(table_list.nused == table_list.nalloc) { - void *tmp_ptr; + h5dump_table_items_t *tmp_ptr; table_list.nalloc = MAX(1, table_list.nalloc * 2); - if(NULL == (tmp_ptr = HDrealloc(table_list.tables, table_list.nalloc * sizeof(table_list.tables[0])))) + if(NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc(table_list.tables, table_list.nalloc * sizeof(table_list.tables[0])))) return -1; table_list.tables = tmp_ptr; } /* end if */ diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index 7bfead7..2b1fb04 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -38,16 +38,17 @@ typedef struct dump_functions_t { } dump_functions; /* List of table structures. There is one table structure for each file */ +typedef struct h5dump_table_items_t { + unsigned long fileno; /* File number that these tables refer to */ + hid_t oid; /* ID of an object in this file, held open so fileno is consistent */ + table_t *group_table; /* Table of groups */ + table_t *dset_table; /* Table of datasets */ + table_t *type_table; /* Table of datatypes */ +} h5dump_table_items_t; typedef struct h5dump_table_list_t { - size_t nalloc; - size_t nused; - struct { - unsigned long fileno; /* File number that these tables refer to */ - hid_t oid; /* ID of an object in this file, held open so fileno is consistent */ - table_t *group_table; /* Table of groups */ - table_t *dset_table; /* Table of datasets */ - table_t *type_table; /* Table of datatypes */ - } *tables; + size_t nalloc; + size_t nused; + h5dump_table_items_t *tables; } h5dump_table_list_t; h5dump_table_list_t table_list = {0, 0, NULL}; diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 3822251..0cd0847 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -377,6 +377,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR } break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: error_msg("unknown object \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); @@ -509,6 +511,11 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR HDfree(targbuf); break; + case H5L_TYPE_ERROR: + case H5L_TYPE_MAX: + HDassert(0); + /* fall through */ + case H5L_TYPE_HARD: default: ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -1054,7 +1061,10 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) } break; + case H5T_NO_CLASS: + case H5T_NCLASSES: default: + HDassert(0); break; } /* end switch */ } /* for(i=0;iextlinkend, h5tools_dump_header_format->extlinkblockend); break; + case H5L_TYPE_ERROR: + case H5L_TYPE_MAX: + HDassert(0); + /* fall through */ + H5L_TYPE_HARD: default: begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); PRINTVALSTREAM(rawoutstream, "\n"); @@ -2094,6 +2109,8 @@ dump_extlink(hid_t group, const char *linkname, const char *objname) case H5O_TYPE_NAMED_DATATYPE: handle_datatypes(group, linkname, NULL, 0, objname); break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: h5tools_setstatus(EXIT_FAILURE); } diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index 4f8d250..e872114 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -359,6 +359,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ } break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: error_msg("unknown object \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); @@ -521,42 +523,48 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ HDfree(targbuf); break; + case H5L_TYPE_ERROR: + case H5L_TYPE_MAX: + HDassert(0); + /* fall through */ + case H5L_TYPE_HARD: default: - { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); + { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); - ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "LinkClass=\"%d\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - linfo->type, /* LinkClass */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_obj_path); - } + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "LinkClass=\"%d\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + linfo->type, /* LinkClass */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_obj_path); + } break; + } /* end switch */ } /* end else */ @@ -969,29 +977,36 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix); switch (ord) { - case H5T_ORDER_LE: - h5tools_str_append(&buffer, "LE"); - break; - case H5T_ORDER_BE: - h5tools_str_append(&buffer, "BE"); - break; - case H5T_ORDER_VAX: - default: - h5tools_str_append(&buffer, "ERROR_UNKNOWN"); - } + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: + case H5T_ORDER_ERROR: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + break; + } /* end switch */ h5tools_str_append(&buffer, "\" Sign=\""); switch (sgn) { - case H5T_SGN_NONE: - h5tools_str_append(&buffer, "false"); - break; - case H5T_SGN_2: - h5tools_str_append(&buffer, "true"); - break; - default: - h5tools_str_append(&buffer, "ERROR_UNKNOWN"); - } + case H5T_SGN_NONE: + h5tools_str_append(&buffer, "false"); + break; + case H5T_SGN_2: + h5tools_str_append(&buffer, "true"); + break; + case H5T_SGN_ERROR: + case H5T_NSGN: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + break; + } /* end switch */ h5tools_str_append(&buffer, "\" Size=\""); sz = H5Tget_size(type); @@ -1033,18 +1048,21 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix); switch (ord) { - case H5T_ORDER_LE: - h5tools_str_append(&buffer, "LE"); - break; - case H5T_ORDER_BE: - h5tools_str_append(&buffer, "BE"); - break; - case H5T_ORDER_VAX: - h5tools_str_append(&buffer, "VAX"); - break; - default: - h5tools_str_append(&buffer, "ERROR_UNKNOWN"); - } + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + h5tools_str_append(&buffer, "VAX"); + break; + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: + case H5T_ORDER_ERROR: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } /* end switch */ h5tools_str_append(&buffer, "\" Size=\""); sz = H5Tget_size(type); @@ -1172,16 +1190,19 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix); switch (ord) { - case H5T_ORDER_LE: - h5tools_str_append(&buffer, "LE"); - break; - case H5T_ORDER_BE: - h5tools_str_append(&buffer, "BE"); - break; - case H5T_ORDER_VAX: - default: - h5tools_str_append(&buffer, "ERROR_UNKNOWN"); - } + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: + case H5T_ORDER_ERROR: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } /* end switch */ size = H5Tget_size(type); h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); @@ -1516,6 +1537,10 @@ xml_print_datatype(hid_t type, unsigned in_group) H5Tclose(super); break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + HDassert(0); + /* fall through */ default: ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -1813,6 +1838,7 @@ xml_dump_dataspace(hid_t space) break; #endif /* TMP */ + case H5S_NULL: case H5S_NO_CLASS: default: ctx.need_prefix = TRUE; @@ -2246,6 +2272,10 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + HDassert(0); + /* fall through */ default: ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -3701,6 +3731,12 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + HDassert(0); + /* fall through */ + case H5T_STRING: + case H5T_REFERENCE: default: ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -4004,37 +4040,43 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s H5Pget_fill_time(dcpl, &ft); h5tools_str_append(&buffer, "FillTime=\""); switch (ft) { - case H5D_FILL_TIME_ALLOC: - h5tools_str_append(&buffer, "FillOnAlloc"); - break; - case H5D_FILL_TIME_NEVER: - h5tools_str_append(&buffer, "FillNever"); - break; - case H5D_FILL_TIME_IFSET: - h5tools_str_append(&buffer, "FillIfSet"); - break; - default: - h5tools_str_append(&buffer, "?"); - break; - } + case H5D_FILL_TIME_ALLOC: + h5tools_str_append(&buffer, "FillOnAlloc"); + break; + case H5D_FILL_TIME_NEVER: + h5tools_str_append(&buffer, "FillNever"); + break; + case H5D_FILL_TIME_IFSET: + h5tools_str_append(&buffer, "FillIfSet"); + break; + case H5D_FILL_TIME_ERROR: + HDassert(0); + /* fall through */ + default: + h5tools_str_append(&buffer, "?"); + break; + } /* end switch */ h5tools_str_append(&buffer, "\" "); H5Pget_alloc_time(dcpl, &at); h5tools_str_append(&buffer, "AllocationTime=\""); switch (at) { - case H5D_ALLOC_TIME_EARLY: - h5tools_str_append(&buffer, "Early"); - break; - case H5D_ALLOC_TIME_INCR: - h5tools_str_append(&buffer, "Incremental"); - break; - case H5D_ALLOC_TIME_LATE: - h5tools_str_append(&buffer, "Late"); - break; - case H5D_ALLOC_TIME_DEFAULT: - default: - h5tools_str_append(&buffer, "?"); - break; - } + case H5D_ALLOC_TIME_EARLY: + h5tools_str_append(&buffer, "Early"); + break; + case H5D_ALLOC_TIME_INCR: + h5tools_str_append(&buffer, "Incremental"); + break; + case H5D_ALLOC_TIME_LATE: + h5tools_str_append(&buffer, "Late"); + break; + case H5D_ALLOC_TIME_DEFAULT: + case H5D_ALLOC_TIME_ERROR: + HDassert(0); + /* fall through */ + default: + h5tools_str_append(&buffer, "?"); + break; + } /* end switch */ h5tools_str_append(&buffer, "\""); h5tools_str_append(&buffer, ">"); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); @@ -4255,6 +4297,11 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s ctx.indent_level--; dump_indent -= COL; break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + HDassert(0); + /* fall through */ + default: ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index 5f24566..ef45372 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -308,7 +308,7 @@ create_textfile(const char *name, size_t size) fd = HDcreat(name,0777); HDassert(fd >= 0); - buf = HDcalloc(size, (size_t)1); + buf = (char *)HDcalloc(size, (size_t)1); HDassert(buf); /* fill buf with pattern */ diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index fe128fa..fe146c1 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1759,7 +1759,6 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) size_t cd_nelmts; /* filter client number of values */ size_t cd_num; /* filter client data counter */ char f_name[256]; /* filter/file name */ - char dset_name[256]; /* filter/file name */ char s[64]; /* temporary string buffer */ off_t f_offset; /* offset in external file */ hsize_t f_size; /* bytes used in external file */ @@ -1847,7 +1846,11 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) h5tools_str_append(&buffer, "\n"); } /* end if */ break; + + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: + HDassert(0); break; } /* Print total raw storage size */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 71ada53..d592528 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -102,29 +102,29 @@ static hbool_t not_comparable; -#define PER(A,B) { \ - per = -1; \ - not_comparable = FALSE; \ - both_zero = FALSE; \ - if(0 == (A) && 0 == (B)) \ - both_zero = TRUE; \ - if(0 != (A)) \ - per = (double)ABS((double)((B) - (A)) / (double)(A)); \ - else \ - not_comparable = TRUE; \ +#define PER(A,B) { \ + per = -1; \ + not_comparable = FALSE; \ + both_zero = FALSE; \ + if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \ + both_zero = TRUE; \ + if(!H5_DBL_ABS_EQUAL(0,A)) \ + per = (double)ABS((double)((B) - (A)) / (double)(A)); \ + else \ + not_comparable = TRUE; \ } -#define PER_UNSIGN(TYPE,A,B) { \ - per = -1; \ - not_comparable = FALSE; \ - both_zero = FALSE; \ - if((A) == 0 && (B) == 0) \ - both_zero = TRUE; \ - if((A) != 0) \ - per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \ - else \ - not_comparable = TRUE; \ +#define PER_UNSIGN(TYPE,A,B) { \ + per = -1; \ + not_comparable = FALSE; \ + both_zero = FALSE; \ + if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \ + both_zero = TRUE; \ + if(!H5_DBL_ABS_EQUAL(0,A)) \ + per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \ + else \ + not_comparable = TRUE; \ } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index d7c5639..b8dd0e8 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -687,31 +687,30 @@ int diff_can_type( hid_t f_tid1, /* file data type */ HDassert(tclass1==tclass2); switch (tclass1) { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_COMPOUND: - case H5T_STRING: - case H5T_ARRAY: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_VLEN: - case H5T_REFERENCE: - - break; - - default: /*H5T_TIME */ - + case H5T_TIME: + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { + parallel_print("Not comparable: <%s> and <%s> are of class %s\n", + obj1_name,obj2_name,get_class(tclass2) ); + } /* end if */ + can_compare = 0; + options->not_cmp = 1; + return can_compare; - if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) - { - parallel_print("Not comparable: <%s> and <%s> are of class %s\n", - obj1_name,obj2_name,get_class(tclass2) ); - } - can_compare = 0; - options->not_cmp = 1; - return can_compare; - } + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_COMPOUND: + case H5T_STRING: + case H5T_ARRAY: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_REFERENCE: + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + break; + } /* end switch */ /*------------------------------------------------------------------------- * check for equal file datatype; warning only diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index aefd641..14fbcaa 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -78,8 +78,6 @@ void print_type(hid_t type) { switch (H5Tget_class(type)) { - default: - return; case H5T_INTEGER: if (H5Tequal(type, H5T_STD_I8BE)) { parallel_print("H5T_STD_I8BE"); @@ -160,7 +158,21 @@ void print_type(hid_t type) } break; - }/*switch*/ + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + return; + + } /* end switch */ } /*------------------------------------------------------------------------- @@ -219,6 +231,7 @@ get_type(h5trav_type_t type) return("H5G_LINK"); case H5TRAV_TYPE_UDLINK: return("H5G_UDLINK"); + case H5TRAV_TYPE_UNKNOWN: default: return("unknown type"); } @@ -242,13 +255,18 @@ get_sign(H5T_sign_t sign) { switch (sign) { - default: - return("H5T_SGN_ERROR"); - case H5T_SGN_NONE: - return("H5T_SGN_NONE"); - case H5T_SGN_2: - return("H5T_SGN_2"); - } + case H5T_SGN_NONE: + return "H5T_SGN_NONE"; + case H5T_SGN_2: + return "H5T_SGN_2"; + case H5T_SGN_ERROR: + return "H5T_SGN_ERROR"; + case H5T_NSGN: + return "H5T_NSGN"; + default: + HDassert(0); + return "unknown sign value"; + } /* end switch */ } @@ -268,8 +286,6 @@ get_class(H5T_class_t tclass) { switch (tclass) { - default: - return("Invalid class"); case H5T_TIME: return("H5T_TIME"); case H5T_INTEGER: @@ -292,8 +308,13 @@ get_class(H5T_class_t tclass) return("H5T_VLEN"); case H5T_ARRAY: return("H5T_ARRAY"); - } -} + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + HDassert(0); + return("Invalid class"); + } /* end switch */ +} /* end get_class() */ /*------------------------------------------------------------------------- * Function: print_found diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index c820aff..274b398 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1498,14 +1498,24 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } } break; - default: + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; if (size != HDfwrite(mem, sizeof(char), size, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); - } + } /* end for */ break; - } + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class"); + break; + } /* end switch */ CATCH return ret_value; diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 26cac47..6388273 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2476,6 +2476,8 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ break; + case H5T_NO_CLASS: + case H5T_NCLASSES: default: h5tools_str_append(buffer, "unknown datatype"); break; @@ -2903,7 +2905,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, off_t offset; /* offset of external file */ char f_name[256]; /* filter name */ char name[256]; /* external or virtual file name */ - char dsetname[256]; /* virtual datset name */ hsize_t chsize[64]; /* chunk size in elements */ hsize_t size; /* size of external file */ hsize_t storage_size; @@ -3080,6 +3081,8 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, } } break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", "Unknown layout"); @@ -3305,6 +3308,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, case H5D_FILL_TIME_IFSET: h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_IFSET"); break; + case H5D_FILL_TIME_ERROR: default: HDassert(0); break; @@ -3362,6 +3366,8 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, case H5D_ALLOC_TIME_LATE: h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_LATE"); break; + case H5D_ALLOC_TIME_ERROR: + case H5D_ALLOC_TIME_DEFAULT: default: HDassert(0); break; diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 0bb7d77..60666f1 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -218,7 +218,7 @@ ref_path_table_put(const char *path, haddr_t objno) HDassert(ref_path_table); HDassert(path); - if((new_node = HDmalloc(sizeof(ref_path_node_t))) == NULL) + if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL) return(-1); new_node->objno = objno; @@ -300,7 +300,7 @@ lookup_ref_path(haddr_t ref) if(ref_path_table == NULL) init_ref_path_table(); - node = H5SL_search(ref_path_table, &ref); + node = (ref_path_node_t *)H5SL_search(ref_path_table, &ref); return(node ? node->path : NULL); } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index b61ed34..88308ed 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1058,6 +1058,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, H5_TOOLS_DATATYPE); break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: h5tools_str_append(str, "%u-", (unsigned) oi.type); break; @@ -1187,7 +1189,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } break; - default: + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: { /* All other types get printed as hexadecimal */ size_t i; @@ -1200,6 +1204,12 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } } break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + h5tools_str_append(str, "invalid datatype"); + break; } /* end switch */ } return h5tools_str_fmt(str, start, OPT(info->elmt_fmt, "%s")); @@ -1394,7 +1404,7 @@ h5tools_str_replace ( const char *string, const char *substr, const char *replac head = newstr; while ( (tok = HDstrstr ( head, substr ))){ oldstr = newstr; - newstr = HDmalloc ( HDstrlen ( oldstr ) - HDstrlen ( substr ) + HDstrlen ( replacement ) + 1 ); + newstr = (char *)HDmalloc( HDstrlen( oldstr ) - HDstrlen( substr ) + HDstrlen( replacement ) + 1 ); if ( newstr == NULL ){ HDfree (oldstr); diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c index d68d3c5..8a56d29 100644 --- a/tools/lib/h5tools_type.c +++ b/tools/lib/h5tools_type.c @@ -13,6 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include "H5private.h" #include "h5tools.h" /*------------------------------------------------------------------------- @@ -75,54 +76,54 @@ h5tools_get_little_endian_type(hid_t tid) size = H5Tget_size(tid); sign = H5Tget_sign(tid); - switch( type_class ) - { - case H5T_INTEGER: - { - if ( size == 1 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I8LE); - else if ( size == 2 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I16LE); - else if ( size == 4 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I32LE); - else if ( size == 8 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I64LE); - else if ( size == 1 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U8LE); - else if ( size == 2 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U16LE); - else if ( size == 4 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U32LE); - else if ( size == 8 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U64LE); - } - break; - - case H5T_FLOAT: - if ( size == 4) - p_type=H5Tcopy(H5T_IEEE_F32LE); - else if ( size == 8) - p_type=H5Tcopy(H5T_IEEE_F64LE); - break; - - case H5T_TIME: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_STRING: - case H5T_COMPOUND: - case H5T_REFERENCE: - case H5T_ENUM: - case H5T_VLEN: - case H5T_ARRAY: - break; - - default: - break; - - } - - return(p_type); -} + switch(type_class) { + case H5T_INTEGER: + if ( size == 1 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I8LE); + else if ( size == 2 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I16LE); + else if ( size == 4 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I32LE); + else if ( size == 8 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I64LE); + else if ( size == 1 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U8LE); + else if ( size == 2 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U16LE); + else if ( size == 4 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U32LE); + else if ( size == 8 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U64LE); + break; + + case H5T_FLOAT: + if ( size == 4) + p_type=H5Tcopy(H5T_IEEE_F32LE); + else if ( size == 8) + p_type=H5Tcopy(H5T_IEEE_F64LE); + break; + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_STRING: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + HDassert(0); + break; + + } /* end switch */ + + return p_type; +} /* end h5tools_get_little_endian_type() */ /*------------------------------------------------------------------------- @@ -152,53 +153,51 @@ h5tools_get_big_endian_type(hid_t tid) size = H5Tget_size(tid); sign = H5Tget_sign(tid); - switch( type_class ) - { - case H5T_INTEGER: - { - if ( size == 1 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I8BE); - else if ( size == 2 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I16BE); - else if ( size == 4 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I32BE); - else if ( size == 8 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I64BE); - else if ( size == 1 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U8BE); - else if ( size == 2 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U16BE); - else if ( size == 4 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U32BE); - else if ( size == 8 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U64BE); - } - break; - - case H5T_FLOAT: - if ( size == 4) - p_type=H5Tcopy(H5T_IEEE_F32BE); - else if ( size == 8) - p_type=H5Tcopy(H5T_IEEE_F64BE); - break; - - case H5T_TIME: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_STRING: - case H5T_COMPOUND: - case H5T_REFERENCE: - case H5T_ENUM: - case H5T_VLEN: - case H5T_ARRAY: - break; - - default: - break; - - } - - - return(p_type); -} + switch(type_class) { + case H5T_INTEGER: + if ( size == 1 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I8BE); + else if ( size == 2 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I16BE); + else if ( size == 4 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I32BE); + else if ( size == 8 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I64BE); + else if ( size == 1 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U8BE); + else if ( size == 2 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U16BE); + else if ( size == 4 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U32BE); + else if ( size == 8 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U64BE); + break; + + case H5T_FLOAT: + if ( size == 4) + p_type=H5Tcopy(H5T_IEEE_F32BE); + else if ( size == 8) + p_type=H5Tcopy(H5T_IEEE_F64BE); + break; + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_STRING: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + HDassert(0); + break; + } /* end switch */ + + return p_type; +} /* end h5tools_get_big_endian_type() */ diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index fc8cf1d..a09a003 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -612,7 +612,10 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen } /* end if */ break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: + HDassert(0); break; } /* end switch */ diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index b8d44de..b85133d 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -169,6 +169,10 @@ set_time(io_time_t *pt, timer_type t, int start_stop) pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS]; } break; +#else + case MPI_CLOCK: + HDfprintf(stderr, "MPI clock set in serial library\n"); + return NULL; #endif /* H5_HAVE_PARALLEL */ case SYS_CLOCK: if (start_stop == TSTART) { @@ -197,11 +201,11 @@ set_time(io_time_t *pt, timer_type t, int start_stop) } break; + default: - HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type); - return (NULL); - break; - } + HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type); + return NULL; + } /* end switch */ #if 0 /* this does not belong here. Need fix in h5perf code when set_time() is called. -AKC- */ diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index be6d089..3789723 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -121,8 +121,9 @@ get_H5B2_class(const uint8_t *sig) cls = H5A_BT2_CORDER; break; + case H5B2_NUM_BTREE_ID: default: - HDfprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype)); + HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype)); HDexit(4); } /* end switch */ @@ -156,8 +157,9 @@ get_H5EA_class(const uint8_t *sig) cls = H5EA_CLS_TEST; break; + case H5EA_NUM_CLS_ID: default: - HDfprintf(stderr, "Unknown array class %u\n", (unsigned)(clsid)); + HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid)); HDexit(4); } /* end switch */ @@ -191,8 +193,9 @@ get_H5FA_class(const uint8_t *sig) cls = H5FA_CLS_TEST; break; + case H5FA_NUM_CLS_ID: default: - HDfprintf(stderr, "Unknown array class %u\n", (unsigned)(clsid)); + HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid)); HDexit(4); } /* end switch */ @@ -382,8 +385,9 @@ main(int argc, char *argv[]) status = H5D_btree_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims, dim); break; + case H5B_NUM_BTREE_ID: default: - HDfprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype)); + HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype)); HDexit(4); } diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 8dee706..1c1bba1 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -181,7 +181,7 @@ parse_command_line(int argc, const char *argv[], param_t *parms) /* Allocate space for the group name pointers */ parms->ngroups = (argc - opt_ind); - parms->groups = HDmalloc(parms->ngroups * sizeof(char *)); + parms->groups = (char **)HDmalloc(parms->ngroups * sizeof(char *)); /* Retrieve the group names */ curr_group = 0; diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index ffd52e8..f58af3a 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -261,13 +261,13 @@ main (int argc, char *argv[]) src_is_family = strcmp (src_name, src_gen_name); if ((src=HDopen(src_name, O_RDONLY,0))<0) { - perror (src_name); - exit (EXIT_FAILURE); + perror (src_name); + exit (EXIT_FAILURE); } if (HDfstat(src, &sb)<0) { - perror ("fstat"); - exit (EXIT_FAILURE); + perror ("fstat"); + exit (EXIT_FAILURE); } src_size = src_act_size = sb.st_size; if (verbose) fprintf (stderr, "< %s\n", src_name); @@ -290,7 +290,7 @@ main (int argc, char *argv[]) if (argno=0); /* The data */ - buf = calloc(1, SQUARE (DS_SIZE*CH_SIZE)); + buf = (signed char *)calloc(1, SQUARE (DS_SIZE*CH_SIZE)); H5Dwrite(dset, H5T_NATIVE_SCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); free(buf); @@ -194,7 +194,7 @@ static double test_rowmaj (int op, size_t cache_size, size_t io_size) { hid_t file, dset, mem_space, file_space; - signed char *buf = calloc (1, (size_t)(SQUARE(io_size))); + signed char *buf = (signed char *)calloc (1, (size_t)(SQUARE(io_size))); hsize_t i, j, hs_size[2]; hsize_t hs_offset[2]; int mdc_nelmts; @@ -273,7 +273,7 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset) hsize_t i, hs_size[2]; hsize_t nio = 0; hsize_t hs_offset[2]; - signed char *buf = calloc (1, (size_t)(SQUARE (io_size))); + signed char *buf = (signed char *)calloc(1, (size_t)(SQUARE (io_size))); int mdc_nelmts; size_t rdcc_nelmts; double w0; diff --git a/tools/perform/overhead.c b/tools/perform/overhead.c index 0288ffa..feabd3a 100644 --- a/tools/perform/overhead.c +++ b/tools/perform/overhead.c @@ -224,7 +224,7 @@ test(fill_t fill_style, const double splits[], if ((fd=HDopen(FILE_NAME_1, O_RDONLY, 0666)) < 0) goto error; if(FILL_RANDOM==fill_style) - had = calloc((size_t)cur_size[0], sizeof(int)); + had = (int *)calloc((size_t)cur_size[0], sizeof(int)); for (i=1; i<=cur_size[0]; i++) { diff --git a/tools/perform/sio_engine.c b/tools/perform/sio_engine.c index 3b28ea7..5622810 100644 --- a/tools/perform/sio_engine.c +++ b/tools/perform/sio_engine.c @@ -181,7 +181,7 @@ do_sio(parameters param) } /* Allocate transfer buffer */ - if ((buffer = malloc(linear_buf_size)) == NULL){ + if ((buffer = (char *)malloc(linear_buf_size)) == NULL){ HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", linear_buf_size); GOTOERROR(FAIL); } diff --git a/tools/perform/sio_perf.c b/tools/perform/sio_perf.c index 7d75a2d..34d8552 100644 --- a/tools/perform/sio_perf.c +++ b/tools/perform/sio_perf.c @@ -481,16 +481,16 @@ run_test(iotype iot, parameters parms, struct options *opts) /* allocate space for tables minmax and that it is sufficient */ /* to initialize all elements to zeros by calloc. */ - write_sys_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - write_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - write_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - write_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + write_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax)); + write_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax)); + write_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax)); + write_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax)); if (!parms.h5_write_only) { - read_sys_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - read_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - read_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - read_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + read_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax)); + read_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax)); + read_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax)); + read_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax)); } /* Do IO iteration times, collecting statistics each time */ @@ -1443,6 +1443,10 @@ void debug_start_stop_time(io_time_t *pt, timer_type t, int start_stop) case HDF5_RAW_READ_FIXED_DIMS: msg = "Raw Read"; break; + case HDF5_FILE_READ_OPEN: + case HDF5_FILE_READ_CLOSE: + case HDF5_FILE_WRITE_OPEN: + case HDF5_FILE_WRITE_CLOSE: default: msg = "Unknown Timer"; break; -- cgit v0.12