diff options
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 46 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 24 | ||||
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 8 | ||||
-rw-r--r-- | tools/h5dump/h5dump_xml.c | 136 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 800 | ||||
-rw-r--r-- | tools/h5jam/h5jamgentest.c | 20 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 46 | ||||
-rw-r--r-- | tools/h5repack/h5repack.c | 38 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 88 | ||||
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 6 | ||||
-rw-r--r-- | tools/h5repack/h5repack_opttable.c | 6 | ||||
-rw-r--r-- | tools/h5repack/h5repack_parse.c | 52 | ||||
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 248 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 80 | ||||
-rw-r--r-- | tools/h5stat/h5stat.c | 46 | ||||
-rw-r--r-- | tools/h5stat/h5stat_gentest.c | 50 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 14 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 64 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 42 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 10 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 92 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 14 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 6 |
23 files changed, 968 insertions, 968 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 78949c8..b29ed41 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -2829,7 +2829,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -2845,7 +2845,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -2860,7 +2860,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -2915,7 +2915,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -2960,7 +2960,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -3004,7 +3004,7 @@ static int test_group_recurse2(void) * dset1 */ dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -6192,9 +6192,9 @@ void write_dset_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); @@ -6230,7 +6230,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 = malloc( size ); + dbuf = HDmalloc( size ); for( j = 0; j < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; j++) dbuf[j] = j; @@ -6254,7 +6254,7 @@ void write_dset_in(hid_t loc_id, H5Dclose(did); H5Tclose(tid); H5Sclose(sid); - free( dbuf ); + HDfree( dbuf ); } /*------------------------------------------------------------------------- @@ -6697,10 +6697,10 @@ void gen_datareg(hid_t fid, int i; /* allocate the buffer for write the references */ - rbuf = calloc((size_t)2, sizeof(hdset_reg_ref_t)); + rbuf = HDcalloc((size_t)2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ - buf = malloc(10 * 10 * sizeof(int)); + buf = HDmalloc(10 * 10 * sizeof(int)); for(i = 0; i < 10 * 10; i++) buf[i] = i; @@ -6709,7 +6709,7 @@ void gen_datareg(hid_t fid, sid1 = H5Screate_simple(2, dims1, NULL); did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - assert(status >= 0); + HDassert(status >= 0); /* create the reference dataset */ sid2 = H5Screate_simple(1, dims2, NULL); @@ -6726,12 +6726,12 @@ void gen_datareg(hid_t fid, } status = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL); - assert(status >= 0); + HDassert(status >= 0); H5Sget_select_npoints(sid1); /* store first dataset region */ status = H5Rcreate(&rbuf[0], fid, "dsetref", H5R_DATASET_REGION, sid1); - assert(status >= 0); + HDassert(status >= 0); /* select sequence of five points for second reference */ coord[0][0]=6; coord[0][1]=9; @@ -6753,20 +6753,20 @@ void gen_datareg(hid_t fid, /* write */ status = H5Dwrite(did2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); - assert(status >= 0); + HDassert(status >= 0); /* close, free memory buffers */ status = H5Dclose(did1); - assert(status >= 0); + HDassert(status >= 0); status = H5Sclose(sid1); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did2); - assert(status >= 0); + HDassert(status >= 0); status = H5Sclose(sid2); - assert(status >= 0); + HDassert(status >= 0); - free(rbuf); - free(buf); + HDfree(rbuf); + HDfree(buf); } @@ -6846,7 +6846,7 @@ int test_hyperslab(const char *fname, } } - free(buf); + HDfree(buf); buf=NULL; /* close */ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 7421ddd..09dead0 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -847,26 +847,26 @@ free_handler(struct handler_t *hand, int len) if(hand) { for (i = 0; i < len; i++) { if(hand[i].obj) { - free(hand[i].obj); + HDfree(hand[i].obj); hand[i].obj=NULL; } if (hand[i].subset_info) { if(hand[i].subset_info->start.data) - free(hand[i].subset_info->start.data); + HDfree(hand[i].subset_info->start.data); if(hand[i].subset_info->stride.data) - free(hand[i].subset_info->stride.data); + HDfree(hand[i].subset_info->stride.data); if(hand[i].subset_info->count.data) - free(hand[i].subset_info->count.data); + HDfree(hand[i].subset_info->count.data); if(hand[i].subset_info->block.data) - free(hand[i].subset_info->block.data); + HDfree(hand[i].subset_info->block.data); - free(hand[i].subset_info); + HDfree(hand[i].subset_info); hand[i].subset_info=NULL; } } - free(hand); + HDfree(hand); } } @@ -1181,28 +1181,28 @@ parse_start: switch ((char)opt) { case 's': if (s->start.data) { - free(s->start.data); + HDfree(s->start.data); s->start.data = NULL; } parse_hsize_list(opt_arg, &s->start); break; case 'S': if (s->stride.data) { - free(s->stride.data); + HDfree(s->stride.data); s->stride.data = NULL; } parse_hsize_list(opt_arg, &s->stride); break; case 'c': if (s->count.data) { - free(s->count.data); + HDfree(s->count.data); s->count.data = NULL; } parse_hsize_list(opt_arg, &s->count); break; case 'k': if (s->block.data) { - free(s->block.data); + HDfree(s->block.data); s->block.data = NULL; } parse_hsize_list(opt_arg, &s->block); @@ -1629,7 +1629,7 @@ h5_fileaccess(void) HDmemset(memb_name, 0, sizeof memb_name); HDmemset(memb_addr, 0, sizeof memb_addr); - assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); + HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { memb_fapl[mt] = H5P_DEFAULT; memb_map[mt] = mt; diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 48f1396..c9e5571 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -181,7 +181,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -574,7 +574,7 @@ dump_named_datatype(hid_t tid, const char *name) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -751,7 +751,7 @@ dump_group(hid_t gid, const char *name) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -1351,7 +1351,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe } /* end else */ dump_indent += COL; - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index f21be3b..5b6cba1 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -73,7 +73,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -787,7 +787,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -820,7 +820,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* This should be defined somewhere else */ /* These 2 cases are handled the same right now, but probably will have something different eventually */ - char * dtxid = (char *)malloc(100); + char * dtxid = (char *)HDmalloc(100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -848,9 +848,9 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, dtxid, t_objname); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_objname); + HDfree(t_objname); } - free(dtxid); + HDfree(dtxid); } else { ctx.need_prefix = TRUE; @@ -1134,7 +1134,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); - free(mname); + HDfree(mname); size = H5Tget_size(type); h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); @@ -1183,8 +1183,8 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(mname); - free(t_fname); + HDfree(mname); + HDfree(t_fname); dump_indent += COL; ctx.indent_level++; @@ -1475,7 +1475,7 @@ xml_dump_datatype(hid_t type) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -1510,7 +1510,7 @@ xml_dump_datatype(hid_t type) if(found_obj) { /* Shared datatype, must be entered as an object */ /* These 2 cases are the same now, but may change */ - char *dtxid = (char *)malloc(100); + char *dtxid = (char *)HDmalloc(100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -1541,9 +1541,9 @@ xml_dump_datatype(hid_t type) h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />", xmlnsprefix, dtxid, t_objname); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_objname); + HDfree(t_objname); } - free(dtxid); + HDfree(dtxid); } else { ctx.need_prefix = TRUE; @@ -1614,7 +1614,7 @@ xml_dump_dataspace(hid_t space) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -1853,7 +1853,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU } else { h5tools_context_t datactx; - memset(&datactx, 0, sizeof(datactx)); + HDmemset(&datactx, 0, sizeof(datactx)); datactx.need_prefix = TRUE; datactx.indent_level = ctx.indent_level; datactx.cur_column = ctx.cur_column; @@ -1897,12 +1897,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU for (i = 0; i < ndims; i++) nelmts *= size[i]; - buf = malloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)))); - assert(buf); + buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)))); + HDassert(buf); if (H5Aread(obj_id, p_type, buf) >= 0) { h5tools_context_t datactx; - memset(&datactx, 0, sizeof(datactx)); + HDmemset(&datactx, 0, sizeof(datactx)); datactx.need_prefix = TRUE; datactx.indent_level = ctx.indent_level; datactx.cur_column = ctx.cur_column; @@ -1912,7 +1912,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU if (vl_data) H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); - free(buf); + HDfree(buf); H5Tclose(p_type); H5Sclose(space); H5Tclose(type); @@ -1991,7 +1991,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -2019,7 +2019,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_aname); + HDfree(t_aname); if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) { type = H5Aget_type(attr_id); @@ -2317,7 +2317,7 @@ xml_dump_named_datatype(hid_t type, const char *name) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -2542,7 +2542,7 @@ xml_dump_group(hid_t gid, const char *name) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -2595,11 +2595,11 @@ xml_dump_group(hid_t gid, const char *name) } else { char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)malloc(100); - char *parentxid = (char *)malloc(100); + char *grpxid = (char *)HDmalloc(100); + char *parentxid = (char *)HDmalloc(100); if(found_obj->displayed) { - char *ptrstr = (char *)malloc(100); + char *ptrstr = (char *)HDmalloc(100); /* already seen: enter a groupptr */ if(isRoot) { @@ -2631,8 +2631,8 @@ xml_dump_group(hid_t gid, const char *name) xmlnsprefix,t_name, grpxid, get_next_xid(), t_objname, parentxid, par_name); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_objname); - free(par_name); + HDfree(t_objname); + HDfree(par_name); ctx.indent_level++; @@ -2654,10 +2654,10 @@ xml_dump_group(hid_t gid, const char *name) ctx.indent_level--; - free(t_objname); - free(par_name); + HDfree(t_objname); + HDfree(par_name); } - free(ptrstr); + HDfree(ptrstr); } else { @@ -2691,8 +2691,8 @@ xml_dump_group(hid_t gid, const char *name) xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_tmp); - free(par_name); + HDfree(t_tmp); + HDfree(par_name); } found_obj->displayed = TRUE; @@ -2740,16 +2740,16 @@ xml_dump_group(hid_t gid, const char *name) dump_indent -= COL; ctx.indent_level--; } - free(t_name); - free(grpxid); - free(parentxid); + HDfree(t_name); + HDfree(grpxid); + HDfree(parentxid); } } else { /* only link -- must be first time! */ char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)malloc(100); - char *parentxid = (char *)malloc(100); + char *grpxid = (char *)HDmalloc(100); + char *parentxid = (char *)HDmalloc(100); ctx.need_prefix = TRUE; h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); @@ -2770,14 +2770,14 @@ xml_dump_group(hid_t gid, const char *name) h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" >", xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); - free(t_tmp); - free(par_name); + HDfree(t_tmp); + HDfree(par_name); } h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_name); - free(grpxid); - free(parentxid); + HDfree(t_name); + HDfree(grpxid); + HDfree(parentxid); /* 1. do all the attributes of the group */ @@ -2838,9 +2838,9 @@ xml_dump_group(hid_t gid, const char *name) h5tools_str_close(&buffer); if(par) - free(par); + HDfree(par); if(tmp) - free(tmp); + HDfree(tmp); } /*------------------------------------------------------------------------- @@ -2931,7 +2931,7 @@ xml_print_refs(hid_t did, int source) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -2975,7 +2975,7 @@ xml_print_refs(hid_t did, int source) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_path); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_path); + HDfree(t_path); } ctx.indent_level--; @@ -2984,14 +2984,14 @@ xml_print_refs(hid_t did, int source) h5tools_str_close(&buffer); - free(buf); + HDfree(buf); H5Tclose(type); H5Sclose(space); return SUCCEED; error: if(buf) - free(buf); + HDfree(buf); H5E_BEGIN_TRY { H5Tclose(type); @@ -3057,7 +3057,7 @@ xml_print_strs(hid_t did, int source) if((tsiz = H5Tget_size(type)) == 0) goto error; - buf = malloc((size_t)(ssiz * tsiz)); + buf = HDmalloc((size_t)(ssiz * tsiz)); if (buf == NULL) goto error; @@ -3073,7 +3073,7 @@ xml_print_strs(hid_t did, int source) if((tsiz = H5Tget_size(type)) == 0) goto error; - buf = malloc((size_t)(ssiz * tsiz)); + buf = HDmalloc((size_t)(ssiz * tsiz)); if (buf == NULL) goto error; @@ -3090,7 +3090,7 @@ xml_print_strs(hid_t did, int source) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -3141,7 +3141,7 @@ xml_print_strs(hid_t did, int source) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_onestring); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_onestring); + HDfree(t_onestring); } } bp += tsiz; @@ -3152,11 +3152,11 @@ xml_print_strs(hid_t did, int source) /* Reclaim any VL memory, if necessary */ if (!is_vlstr) if (onestring) - free(onestring); + HDfree(onestring); if (buf) { if (is_vlstr) H5Dvlen_reclaim(type, space, H5P_DEFAULT, buf); - free(buf); + HDfree(buf); } H5Tclose(type); H5Sclose(space); @@ -3164,7 +3164,7 @@ xml_print_strs(hid_t did, int source) error: if(buf) - free(buf); + HDfree(buf); H5E_BEGIN_TRY { H5Tclose(type); @@ -3206,7 +3206,7 @@ check_filters(hid_t dcpl) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -3346,7 +3346,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -3381,7 +3381,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent += COL; space = H5Tget_size(type); - buf = malloc((size_t) space); + buf = HDmalloc((size_t) space); H5Pget_fill_value(dcpl, type, buf); @@ -3414,7 +3414,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_path); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_path); + HDfree(t_path); } ctx.need_prefix = TRUE; @@ -3641,7 +3641,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) break; } } - free(buf); + HDfree(buf); ctx.indent_level--; dump_indent -= COL; @@ -3709,7 +3709,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -3764,7 +3764,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) /* Print information about storage layout */ if (H5D_CHUNKED == H5Pget_layout(dcpl)) { maxdims = H5Sget_simple_extent_ndims(space); - chsize = (hsize_t *) malloc(maxdims * sizeof(hsize_t)); + chsize = (hsize_t *) HDmalloc(maxdims * sizeof(hsize_t)); ctx.indent_level++; dump_indent += COL; @@ -3846,7 +3846,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; dump_indent -= COL; - free(chsize); + HDfree(chsize); } else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) { ctx.indent_level++; @@ -4291,7 +4291,7 @@ xml_print_enum(hid_t type) /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - memset(&ctx, 0, sizeof(ctx)); + HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; @@ -4391,7 +4391,7 @@ xml_print_enum(hid_t type) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", t_name); h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - free(t_name); + HDfree(t_name); ctx.indent_level--; ctx.need_prefix = TRUE; @@ -4447,10 +4447,10 @@ xml_print_enum(hid_t type) /* Release resources */ for (i = 0; i < nmembs; i++) - free(name[i]); + HDfree(name[i]); - free(name); - free(value); + HDfree(name); + HDfree(value); H5Tclose(super); } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 0fe9b69..f87f93a 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -257,24 +257,24 @@ typedef struct s1_t { #define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1) /* File 65 macros */ -#define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */ -#define THRESHOLD10 10 /* Free space section threshold */ +#define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */ +#define THRESHOLD10 10 /* Free space section threshold */ /* "FILE66" macros */ -#define F66_XDIM 8 +#define F66_XDIM 8 #define F66_DATASETU08 "DU08BITS" #define F66_DATASETS08 "DS08BITS" -#define F66_YDIM8 8 +#define F66_YDIM8 8 #define F66_DATASETU16 "DU16BITS" #define F66_DATASETS16 "DS16BITS" -#define F66_YDIM16 16 +#define F66_YDIM16 16 #define F66_DATASETU32 "DU32BITS" #define F66_DATASETS32 "DS32BITS" -#define F66_YDIM32 32 +#define F66_YDIM32 32 #define F66_DATASETU64 "DU64BITS" #define F66_DATASETS64 "DS64BITS" #define F66_YDIM64 64 -#define F66_DUMMYDBL "DummyDBL" +#define F66_DUMMYDBL "DummyDBL" static void gent_group(void) @@ -575,7 +575,7 @@ static int gent_softlink2(void) */ /* Create a new dataset as sample object */ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset1 < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); @@ -596,7 +596,7 @@ static int gent_softlink2(void) */ /* Create a new dataset as sample object */ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset2 < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); @@ -1950,9 +1950,9 @@ static void gent_objref(void) const char *write_comment = "Foo!"; /* Comments for group */ /* Allocate write & read buffers */ - wbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); - rbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); - tbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + wbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + rbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + tbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); /* Create file */ fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2031,9 +2031,9 @@ static void gent_objref(void) H5Fclose(fid1); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(tbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); } static void gent_datareg(void) @@ -2060,10 +2060,10 @@ static void gent_datareg(void) int i; /* counting variables */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf = (hdset_reg_ref_t*) malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); - dwbuf = (uint8_t*) malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - drbuf = (uint8_t*) calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); + dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Create file */ fid1 = H5Fcreate(FILE17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2137,10 +2137,10 @@ static void gent_datareg(void) H5Fclose(fid1); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(dwbuf); - free(drbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); } static void gent_attrreg(void) @@ -2169,10 +2169,10 @@ static void gent_attrreg(void) int i; /* counting variables */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf = (hdset_reg_ref_t*) malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); - dwbuf = (uint8_t*) malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - drbuf = (uint8_t*) calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); + dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Create file */ fid1 = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2257,10 +2257,10 @@ static void gent_attrreg(void) H5Fclose(fid1); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(dwbuf); - free(drbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); } /*taken from Elena's compound test file*/ @@ -2475,7 +2475,7 @@ static void gent_vldatatypes(void) for(i = 0; i < SPACE1_DIM1; i++) { int j; - wdata[i].p = malloc((i + 1) * sizeof(int)); + wdata[i].p = HDmalloc((i + 1) * sizeof(int)); wdata[i].len = i + 1; for(j = 0; j < i + 1; j++) @@ -2487,22 +2487,22 @@ static void gent_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_INT); dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space); - assert(ret >= 0); + HDassert(ret >= 0); /* Allocate and initialize VL dataset to write */ for(i = 0; i < SPACE1_DIM1; i++) { int j; - wdata[i].p = malloc((i + 1) * sizeof(float)); + wdata[i].p = HDmalloc((i + 1) * sizeof(float)); wdata[i].len = i + 1; for(j = 0; j < i + 1; j++) @@ -2514,19 +2514,19 @@ static void gent_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_FLOAT); dset = H5Dcreate2(file, "Dataset2.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space); - assert(ret >= 0); + HDassert(ret >= 0); /* Allocate and initialize a scalar VL dataset to write */ - adata.p = malloc(37 * sizeof(int)); + adata.p = HDmalloc(37 * sizeof(int)); adata.len = 37; for(i = 0; i < 37; i++) @@ -2537,18 +2537,18 @@ static void gent_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_INT); dset = H5Dcreate2(file, "Dataset3.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &adata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(file); - assert(ret >= 0); + HDassert(ret >= 0); } static void @@ -2566,14 +2566,14 @@ gent_vldatatypes2(void) /* Allocate and initialize VL data to write */ for(i = 0; i < SPACE1_DIM1; i++) { - wdata[i].p = (hvl_t *)malloc((i + 1) * sizeof(hvl_t)); + wdata[i].p = (hvl_t *)HDmalloc((i + 1) * sizeof(hvl_t)); if(wdata[i].p == NULL) { printf("Cannot allocate memory for VL data! i=%u\n", i); return; } /* end if */ wdata[i].len = i + 1; for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) { - t1->p = (unsigned *)malloc((j + 1) * sizeof(unsigned)); + t1->p = (unsigned *)HDmalloc((j + 1) * sizeof(unsigned)); if(t1->p == NULL) { printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); return; @@ -2601,23 +2601,23 @@ gent_vldatatypes2(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -2641,7 +2641,7 @@ static void gent_vldatatypes3(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].i=i*10; wdata[i].f=(float)((i*20)/3.0); - wdata[i].v.p=malloc((i+1)*sizeof(unsigned int)); + wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int)); wdata[i].v.len=i+1; for(j=0; j<(i+1); j++) ((unsigned int *)wdata[i].v.p)[j]=i*10+j; @@ -2661,34 +2661,34 @@ static void gent_vldatatypes3(void) /* Insert fields */ ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid2, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_vldatatypes4(void) @@ -2708,7 +2708,7 @@ static void gent_vldatatypes4(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].p=malloc((i+1)*sizeof(s1)); + wdata[i].p=HDmalloc((i+1)*sizeof(s1)); wdata[i].len=i+1; for(j=0; j<(i+1); j++) { ((s1 *)wdata[i].p)[j].i=i*10+j; @@ -2727,9 +2727,9 @@ static void gent_vldatatypes4(void) /* Insert fields */ ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a datatype to refer to */ tid1 = H5Tvlen_create(tid2); @@ -2739,23 +2739,23 @@ static void gent_vldatatypes4(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } /* Generate a variable-length dataset with NULL values in it */ @@ -2778,7 +2778,7 @@ static void gent_vldatatypes5(void) } /* end if */ else { wdata[i].len=i+5; - wdata[i].p=malloc(sizeof(unsigned)*(i+5)); + wdata[i].p=HDmalloc(sizeof(unsigned)*(i+5)); for(j=0; j<i+5; j++) ((unsigned *)wdata[i].p)[j]=j*2; } /* end else */ @@ -2786,37 +2786,37 @@ static void gent_vldatatypes5(void) /* Create file */ fid1 = H5Fcreate(FILE43, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid1>0); + HDassert(fid1>0); /* Create dataspace for datasets */ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); - assert(sid1>0); + HDassert(sid1>0); /* Create a datatype to refer to */ tid1 = H5Tvlen_create(H5T_NATIVE_UINT); - assert(tid1>0); + HDassert(tid1>0); /* Create a dataset */ dataset = H5Dcreate2(fid1, F43_DSETNAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(dataset>0); + HDassert(dataset>0); ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose (sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose (fid1); - assert(ret >= 0); + HDassert(ret >= 0); } /* This is big enough to make h5dump to use hyperslap to read @@ -2857,8 +2857,8 @@ static void gent_array1_big(void) block[0] = 1; /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - wdata = (int *)malloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM)); + wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + wdata = (int *)HDmalloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM)); /* Allocate and initialize array data to write */ for(i = 0; i < SPACE_ARRAY1BIG_DIM; i++) @@ -2882,7 +2882,7 @@ static void gent_array1_big(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /*--------------------------- * Region Reference dataset @@ -2906,17 +2906,17 @@ static void gent_array1_big(void) /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); /* Release memory */ - free(wbuf); - free(wdata); + HDfree(wbuf); + HDfree(wdata); } static void gent_array1(void) @@ -2950,17 +2950,17 @@ static void gent_array1(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array2(void) @@ -2996,17 +2996,17 @@ static void gent_array2(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array3(void) @@ -3047,19 +3047,19 @@ static void gent_array3(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array4(void) @@ -3097,35 +3097,35 @@ static void gent_array4(void) /* Insert integer field */ ret = H5Tinsert(tid2, "i", HOFFSET(s2_t, i), H5T_NATIVE_INT); - assert(ret >= 0); + HDassert(ret >= 0); /* Insert float field */ ret = H5Tinsert(tid2, "f", HOFFSET(s2_t, f), H5T_NATIVE_FLOAT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close compound datatype */ ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array5(void) @@ -3165,42 +3165,42 @@ static void gent_array5(void) /* Insert integer field */ ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create an array of floats datatype */ tid3 = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1); /* Insert float array field */ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3); - assert(ret >= 0); + HDassert(ret >= 0); /* Close array of floats field datatype */ ret = H5Tclose(tid3); - assert(ret >= 0); + HDassert(ret >= 0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close compound datatype */ ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array6(void) @@ -3219,7 +3219,7 @@ static void gent_array6(void) /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].p=malloc((i+j+1)*sizeof(unsigned int)); + wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int)); wdata[i][j].len=i+j+1; for(k=0; k<(i+j+1); k++) ((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k; @@ -3239,28 +3239,28 @@ static void gent_array6(void) /* Close VL datatype */ ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array7(void) @@ -3280,7 +3280,7 @@ static void gent_array7(void) /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].p=malloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1)); + wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1)); wdata[i][j].len=i+j+1; for(k=0; k<(i+j+1); k++) for(l=0; l<ARRAY1_DIM1; l++) @@ -3301,35 +3301,35 @@ static void gent_array7(void) /* Close nested array datatype */ ret = H5Tclose(tid3); - assert(ret >= 0); + HDassert(ret >= 0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close VL datatype */ ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } /* Test the boundary of the display output buffer at the reallocation event */ @@ -3406,30 +3406,30 @@ static void gent_empty(void) dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); /* write out an empty native integer dataset dataset */ dset = H5Dcreate2(file, "Dataset2.0", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); /* write out an empty native floating-point dataset dataset */ dset = H5Dcreate2(file, "Dataset3.0", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); /* write out an empty array dataset */ type = H5Tarray_create2(H5T_NATIVE_INT, SPACE1_RANK, dims); dset = H5Dcreate2(file, "Dataset4.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); /* write out an empty compound dataset */ type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct)); @@ -3439,15 +3439,15 @@ static void gent_empty(void) dset = H5Dcreate2(file, "Dataset5.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(file); - assert(ret >= 0); + HDassert(ret >= 0); } static void @@ -3611,7 +3611,7 @@ void gent_multi(void) HDmemset(memb_name, 0, sizeof memb_name); HDmemset(memb_addr, 0, sizeof memb_addr); - assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { memb_fapl[mt] = H5P_DEFAULT; @@ -3895,10 +3895,10 @@ static void write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = malloc(1 * sizeof(int)); + buf5[0].p = HDmalloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = malloc(2 * sizeof(int)); + buf5[1].p = HDmalloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -3906,9 +3906,9 @@ static void write_attr_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4006,7 +4006,7 @@ static void write_attr_in(hid_t loc_id, for(j = 0; j < 2; j++) { int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for(l = 0; l < i + 1; l++) ((int *)buf52[i][j].p)[l] = n++; @@ -4017,9 +4017,9 @@ static void write_attr_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf52); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); - assert(status >= 0); + HDassert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4138,7 +4138,7 @@ static void write_attr_in(hid_t loc_id, for(k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; for(l = 0; l < i + 1; l++) ((int *)buf53[i][j][k].p)[l] = n++; @@ -4150,9 +4150,9 @@ static void write_attr_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf53); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); - assert(status >= 0); + HDassert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4337,10 +4337,10 @@ static void write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); + buf5[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; buf5[1].len = 2; - buf5[1].p = malloc( 2 * sizeof(int)); + buf5[1].p = HDmalloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0]=2; ((int *)buf5[1].p)[1]=3; @@ -4348,9 +4348,9 @@ static void write_dset_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4448,7 +4448,7 @@ static void write_dset_in(hid_t loc_id, for(j = 0; j < 2; j++) { int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for(l = 0; l < i + 1; l++) ((int *)buf52[i][j].p)[l] = n++; @@ -4458,9 +4458,9 @@ static void write_dset_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4592,7 +4592,7 @@ static void write_dset_in(hid_t loc_id, for(k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; for(l = 0; l < i + 1; l++) ((int *)buf53[i][j][k].p)[l] = n++; @@ -4602,9 +4602,9 @@ static void write_dset_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4676,7 +4676,7 @@ static void gent_attr_all(void) sid = H5Screate_simple(1,dims,NULL); did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Sclose(sid); - assert(status >= 0); + HDassert(status >= 0); /* Create groups */ group_id = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -4701,17 +4701,17 @@ static void gent_attr_all(void) /* Close */ status = H5Dclose(did); - assert(status >= 0); + HDassert(status >= 0); status = H5Gclose(group_id); - assert(status >= 0); + HDassert(status >= 0); status = H5Gclose(group2_id); - assert(status >= 0); + HDassert(status >= 0); status = H5Gclose(root_id); - assert(status >= 0); + HDassert(status >= 0); /* Close file */ status = H5Fclose(fid); - assert(status >= 0); + HDassert(status >= 0); } @@ -4863,73 +4863,73 @@ static void gent_compound_complex(void) /* Create the dataspace */ dataspace = H5Screate_simple(F41_RANK, dim, NULL); - assert(dataspace >= 0); + HDassert(dataspace >= 0); /* Create the file */ datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(datafile >= 0); + HDassert(datafile >= 0); /* Copy the array data type for the string array */ array_tid = H5Tcopy (H5T_C_S1); - assert(array_tid >= 0); + HDassert(array_tid >= 0); /* Set the string array size to Variable */ status = H5Tset_size (array_tid,H5T_VARIABLE); - assert(status >= 0); + HDassert(status >= 0); /* Create the array data type for the string array */ str_array_id = H5Tarray_create2(array_tid, F41_ARRAY_RANK, array_dimb); - assert(str_array_id >= 0); + HDassert(str_array_id >= 0); /* Copy the array data type for the character array */ array1_tid = H5Tcopy (H5T_C_S1); - assert(array1_tid >= 0); + HDassert(array1_tid >= 0); /* Set the character array size */ status = H5Tset_size (array1_tid, F41_ARRAY_DIMc); - assert(status >= 0); + HDassert(status >= 0); /* Create the array data type for the character array */ array2_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F41_ARRAY_RANKd, array_dimd); - assert(array2_tid >= 0); + HDassert(array2_tid >= 0); /* Create the array data type for the character array */ array4_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F41_ARRAY_RANK, array_dimf); - assert(array4_tid >= 0); + HDassert(array4_tid >= 0); /* Create the memory data type */ Array1Structid = H5Tcreate (H5T_COMPOUND, sizeof(Array1Struct)); - assert(Array1Structid >= 0); + HDassert(Array1Structid >= 0); /* Insert the arrays and variables into the structure */ status = H5Tinsert(Array1Structid, "a_name", HOFFSET(Array1Struct, a), H5T_NATIVE_INT); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "b_name", HOFFSET(Array1Struct, b), str_array_id); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "c_name", HOFFSET(Array1Struct, c), array1_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "d_name", HOFFSET(Array1Struct, d), array2_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "e_name", HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "f_name", HOFFSET(Array1Struct, f), array4_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "g_name", HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR); - assert(status >= 0); + HDassert(status >= 0); /* Create the dataset */ dataset = H5Dcreate2(datafile, F41_DATASETNAME, Array1Structid, @@ -4938,35 +4938,35 @@ static void gent_compound_complex(void) /* Write data to the dataset */ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Array1); - assert(status >= 0); + HDassert(status >= 0); /* Release resources */ status = H5Tclose(Array1Structid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(array_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(array1_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(array2_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(array4_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(str_array_id); - assert(status >= 0); + HDassert(status >= 0); status = H5Sclose(dataspace); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(dataset); - assert(status >= 0); + HDassert(status >= 0); status = H5Fclose(datafile); - assert(status >= 0); + HDassert(status >= 0); } @@ -4983,7 +4983,7 @@ static void gent_named_dtype_attr(void) /* Create a file */ fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>0); + HDassert(fid>0); /*------------------------------------------------------------------------- * datatype @@ -4992,27 +4992,27 @@ static void gent_named_dtype_attr(void) /* Create a datatype to commit and use */ tid=H5Tcopy(H5T_NATIVE_INT); - assert(tid>0); + HDassert(tid>0); /* Commit datatype to file */ ret = H5Tcommit2(fid, F42_TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a hard link to the datatype */ ret = H5Lcreate_hard(fid, F42_TYPENAME, fid, F42_LINKNAME, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a scalar dataspace used for all objects */ sid = H5Screate(H5S_SCALAR); - assert(sid > 0); + HDassert(sid > 0); /* Create attribute on commited datatype */ aid = H5Acreate2(tid, F42_ATTRNAME, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(aid > 0); + HDassert(aid > 0); /* Write data into the attribute */ ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * dataset @@ -5021,15 +5021,15 @@ static void gent_named_dtype_attr(void) /* Create dataset */ did = H5Dcreate2(fid, F42_DSETNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(did > 0); + HDassert(did > 0); /* Create attribute on dataset */ aid = H5Acreate2(did, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(aid > 0); + HDassert(aid > 0); /* Write data into the attribute */ ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * group @@ -5038,15 +5038,15 @@ static void gent_named_dtype_attr(void) /* Create a group */ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(gid > 0); + HDassert(gid > 0); /* Create attribute on group */ aid = H5Acreate2(gid, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(aid > 0); + HDassert(aid > 0); /* Write data into the attribute */ ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * close @@ -5055,23 +5055,23 @@ static void gent_named_dtype_attr(void) /* Close attribute */ ret = H5Aclose(aid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close dataset */ ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); /* Close dataspace */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close datatype */ ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close file */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -5118,7 +5118,7 @@ static void gent_null_space(void) static void gent_zero_dim_size(void) { hid_t fid, root, dataset, space, attr; - hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2}; int dset_buf = 10; int point = 4; @@ -5208,25 +5208,25 @@ make_external(hid_t fid) dcpl = H5Pcreate(H5P_DATASET_CREATE); ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_external(dcpl, "ext2.bin", (off_t)0, size); - assert(ret >= 0); + HDassert(ret >= 0); sid = H5Screate_simple(1, cur_size, max_size); - assert(ret >= 0); + HDassert(ret >= 0); dsid = H5Dcreate2(fid, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); H5Dclose(dsid); - assert(ret >= 0); + HDassert(ret >= 0); H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); } /*------------------------------------------------------------------------- @@ -5259,7 +5259,7 @@ static void gent_filters(void) /* create a file */ fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); /* create a space */ sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); @@ -5273,34 +5273,34 @@ static void gent_filters(void) *------------------------------------------------------------------------- */ ret = H5Pset_layout(dcpl, H5D_COMPACT); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Oset_comment_by_name(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_layout(dcpl, H5D_CONTIGUOUS); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Oset_comment_by_name(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_layout(dcpl, H5D_CHUNKED); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Oset_comment_by_name(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * make several dataset with filters @@ -5309,7 +5309,7 @@ static void gent_filters(void) /* set up chunk */ ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * SZIP @@ -5319,14 +5319,14 @@ static void gent_filters(void) if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set szip data */ ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); } #endif /* H5_HAVE_FILTER_SZIP */ @@ -5337,14 +5337,14 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_DEFLATE) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set deflate data */ ret = H5Pset_deflate(dcpl, 9); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"deflate",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif @@ -5355,14 +5355,14 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_SHUFFLE) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set the shuffle filter */ ret = H5Pset_shuffle(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"shuffle",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif @@ -5373,14 +5373,14 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_FLETCHER32) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set the checksum filter */ ret = H5Pset_fletcher32(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fletcher32",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif /*------------------------------------------------------------------------- @@ -5390,16 +5390,16 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_NBIT) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set the checksum filter */ ret = H5Pset_nbit(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); tid=H5Tcopy(H5T_NATIVE_INT); H5Tset_precision(tid,H5Tget_size(tid)-1); ret=make_dset(fid,"nbit",sid,tid,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif /*------------------------------------------------------------------------- @@ -5409,14 +5409,14 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_SCALEOFFSET) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set the scaleoffset filter */ ret = H5Pset_scaleoffset(dcpl,H5Z_SO_INT,(int)H5Tget_size(H5T_NATIVE_INT)); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"scaleoffset",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif /*------------------------------------------------------------------------- @@ -5425,12 +5425,12 @@ static void gent_filters(void) */ /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); #if defined (H5_HAVE_FILTER_SHUFFLE) /* set the shuffle filter */ ret = H5Pset_shuffle(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); #endif #ifdef H5_HAVE_FILTER_SZIP @@ -5438,30 +5438,30 @@ static void gent_filters(void) szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK; /* set szip data */ ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); - assert(ret >= 0); + HDassert(ret >= 0); } #endif /* H5_HAVE_FILTER_SZIP */ #if defined (H5_HAVE_FILTER_DEFLATE) /* set deflate data */ ret = H5Pset_deflate(dcpl, 5); - assert(ret >= 0); + HDassert(ret >= 0); #endif #if defined (H5_HAVE_FILTER_FLETCHER32) /* set the checksum filter */ ret = H5Pset_fletcher32(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); #endif #if defined (H5_HAVE_FILTER_NBIT) /* set the nbit filter */ ret = H5Pset_nbit(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); #endif ret=make_dset(fid,"all",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- @@ -5470,20 +5470,20 @@ static void gent_filters(void) */ /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Zregister (H5Z_MYFILTER); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"myfilter",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * make an external dataset @@ -5496,27 +5496,27 @@ static void gent_filters(void) *------------------------------------------------------------------------- */ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"alloc_time_early",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * H5D_ALLOC_TIME_INCR *------------------------------------------------------------------------- */ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"alloc_time_incr",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * H5D_ALLOC_TIME_LATE *------------------------------------------------------------------------- */ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"alloc_time_late",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * commit a H5G_TYPE type with a comment @@ -5524,26 +5524,26 @@ static void gent_filters(void) */ tid = H5Tcopy(H5T_STD_B8LE); ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Oset_comment_by_name(fid, "mytype", "This is a commited datatype", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -5610,7 +5610,7 @@ static void gent_fcontents(void) /* create a file */ fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); write_dset(fid,1,dims,"dset",H5T_NATIVE_INT,buf); @@ -5642,30 +5642,30 @@ static void gent_fcontents(void) /* hard link to "dset" */ ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset3", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* hard link to "dset" */ ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset4", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* soft link to itself */ ret = H5Lcreate_soft("mylink", fid, "mylink", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* soft link to "dset" */ ret = H5Lcreate_soft("/dset", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* dangling external link */ ret = H5Lcreate_external("fname", "oname", fid, "extlink", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* dangling udlink */ ret = H5Lcreate_ud(fid, "udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * datatypes @@ -5673,20 +5673,20 @@ static void gent_fcontents(void) */ tid = H5Tcopy(H5T_NATIVE_INT); ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /* no name datatype */ tid = H5Tcopy(H5T_NATIVE_INT); ret = H5Tcommit2(fid, "mytype2", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); write_dset(fid, 1, dims, "dsetmytype2", tid, buf); ret = H5Ldelete(fid, "mytype2", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- @@ -5696,16 +5696,16 @@ static void gent_fcontents(void) ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); /* create a file for the bootblock test */ fid = H5Fcreate(FILE47, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } /*------------------------------------------------------------------------- @@ -5743,7 +5743,7 @@ static void gent_fvalues(void) /* create a file */ fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); /* create a space */ sid = H5Screate_simple(1, dims, NULL); @@ -5757,42 +5757,42 @@ static void gent_fvalues(void) *------------------------------------------------------------------------- */ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fill_time_ifset",sid,H5T_NATIVE_INT,dcpl,buf); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * H5D_FILL_TIME_NEVER *------------------------------------------------------------------------- */ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fill_time_never",sid,H5T_NATIVE_INT,dcpl,buf); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * H5D_FILL_TIME_ALLOC *------------------------------------------------------------------------- */ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fill_time_alloc",sid,H5T_NATIVE_INT,dcpl,buf); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * dataset with no fill value @@ -5809,23 +5809,23 @@ static void gent_fvalues(void) H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(c_t, b), H5T_NATIVE_DOUBLE); ret = H5Pset_fill_value(dcpl, tid, &fillval2); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fill_compound",sid,tid,dcpl,buf2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * dataset with a H5T_VLEN fill value *------------------------------------------------------------------------- */ buf3[0].len = 1; - buf3[0].p = malloc( 1 * sizeof(int)); + buf3[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf3[0].p)[0]=1; buf3[1].len = 2; - buf3[1].p = malloc(2 * sizeof(int)); + buf3[1].p = HDmalloc(2 * sizeof(int)); ((int *)buf3[1].p)[0] = 2; ((int *)buf3[1].p)[1] = 3; @@ -5834,17 +5834,17 @@ static void gent_fvalues(void) fillval3.p=NULL; fillval3.len=0; ret = H5Pset_fill_value(dcpl, tid, &fillval3); - assert(ret >= 0); + HDassert(ret >= 0); did = H5Dcreate2(fid, "fill_vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf3); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(did); ret = H5Tclose(tid); ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * dataset with a H5T_ARRAY fill value @@ -5860,9 +5860,9 @@ static void gent_fvalues(void) *------------------------------------------------------------------------- */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -5905,7 +5905,7 @@ static void gent_string(void) /* create a file */ fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); /*------------------------------------------------------------------------- * str1 @@ -5914,11 +5914,11 @@ static void gent_string(void) tid=H5Tcopy(H5T_C_S1); ret = H5Tset_size(tid, sizeof(buf1)); - assert(ret >= 0); + HDassert(ret >= 0); write_dset(fid,1,dims1,"str1",tid,buf1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * str2 @@ -5927,16 +5927,16 @@ static void gent_string(void) sid = H5Screate_simple(SPACE1_RANK, dims2, NULL); tid = H5Tcopy(H5T_C_S1); ret = H5Tset_size(tid, H5T_VARIABLE); - assert(ret >= 0); + HDassert(ret >= 0); did = H5Dcreate2(fid, "str2", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * str3 @@ -5949,13 +5949,13 @@ static void gent_string(void) H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_INT); H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid ); ret=make_dset(fid,"str3",sid,tid,H5P_DEFAULT,&buf3); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(str_tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * str4 @@ -5964,14 +5964,14 @@ static void gent_string(void) sid = H5Screate_simple(SPACE1_RANK, dims4, NULL); ret=make_dset(fid,"str4",sid,H5T_NATIVE_CHAR,H5P_DEFAULT,buf4); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -6014,7 +6014,7 @@ static void gent_aindices(void) /* create a file */ fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); /*------------------------------------------------------------------------- * root datasets @@ -6047,7 +6047,7 @@ static void gent_aindices(void) *------------------------------------------------------------------------- */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -6069,34 +6069,34 @@ static void gent_longlinks(void) /* Create files */ fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid >= 0); + HDassert(fid >= 0); /* Create group with short name in file (used as target for hard links) */ gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(gid >= 0); + HDassert(gid >= 0); /* Construct very long file name */ objname = (char*) HDmalloc((size_t)(F51_MAX_NAME_LEN + 1)); - assert(objname); + HDassert(objname); for(u = 0; u < F51_MAX_NAME_LEN; u++) objname[u] = 'a'; objname[F51_MAX_NAME_LEN] = '\0'; /* Create hard link to existing object */ - assert(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0); + HDassert(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0); /* Create soft link to existing object */ objname[0] = 'b'; - assert(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0); + HDassert(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0); /* Create group with long name in existing group */ gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(gid2 >= 0); + HDassert(gid2 >= 0); /* Close objects */ - assert(H5Gclose(gid2) >= 0); - assert(H5Gclose(gid) >= 0); - assert(H5Fclose(fid) >= 0); + HDassert(H5Gclose(gid2) >= 0); + HDassert(H5Gclose(gid) >= 0); + HDassert(H5Fclose(fid) >= 0); /* Release memory */ HDfree(objname); @@ -6246,7 +6246,7 @@ gent_bigdims(void) /* create a file */ fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid >= 0); + HDassert(fid >= 0); /* create dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -6272,7 +6272,7 @@ gent_bigdims(void) if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) goto out; - buf=(char *) malloc((unsigned)(nelmts*size)); + buf=(char *) HDmalloc((unsigned)(nelmts*size)); for(i=0, c=0; i<nelmts; i++, c++) { @@ -6285,7 +6285,7 @@ gent_bigdims(void) goto out; - free(buf); + HDfree(buf); buf=NULL; /* close */ @@ -6306,7 +6306,7 @@ gent_bigdims(void) did = -1; ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); return; @@ -6340,20 +6340,20 @@ gent_hyperslab(void) double *buf; int i, ret; - buf = (double*) malloc(32 * 4097 * sizeof(double) ); + buf = (double*) HDmalloc(32 * 4097 * sizeof(double) ); for(i = 0; i < 32 * 4097; i++) buf[i] = 1; /* create a file */ fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); - free(buf); + HDfree(buf); } /*------------------------------------------------------------------------- @@ -6918,14 +6918,14 @@ gent_extlinks(void) * Function: gent_fs_strategy_threshold * * Purpose: Generate a file with non-default file space strategy and - * non-default free-space section threshold. + * non-default free-space section threshold. *------------------------------------------------------------------------- */ static void gent_fs_strategy_threshold(void) { - hid_t fid; /* File id */ - hid_t fcpl; /* File creation property */ + hid_t fid; /* File id */ + hid_t fcpl; /* File creation property */ /* Create file-creation template */ fcpl = H5Pcreate(H5P_FILE_CREATE); @@ -6949,7 +6949,7 @@ gent_fs_strategy_threshold(void) * Three more datasets of 1, 2 and 4 bytes of signed int types are created. * Fill them with raw data such that no bit will be all zero in a dataset. * A dummy dataset of double type is created for failure test. - * Created: Albert Cheng, 2010/5/10. + * Created: Albert Cheng, 2010/5/10. * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes *------------------------------------------------------------------------- */ @@ -6976,13 +6976,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu8bits = (uint8_t) ~0u; /* all 1s */ + valu8bits = (uint8_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu8[i][0] = valu8bits; - for(j = 1; j < dims[1]; j++) { + dsetu8[i][0] = valu8bits; + for(j = 1; j < dims[1]; j++) { dsetu8[i][j] = dsetu8[i][j-1] << 1; - } - valu8bits <<= 1; + } + valu8bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); @@ -6994,13 +6994,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu16bits = (uint16_t) ~0u; /* all 1s */ + valu16bits = (uint16_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu16[i][0] = valu16bits; - for(j = 1; j < dims[1]; j++) { + dsetu16[i][0] = valu16bits; + for(j = 1; j < dims[1]; j++) { dsetu16[i][j] = dsetu16[i][j-1] << 1; - } - valu16bits <<= 1; + } + valu16bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); @@ -7012,13 +7012,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu32bits = (uint32_t) ~0u; /* all 1s */ + valu32bits = (uint32_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu32[i][0] = valu32bits; - for(j = 1; j < dims[1]; j++) { + dsetu32[i][0] = valu32bits; + for(j = 1; j < dims[1]; j++) { dsetu32[i][j] = dsetu32[i][j-1] << 1; - } - valu32bits <<= 1; + } + valu32bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); @@ -7048,13 +7048,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val8bits = (int8_t) ~0; /* all 1s */ + val8bits = (int8_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset8[i][0] = val8bits; - for(j = 1; j < dims[1]; j++) { + dset8[i][0] = val8bits; + for(j = 1; j < dims[1]; j++) { dset8[i][j] = dset8[i][j-1] << 1; - } - val8bits <<= 1; + } + val8bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); @@ -7066,13 +7066,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val16bits = (int16_t) ~0; /* all 1s */ + val16bits = (int16_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset16[i][0] = val16bits; - for(j = 1; j < dims[1]; j++) { + dset16[i][0] = val16bits; + for(j = 1; j < dims[1]; j++) { dset16[i][j] = dset16[i][j-1] << 1; - } - val16bits <<= 1; + } + val16bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); @@ -7084,13 +7084,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val32bits = (int32_t) ~0; /* all 1s */ + val32bits = (int32_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset32[i][0] = val32bits; - for(j = 1; j < dims[1]; j++) { + dset32[i][0] = val32bits; + for(j = 1; j < dims[1]; j++) { dset32[i][j] = dset32[i][j-1] << 1; - } - val32bits <<= 1; + } + val32bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index ec79215..c64053c 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -310,18 +310,18 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) { HDassert(ub_size <= BUF_SIZE); - fd = HDopen(filename, O_RDWR, 0); + fd = HDopen(filename, O_RDWR, 0); HDassert(fd >= 0); - /* fill buf with pattern */ - HDmemset(buf, '\0', ub_size); - bp = buf; - for (u = 0; u < ub_fill; u++) + /* fill buf with pattern */ + HDmemset(buf, '\0', ub_size); + bp = buf; + for (u = 0; u < ub_fill; u++) *bp++ = pattern[u % 10]; - HDwrite(fd, buf, ub_size); + HDwrite(fd, buf, ub_size); - HDclose(fd); + HDclose(fd); } } @@ -334,9 +334,9 @@ create_textfile(const char *name, size_t size) char *bp; fd = HDcreat(name,0777); - assert(fd >= 0); + HDassert(fd >= 0); buf = calloc(size, (size_t)1); - assert(buf); + HDassert(buf); /* fill buf with pattern */ bp = buf; @@ -345,7 +345,7 @@ create_textfile(const char *name, size_t size) HDwrite(fd, buf, size); - free(buf); + HDfree(buf); HDclose(fd); } diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 9668a22..9766170 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -828,7 +828,7 @@ display_cmpd_type(hid_t type, int ind) n = display_string(stdout, name, FALSE); printf("\"%*s +%-4lu ", MAX(0, 16-n), "", (unsigned long)H5Tget_member_offset(type, i)); - free(name); + HDfree(name); /* Member's type */ subtype = H5Tget_member_type(type, i); @@ -874,7 +874,7 @@ display_enum_type(hid_t type, int ind) if (H5T_ENUM!=H5Tget_class(type)) return FALSE; nmembs = H5Tget_nmembers(type); - assert(nmembs>0); + HDassert(nmembs>0); super = H5Tget_super(type); printf("enum "); display_type(super, ind+4); @@ -936,9 +936,9 @@ display_enum_type(hid_t type, int ind) } /* Release resources */ - for (i=0; i<nmembs; i++) free(name[i]); - free(name); - free(value); + for (i=0; i<nmembs; i++) HDfree(name[i]); + HDfree(name); + HDfree(value); H5Tclose(super); if (0==nmembs) printf("\n%*s <empty>", ind+4, ""); @@ -1113,7 +1113,7 @@ display_opaque_type(hid_t type, int ind) printf("\n%*s(tag = \"", ind, ""); display_string(stdout, tag, FALSE); printf("\")"); - free(tag); + HDfree(tag); } return TRUE; } @@ -1172,7 +1172,7 @@ display_array_type(hid_t type, int ind) if (H5T_ARRAY!=H5Tget_class(type)) return FALSE; ndims = H5Tget_array_ndims(type); if (ndims) { - dims = (hsize_t *)malloc(ndims*sizeof(dims[0])); + dims = (hsize_t *)HDmalloc(ndims*sizeof(dims[0])); H5Tget_array_dims2(type, dims); /* Print dimensions */ @@ -1180,7 +1180,7 @@ display_array_type(hid_t type, int ind) HDfprintf(stdout, "%s%Hu" , i?",":"[", dims[i]); putchar(']'); - free(dims); + HDfree(dims); } else { fputs(" [SCALAR]", stdout); } @@ -1908,7 +1908,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind) n = print_string(buffer, name, FALSE); h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16-n), "", (unsigned long)H5Tget_member_offset(type, i)); - free(name); + HDfree(name); /* Member's type */ subtype = H5Tget_member_type(type, i); @@ -1954,7 +1954,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) if (H5T_ENUM!=H5Tget_class(type)) return FALSE; nmembs = H5Tget_nmembers(type); - assert(nmembs>0); + HDassert(nmembs>0); super = H5Tget_super(type); h5tools_str_append(buffer, "enum "); print_type(buffer, super, ind+4); @@ -2017,9 +2017,9 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) } /* Release resources */ - for (i=0; i<nmembs; i++) free(name[i]); - free(name); - free(value); + for (i=0; i<nmembs; i++) HDfree(name[i]); + HDfree(name); + HDfree(value); H5Tclose(super); if (0==nmembs) h5tools_str_append(buffer, "\n%*s <empty>", ind+4, ""); @@ -2197,7 +2197,7 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind) h5tools_str_append(buffer, "\n%*s(tag = \"", ind, ""); print_string(buffer, tag, FALSE); h5tools_str_append(buffer, "\")"); - free(tag); + HDfree(tag); } return TRUE; } @@ -2256,15 +2256,15 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) if (H5T_ARRAY!=H5Tget_class(type)) return FALSE; ndims = H5Tget_array_ndims(type); if (ndims) { - dims = (hsize_t *)malloc(ndims*sizeof(dims[0])); + dims = (hsize_t *)HDmalloc(ndims*sizeof(dims[0])); H5Tget_array_dims2(type, dims); /* Print dimensions */ for (i=0; i<ndims; i++) - h5tools_str_append(buffer, "%s%"H5_PRINTF_LL_WIDTH"u" , i?",":"[", dims[i]); + h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT , i?",":"[", dims[i]); h5tools_str_append(buffer, "]"); - free(dims); + HDfree(dims); } else { h5tools_str_append(buffer, " [SCALAR]\n", stdout); @@ -2586,7 +2586,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, /* simple dataspace */ h5tools_str_append(&buffer, " {"); for (i=0; i<ndims; i++) { - h5tools_str_append(&buffer, "%s%"H5_PRINTF_LL_WIDTH"u", i?", ":"", size[i]); + h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i?", ":"", size[i]); nelmts *= size[i]; } h5tools_str_append(&buffer, "}\n"); @@ -2676,10 +2676,10 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, vl_data = TRUE; temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); - assert(temp_need == (hsize_t)((size_t)temp_need)); + HDassert(temp_need == (hsize_t)((size_t)temp_need)); need = (size_t)temp_need; - buf = malloc(need); - assert(buf); + buf = HDmalloc(need); + HDassert(buf); if(H5Aread(attr, p_type, buf) >= 0) { ctx.need_prefix = TRUE; ctx.indent_level = 2; @@ -2691,7 +2691,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, if (vl_data) H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); - free(buf); + HDfree(buf); H5Tclose(p_type); } /* end if */ fprintf(stdout, "\n"); @@ -3115,7 +3115,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tool_link_info_t lnk_info; /* init linkinfo struct */ - memset(&lnk_info, 0, sizeof(h5tool_link_info_t)); + HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); /* if verbose, make H5tools_get_symlink_info() display more */ if (verbose_g) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index a5fb47f..3b00327 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -90,7 +90,7 @@ int h5repack_init(pack_opt_t *options, int verbose, H5F_file_space_type_t strategy, hsize_t threshold) { int k, n; - memset(options,0,sizeof(pack_opt_t)); + HDmemset(options,0,sizeof(pack_opt_t)); options->min_comp = 1024; options->verbose = verbose; @@ -157,7 +157,7 @@ int h5repack_addfilter(const char* str, if(options->n_filter_g > H5_REPACK_MAX_NFILTERS) { error_msg("maximum number of filters exceeded for <%s>\n", str); - free(obj_list); + HDfree(obj_list); return -1; } @@ -166,7 +166,7 @@ int h5repack_addfilter(const char* str, else options_add_filter(obj_list, n_objs, filter, options->op_tbl); - free(obj_list); + HDfree(obj_list); return 0; } @@ -232,7 +232,7 @@ int h5repack_addlayout(const char* str, &pack, options->op_tbl); - free(obj_list); + HDfree(obj_list); return 0; } @@ -493,24 +493,24 @@ int copy_attr(hid_t loc_in, type_class = H5Tget_class(wtype_id); is_ref = (type_class == H5T_REFERENCE); if (type_class == H5T_VLEN ||type_class == H5T_ARRAY ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref = (is_ref || (H5Tget_class(base_type)==H5T_REFERENCE)); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref = (is_ref || (H5Tget_class(base_type)==H5T_REFERENCE)); + H5Tclose(base_type); } if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(wtype_id) ; - for (j=0; j<nmembers; j++) { - hid_t mtid = H5Tget_member_type( wtype_id, j ); - H5T_class_t mtclass = H5Tget_class(mtid); - H5Tclose(mtid); - - if (mtclass==H5T_REFERENCE) { - is_ref = 1; - break; - } - } /* for (j=0; i<nmembers; j++) */ + int nmembers = H5Tget_nmembers(wtype_id) ; + for (j=0; j<nmembers; j++) { + hid_t mtid = H5Tget_member_type( wtype_id, j ); + H5T_class_t mtclass = H5Tget_class(mtid); + H5Tclose(mtid); + + if (mtclass==H5T_REFERENCE) { + is_ref = 1; + break; + } + } /* for (j=0; i<nmembers; j++) */ } /* if (type_class == H5T_COMPOUND) */ if(is_ref) { diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 8b2a1aa..d96e08b 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -131,23 +131,23 @@ int copy_objects(const char* fnamein, goto out; } - if(!options->fs_strategy) - { - if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) - { - error_msg("failed to retrieve file space strategy\n"); - goto out; - } - } - - if(!options->fs_threshold) - { - if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) - { - error_msg("failed to retrieve file space threshold\n"); - goto out; - } - } + if(!options->fs_strategy) + { + if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) + { + error_msg("failed to retrieve file space strategy\n"); + goto out; + } + } + + if(!options->fs_threshold) + { + if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) + { + error_msg("failed to retrieve file space threshold\n"); + goto out; + } + } if(H5Pclose(fcpl_in) < 0) { @@ -348,28 +348,28 @@ int copy_objects(const char* fnamein, /* either use the FCPL already created or create a new one */ if(fcpl != H5P_DEFAULT) { - /* set file space strategy and free space threshold */ - if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) - { - error_msg("failed to set file space strategy & threshold\n"); - goto out; - } + /* set file space strategy and free space threshold */ + if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) + { + error_msg("failed to set file space strategy & threshold\n"); + goto out; + } } else { - /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - - /* set file space strategy and free space threshold */ - if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) - { - error_msg("failed to set file space strategy & threshold \n"); - goto out; - } + /* create a file creation property list */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + { + error_msg("fail to create a file creation property list\n"); + goto out; + } + + /* set file space strategy and free space threshold */ + if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) + { + error_msg("failed to set file space strategy & threshold \n"); + goto out; + } } /*------------------------------------------------------------------------- @@ -618,7 +618,7 @@ int do_copy_objects(hid_t fidin, { case H5TRAV_TYPE_UNKNOWN: - assert(0); + HDassert(0); break; /*------------------------------------------------------------------------- * H5TRAV_TYPE_GROUP @@ -921,7 +921,7 @@ int do_copy_objects(hid_t fidin, size = 1; sm_size[k - 1] = MIN(dims[k - 1], size); sm_nbytes *= sm_size[k - 1]; - assert(sm_nbytes > 0); + HDassert(sm_nbytes > 0); } sm_buf = HDmalloc((size_t)sm_nbytes); @@ -929,8 +929,8 @@ int do_copy_objects(hid_t fidin, sm_space = H5Screate_simple(1, &sm_nelmts, NULL); /* the stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); + HDmemset(hs_offset, 0, sizeof hs_offset); + HDmemset(zero, 0, sizeof zero); for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { @@ -1345,7 +1345,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) int status = 0; /* Return value */ /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ - assert(size > 0); + HDassert(size > 0); /* Open files */ if((infid = HDopen(infile, O_RDONLY, 0)) < 0) { @@ -1387,13 +1387,13 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) status = -1; goto done; } /* end if */ - assert(nwritten > 0); - assert(nwritten <= nbytes); + HDassert(nwritten > 0); + HDassert(nwritten <= nbytes); /* Update # of bytes left & offset in buffer */ nbytes -= nwritten; wbuf += nwritten; - assert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); + HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); } /* end while */ /* Update size of userblock left to transfer */ diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 7072d2d..6c7bc65 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -19,12 +19,12 @@ /* number of members in an array */ #ifndef NELMTS -# define NELMTS(X) (sizeof(X)/sizeof(X[0])) +# define NELMTS(X) (sizeof(X)/sizeof(X[0])) #endif /* minimum of two values */ #undef MIN -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) +#define MIN(a,b) (((a)<(b)) ? (a) : (b)) /*------------------------------------------------------------------------- * Function: aux_find_obj @@ -330,7 +330,7 @@ int apply_filters(const char* name, /* object name from traverse list */ size = 1; sm_size[i - 1] = MIN(dims[i - 1], size); sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); + HDassert(sm_nbytes > 0); } diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index 57b5fa7..01ee018 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -158,7 +158,7 @@ int options_table_init( pack_opttbl_t **tbl ) if(NULL == (table->objs = (pack_info_t*)malloc(table->size * sizeof(pack_info_t)))) { error_msg("not enough memory for options table\n"); - free(table); + HDfree(table); return -1; } @@ -182,8 +182,8 @@ int options_table_init( pack_opttbl_t **tbl ) int options_table_free( pack_opttbl_t *table ) { - free(table->objs); - free(table); + HDfree(table->objs); + HDfree(table); return 0; } diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index d3c6014..5258c4e 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -63,7 +63,7 @@ obj_list_t* parse_filter(const char *str, /* initialize compression info */ - memset(filt,0,sizeof(filter_info_t)); + HDmemset(filt,0,sizeof(filter_info_t)); *is_glb = 0; /* check for the end of object list and number of objects */ @@ -105,7 +105,7 @@ obj_list_t* parse_filter(const char *str, { if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; HDstrcpy(obj_list[n].obj,sobj); - memset(sobj,0,sizeof(sobj)); + HDmemset(sobj,0,sizeof(sobj)); n++; k=-1; } @@ -113,7 +113,7 @@ obj_list_t* parse_filter(const char *str, /* nothing after : */ if (end_obj+1==(int)len) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("input Error: Invalid compression type in <%s>\n",str); exit(EXIT_FAILURE); } @@ -151,7 +151,7 @@ obj_list_t* parse_filter(const char *str, } c = str[u]; if (!isdigit(c) && l==-1){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("compression parameter not digit in <%s>\n",str); exit(EXIT_FAILURE); } @@ -211,7 +211,7 @@ obj_list_t* parse_filter(const char *str, } c = str[u]; if (!isdigit(c) && l==-1){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("compression parameter is not a digit in <%s>\n",str); exit(EXIT_FAILURE); } @@ -255,7 +255,7 @@ obj_list_t* parse_filter(const char *str, { c = str[u]; if (!isdigit(c)){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("compression parameter is not a digit in <%s>\n",str); exit(EXIT_FAILURE); } @@ -301,7 +301,7 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 1; if (no_param) { /*no more parameters, GZIP must have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("missing compression parameter in <%s>\n",str); exit(EXIT_FAILURE); } @@ -317,7 +317,7 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SZIP must have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("missing compression parameter in <%s>\n",str); exit(EXIT_FAILURE); } @@ -333,7 +333,7 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 0; if (m>0) { /*shuffle does not have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("extra parameter in SHUF <%s>\n",str); exit(EXIT_FAILURE); } @@ -348,7 +348,7 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 0; if (m>0) { /*shuffle does not have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("extra parameter in FLET <%s>\n",str); exit(EXIT_FAILURE); } @@ -363,7 +363,7 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 0; if (m>0) { /*nbit does not have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("extra parameter in NBIT <%s>\n",str); exit(EXIT_FAILURE); } @@ -378,13 +378,13 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SOFF must have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("missing compression parameter in <%s>\n",str); exit(EXIT_FAILURE); } } else { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("invalid filter type in <%s>\n",str); exit(EXIT_FAILURE); } @@ -407,7 +407,7 @@ obj_list_t* parse_filter(const char *str, case H5Z_FILTER_DEFLATE: if (filt->cd_values[0]>9 ) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("invalid compression parameter in <%s>\n",str); exit(EXIT_FAILURE); } @@ -422,19 +422,19 @@ obj_list_t* parse_filter(const char *str, pixels_per_block=filt->cd_values[0]; if ((pixels_per_block%2)==1) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("pixels_per_block is not even in <%s>\n",str); exit(EXIT_FAILURE); } if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("pixels_per_block is too large in <%s>\n",str); exit(EXIT_FAILURE); } if ( (HDstrcmp(smask,"NN")!=0) && (HDstrcmp(smask,"EC")!=0) ) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("szip mask must be 'NN' or 'EC' \n"); exit(EXIT_FAILURE); } @@ -486,9 +486,9 @@ obj_list_t* parse_layout(const char *str, char slayout[10]; - memset(sdim, '\0', sizeof(sdim)); - memset(sobj, '\0', sizeof(sobj)); - memset(slayout, '\0', sizeof(slayout)); + HDmemset(sdim, '\0', sizeof(sdim)); + HDmemset(sobj, '\0', sizeof(sobj)); + HDmemset(slayout, '\0', sizeof(slayout)); /* check for the end of object list and number of objects */ for ( i=0, n=0; i<len; i++) @@ -526,7 +526,7 @@ obj_list_t* parse_layout(const char *str, { if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; HDstrcpy(obj_list[n].obj,sobj); - memset(sobj,0,sizeof(sobj)); + HDmemset(sobj,0,sizeof(sobj)); n++; k=-1; } @@ -535,7 +535,7 @@ obj_list_t* parse_layout(const char *str, /* nothing after : */ if (end_obj+1==(int)len) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("in parse layout, no characters after : in <%s>\n",str); exit(EXIT_FAILURE); } @@ -576,7 +576,7 @@ obj_list_t* parse_layout(const char *str, if (j>(int)len) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> Chunk dimensions missing\n",str); exit(EXIT_FAILURE); } @@ -590,7 +590,7 @@ obj_list_t* parse_layout(const char *str, if (!isdigit(c) && c!='x' && c!='N' && c!='O' && c!='N' && c!='E' ){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim,str); exit(EXIT_FAILURE); @@ -603,7 +603,7 @@ obj_list_t* parse_layout(const char *str, k=0; pack->chunk.chunk_lengths[c_index]=atoi(sdim); if (pack->chunk.chunk_lengths[c_index]==0) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim,str); exit(EXIT_FAILURE); @@ -621,7 +621,7 @@ obj_list_t* parse_layout(const char *str, { pack->chunk.chunk_lengths[c_index]=atoi(sdim); if (pack->chunk.chunk_lengths[c_index]==0){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim,str); exit(EXIT_FAILURE); diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 5c292c7..915b0e9 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -28,7 +28,7 @@ static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt); static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, trav_table_t *travt, hid_t fidout); static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, - hid_t fid_out, void *ref_out, trav_table_t *travt); + hid_t fid_out, void *ref_out, trav_table_t *travt); /*------------------------------------------------------------------------- * Function: do_copy_refobjs @@ -327,7 +327,7 @@ int do_copy_refobjs(hid_t fidin, goto error; } /* end else */ - assert(dset_out != FAIL); + HDassert(dset_out != FAIL); /*------------------------------------------------------------------------- * copy referenced objects in attributes @@ -432,13 +432,13 @@ error: * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Modifier: xcao@hdfgroup.org, 9/12/2011 - * Update values of references(object and region) for the following types: + * Update values of references(object and region) for the following types: * 1) References, * 2) ARRAY of reference, * 3) VLEN of references. * 4) COMPOUND of references. * This function does not handle references in other complicated structures, - * such as references in nested compound datatypes. + * such as references in nested compound datatypes. * * Date: October, 28, 2003 * @@ -479,7 +479,7 @@ static int copy_refs_attr(hid_t loc_in, for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { - is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; + is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -500,39 +500,39 @@ static int copy_refs_attr(hid_t loc_in, is_ref = (type_class == H5T_REFERENCE); if (type_class == H5T_VLEN ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE); - msize = H5Tget_size(base_type); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE); + msize = H5Tget_size(base_type); + H5Tclose(base_type); } if (type_class == H5T_ARRAY ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE); - msize = H5Tget_size(base_type); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE); + msize = H5Tget_size(base_type); + H5Tclose(base_type); } if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(ftype_id) ; - if (nmembers < 1) - goto error; + int nmembers = H5Tget_nmembers(ftype_id) ; + if (nmembers < 1) + goto error; ref_comp_index = (int *)HDmalloc(nmembers*sizeof (int)); ref_comp_size = (size_t *)HDmalloc(nmembers*sizeof(ref_comp_size)); ref_comp_field_n = 0; - for (i=0; i<(unsigned)nmembers; i++) { - hid_t mtid = H5Tget_member_type( ftype_id, i ); - if ((H5Tget_class(mtid)==H5T_REFERENCE)) { - ref_comp_index[ref_comp_field_n] = i; - ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid); - ref_comp_field_n++; - } - H5Tclose(mtid); - } + for (i=0; i<(unsigned)nmembers; i++) { + hid_t mtid = H5Tget_member_type( ftype_id, i ); + if ((H5Tget_class(mtid)==H5T_REFERENCE)) { + ref_comp_index[ref_comp_field_n] = i; + ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid); + ref_comp_field_n++; + } + H5Tclose(mtid); + } /* if compound don't contain reference type member, free the above * mallocs. Otherwise there can be memory leaks by the 'continue' @@ -541,14 +541,14 @@ static int copy_refs_attr(hid_t loc_in, { if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; + HDfree(ref_comp_index); + ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; + HDfree(ref_comp_size); + ref_comp_size = NULL; } } } @@ -556,10 +556,10 @@ static int copy_refs_attr(hid_t loc_in, is_ref_comp = (ref_comp_field_n > 0); if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) { - H5Tclose(mtype_id); - H5Tclose(ftype_id); - H5Aclose(attr_id); - continue; + H5Tclose(mtype_id); + H5Tclose(ftype_id); + H5Aclose(attr_id); + continue; } /* get name */ @@ -584,18 +584,18 @@ static int copy_refs_attr(hid_t loc_in, nelmts *= dims[j]; if (is_ref_array) { - unsigned array_rank = 0; - hsize_t array_size = 1; - hsize_t array_dims[H5S_MAX_RANK]; - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - msize = H5Tget_size(base_type); - H5Tclose(base_type); - - array_rank = H5Tget_array_ndims(mtype_id); - H5Tget_array_dims2(mtype_id, array_dims); + unsigned array_rank = 0; + hsize_t array_size = 1; + hsize_t array_dims[H5S_MAX_RANK]; + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + msize = H5Tget_size(base_type); + H5Tclose(base_type); + + array_rank = H5Tget_array_ndims(mtype_id); + H5Tget_array_dims2(mtype_id, array_dims); for(j = 0; j <array_rank; j++) - array_size *= array_dims[j]; + array_size *= array_dims[j]; nelmts *= array_size; } @@ -626,7 +626,7 @@ static int copy_refs_attr(hid_t loc_in, for(i = 0; i < (unsigned)nelmts; i++) { if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0) - continue; + continue; if(options->verbose) printf("object <%s> reference created to <%s>\n", name, refname); } /* k */ @@ -657,13 +657,13 @@ static int copy_refs_attr(hid_t loc_in, for(i = 0; i < (unsigned)nelmts; i++) { if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0) - continue; + continue; if(options->verbose) printf("object <%s> region reference created to <%s>\n", name, refname); } } /* H5T_STD_REF_DSETREG */ else if (is_ref_vlen) { - /* handle VLEN of references */ + /* handle VLEN of references */ buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t))); refbuf = buf; /* reuse the read buffer for write */ @@ -677,31 +677,31 @@ static int copy_refs_attr(hid_t loc_in, if(H5Aread(attr_id, mtype_id, buf) < 0) goto error; - if (H5R_OBJ_REF_BUF_SIZE==msize) { - hobj_ref_t ref_out; - for (i=0; i<(unsigned)nelmts; i++) { - hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p; - for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { - if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); - } - } /* for (i=0; i<nelems; i++) */ - } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) { - - hdset_reg_ref_t ref_out; - for (i=0; i<(unsigned)nelmts; i++) { - hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p; - for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { - if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); - } - } /* for (i=0; i<nelems; i++) */ - } + if (H5R_OBJ_REF_BUF_SIZE==msize) { + hobj_ref_t ref_out; + for (i=0; i<(unsigned)nelmts; i++) { + hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p; + for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { + if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(&(ptr[j]), &ref_out, msize); + } + } /* for (i=0; i<nelems; i++) */ + } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) { + + hdset_reg_ref_t ref_out; + for (i=0; i<(unsigned)nelmts; i++) { + hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p; + for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { + if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(&(ptr[j]), &ref_out, msize); + } + } /* for (i=0; i<nelems; i++) */ + } } /* else if (is_ref_vlen) */ else if (is_ref_comp) { - /* handle ref fields in a compound */ + /* handle ref fields in a compound */ buf = HDmalloc((unsigned)(nelmts * msize)); refbuf = buf; /* reuse the read buffer for write */ @@ -716,22 +716,22 @@ static int copy_refs_attr(hid_t loc_in, goto error; for (i=0; i<(unsigned)nelmts; i++) { - for (j=0; j<(unsigned)ref_comp_field_n; j++) { - if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { - int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); - hobj_ref_t ref_out; - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* if */ - else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { - int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); - hdset_reg_ref_t ref_out; - if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* else if */ - } /* j */ + for (j=0; j<(unsigned)ref_comp_field_n; j++) { + if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { + int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); + hobj_ref_t ref_out; + if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); + } /* if */ + else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { + int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); + hdset_reg_ref_t ref_out; + if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); + } /* else if */ + } /* j */ } /* i */ } /* else if (is_ref_comp) */ @@ -739,11 +739,11 @@ static int copy_refs_attr(hid_t loc_in, goto error; if (is_ref_vlen && buf) - H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf); + H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf); } /* if (nelmts) */ if (refbuf == buf) - refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ + refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ if(buf) { HDfree(buf); @@ -756,13 +756,13 @@ static int copy_refs_attr(hid_t loc_in, } if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; + HDfree(ref_comp_index); + ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; + HDfree(ref_comp_size); + ref_comp_size = NULL; } if(H5Aclose(attr_out) < 0) @@ -785,16 +785,16 @@ static int copy_refs_attr(hid_t loc_in, return 0; error: - if(refbuf) - HDfree(refbuf); - if(buf) - HDfree(buf); + if(refbuf) + HDfree(refbuf); + if(buf) + HDfree(buf); if (ref_comp_index) - HDfree(ref_comp_index); + HDfree(ref_comp_index); if (ref_comp_size) - HDfree(ref_comp_size); + HDfree(ref_comp_size); H5E_BEGIN_TRY { H5Tclose(ftype_id); @@ -808,9 +808,9 @@ error: } /*------------------------------------------------------------------------- - * Function: MapIdToName + * Function: MapIdToName * - * Purpose: map a ID from a reference to a dataset name + * Purpose: map a ID from a reference to a dataset name * *------------------------------------------------------------------------- */ @@ -843,48 +843,48 @@ out: } /*------------------------------------------------------------------------- - * Function: Update_Ref_value + * Function: Update_Ref_value * - * Purpose: Update a reference value + * Purpose: Update a reference value * * Programmer: xcao@hdfgroup.org 9/12/2011 * *------------------------------------------------------------------------- */ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, - hid_t fid_out, void *ref_out, trav_table_t *travt) + hid_t fid_out, void *ref_out, trav_table_t *travt) { - herr_t ret = -1; - const char* ref_obj_name; - hid_t space_id=-1, ref_obj_id=-1; + herr_t ret = -1; + const char* ref_obj_name; + hid_t space_id=-1, ref_obj_id=-1; - ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); - if (ref_obj_id<0) - goto done; + ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); + if (ref_obj_id<0) + goto done; - ref_obj_name = MapIdToName(ref_obj_id, travt); - if (ref_obj_name == NULL) - goto done; + ref_obj_name = MapIdToName(ref_obj_id, travt); + if (ref_obj_name == NULL) + goto done; - if (ref_type == H5R_DATASET_REGION) { - space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); - if (space_id < 0) - goto done; - } + if (ref_type == H5R_DATASET_REGION) { + space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); + if (space_id < 0) + goto done; + } ret = H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id); if (ret < 0) - goto done; + goto done; - ret = 0; + ret = 0; done: H5E_BEGIN_TRY { - H5Sclose(space_id); - H5Oclose(ref_obj_id); + H5Sclose(space_id); + H5Oclose(ref_obj_id); } H5E_END_TRY; - return ret; + return ret; } diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index d0974b6..156038c 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -170,15 +170,15 @@ int main (void) { pack_opt_t pack_options; diff_opt_t diff_options; - hsize_t fs_size = 0; /* free space section threshold */ - H5F_file_space_type_t fs_type = H5F_FILE_SPACE_DEFAULT; /* file space handling strategy */ + hsize_t fs_size = 0; /* free space section threshold */ + H5F_file_space_type_t fs_type = H5F_FILE_SPACE_DEFAULT; /* file space handling strategy */ #if defined (H5_HAVE_FILTER_SZIP) int szip_can_encode = 0; #endif /* initialize */ - memset(&diff_options, 0, sizeof (diff_opt_t)); - memset(&pack_options, 0, sizeof (pack_opt_t)); + HDmemset(&diff_options, 0, sizeof (diff_opt_t)); + HDmemset(&pack_options, 0, sizeof (pack_opt_t)); /* run tests */ puts("Testing h5repack:"); @@ -938,7 +938,7 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { - /* fs_type = H5F_FILE_SPACE_AGGR_VFD; fs_size = 3 */ + /* fs_type = H5F_FILE_SPACE_AGGR_VFD; fs_size = 3 */ if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) GOERROR; if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0) @@ -1255,7 +1255,7 @@ int main (void) && defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE) if (szip_can_encode) { - /* fs_type = H5F_FILE_SPACE_VFD; fs_size = 4 */ + /* fs_type = H5F_FILE_SPACE_VFD; fs_size = 4 */ if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0) @@ -2956,31 +2956,31 @@ out: * * Purpose: create datasets with contiguous and chunked layouts: * - * contig_small: < 1k, fixed dims datspace - * chunked_small_fixed: < 1k, fixed dims dataspace + * contig_small: < 1k, fixed dims datspace + * chunked_small_fixed: < 1k, fixed dims dataspace * *------------------------------------------------------------------------- */ -#define S_DIM1 4 -#define S_DIM2 10 -#define CONTIG_S "contig_small" -#define CHUNKED_S_FIX "chunked_small_fixed" +#define S_DIM1 4 +#define S_DIM2 10 +#define CONTIG_S "contig_small" +#define CHUNKED_S_FIX "chunked_small_fixed" static int make_layout2(hid_t loc_id) { - hid_t contig_dcpl = -1; /* dataset creation property list */ + hid_t contig_dcpl = -1; /* dataset creation property list */ hid_t chunked_dcpl = -1; /* dataset creation property list */ - int i, j, n; /* Local index variables */ - int ret_value = -1; /* Return value */ - hid_t s_sid = -1; /* dataspace ID */ + int i, j, n; /* Local index variables */ + int ret_value = -1; /* Return value */ + hid_t s_sid = -1; /* dataspace ID */ - hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */ - hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */ + hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */ + hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */ - int s_buf[S_DIM1][S_DIM2]; /* Temporary buffer */ + int s_buf[S_DIM1][S_DIM2]; /* Temporary buffer */ for(i = n = 0; i < S_DIM1; i++) { for (j = 0; j < S_DIM2; j++) { @@ -3130,7 +3130,7 @@ int make_big(hid_t loc_id) if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) goto out; - free(buf); + HDfree(buf); buf=NULL; /* close */ @@ -3171,8 +3171,8 @@ int make_external(hid_t loc_id) hid_t sid=-1; hid_t dcpl; int buf[2]={1,2}; - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ hsize_t size; cur_size[0] = max_size[0] = 2; @@ -3255,7 +3255,7 @@ make_userblock(void) /* Write userblock data */ nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE); - assert(nwritten == USERBLOCK_SIZE); + HDassert(nwritten == USERBLOCK_SIZE); /* Close file */ HDclose(fd); @@ -3319,7 +3319,7 @@ verify_userblock( const char* filename) /* Read userblock data */ nread = HDread(fd, ub, (size_t)USERBLOCK_SIZE); - assert(nread == USERBLOCK_SIZE); + HDassert(nread == USERBLOCK_SIZE); /* Verify userblock data */ for(u = 0; u < USERBLOCK_SIZE; u++) @@ -3368,7 +3368,7 @@ make_userblock_file(void) /* write userblock data */ nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE); - assert(nwritten == USERBLOCK_SIZE); + HDassert(nwritten == USERBLOCK_SIZE); /* close file */ HDclose(fd); @@ -3693,7 +3693,7 @@ int write_dset_in(hid_t loc_id, H5Dclose(did); H5Tclose(tid); H5Sclose(sid); - free( dbuf ); + HDfree( dbuf ); } /*------------------------------------------------------------------------- @@ -3728,7 +3728,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf12, 'z', sizeof buf12); + HDmemset(buf12, 'z', sizeof buf12); } @@ -3749,7 +3749,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf22,0,sizeof buf22); + HDmemset(buf22,0,sizeof buf22); } if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) @@ -3779,7 +3779,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf32,0,sizeof buf32); + HDmemset(buf32,0,sizeof buf32); } if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) @@ -3871,7 +3871,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf62,0,sizeof buf62); + HDmemset(buf62,0,sizeof buf62); } @@ -3889,8 +3889,8 @@ int write_dset_in(hid_t loc_id, if(make_diffs) { - memset(buf72, 0, sizeof buf72); - memset(buf82, 0, sizeof buf82); + HDmemset(buf72, 0, sizeof buf72); + HDmemset(buf82, 0, sizeof buf82); } @@ -3930,7 +3930,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf13,'z',sizeof buf13); + HDmemset(buf13,'z',sizeof buf13); } if ((tid = H5Tcopy(H5T_C_S1)) < 0) @@ -4243,9 +4243,9 @@ int make_dset_reg_ref(hid_t loc_id) out: if(wbuf) - free(wbuf); + HDfree(wbuf); if(dwbuf) - free(dwbuf); + HDfree(dwbuf); H5E_BEGIN_TRY { @@ -4650,7 +4650,7 @@ int write_attr_in(hid_t loc_id, */ if (make_diffs) { - memset(buf12, 'z', sizeof buf12); + HDmemset(buf12, 'z', sizeof buf12); } /* @@ -4690,7 +4690,7 @@ int write_attr_in(hid_t loc_id, if (make_diffs) { - memset(buf22,0,sizeof buf22); + HDmemset(buf22,0,sizeof buf22); } /* @@ -4750,7 +4750,7 @@ int write_attr_in(hid_t loc_id, */ if (make_diffs) { - memset(buf32,0,sizeof buf32); + HDmemset(buf32,0,sizeof buf32); } /* @@ -4898,7 +4898,7 @@ int write_attr_in(hid_t loc_id, if (make_diffs) { - memset(buf62,0,sizeof buf62); + HDmemset(buf62,0,sizeof buf62); } /* buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; @@ -4984,7 +4984,7 @@ int write_attr_in(hid_t loc_id, if (make_diffs) { - memset(buf13,'z',sizeof buf13); + HDmemset(buf13,'z',sizeof buf13); } /* diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index c5f7df7..2155f95 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -319,7 +319,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) bin = ceil_log10((unsigned long)oi->num_attrs); if((bin + 1) > iter->attr_nbins) { iter->attr_bins = (unsigned long *)realloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); - assert(iter->attr_bins); + HDassert(iter->attr_bins); /* Initialize counts for intermediate bins */ while(iter->attr_nbins < bin) @@ -378,7 +378,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Get group information */ ret = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* Update link stats */ if(ginfo.nlinks < SIZE_SMALL_GROUPS) @@ -391,7 +391,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) if((bin + 1) > iter->group_nbins) { /* Allocate more storage for info about dataset's datatype */ iter->group_bins = (unsigned long *)realloc(iter->group_bins, (bin + 1) * sizeof(unsigned long)); - assert(iter->group_bins); + HDassert(iter->group_bins); /* Initialize counts for intermediate bins */ while(iter->group_nbins < bin) @@ -410,7 +410,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Update attribute metadata info */ ret = attribute_stats(iter, oi); - assert(ret >= 0); + HDassert(ret >= 0); return 0; } /* end group_stats() */ @@ -458,7 +458,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) iter->dset_ohdr_info.free_size += oi->hdr.space.free; did = H5Dopen2(iter->fid, name, H5P_DEFAULT); - assert(did > 0); + HDassert(did > 0); /* Update dataset metadata info */ iter->datasets_index_storage_size += oi->meta_size.obj.index_size; @@ -466,17 +466,17 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Update attribute metadata info */ ret = attribute_stats(iter, oi); - assert(ret >= 0); + HDassert(ret >= 0); /* Get storage info */ storage = H5Dget_storage_size(did); /* Gather layout statistics */ dcpl = H5Dget_create_plist(did); - assert(dcpl > 0); + HDassert(dcpl > 0); lout = H5Pget_layout(dcpl); - assert(lout >= 0); + HDassert(lout >= 0); /* Object header's total size for H5D_COMPACT layout includes raw data size */ /* "storage" also includes H5D_COMPACT raw data size */ @@ -499,10 +499,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Gather dataspace statistics */ sid = H5Dget_space(did); - assert(sid > 0); + HDassert(sid > 0); ndims = H5Sget_simple_extent_dims(sid, dims, NULL); - assert(ndims >= 0); + HDassert(ndims >= 0); /* Check for larger rank of dataset */ if((unsigned)ndims > iter->max_dset_rank) @@ -522,7 +522,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) if((bin + 1) > iter->dset_dim_nbins) { /* Allocate more storage for info about dataset's datatype */ iter->dset_dim_bins = (unsigned long *)realloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long)); - assert(iter->dset_dim_bins); + HDassert(iter->dset_dim_bins); /* Initialize counts for intermediate bins */ while(iter->dset_dim_nbins < bin) @@ -537,11 +537,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) } /* end if */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /* Gather datatype statistics */ tid = H5Dget_type(did); - assert(tid > 0); + HDassert(tid > 0); type_found = FALSE; for(u = 0; u < iter->dset_ntypes; u++) @@ -559,11 +559,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Allocate more storage for info about dataset's datatype */ iter->dset_type_info = (dtype_info_t *)realloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t)); - assert(iter->dset_type_info); + HDassert(iter->dset_type_info); /* Initialize information about datatype */ iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid); - assert(iter->dset_type_info[curr_ntype].tid > 0); + HDassert(iter->dset_type_info[curr_ntype].tid > 0); iter->dset_type_info[curr_ntype].count = 1; iter->dset_type_info[curr_ntype].named = 0; @@ -576,7 +576,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) (iter->dset_type_info[u].named)++; ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /* Track different filters */ if((nfltr = H5Pget_nfilters(dcpl)) >= 0) { @@ -594,10 +594,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) } /* endif nfltr */ ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); return 0; } /* end dataset_stats() */ @@ -628,7 +628,7 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi) /* Update attribute metadata info */ ret = attribute_stats(iter, oi); - assert(ret >= 0); + HDassert(ret >= 0); return 0; } /* end datatype_stats() */ @@ -744,7 +744,7 @@ freespace_stats(hid_t fid, iter_t *iter) if(NULL == (sect_info = (H5F_sect_info_t *)calloc((size_t)nsects, sizeof(H5F_sect_info_t)))) return(FAIL); nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info); - assert(nsects); + HDassert(nsects); } /* end else-if */ for(u = 0; u < (size_t)nsects; u++) { @@ -758,7 +758,7 @@ freespace_stats(hid_t fid, iter_t *iter) if(bin >= iter->sect_nbins) { /* Allocate more storage for section info */ iter->sect_bins = (unsigned long *)realloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long)); - assert(iter->sect_bins); + HDassert(iter->sect_bins); /* Initialize counts for intermediate bins */ while(iter->sect_nbins < bin) @@ -1651,7 +1651,7 @@ main(int argc, const char *argv[]) if(H5Fget_filesize(fid, &iter.filesize) < 0) warn_msg("Unable to retrieve file size\n"); - assert(iter.filesize != 0); + HDassert(iter.filesize != 0); /* Get storge info for file-level structures */ if(H5Fget_info2(fid, &finfo) < 0) @@ -1674,7 +1674,7 @@ main(int argc, const char *argv[]) if(H5Pget_file_space(fcpl, &iter.fs_strategy, &iter.fs_threshold) < 0) warn_msg("Unable to retrieve file space information\n"); - assert(iter.fs_strategy != 0 && iter.fs_strategy < H5F_FILE_SPACE_NTYPES); + HDassert(iter.fs_strategy != 0 && iter.fs_strategy < H5F_FILE_SPACE_NTYPES); /* get information for free-space sections */ if(freespace_stats(fid, &iter) < 0) diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c index e333128..7384963 100644 --- a/tools/h5stat/h5stat_gentest.c +++ b/tools/h5stat/h5stat_gentest.c @@ -26,12 +26,12 @@ #include <assert.h> #include "hdf5.h" -#define FILE "h5stat_newgrat.h5" -#define DATASET_NAME "DATASET_NAME" -#define GROUP_NAME "GROUP" -#define ATTR_NAME "ATTR" -#define NUM_GRPS 35000 -#define NUM_ATTRS 100 +#define FILE "h5stat_newgrat.h5" +#define DATASET_NAME "DATASET_NAME" +#define GROUP_NAME "GROUP" +#define ATTR_NAME "ATTR" +#define NUM_GRPS 35000 +#define NUM_ATTRS 100 /* * Generate 1.8 HDF5 file @@ -40,27 +40,27 @@ */ static void gen_file(void) { - hid_t fcpl; /* File creation property */ - hid_t fapl; /* File access property */ - hid_t file; /* File id */ - hid_t gid; /* Group id */ - hid_t type_id; /* Datatype id */ - hid_t space_id; /* Dataspace id */ - hid_t attr_id; /* Attribute id */ - hid_t dset_id; /* Dataset id */ - char name[30]; /* Group name */ - char attrname[30]; /* Attribute name */ - int ret; /* Return value */ - int i; /* Local index variable */ + hid_t fcpl; /* File creation property */ + hid_t fapl; /* File access property */ + hid_t file; /* File id */ + hid_t gid; /* Group id */ + hid_t type_id; /* Datatype id */ + hid_t space_id; /* Dataspace id */ + hid_t attr_id; /* Attribute id */ + hid_t dset_id; /* Dataset id */ + char name[30]; /* Group name */ + char attrname[30]; /* Attribute name */ + int ret; /* Return value */ + int i; /* Local index variable */ fapl = H5Pcreate(H5P_FILE_ACCESS); ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - assert(ret >= 0); + HDassert(ret >= 0); /* Set file space handling strategy */ fcpl = H5Pcreate(H5P_FILE_CREATE); ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); - assert(ret >= 0); + HDassert(ret >= 0); /* Create dataset */ file = H5Fcreate(FILE, H5F_ACC_TRUNC, fcpl, fapl); @@ -82,17 +82,17 @@ static void gen_file(void) sprintf(attrname, "%s%d", ATTR_NAME,i); attr_id = H5Acreate2(dset_id, attrname, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); ret = H5Aclose(attr_id); - assert(ret >= 0); + HDassert(ret >= 0); } /* end for */ ret = H5Dclose(dset_id); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space_id); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type_id); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(file); - assert(ret >= 0); + HDassert(ret >= 0); } int main(void) diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index be20ed4..4ffee2b 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -154,7 +154,7 @@ void print_manager_output(void) } fflush(stdout); - memset(outBuff, 0, OUTBUFF_SIZE); + HDmemset(outBuff, 0, OUTBUFF_SIZE); outBuffOffset = 0; } else if( (outBuffOffset>0) && !g_Parallel) @@ -189,7 +189,7 @@ static void print_incoming_data(void) MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status); if(incomingMessage) { - memset(data, 0, PRINT_DATA_MAX_SIZE+1); + HDmemset(data, 0, PRINT_DATA_MAX_SIZE+1); MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); printf("%s", data); @@ -531,7 +531,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, const char *ext_path; /* init linkinfo struct */ - memset(&lnk_info, 0, sizeof(h5tool_link_info_t)); + HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); if (!opts->follow_links) { @@ -1474,7 +1474,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } /* end if */ h5diffdebug("done with if block\n"); - free(workerTasks); + HDfree(workerTasks); } #endif /* H5_HAVE_PARALLEL */ @@ -1938,7 +1938,7 @@ hsize_t diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_DATASET: - /* verbose (-v) and report (-r) mode */ + /* verbose (-v) and report (-r) mode */ if(options->m_verbose || options->m_report) { do_print_objname("dataset", path1, path2, options); @@ -1950,7 +1950,7 @@ hsize_t diff(hid_t file1_id, { nfound = diff_dataset(file1_id, file2_id, path1, path2, options); } - /* the rest (-c, none, ...) */ + /* the rest (-c, none, ...) */ else { nfound = diff_dataset(file1_id, file2_id, path1, path2, options); @@ -1958,7 +1958,7 @@ hsize_t diff(hid_t file1_id, if (nfound) { do_print_objname("dataset", path1, path2, options); - print_found(nfound); + print_found(nfound); } } break; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 91b94b8..6437809 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -137,7 +137,7 @@ static int not_comparable; is_zero=1; \ } -# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) +# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) /*------------------------------------------------------------------------- * local prototypes @@ -260,7 +260,7 @@ hsize_t diff_array( void *_mem1, switch (type_class) { default: - assert(0); + HDassert(0); break; /*------------------------------------------------------------------------- @@ -440,10 +440,10 @@ hsize_t diff_datum(void *_mem1, switch (H5Tget_class(m_type)) { default: - assert(0); + HDassert(0); break; case H5T_TIME: - assert(0); + HDassert(0); break; /*------------------------------------------------------------------------- @@ -705,7 +705,7 @@ hsize_t diff_datum(void *_mem1, size = H5Tget_size(memb_type); ndims = H5Tget_array_ndims(m_type); H5Tget_array_dims2(m_type, adims); - assert(ndims >= 1 && ndims <= H5S_MAX_RANK); + HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* calculate the number of array elements */ for (u = 0, nelmts = 1; u <ndims; u++) @@ -897,7 +897,7 @@ hsize_t diff_datum(void *_mem1, { char temp1_char; char temp2_char; - assert(type_size==sizeof(char)); + HDassert(type_size==sizeof(char)); memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); /* -d and !-p */ @@ -993,7 +993,7 @@ hsize_t diff_datum(void *_mem1, { unsigned char temp1_uchar; unsigned char temp2_uchar; - assert(type_size==sizeof(unsigned char)); + HDassert(type_size==sizeof(unsigned char)); memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); @@ -1092,7 +1092,7 @@ hsize_t diff_datum(void *_mem1, { short temp1_short; short temp2_short; - assert(type_size==sizeof(short)); + HDassert(type_size==sizeof(short)); memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); @@ -1191,7 +1191,7 @@ hsize_t diff_datum(void *_mem1, { unsigned short temp1_ushort; unsigned short temp2_ushort; - assert(type_size==sizeof(short)); + HDassert(type_size==sizeof(short)); memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); @@ -1291,7 +1291,7 @@ hsize_t diff_datum(void *_mem1, { int temp1_int; int temp2_int; - assert(type_size==sizeof(int)); + HDassert(type_size==sizeof(int)); memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); @@ -1389,7 +1389,7 @@ hsize_t diff_datum(void *_mem1, { unsigned int temp1_uint; unsigned int temp2_uint; - assert(type_size==sizeof(int)); + HDassert(type_size==sizeof(int)); memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); @@ -1487,7 +1487,7 @@ hsize_t diff_datum(void *_mem1, { long temp1_long; long temp2_long; - assert(type_size==sizeof(long)); + HDassert(type_size==sizeof(long)); memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); @@ -1587,7 +1587,7 @@ hsize_t diff_datum(void *_mem1, { unsigned long temp1_ulong; unsigned long temp2_ulong; - assert(type_size==sizeof(unsigned long)); + HDassert(type_size==sizeof(unsigned long)); memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); @@ -1686,7 +1686,7 @@ hsize_t diff_datum(void *_mem1, { long long temp1_llong; long long temp2_llong; - assert(type_size==sizeof(long long)); + HDassert(type_size==sizeof(long long)); memcpy(&temp1_llong, mem1, sizeof(long long)); memcpy(&temp2_llong, mem2, sizeof(long long)); @@ -1784,7 +1784,7 @@ hsize_t diff_datum(void *_mem1, { unsigned long long temp1_ullong; unsigned long long temp2_ullong; - assert(type_size==sizeof(unsigned long long)); + HDassert(type_size==sizeof(unsigned long long)); memcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); @@ -1904,7 +1904,7 @@ hsize_t diff_datum(void *_mem1, int isnan1=0; int isnan2=0; - assert(type_size==sizeof(float)); + HDassert(type_size==sizeof(float)); memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); @@ -2117,7 +2117,7 @@ hsize_t diff_datum(void *_mem1, int isnan1=0; int isnan2=0; - assert(type_size==sizeof(double)); + HDassert(type_size==sizeof(double)); memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); @@ -2332,7 +2332,7 @@ hsize_t diff_datum(void *_mem1, int isnan2=0; - assert(type_size==sizeof(long double)); + HDassert(type_size==sizeof(long double)); memcpy(&temp1_double, mem1, sizeof(long double)); memcpy(&temp2_double, mem2, sizeof(long double)); @@ -2668,13 +2668,13 @@ hsize_t diff_region(hid_t obj1_id, */ if(nblocks1 > 0) { alloc_size = nblocks1 * ndims1 * 2 * sizeof(ptdata1[0]); - assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - ptdata1 = malloc((size_t)alloc_size); + ptdata1 = HDmalloc((size_t)alloc_size); H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1); - ptdata2 = malloc((size_t)alloc_size); + ptdata2 = HDmalloc((size_t)alloc_size); H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region2_id, (hsize_t)0, (hsize_t)nblocks2, ptdata2); @@ -2723,13 +2723,13 @@ hsize_t diff_region(hid_t obj1_id, */ if(npoints1 > 0) { alloc_size = npoints1 * ndims1 * sizeof(ptdata1[0]); - assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - ptdata1 = malloc((size_t)alloc_size); + ptdata1 = HDmalloc((size_t)alloc_size); H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t); H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1); - ptdata2 = malloc((size_t)alloc_size); + ptdata2 = HDmalloc((size_t)alloc_size); H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t); H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2); @@ -5591,7 +5591,7 @@ int ull2float(unsigned long long ull_value, float *f_value) memcpy(f_value, buf, dst_size); if(buf) - free(buf); + HDfree(buf); return 0; @@ -5600,7 +5600,7 @@ error: H5Pclose(dxpl_id); } H5E_END_TRY; if(buf) - free(buf); + HDfree(buf); return -1; } @@ -5774,13 +5774,13 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) /*------------------------------------------------------------------------- - * Function: my_isnan + * Function: my_isnan * - * Purpose: Determines whether VAL points to NaN. + * Purpose: Determines whether VAL points to NaN. * - * Return: TRUE or FALSE + * Return: TRUE or FALSE * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 6, 1998 * * Modifications: @@ -5995,7 +5995,7 @@ void print_pos( int *ph, /* print header */ pos[i] = curr_pos/acc[i]; curr_pos -= acc[i]*pos[i]; } - assert( curr_pos == 0 ); + HDassert( curr_pos == 0 ); if ( rank > 0 ) { @@ -6048,7 +6048,7 @@ void print_char_pos( int *ph, /* print header */ pos[i] = curr_pos/acc[i]; curr_pos -= acc[i]*pos[i]; } - assert( curr_pos == 0 ); + HDassert( curr_pos == 0 ); parallel_print("[ " ); if ( rank > 0 ) diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 03ec067..bfb8429 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -409,7 +409,7 @@ hsize_t diff_datasetid( hid_t did1, options, name1, name2, m_tid1, did1, did2); /* reclaim any VL memory, if necessary */ - if(vl_data) { + if(vl_data) { H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); } /* end if */ @@ -445,27 +445,27 @@ hsize_t diff_datasetid( hid_t did1, size = 1; sm_size[i - 1] = MIN(dims1[i - 1], size); sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); + HDassert(sm_nbytes > 0); } /* end for */ - /* malloc return code should be verified. + /* malloc return code should be verified. * If fail, need to handle the error. * This else branch should be recoded as a separate function. * Note that there are many "goto error" within this branch * that fails to address freeing other objects created here. - * E.g., sm_space. - */ - sm_buf1 = malloc((size_t)sm_nbytes); - assert(sm_buf1); - sm_buf2 = malloc((size_t)sm_nbytes); - assert(sm_buf2); + * E.g., sm_space. + */ + sm_buf1 = HDmalloc((size_t)sm_nbytes); + HDassert(sm_buf1); + sm_buf2 = HDmalloc((size_t)sm_nbytes); + HDassert(sm_buf2); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); /* the stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); + HDmemset(hs_offset, 0, sizeof hs_offset); + HDmemset(zero, 0, sizeof zero); for(elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ @@ -529,19 +529,19 @@ hsize_t diff_datasetid( hid_t did1, /* free */ if(buf1 != NULL) { - free(buf1); + HDfree(buf1); buf1 = NULL; } /* end if */ if(buf2 != NULL) { - free(buf2); + HDfree(buf2); buf2 = NULL; } /* end if */ if(sm_buf1 != NULL) { - free(sm_buf1); + HDfree(sm_buf1); sm_buf1 = NULL; } /* end if */ if(sm_buf2 != NULL) { - free(sm_buf2); + HDfree(sm_buf2); sm_buf2 = NULL; } /* end if */ @@ -565,7 +565,7 @@ error: /* reclaim any VL memory, if necessary */ if(vl_data) H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); - free(buf1); + HDfree(buf1); buf1=NULL; } if (buf2!=NULL) @@ -573,7 +573,7 @@ error: /* reclaim any VL memory, if necessary */ if(vl_data) H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); - free(buf2); + HDfree(buf2); buf2=NULL; } if (sm_buf1!=NULL) @@ -581,7 +581,7 @@ error: /* reclaim any VL memory, if necessary */ if(vl_data) H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); - free(sm_buf1); + HDfree(sm_buf1); sm_buf1=NULL; } if (sm_buf2!=NULL) @@ -589,7 +589,7 @@ error: /* reclaim any VL memory, if necessary */ if(vl_data) H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); - free(sm_buf2); + HDfree(sm_buf2); sm_buf2=NULL; } @@ -695,7 +695,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ *------------------------------------------------------------------------- */ - assert(tclass1==tclass2); + HDassert(tclass1==tclass2); switch (tclass1) { case H5T_INTEGER: @@ -784,7 +784,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ *------------------------------------------------------------------------- */ - assert(rank1==rank2); + HDassert(rank1==rank2); for ( i=0; i<rank1; i++) { if (maxdim1 && maxdim2) diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index d3d386d..ef32cde 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1027,7 +1027,7 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) { int i; - assert(ctx->ndims); + HDassert(ctx->ndims); ctx->acc[ctx->ndims - 1] = 1; for (i = (ctx->ndims - 2); i >= 0; i--) { @@ -1362,7 +1362,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) size = H5Tget_size(memb); ndims = H5Tget_array_ndims(tid); H5Tget_array_dims2(tid, dims); - assert(ndims >= 1 && ndims <= H5S_MAX_RANK); + HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* calculate the number of array elements */ for (k = 0, nelmts = 1; k < ndims; k++) { @@ -1581,7 +1581,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); @@ -1708,7 +1708,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); alloc_size = npoints * ndims * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); @@ -1726,7 +1726,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, stream, container, ndims, type_id, npoints, ptdata); done: - free(ptdata); + HDfree(ptdata); if(H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 06e3b2e..98945aa 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -448,10 +448,10 @@ h5tools_print_region_data_blocks(hid_t region_id, h5tools_context_t ctx; void *region_buf = NULL; - assert(info); - assert(cur_ctx); - assert(buffer); - assert(ptdata); + HDassert(info); + HDassert(cur_ctx); + HDassert(buffer); + HDassert(ptdata); HDmemset(&ctx, 0, sizeof(ctx)); /* Get the dataspace of the dataset */ @@ -608,9 +608,9 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, hid_t type_id = -1; int i; - assert(info); - assert(ctx); - assert(buffer); + HDassert(info); + HDassert(ctx); + HDassert(buffer); if((nblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); @@ -634,7 +634,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_str_append(buffer, "REGION_TYPE BLOCK "); alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); @@ -650,12 +650,12 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) - h5tools_str_append(buffer, "%s%lu", j ? "," : "(", - (unsigned long) ptdata[i * 2 * ndims + j]); + h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, j ? "," : "(", + ptdata[i * 2 * ndims + j]); for (j = 0; j < ndims; j++) - h5tools_str_append(buffer, "%s%lu", j ? "," : ")-(", - (unsigned long) ptdata[i * 2 * ndims + j + ndims]); + h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, j ? "," : ")-(", + ptdata[i * 2 * ndims + j + ndims]); h5tools_str_append(buffer, ")"); } /* end for (i = 0; i < nblocks; i++) */ @@ -799,10 +799,10 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, void *region_buf = NULL; h5tools_context_t ctx; - assert(info); - assert(cur_ctx); - assert(buffer); - assert(ptdata); + HDassert(info); + HDassert(cur_ctx); + HDassert(buffer); + HDassert(ptdata); HDmemset(&ctx, 0, sizeof(ctx)); /* Allocate space for the dimension array */ @@ -929,9 +929,9 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, hid_t dtype; hid_t type_id; - assert(info); - assert(ctx); - assert(buffer); + HDassert(info); + HDassert(ctx); + HDassert(buffer); if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); @@ -955,7 +955,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, h5tools_str_append(buffer, "REGION_TYPE POINT "); alloc_size = npoints * ndims * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); @@ -970,8 +970,8 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx); for (loop_indx = 0; loop_indx < ndims; loop_indx++) - h5tools_str_append(buffer, "%s%lu", loop_indx ? "," : "(", - (unsigned long) (ptdata[indx * ndims + loop_indx])); + h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, loop_indx ? "," : "(", + ptdata[indx * ndims + loop_indx]); h5tools_str_append(buffer, ")"); } /* end for (indx = 0; indx < npoints; indx++) */ @@ -1196,10 +1196,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c size = 1; sm_size[i - 1] = MIN(total_size[i - 1], size); sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); + HDassert(sm_nbytes > 0); } - assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ + HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); @@ -1582,14 +1582,14 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont size = 1; sm_size[i - 1] = MIN(total_size[i - 1], size); sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); + HDassert(sm_nbytes > 0); } } if(!sm_nbytes) goto done; - assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ + HDassert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes); sm_nelmts = sm_nbytes / p_type_nbytes; @@ -1700,7 +1700,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte if (nelmts == 0) return SUCCEED; /*nothing to print*/ if (ctx->ndims > 0) { - assert(ctx->p_max_idx[ctx->ndims - 1] == (hsize_t) ((int) ctx->p_max_idx[ctx->ndims - 1])); + HDassert(ctx->p_max_idx[ctx->ndims - 1] == (hsize_t) ((int) ctx->p_max_idx[ctx->ndims - 1])); ctx->size_last_dim = (int) (ctx->p_max_idx[ctx->ndims - 1]); } /* end if */ else @@ -2390,7 +2390,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ if(H5Tget_array_dims2(type, dims) >= 0) { /* Print array dimensions */ for (i = 0; i < ndims; i++) - h5tools_str_append(buffer, "[%d]", (int) dims[i]); + h5tools_str_append(buffer, "[" HSIZE_T_FORMAT "]", dims[i]); h5tools_str_append(buffer, " "); } @@ -2461,12 +2461,12 @@ h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer, const h5tool_format case H5S_SIMPLE: /* simple dataspace */ - h5tools_str_append(buffer, "%s %s { %s %" H5_PRINTF_LL_WIDTH "u", + h5tools_str_append(buffer, "%s %s { %s " HSIZE_T_FORMAT, h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE, h5tools_dump_header_format->dataspacedimbegin, size[0]); for(i = 1; i < ndims; i++) - h5tools_str_append(buffer, ", %" H5_PRINTF_LL_WIDTH "u", size[i]); + h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, size[i]); h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend); @@ -2474,14 +2474,14 @@ h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer, const h5tool_format h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedimbegin, "H5S_UNLIMITED"); else - h5tools_str_append(buffer, "%s %" H5_PRINTF_LL_WIDTH "u", + h5tools_str_append(buffer, "%s " HSIZE_T_FORMAT, h5tools_dump_header_format->dataspacedimbegin, maxsize[0]); for(i = 1; i < ndims; i++) if(maxsize[i] == H5S_UNLIMITED) h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED"); else - h5tools_str_append(buffer, ", %" H5_PRINTF_LL_WIDTH "u", maxsize[i]); + h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, maxsize[i]); h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend); break; @@ -2539,7 +2539,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i if((snmembs = H5Tget_nmembers(type)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); nmembs = (unsigned)snmembs; - assert(nmembs > 0); + HDassert(nmembs > 0); if((super = H5Tget_super(type)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); @@ -2611,7 +2611,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" *strangely, unless use another pointer "copy".*/ copy = value + i * dst_size; - h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) ((void *) copy))); + h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long *) ((void *) copy))); } else { /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" @@ -2890,9 +2890,9 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "%s ", CHUNKED); rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); - h5tools_str_append(&buffer, "%s %" H5_PRINTF_LL_WIDTH "u", h5tools_dump_header_format->dataspacedimbegin, chsize[0]); + h5tools_str_append(&buffer, "%s " HSIZE_T_FORMAT, h5tools_dump_header_format->dataspacedimbegin, chsize[0]); for(i = 1; i < rank; i++) - h5tools_str_append(&buffer, ", %" H5_PRINTF_LL_WIDTH "u", chsize[i]); + h5tools_str_append(&buffer, ", " HSIZE_T_FORMAT, chsize[i]); h5tools_str_append(&buffer, " %s", h5tools_dump_header_format->dataspacedimend); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); @@ -2942,18 +2942,18 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, if(storage_size != 0) ratio = (double) uncomp_size / (double) storage_size; - h5tools_str_append(&buffer, "SIZE %" H5_PRINTF_LL_WIDTH "u (%.3f:1 COMPRESSION)", storage_size, ratio); + h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT" (%.3f:1 COMPRESSION)", storage_size, ratio); } else - h5tools_str_append(&buffer, "SIZE %" H5_PRINTF_LL_WIDTH "u", storage_size); + h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); H5Sclose(sid); H5Tclose(tid); } else { - h5tools_str_append(&buffer, "SIZE %" H5_PRINTF_LL_WIDTH "u", storage_size); + h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); } h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); @@ -2980,7 +2980,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "SIZE %" H5_PRINTF_LL_WIDTH "u", storage_size); + h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); ctx->indent_level--; @@ -3026,7 +3026,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "FILENAME %s SIZE %" H5_PRINTF_LL_WIDTH "u", name, size); + h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size); h5tools_str_append(&buffer, " OFFSET %ld", offset); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); } @@ -3062,7 +3062,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_str_append(&buffer,"SIZE %" H5_PRINTF_LL_WIDTH "u", storage_size); + h5tools_str_append(&buffer,"SIZE " HSIZE_T_FORMAT, storage_size); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); ctx->need_prefix = TRUE; @@ -3289,7 +3289,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_IFSET"); break; default: - assert(0); + HDassert(0); break; } h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); @@ -3346,7 +3346,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_LATE"); break; default: - assert(0); + HDassert(0); break; } h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); @@ -3823,11 +3823,11 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, nelmts *= size[i]; alloc_size = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); - assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ if(alloc_size) { buf = HDmalloc((size_t)alloc_size); - assert(buf); + HDassert(buf); if (H5Aread(obj_id, p_type, buf) >= 0) if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index e5e0d64..c3fbb1b 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -334,7 +334,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, ctx->pos[i] = curr_pos / ctx->acc[i]; curr_pos -= ctx->acc[i] * ctx->pos[i]; } - assert(curr_pos == 0); + HDassert(curr_pos == 0); /* Print the index values */ for (i = 0; i < (size_t) ndims; i++) { @@ -462,12 +462,12 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region, /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s%lu", j ? "," : "(", - (unsigned long) ptdata[i * 2 * ndims + j]); + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", + ptdata[i * 2 * ndims + j]); for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s%lu", j ? "," : ")-(", - (unsigned long) ptdata[i * 2 * ndims + j + ndims]); + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : ")-(", + ptdata[i * 2 * ndims + j + ndims]); h5tools_str_append(str, ")"); } @@ -522,8 +522,8 @@ h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region, (unsigned long)i); for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s%lu", j ? "," : "(", - (unsigned long) (ptdata[i * ndims + j])); + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", + (ptdata[i * ndims + j])); h5tools_str_append(str, ")"); } diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index c3cfddf..3bb8b3f 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -900,7 +900,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT); printf(" %-10s %s -> %s\n", "link", path, targbuf); - free(targbuf); + HDfree(targbuf); } /* end if */ else printf(" %-10s %s ->\n", "link", path); @@ -913,12 +913,12 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) const char *objname; targbuf = HDmalloc(linfo->u.val_size + 1); - assert(targbuf); + HDassert(targbuf); H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT); H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname); printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); - free(targbuf); + HDfree(targbuf); } /* end if */ else printf(" %-10s %s ->\n", "ext link", path); |