From 8cb45292110453354afd78b7cf1da50db2341014 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 26 Nov 2017 18:13:18 -0800 Subject: Fixed misc Warnings flagged by VS2017. --- examples/h5_cmprss.c | 1 - src/H5Dio.c | 4 +- src/H5MF.c | 5 +- src/H5Tdbg.c | 227 +++++++++++++++++++++++++-------------------------- src/H5system.c | 2 +- test/cache_tagging.c | 13 +-- test/tarray.c | 24 +++--- test/tattr.c | 14 ++-- test/tchecksum.c | 2 +- test/testhdf5.h | 1 + test/tfile.c | 6 +- test/th5o.c | 4 +- test/theap.c | 30 +++---- test/tid.c | 18 ++-- test/titerate.c | 18 ++-- test/tmisc.c | 36 ++++---- test/trefstr.c | 26 +++--- test/tselect.c | 130 ++++++++++++++--------------- test/tskiplist.c | 142 ++++++++++++++++---------------- test/ttst.c | 18 ++-- test/tvltypes.c | 6 +- 21 files changed, 364 insertions(+), 363 deletions(-) diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index ebc7712..b51ec44 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -36,7 +36,6 @@ int main () { hsize_t dims[2]; hsize_t cdims[2]; - int idx; int i,j, numfilt; int buf[DIM0][DIM1]; int rbuf [DIM0][DIM1]; diff --git a/src/H5Dio.c b/src/H5Dio.c index 104a632..280d602 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -962,7 +962,9 @@ const io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI); #endif /* H5_HAVE_PARALLEL */ -done: +#ifdef H5_DEBUG_BUILD + done: +#endif /* H5_DEBUG_BUILD */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__ioinfo_init() */ diff --git a/src/H5MF.c b/src/H5MF.c index 49c7b77..7e06654 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -3247,7 +3247,6 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* for self referential FSMs */ haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ /* for self referential FSMs */ - H5FS_stat_t fs_stat; /* Information for hdr FSM */ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ hbool_t reset_ring = FALSE; /* Whether we set the ring */ @@ -3310,6 +3309,9 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) reset_ring = TRUE; #ifndef NDEBUG +{ + H5FS_stat_t fs_stat; /* Information for hdr FSM */ + /* Verify that sm_hdr_fspace is floating if it exists */ if(sm_hdr_fspace) { /* Query free space manager info for this type */ @@ -3357,6 +3359,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) HDassert(fs_stat.alloc_sect_size == 0); } /* end if */ } /* end if */ +} #endif /* NDEBUG */ /* Free the space in the metadata aggregator. Do this via the diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index f434543..eb648f3 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -32,9 +32,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Tpkg.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ @@ -74,28 +74,21 @@ /*------------------------------------------------------------------------- - * Function: H5T__print_stats + * Function: H5T__print_stats * - * Purpose: Print statistics about a conversion path. Statistics are - * printed only if all the following conditions are true: + * Purpose: Print statistics about a conversion path. Statistics are + * printed only if all the following conditions are true: * - * 1. The library was compiled with H5T_DEBUG defined. - * 2. Data type debugging is turned on at run time. - * 3. The path was called at least one time. + * 1. The library was compiled with H5T_DEBUG defined. + * 2. Data type debugging is turned on at run time. + * 3. The path was called at least one time. * - * The optional NPRINT argument keeps track of the number of - * conversions paths for which statistics have been shown. If - * its value is zero then table headers are printed before the - * first line of output. + * The optional NPRINT argument keeps track of the number of + * conversions paths for which statistics have been shown. If + * its value is zero then table headers are printed before the + * first line of output. * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Robb Matzke - * Monday, December 14, 1998 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -110,34 +103,34 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* FUNC_ENTER_PACKAGE_NOERR #ifdef H5T_DEBUG - if(H5DEBUG(T) && path->stats.ncalls > 0) { - if(nprint && 0 == (*nprint)++) { - HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "Conversion", "Elmts", "Calls", "User", - "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "----------", "-----", "-----", "----", - "------", "-------", "---------"); - } - if(path->src && path->dst) + if (H5DEBUG(T) && path->stats.ncalls > 0) { + if (nprint && 0 == (*nprint)++) { + HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "Conversion", "Elmts", "Calls", "User", + "System", "Elapsed", "Bandwidth"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "----------", "-----", "-----", "----", + "------", "-------", "---------"); + } + if (path->src && path->dst) nbytes = MAX(H5T_get_size(path->src), H5T_get_size(path->dst)); - else if(path->src) + else if (path->src) nbytes = H5T_get_size(path->src); - else if(path->dst) + else if (path->dst) nbytes = H5T_get_size(path->dst); else nbytes = 0; - nbytes *= path->stats.nelmts; - H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime); - HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", - path->name, - path->stats.nelmts, - path->stats.ncalls, - path->stats.timer.utime, - path->stats.timer.stime, - path->stats.timer.etime, - bandwidth); + nbytes *= path->stats.nelmts; + H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime); + HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", + path->name, + path->stats.nelmts, + path->stats.ncalls, + path->stats.timer.utime, + path->stats.timer.stime, + path->stats.timer.etime, + bandwidth); } #endif FUNC_LEAVE_NOAPI(SUCCEED) @@ -145,24 +138,20 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* /*------------------------------------------------------------------------- - * Function: H5T_debug - * - * Purpose: Prints information about a data type. + * Function: H5T_debug * - * Return: Non-negative on success/Negative on failure + * Purpose: Prints information about a data type. * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5T_debug(const H5T_t *dt, FILE *stream) { - const char *s1 = "", *s2 = ""; - unsigned i; + const char *s1 = ""; + const char *s2 = ""; + unsigned i; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -171,7 +160,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) HDassert(dt); HDassert(stream); - switch(dt->shared->type) { + switch (dt->shared->type) { case H5T_NO_CLASS: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class"); break; @@ -221,9 +210,9 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: s1 = ""; break; - } /* end switch */ + } /* end switch */ - switch(dt->shared->state) { + switch (dt->shared->state) { case H5T_STATE_TRANSIENT: s2 = "[transient]"; break; @@ -245,14 +234,14 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; default: HDassert(0 && "This Should never be executed!"); - } /* end switch */ + } /* end switch */ - fprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size)); + HDfprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size)); - if(H5T_IS_ATOMIC(dt->shared)) { - uint64_t tmp; + if (H5T_IS_ATOMIC(dt->shared)) { + uint64_t tmp; - switch(dt->shared->u.atomic.order) { + switch (dt->shared->u.atomic.order) { case H5T_ORDER_ERROR: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "order error"); break; @@ -277,17 +266,16 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: s1 = "order?"; break; - } /* end switch */ + } /* end switch */ + + HDfprintf(stream, ", %s", s1); - fprintf(stream, ", %s", s1); + if (dt->shared->u.atomic.offset) + HDfprintf(stream, ", offset=%lu", (unsigned long) (dt->shared->u.atomic.offset)); + if (dt->shared->u.atomic.prec != 8 * dt->shared->size) + HDfprintf(stream, ", prec=%lu", (unsigned long) (dt->shared->u.atomic.prec)); - if(dt->shared->u.atomic.offset) - fprintf(stream, ", offset=%lu", - (unsigned long) (dt->shared->u.atomic.offset)); - if(dt->shared->u.atomic.prec != 8 * dt->shared->size) - fprintf(stream, ", prec=%lu", - (unsigned long) (dt->shared->u.atomic.prec)); - switch(dt->shared->type) { + switch (dt->shared->type) { case H5T_NO_CLASS: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class"); break; @@ -313,7 +301,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) } /* end switch */ if(s1) - fprintf(stream, ", %s", s1); + HDfprintf(stream, ", %s", s1); break; case H5T_FLOAT: @@ -339,23 +327,24 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; } /* end switch */ - fprintf(stream, ", sign=%lu+1", + HDfprintf(stream, ", sign=%lu+1", (unsigned long)(dt->shared->u.atomic.u.f.sign)); - fprintf(stream, ", mant=%lu+%lu (%s)", + HDfprintf(stream, ", mant=%lu+%lu (%s)", (unsigned long)(dt->shared->u.atomic.u.f.mpos), (unsigned long)(dt->shared->u.atomic.u.f.msize), s1); - fprintf(stream, ", exp=%lu+%lu", + HDfprintf(stream, ", exp=%lu+%lu", (unsigned long)(dt->shared->u.atomic.u.f.epos), (unsigned long)(dt->shared->u.atomic.u.f.esize)); tmp = dt->shared->u.atomic.u.f.ebias >> 32; - if(tmp) { + if (tmp) { size_t hi = (size_t)tmp; size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff); - fprintf(stream, " bias=0x%08lx%08lx", + HDfprintf(stream, " bias=0x%08lx%08lx", (unsigned long)hi, (unsigned long)lo); - } else { + } + else { size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff); - fprintf(stream, " bias=0x%08lx", (unsigned long)lo); + HDfprintf(stream, " bias=0x%08lx", (unsigned long)lo); } break; @@ -372,69 +361,73 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: /* No additional info */ break; - } /* end switch */ - } else if(H5T_COMPOUND == dt->shared->type) { - /* Compound data type */ - for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { - fprintf(stream, "\n\"%s\" @%lu", - dt->shared->u.compnd.memb[i].name, - (unsigned long)(dt->shared->u.compnd.memb[i].offset)); - fprintf(stream, " "); - H5T_debug(dt->shared->u.compnd.memb[i].type, stream); - } /* end for */ - fprintf(stream, "\n"); - } else if(H5T_VLEN == dt->shared->type) { - switch(dt->shared->u.vlen.loc) { + } /* end switch */ + } + else if (H5T_COMPOUND == dt->shared->type) { + /* Compound data type */ + for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { + HDfprintf(stream, "\n\"%s\" @%lu", + dt->shared->u.compnd.memb[i].name, + (unsigned long)(dt->shared->u.compnd.memb[i].offset)); + HDfprintf(stream, " "); + H5T_debug(dt->shared->u.compnd.memb[i].type, stream); + } /* end for */ + HDfprintf(stream, "\n"); + } + else if (H5T_VLEN == dt->shared->type) { + switch (dt->shared->u.vlen.loc) { case H5T_LOC_BADLOC: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid datatype location"); break; case H5T_LOC_MEMORY: - fprintf(stream, ", loc=memory"); + HDfprintf(stream, ", loc=memory"); break; case H5T_LOC_DISK: - fprintf(stream, ", loc=disk"); + HDfprintf(stream, ", loc=disk"); break; case H5T_LOC_MAXLOC: default: - fprintf(stream, ", loc=UNKNOWN"); + HDfprintf(stream, ", loc=UNKNOWN"); break; } /* end switch */ - if(H5T_IS_VL_STRING(dt->shared)) + if (H5T_IS_VL_STRING(dt->shared)) /* Variable length string datatype */ - fprintf(stream, ", variable-length"); + HDfprintf(stream, ", variable-length"); else { /* Variable length sequence datatype */ - fprintf(stream, " VLEN "); + HDfprintf(stream, " VLEN "); H5T_debug(dt->shared->parent, stream); - fprintf(stream, "\n"); + HDfprintf(stream, "\n"); } /* end else */ - } else if(H5T_ENUM == dt->shared->type) { + } + else if (H5T_ENUM == dt->shared->type) { size_t base_size; - /* Enumeration data type */ - fprintf(stream, " "); - H5T_debug(dt->shared->parent, stream); - base_size = dt->shared->parent->shared->size; - for(i = 0; i < dt->shared->u.enumer.nmembs; i++) { + /* Enumeration data type */ + HDfprintf(stream, " "); + H5T_debug(dt->shared->parent, stream); + base_size = dt->shared->parent->shared->size; + for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { size_t k; - fprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); - for(k = 0; k < base_size; k++) - fprintf(stream, "%02lx", - (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k)); - } /* end for */ - fprintf(stream, "\n"); - } else if(H5T_OPAQUE == dt->shared->type) { - fprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag); - } else { - /* Unknown */ - fprintf(stream, "unknown class %d\n", (int)(dt->shared->type)); + HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); + for (k = 0; k < base_size; k++) + HDfprintf(stream, "%02lx", (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k)); + } /* end for */ + HDfprintf(stream, "\n"); + } + else if (H5T_OPAQUE == dt->shared->type) { + HDfprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag); + } + else { + /* Unknown */ + HDfprintf(stream, "unknown class %d\n", (int)(dt->shared->type)); } - fprintf(stream, "}"); + HDfprintf(stream, "}"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5system.c b/src/H5system.c index a1cdf19..a8726c2 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -977,7 +977,7 @@ Wround(double arg) float Wroundf(float arg) { - return arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F); + return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); } #endif /* H5_HAVE_WIN32_API */ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 99ab49c..9c79968 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -3631,11 +3631,14 @@ error: static unsigned check_invalid_tag_application(void) { +#if H5C_DO_TAGGING_SANITY_CHECKS /* Variables */ H5F_t * f = NULL; - hid_t fid, dxpl_id = -1; + hid_t fid = -1; + hid_t dxpl_id = -1; haddr_t addr; H5HL_t * lheap = NULL; +#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ /* Testing Macro */ TESTING("failure on invalid tag application"); @@ -3683,8 +3686,8 @@ check_invalid_tag_application(void) PASSED(); #else SKIPPED(); - printf(" test skipped because sanity checking on tag value is disabled.\n"); -#endif + HDprintf(" test skipped because sanity checking on tag value is disabled.\n"); +#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ return 0; @@ -3791,10 +3794,10 @@ main(void) HDremove(FILENAME2); /* Return Errors */ - return(nerrs > 0); + return nerrs > 0; error: /* Return with Error */ - return(1); + return 1; } /* main */ diff --git a/test/tarray.c b/test/tarray.c index a35b8a3..b2e0ee7 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -679,7 +679,7 @@ test_array_compound_atomic(void) /* Check the 1st field's name */ mname = H5Tget_member_name(tid2, 0); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname, "i") != 0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); H5free_memory(mname); @@ -698,7 +698,7 @@ test_array_compound_atomic(void) /* Check the 2nd field's name */ mname = H5Tget_member_name(tid2, 1); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname, "f") != 0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); H5free_memory(mname); @@ -897,7 +897,7 @@ test_array_compound_array(void) /* Check the 1st field's name */ mname=H5Tget_member_name(tid2,0); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -916,7 +916,7 @@ test_array_compound_array(void) /* Check the 2nd field's name */ mname=H5Tget_member_name(tid2,1); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -1604,7 +1604,7 @@ test_array_bkg(void) /* Initialize the data */ /* ------------------- */ dtsinfo = (CmpDTSinfo *)HDmalloc(sizeof(CmpDTSinfo)); - CHECK(dtsinfo, NULL, "HDmalloc"); + CHECK_PTR(dtsinfo, "HDmalloc"); HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo)); for (i = 0; i < LENGTH; i++) { for (j = 0; j < ALEN; j++) { @@ -1927,7 +1927,7 @@ test_compat(void) /* Check the 1st field's name */ mname=H5Tget_member_name(tid1,0); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -1946,7 +1946,7 @@ test_compat(void) /* Check the 2nd field's name */ mname=H5Tget_member_name(tid1,1); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -1965,7 +1965,7 @@ test_compat(void) /* Check the 3rd field's name */ mname=H5Tget_member_name(tid1,2); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"l")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -2009,7 +2009,7 @@ test_compat(void) /* Check the 1st field's name */ mname=H5Tget_member_name(tid1,0); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); if(mname) H5free_memory(mname); @@ -2028,7 +2028,7 @@ test_compat(void) /* Check the 2nd field's name */ mname=H5Tget_member_name(tid1,1); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); if(mname) H5free_memory(mname); @@ -2073,7 +2073,7 @@ test_compat(void) /* Check the 3rd field's name */ mname=H5Tget_member_name(tid1,2); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"l")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); if(mname) H5free_memory(mname); @@ -2118,7 +2118,7 @@ test_compat(void) /* Check the 4th field's name */ mname=H5Tget_member_name(tid1,3); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"d")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); if(mname) H5free_memory(mname); diff --git a/test/tattr.c b/test/tattr.c index 3786d0d..2d333e9 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -277,7 +277,7 @@ test_attr_basic_write(hid_t fapl) if(attr_name_size > 0) { attr_name = (char*)HDcalloc((size_t)(attr_name_size + 1), sizeof(char)); - CHECK(attr_name, NULL, "HDcalloc"); + CHECK_PTR(attr_name, "HDcalloc"); if(attr_name) { ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name); @@ -313,7 +313,7 @@ test_attr_basic_write(hid_t fapl) if(attr_name_size > 0) { attr_name = (char*)HDcalloc((size_t)(attr_name_size+1), sizeof(char)); - CHECK(attr_name, NULL, "HDcalloc"); + CHECK_PTR(attr_name, "HDcalloc"); if(attr_name) { ret = (herr_t)H5Aget_name(attr2, (size_t)(attr_name_size + 1), attr_name); @@ -6862,7 +6862,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Allocate the "visited link" array */ iter_info.max_visit = max_compact * 2; visited = (hbool_t*)HDmalloc(sizeof(hbool_t) * iter_info.max_visit); - CHECK(visited, NULL, "HDmalloc"); + CHECK_PTR(visited, "HDmalloc"); iter_info.visited = visited; /* Loop over operating on different indices on link fields */ @@ -8040,7 +8040,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Allocate & initialize "big" attribute data */ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); - CHECK(big_value, NULL, "HDmalloc"); + CHECK_PTR(big_value, "HDmalloc"); HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ @@ -8371,7 +8371,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Allocate & initialize "big" attribute data */ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); - CHECK(big_value, NULL, "HDmalloc"); + CHECK_PTR(big_value, "HDmalloc"); HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ @@ -8817,7 +8817,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Allocate & initialize "big" attribute data */ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); - CHECK(big_value, NULL, "HDmalloc"); + CHECK_PTR(big_value, "HDmalloc"); HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ @@ -9186,7 +9186,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Allocate & initialize "big" attribute data */ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); - CHECK(big_value, NULL, "HDmalloc"); + CHECK_PTR(big_value, "HDmalloc"); HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ diff --git a/test/tchecksum.c b/test/tchecksum.c index febaacc..ffbab45 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -187,7 +187,7 @@ test_chksum_large(void) /* Allocate the buffer */ large_buf = (uint8_t *)HDmalloc((size_t)BUF_LEN); - CHECK(large_buf, NULL, "HDmalloc"); + CHECK_PTR(large_buf, "HDmalloc"); /* Initialize buffer w/known data */ for(u = 0; u < BUF_LEN; u++) diff --git a/test/testhdf5.h b/test/testhdf5.h index 2cbe6c6..41675cf 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -54,6 +54,7 @@ } \ } +/* Check that a pointer is valid (i.e.: not NULL) */ #define CHECK_PTR(ret,where) { \ if (VERBOSE_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ diff --git a/test/tfile.c b/test/tfile.c index 027ad62..80ba4da 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1072,7 +1072,7 @@ test_get_obj_ids(void) VERIFY(oid_count, (NGROUPS + NDSETS + 1), "H5Fget_obj_count"); oid_list = (hid_t *)HDcalloc((size_t)oid_list_size, sizeof(hid_t)); - CHECK(oid_list, NULL, "HDcalloc"); + CHECK_PTR(oid_list, "HDcalloc"); /* Call the public function H5F_get_obj_ids to use H5F_get_objects. User reported having problem here. * that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in @@ -1135,7 +1135,7 @@ test_get_obj_ids(void) VERIFY(oid_count, NDSETS, "H5Fget_obj_count"); oid_list = (hid_t *)HDcalloc((size_t)oid_count, sizeof(hid_t)); - CHECK(oid_list, NULL, "HDcalloc"); + CHECK_PTR(oid_list, "HDcalloc"); /* Get the list of all opened objects */ ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); @@ -2667,7 +2667,7 @@ cal_chksum(const char *file, uint32_t *chksum) /* Allocate space for the file data */ file_data = HDmalloc((size_t)sb.st_size); - CHECK(file_data, NULL, "HDmalloc"); + CHECK_PTR(file_data, "HDmalloc"); if(file_data) { /* Read file's data into memory */ diff --git a/test/th5o.c b/test/th5o.c index 4baac20..144ea4c 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -783,9 +783,9 @@ test_h5o_link(void) /* Allocate memory buffers */ /* (These are treated as 2-D buffers) */ wdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int)); - CHECK(wdata, NULL, "HDmalloc"); + CHECK_PTR(wdata, "HDmalloc"); rdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int)); - CHECK(rdata, NULL, "HDmalloc"); + CHECK_PTR(rdata, "HDmalloc"); /* Initialize the raw data */ for(i = n = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++) diff --git a/test/theap.c b/test/theap.c index 3c23025..cdb423e 100644 --- a/test/theap.c +++ b/test/theap.c @@ -88,11 +88,11 @@ test_heap_init(void) /* Allocate arrays */ rand_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - CHECK(rand_num, NULL, "HDmalloc"); + CHECK_PTR(rand_num, "HDmalloc"); inc_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - CHECK(inc_sort_num, NULL, "HDmalloc"); + CHECK_PTR(inc_sort_num, "HDmalloc"); dec_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - CHECK(dec_sort_num, NULL, "HDmalloc"); + CHECK_PTR(dec_sort_num, "HDmalloc"); /* Create randomized set of numbers */ curr_time = HDtime(NULL); @@ -127,7 +127,7 @@ test_heap_create(void) /* Try creating a maximum Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Try closing the heap */ ret=H5HP_close(heap); @@ -135,7 +135,7 @@ test_heap_create(void) /* Try creating a minimum Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Try closing the heap */ ret=H5HP_close(heap); @@ -163,7 +163,7 @@ test_heap_insert_min(void) /* Create a Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -237,7 +237,7 @@ test_heap_insert_max(void) /* Create a Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -325,7 +325,7 @@ test_heap_insert_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem, i /* Create a Heap */ heap=H5HP_create(heap_type); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -405,7 +405,7 @@ test_heap_remove_min(void) /* Create a Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -479,7 +479,7 @@ test_heap_remove_max(void) /* Create a Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -567,7 +567,7 @@ static void test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, siz /* Create a Heap */ heap=H5HP_create(heap_type); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -714,7 +714,7 @@ test_heap_change_min(void) /* Create a Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -788,7 +788,7 @@ test_heap_change_max(void) /* Create a Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -880,7 +880,7 @@ test_heap_incdec_min(void) /* Create a Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -955,7 +955,7 @@ test_heap_incdec_max(void) /* Create a Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); diff --git a/test/tid.c b/test/tid.c index 494ee60..375ef69 100644 --- a/test/tid.c +++ b/test/tid.c @@ -57,7 +57,7 @@ static int basic_id_test(void) testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t) 0); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iobject_verify"); + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); if(testPtr != NULL) goto out; @@ -65,7 +65,7 @@ static int basic_id_test(void) testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t) 700); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iobject_verify"); + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); if(testPtr != NULL) goto out; @@ -118,7 +118,7 @@ static int basic_id_test(void) testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) 0); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iremove_verify"); + CHECK_PTR_NULL(testPtr, "H5Iremove_verify"); if(testPtr != NULL) goto out; @@ -126,14 +126,14 @@ static int basic_id_test(void) testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) ((int) myType-1)); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iremove_verify"); + CHECK_PTR_NULL(testPtr, "H5Iremove_verify"); if(testPtr != NULL) goto out; /* Remove an ID and make sure we can't access it */ testPtr = (int*) H5Iremove_verify(arrayID, myType); - CHECK(testPtr, NULL, "H5Iremove_verify"); + CHECK_PTR(testPtr, "H5Iremove_verify"); if(testPtr == NULL) goto out; @@ -141,7 +141,7 @@ static int basic_id_test(void) testPtr = (int*) H5Iobject_verify(arrayID, myType); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iobject_verify"); + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); if(testPtr != NULL) goto out; @@ -263,7 +263,7 @@ static int id_predefined_test(void ) testPtr = H5Isearch(H5I_GENPROP_LST, (H5I_search_func_t) test_search_func, testObj); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Isearch"); + CHECK_PTR_NULL(testPtr, "H5Isearch"); if(testPtr != NULL) goto out; @@ -301,7 +301,7 @@ static int id_predefined_test(void ) testPtr = H5Iremove_verify(typeID, H5I_DATATYPE); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iremove_verify"); + CHECK_PTR_NULL(testPtr, "H5Iremove_verify"); if(testPtr != NULL) goto out; @@ -309,7 +309,7 @@ static int id_predefined_test(void ) testPtr = H5Iobject_verify(typeID, H5I_DATATYPE); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iobject_verify"); + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); if(testPtr != NULL) goto out; diff --git a/test/titerate.c b/test/titerate.c index aad62c9..231bd2e 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -159,7 +159,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Keep a copy of the dataset names around for later */ lnames[i] = HDstrdup(name); - CHECK(lnames[i], NULL, "strdup"); + CHECK_PTR(lnames[i], "strdup"); ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -170,13 +170,13 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(ret, FAIL, "H5Gcreate2"); lnames[NDATASETS] = HDstrdup("grp"); - CHECK(lnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(lnames[NDATASETS], "strdup"); ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); lnames[NDATASETS + 1] = HDstrdup("dtype"); - CHECK(lnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(lnames[NDATASETS], "strdup"); /* Close everything up */ ret = H5Tclose(datatype); @@ -412,7 +412,7 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) /* Keep a copy of the attribute names around for later */ anames[i] = HDstrdup(name); - CHECK(anames[i], NULL, "strdup"); + CHECK_PTR(anames[i], "strdup"); ret = H5Aclose(attribute); CHECK(ret, FAIL, "H5Aclose"); @@ -596,7 +596,7 @@ test_iter_group_large(hid_t fapl) /* Allocate & initialize array */ names = (iter_info *)HDcalloc(sizeof(iter_info), (ITER_NGROUPS + 2)); - CHECK(names, NULL, "HDcalloc"); + CHECK_PTR(names, "HDcalloc"); /* Output message about test being performed */ MESSAGE(5, ("Testing Large Group Iteration Functionality\n")); @@ -733,7 +733,7 @@ static void test_grp_memb_funcs(hid_t fapl) /* Keep a copy of the dataset names around for later */ dnames[i] = HDstrdup(name); - CHECK(dnames[i], NULL, "strdup"); + CHECK_PTR(dnames[i], "strdup"); ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -744,13 +744,13 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(ret, FAIL, "H5Gcreate2"); dnames[NDATASETS] = HDstrdup("grp"); - CHECK(dnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(dnames[NDATASETS], "strdup"); ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); dnames[NDATASETS + 1] = HDstrdup("dtype"); - CHECK(dnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(dnames[NDATASETS], "strdup"); /* Close everything up */ ret = H5Tclose(datatype); @@ -797,7 +797,7 @@ static void test_grp_memb_funcs(hid_t fapl) /* Keep a copy of the dataset names around for later */ obj_names[i] = HDstrdup(dataset_name); - CHECK(obj_names[i], NULL, "strdup"); + CHECK_PTR(obj_names[i], "strdup"); ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); diff --git a/test/tmisc.c b/test/tmisc.c index 6da4589..f0e595b 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -723,7 +723,7 @@ create_struct3(void) herr_t ret; /* For error checking */ str3hndl = (misc5_struct3_hndl *)HDmalloc(sizeof(misc5_struct3_hndl)); - CHECK(str3hndl,NULL,"malloc"); + CHECK_PTR(str3hndl, "malloc"); str3hndl->st3h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct3)); CHECK(str3hndl->st3h_base, FAIL, "H5Tcreate"); @@ -766,7 +766,7 @@ create_struct2(void) herr_t ret; /* For error checking */ str2hndl = (misc5_struct2_hndl *)HDmalloc(sizeof(misc5_struct2_hndl)); - CHECK(str2hndl, NULL, "malloc"); + CHECK_PTR(str2hndl, "HDmalloc"); str2hndl->st2h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct2)); CHECK(str2hndl->st2h_base, FAIL, "H5Tcreate"); @@ -775,7 +775,7 @@ create_struct2(void) CHECK(ret, FAIL, "H5Tinsert"); str2hndl->st2h_st3hndl = create_struct3(); - CHECK(str2hndl->st2h_st3hndl,NULL,"create_struct3"); + CHECK_PTR(str2hndl->st2h_st3hndl, "create_struct3"); ret = H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id); CHECK(ret,FAIL,"H5Tinsert"); @@ -811,7 +811,7 @@ set_struct2(misc5_struct2 *buf) buf->st2_el2.len = MISC5_DBGNELM3; buf->st2_el2.p = HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); - CHECK(buf->st2_el2.p,NULL,"malloc"); + CHECK_PTR(buf->st2_el2.p, "HDmalloc"); for(i=0; i<(buf->st2_el2.len); i++) set_struct3(&(((misc5_struct3 *)(buf->st2_el2.p))[i])); @@ -832,7 +832,7 @@ create_struct1(void) herr_t ret; /* For error checking */ str1hndl = (misc5_struct1_hndl *)HDmalloc(sizeof(misc5_struct1_hndl)); - CHECK(str1hndl, NULL, "malloc"); + CHECK_PTR(str1hndl, "HDmalloc"); str1hndl->st1h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct1)); CHECK(str1hndl->st1h_base, FAIL, "H5Tcreate"); @@ -841,7 +841,7 @@ create_struct1(void) CHECK(ret, FAIL, "H5Tinsert"); str1hndl->st1h_st2hndl=create_struct2(); - CHECK(str1hndl->st1h_st2hndl,NULL,"create_struct2"); + CHECK_PTR(str1hndl->st1h_st2hndl, "create_struct2"); ret = H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id); CHECK(ret,FAIL,"H5Tinsert"); @@ -877,7 +877,7 @@ set_struct1(misc5_struct1 *buf) buf->st1_el2.len=MISC5_DBGNELM2; buf->st1_el2.p=HDmalloc((buf->st1_el2.len)*sizeof(misc5_struct2)); - CHECK(buf->st1_el2.p,NULL,"malloc"); + CHECK_PTR(buf->st1_el2.p, "HDmalloc"); for(i=0; i<(buf->st1_el2.len); i++) set_struct2(&(((misc5_struct2 *)(buf->st1_el2.p))[i])); @@ -913,7 +913,7 @@ test_misc5(void) /* Create the memory structure to write */ str1hndl = create_struct1(); - CHECK(str1hndl, NULL, "create_struct1"); + CHECK_PTR(str1hndl, "create_struct1"); /* Create the dataspace */ dims[0] = MISC5_NELMTOPLVL; @@ -927,7 +927,7 @@ test_misc5(void) /* Create the variable-length buffer */ buf.len = MISC5_DBGNELM1; buf.p = HDmalloc((buf.len) * sizeof(misc5_struct1)); - CHECK(buf.p, NULL, "malloc"); + CHECK_PTR(buf.p, "HDmalloc"); /* Create the top-level VL information */ for(i = 0; i < MISC5_DBGNELM1; i++) @@ -1253,10 +1253,10 @@ test_misc8(void) /* Allocate space for the data to write & read */ wdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); - CHECK(wdata,NULL,"malloc"); + CHECK_PTR(wdata, "HDmalloc"); #ifdef VERIFY_DATA rdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); - CHECK(rdata,NULL,"malloc"); + CHECK_PTR(rdata, "HDmalloc"); #endif /* VERIFY_DATA */ /* Initialize values */ @@ -2144,7 +2144,7 @@ misc13_verify_dataset(hid_t loc_id, const char *name, const unsigned *data) /* Create a data buffer for the dataset read */ read_data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned)); - CHECK(read_data, NULL, "HDcalloc"); + CHECK_PTR(read_data, "HDcalloc"); /* Open the contiguous dataset in the root group */ dsid = H5Dopen2(loc_id, name, H5P_DEFAULT); @@ -2270,14 +2270,14 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char /* Allocate space for the user block */ user_block = HDcalloc(size, (size_t)1); - CHECK(user_block, NULL, "HDcalloc"); + CHECK_PTR(user_block, "HDcalloc"); /* Copy in the user block data */ HDmemcpy(user_block, str, strlen(str)); /* Open the new file */ new_fp = HDfopen(new_name,"wb"); - CHECK(new_fp, NULL, "HDfopen"); + CHECK_PTR(new_fp, "HDfopen"); /* Write the user block to the new file */ written = HDfwrite(user_block, (size_t)1, size, new_fp); @@ -2285,11 +2285,11 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char /* Open the old file */ old_fp = HDfopen(old_name,"rb"); - CHECK(old_fp, NULL, "HDfopen"); + CHECK_PTR(old_fp, "HDfopen"); /* Allocate space for the copy buffer */ copy_buf = HDmalloc((size_t)MISC13_COPY_BUF_SIZE); - CHECK(copy_buf, NULL, "HDmalloc"); + CHECK_PTR(copy_buf, "HDmalloc"); /* Copy data from the old file to the new file */ while((read_in = HDfread(copy_buf, (size_t)1, (size_t)MISC13_COPY_BUF_SIZE, old_fp)) > 0) { @@ -2439,7 +2439,7 @@ test_misc13(void) /* Create a data buffer for the datasets */ data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned)); - CHECK(data, NULL, "HDcalloc"); + CHECK_PTR(data, "HDcalloc"); /* Initialize data to write */ misc13_init_data(data); @@ -3446,7 +3446,7 @@ test_misc19(void) /* Get a VFD class to register */ vfd_cls = h5_get_dummy_vfd_class(); - CHECK(vfd_cls, NULL, "h5_get_dummy_vfd_class"); + CHECK_PTR(vfd_cls, "h5_get_dummy_vfd_class"); /* Register a virtual file driver */ vfdid = H5FDregister(vfd_cls); diff --git a/test/trefstr.c b/test/trefstr.c index 40ce344..f55ede0 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -67,7 +67,7 @@ test_refstr_create(void) /* Try creating a ref-counted string */ rs=H5RS_create("foo"); - CHECK(rs, NULL, "H5RS_create"); + CHECK_PTR(rs, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs); @@ -97,7 +97,7 @@ test_refstr_count(void) /* Try creating a ref-counted string */ rs=H5RS_create("foo"); - CHECK(rs, NULL, "H5RS_create"); + CHECK_PTR(rs, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs); @@ -144,7 +144,7 @@ test_refstr_dup(void) /* Try creating a ref-counted string */ rs1=H5RS_create("foo"); - CHECK(rs1, NULL, "H5RS_create"); + CHECK_PTR(rs1, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs1); @@ -152,7 +152,7 @@ test_refstr_dup(void) /* Duplicate r-string */ rs2=H5RS_dup(rs1); - CHECK(rs2, NULL, "H5RS_dup"); + CHECK_PTR(rs2, "H5RS_dup"); /* Get the reference count on the strings */ count=H5RS_get_count(rs1); @@ -194,11 +194,11 @@ test_refstr_cmp(void) /* Create first reference counted string */ rs1=H5RS_create("foo"); - CHECK(rs1, NULL, "H5RS_create"); + CHECK_PTR(rs1, "H5RS_create"); /* Create second reference counted string */ rs2=H5RS_create("foo2"); - CHECK(rs2, NULL, "H5RS_create"); + CHECK_PTR(rs2, "H5RS_create"); /* Compare the strings in various ways */ cmp=H5RS_cmp(rs1,rs1); @@ -246,11 +246,11 @@ test_refstr_wrap(void) /* Wrap ref-counted string around existing buffer */ rs=H5RS_wrap(buf); - CHECK(rs, NULL, "H5RS_wrap"); + CHECK_PTR(rs, "H5RS_wrap"); /* Get pointer to raw string in ref-counted string */ s=H5RS_get_str(rs); - CHECK(s, NULL, "H5RS_get_str"); + CHECK_PTR(s, "H5RS_get_str"); VERIFY(s, buf, "wrapping"); cmp=HDstrcmp(s,buf); VERIFY(cmp, 0, "HDstrcmp"); @@ -264,7 +264,7 @@ test_refstr_wrap(void) /* Get pointer to raw string in ref-counted string */ s=H5RS_get_str(rs); - CHECK(s, NULL, "H5RS_get_str"); + CHECK_PTR(s, "H5RS_get_str"); CHECK(s, buf, "wrapping"); cmp=HDstrcmp(s,buf); if(cmp<=0) @@ -299,16 +299,16 @@ test_refstr_own(void) /* Initialize buffer */ s = (char *)H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1); - CHECK(s, NULL, "H5FL_BLK_MALLOC"); + CHECK_PTR(s, "H5FL_BLK_MALLOC"); HDstrcpy(s, "foo"); /* Transfer ownership of dynamically allocated string to ref-counted string */ rs=H5RS_own(s); - CHECK(rs, NULL, "H5RS_own"); + CHECK_PTR(rs, "H5RS_own"); /* Get pointer to raw string in ref-counted string */ t=H5RS_get_str(rs); - CHECK(t, NULL, "H5RS_get_str"); + CHECK_PTR(t, "H5RS_get_str"); VERIFY(t, s, "transferring"); cmp=HDstrcmp(s,t); VERIFY(cmp, 0, "HDstrcmp"); @@ -322,7 +322,7 @@ test_refstr_own(void) /* Get pointer to raw string in ref-counted string */ t=H5RS_get_str(rs); - CHECK(t, NULL, "H5RS_get_str"); + CHECK_PTR(t, "H5RS_get_str"); VERIFY(t, s, "transferring"); cmp=HDstrcmp(t,s); VERIFY(cmp, 0, "HDstrcmp"); diff --git a/test/tselect.c b/test/tselect.c index 85c21bb..2022a11 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -228,9 +228,9 @@ test_select_hyper(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; islist, &j); - CHECK(obj_ret, NULL, "H5SL_remove"); + CHECK_PTR(obj_ret, "H5SL_remove"); obj_ret->nfrees++; obj_list->nobjs_rem--; } /* end else */ @@ -1324,7 +1324,7 @@ test_skiplist_try_free_safe(void) /* Create a skip list */ obj_list.slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(obj_list.slist, NULL, "H5SL_create"); + CHECK_PTR(obj_list.slist, "H5SL_create"); /* Init obj_list.list */ obj_list.list = list; @@ -1396,7 +1396,7 @@ test_skiplist_less(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<10; u++) { @@ -1430,7 +1430,7 @@ test_skiplist_less(void) VERIFY(*found_item,5,"H5SL_less"); find_item=4; found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(found_item,NULL,"H5SL_less"); + CHECK_PTR_NULL(found_item, "H5SL_less"); /* Close the skip list */ ret=H5SL_close(slist); @@ -1460,7 +1460,7 @@ test_skiplist_greater(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1488,7 +1488,7 @@ test_skiplist_greater(void) VERIFY(*found_item, 90, "H5SL_greater"); find_item = 100; found_item = (unsigned *)H5SL_greater(slist, &find_item); - VERIFY(found_item, NULL, "H5SL_greater"); + CHECK_PTR_NULL(found_item, "H5SL_greater"); find_item = 6; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, 10, "H5SL_greater"); @@ -1525,7 +1525,7 @@ test_skiplist_below(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1536,44 +1536,44 @@ test_skiplist_below(void) /* Check for exact match of items in various positions */ find_item = 20; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); find_item = 90; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); find_item = 5; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); /* Find item less than a missing key, in various positions */ find_item = 19; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 15, "H5SL_below"); find_item = 89; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 80, "H5SL_below"); find_item = 100; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 90, "H5SL_below"); find_item = 9; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 5, "H5SL_below"); find_item = 4; node = (H5SL_node_t *)H5SL_less(slist, &find_item); - VERIFY(node, NULL, "H5SL_below"); + CHECK_PTR_NULL(node, "H5SL_below"); /* Close the skip list */ ret = H5SL_close(slist); @@ -1604,7 +1604,7 @@ test_skiplist_above(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1615,42 +1615,42 @@ test_skiplist_above(void) /* Check for exact match of items in various positions */ find_item = 20; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); find_item = 90; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); find_item = 5; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); /* Find item greater than a missing key, in various positions */ find_item = 19; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 20, "H5SL_above"); find_item = 89; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 90, "H5SL_above"); find_item = 100; node = H5SL_above(slist, &find_item); - VERIFY(node, NULL, "H5SL_above"); + CHECK_PTR_NULL(node, "H5SL_above"); find_item = 6; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 10, "H5SL_above"); find_item = 4; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 5, "H5SL_above"); @@ -1681,7 +1681,7 @@ test_skiplist_remove_first(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1697,7 +1697,7 @@ test_skiplist_remove_first(void) /* Check for removing object from empty list */ found_item = (unsigned *)H5SL_remove_first(slist); - VERIFY(found_item, NULL, "H5SL_remove_first"); + CHECK_PTR_NULL(found_item, "H5SL_remove_first"); /* Close the skip list */ ret = H5SL_close(slist); @@ -1725,7 +1725,7 @@ test_skiplist_remove_first_many(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < NUM_ELEMS; u++) { @@ -1742,7 +1742,7 @@ test_skiplist_remove_first_many(void) /* Check for removing object from empty list */ found_item = (int *)H5SL_remove_first(slist); - VERIFY(found_item, NULL, "H5SL_remove_first"); + CHECK_PTR_NULL(found_item, "H5SL_remove_first"); /* Close the skip list */ ret = H5SL_close(slist); diff --git a/test/ttst.c b/test/ttst.c index b26d582..c5912c5 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -157,7 +157,7 @@ test_tst_create(void) /* Try creating a TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Try closing a real tree */ ret=H5ST_close(tree); @@ -186,7 +186,7 @@ test_tst_insert(void) /* Create the TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Insert unique words into TST, in random order */ for(u=0; ueqkid,uniq_words[u])) TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,uniq_words[u]); obj=H5ST_locate(tree,uniq_words[u]); - CHECK(obj, NULL, "H5ST_locate"); + CHECK_PTR(obj, "H5ST_locate"); if(HDstrcmp((const char *)obj,uniq_words[u])) TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,uniq_words[u]); @@ -246,7 +246,7 @@ test_tst_iterate(void) /* Create the TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Insert unique words into TST, in random order */ for(u=0; ueqkid,rand_uniq_words[u])) diff --git a/test/tvltypes.c b/test/tvltypes.c index 5121a66..0c4cb9d 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -1015,9 +1015,9 @@ test_vltypes_compound_vlen_vlen(void) /* Allocate and initialize VL data to write */ wdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1); - CHECK(wdata, NULL, "HDmalloc"); + CHECK_PTR(wdata, "HDmalloc"); rdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1); - CHECK(rdata, NULL, "HDmalloc"); + CHECK_PTR(rdata, "HDmalloc"); for(i = 0; i < SPACE3_DIM1; i++) { wdata[i].i = (int)(i * 10); wdata[i].f = (float)(i * 20) / 3.0F; @@ -2503,7 +2503,7 @@ test_vltypes_fill_value(void) /* Allocate space for the buffer to read data */ rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct)); - CHECK(rbuf, NULL, "HDmalloc"); + CHECK_PTR(rbuf, "HDmalloc"); /* Create the small & large dataspaces to use */ -- cgit v0.12