diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-07-27 20:43:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 20:43:30 (GMT) |
commit | 1e91d96fa02466ffe451319bdac1005f84dc7993 (patch) | |
tree | 4de04ef502c313dfd766497b20235188761146c0 /tools/src/h5repack | |
parent | 95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82 (diff) | |
download | hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.zip hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.gz hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.bz2 |
Brings over most of the HD prefix removal (#3293)
Diffstat (limited to 'tools/src/h5repack')
-rw-r--r-- | tools/src/h5repack/h5repack.c | 88 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_copy.c | 92 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 50 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_opttable.c | 14 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_parse.c | 116 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_refs.c | 117 |
6 files changed, 238 insertions, 239 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index c58943b..0ced980 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -71,7 +71,7 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest) { int k, n; - HDmemset(options, 0, sizeof(pack_opt_t)); + memset(options, 0, sizeof(pack_opt_t)); options->min_comp = 0; options->verbose = verbose; options->latest = latest; @@ -132,7 +132,7 @@ h5repack_addfilter(const char *str, pack_opt_t *options) n = options->n_filter_g++; /* increase # of global filters */ if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { error_msg("maximum number of filters exceeded for <%s>\n", str); - HDfree(obj_list); + free(obj_list); return -1; } @@ -141,7 +141,7 @@ h5repack_addfilter(const char *str, pack_opt_t *options) else options_add_filter(obj_list, n_objs, filter, options->op_tbl); - HDfree(obj_list); + free(obj_list); return 0; } /* end h5repack_addfilter() */ @@ -195,7 +195,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options) if (options->all_layout == 0) ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl); - HDfree(obj_list); + free(obj_list); ret_value = 0; } /* end if obj_list exists */ @@ -253,13 +253,13 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t for (i = 0; i < travt->nobjs; i++) { if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { /* Push onto the stack */ - if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) + if (NULL == (dt = (named_dt_t *)malloc(sizeof(named_dt_t)))) H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed"); dt->next = *named_dt_head_p; *named_dt_head_p = dt; /* Update the token/address and id */ - HDmemcpy(&dt->obj_token, &travt->objs[i].obj_token, sizeof(H5O_token_t)); + memcpy(&dt->obj_token, &travt->objs[i].obj_token, sizeof(H5O_token_t)); dt->id_out = H5I_INVALID_HID; /* Check if this type is the one requested */ @@ -276,13 +276,13 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t */ if (!dt_ret) { /* Push the new datatype onto the stack */ - if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) + if (NULL == (dt_ret = (named_dt_t *)malloc(sizeof(named_dt_t)))) H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed"); dt_ret->next = *named_dt_head_p; *named_dt_head_p = dt_ret; /* Update the token/address and id */ - HDmemcpy(&dt_ret->obj_token, &oinfo.token, sizeof(H5O_token_t)); + memcpy(&dt_ret->obj_token, &oinfo.token, sizeof(H5O_token_t)); dt_ret->id_out = H5I_INVALID_HID; } /* end if requested datatype not found */ @@ -330,7 +330,7 @@ named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) if (H5Tclose(dt->id_out) < 0 && !ignore_err) H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); dt = dt->next; - HDfree(*named_dt_head_p); + free(*named_dt_head_p); *named_dt_head_p = dt; } @@ -481,9 +481,9 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ *----------------------------------------------------------------- */ - buf = (void *)HDmalloc((size_t)(nelmts * msize)); + buf = (void *)malloc((size_t)(nelmts * msize)); if (buf == NULL) { - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (options->verbose == 2) { H5_timer_init(&timer); @@ -526,15 +526,15 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ if (TRUE == h5tools_detect_vlen(wtype_id)) H5Treclaim(wtype_id, space_id, H5P_DEFAULT, buf); - HDfree(buf); + free(buf); buf = NULL; } /*H5T_REFERENCE*/ if (options->verbose > 0) { if (options->verbose == 2) - HDprintf(FORMAT_OBJ_ATTR_TIME, "attr", read_time, write_time, name); + printf(FORMAT_OBJ_ATTR_TIME, "attr", read_time, write_time, name); else - HDprintf(FORMAT_OBJ_ATTR, "attr", name); + printf(FORMAT_OBJ_ATTR, "attr", name); } /*--------------------------------------------------------------------- @@ -566,7 +566,7 @@ done: H5Treclaim(wtype_id, space_id, H5P_DEFAULT, buf); /* Free buf */ - HDfree(buf); + free(buf); } H5Aclose(attr_out); @@ -602,7 +602,7 @@ check_options(pack_opt_t *options) */ if (options->verbose > 0 && have_request(options)) { if (options->all_layout == 1) { - HDprintf("All objects to modify layout are...\n"); + printf("All objects to modify layout are...\n"); switch (options->layout_g) { case H5D_COMPACT: strcpy(slayout, "compact"); @@ -624,17 +624,17 @@ check_options(pack_opt_t *options) strcpy(slayout, "invalid layout\n"); H5TOOLS_GOTO_DONE((-1)); } - HDprintf(" Apply %s layout to all", slayout); + printf(" Apply %s layout to all", slayout); if (H5D_CHUNKED == options->layout_g) { - HDprintf("with dimension [ "); + printf("with dimension [ "); for (j = 0; j < options->chunk_g.rank; j++) - HDprintf("%d ", (int)options->chunk_g.chunk_lengths[j]); - HDprintf("]"); + printf("%d ", (int)options->chunk_g.chunk_lengths[j]); + printf("]"); } - HDprintf("\n"); + printf("\n"); } else - HDprintf("No all objects to modify layout\n"); + printf("No all objects to modify layout\n"); } /* end if verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { @@ -642,16 +642,16 @@ check_options(pack_opt_t *options) if (options->op_tbl->objs[i].chunk.rank > 0) { if (options->verbose > 0) { - HDprintf(" <%s> with chunk size ", name); + printf(" <%s> with chunk size ", name); for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) - HDprintf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]); - HDprintf("\n"); + printf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]); + printf("\n"); } has_ck = 1; } else if (options->op_tbl->objs[i].chunk.rank == -2) { /* TODO: replace 'magic number' */ if (options->verbose > 0) - HDprintf(" <%s> %s\n", name, "NONE (contiguous)"); + printf(" <%s> %s\n", name, "NONE (contiguous)"); has_ck = 1; } } /* end for each object in options */ @@ -666,34 +666,34 @@ check_options(pack_opt_t *options) if (options->verbose > 0 && have_request(options)) { if (options->all_filter == 1) { - HDprintf("All objects to apply filter are...\n"); + printf("All objects to apply filter are...\n"); for (k = 0; k < options->n_filter_g; k++) { H5Z_filter_t filtn = options->filter_g[k].filtn; if (filtn < 0) { - HDprintf(" Unknown\n"); + printf(" Unknown\n"); continue; } switch (filtn) { case H5Z_FILTER_NONE: - HDprintf(" Uncompress all\n"); + printf(" Uncompress all\n"); break; case H5Z_FILTER_SHUFFLE: case H5Z_FILTER_FLETCHER32: - HDprintf(" All with %s\n", get_sfilter(filtn)); + printf(" All with %s\n", get_sfilter(filtn)); break; case H5Z_FILTER_SZIP: case H5Z_FILTER_DEFLATE: - HDprintf(" All with %s, parameter %d\n", get_sfilter(filtn), - options->filter_g[k].cd_values[0]); + printf(" All with %s, parameter %d\n", get_sfilter(filtn), + options->filter_g[k].cd_values[0]); break; default: - HDprintf(" User Defined %d\n", filtn); + printf(" User Defined %d\n", filtn); break; } /* end switch */ } /* end for each filter */ } /* end if options->all_filter == 1 (TODO: meaning) */ else - HDprintf("No all objects to apply filter\n"); + printf("No all objects to apply filter\n"); } /* end if verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { @@ -704,11 +704,11 @@ check_options(pack_opt_t *options) if (options->verbose > 0) { if (pack.filter[j].filtn >= 0) { if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) { - HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), - pack.filter[j].filtn); + printf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), + pack.filter[j].filtn); } else { - HDprintf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); + printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); } } } @@ -740,8 +740,8 @@ check_options(pack_opt_t *options) */ if (options->ublock_filename != NULL && options->ublock_size == 0) { if (options->verbose > 0) { - HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", - options->ublock_filename); + printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", + options->ublock_filename); options->ublock_size = 1024; } } @@ -813,21 +813,21 @@ check_objects(const char *fname, pack_opt_t *options) */ if (options->verbose > 0) - HDprintf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); + printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { pack_info_t obj = options->op_tbl->objs[i]; char *name = obj.path; if (options->verbose > 0) - HDprintf(" <%s>", name); + printf(" <%s>", name); /* the input object names are present in the file and are valid */ if (h5trav_getindext(name, travt) < 0) H5TOOLS_GOTO_ERROR((-1), "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose > 0 ? "\n" : ""), name, fname); if (options->verbose > 0) - HDprintf("...Found\n"); + printf("...Found\n"); for (ifil = 0; ifil < obj.nfilters; ifil++) { if (obj.filter[ifil].filtn < 0) @@ -854,7 +854,7 @@ check_objects(const char *fname, pack_opt_t *options) H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed"); - HDmemset(dims, 0, sizeof dims); + memset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); for (j = 0; j < rank; j++) @@ -866,7 +866,7 @@ check_objects(const char *fname, pack_opt_t *options) } if (csize < ppb) { - HDprintf(" <warning: SZIP settings, chunk size is smaller than pixels per block>\n"); + printf(" <warning: SZIP settings, chunk size is smaller than pixels per block>\n"); H5TOOLS_GOTO_DONE(0); } } /* end case SZIP */ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 42c393b..172ba26 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -299,7 +299,7 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options) *------------------------------------------------------------------------- */ if (options->verbose > 0) - HDprintf("Making new file ...\n"); + printf("Making new file ...\n"); if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, options->fout_fapl)) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Fcreate could not create file <%s>:", fnameout); @@ -658,7 +658,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti int ret_value = 0; /* init linkinfo struct */ - HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t)); + memset(&linkinfo, 0, sizeof(h5tool_link_info_t)); /*------------------------------------------------------------------------- * copy the supplied object list @@ -667,14 +667,14 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (options->verbose > 0) { if (options->verbose == 2) { - HDprintf("-----------------------------------------------------------------\n"); - HDprintf(" Type Filter (Compression) Timing read/write Name\n"); - HDprintf("-----------------------------------------------------------------\n"); + printf("-----------------------------------------------------------------\n"); + printf(" Type Filter (Compression) Timing read/write Name\n"); + printf("-----------------------------------------------------------------\n"); } else { - HDprintf("-----------------------------------------\n"); - HDprintf(" Type Filter (Compression) Name\n"); - HDprintf("-----------------------------------------\n"); + printf("-----------------------------------------\n"); + printf(" Type Filter (Compression) Name\n"); + printf("-----------------------------------------\n"); } } @@ -695,9 +695,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti case H5TRAV_TYPE_GROUP: if (options->verbose > 0) { if (options->verbose == 2) - HDprintf(FORMAT_OBJ_NOTIME, "group", travt->objs[i].name); + printf(FORMAT_OBJ_NOTIME, "group", travt->objs[i].name); else - HDprintf(FORMAT_OBJ, "group", travt->objs[i].name); + printf(FORMAT_OBJ, "group", travt->objs[i].name); } /* open input group */ @@ -877,7 +877,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed"); if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed"); - HDmemset(dims, 0, sizeof dims); + memset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); if (H5Dget_space_status(dset_in, &space_status) < 0) @@ -991,9 +991,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (dset_out == H5I_INVALID_HID) { H5TOOLS_INFO("H5Dcreate2 failed"); if (options->verbose > 0) - HDprintf(" warning: could not create dataset <%s>. Applying original " - "settings\n", - travt->objs[i].name); + printf(" warning: could not create dataset <%s>. Applying original " + "settings\n", + travt->objs[i].name); if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, @@ -1012,7 +1012,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti /* have to read the whole dataset if there is only one element in the * dataset */ if (need < H5TOOLS_MALLOCSIZE) - buf = HDmalloc(need); + buf = malloc(need); /* Set up collective write if using filters in parallel */ { @@ -1061,7 +1061,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */ - HDfree(buf); + free(buf); buf = NULL; } } @@ -1108,7 +1108,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti &hslab_nbytes) < 0) H5TOOLS_GOTO_ERROR((-1), "get_hyperslab failed"); - hslab_buf = HDmalloc((size_t)hslab_nbytes); + hslab_buf = malloc((size_t)hslab_nbytes); if (hslab_buf == NULL) H5TOOLS_GOTO_ERROR((-1), "can't allocate space for hyperslab"); @@ -1116,8 +1116,8 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); /* the hyperslab selection loop */ - HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset); - HDmemset(zero, 0, sizeof zero); + memset(hs_sel_offset, 0, sizeof hs_sel_offset); + memset(zero, 0, sizeof zero); for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) { if (rank > 0) { @@ -1189,7 +1189,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5Sclose(hslab_space); if (hslab_buf != NULL) { - HDfree(hslab_buf); + free(hslab_buf); hslab_buf = NULL; } } /* end if reading/writing by hyperslab */ @@ -1221,13 +1221,13 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti * (in case there was a filter) */ if (has_filter && apply_s == 0) - HDprintf(" <warning: filter not applied to %s. dataset smaller than " - "%d bytes>\n", - travt->objs[i].name, (int)options->min_comp); + printf(" <warning: filter not applied to %s. dataset smaller than " + "%d bytes>\n", + travt->objs[i].name, (int)options->min_comp); if (has_filter && apply_f == 0) - HDprintf(" <warning: could not apply the filter to %s>\n", - travt->objs[i].name); + printf(" <warning: could not apply the filter to %s>\n", + travt->objs[i].name); } /* end if verbose (print compression) */ /*------------------------------------------------------------------------- @@ -1310,9 +1310,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (options->verbose > 0) { if (options->verbose == 2) - HDprintf(FORMAT_OBJ_TIME, "dset", 0.0, write_time, travt->objs[i].name); + printf(FORMAT_OBJ_TIME, "dset", 0.0, write_time, travt->objs[i].name); else - HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name); + printf(FORMAT_OBJ, "dset", travt->objs[i].name); } } /* end whether we have request for filter/chunking */ @@ -1327,9 +1327,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti case H5TRAV_TYPE_NAMED_DATATYPE: if (options->verbose > 0) { if (options->verbose == 2) - HDprintf(FORMAT_OBJ_NOTIME, "type", travt->objs[i].name); + printf(FORMAT_OBJ_NOTIME, "type", travt->objs[i].name); else - HDprintf(FORMAT_OBJ, "type", travt->objs[i].name); + printf(FORMAT_OBJ, "type", travt->objs[i].name); } if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) @@ -1371,9 +1371,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti case H5TRAV_TYPE_UDLINK: if (options->verbose > 0) { if (options->verbose == 2) - HDprintf(FORMAT_OBJ_NOTIME, "link", travt->objs[i].name); + printf(FORMAT_OBJ_NOTIME, "link", travt->objs[i].name); else - HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); + printf(FORMAT_OBJ, "link", travt->objs[i].name); } /* Check -X option. */ @@ -1381,7 +1381,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (H5tools_get_symlink_info(fidin, travt->objs[i].name, &linkinfo, 1) == 0) { /* dangling link */ if (options->prune) { - HDprintf("Pruned %s.\n", travt->objs[i].name); + printf("Pruned %s.\n", travt->objs[i].name); } else { if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, @@ -1421,12 +1421,12 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + free(linkinfo.trg_path); linkinfo.trg_path = NULL; } /* options->merge */ else { if (options->prune) { - HDprintf("Pruned %s.\n", travt->objs[i].name); + printf("Pruned %s.\n", travt->objs[i].name); } else { if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, @@ -1460,7 +1460,7 @@ done: /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + free(linkinfo.trg_path); H5E_BEGIN_TRY { @@ -1484,9 +1484,9 @@ done: /* free */ if (buf != NULL) - HDfree(buf); + free(buf); if (hslab_buf != NULL) - HDfree(hslab_buf); + free(hslab_buf); return ret_value; } /* end do_copy_objects() */ @@ -1589,9 +1589,9 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_ if (!pr) if (options->verbose == 2) - HDprintf(FORMAT_OBJ_TIME, "dset", read_time, write_time, objname); + printf(FORMAT_OBJ_TIME, "dset", read_time, write_time, objname); else - HDprintf(FORMAT_OBJ, "dset", objname); + printf(FORMAT_OBJ, "dset", objname); else { char str[512], temp[512]; @@ -1600,9 +1600,9 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_ HDsnprintf(temp, sizeof(temp), " (%.3f:1)", ratio); HDstrcat(str, temp); if (options->verbose == 2) - HDprintf(FORMAT_OBJ_TIME, str, read_time, write_time, objname); + printf(FORMAT_OBJ_TIME, str, read_time, write_time, objname); else - HDprintf(FORMAT_OBJ, str, objname); + printf(FORMAT_OBJ, str, objname); } } /* end print_dataset_info() */ @@ -1654,13 +1654,13 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) } while (-1 == nwritten && EINTR == errno); if (-1 == nwritten) /* error */ H5TOOLS_GOTO_ERROR((-1), "HDwrite failed"); - HDassert(nwritten > 0); - HDassert(nwritten <= nbytes); + assert(nwritten > 0); + assert(nwritten <= nbytes); /* Update # of bytes left & offset in buffer */ nbytes -= nwritten; wbuf += nwritten; - HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); + assert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); } /* end while */ /* Update size of userblock left to transfer */ @@ -1728,9 +1728,9 @@ print_user_block(const char *filename, hid_t fid) for (i = 0; i < nread; i++) { - HDprintf("%c ", rbuf[i]); + printf("%c ", rbuf[i]); } - HDprintf("\n"); + printf("\n"); if (nread < 0) { H5TOOLS_GOTO_ERROR((-1), "nread < 0"); diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 5ecb423..0621c7a 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -370,7 +370,7 @@ static void leave(int ret) { h5tools_close(); - HDexit(ret); + exit(ret); } /*------------------------------------------------------------------------- @@ -391,7 +391,7 @@ read_info(const char *filename, pack_opt_t *options) int i; int ret_value = EXIT_SUCCESS; - if (NULL == (fp = HDfopen(filename, "r"))) { + if (NULL == (fp = fopen(filename, "r"))) { error_msg("cannot open options file %s\n", filename); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; @@ -534,10 +534,10 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) int ret_value = 0; /* Initialize fapl info structs */ - HDmemset(&in_vol_info, 0, sizeof(h5tools_vol_info_t)); - HDmemset(&out_vol_info, 0, sizeof(h5tools_vol_info_t)); - HDmemset(&in_vfd_info, 0, sizeof(h5tools_vfd_info_t)); - HDmemset(&out_vfd_info, 0, sizeof(h5tools_vfd_info_t)); + memset(&in_vol_info, 0, sizeof(h5tools_vol_info_t)); + memset(&out_vol_info, 0, sizeof(h5tools_vol_info_t)); + memset(&in_vfd_info, 0, sizeof(h5tools_vfd_info_t)); + memset(&out_vfd_info, 0, sizeof(h5tools_vfd_info_t)); /* parse command line options */ while (EOF != (opt = H5_get_option(argc, argv, s_opts, l_opts))) { @@ -569,7 +569,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) case 'v': if (H5_optarg != NULL) { - if (2 == HDatoi(H5_optarg)) + if (2 == atoi(H5_optarg)) options->verbose = 2; } else @@ -624,7 +624,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) break; case 'j': - bound = HDatoi(H5_optarg); + bound = atoi(H5_optarg); if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) { error_msg("in parsing low bound\n"); h5tools_setstatus(EXIT_FAILURE); @@ -635,7 +635,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) break; case 'k': - bound = HDatoi(H5_optarg); + bound = atoi(H5_optarg); if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) { error_msg("in parsing high bound\n"); h5tools_setstatus(EXIT_FAILURE); @@ -654,13 +654,13 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) break; case 'c': - options->grp_compact = HDatoi(H5_optarg); + options->grp_compact = atoi(H5_optarg); if (options->grp_compact > 0) options->latest = TRUE; /* must use latest format */ break; case 'd': - options->grp_indexed = HDatoi(H5_optarg); + options->grp_indexed = atoi(H5_optarg); if (options->grp_indexed > 0) options->latest = TRUE; /* must use latest format */ break; @@ -671,7 +671,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) char *msgPtr = HDstrchr(H5_optarg, ':'); options->latest = TRUE; /* must use latest format */ if (msgPtr == NULL) { - ssize = HDatoi(H5_optarg); + ssize = atoi(H5_optarg); for (idx = 0; idx < 5; idx++) options->msg_size[idx] = ssize; } @@ -680,7 +680,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) HDstrcpy(msgType, msgPtr + 1); msgPtr[0] = '\0'; - ssize = HDatoi(H5_optarg); + ssize = atoi(H5_optarg); if (!HDstrncmp(msgType, "dspace", 6)) options->msg_size[0] = ssize; else if (!HDstrncmp(msgType, "dtype", 5)) @@ -744,7 +744,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) } break; case 'P': - options->fs_persist = HDatoi(H5_optarg); + options->fs_persist = atoi(H5_optarg); if (options->fs_persist == 0) /* To distinguish the "specified" zero value */ options->fs_persist = -1; @@ -784,14 +784,14 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) case 'E': if (H5_optarg != NULL) - enable_error_stack = HDatoi(H5_optarg); + enable_error_stack = atoi(H5_optarg); else enable_error_stack = 1; break; case '1': in_vol_info.type = VOL_BY_VALUE; - in_vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); + in_vol_info.u.value = (H5VL_class_value_t)atoi(H5_optarg); custom_in_vol = TRUE; break; @@ -807,7 +807,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) case '4': out_vol_info.type = VOL_BY_VALUE; - out_vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg); + out_vol_info.u.value = (H5VL_class_value_t)atoi(H5_optarg); custom_out_vol = TRUE; break; @@ -823,7 +823,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) case '7': in_vfd_info.type = VFD_BY_VALUE; - in_vfd_info.u.value = (H5FD_class_value_t)HDatoi(H5_optarg); + in_vfd_info.u.value = (H5FD_class_value_t)atoi(H5_optarg); custom_in_vfd = TRUE; break; @@ -839,7 +839,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) case '0': out_vfd_info.type = VFD_BY_VALUE; - out_vfd_info.u.value = (H5FD_class_value_t)HDatoi(H5_optarg); + out_vfd_info.u.value = (H5FD_class_value_t)atoi(H5_optarg); custom_out_vfd = TRUE; break; @@ -891,7 +891,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options) errno = 0; onion_fa_in_g.revision_num = HDstrtoull(in_vfd_info.info, NULL, 10); if (errno == ERANGE) { - HDprintf("Invalid onion revision specified for the input file\n"); + printf("Invalid onion revision specified for the input file\n"); usage(h5tools_getprogname()); exit(EXIT_FAILURE); } @@ -965,7 +965,7 @@ main(int argc, char **argv) pack_opt_t options; /*the global options */ int parse_ret; - HDmemset(&options, 0, sizeof(pack_opt_t)); + memset(&options, 0, sizeof(pack_opt_t)); /* Initialize h5tools lib */ h5tools_init(); @@ -975,14 +975,14 @@ main(int argc, char **argv) /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ if (h5tools_getenv_update_hyperslab_bufsize() < 0) { - HDprintf("Error occurred while retrieving H5TOOLS_BUFSIZE value\n"); + printf("Error occurred while retrieving H5TOOLS_BUFSIZE value\n"); h5tools_setstatus(EXIT_FAILURE); goto done; } /* initialize options */ if (h5repack_init(&options, 0, FALSE) < 0) { - HDprintf("Error occurred while initializing repack options\n"); + printf("Error occurred while initializing repack options\n"); h5tools_setstatus(EXIT_FAILURE); goto done; } @@ -992,7 +992,7 @@ main(int argc, char **argv) parse_ret = parse_command_line(argc, (const char *const *)argv, &options); if (parse_ret < 0) { - HDprintf("Error occurred while parsing command-line options\n"); + printf("Error occurred while parsing command-line options\n"); h5tools_setstatus(EXIT_FAILURE); goto done; } @@ -1007,7 +1007,7 @@ main(int argc, char **argv) /* pack it */ if (h5repack(infile, outfile, &options) < 0) { - HDprintf("Error occurred while repacking\n"); + printf("Error occurred while repacking\n"); h5tools_setstatus(EXIT_FAILURE); goto done; } diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 4e6e0f4..2018527 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -104,7 +104,7 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs) int ret_value = 0; table->size += n_objs; - table->objs = (pack_info_t *)HDrealloc(table->objs, table->size * sizeof(pack_info_t)); + table->objs = (pack_info_t *)realloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs == NULL) { H5TOOLS_INFO("not enough memory for options table"); ret_value = -1; @@ -132,14 +132,14 @@ options_table_init(pack_opttbl_t **tbl) pack_opttbl_t *table; int ret_value = 0; - if (NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) { + if (NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t)))) { H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table"); } table->size = 30; table->nelems = 0; - if (NULL == (table->objs = (pack_info_t *)HDmalloc(table->size * sizeof(pack_info_t)))) { - HDfree(table); + if (NULL == (table->objs = (pack_info_t *)malloc(table->size * sizeof(pack_info_t)))) { + free(table); H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table"); } @@ -163,8 +163,8 @@ done: int options_table_free(pack_opttbl_t *table) { - HDfree(table->objs); - HDfree(table); + free(table->objs); + free(table); return 0; } @@ -200,7 +200,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pac /* already chunk info inserted for this one; exit */ if (table->objs[i].chunk.rank > 0) { H5TOOLS_INFO("chunk information already inserted for <%s>\n", obj_list[j].obj); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } /* insert the layout info */ else { diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index 9ffee0a..9ee4d07 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -52,7 +52,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t unsigned pixels_per_block; /* initialize compression info */ - HDmemset(filt, 0, sizeof(filter_info_t)); + memset(filt, 0, sizeof(filter_info_t)); *is_glb = 0; /* check for the end of object list and number of objects */ @@ -77,7 +77,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t else *n_objs = n; - obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t)); + obj_list = (obj_list_t *)malloc(n * sizeof(obj_list_t)); if (obj_list == NULL) { error_msg("could not allocate object list\n"); return NULL; @@ -95,7 +95,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t sobj[k + 1] = '\0'; HDstrcpy(obj_list[n].obj, sobj); - HDmemset(sobj, 0, sizeof(sobj)); + memset(sobj, 0, sizeof(sobj)); n++; k = -1; } @@ -103,9 +103,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t /* nothing after : */ if (end_obj + 1 == (int)len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("input Error: Invalid compression type in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } /* get filter additional parameters */ @@ -134,9 +134,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter not digit in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } if (l == -1) stype[m] = c; @@ -152,7 +152,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_values[j++] = H5_SZIP_EC_OPTION_MASK; else { error_msg("szip mask must be 'NN' or 'EC' \n"); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } } @@ -184,9 +184,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter is not a digit in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } if (l == -1) stype[m] = c; @@ -202,7 +202,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_values[j++] = H5Z_SO_FLOAT_DSCALE; else { error_msg("scale type must be 'IN' or 'DS' \n"); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } } @@ -224,7 +224,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t if (str[u] == ',') { stype[q] = '\0'; /* end digit */ if (l == -1) { - filt->filtn = HDatoi(stype); + filt->filtn = atoi(stype); l = 0; } else if (f == -1) { @@ -244,15 +244,15 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("filter number parameter is not a digit in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } else if (!HDisdigit(c) && f == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("filter flag parameter is not a digit in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } stype[q] = c; } /* for u */ @@ -269,9 +269,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c)) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter is not a digit in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } stype[m] = c; } /* u */ @@ -312,9 +312,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 1; if (no_param) { /*no more parameters, GZIP must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } @@ -327,9 +327,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SZIP must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } @@ -342,9 +342,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*shuffle does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in SHUF <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -356,9 +356,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*shuffle does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in FLET <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -370,9 +370,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*nbit does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in NBIT <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -384,9 +384,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SOFF must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -397,16 +397,16 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t /* parameters does not match count */ if (filt->cd_nelmts != j) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("incorrect number of compression parameters in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } else { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("invalid filter type in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } break; } @@ -425,9 +425,9 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t case H5Z_FILTER_DEFLATE: if (filt->cd_values[0] > 9) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("invalid compression parameter in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } break; /*------------------------------------------------------------------------- @@ -438,21 +438,21 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t pixels_per_block = filt->cd_values[0]; if ((pixels_per_block % 2) == 1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("pixels_per_block is not even in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("pixels_per_block is too large in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } if ((HDstrcmp(smask, "NN") != 0) && (HDstrcmp(smask, "EC") != 0)) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("szip mask must be 'NN' or 'EC' \n"); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } break; default: @@ -496,9 +496,9 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about char sdim[10]; char slayout[10]; - HDmemset(sdim, '\0', sizeof(sdim)); - HDmemset(sobj, '\0', sizeof(sobj)); - HDmemset(slayout, '\0', sizeof(slayout)); + memset(sdim, '\0', sizeof(sdim)); + memset(sobj, '\0', sizeof(sobj)); + memset(slayout, '\0', sizeof(slayout)); /* check for the end of object list and number of objects */ for (i = 0, n = 0; i < len; i++) { @@ -514,7 +514,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about } n++; - obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t)); + obj_list = (obj_list_t *)malloc(n * sizeof(obj_list_t)); if (obj_list == NULL) { error_msg("could not allocate object list\n"); return NULL; @@ -532,7 +532,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about else sobj[k + 1] = '\0'; HDstrcpy(obj_list[n].obj, sobj); - HDmemset(sobj, 0, sizeof(sobj)); + memset(sobj, 0, sizeof(sobj)); n++; k = -1; } @@ -541,9 +541,9 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about /* nothing after : */ if (end_obj + 1 == (int)len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, no characters after : in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } /* get layout info */ @@ -558,7 +558,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about pack->layout = H5D_CHUNKED; else { error_msg("in parse layout, not a valid layout in <%s>\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } else { @@ -575,9 +575,9 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about k = 0; if (j > len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> Chunk dimensions missing\n", str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } for (i = j, c_index = 0; i < len; i++) { @@ -587,9 +587,9 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about if (!HDisdigit(c) && c != 'x' && c != 'N' && c != 'O' && c != 'N' && c != 'E') { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim, str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } if (c == 'x' || i == len - 1) { @@ -599,9 +599,9 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0); if (pack->chunk.chunk_lengths[c_index] == 0) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } c_index++; } @@ -615,9 +615,9 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0); if (pack->chunk.chunk_lengths[c_index] == 0) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str); - HDexit(EXIT_FAILURE); + exit(EXIT_FAILURE); } pack->chunk.rank = c_index + 1; } diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 3c0be30..171b335 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -152,18 +152,18 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti *------------------------------------------------------------------------- */ if (nelmts) { - buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hobj_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { - HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + printf("cannot read into memory\n"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); - refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); + refbuf = (hobj_ref_t *)calloc((unsigned)nelmts, msize); if (refbuf == NULL) { - HDprintf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); + printf("cannot allocate memory\n"); + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); } /* end if */ for (u = 0; u < nelmts; u++) { H5E_BEGIN_TRY @@ -183,11 +183,11 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed"); if (options->verbose > 0) { if (options->verbose == 2) - HDprintf(FORMAT_OBJ_NOTIME, "dset", travt->objs[i].name); + printf(FORMAT_OBJ_NOTIME, "dset", travt->objs[i].name); else - HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name); - HDprintf("object <%s> object reference created to <%s>\n", - travt->objs[i].name, refname); + printf(FORMAT_OBJ, "dset", travt->objs[i].name); + printf("object <%s> object reference created to <%s>\n", + travt->objs[i].name, refname); } } /*refname*/ if (H5Oclose(refobj_id) < 0) @@ -207,9 +207,9 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); if (buf) - HDfree(buf); + free(buf); if (refbuf) - HDfree(refbuf); + free(refbuf); /*------------------------------------------------------ * copy attrs @@ -234,10 +234,10 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti *------------------------------------------------------------------------- */ if (nelmts) { - buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hdset_reg_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { - HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + printf("cannot read into memory\n"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); @@ -246,11 +246,11 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti * create output *------------------------------------------------------------------------- */ - refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), - (size_t)nelmts); /*init to zero */ + refbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), + (size_t)nelmts); /*init to zero */ if (refbuf == NULL) { - HDprintf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); + printf("cannot allocate memory\n"); + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); } /* end if */ for (u = 0; u < nelmts; u++) { @@ -279,9 +279,9 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (H5Sclose(region_id) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); if (options->verbose > 0) { - HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name); - HDprintf("object <%s> region reference created to <%s>\n", - travt->objs[i].name, refname); + printf(FORMAT_OBJ, "dset", travt->objs[i].name); + printf("object <%s> region reference created to <%s>\n", + travt->objs[i].name, refname); } } /*refname*/ if (H5Oclose(refobj_id) < 0) @@ -301,9 +301,9 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); if (buf) - HDfree(buf); + free(buf); if (refbuf) - HDfree(refbuf); + free(refbuf); /*----------------------------------------------------- * copy attrs @@ -506,8 +506,8 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / if (nmembers < 1) H5TOOLS_GOTO_ERROR((-1), "H5Tget_nmembers failed"); - ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers * sizeof(unsigned)); - ref_comp_size = (size_t *)HDmalloc((size_t)nmembers * sizeof(ref_comp_size)); + ref_comp_index = (unsigned *)malloc((size_t)nmembers * sizeof(unsigned)); + ref_comp_size = (size_t *)malloc((size_t)nmembers * sizeof(ref_comp_size)); ref_comp_field_n = 0; for (i = 0; i < (unsigned)nmembers; i++) { @@ -527,12 +527,12 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / * statement below. */ if (!ref_comp_field_n) { if (ref_comp_index) { - HDfree(ref_comp_index); + free(ref_comp_index); ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); + free(ref_comp_size); ref_comp_size = NULL; } } @@ -598,18 +598,18 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / if (nelmts > 0) { /* handle object references */ if ((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE == msize)) { - buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hobj_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { - HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + printf("cannot read into memory\n"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); - refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); + refbuf = (hobj_ref_t *)calloc((unsigned)nelmts, msize); if (refbuf == NULL) { - HDprintf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); + printf("cannot allocate memory\n"); + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); } /* end if */ for (i = 0; i < (unsigned)nelmts; i++) @@ -619,11 +619,11 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / } /* H5T_STD_REF_OBJ */ /* handle region references */ else if ((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) { - buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hdset_reg_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { - HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + printf("cannot read into memory\n"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); @@ -632,11 +632,10 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / * create output *------------------------------------------------------------------------- */ - refbuf = - (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ + refbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if (refbuf == NULL) { - HDprintf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); + printf("cannot allocate memory\n"); + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); } /* end if */ for (i = 0; i < (unsigned)nelmts; i++) @@ -647,12 +646,12 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / else if (is_ref_vlen) { /* handle VLEN of references */ - buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t))); + buf = (hvl_t *)malloc((unsigned)(nelmts * sizeof(hvl_t))); refbuf = buf; /* reuse the read buffer for write */ if (buf == NULL) { - HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + printf("cannot read into memory\n"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (H5Aread(attr_id, mtype_id, buf) < 0) @@ -667,7 +666,7 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / 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); + memcpy(&(ptr[j]), &ref_out, msize); } } /* for (i=0; i<nelems; i++) */ } @@ -681,7 +680,7 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt) < 0) continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); + memcpy(&(ptr[j]), &ref_out, msize); } } /* for (i=0; i<nelems; i++) */ } @@ -689,12 +688,12 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / else if (is_ref_comp) { /* handle ref fields in a compound */ - buf = HDmalloc((unsigned)(nelmts * msize)); + buf = malloc((unsigned)(nelmts * msize)); refbuf = buf; /* reuse the read buffer for write */ if (buf == NULL) { - HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + printf("cannot read into memory\n"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (H5Aread(attr_id, mtype_id, buf) < 0) @@ -712,7 +711,7 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / travt) < 0) /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ continue; - HDmemcpy(((char *)buf) + idx, &ref_out, ref_comp_size[j]); + memcpy(((char *)buf) + idx, &ref_out, ref_comp_size[j]); } /* if */ else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { size_t idx = i * msize + H5Tget_member_offset(mtype_id, ref_comp_index[j]); @@ -722,7 +721,7 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / (hdset_reg_ref_t *)(((char *)buf) + idx), fidout, &ref_out, travt) < 0) continue; - HDmemcpy(((char *)buf) + idx, &ref_out, ref_comp_size[j]); + memcpy(((char *)buf) + idx, &ref_out, ref_comp_size[j]); } /* else if */ } /* j */ } /* i */ @@ -739,22 +738,22 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ if (buf) { - HDfree(buf); + free(buf); buf = NULL; } if (refbuf) { - HDfree(refbuf); + free(refbuf); refbuf = NULL; } if (ref_comp_index) { - HDfree(ref_comp_index); + free(ref_comp_index); ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); + free(ref_comp_size); ref_comp_size = NULL; } @@ -777,15 +776,15 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / done: if (refbuf) - HDfree(refbuf); + free(refbuf); if (buf) - HDfree(buf); + free(buf); if (ref_comp_index) - HDfree(ref_comp_index); + free(ref_comp_index); if (ref_comp_size) - HDfree(ref_comp_size); + free(ref_comp_size); H5E_BEGIN_TRY { |