diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-09-15 22:13:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-15 22:13:18 (GMT) |
commit | 44a00ef876ad3e1922847e93feac57c479217fbe (patch) | |
tree | 5e9fc677913a06a71eba1342633f92e93bd07a6c /src | |
parent | 59a90368cdb696205bdf15040d1a48b4f69af97f (diff) | |
download | hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.zip hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.tar.gz hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.tar.bz2 |
Strip HD prefix from string/char C API calls (#3540)
* Strip HD prefix from string/char C API calls
* HD(f)(put|get)(s|c)
* HDstr*
* HDv*printf
* HD(s)(print|scan)f
* HDperror
But NOT:
* HDstrcase*
* HDvasprintf
* HDstrtok_r
* HDstrndup
As those are not C99 and have portability work-around
implementations. They will be handled later.
* Fix th5_system.c screwup
Diffstat (limited to 'src')
120 files changed, 915 insertions, 1036 deletions
@@ -460,12 +460,12 @@ H5_term_library(void) /* log a package when its terminator needs to be retried */ pending++; - nprinted = HDsnprintf(next, nleft, "%s%s", + nprinted = snprintf(next, nleft, "%s%s", (next != loop) ? "," : "", terminator[i].name); if (nprinted < 0) continue; if ((size_t)nprinted >= nleft) - nprinted = HDsnprintf(next, nleft, "..."); + nprinted = snprintf(next, nleft, "..."); if (nprinted < 0 || (size_t)nprinted >= nleft) continue; nleft -= (size_t)nprinted; @@ -719,24 +719,24 @@ H5__debug_mask(const char *s) pkg_name[MIN(sizeof(pkg_name) - 1, i)] = '\0'; /* Trace, all, or one? */ - if (!HDstrcmp(pkg_name, "trace")) { + if (!strcmp(pkg_name, "trace")) { H5_debug_g.trace = clear ? NULL : stream; } - else if (!HDstrcmp(pkg_name, "ttop")) { + else if (!strcmp(pkg_name, "ttop")) { H5_debug_g.trace = stream; H5_debug_g.ttop = (bool)!clear; } - else if (!HDstrcmp(pkg_name, "ttimes")) { + else if (!strcmp(pkg_name, "ttimes")) { H5_debug_g.trace = stream; H5_debug_g.ttimes = (bool)!clear; } - else if (!HDstrcmp(pkg_name, "all")) { + else if (!strcmp(pkg_name, "all")) { for (i = 0; i < (size_t)H5_NPKGS; i++) H5_debug_g.pkg[i].stream = clear ? NULL : stream; } else { for (i = 0; i < (size_t)H5_NPKGS; i++) { - if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) { + if (!strcmp(H5_debug_g.pkg[i].name, pkg_name)) { H5_debug_g.pkg[i].stream = clear ? NULL : stream; break; } /* end if */ @@ -908,7 +908,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) fprintf(stderr, "%s", H5build_settings); /* Bail out now. */ - HDfputs("Bye...\n", stderr); + fputs("Bye...\n", stderr); HDabort(); case 1: /* continue with a warning */ @@ -948,7 +948,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); /* Bail out now. */ - HDfputs("Bye...\n", stderr); + fputs("Bye...\n", stderr); HDabort(); case 1: /* continue with a warning */ @@ -982,17 +982,17 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) * Check only the first sizeof(lib_str) char. Assume the information * will fit within this size or enough significance. */ - HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d%s%s", H5_VERS_MAJOR, - H5_VERS_MINOR, H5_VERS_RELEASE, (*substr ? "-" : ""), substr); - - if (HDstrcmp(lib_str, H5_lib_vers_info_g) != 0) { - HDfputs("Warning! Library version information error.\n" - "The HDF5 library version information are not " - "consistent in its source code.\nThis is NOT a fatal error " - "but should be corrected. Setting the environment\n" - "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of 1 " - "will suppress\nthis warning.\n", - stderr); + snprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d%s%s", H5_VERS_MAJOR, H5_VERS_MINOR, + H5_VERS_RELEASE, (*substr ? "-" : ""), substr); + + if (strcmp(lib_str, H5_lib_vers_info_g) != 0) { + fputs("Warning! Library version information error.\n" + "The HDF5 library version information are not " + "consistent in its source code.\nThis is NOT a fatal error " + "but should be corrected. Setting the environment\n" + "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of 1 " + "will suppress\nthis warning.\n", + stderr); fprintf(stderr, "Library version information are:\n" "H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, " @@ -1580,7 +1580,7 @@ H5A__rename_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const assert(new_name); /* Avoid thrashing things if the names are the same */ - if (HDstrcmp(old_name, new_name) != 0) { + if (strcmp(old_name, new_name) != 0) { H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */ /* Set up VOL callback arguments */ @@ -288,7 +288,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co aux_ptr->sync_point_done = NULL; aux_ptr->p0_image_len = 0; - HDsnprintf(prefix, sizeof(prefix), "%d:", mpi_rank); + snprintf(prefix, sizeof(prefix), "%d:", mpi_rank); if (mpi_rank == 0) { if (NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) @@ -1874,7 +1874,7 @@ H5AC_validate_config(const H5AC_cache_config_t *config_ptr) * open the file, so we will content ourselves with a couple of * sanity checks on the length of the file name. */ - name_len = HDstrlen(config_ptr->trace_file_name); + name_len = strlen(config_ptr->trace_file_name); if (name_len == 0) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty"); else if (name_len > H5AC__MAX_TRACE_FILE_NAME_LEN) diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index d8f0e2f..9ea4b75 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -154,7 +154,7 @@ H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute"); /* Compare the string values */ - udata->cmp = HDstrcmp(udata->name, attr->shared->name); + udata->cmp = strcmp(udata->name, attr->shared->name); /* Check for correct attribute & callback to make */ if (udata->cmp == 0 && udata->found_op) { diff --git a/src/H5Adense.c b/src/H5Adense.c index 4b1a43c..27ccf91 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -369,7 +369,7 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) udata.fheap = fheap; udata.shared_fheap = shared_fheap; udata.name = name; - udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0); + udata.name_hash = H5_checksum_lookup3(name, strlen(name), 0); udata.flags = 0; udata.corder = 0; udata.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */ @@ -507,7 +507,7 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) udata.common.fheap = fheap; udata.common.shared_fheap = shared_fheap; udata.common.name = attr->shared->name; - udata.common.name_hash = H5_checksum_lookup3(attr->shared->name, HDstrlen(attr->shared->name), 0); + udata.common.name_hash = H5_checksum_lookup3(attr->shared->name, strlen(attr->shared->name), 0); H5_CHECKED_ASSIGN(udata.common.flags, uint8_t, mesg_flags, unsigned); udata.common.corder = attr->shared->crt_idx; udata.common.found_op = NULL; @@ -748,7 +748,7 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) udata.fheap = fheap; udata.shared_fheap = shared_fheap; udata.name = attr->shared->name; - udata.name_hash = H5_checksum_lookup3(attr->shared->name, HDstrlen(attr->shared->name), 0); + udata.name_hash = H5_checksum_lookup3(attr->shared->name, strlen(attr->shared->name), 0); udata.flags = 0; udata.corder = 0; udata.found_op = NULL; @@ -881,7 +881,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons udata.fheap = fheap; udata.shared_fheap = shared_fheap; udata.name = old_name; - udata.name_hash = H5_checksum_lookup3(old_name, HDstrlen(old_name), 0); + udata.name_hash = H5_checksum_lookup3(old_name, strlen(old_name), 0); udata.flags = 0; udata.corder = 0; udata.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */ @@ -1339,7 +1339,7 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) udata.common.fheap = fheap; udata.common.shared_fheap = shared_fheap; udata.common.name = name; - udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0); + udata.common.name_hash = H5_checksum_lookup3(name, strlen(name), 0); udata.common.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */ udata.common.found_op_data = &attr_copy; udata.corder_bt2_addr = ainfo->corder_bt2_addr; @@ -1432,7 +1432,7 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) other_bt2_udata.shared_fheap = bt2_udata->shared_fheap; other_bt2_udata.name = fh_udata.attr->shared->name; other_bt2_udata.name_hash = - H5_checksum_lookup3(fh_udata.attr->shared->name, HDstrlen(fh_udata.attr->shared->name), 0); + H5_checksum_lookup3(fh_udata.attr->shared->name, strlen(fh_udata.attr->shared->name), 0); other_bt2_udata.found_op = NULL; other_bt2_udata.found_op_data = NULL; } /* end else */ @@ -1668,7 +1668,7 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name, bool *at udata.fheap = fheap; udata.shared_fheap = shared_fheap; udata.name = name; - udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0); + udata.name_hash = H5_checksum_lookup3(name, strlen(name), 0); udata.flags = 0; udata.corder = 0; udata.found_op = NULL; /* v2 B-tree comparison callback */ diff --git a/src/H5Aint.c b/src/H5Aint.c index f9f74c3..853270c 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -947,7 +947,7 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf, size_t *attr_name_len) assert(attr_name_len); /* Get the real attribute length */ - nbytes = HDstrlen(attr->shared->name); + nbytes = strlen(attr->shared->name); /* Compute the string length which will fit into the user's buffer */ copy_len = MIN(buf_size - 1, nbytes); @@ -1701,7 +1701,7 @@ H5A__attr_cmp_name_inc(const void *attr1, const void *attr2) FUNC_ENTER_PACKAGE_NOERR FUNC_LEAVE_NOAPI( - HDstrcmp((*(const H5A_t *const *)attr1)->shared->name, (*(const H5A_t *const *)attr2)->shared->name)) + strcmp((*(const H5A_t *const *)attr1)->shared->name, (*(const H5A_t *const *)attr2)->shared->name)) } /* end H5A__attr_cmp_name_inc() */ /*------------------------------------------------------------------------- @@ -1724,7 +1724,7 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2) FUNC_ENTER_PACKAGE_NOERR FUNC_LEAVE_NOAPI( - HDstrcmp((*(const H5A_t *const *)attr2)->shared->name, (*(const H5A_t *const *)attr1)->shared->name)) + strcmp((*(const H5A_t *const *)attr2)->shared->name, (*(const H5A_t *const *)attr1)->shared->name)) } /* end H5A__attr_cmp_name_dec() */ /*------------------------------------------------------------------------- @@ -2547,7 +2547,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na FUNC_ENTER_PACKAGE /* Avoid thrashing things if the names are the same */ - if (HDstrcmp(old_attr_name, new_attr_name) != 0) { + if (strcmp(old_attr_name, new_attr_name) != 0) { /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; obj_loc.path = &obj_path; diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 39c6db9..83a70eb 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -124,7 +124,7 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Print relevant node info */ fprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, ""); for (u = 0; u < (unsigned)(hdr->depth + 1); u++) { - HDsnprintf(temp_str, sizeof(temp_str), "Depth %u:", u); + snprintf(temp_str, sizeof(temp_str), "Depth %u:", u); fprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, hdr->node_info[u].max_nrec, hdr->node_info[u].split_nrec, hdr->node_info[u].merge_nrec); } /* end for */ @@ -206,13 +206,13 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co /* Print all node pointers and records */ for (u = 0; u < internal->nrec; u++) { /* Print node pointer */ - HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); + snprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); fprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, internal->node_ptrs[u].addr); /* Print record */ - HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u); + snprintf(temp_str, sizeof(temp_str), "Record #%u:", u); fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); assert(H5B2_INT_NREC(internal, hdr, u)); (void)(type->debug)(stream, indent + 6, MAX(0, fwidth - 6), H5B2_INT_NREC(internal, hdr, u), @@ -220,7 +220,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co } /* end for */ /* Print final node pointer */ - HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); + snprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); fprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, internal->node_ptrs[u].addr); @@ -303,7 +303,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, c /* Print all node pointers and records */ for (u = 0; u < leaf->nrec; u++) { /* Print record */ - HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u); + snprintf(temp_str, sizeof(temp_str), "Record #%u:", u); fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); assert(H5B2_LEAF_NREC(leaf, hdr, u)); (void)(type->debug)(stream, indent + 6, MAX(0, fwidth - 6), H5B2_LEAF_NREC(leaf, hdr, u), @@ -138,7 +138,7 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, for (i = 0; i <= max_type_id; i++) { assert((class_table_ptr)[i]); - assert(HDstrlen((class_table_ptr)[i]->name) > 0); + assert(strlen((class_table_ptr)[i]->name) > 0); } /* end for */ if (NULL == (cache_ptr = H5FL_CALLOC(H5C_t))) @@ -138,7 +138,7 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream) fprintf(stream, "thread %" PRIu64 ".", H5TS_thread_id()); if (fstack && fstack->nused > 0) fprintf(stream, " Back trace follows."); - HDfputc('\n', stream); + fputc('\n', stream); for (i = fstack->nused - 1; i >= 0; --i) fprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->rec[i]); diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 6e3db09..457b29c 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -317,10 +317,10 @@ H5C_set_prefix(H5C_t *cache_ptr, char *prefix) FUNC_ENTER_NOAPI(FAIL) - if (cache_ptr == NULL || prefix == NULL || HDstrlen(prefix) >= H5C__PREFIX_LEN) + if (cache_ptr == NULL || prefix == NULL || strlen(prefix) >= H5C__PREFIX_LEN) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry"); - HDstrncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN)); + strncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN)); cache_ptr->prefix[H5C__PREFIX_LEN - 1] = '\0'; diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index 52154d3..548e7b8 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -168,7 +168,7 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata) assert(json_udata->message); /* Write the log message and flush */ - n_chars = HDstrlen(json_udata->message); + n_chars = strlen(json_udata->message); if ((int)n_chars != fprintf(json_udata->outfile, "%s", json_udata->message)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message"); memset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char))); @@ -231,16 +231,16 @@ H5C__log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mp * * allocation size = "RANK_" + <rank # length> + dot + <path length> + \0 */ - n_chars = 5 + 39 + 1 + HDstrlen(log_location) + 1; + n_chars = 5 + 39 + 1 + strlen(log_location) + 1; if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation"); /* Add the rank to the log file name when MPI is in use */ if (-1 == mpi_rank) - HDsnprintf(file_name, n_chars, "%s", log_location); + snprintf(file_name, n_chars, "%s", log_location); else - HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location); + snprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location); /* Open log file and set it to be unbuffered */ if (NULL == (json_udata->outfile = fopen(file_name, "w"))) @@ -331,7 +331,7 @@ H5C__json_write_start_log_msg(void *udata) assert(json_udata->message); /* Create the log message string (opens the JSON array) */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\n\ \"HDF5 metadata cache log messages\" : [\n\ {\ @@ -339,7 +339,7 @@ H5C__json_write_start_log_msg(void *udata) \"action\":\"logging start\"\ },\n\ ", - (long long)HDtime(NULL)); + (long long)HDtime(NULL)); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -371,14 +371,14 @@ H5C__json_write_stop_log_msg(void *udata) assert(json_udata->message); /* Create the log message string (closes the JSON array) */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"logging stop\"\ }\n\ ]}\n\ ", - (long long)HDtime(NULL)); + (long long)HDtime(NULL)); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -410,14 +410,14 @@ H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value) assert(json_udata->message); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"create\",\ \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (int)fxn_ret_value); + (long long)HDtime(NULL), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -449,13 +449,13 @@ H5C__json_write_destroy_cache_log_msg(void *udata) assert(json_udata->message); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"destroy\"\ },\n\ ", - (long long)HDtime(NULL)); + (long long)HDtime(NULL)); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -487,14 +487,14 @@ H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value) assert(json_udata->message); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"evict\",\ \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (int)fxn_ret_value); + (long long)HDtime(NULL), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -526,7 +526,7 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, assert(json_udata->message); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"expunge\",\ @@ -535,7 +535,7 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -567,14 +567,14 @@ H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) assert(json_udata->message); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"flush\",\ \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (int)fxn_ret_value); + (long long)HDtime(NULL), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -607,7 +607,7 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, assert(json_udata->message); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"insert\",\ @@ -618,8 +618,7 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)size, - (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -652,7 +651,7 @@ H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *e assert(entry); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"dirty\",\ @@ -660,7 +659,7 @@ H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *e \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -693,7 +692,7 @@ H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *e assert(entry); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"clean\",\ @@ -701,7 +700,7 @@ H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *e \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -735,7 +734,7 @@ H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_ent assert(entry); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"unserialized\",\ @@ -743,7 +742,7 @@ H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_ent \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -777,7 +776,7 @@ H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry assert(entry); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"serialized\",\ @@ -785,7 +784,7 @@ H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -818,7 +817,7 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad assert(json_udata->message); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"move\",\ @@ -828,8 +827,8 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)old_addr, (unsigned long)new_addr, type_id, - (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)old_addr, (unsigned long)new_addr, type_id, + (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -862,7 +861,7 @@ H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, h assert(entry); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"pin\",\ @@ -870,7 +869,7 @@ H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, h \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -906,7 +905,7 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, assert(child); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"create_fd\",\ @@ -915,8 +914,8 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr, - (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr, + (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -951,12 +950,12 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr assert(entry); if (H5C__READ_ONLY_FLAG == flags) - HDstrcpy(rw_s, "READ"); + strcpy(rw_s, "READ"); else - HDstrcpy(rw_s, "WRITE"); + strcpy(rw_s, "WRITE"); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"protect\",\ @@ -967,8 +966,8 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, type_id, rw_s, (int)entry->size, - (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, type_id, rw_s, (int)entry->size, + (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -1002,7 +1001,7 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry assert(entry); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"resize\",\ @@ -1011,7 +1010,7 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, (int)new_size, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, (int)new_size, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -1044,7 +1043,7 @@ H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, assert(entry); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"unpin\",\ @@ -1052,7 +1051,7 @@ H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -1088,7 +1087,7 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, assert(child); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"destroy_fd\",\ @@ -1097,8 +1096,8 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr, - (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr, + (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -1131,7 +1130,7 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_i assert(json_udata->message); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"unprotect\",\ @@ -1141,7 +1140,7 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_i \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -1175,14 +1174,14 @@ H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t assert(config); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"set_config\",\ \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (int)fxn_ret_value); + (long long)HDtime(NULL), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) @@ -1215,7 +1214,7 @@ H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry assert(entry); /* Create the log message string */ - HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ + snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ {\ \"timestamp\":%lld,\ \"action\":\"remove\",\ @@ -1223,7 +1222,7 @@ H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry \"returned\":%d\ },\n\ ", - (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index ffa415f..6b31d98 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -163,7 +163,7 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata) assert(trace_udata->message); /* Write the log message and flush */ - n_chars = HDstrlen(trace_udata->message); + n_chars = strlen(trace_udata->message); if ((int)n_chars != fprintf(trace_udata->outfile, "%s", trace_udata->message)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message"); memset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char))); @@ -226,16 +226,16 @@ H5C__log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int m * * allocation size = <path length> + dot + <rank # length> + \0 */ - n_chars = HDstrlen(log_location) + 1 + 39 + 1; + n_chars = strlen(log_location) + 1 + 39 + 1; if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation"); /* Add the rank to the log file name when MPI is in use */ if (-1 == mpi_rank) - HDsnprintf(file_name, n_chars, "%s", log_location); + snprintf(file_name, n_chars, "%s", log_location); else - HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank); + snprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank); /* Open log file and set it to be unbuffered */ if (NULL == (trace_udata->outfile = fopen(file_name, "w"))) @@ -329,8 +329,8 @@ H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id assert(trace_udata->message); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n", - (unsigned long)address, type_id, (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n", + (unsigned long)address, type_id, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -362,7 +362,7 @@ H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) assert(trace_udata->message); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n", (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n", (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -395,8 +395,8 @@ H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, assert(trace_udata->message); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n", - (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n", + (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -429,8 +429,8 @@ H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t * assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n", - (unsigned long)(entry->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -463,8 +463,8 @@ H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t * assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n", - (unsigned long)(entry->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -498,8 +498,8 @@ H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_en assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n", - (unsigned long)(entry->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -533,8 +533,8 @@ H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entr assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n", - (unsigned long)(entry->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -567,8 +567,8 @@ H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_a assert(trace_udata->message); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n", - (unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n", + (unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -601,8 +601,8 @@ H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n", - (unsigned long)(entry->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -638,9 +638,9 @@ H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, assert(child); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, - "H5AC_create_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr), - (unsigned long)(child->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, + "H5AC_create_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr), + (unsigned long)(child->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -674,8 +674,8 @@ H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *ent assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n", - (unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n", + (unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -709,8 +709,8 @@ H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entr assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n", - (unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n", + (unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -743,8 +743,8 @@ H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n", - (unsigned long)(entry->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -780,9 +780,9 @@ H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent assert(child); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, - "H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr), - (unsigned long)(child->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, + "H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr), + (unsigned long)(child->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -815,8 +815,8 @@ H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_ assert(trace_udata->message); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n", - (unsigned long)(address), type_id, flags, (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n", + (unsigned long)(address), type_id, flags, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -850,20 +850,19 @@ H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t assert(config); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, - "H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f " - "%d %d %d %f %f %d %d %d %d %f %zu %d %d\n", - config->version, (int)(config->rpt_fcn_enabled), (int)(config->open_trace_file), - (int)(config->close_trace_file), config->trace_file_name, (int)(config->evictions_enabled), - (int)(config->set_initial_size), (int)(config->initial_size), config->min_clean_fraction, - (int)(config->max_size), (int)(config->min_size), config->epoch_length, - (int)(config->incr_mode), config->lower_hr_threshold, config->increment, - (int)(config->flash_incr_mode), config->flash_multiple, config->flash_threshold, - (int)(config->apply_max_increment), (int)(config->max_increment), (int)(config->decr_mode), - config->upper_hr_threshold, config->decrement, (int)(config->apply_max_decrement), - (int)(config->max_decrement), config->epochs_before_eviction, - (int)(config->apply_empty_reserve), config->empty_reserve, config->dirty_bytes_threshold, - config->metadata_write_strategy, (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, + "H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f " + "%d %d %d %f %f %d %d %d %d %f %zu %d %d\n", + config->version, (int)(config->rpt_fcn_enabled), (int)(config->open_trace_file), + (int)(config->close_trace_file), config->trace_file_name, (int)(config->evictions_enabled), + (int)(config->set_initial_size), (int)(config->initial_size), config->min_clean_fraction, + (int)(config->max_size), (int)(config->min_size), config->epoch_length, (int)(config->incr_mode), + config->lower_hr_threshold, config->increment, (int)(config->flash_incr_mode), + config->flash_multiple, config->flash_threshold, (int)(config->apply_max_increment), + (int)(config->max_increment), (int)(config->decr_mode), config->upper_hr_threshold, + config->decrement, (int)(config->apply_max_decrement), (int)(config->max_decrement), + config->epochs_before_eviction, (int)(config->apply_empty_reserve), config->empty_reserve, + config->dirty_bytes_threshold, config->metadata_write_strategy, (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) @@ -896,8 +895,8 @@ H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entr assert(entry); /* Create the log message string */ - HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n", - (unsigned long)(entry->addr), (int)fxn_ret_value); + snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 099fa63..e5f65cf 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -194,10 +194,10 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha memset(tbl_buf, 0, sizeof(tbl_buf)); - HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate list = "); + snprintf(tbl_buf, sizeof(tbl_buf), "candidate list = "); for (u = 0; u < num_candidates; u++) - HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u))); - HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); + sprintf(&(tbl_buf[strlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u))); + sprintf(&(tbl_buf[strlen(tbl_buf)]), "\n"); fprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ @@ -260,10 +260,10 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha #if H5C_APPLY_CANDIDATE_LIST__DEBUG for (u = 0; u < 1024; u++) tbl_buf[u] = '\0'; - HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate assignment table = "); + snprintf(tbl_buf, sizeof(tbl_buf), "candidate assignment table = "); for (u = 0; u <= (unsigned)mpi_size; u++) - HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]); - HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); + sprintf(&(tbl_buf[strlen(tbl_buf)]), " %u", candidate_assignment_table[u]); + sprintf(&(tbl_buf[strlen(tbl_buf)]), "\n"); fprintf(stdout, "%s", tbl_buf); fprintf(stdout, "%s:%d: flush entries [%u, %u].\n", __func__, mpi_rank, first_entry_to_flush, diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 43ec98f..d79f7d0 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -708,7 +708,7 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, con fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < udata->ndims; u++) fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u])); - HDfputs("}\n", stream); + fputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__btree_debug_key() */ diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index b6aeeeb..4da9555 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -431,7 +431,7 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, const void *_record, fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < ctx->ndims; u++) fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]); - HDfputs("}\n", stream); + fputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5D__bt2_unfilt_debug() */ @@ -541,7 +541,7 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, const void *_record, c fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < ctx->ndims; u++) fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]); - HDfputs("}\n", stream); + fputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5D__bt2_filt_debug() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 6b56697..cabdcfb 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -7174,7 +7174,7 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) for (u = 0; u < udata->ndims; u++) fprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""), (chunk_rec->scaled[u] * udata->chunk_dim[u])); - HDfputs("]\n", udata->stream); + fputs("]\n", udata->stream); } /* end if */ FUNC_LEAVE_NOAPI(H5_ITER_CONT) @@ -7281,10 +7281,10 @@ H5D__chunk_stats(const H5D_t *dset, bool headers) miss_rate = 0.0; } if (miss_rate > 100) { - HDsnprintf(ascii, sizeof(ascii), "%7d%%", (int)(miss_rate + 0.5)); + snprintf(ascii, sizeof(ascii), "%7d%%", (int)(miss_rate + 0.5)); } else { - HDsnprintf(ascii, sizeof(ascii), "%7.2f%%", miss_rate); + snprintf(ascii, sizeof(ascii), "%7.2f%%", miss_rate); } fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->stats.nhits, diff --git a/src/H5Dearray.c b/src/H5Dearray.c index f14ac33..c713b6f 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -395,7 +395,7 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void assert(elmt); /* Print element */ - HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); + snprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) @@ -539,7 +539,7 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const assert(elmt); /* Print element */ - HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); + snprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, elmt->filter_mask); diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index dae5dd1..450d466 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -393,7 +393,7 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void assert(elmt); /* Print element */ - HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); + snprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) @@ -635,7 +635,7 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const assert(elmt); /* Print element */ - HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); + snprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, elmt->filter_mask); diff --git a/src/H5Dint.c b/src/H5Dint.c index 7d38441..3f4ff72 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1087,22 +1087,22 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** /* Prefix has to be checked for NULL / empty string again because the * code above might have updated it. */ - if (prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) { + if (prefix == NULL || *prefix == '\0' || strcmp(prefix, ".") == 0) { /* filename is interpreted as relative to the current directory, * does not need to be expanded */ *file_prefix = NULL; } /* end if */ else { - if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { + if (strncmp(prefix, "${ORIGIN}", strlen("${ORIGIN}")) == 0) { /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ - filepath_len = HDstrlen(filepath); - prefix_len = HDstrlen(prefix); - file_prefix_len = filepath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; + filepath_len = strlen(filepath); + prefix_len = strlen(prefix); + file_prefix_len = filepath_len + prefix_len - strlen("${ORIGIN}") + 1; if (NULL == (*file_prefix = (char *)H5MM_malloc(file_prefix_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer"); - HDsnprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + HDstrlen("${ORIGIN}")); + snprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + strlen("${ORIGIN}")); } /* end if */ else { if (NULL == (*file_prefix = (char *)H5MM_strdup(prefix))) @@ -1526,7 +1526,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) * matches the new external file prefix */ if (extfile_prefix && dataset->shared->extfile_prefix) { - if (HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0) + if (strcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0) HGOTO_ERROR( H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset"); diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index fa27991..1324faf 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -489,7 +489,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) /* Determine size of heap needed to stored the file names */ for (u = 0; u < efl->nused; ++u) - heap_size += H5HL_ALIGN(HDstrlen(efl->slot[u].name) + 1); + heap_size += H5HL_ALIGN(strlen(efl->slot[u].name) + 1); /* Create the heap for the EFL file names */ if (H5HL_create(file, heap_size, &efl->heap_addr /*out*/) < 0) @@ -507,8 +507,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) for (u = 0; u < efl->nused; ++u) { /* Insert file name into heap */ - if (H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) < - 0) { + if (H5HL_insert(file, heap, strlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) < 0) { H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap"); } diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index d8f9444..94f2c39 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -446,7 +446,7 @@ static FILE *debug_stream = NULL; \ if (trace_flag) { \ H5D_MPIO_DEBUG_VA(rank, "%s%s", trace_in_pre, __func__); \ - debug_indent += (int)HDstrlen(trace_in_pre); \ + debug_indent += (int)strlen(trace_in_pre); \ } \ } while (0) @@ -455,7 +455,7 @@ static FILE *debug_stream = NULL; bool trace_flag = H5D_mpio_debug_flags_s[(int)'t']; \ \ if (trace_flag) { \ - debug_indent -= (int)HDstrlen(trace_out_pre); \ + debug_indent -= (int)strlen(trace_out_pre); \ H5D_MPIO_DEBUG_VA(rank, "%s%s", trace_out_pre, __func__); \ } \ } while (0) @@ -861,14 +861,14 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c * so, prepend a semicolon to separate the messages. */ if (buf_space_left && local_cause_bytes_written) { - HDstrncat(local_cause, "; ", buf_space_left); + strncat(local_cause, "; ", buf_space_left); local_cause_bytes_written += MIN(buf_space_left, 2); buf_space_left -= MIN(buf_space_left, 2); } if (buf_space_left) { - HDstrncat(local_cause, cause_str, buf_space_left); - local_cause_bytes_written += MIN(buf_space_left, HDstrlen(cause_str)); + strncat(local_cause, cause_str, buf_space_left); + local_cause_bytes_written += MIN(buf_space_left, strlen(cause_str)); } } @@ -884,14 +884,14 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c * so, prepend a semicolon to separate the messages. */ if (buf_space_left && global_cause_bytes_written) { - HDstrncat(global_cause, "; ", buf_space_left); + strncat(global_cause, "; ", buf_space_left); global_cause_bytes_written += MIN(buf_space_left, 2); buf_space_left -= MIN(buf_space_left, 2); } if (buf_space_left) { - HDstrncat(global_cause, cause_str, buf_space_left); - global_cause_bytes_written += MIN(buf_space_left, HDstrlen(cause_str)); + strncat(global_cause, cause_str, buf_space_left); + global_cause_bytes_written += MIN(buf_space_left, strlen(cause_str)); } } } @@ -1111,7 +1111,7 @@ H5D__piece_io(H5D_io_info_t *io_info) char debug_log_filename[1024]; time_t time_now; - HDsnprintf(debug_log_filename, 1024, "H5Dmpio_debug.rank%d", mpi_rank); + snprintf(debug_log_filename, 1024, "H5Dmpio_debug.rank%d", mpi_rank); if (NULL == (debug_log_file = fopen(debug_log_filename, "a"))) HGOTO_ERROR(H5E_IO, H5E_OPENERROR, FAIL, "couldn't open debugging log file"); diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index b14e06f..3ed7820 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -443,11 +443,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) assert(ent->source_dset.virtual_select); /* Source file name */ - str_size[2 * i] = HDstrlen(ent->source_file_name) + (size_t)1; + str_size[2 * i] = strlen(ent->source_file_name) + (size_t)1; block_size += str_size[2 * i]; /* Source dset name */ - str_size[(2 * i) + 1] = HDstrlen(ent->source_dset_name) + (size_t)1; + str_size[(2 * i) + 1] = strlen(ent->source_dset_name) + (size_t)1; block_size += str_size[(2 * i) + 1]; /* Source selection */ @@ -868,7 +868,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir assert(source_dset->dset_name); /* Check if we need to open the source file */ - if (HDstrcmp(source_dset->file_name, ".") != 0) { + if (strcmp(source_dset->file_name, ".") != 0) { unsigned intent; /* File access permissions */ /* Get the virtual dataset's file open flags ("intent") */ @@ -1115,12 +1115,12 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_ /* Initialize p and tmp_static_strlen */ p = source_name; - tmp_static_strlen = tmp_strlen = HDstrlen(source_name); + tmp_static_strlen = tmp_strlen = strlen(source_name); /* Iterate over name */ /* Note this will not work with UTF-8! We should support this eventually * -NAF 5/18/2015 */ - while ((pct = HDstrchr(p, '%'))) { + while ((pct = strchr(p, '%'))) { assert(pct >= p); /* Allocate name segment struct if necessary */ @@ -1336,10 +1336,10 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name do { /* Add name segment */ if (name_seg->name_segment) { - seg_len = HDstrlen(name_seg->name_segment); + seg_len = strlen(name_seg->name_segment); assert(seg_len > 0); assert(seg_len < name_len_rem); - HDstrncpy(p, name_seg->name_segment, name_len_rem); + strncpy(p, name_seg->name_segment, name_len_rem); name_len_rem -= seg_len; p += seg_len; } /* end if */ @@ -1347,7 +1347,7 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name /* Add block number */ if (nsubs_rem > 0) { assert(blockno_len < name_len_rem); - if (HDsnprintf(p, name_len_rem, "%llu", (long long unsigned)blockno) < 0) + if (snprintf(p, name_len_rem, "%llu", (long long unsigned)blockno) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write block number to string"); name_len_rem -= blockno_len; p += blockno_len; @@ -170,8 +170,8 @@ H5E_init(void) /* Allocate the HDF5 error class */ assert(H5E_ERR_CLS_g == (-1)); - HDsnprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, - (HDstrlen(H5_VERS_SUBRELEASE) > 0 ? "-" H5_VERS_SUBRELEASE : "")); + snprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, + (strlen(H5_VERS_SUBRELEASE) > 0 ? "-" H5_VERS_SUBRELEASE : "")); if (NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers))) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed"); if ((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, false)) < 0) @@ -569,11 +569,11 @@ H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size) assert(cls); /* Get the class's name */ - len = (ssize_t)HDstrlen(cls->cls_name); + len = (ssize_t)strlen(cls->cls_name); /* Set the user's buffer, if provided */ if (name) { - HDstrncpy(name, cls->cls_name, size); + strncpy(name, cls->cls_name, size); if ((size_t)len >= size) name[size - 1] = '\0'; } /* end if */ diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 318448a..d744ac5 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -229,7 +229,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde fprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, ""); for (u = 0; u < iblock->ndblk_addrs; u++) { /* Print address */ - HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u); + snprintf(temp_str, sizeof(temp_str), "Address #%u:", u); fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, iblock->dblk_addrs[u]); } /* end for */ @@ -244,7 +244,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde fprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, ""); for (u = 0; u < iblock->nsblk_addrs; u++) { /* Print address */ - HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u); + snprintf(temp_str, sizeof(temp_str), "Address #%u:", u); fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, iblock->sblk_addrs[u]); } /* end for */ @@ -331,7 +331,7 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, fprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, ""); for (u = 0; u < sblock->ndblks; u++) { /* Print address */ - HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u); + snprintf(temp_str, sizeof(temp_str), "Address #%u:", u); fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, sblock->dblk_addrs[u]); } /* end for */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 3f44e71..13e7c98 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -301,7 +301,7 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void * assert(elmt); /* Print element */ - HDsnprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx); + snprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx); fprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, (unsigned long long)*(const uint64_t *)elmt); diff --git a/src/H5ESint.c b/src/H5ESint.c index 7d4ff21..dab6839 100644 --- a/src/H5ESint.c +++ b/src/H5ESint.c @@ -359,7 +359,7 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con /* Copy the string for the API routine's arguments */ /* (skip the six characters from the app's file, function and line # arguments) */ - assert(0 == HDstrncmp(caller_args, "*s*sIu", 6)); + assert(0 == strncmp(caller_args, "*s*sIu", 6)); if (H5_trace_args(rs, caller_args + 6, ap) < 0) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "can't create formatted API arguments"); if (NULL == (api_args = H5RS_get_str(rs))) diff --git a/src/H5Eint.c b/src/H5Eint.c index b534376..17d8fdd 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -119,11 +119,11 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) assert(msg); /* Get the length of the message string */ - len = (ssize_t)HDstrlen(msg->msg); + len = (ssize_t)strlen(msg->msg); /* Copy the message into the user's buffer, if given */ if (msg_str) { - HDstrncpy(msg_str, msg->msg, size); + strncpy(msg_str, msg->msg, size); if ((size_t)len >= size) msg_str[size - 1] = '\0'; } /* end if */ @@ -209,7 +209,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) cls_ptr = maj_ptr->cls; /* Print error class header if new class */ - if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) { + if (eprint->cls.lib_name == NULL || strcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) { /* update to the new class information */ if (cls_ptr->cls_name) eprint->cls.cls_name = cls_ptr->cls_name; @@ -245,7 +245,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) } /* end if */ /* Check for "real" error description - used to format output more nicely */ - if (err_desc->desc == NULL || HDstrlen(err_desc->desc) == 0) + if (err_desc->desc == NULL || strlen(err_desc->desc) == 0) have_desc = 0; /* Print error message */ @@ -333,7 +333,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) HGOTO_DONE(FAIL); /* Print error class header if new class */ - if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) { + if (eprint->cls.lib_name == NULL || strcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) { /* update to the new class information */ if (cls_ptr->cls_name) eprint->cls.cls_name = cls_ptr->cls_name; @@ -369,7 +369,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) } /* end if */ /* Check for "real" error description - used to format output more nicely */ - if (err_desc->desc == NULL || HDstrlen(err_desc->desc) == 0) + if (err_desc->desc == NULL || strlen(err_desc->desc) == 0) have_desc = 0; /* Print error message */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index c7e0105..de812f3 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -122,7 +122,7 @@ typedef struct H5E_t H5E_t; * considered as an API change \ */ \ HDONE_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \ - HDstrerror(myerrno)); \ + strerror(myerrno)); \ } #define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \ { \ @@ -131,7 +131,7 @@ typedef struct H5E_t H5E_t; * considered as an API change \ */ \ HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \ - HDstrerror(myerrno)); \ + strerror(myerrno)); \ } #else /* H5_HAVE_WIN32_API */ /* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a @@ -148,7 +148,7 @@ typedef struct H5E_t H5E_t; */ \ HDONE_ERROR(majorcode, minorcode, retcode, \ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \ - myerrno, HDstrerror(myerrno), win_error); \ + myerrno, strerror(myerrno), win_error); \ } #define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \ { \ @@ -159,7 +159,7 @@ typedef struct H5E_t H5E_t; */ \ HGOTO_ERROR(majorcode, minorcode, retcode, \ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \ - myerrno, HDstrerror(myerrno), win_error); \ + myerrno, strerror(myerrno), win_error); \ } #endif /* H5_HAVE_WIN32_API */ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index abd9388..666b922 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -284,7 +284,7 @@ H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void * assert(elmt); /* Print element */ - HDsnprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx); + snprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx); fprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, (unsigned long long)*(const uint64_t *)elmt); @@ -543,9 +543,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) /* Check if driver matches driver information saved. Unfortunately, we can't push this * function to each specific driver because we're checking if the driver is correct. */ - if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family") != 0) + if (!strncmp(name, "NCSAfami", (size_t)8) && strcmp(file->cls->name, "family") != 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used"); - if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi") != 0) + if (!strncmp(name, "NCSAmult", (size_t)8) && strcmp(file->cls->name, "multi") != 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used"); /* Decode driver information */ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index b54b1f1..5cc17fe 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -399,7 +399,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, " "errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this " "sub-write = %llu, bytes actually written = %llu, offset = %llu", - HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), (void *)ptr, + HDctime(&mytime), file->name, file->fd, myerrno, strerror(myerrno), (void *)ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ @@ -433,9 +433,9 @@ H5FD__core_get_default_config(void) char *driver = HDgetenv(HDF5_DRIVER); if (driver) { - if (!HDstrcmp(driver, "core")) + if (!strcmp(driver, "core")) return &H5FD_core_default_config_g; - else if (!HDstrcmp(driver, "core_paged")) + else if (!strcmp(driver, "core_paged")) return &H5FD_core_default_paged_config_g; } @@ -463,9 +463,9 @@ H5FD_core_init(void) /* Check the use disabled file locks environment variable */ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); - if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) + if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = true; /* Override: Ignore disabled locks */ - else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) + else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) ignore_disabled_file_locks_s = false; /* Override: Don't ignore disabled locks */ else ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */ @@ -905,7 +905,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " "error message = '%s', file->mem = %p, total read size = %llu, bytes this " "sub-read = %llu, bytes actually read = %llu, offset = %llu", - HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), + HDctime(&mytime), file->name, file->fd, myerrno, strerror(myerrno), (void *)file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ @@ -1086,7 +1086,7 @@ H5FD__core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) if (NULL == f2->name) HGOTO_DONE(1); - ret_value = HDstrcmp(f1->name, f2->name); + ret_value = strcmp(f1->name, f2->name); } /* end else */ done: diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 8e90b8b..b7dd18d 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -204,9 +204,9 @@ H5FD_direct_init(void) /* Check the use disabled file locks environment variable */ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); - if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) + if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = true; /* Override: Ignore disabled locks */ - else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) + else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) ignore_disabled_file_locks_s = false; /* Override: Don't ignore disabled locks */ else ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 828cdcc..94805a2 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -225,36 +225,36 @@ H5FD__family_get_default_printf_filename(const char *old_filename) assert(old_filename); - old_filename_len = HDstrlen(old_filename); + old_filename_len = strlen(old_filename); if (0 == old_filename_len) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid filename"); - new_filename_len = old_filename_len + HDstrlen(suffix) + 1; + new_filename_len = old_filename_len + strlen(suffix) + 1; if (NULL == (tmp_buffer = H5MM_malloc(new_filename_len))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer"); /* Determine if filename contains a ".h5" extension. */ - if ((file_extension = HDstrstr(old_filename, ".h5"))) { + if ((file_extension = strstr(old_filename, ".h5"))) { /* Insert the printf format between the filename and ".h5" extension. */ - HDstrcpy(tmp_buffer, old_filename); - file_extension = HDstrstr(tmp_buffer, ".h5"); - HDsprintf(file_extension, "%s%s", suffix, ".h5"); + strcpy(tmp_buffer, old_filename); + file_extension = strstr(tmp_buffer, ".h5"); + sprintf(file_extension, "%s%s", suffix, ".h5"); } - else if ((file_extension = HDstrrchr(old_filename, '.'))) { + else if ((file_extension = strrchr(old_filename, '.'))) { char *new_extension_loc = NULL; /* If the filename doesn't contain a ".h5" extension, but contains * AN extension, just insert the printf format before that extension. */ - HDstrcpy(tmp_buffer, old_filename); - new_extension_loc = HDstrrchr(tmp_buffer, '.'); - HDsprintf(new_extension_loc, "%s%s", suffix, file_extension); + strcpy(tmp_buffer, old_filename); + new_extension_loc = strrchr(tmp_buffer, '.'); + sprintf(new_extension_loc, "%s%s", suffix, file_extension); } else { /* If the filename doesn't contain an extension at all, just insert * the printf format at the end of the filename. */ - HDsnprintf(tmp_buffer, new_filename_len, "%s%s", old_filename, suffix); + snprintf(tmp_buffer, new_filename_len, "%s%s", old_filename, suffix); } ret_value = tmp_buffer; @@ -564,7 +564,7 @@ H5FD__family_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*o FUNC_ENTER_PACKAGE_NOERR /* Name and version number */ - HDstrncpy(name, "NCSAfami", (size_t)9); + strncpy(name, "NCSAfami", (size_t)9); name[8] = '\0'; /* Store member file size. Use the member file size from the property here. @@ -738,9 +738,9 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate temporary member name"); /* Check that names are unique */ - HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0); - HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 1); - if (!HDstrcmp(memb_name, temp)) { + snprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0); + snprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 1); + if (!strcmp(memb_name, temp)) { if (default_config) { temp = H5MM_xfree(temp); if (NULL == (temp = H5FD__family_get_default_printf_filename(name))) @@ -753,7 +753,7 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad /* Open all the family members */ while (1) { - HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, file->nmembs); + snprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, file->nmembs); /* Enlarge member array */ if (file->nmembs >= file->amembs) { @@ -1016,7 +1016,7 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) /* Create another file if necessary */ if (u >= file->nmembs || !file->memb[u]) { file->nmembs = MAX(file->nmembs, u + 1); - HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, file->name, u); + snprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, file->name, u); H5E_BEGIN_TRY { H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t); @@ -1458,11 +1458,11 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) /* Sanity check to make sure that generated names are unique */ H5_GCC_CLANG_DIAG_OFF("format-nonliteral") - HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 0); - HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 1); + snprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 0); + snprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 1); H5_GCC_CLANG_DIAG_ON("format-nonliteral") - if (!HDstrcmp(member_name, temp)) { + if (!strcmp(member_name, temp)) { if (default_config) { temp = H5MM_xfree(temp); if (NULL == (temp = H5FD__family_get_default_printf_filename(filename))) @@ -1479,7 +1479,7 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) while (1) { /* Fix up the filename with the current member's number */ H5_GCC_CLANG_DIAG_OFF("format-nonliteral") - HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, current_member); + snprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, current_member); H5_GCC_CLANG_DIAG_ON("format-nonliteral") /* Attempt to delete the member files. If the first file throws an error diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index d73aa26..6f2c559 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -1220,10 +1220,10 @@ H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) if (finfo1->mBlockSize != finfo2->mBlockSize) { HGOTO_DONE(-1); } - if (HDstrcmp(finfo1->mOwner, finfo2->mOwner)) { + if (strcmp(finfo1->mOwner, finfo2->mOwner)) { HGOTO_DONE(-1); } - if (HDstrcmp(finfo1->mGroup, finfo2->mGroup)) { + if (strcmp(finfo1->mGroup, finfo2->mGroup)) { HGOTO_DONE(-1); } if (finfo1->mPermissions != finfo2->mPermissions) { diff --git a/src/H5FDint.c b/src/H5FDint.c index 20be6ed..082b602 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -2921,7 +2921,7 @@ H5FD_check_plugin_load(const H5FD_class_t *cls, const H5PL_key_t *key, bool *suc /* Which kind of key are we looking for? */ if (key->vfd.kind == H5FD_GET_DRIVER_BY_NAME) { /* Check if plugin name matches VFD class name */ - if (cls->name && !HDstrcmp(cls->name, key->vfd.u.name)) + if (cls->name && !strcmp(cls->name, key->vfd.u.name)) *success = true; } else { @@ -2957,7 +2957,7 @@ H5FD__get_driver_cb(void *obj, hid_t id, void *_op_data) FUNC_ENTER_PACKAGE_NOERR if (H5FD_GET_DRIVER_BY_NAME == op_data->key.kind) { - if (0 == HDstrcmp(cls->name, op_data->key.u.name)) { + if (0 == strcmp(cls->name, op_data->key.u.name)) { op_data->found_id = id; ret_value = H5_ITER_STOP; } /* end if */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index b6efd98..35374a8 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -245,9 +245,9 @@ H5FD_log_init(void) /* Check the use disabled file locks environment variable */ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); - if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) + if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = true; /* Override: Ignore disabled locks */ - else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) + else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) ignore_disabled_file_locks_s = false; /* Override: Don't ignore disabled locks */ else ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */ @@ -501,7 +501,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR( H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", - name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags); + name, myerrno, strerror(myerrno), flags, (unsigned)o_flags); } /* Stop timer for open() call */ @@ -545,7 +545,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #endif /* H5_HAVE_WIN32_API */ /* Retain a copy of the name used to open the file, for possible error reporting */ - HDstrncpy(file->filename, name, sizeof(file->filename)); + strncpy(file->filename, name, sizeof(file->filename)); file->filename[sizeof(file->filename) - 1] = '\0'; /* Get the flags for logging */ @@ -1239,7 +1239,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " "error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, " "bytes actually read = %llu, offset = %llu", - HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, + HDctime(&mytime), file->filename, file->fd, myerrno, strerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } @@ -1458,7 +1458,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " "error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = " "%llu, bytes actually written = %llu, offset = %llu", - HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, + HDctime(&mytime), file->filename, file->fd, myerrno, strerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index ee10483..8ddffb0 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -615,7 +615,7 @@ H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char * n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->maxaddr), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->size_t_blob), &buf[n_eaten]); assert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_eaten); - HDstrncpy(out->filename, (const char *)&buf[n_eaten], H5FD_MIRROR_XMIT_FILEPATH_MAX - 1); + strncpy(out->filename, (const char *)&buf[n_eaten], H5FD_MIRROR_XMIT_FILEPATH_MAX - 1); out->filename[H5FD_MIRROR_XMIT_FILEPATH_MAX - 1] = 0; /* force final NULL */ return H5FD_MIRROR_XMIT_OPEN_SIZE; @@ -653,7 +653,7 @@ H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->status), &buf[n_eaten]); assert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_eaten); - HDstrncpy(out->message, (const char *)&buf[n_eaten], H5FD_MIRROR_STATUS_MESSAGE_MAX - 1); + strncpy(out->message, (const char *)&buf[n_eaten], H5FD_MIRROR_STATUS_MESSAGE_MAX - 1); out->message[H5FD_MIRROR_STATUS_MESSAGE_MAX - 1] = 0; /* force NULL term */ return H5FD_MIRROR_XMIT_REPLY_SIZE; @@ -825,7 +825,7 @@ H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->maxaddr); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size_t_blob); assert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_writ); - HDstrncpy((char *)&dest[n_writ], x->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX); + strncpy((char *)&dest[n_writ], x->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX); return H5FD_MIRROR_XMIT_OPEN_SIZE; } /* end H5FD_mirror_xmit_encode_open() */ @@ -860,7 +860,7 @@ H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_ n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->status); assert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_writ); - HDstrncpy((char *)&dest[n_writ], x->message, H5FD_MIRROR_STATUS_MESSAGE_MAX); + strncpy((char *)&dest[n_writ], x->message, H5FD_MIRROR_STATUS_MESSAGE_MAX); return H5FD_MIRROR_XMIT_REPLY_SIZE; } /* end H5FD_mirror_xmit_encode_reply() */ @@ -1360,7 +1360,7 @@ H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); - if (HDstrlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX) + if (strlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "filename is too long"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); @@ -1417,7 +1417,7 @@ H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad open_xmit->flags = (uint32_t)flags; open_xmit->maxaddr = (uint64_t)maxaddr; open_xmit->size_t_blob = (uint64_t)((size_t)(-1)); - HDsnprintf(open_xmit->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX - 1, "%s", name); + snprintf(open_xmit->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX - 1, "%s", name); xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); if (NULL == xmit_buf) @@ -1512,15 +1512,14 @@ done: * We can ignore any response from the writer, if we receive * any reply at all. */ - if (HDwrite(file->sock_fd, "GOODBYE", HDstrlen("GOODBYE")) < 0) { + if (HDwrite(file->sock_fd, "GOODBYE", strlen("GOODBYE")) < 0) { HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to transmit close"); if (HDclose(file->sock_fd) < 0) HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket"); file->sock_fd = -1; /* invalidate for later */ } /* end if problem writing goodbye; go down hard */ else if (HDshutdown(file->sock_fd, SHUT_WR) < 0) - HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't shutdown socket write: %s", - HDstrerror(errno)); + HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't shutdown socket write: %s", strerror(errno)); } /* end if xmit encode failed */ if (file->sock_fd >= 0) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index b7cadb7..d2377cb 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -281,7 +281,7 @@ H5FD_mpio_init(void) /* Check if MPI driver has been loaded dynamically */ env = HDgetenv(HDF5_DRIVER); - if (env && !HDstrcmp(env, "mpio")) { + if (env && !strcmp(env, "mpio")) { int mpi_initialized = 0; /* Initialize MPI if not already initialized */ diff --git a/src/H5FDonion.c b/src/H5FDonion.c index 06db8df..5c0994c 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -464,7 +464,7 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) HDtime(&rawtime); info = HDgmtime(&rawtime); - HDstrftime(rec->time_of_creation, sizeof(rec->time_of_creation), "%Y%m%dT%H%M%SZ", info); + strftime(rec->time_of_creation, sizeof(rec->time_of_creation), "%Y%m%dT%H%M%SZ", info); rec->logical_eof = file->logical_eof; @@ -799,7 +799,7 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) FUNC_ENTER_PACKAGE - if (!HDstrcmp(config_str, "")) + if (!strcmp(config_str, "")) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty"); /* Initialize to the default values */ @@ -810,7 +810,7 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) fa->revision_num = H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST; fa->force_write_open = 0; fa->creation_flags = 0; - HDstrcpy(fa->comment, "initial comment"); + strcpy(fa->comment, "initial comment"); /* If a single integer is passed in as a string, it's a shortcut for the tools * (h5repack, h5diff, h5dump). Otherwise, the string should have curly brackets, @@ -829,51 +829,51 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) H5FD__onion_remove_unused_symbols(config_str_copy); /* The configure string can't be empty after removing the curly brackets */ - if (!HDstrcmp(config_str_copy, "")) + if (!strcmp(config_str_copy, "")) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty"); - token1 = HDstrtok(config_str_copy, ":"); - token2 = HDstrtok(NULL, ";"); + token1 = strtok(config_str_copy, ":"); + token2 = strtok(NULL, ";"); do { if (token1 && token2) { - if (!HDstrcmp(token1, "version")) { - if (!HDstrcmp(token2, "H5FD_ONION_FAPL_INFO_VERSION_CURR")) + if (!strcmp(token1, "version")) { + if (!strcmp(token2, "H5FD_ONION_FAPL_INFO_VERSION_CURR")) fa->version = H5FD_ONION_FAPL_INFO_VERSION_CURR; } - else if (!HDstrcmp(token1, "backing_fapl_id")) { - if (!HDstrcmp(token2, "H5P_DEFAULT")) + else if (!strcmp(token1, "backing_fapl_id")) { + if (!strcmp(token2, "H5P_DEFAULT")) fa->backing_fapl_id = H5P_DEFAULT; else if (!strcmp(token2, "H5I_INVALID_HID")) fa->backing_fapl_id = H5I_INVALID_HID; else fa->backing_fapl_id = strtoll(token2, NULL, 10); } - else if (!HDstrcmp(token1, "page_size")) { + else if (!strcmp(token1, "page_size")) { fa->page_size = (uint32_t)strtoul(token2, NULL, 10); } - else if (!HDstrcmp(token1, "revision_num")) { - if (!HDstrcmp(token2, "H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST")) + else if (!strcmp(token1, "revision_num")) { + if (!strcmp(token2, "H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST")) fa->revision_num = H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST; else fa->revision_num = (uint64_t)strtoull(token2, NULL, 10); } - else if (!HDstrcmp(token1, "force_write_open")) { + else if (!strcmp(token1, "force_write_open")) { fa->force_write_open = (uint8_t)strtoul(token2, NULL, 10); } - else if (!HDstrcmp(token1, "creation_flags")) { + else if (!strcmp(token1, "creation_flags")) { fa->creation_flags = (uint8_t)strtoul(token2, NULL, 10); } - else if (!HDstrcmp(token1, "comment")) { - HDstrcpy(fa->comment, token2); + else if (!strcmp(token1, "comment")) { + strcpy(fa->comment, token2); } else HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unknown token in the configure string: %s", token1); } - token1 = HDstrtok(NULL, ":"); - token2 = HDstrtok(NULL, ";"); + token1 = strtok(NULL, ":"); + token2 = strtok(NULL, ";"); } while (token1); } @@ -960,18 +960,18 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct"); /* Allocate space for onion VFD file names */ - if (NULL == (name_onion = H5MM_malloc(sizeof(char) * (HDstrlen(filename) + 7)))) + if (NULL == (name_onion = H5MM_malloc(sizeof(char) * (strlen(filename) + 7)))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate onion name string"); - HDsnprintf(name_onion, HDstrlen(filename) + 7, "%s.onion", filename); + snprintf(name_onion, strlen(filename) + 7, "%s.onion", filename); - if (NULL == (recovery_file_nameery = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10)))) + if (NULL == (recovery_file_nameery = H5MM_malloc(sizeof(char) * (strlen(name_onion) + 10)))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string"); - HDsnprintf(recovery_file_nameery, HDstrlen(name_onion) + 10, "%s.recovery", name_onion); + snprintf(recovery_file_nameery, strlen(name_onion) + 10, "%s.recovery", name_onion); file->recovery_file_name = recovery_file_nameery; - if (NULL == (file->recovery_file_name = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10)))) + if (NULL == (file->recovery_file_name = H5MM_malloc(sizeof(char) * (strlen(name_onion) + 10)))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string"); - HDsnprintf(file->recovery_file_name, HDstrlen(name_onion) + 10, "%s.recovery", name_onion); + snprintf(file->recovery_file_name, strlen(name_onion) + 10, "%s.recovery", name_onion); /* Translate H5P_DEFAULT to a real fapl ID, if necessary */ backing_fapl_id = H5FD__onion_get_legit_fapl_id(file->fa.backing_fapl_id); @@ -1191,7 +1191,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to duplicate comment string"); /* TODO: Lengths of strings should be size_t */ - file->curr_rev_record.comment_size = (uint32_t)HDstrlen(fa->comment) + 1; + file->curr_rev_record.comment_size = (uint32_t)strlen(fa->comment) + 1; } file->origin_eof = file->header.origin_eof; file->logical_eof = MAX(file->curr_rev_record.logical_eof, file->logical_eof); @@ -1670,7 +1670,7 @@ H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, uint64_t *revi H5TRACE3("e", "*six", filename, fapl_id, revision_count); /* Check args */ - if (!filename || !HDstrcmp(filename, "")) + if (!filename || !strcmp(filename, "")) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid file name"); if (!revision_count) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "revision count can't be null"); diff --git a/src/H5FDonion_header.c b/src/H5FDonion_header.c index 55a632c..e6790b3 100644 --- a/src/H5FDonion_header.c +++ b/src/H5FDonion_header.c @@ -134,7 +134,7 @@ H5FD__onion_header_decode(unsigned char *buf, H5FD_onion_header_t *header) assert(header != NULL); assert(H5FD_ONION_HEADER_VERSION_CURR == header->version); - if (HDstrncmp((const char *)buf, H5FD_ONION_HEADER_SIGNATURE, 4)) + if (strncmp((const char *)buf, H5FD_ONION_HEADER_SIGNATURE, 4)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid header signature"); if (buf[4] != H5FD_ONION_HEADER_VERSION_CURR) diff --git a/src/H5FDonion_history.c b/src/H5FDonion_history.c index 875d638..32bf483 100644 --- a/src/H5FDonion_history.c +++ b/src/H5FDonion_history.c @@ -172,7 +172,7 @@ H5FD__onion_history_decode(unsigned char *buf, H5FD_onion_history_t *history) assert(history != NULL); assert(H5FD_ONION_HISTORY_VERSION_CURR == history->version); - if (HDstrncmp((const char *)buf, H5FD_ONION_HISTORY_SIGNATURE, 4)) + if (strncmp((const char *)buf, H5FD_ONION_HISTORY_SIGNATURE, 4)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid signature"); if (H5FD_ONION_HISTORY_VERSION_CURR != buf[4]) diff --git a/src/H5FDonion_index.c b/src/H5FDonion_index.c index 4e7f8a3..4d1320e 100644 --- a/src/H5FDonion_index.c +++ b/src/H5FDonion_index.c @@ -604,7 +604,7 @@ H5FD__onion_revision_record_decode(unsigned char *buf, H5FD_onion_revision_recor assert(H5FD_ONION_REVISION_RECORD_VERSION_CURR == record->version); assert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == record->archival_index.version); - if (HDstrncmp((const char *)buf, H5FD_ONION_REVISION_RECORD_SIGNATURE, 4)) + if (strncmp((const char *)buf, H5FD_ONION_REVISION_RECORD_SIGNATURE, 4)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid signature"); if (H5FD_ONION_REVISION_RECORD_VERSION_CURR != buf[4]) diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 08a6971..2137703 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -623,7 +623,7 @@ H5Pget_fapl_ros3_token(hid_t fapl_id, size_t size, char *token_dst /*out*/) } /* Copy the token data out */ - tokenlen = HDstrlen(token_src); + tokenlen = strlen(token_src); if (size <= tokenlen) { tokenlen = size - 1; } @@ -659,7 +659,7 @@ H5FD__ros3_str_token_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED #endif if (*value) - if (NULL == (*value = HDstrdup(*value))) + if (NULL == (*value = strdup(*value))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy string property token"); done: @@ -691,7 +691,7 @@ H5FD__ros3_str_token_cmp(const void *_value1, const void *_value2, size_t H5_ATT if (*value1) { if (*value2) - ret_value = HDstrcmp(*value1, *value2); + ret_value = strcmp(*value1, *value2); else ret_value = 1; } @@ -798,7 +798,7 @@ H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5FD_ROS3 != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - if (HDstrlen(token) > H5FD_ROS3_MAX_SECRET_TOK_LEN) + if (strlen(token) > H5FD_ROS3_MAX_SECRET_TOK_LEN) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "specified token exceeds the internally specified maximum string length"); @@ -809,13 +809,13 @@ H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token) if (H5P_get(plist, ROS3_TOKEN_PROP_NAME, &token_src) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get token value"); - H5MM_memcpy(token_src, token, HDstrlen(token) + 1); + H5MM_memcpy(token_src, token, strlen(token) + 1); } else { token_src = (char *)malloc(sizeof(char) * (H5FD_ROS3_MAX_SECRET_TOK_LEN + 1)); if (token_src == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for token_src variable."); - H5MM_memcpy(token_src, token, HDstrlen(token) + 1); + H5MM_memcpy(token_src, token, strlen(token) + 1); if (H5P_insert(plist, ROS3_TOKEN_PROP_NAME, sizeof(char *), &token_src, NULL, NULL, NULL, NULL, H5FD__ros3_str_token_delete, H5FD__ros3_str_token_copy, H5FD__ros3_str_token_cmp, H5FD__ros3_str_token_close) < 0) @@ -1398,16 +1398,16 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) assert(purl2->host != NULL); /* URL: SCHEME */ - if (HDstrcmp(purl1->scheme, purl2->scheme)) + if (strcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1); /* URL: HOST */ - if (HDstrcmp(purl1->host, purl2->host)) + if (strcmp(purl1->host, purl2->host)) HGOTO_DONE(-1); /* URL: PORT */ if (purl1->port && purl2->port) { - if (HDstrcmp(purl1->port, purl2->port)) + if (strcmp(purl1->port, purl2->port)) HGOTO_DONE(-1); } else if (purl1->port) @@ -1417,7 +1417,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /* URL: PATH */ if (purl1->path && purl2->path) { - if (HDstrcmp(purl1->path, purl2->path)) + if (strcmp(purl1->path, purl2->path)) HGOTO_DONE(-1); } else if (purl1->path && !purl2->path) @@ -1427,7 +1427,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /* URL: QUERY */ if (purl1->query && purl2->query) { - if (HDstrcmp(purl1->query, purl2->query)) + if (strcmp(purl1->query, purl2->query)) HGOTO_DONE(-1); } else if (purl1->query && !purl2->query) @@ -1437,7 +1437,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /* FAPL: AWS_REGION */ if (f1->fa.aws_region[0] != '\0' && f2->fa.aws_region[0] != '\0') { - if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) + if (strcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1); } else if (f1->fa.aws_region[0] != '\0') @@ -1447,7 +1447,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /* FAPL: SECRET_ID */ if (f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') { - if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) + if (strcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1); } else if (f1->fa.secret_id[0] != '\0') @@ -1457,7 +1457,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /* FAPL: SECRET_KEY */ if (f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') { - if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) + if (strcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1); } else if (f1->fa.secret_key[0] != '\0') diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 83a33a9..7c5ff1d 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -227,7 +227,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (name == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to operate on null name"); - namelen = HDstrlen(name); + namelen = strlen(name); /*********************** * PREPARE ALL STRINGS * @@ -248,7 +248,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) */ if (value != NULL) { int ret = 0; - size_t valuelen = HDstrlen(value); + size_t valuelen = strlen(value); size_t catlen = namelen + valuelen + 2; /* +2 from ": " */ size_t catwrite = catlen + 3; /* 3 not 1 to quiet compiler warning */ @@ -265,10 +265,10 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) nvcat = (char *)H5MM_malloc(sizeof(char) * catwrite); if (nvcat == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for concatenated string."); - ret = HDsnprintf(nvcat, catwrite, "%s: %s", name, value); + ret = snprintf(nvcat, catwrite, "%s: %s", name, value); if (ret < 0 || (size_t)ret > catlen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot concatenate `%s: %s", name, value); - assert(catlen == HDstrlen(nvcat)); + assert(catlen == strlen(nvcat)); /* create new_node, should we need it */ @@ -318,7 +318,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) /* Check whether to modify/remove first node in list */ - if (HDstrcmp(lowername, node_ptr->lowername) == 0) { + if (strcmp(lowername, node_ptr->lowername) == 0) { is_looking = false; @@ -396,7 +396,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) new_node = NULL; } } - else if (HDstrcmp(lowername, node_ptr->lowername) < 0) { + else if (strcmp(lowername, node_ptr->lowername) < 0) { is_looking = false; @@ -440,7 +440,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) * APPEND NEW NODE * *******************/ - assert(HDstrcmp(lowername, node_ptr->lowername) > 0); + assert(strcmp(lowername, node_ptr->lowername) > 0); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -448,7 +448,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) node_ptr->next = new_node; } } - else if (HDstrcmp(lowername, node_ptr->next->lowername) < 0) { + else if (strcmp(lowername, node_ptr->next->lowername) < 0) { is_looking = false; @@ -463,7 +463,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) * INSERT NEW NODE * *******************/ - assert(HDstrcmp(lowername, node_ptr->lowername) > 0); + assert(strcmp(lowername, node_ptr->lowername) > 0); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -472,7 +472,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) node_ptr->next = new_node; } } - else if (HDstrcmp(lowername, node_ptr->next->lowername) == 0) { + else if (strcmp(lowername, node_ptr->next->lowername) == 0) { is_looking = false; @@ -681,7 +681,7 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch request->first_header = NULL; /* malloc and copy strings for the structure */ - reslen = HDstrlen(_resource); + reslen = strlen(_resource); if (_resource[0] == '/') { res = (char *)H5MM_malloc(sizeof(char) * (reslen + 1)); @@ -695,20 +695,20 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); *res = '/'; H5MM_memcpy((&res[1]), _resource, (reslen + 1)); - assert((reslen + 1) == HDstrlen(res)); + assert((reslen + 1) == strlen(res)); } /* end if (else resource string not starting with '/') */ - verblen = HDstrlen(_verb) + 1; + verblen = strlen(_verb) + 1; verb = (char *)H5MM_malloc(sizeof(char) * verblen); if (verb == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for verb string"); - HDstrncpy(verb, _verb, verblen); + strncpy(verb, _verb, verblen); - vrsnlen = HDstrlen(_http_version) + 1; + vrsnlen = strlen(_http_version) + 1; vrsn = (char *)H5MM_malloc(sizeof(char) * vrsnlen); if (vrsn == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for http-version string"); - HDstrncpy(vrsn, _http_version, vrsnlen); + strncpy(vrsn, _http_version, vrsnlen); /* place new copies into structure */ request->resource = res; @@ -925,8 +925,8 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find \"Content-Length\" in response."); /* move "start" to beginning of value in line; find end of line */ - start = start + HDstrlen("\r\nContent-Length: "); - end = HDstrstr(start, "\r\n"); + start = start + strlen("\r\nContent-Length: "); + end = strstr(start, "\r\n"); if (end == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find end of content length line"); @@ -1059,13 +1059,13 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "token cannot be null."); /* copy strings */ - tmplen = HDstrlen(region) + 1; + tmplen = strlen(region) + 1; handle->region = (char *)H5MM_malloc(sizeof(char) * tmplen); if (handle->region == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle region copy."); H5MM_memcpy(handle->region, region, tmplen); - tmplen = HDstrlen(id) + 1; + tmplen = strlen(id) + 1; handle->secret_id = (char *)H5MM_malloc(sizeof(char) * tmplen); if (handle->secret_id == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle ID copy."); @@ -1077,7 +1077,7 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle key copy."); H5MM_memcpy(handle->signing_key, signing_key, tmplen); - tmplen = HDstrlen(token) + 1; + tmplen = strlen(token) + 1; handle->token = (char *)H5MM_malloc(sizeof(char) * tmplen); if (handle->token == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle token copy."); @@ -1203,7 +1203,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) char *rangebytesstr = NULL; hrb_t *request = NULL; int ret = 0; /* working variable to check */ - /* return value of HDsnprintf */ + /* return value of snprintf */ char *authorization = NULL; char *buffer1 = NULL; char *signed_headers = NULL; @@ -1259,8 +1259,8 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE + 1)); if (rangebytesstr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); - ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-%" PRIuHADDR, - offset, offset + len - 1); + ret = snprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-%" PRIuHADDR, + offset, offset + len - 1); if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } @@ -1268,7 +1268,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE + 1)); if (rangebytesstr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); - ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-", offset); + ret = snprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-", offset); if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } @@ -1288,7 +1288,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) /* Pass in range directly */ char *bytesrange_ptr = NULL; /* pointer past "bytes=" portion */ - bytesrange_ptr = HDstrchr(rangebytesstr, '='); + bytesrange_ptr = strchr(rangebytesstr, '='); assert(bytesrange_ptr != NULL); bytesrange_ptr++; /* move to first char past '=' */ assert(*bytesrange_ptr != '\0'); @@ -1376,7 +1376,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); assert(headers->magic == S3COMMS_HRB_NODE_MAGIC); - if (HDstrlen((const char *)handle->token) > 0) { + if (strlen((const char *)handle->token) > 0) { if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "x-amz-security-token", (const char *)handle->token)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-security-token header"); @@ -1414,7 +1414,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad string-to-sign"); /* buffer1 -> signature */ if (FAIL == H5FD_s3comms_HMAC_SHA256(handle->signing_key, SHA256_DIGEST_LENGTH, buffer2, - HDstrlen(buffer2), buffer1)) + strlen(buffer2), buffer1)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad signature"); iso8601now[8] = 0; /* trim to yyyyMMDD */ @@ -1422,9 +1422,9 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) if (ret == 0 || ret >= S3COMMS_MAX_CREDENTIAL_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 credential string"); - ret = HDsnprintf(authorization, 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN, - "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", buffer2, - signed_headers, buffer1); + ret = snprintf(authorization, 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN, + "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", buffer2, + signed_headers, buffer1); if (ret <= 0 || ret >= 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 authorization string"); @@ -1674,14 +1674,14 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "signed headers destination cannot be null."); /* HTTP verb, resource path, and query string lines */ - cr_len = (HDstrlen(http_request->verb) + HDstrlen(http_request->resource) + HDstrlen(query_params) + + cr_len = (strlen(http_request->verb) + strlen(http_request->resource) + strlen(query_params) + (size_t)3); /* three newline chars */ if (cr_len >= cr_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); /* TODO: compiler warning */ - ret = HDsnprintf(canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", http_request->verb, - http_request->resource, query_params); + ret = snprintf(canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", http_request->verb, + http_request->resource, query_params); if (ret < 0 || (size_t)ret >= cr_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to compose canonical request first line"); @@ -1691,38 +1691,38 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c assert(node->magic == S3COMMS_HRB_NODE_MAGIC); - ret = HDsnprintf(tmpstr, 1024, "%s:%s\n", node->lowername, node->value); + ret = snprintf(tmpstr, 1024, "%s:%s\n", node->lowername, node->value); if (ret < 0 || ret >= 1024) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s", node->lowername, node->value); - cr_len += HDstrlen(tmpstr); + cr_len += strlen(tmpstr); if (cr_len + 1 > cr_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); - HDstrcat(canonical_request_dest, tmpstr); + strcat(canonical_request_dest, tmpstr); - ret = HDsnprintf(tmpstr, 1024, "%s;", node->lowername); + ret = snprintf(tmpstr, 1024, "%s;", node->lowername); if (ret < 0 || ret >= 1024) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to append semicolon to lowername %s", node->lowername); - sh_len += HDstrlen(tmpstr); + sh_len += strlen(tmpstr); if (sh_len + 1 > sh_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in signed headers"); - HDstrcat(signed_headers_dest, tmpstr); + strcat(signed_headers_dest, tmpstr); node = node->next; } /* end while node is not NULL */ /* remove trailing ';' from signed headers sequence */ - signed_headers_dest[HDstrlen(signed_headers_dest) - 1] = '\0'; + signed_headers_dest[strlen(signed_headers_dest) - 1] = '\0'; /* append signed headers and payload hash * NOTE: at present, no HTTP body is handled, per the nature of * requests/range-gets */ - HDstrcat(canonical_request_dest, "\n"); - HDstrcat(canonical_request_dest, signed_headers_dest); - HDstrcat(canonical_request_dest, "\n"); - HDstrcat(canonical_request_dest, EMPTY_SHA256); + strcat(canonical_request_dest, "\n"); + strcat(canonical_request_dest, signed_headers_dest); + strcat(canonical_request_dest, "\n"); + strcat(canonical_request_dest, EMPTY_SHA256); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1774,8 +1774,8 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bytes sequence cannot be null."); for (i = 0; i < msg_len; i++) { - int chars_written = HDsnprintf(&(dest[i * 2]), 3, /* 'X', 'X', '\n' */ - (lowercase == true) ? "%02x" : "%02X", msg[i]); + int chars_written = snprintf(&(dest[i * 2]), 3, /* 'X', 'X', '\n' */ + (lowercase == true) ? "%02x" : "%02X", msg[i]); if (chars_written != 2) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem while writing hex chars for %c", msg[i]); } @@ -1957,7 +1957,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha #endif /* format target line for start of profile */ - if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) + if (32 < snprintf(profile_line, 32, "[%s]", profile_name)) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label"); /* look for start of profile */ @@ -1966,10 +1966,10 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha for (buffer_i = 0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; - line_buffer = HDfgets(line_buffer, 128, file); + line_buffer = fgets(line_buffer, 128, file); if (line_buffer == NULL) /* reached end of file */ goto done; - } while (HDstrncmp(line_buffer, profile_line, HDstrlen(profile_line))); + } while (strncmp(line_buffer, profile_line, strlen(profile_line))); /* extract credentials from lines */ do { @@ -1978,7 +1978,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha buffer[buffer_i] = 0; /* collect a line from file */ - line_buffer = HDfgets(line_buffer, 128, file); + line_buffer = fgets(line_buffer, 128, file); if (line_buffer == NULL) goto done; /* end of file */ @@ -1989,12 +1989,12 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha char line_prefix[128]; setting_name = setting_names[setting_i]; - setting_name_len = HDstrlen(setting_name); - if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) + setting_name_len = strlen(setting_name); + if (snprintf(line_prefix, 128, "%s=", setting_name) < 0) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix"); /* found a matching name? */ - if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { + if (!strncmp(line_buffer, line_prefix, setting_name_len + 1)) { found_setting = 1; /* skip NULL destination buffer */ @@ -2011,7 +2011,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha line_buffer++; /* was pointing at '='; advance */ /* copy line buffer into out pointer */ - HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, HDstrlen(line_buffer)); + strncpy(setting_pointers[setting_i], (const char *)line_buffer, strlen(line_buffer)); /* "trim" tailing whitespace by replacing with null terminator*/ buffer_i = 0; @@ -2074,13 +2074,13 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * #endif #ifdef H5_HAVE_WIN32_API - ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("USERPROFILE")); + ret = snprintf(awspath, 117, "%s/.aws/", HDgetenv("USERPROFILE")); #else - ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME")); + ret = snprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME")); #endif if (ret < 0 || (size_t)ret >= 117) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path"); - ret = HDsnprintf(filepath, 128, "%s%s", awspath, "credentials"); + ret = snprintf(filepath, 128, "%s%s", awspath, "credentials"); if (ret < 0 || (size_t)ret >= 128) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path"); @@ -2094,7 +2094,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * credfile = NULL; } /* end if credential file opened */ - ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config"); + ret = snprintf(filepath, 128, "%s%s", awspath, "config"); if (ret < 0 || (size_t)ret >= 128) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path"); credfile = fopen(filepath, "r"); @@ -2218,7 +2218,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) if (str == NULL || *str == '\0') HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid url string"); - urllen = (long int)HDstrlen(str); + urllen = (long int)strlen(str); purl = (parsed_url_t *)H5MM_malloc(sizeof(parsed_url_t)); if (purl == NULL) @@ -2234,7 +2234,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) * READ SCHEME * ***************/ - tmpstr = HDstrchr(curstr, ':'); + tmpstr = strchr(curstr, ':'); if (tmpstr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction: probably not URL"); len = tmpstr - curstr; @@ -2251,7 +2251,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) purl->scheme = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->scheme == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for SCHEME"); - HDstrncpy(purl->scheme, curstr, (size_t)len); + strncpy(purl->scheme, curstr, (size_t)len); purl->scheme[len] = '\0'; for (i = 0; i < len; i++) purl->scheme[i] = (char)HDtolower(purl->scheme[i]); @@ -2291,7 +2291,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) purl->host = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->host == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for HOST"); - HDstrncpy(purl->host, curstr, (size_t)len); + strncpy(purl->host, curstr, (size_t)len); purl->host[len] = 0; /************* @@ -2316,7 +2316,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->port == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PORT"); - HDstrncpy(purl->port, curstr, (size_t)len); + strncpy(purl->port, curstr, (size_t)len); purl->port[len] = 0; } /* end if PORT element */ @@ -2339,7 +2339,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) purl->path = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->path == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PATH"); - HDstrncpy(purl->path, curstr, (size_t)len); + strncpy(purl->path, curstr, (size_t)len); purl->path[len] = 0; } } /* end if PATH element */ @@ -2361,7 +2361,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) purl->query = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->query == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for QUERY"); - HDstrncpy(purl->query, curstr, (size_t)len); + strncpy(purl->query, curstr, (size_t)len); purl->query[len] = 0; } /* end if QUERY exists */ @@ -2446,7 +2446,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr fprintf(stdout, " SINGLE-BYTE\n"); #endif *repr_len = 3; - chars_written = HDsnprintf(repr, 4, "%%%02X", c); + chars_written = snprintf(repr, 4, "%%%02X", c); if (chars_written < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); } /* end if single-byte unicode char */ @@ -2497,7 +2497,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr acc += (stack_size > 2) ? 0x20 : 0; /* 0x00100000 */ acc += (stack_size > 3) ? 0x10 : 0; /* 0x00010000 */ stack_size--; - chars_written = HDsnprintf(repr, 4, "%%%02X", (unsigned char)(acc + stack[stack_size])); + chars_written = snprintf(repr, 4, "%%%02X", (unsigned char)(acc + stack[stack_size])); if (chars_written < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); *repr_len += 3; @@ -2509,7 +2509,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr /* 10xxxxxx */ for (i = 0; i < stack_size; i++) { chars_written = - HDsnprintf(&repr[i * 3 + 3], 4, "%%%02X", (unsigned char)(0x80 + stack[stack_size - 1 - i])); + snprintf(&repr[i * 3 + 3], 4, "%%%02X", (unsigned char)(0x80 + stack[stack_size - 1 - i])); if (chars_written < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); *repr_len += 3; @@ -2565,7 +2565,7 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi unsigned char datekey[SHA256_DIGEST_LENGTH]; unsigned char dateregionkey[SHA256_DIGEST_LENGTH]; unsigned char dateregionservicekey[SHA256_DIGEST_LENGTH]; - int ret = 0; /* return value of HDsnprintf */ + int ret = 0; /* return value of snprintf */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -2583,24 +2583,24 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi if (iso8601now == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`iso8601now` cannot be NULL."); - AWS4_secret_len = 4 + HDstrlen(secret) + 1; + AWS4_secret_len = 4 + strlen(secret) + 1; AWS4_secret = (char *)H5MM_malloc(sizeof(char *) * AWS4_secret_len); if (AWS4_secret == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Could not allocate space."); /* prepend "AWS4" to start of the secret key */ - ret = HDsnprintf(AWS4_secret, AWS4_secret_len, "%s%s", "AWS4", secret); + ret = snprintf(AWS4_secret, AWS4_secret_len, "%s%s", "AWS4", secret); if ((size_t)ret != (AWS4_secret_len - 1)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem writing AWS4+secret `%s`", secret); /* hash_func, key, len(key), msg, len(msg), digest_dest, digest_len_dest * we know digest length, so ignore via NULL */ - HMAC(EVP_sha256(), (const unsigned char *)AWS4_secret, (int)HDstrlen(AWS4_secret), + HMAC(EVP_sha256(), (const unsigned char *)AWS4_secret, (int)strlen(AWS4_secret), (const unsigned char *)iso8601now, 8, /* 8 --> length of 8 --> "yyyyMMDD" */ datekey, NULL); HMAC(EVP_sha256(), (const unsigned char *)datekey, SHA256_DIGEST_LENGTH, (const unsigned char *)region, - HDstrlen(region), dateregionkey, NULL); + strlen(region), dateregionkey, NULL); HMAC(EVP_sha256(), (const unsigned char *)dateregionkey, SHA256_DIGEST_LENGTH, (const unsigned char *)"s3", 2, dateregionservicekey, NULL); HMAC(EVP_sha256(), (const unsigned char *)dateregionservicekey, SHA256_DIGEST_LENGTH, @@ -2653,7 +2653,7 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const char day[9]; char hexsum[SHA256_DIGEST_LENGTH * 2 + 1]; size_t i = 0; - int ret = 0; /* HDsnprintf return value */ + int ret = 0; /* snprintf return value */ herr_t ret_value = SUCCEED; char tmp[128]; @@ -2678,24 +2678,24 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const checksum[i] = '\0'; hexsum[i] = '\0'; } - HDstrncpy(day, now, 8); + strncpy(day, now, 8); day[8] = '\0'; - ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region); + ret = snprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region); if (ret <= 0 || ret >= 127) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem adding day and region to string"); H5MM_memcpy((dest + d), "AWS4-HMAC-SHA256\n", 17); d = 17; - H5MM_memcpy((dest + d), now, HDstrlen(now)); - d += HDstrlen(now); + H5MM_memcpy((dest + d), now, strlen(now)); + d += strlen(now); dest[d++] = '\n'; - H5MM_memcpy((dest + d), tmp, HDstrlen(tmp)); - d += HDstrlen(tmp); + H5MM_memcpy((dest + d), tmp, strlen(tmp)); + d += strlen(tmp); dest[d++] = '\n'; - SHA256((const unsigned char *)req, HDstrlen(req), checksum); + SHA256((const unsigned char *)req, strlen(req), checksum); if (H5FD_s3comms_bytes_to_hex(hexsum, (const unsigned char *)checksum, SHA256_DIGEST_LENGTH, true) == FAIL) diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 1912212..b29d2d8 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -130,7 +130,7 @@ * * Format "S3 Credential" string from inputs, for AWS4. * - * Wrapper for HDsnprintf(). + * Wrapper for snprintf(). * * _HAS NO ERROR-CHECKING FACILITIES_ * It is left to programmer to ensure that return value confers success. @@ -153,8 +153,8 @@ *--------------------------------------------------------------------------- */ #define S3COMMS_FORMAT_CREDENTIAL(dest, access, iso8601_date, region, service) \ - HDsnprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE, "%s/%s/%s/%s/aws4_request", (access), (iso8601_date), \ - (region), (service)) + snprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE, "%s/%s/%s/%s/aws4_request", (access), (iso8601_date), \ + (region), (service)) /********************* * PUBLIC STRUCTURES * diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 6f4bb42..fa48aa3 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -205,9 +205,9 @@ H5FD_sec2_init(void) /* Check the use disabled file locks environment variable */ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); - if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) + if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) ignore_disabled_file_locks_s = true; /* Override: Ignore disabled locks */ - else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) + else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) ignore_disabled_file_locks_s = false; /* Override: Don't ignore disabled locks */ else ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */ @@ -323,7 +323,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr HGOTO_ERROR( H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", - name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags); + name, myerrno, strerror(myerrno), flags, (unsigned)o_flags); } /* end if */ if (HDfstat(fd, &sb) < 0) @@ -368,7 +368,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr } /* Retain a copy of the name used to open the file, for possible error reporting */ - HDstrncpy(file->filename, name, sizeof(file->filename)); + strncpy(file->filename, name, sizeof(file->filename)); file->filename[sizeof(file->filename) - 1] = '\0'; /* Check for non-default FAPL */ @@ -703,7 +703,7 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " "error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, " "bytes actually read = %llu, offset = %llu", - HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, + HDctime(&mytime), file->filename, file->fd, myerrno, strerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ @@ -809,7 +809,7 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " "error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = " "%llu, bytes actually written = %llu, offset = %llu", - HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, + HDctime(&mytime), file->filename, file->fd, myerrno, strerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 93d8d3b..723b191 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -367,8 +367,8 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) fapl_ptr = default_fapl; } - HDstrncpy(config->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1); - HDstrncpy(config->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); + strncpy(config->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1); + strncpy(config->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); config->ignore_wo_errs = fapl_ptr->ignore_wo_errs; /* Copy R/W and W/O FAPLs */ @@ -448,9 +448,9 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_spli } /* end if W/O VFD is non-default */ fapl_out->ignore_wo_errs = vfd_config->ignore_wo_errs; - HDstrncpy(fapl_out->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1); + strncpy(fapl_out->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1); fapl_out->wo_path[H5FD_SPLITTER_PATH_MAX] = '\0'; - HDstrncpy(fapl_out->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); + strncpy(fapl_out->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); fapl_out->log_file_path[H5FD_SPLITTER_PATH_MAX] = '\0'; fapl_out->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ fapl_out->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ @@ -527,32 +527,32 @@ H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, const ch assert(base_filename); /* Check that output buffer can hold base filename + `_wo` suffix */ - old_filename_len = HDstrlen(base_filename); - if (old_filename_len > H5FD_SPLITTER_PATH_MAX - HDstrlen(suffix) - 1) + old_filename_len = strlen(base_filename); + if (old_filename_len > H5FD_SPLITTER_PATH_MAX - strlen(suffix) - 1) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length"); /* Determine if filename contains a ".h5" extension. */ - if ((file_extension = HDstrstr(base_filename, ".h5"))) { + if ((file_extension = strstr(base_filename, ".h5"))) { /* Insert the suffix between the filename and ".h5" extension. */ - HDstrcpy(new_path, base_filename); - file_extension = HDstrstr(new_path, ".h5"); - HDsprintf(file_extension, "%s%s", suffix, ".h5"); + strcpy(new_path, base_filename); + file_extension = strstr(new_path, ".h5"); + sprintf(file_extension, "%s%s", suffix, ".h5"); } - else if ((file_extension = HDstrrchr(base_filename, '.'))) { + else if ((file_extension = strrchr(base_filename, '.'))) { char *new_extension_loc = NULL; /* If the filename doesn't contain a ".h5" extension, but contains * AN extension, just insert the suffix before that extension. */ - HDstrcpy(new_path, base_filename); - new_extension_loc = HDstrrchr(new_path, '.'); - HDsprintf(new_extension_loc, "%s%s", suffix, file_extension); + strcpy(new_path, base_filename); + new_extension_loc = strrchr(new_path, '.'); + sprintf(new_extension_loc, "%s%s", suffix, file_extension); } else { /* If the filename doesn't contain an extension at all, just insert * the suffix at the end of the filename. */ - HDsnprintf(new_path, new_path_len, "%s%s", base_filename, suffix); + snprintf(new_path, new_path_len, "%s%s", base_filename, suffix); } done: @@ -720,8 +720,8 @@ H5FD__splitter_fapl_copy(const void *_old_fa) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL"); H5MM_memcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t)); - HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1); - HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); + strncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1); + strncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); /* Copy R/W and W/O FAPLs */ if (H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0) @@ -833,8 +833,8 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha } /* Copy simpler info */ - HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1); - HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); + strncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1); + strncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1); file_ptr->fa.ignore_wo_errs = fapl_ptr->ignore_wo_errs; /* Copy R/W and W/O channel FAPLs. */ @@ -1575,11 +1575,11 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const size_t size; char *s; - size = HDstrlen(atfunc) + HDstrlen(msg) + 3; /* ':', ' ', '\n' */ + size = strlen(atfunc) + strlen(msg) + 3; /* ':', ' ', '\n' */ s = (char *)H5MM_malloc(sizeof(char) * (size + 1)); if (NULL == s) ret_value = FAIL; - else if (size < (size_t)HDsnprintf(s, size + 1, "%s: %s\n", atfunc, msg)) + else if (size < (size_t)snprintf(s, size + 1, "%s: %s\n", atfunc, msg)) ret_value = FAIL; else if (size != fwrite(s, 1, size, file->logfp)) ret_value = FAIL; diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index c58a3d5..0dfcc36 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -224,7 +224,7 @@ H5FD_ioc_init(void) /* Check if IOC VFD has been loaded dynamically */ env_var = HDgetenv(HDF5_DRIVER); - if (env_var && !HDstrcmp(env_var, H5FD_IOC_NAME)) { + if (env_var && !strcmp(env_var, H5FD_IOC_NAME)) { int mpi_initialized = 0; int provided = 0; @@ -528,7 +528,7 @@ H5FD__ioc_sb_encode(H5FD_t *_file, char *name, unsigned char *buf) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get subfiling context object"); /* Encode driver name */ - HDstrncpy(name, "IOC", 9); + strncpy(name, "IOC", 9); name[8] = '\0'; /* Encode configuration structure magic number */ @@ -573,7 +573,7 @@ H5FD__ioc_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) if (NULL == (sf_context = H5_get_subfiling_object(file->context_id))) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get subfiling context object"); - if (HDstrncmp(name, "IOC", 9)) + if (strncmp(name, "IOC", 9)) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver name in superblock"); /* Decode configuration structure magic number */ @@ -1495,8 +1495,8 @@ H5FD__ioc_del(const char *name, hid_t fapl) /* TODO: No support for subfile directory prefix currently */ /* TODO: Possibly try loading config file prefix from file before deleting */ - HDsnprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, - prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); + snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, + prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); if (NULL == (config_file = fopen(tmp_filename, "r"))) { if (ENOENT == errno) { @@ -1535,8 +1535,8 @@ H5FD__ioc_del(const char *name, hid_t fapl) for (int i = 0; i < n_subfiles; i++) { /* TODO: No support for subfile directory prefix currently */ - HDsnprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_FILENAME_TEMPLATE, file_dirname, - base_filename, (uint64_t)st.st_ino, num_digits, i + 1, n_subfiles); + snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_FILENAME_TEMPLATE, file_dirname, + base_filename, (uint64_t)st.st_ino, num_digits, i + 1, n_subfiles); if (HDremove(tmp_filename) < 0) { #ifdef H5FD_IOC_DEBUG diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index 8f738c7..058ac83 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -724,7 +724,7 @@ H5FD__subfiling_sb_size(H5FD_t *_file) } else { if (sf_context->config_file_prefix) { - ret_value += HDstrlen(sf_context->config_file_prefix) + 1; + ret_value += strlen(sf_context->config_file_prefix) + 1; } } @@ -780,7 +780,7 @@ H5FD__subfiling_sb_encode(H5FD_t *_file, char *name, unsigned char *buf) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get subfiling context object"); /* Encode driver name */ - HDstrncpy(name, "Subfilin", 9); + strncpy(name, "Subfilin", 9); name[8] = '\0'; /* Encode configuration structure magic number */ @@ -802,7 +802,7 @@ H5FD__subfiling_sb_encode(H5FD_t *_file, char *name, unsigned char *buf) /* Encode config file prefix string length */ if (sf_context->config_file_prefix) { - prefix_len = HDstrlen(sf_context->config_file_prefix) + 1; + prefix_len = strlen(sf_context->config_file_prefix) + 1; H5_CHECKED_ASSIGN(tmpu64, uint64_t, prefix_len, size_t); } else @@ -862,7 +862,7 @@ H5FD__subfiling_sb_decode(H5FD_t *_file, const char *name, const unsigned char * if (NULL == (sf_context = H5_get_subfiling_object(file->context_id))) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get subfiling context object"); - if (HDstrncmp(name, "Subfilin", 9)) + if (strncmp(name, "Subfilin", 9)) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver name in superblock"); /* Decode configuration structure magic number */ @@ -2426,7 +2426,7 @@ H5FD__subfiling_lock(H5FD_t *_file, bool rw) if (file->fa.require_ioc) { #ifdef VERBOSE - HDputs("Subfiling driver doesn't support file locking"); + puts("Subfiling driver doesn't support file locking"); #endif } else { diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 645701c..50ca6af 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -562,7 +562,7 @@ H5_open_subfiling_stub_file(const char *name, unsigned flags, MPI_Comm file_comm stub_file_id = UINT64_MAX; H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't stat HDF5 stub file, errno = %d, error message = '%s'", errno, - HDstrerror(errno)); + strerror(errno)); } else stub_file_id = (uint64_t)st.st_ino; @@ -668,7 +668,7 @@ H5_open_subfiles(const char *base_filename, uint64_t file_id, H5FD_subfiling_par if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(file_comm, &mpi_rank))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mpi_code); - HDsnprintf(sf_context->sf_logfile_name, PATH_MAX, "%s.log.%d", sf_context->h5_filename, mpi_rank); + snprintf(sf_context->sf_logfile_name, PATH_MAX, "%s.log.%d", sf_context->h5_filename, mpi_rank); if (NULL == (sf_context->sf_logfile = fopen(sf_context->sf_logfile_name, "a"))) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, @@ -778,7 +778,7 @@ init_subfiling(const char *base_filename, uint64_t file_id, H5FD_subfiling_param /* Check if a prefix has been set for the configuration file name */ prefix_env = HDgetenv(H5FD_SUBFILING_CONFIG_FILE_PREFIX); if (prefix_env) { - if (NULL == (new_context->config_file_prefix = HDstrdup(prefix_env))) + if (NULL == (new_context->config_file_prefix = strdup(prefix_env))) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "couldn't copy config file prefix string"); } @@ -1202,7 +1202,7 @@ get_ioc_selection_criteria_from_env(H5FD_subfiling_ioc_select_t *ioc_selection_t * '1:64' to specify the "every Nth rank" strategy with a * criteria of '64'. */ - opt_value = HDstrchr(env_value, ':'); + opt_value = strchr(env_value, ':'); if (opt_value) { long check_value; @@ -1815,13 +1815,13 @@ init_subfiling_context(subfiling_context_t *sf_context, const char *base_filenam sf_context->sf_logfile = NULL; #endif - if (NULL == (sf_context->h5_filename = HDstrdup(base_filename))) + if (NULL == (sf_context->h5_filename = strdup(base_filename))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfiling filename"); /* Check for a subfile name prefix setting in the environment */ if ((env_value = HDgetenv(H5FD_SUBFILING_SUBFILE_PREFIX))) { - if (NULL == (sf_context->subfile_prefix = HDstrdup(env_value))) + if (NULL == (sf_context->subfile_prefix = strdup(env_value))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't copy subfile prefix value"); } @@ -2204,8 +2204,8 @@ ioc_open_files(int64_t file_context_id, int file_acc_flags) * and the configuration file will be named: * ABC.h5.subfile_<file-number>.config */ - HDsnprintf(filepath, PATH_MAX, "%s/" H5FD_SUBFILING_FILENAME_TEMPLATE, subfile_dir, base, - sf_context->h5_file_id, num_digits, subfile_idx, num_subfiles); + snprintf(filepath, PATH_MAX, "%s/" H5FD_SUBFILING_FILENAME_TEMPLATE, subfile_dir, base, + sf_context->h5_file_id, num_digits, subfile_idx, num_subfiles); if ((sf_context->sf_fids[i] = HDopen(filepath, file_acc_flags, mode)) < 0) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "failed to open subfile"); @@ -2302,8 +2302,8 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfiling configuration filename"); - HDsnprintf(config_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, config_dir, - base_filename, sf_context->h5_file_id); + snprintf(config_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, config_dir, + base_filename, sf_context->h5_file_id); /* Determine whether a subfiling configuration file exists */ errno = 0; @@ -2334,42 +2334,42 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c "couldn't allocate buffer for writing to subfiling configuration file"); /* Write the subfiling stripe size to the configuration file */ - HDsnprintf(line_buf, PATH_MAX, "stripe_size=%" PRId64 "\n", sf_context->sf_stripe_size); - if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + snprintf(line_buf, PATH_MAX, "stripe_size=%" PRId64 "\n", sf_context->sf_stripe_size); + if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write the number of I/O concentrators to the configuration file */ - HDsnprintf(line_buf, PATH_MAX, "aggregator_count=%d\n", sf_context->topology->n_io_concentrators); - if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + snprintf(line_buf, PATH_MAX, "aggregator_count=%d\n", sf_context->topology->n_io_concentrators); + if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write the number of subfiles to the configuration file */ - HDsnprintf(line_buf, PATH_MAX, "subfile_count=%d\n", n_subfiles); - if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + snprintf(line_buf, PATH_MAX, "subfile_count=%d\n", n_subfiles); + if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write the base HDF5 filename to the configuration file */ - HDsnprintf(line_buf, PATH_MAX, "hdf5_file=%s\n", sf_context->h5_filename); - if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + snprintf(line_buf, PATH_MAX, "hdf5_file=%s\n", sf_context->h5_filename); + if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write the optional subfile directory prefix to the configuration file */ - HDsnprintf(line_buf, PATH_MAX, "subfile_dir=%s\n", subfile_dir); - if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + snprintf(line_buf, PATH_MAX, "subfile_dir=%s\n", subfile_dir); + if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write out each subfile name to the configuration file */ num_digits = (int)(log10(n_subfiles) + 1); for (int k = 0; k < n_subfiles; k++) { - HDsnprintf(line_buf, PATH_MAX, H5FD_SUBFILING_FILENAME_TEMPLATE "\n", base_filename, - sf_context->h5_file_id, num_digits, k + 1, n_subfiles); + snprintf(line_buf, PATH_MAX, H5FD_SUBFILING_FILENAME_TEMPLATE "\n", base_filename, + sf_context->h5_file_id, num_digits, k + 1, n_subfiles); - if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); } @@ -2430,8 +2430,8 @@ open_config_file(const char *base_filename, const char *config_dir, uint64_t fil H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfiling configuration filename"); - HDsnprintf(config_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, config_dir, - base_filename, file_id); + snprintf(config_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, config_dir, + base_filename, file_id); /* Determine whether a subfiling configuration file exists */ errno = 0; @@ -2509,11 +2509,11 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64 config_buf[config_file_len] = '\0'; if (stripe_size) { - if (NULL == (substr = HDstrstr(config_buf, "stripe_size"))) + if (NULL == (substr = strstr(config_buf, "stripe_size"))) H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "malformed subfiling configuration file - no stripe size entry"); - if (EOF == HDsscanf(substr, "stripe_size=%" PRId64, &read_stripe_size)) + if (EOF == sscanf(substr, "stripe_size=%" PRId64, &read_stripe_size)) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "couldn't get stripe size from subfiling configuration file"); @@ -2526,11 +2526,11 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64 } if (num_subfiles) { - if (NULL == (substr = HDstrstr(config_buf, "subfile_count"))) + if (NULL == (substr = strstr(config_buf, "subfile_count"))) H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "malformed subfiling configuration file - no subfile count entry"); - if (EOF == HDsscanf(substr, "subfile_count=%" PRId64, &read_num_subfiles)) + if (EOF == sscanf(substr, "subfile_count=%" PRId64, &read_num_subfiles)) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "couldn't get number of subfiles from subfiling configuration file"); @@ -2594,7 +2594,7 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't get file dirname"); /* If filepath is just the filename, set up path using CWD */ - if (!HDstrcmp(file_dirname, ".")) { + if (!strcmp(file_dirname, ".")) { if (NULL == (resolved_path = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for filepath"); @@ -2608,24 +2608,24 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat H5_SUBFILING_GOTO_ERROR( H5E_VFL, H5E_CANTGET, FAIL, "can't get current working directory, errno = %d, error message = '%s'", errno, - HDstrerror(errno)); + strerror(errno)); - HDsnprintf(resolved_path, PATH_MAX, "%s/%s", cwd, file_basename); + snprintf(resolved_path, PATH_MAX, "%s/%s", cwd, file_basename); } else { /* Otherwise, just use what was given as the pathname */ - if (NULL == (resolved_path = HDstrdup(filepath))) + if (NULL == (resolved_path = strdup(filepath))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy filename"); } } else H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't resolve subfile path, errno = %d, error message = '%s'", errno, - HDstrerror(errno)); + strerror(errno)); } if (resolved_path) { - H5_CHECKED_ASSIGN(path_len, hsize_t, (HDstrlen(resolved_path) + 1), size_t); + H5_CHECKED_ASSIGN(path_len, hsize_t, (strlen(resolved_path) + 1), size_t); } else path_len = HSIZE_UNDEF; @@ -3138,13 +3138,13 @@ H5_subfiling_log(int64_t sf_context_id, const char *fmt, ...) H5FD_ioc_begin_thread_exclusive(); if (sf_context->sf_logfile) { - HDvfprintf(sf_context->sf_logfile, fmt, log_args); - HDfputs("\n", sf_context->sf_logfile); + vfprintf(sf_context->sf_logfile, fmt, log_args); + fputs("\n", sf_context->sf_logfile); fflush(sf_context->sf_logfile); } else { - HDvprintf(fmt, log_args); - HDputs(""); + vprintf(fmt, log_args); + puts(""); fflush(stdout); } diff --git a/src/H5FDtest.c b/src/H5FDtest.c index 4f2a5b2..694bae4 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -89,10 +89,10 @@ H5FD__supports_swmr_test(const char *vfd_name) FUNC_ENTER_NOAPI_NOINIT_NOERR - if (!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch")) + if (!vfd_name || !strcmp(vfd_name, "") || !strcmp(vfd_name, "nomatch")) ret_value = true; else - ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2"); + ret_value = !strcmp(vfd_name, "log") || !strcmp(vfd_name, "sec2"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__supports_swmr_test() */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 8029d35..2aadcca 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -245,10 +245,10 @@ H5F__parse_file_lock_env_var(htri_t *use_locks) /* Check the file locking environment variable */ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); - if (lock_env_var && (!HDstrcmp(lock_env_var, "FALSE") || !HDstrcmp(lock_env_var, "0"))) + if (lock_env_var && (!strcmp(lock_env_var, "FALSE") || !strcmp(lock_env_var, "0"))) *use_locks = false; /* Override: Never use locks */ - else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "BEST_EFFORT") || - !HDstrcmp(lock_env_var, "1"))) + else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "BEST_EFFORT") || + !strcmp(lock_env_var, "1"))) *use_locks = true; /* Override: Always use locks */ else *use_locks = FAIL; /* Environment variable not set, or not set correctly */ @@ -742,8 +742,8 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name /*ou FUNC_ENTER_PACKAGE - prefix_len = HDstrlen(prefix); - fname_len = HDstrlen(file_name); + prefix_len = strlen(prefix); + fname_len = strlen(file_name); /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ if (NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2 + @@ -751,10 +751,9 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name /*ou HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer"); /* Compose the full file name */ - HDsnprintf(*full_name, (prefix_len + fname_len + 2 + 2), "%s%s%s", - prefix, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ - ((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS), - file_name); + snprintf(*full_name, (prefix_len + fname_len + 2 + 2), "%s%s%s", + prefix, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ + ((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS), file_name); done: FUNC_LEAVE_NOAPI(ret_value) @@ -782,7 +781,7 @@ H5F__getenv_prefix_name(char **env_prefix /*in,out*/) ret_value = *env_prefix; /* Advance to next component, if possible */ - strret = HDstrchr(*env_prefix, H5_COLON_SEPC); + strret = strchr(*env_prefix, H5_COLON_SEPC); if (strret == NULL) *env_prefix = NULL; else { @@ -829,7 +828,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Copy the file name to use */ if (NULL == (temp_file_name = H5MM_strdup(file_name))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - temp_file_name_len = HDstrlen(temp_file_name); + temp_file_name_len = strlen(temp_file_name); /* Target file_name is an absolute pathname: see RM for detailed description */ if (H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { @@ -851,7 +850,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c ptr++; /* Copy into the temp. file name */ - HDstrncpy(temp_file_name, ptr, temp_file_name_len); + strncpy(temp_file_name, ptr, temp_file_name_len); temp_file_name[temp_file_name_len - 1] = '\0'; } /* end if */ } /* end if */ @@ -865,7 +864,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c H5E_clear_stack(NULL); /* Strip "<drive-letter>:" */ - HDstrncpy(temp_file_name, &file_name[2], temp_file_name_len); + strncpy(temp_file_name, &file_name[2], temp_file_name_len); temp_file_name[temp_file_name_len - 1] = '\0'; } /* end if */ } /* end if */ @@ -1280,11 +1279,11 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &mdc_log_location) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get mdc log location"); if (mdc_log_location != NULL) { - size_t len = HDstrlen(mdc_log_location); + size_t len = strlen(mdc_log_location); if (NULL == (f->shared->mdc_log_location = (char *)H5MM_calloc((len + 1) * sizeof(char)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate memory for mdc log file name"); - HDstrncpy(f->shared->mdc_log_location, mdc_log_location, len); + strncpy(f->shared->mdc_log_location, mdc_log_location, len); } else f->shared->mdc_log_location = NULL; @@ -3166,7 +3165,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le * * JRM -- 11/11/22 */ - if (HDstrcmp(fd_ptr->cls->name, "multi") == 0) + if (strcmp(fd_ptr->cls->name, "multi") == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver."); /* While the family file driver is conceptually fully compatible @@ -3188,7 +3187,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le * in the future. * JRM -- 12/21/11 */ - if (HDstrcmp(fd_ptr->cls->name, "family") == 0) + if (strcmp(fd_ptr->cls->name, "family") == 0) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver."); /* Go get the actual file size */ diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index d44f674..fcefd1d0 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -151,7 +151,7 @@ H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link"); /* Compare the string values */ - udata->cmp = HDstrcmp(udata->name, lnk->name); + udata->cmp = strcmp(udata->name, lnk->name); /* Check for correct link & callback to make */ if (udata->cmp == 0 && udata->found_op) { diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index 13a4d8a..4ed6751 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -214,11 +214,11 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound"); /* Get the length of the name */ - *name_len = HDstrlen(ltable.lnks[idx].name); + *name_len = strlen(ltable.lnks[idx].name); /* Copy the name into the user's buffer, if given */ if (name) { - HDstrncpy(name, ltable.lnks[idx].name, MIN((*name_len + 1), name_size)); + strncpy(name, ltable.lnks[idx].name, MIN((*name_len + 1), name_size)); if (*name_len >= name_size) name[name_size - 1] = '\0'; } /* end if */ @@ -255,7 +255,7 @@ H5G__compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, vo assert(udata); /* If we've found the right link, get the object type */ - if (HDstrcmp(lnk->name, udata->name) == 0) { + if (strcmp(lnk->name, udata->name) == 0) { /* Replace path names for link being removed */ if (H5G__link_name_replace(udata->file, udata->grp_full_path_r, lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object type"); @@ -412,7 +412,7 @@ H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_ud assert(udata); /* Check for name to get information */ - if (HDstrcmp(lnk->name, udata->name) == 0) { + if (strcmp(lnk->name, udata->name) == 0) { if (udata->lnk) { /* Copy link information */ if (NULL == H5O_msg_copy(H5O_LINK_ID, lnk, udata->lnk)) diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 7b1d58e..531549e 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -394,7 +394,7 @@ H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk) udata.common.f = f; udata.common.fheap = fheap; udata.common.name = lnk->name; - udata.common.name_hash = H5_checksum_lookup3(lnk->name, HDstrlen(lnk->name), 0); + udata.common.name_hash = H5_checksum_lookup3(lnk->name, strlen(lnk->name), 0); udata.common.corder = lnk->corder; udata.common.found_op = NULL; udata.common.found_op_data = NULL; @@ -502,7 +502,7 @@ H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, bool *fo udata.f = f; udata.fheap = fheap; udata.name = name; - udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0); + udata.name_hash = H5_checksum_lookup3(name, strlen(name), 0); udata.found_op = H5G__dense_lookup_cb; /* v2 B-tree comparison callback */ udata.found_op_data = lnk; @@ -1004,11 +1004,11 @@ H5G__dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link"); /* Get the length of the name */ - udata->name_len = HDstrlen(lnk->name); + udata->name_len = strlen(lnk->name); /* Copy the name into the user's buffer, if given */ if (udata->name) { - HDstrncpy(udata->name, lnk->name, MIN((udata->name_len + 1), udata->name_size)); + strncpy(udata->name, lnk->name, MIN((udata->name_len + 1), udata->name_size)); if (udata->name_len >= udata->name_size) udata->name[udata->name_size - 1] = '\0'; } /* end if */ @@ -1146,11 +1146,11 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound"); /* Get the length of the name */ - *name_len = HDstrlen(ltable.lnks[n].name); + *name_len = strlen(ltable.lnks[n].name); /* Copy the name into the user's buffer, if given */ if (name) { - HDstrncpy(name, ltable.lnks[n].name, MIN((*name_len + 1), name_size)); + strncpy(name, ltable.lnks[n].name, MIN((*name_len + 1), name_size)); if (*name_len >= name_size) name[name_size - 1] = '\0'; } /* end if */ @@ -1306,7 +1306,7 @@ H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_ udata.common.f = f; udata.common.fheap = fheap; udata.common.name = name; - udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0); + udata.common.name_hash = H5_checksum_lookup3(name, strlen(name), 0); udata.common.found_op = NULL; udata.common.found_op_data = NULL; udata.rem_from_fheap = true; @@ -1418,7 +1418,7 @@ H5G__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) other_bt2_udata.fheap = bt2_udata->fheap; other_bt2_udata.name = fh_udata.lnk->name; other_bt2_udata.name_hash = - H5_checksum_lookup3(fh_udata.lnk->name, HDstrlen(fh_udata.lnk->name), 0); + H5_checksum_lookup3(fh_udata.lnk->name, strlen(fh_udata.lnk->name), 0); other_bt2_udata.found_op = NULL; other_bt2_udata.found_op_data = NULL; } /* end else */ diff --git a/src/H5Gent.c b/src/H5Gent.c index 25927df..0563ae1 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -371,7 +371,7 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk H5G__ent_reset(ent); /* Add the new name to the heap */ - if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0) + if (H5HL_insert(f, heap, strlen(name) + 1, name, &name_offset) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap"); ent->name_off = name_offset; @@ -459,7 +459,7 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk size_t lnk_offset; /* Offset to sym-link value */ /* Insert link value into local heap */ - if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0) + if (H5HL_insert(f, heap, strlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap"); ent->type = H5G_CACHED_SLINK; diff --git a/src/H5Gint.c b/src/H5Gint.c index 3af9610..1be54ed 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -931,7 +931,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Check if we will need more space to store this link's relative path */ /* ("+2" is for string terminator and possible '/' for group separator later) */ - link_name_len = HDstrlen(lnk->name); + link_name_len = strlen(lnk->name); len_needed = udata->curr_path_len + link_name_len + 2; if (len_needed > udata->path_buf_size) { void *new_path; /* Pointer to new path buffer */ @@ -945,7 +945,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Build the link's relative path name */ assert(udata->path[old_path_len] == '\0'); - HDstrncpy(&(udata->path[old_path_len]), lnk->name, link_name_len + 1); + strncpy(&(udata->path[old_path_len]), lnk->name, link_name_len + 1); udata->curr_path_len += link_name_len; /* Construct the link info from the link message */ @@ -1008,7 +1008,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Add the path separator to the current path */ assert(udata->path[udata->curr_path_len] == '\0'); - HDstrncpy(&(udata->path[udata->curr_path_len]), "/", (size_t)2); + strncpy(&(udata->path[udata->curr_path_len]), "/", (size_t)2); udata->curr_path_len++; /* Attempt to get the link info for this group */ diff --git a/src/H5Glink.c b/src/H5Glink.c index 59cb9d9..fd4d560 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -91,7 +91,7 @@ H5G__link_cmp_name_inc(const void *lnk1, const void *lnk2) { FUNC_ENTER_PACKAGE_NOERR - FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name)) + FUNC_LEAVE_NOAPI(strcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name)) } /* end H5G__link_cmp_name_inc() */ /*------------------------------------------------------------------------- @@ -113,7 +113,7 @@ H5G__link_cmp_name_dec(const void *lnk1, const void *lnk2) { FUNC_ENTER_PACKAGE_NOERR - FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk2)->name, ((const H5O_link_t *)lnk1)->name)) + FUNC_LEAVE_NOAPI(strcmp(((const H5O_link_t *)lnk2)->name, ((const H5O_link_t *)lnk1)->name)) } /* end H5G__link_cmp_name_dec() */ /*------------------------------------------------------------------------- @@ -276,7 +276,7 @@ H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t * break; case H5L_TYPE_SOFT: - info->u.val_size = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/ + info->u.val_size = strlen(lnk->u.soft.name) + 1; /*count the null terminator*/ break; case H5L_TYPE_ERROR: diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 477c31f..1ba45de 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -871,7 +871,7 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Add the new message */ if (udata->comment && *udata->comment) { - if (NULL == (comment.s = HDstrdup(udata->comment))) + if (NULL == (comment.s = strdup(udata->comment))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy group comment"); if (H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message"); @@ -953,8 +953,8 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ } else { if (udata->comment && udata->bufsize) - HDstrncpy(udata->comment, comment.s, udata->bufsize); - udata->comment_size = HDstrlen(comment.s); + strncpy(udata->comment, comment.s, udata->bufsize); + udata->comment_size = strlen(comment.s); H5O_msg_reset(H5O_NAME_ID, &comment); } diff --git a/src/H5Gname.c b/src/H5Gname.c index 8223509..1341a2c 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -116,7 +116,7 @@ H5G__component(const char *name, size_t *size_p) while ('/' == *name) name++; if (size_p) - *size_p = HDstrcspn(name, "/"); + *size_p = strcspn(name, "/"); FUNC_LEAVE_NOAPI(name) } /* end H5G__component() */ @@ -217,7 +217,7 @@ H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) /* Check that the components we found are the same length */ if (nchars1 == nchars2) { /* Check that the two components are equal */ - if (HDstrncmp(fullpath, prefix, nchars1) == 0) { + if (strncmp(fullpath, prefix, nchars1) == 0) { /* Advance the pointers in the names */ fullpath += nchars1; prefix += nchars2; @@ -266,7 +266,7 @@ H5G__build_fullpath(const char *prefix, const char *name) /* Create full path */ if (NULL == (ret_value = H5RS_create(prefix))) HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "can't create ref-counted string"); - if (prefix[HDstrlen(prefix) - 1] != '/') + if (prefix[strlen(prefix) - 1] != '/') H5RS_aputc(ret_value, '/'); /* Add separator, if the prefix doesn't end in one */ H5RS_acat(ret_value, name); @@ -455,7 +455,7 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name len = H5RS_len(loc->path->user_path_r); if (name) { - HDstrncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((len + 1), size)); + strncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((len + 1), size)); if (len >= size) name[size - 1] = '\0'; } /* end if */ @@ -570,8 +570,8 @@ H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char assert(path); /* Check if path needs to be updated */ - full_suffix_len = HDstrlen(full_suffix); - path_len = HDstrlen(path); + full_suffix_len = strlen(full_suffix); + path_len = strlen(path); if (full_suffix_len < path_len) { const char *dst_suffix; /* Destination suffix that changes */ const char *src_suffix; /* Source suffix that changes */ @@ -603,7 +603,7 @@ H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char /* Compute path prefix before src suffix */ path_prefix2 = path; - path_prefix2_len = path_prefix_len - HDstrlen(src_suffix); + path_prefix2_len = path_prefix_len - strlen(src_suffix); /* Allocate new ref-counted string */ if (NULL == (rs = H5RS_create(NULL))) @@ -781,7 +781,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) src_path = H5RS_get_str(names->src_full_path_r); /* Construct full path suffix */ - full_suffix = full_path + HDstrlen(src_path); + full_suffix = full_path + strlen(src_path); /* Create new full path suffix */ if (NULL == (rs = H5RS_create(full_suffix))) @@ -848,7 +848,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) assert(*dst_path == '/'); /* Get pointer to "full suffix" */ - full_suffix = full_path + HDstrlen(src_path); + full_suffix = full_path + strlen(src_path); /* Update the user path, if one exists */ if (obj_path->user_path_r) @@ -1141,16 +1141,16 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size, si /* Check for finding the object */ if (found_obj) { /* Set the length of the full path */ - len = HDstrlen(udata.path) + 1; /* Length of path + 1 (for "/") */ + len = strlen(udata.path) + 1; /* Length of path + 1 (for "/") */ /* If there's a buffer provided, copy into it, up to the limit of its size */ if (name) { /* Copy the initial path separator */ - HDstrncpy(name, "/", (size_t)2); + strncpy(name, "/", (size_t)2); /* Append the rest of the path */ /* (less one character, for the initial path separator) */ - HDstrncat(name, udata.path, (size - 2)); + strncat(name, udata.path, (size - 2)); if (len >= size) name[size - 1] = '\0'; } /* end if */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 97103a6..b4bd121 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -360,7 +360,7 @@ H5G__node_cmp2(void *_lt_key, void *_udata, void *_rt_key) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name"); /* Set return value */ - ret_value = HDstrcmp(s1, s2); + ret_value = strcmp(s1, s2); done: FUNC_LEAVE_NOAPI(ret_value) @@ -406,13 +406,13 @@ H5G__node_cmp3(void *_lt_key, void *_udata, void *_rt_key) /* left side */ if ((s = (const char *)H5HL_offset_into(udata->heap, lt_key->offset)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name"); - if (HDstrcmp(udata->name, s) <= 0) + if (strcmp(udata->name, s) <= 0) ret_value = (-1); else { /* right side */ if ((s = (const char *)H5HL_offset_into(udata->heap, rt_key->offset)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name"); - if (HDstrcmp(udata->name, s) > 0) + if (strcmp(udata->name, s) > 0) ret_value = 1; } /* end else */ @@ -476,7 +476,7 @@ H5G__node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, bool if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name"); - cmp = HDstrcmp(udata->common.name, s); + cmp = strcmp(udata->common.name, s); if (cmp < 0) rt = idx; @@ -574,7 +574,7 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, bool H5_A HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name"); /* Check if symbol is already present */ - if (0 == (cmp = HDstrcmp(udata->common.name, s))) + if (0 == (cmp = strcmp(udata->common.name, s))) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "symbol is already present in symbol table"); if (cmp < 0) @@ -727,7 +727,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i idx = (lt + rt) / 2; if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name"); - cmp = HDstrcmp(udata->common.name, s); + cmp = strcmp(udata->common.name, s); if (cmp < 0) rt = idx; else @@ -740,7 +740,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i /* Get a pointer to the name of the link */ if (NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name"); - link_name_len = HDstrlen(lnk.name) + 1; + link_name_len = strlen(lnk.name) + 1; /* Set up rest of link structure */ lnk.corder_valid = false; @@ -778,7 +778,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i if (lnk.u.soft.name) { size_t soft_link_len; /* Length of string in local heap */ - soft_link_len = HDstrlen(lnk.u.soft.name) + 1; + soft_link_len = strlen(lnk.u.soft.name) + 1; if (H5HL_remove(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, soft_link_len) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 4770724..ef9773d 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -725,11 +725,11 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound"); /* Get the length of the name */ - *name_len = HDstrlen(udata.name); + *name_len = strlen(udata.name); /* Copy the name into the user's buffer, if given */ if (name) { - HDstrncpy(name, udata.name, MIN((*name_len + 1), name_size)); + strncpy(name, udata.name, MIN((*name_len + 1), name_size)); if (*name_len >= name_size) name[name_size - 1] = '\0'; } /* end if */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index fc55c98..a6a6406 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -617,7 +617,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign /* Set the user path, if given */ if (user_path) - HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (len + 1)); + strncpy(user_path, H5RS_get_str(obj_path->user_path_r), (len + 1)); /* Set the length of the path */ *user_path_len = len; diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 5c86aa6..dbb46c1 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -511,7 +511,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough */ - if (NULL == (comp = (char *)H5WB_actual(wb, (HDstrlen(name) + 1)))) + if (NULL == (comp = (char *)H5WB_actual(wb, (strlen(name) + 1)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer"); /* Traverse the path */ @@ -555,7 +555,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G if (lookup_status) { /* Sanity check link and indicate it's valid */ assert(lnk.type >= H5L_TYPE_HARD); - assert(!HDstrcmp(comp, lnk.name)); + assert(!strcmp(comp, lnk.name)); link_valid = true; /* Build object location from the link */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 32afc1f..14fab84 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -398,7 +398,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) /* Calculate the length */ len = end - start; - HDsnprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count); + snprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count); fprintf(udata->stream, "%*s%-*s %8zu, %8zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9), temp_str, start, len); udata->sect_count++; @@ -591,13 +591,13 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, bool dump_internal, FILE *strea else fprintf(stream, "%*sDirect Block Entries: (address)\n", indent, ""); for (u = 0; u < hdr->man_dtable.max_direct_rows && u < iblock->nrows; u++) { - HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (block size: %lu)", (unsigned)u, - (unsigned long)hdr->man_dtable.row_block_size[u]); + snprintf(temp_str, sizeof(temp_str), "Row #%u: (block size: %lu)", (unsigned)u, + (unsigned long)hdr->man_dtable.row_block_size[u]); fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); for (v = 0; v < hdr->man_dtable.cparam.width; v++) { size_t off = (u * hdr->man_dtable.cparam.width) + v; - HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); + snprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); if (hdr->filter_len > 0) fprintf(stream, "%*s%-*s %9" PRIuHADDR "/%6zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, iblock->ents[off].addr, iblock->filt_ents[off].size, @@ -616,13 +616,12 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, bool dump_internal, FILE *strea H5VM_log2_of2(hdr->man_dtable.cparam.width); for (u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++) { num_indirect_rows = (H5VM_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1; - HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u, - num_indirect_rows); + snprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows); fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); for (v = 0; v < hdr->man_dtable.cparam.width; v++) { size_t off = (u * hdr->man_dtable.cparam.width) + v; - HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); + snprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); fprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, iblock->ents[off].addr); } /* end for */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index b60853a..16ea529 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -178,7 +178,7 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2) else if(cparam1->pline.filter[u].name && !cparam2->pline.filter[u].name) HGOTO_DONE(1); else if(cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) { - if((ret_value = HDstrcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name))) + if((ret_value = strcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name))) HGOTO_DONE(ret_value); } /* end if */ #endif diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index 60cf3f7..0f100e4 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -111,7 +111,7 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) if (h->obj[u].begin) { char buf[64]; - HDsnprintf(buf, sizeof(buf), "Object %u", u); + snprintf(buf, sizeof(buf), "Object %u", u); fprintf(stream, "%*s%s\n", indent, "", buf); fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MIN(fwidth - 3, 0), "Obffset in block:", (unsigned long)(h->obj[u].begin - h->chunk)); @@ -129,12 +129,12 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) if (j + k < h->obj[u].size) fprintf(stream, "%02x ", p[j + k]); else - HDfputs(" ", stream); + fputs(" ", stream); } for (k = 0; k < 16 && j + k < h->obj[u].size; k++) { if (8 == k) fprintf(stream, " "); - HDfputc(p[j + k] > ' ' && p[j + k] <= '~' ? p[j + k] : '.', stream); + fputc(p[j + k] > ' ' && p[j + k] <= '~' ? p[j + k] : '.', stream); } fprintf(stream, "\n"); } diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 852884a..1308f8d 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -76,7 +76,7 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) for (free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { char temp_str[32]; - HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block); + snprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block); fprintf(stream, "%*s%-*s %8zu, %8zu\n", indent + 3, "", MAX(0, fwidth - 9), temp_str, freelist->offset, freelist->size); if ((freelist->offset + freelist->size) > h->dblk_size) @@ -665,8 +665,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name"); /* Combine the filename and link name into a single buffer to give to the UD link */ - file_name_len = HDstrlen(file_name) + 1; - norm_obj_name_len = HDstrlen(norm_obj_name) + 1; + file_name_len = strlen(file_name) + 1; + norm_obj_name_len = strlen(norm_obj_name) + 1; buf_size = 1 + file_name_len + norm_obj_name_len; if (NULL == (ext_link_buf = H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer"); @@ -674,9 +674,9 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i /* Encode the external link information */ p = (uint8_t *)ext_link_buf; *p++ = (H5L_EXT_VERSION << 4) | H5L_EXT_FLAGS_ALL; /* External link version & flags */ - HDstrncpy((char *)p, file_name, buf_size - 1); /* Name of file containing external link's object */ + strncpy((char *)p, file_name, buf_size - 1); /* Name of file containing external link's object */ p += file_name_len; - HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ + strncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = link_name; @@ -1982,10 +1982,10 @@ H5Lunpack_elink_val(const void *_ext_linkval, size_t link_size, unsigned *flags, if (ext_linkval[link_size - 1] != '\0') HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "linkval buffer is not NULL-terminated"); - /* We're now guaranteed that HDstrlen won't segfault, since the buffer has + /* We're now guaranteed that strlen won't segfault, since the buffer has * at least one NULL in it. */ - len = HDstrlen((const char *)ext_linkval + 1); + len = strlen((const char *)ext_linkval + 1); /* If the first NULL we found was at the very end of the buffer, then * this external link value has no object name and is invalid. diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index a5f49e4..56c3117 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -132,7 +132,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons /* Gather some information from the external link's user data */ file_name = (const char *)p; - fname_len = HDstrlen(file_name); + fname_len = strlen(file_name); obj_name = (const char *)p + fname_len + 1; /* Get the plist structure */ diff --git a/src/H5Lint.c b/src/H5Lint.c index e0040e4..e33ad93 100644 --- a/src/H5Lint.c +++ b/src/H5Lint.c @@ -925,8 +925,8 @@ H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size) if (H5L_TYPE_SOFT == lnk->type) { /* Copy to output buffer */ if (size > 0 && buf) { - HDstrncpy((char *)buf, lnk->u.soft.name, size); - if (HDstrlen(lnk->u.soft.name) >= size) + strncpy((char *)buf, lnk->u.soft.name, size); + if (strlen(lnk->u.soft.name) >= size) ((char *)buf)[size - 1] = '\0'; } /* end if */ } /* end if */ @@ -1627,7 +1627,7 @@ H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATT /* Look for another separator */ next = udata->sep; - if (NULL == (udata->sep = HDstrchr(udata->sep, '/'))) + if (NULL == (udata->sep = strchr(udata->sep, '/'))) cb_func = H5L__exists_final_cb; else { /* Chew through adjacent separators, if present */ @@ -1693,7 +1693,7 @@ H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, bool *exists) else { /* Set up user data & correct callback */ udata.exists = exists; - if (NULL == (udata.sep = HDstrchr(name_trav, '/'))) + if (NULL == (udata.sep = strchr(name_trav, '/'))) cb_func = H5L__exists_final_cb; else { /* Chew through adjacent separators, if present */ @@ -1742,7 +1742,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name, bool *exists) assert(exists); /* A path of "/" will always exist in a file */ - if (0 == HDstrcmp(name, "/")) + if (0 == strcmp(name, "/")) *exists = true; else { /* Traverse the group hierarchy to locate the object to get info about */ @@ -112,7 +112,7 @@ H5MM_xstrdup(const char *s) FUNC_ENTER_NOAPI(NULL) if (s) - if (NULL == (ret_value = HDstrdup(s))) + if (NULL == (ret_value = strdup(s))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -140,7 +140,7 @@ H5MM_strdup(const char *s) if (!s) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed"); - if (NULL == (ret_value = HDstrdup(s))) + if (NULL == (ret_value = strdup(s))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed"); done: @@ -837,7 +837,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Avoid compiler warning on 32-bit machines */ #if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T - if (HDstrlen(new_name) > H5L_MAX_LINK_NAME_LEN) + if (strlen(new_name) > H5L_MAX_LINK_NAME_LEN) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long"); #endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */ if (lcpl_id != H5P_DEFAULT && (true != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 04c3fab..e86ec39 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -193,7 +193,7 @@ H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, u HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Make an attempt to detect corrupted name or name length - HDFFV-10588 */ - if (name_len != (HDstrnlen(attr->shared->name, name_len) + 1)) + if (name_len != (strnlen(attr->shared->name, name_len) + 1)) HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length"); /* Determine pointer movement and check if it's valid */ @@ -360,7 +360,7 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) * encoded lengths are exact but we pad each part except the data to be a * multiple of eight bytes (in the first version). */ - name_len = HDstrlen(attr->shared->name) + 1; + name_len = strlen(attr->shared->name) + 1; UINT16ENCODE(p, name_len); UINT16ENCODE(p, attr->shared->dt_size); UINT16ENCODE(p, attr->shared->ds_size); @@ -479,7 +479,7 @@ H5O__attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) 2; /*space size */ /* Length of attribute name */ - name_len = HDstrlen(attr->shared->name) + 1; + name_len = strlen(attr->shared->name) + 1; /* Version-specific size information */ if (attr->shared->version == H5O_ATTR_VERSION_1) @@ -831,13 +831,13 @@ H5O__attr_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidt case H5T_CSET_RESERVED_13: case H5T_CSET_RESERVED_14: case H5T_CSET_RESERVED_15: - HDsnprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(mesg->shared->encoding)); + snprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(mesg->shared->encoding)); s = buf; break; case H5T_CSET_ERROR: default: - HDsnprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(mesg->shared->encoding)); + snprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(mesg->shared->encoding)); s = buf; break; } /* end switch */ diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 3b9e995..88c595e 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -401,7 +401,7 @@ H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, assert(!udata->attr); /* Check for correct attribute message to modify */ - if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { + if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { /* Make a copy of the attribute to return */ if (NULL == (udata->attr = H5A__copy(NULL, (H5A_t *)mesg->native))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy attribute"); @@ -673,7 +673,7 @@ H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char *name_ * address to which the attribute is attached, and file serial * number should all match. */ - if (!HDstrcmp(name_to_open, (*attr)->shared->name) && loc->addr == (*attr)->oloc.addr && + if (!strcmp(name_to_open, (*attr)->shared->name) && loc->addr == (*attr)->oloc.addr && loc_fnum == attr_fnum) { ret_value = true; break; @@ -784,7 +784,7 @@ H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUS assert(!udata->found); /* Check for correct attribute message to modify */ - if (0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) { + if (0 == strcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) { /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(udata->f, oh, mesg->chunkno))) HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk"); @@ -935,7 +935,7 @@ H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, assert(!udata->found); /* Check for existing attribute with new name */ - if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->new_name) == 0) { + if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->new_name) == 0) { /* Indicate that we found an existing attribute with the new name*/ udata->found = true; @@ -978,7 +978,7 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR assert(!udata->found); /* Find correct attribute message to rename */ - if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->old_name) == 0) { + if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->old_name) == 0) { unsigned old_version = ((H5A_t *)mesg->native)->shared->version; /* Old version of the attribute */ /* Protect chunk */ @@ -1015,7 +1015,7 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR assert(H5O_msg_is_shared(H5O_ATTR_ID, (H5A_t *)mesg->native) == false); /* Check for attribute message changing size */ - if (HDstrlen(udata->new_name) != HDstrlen(udata->old_name) || + if (strlen(udata->new_name) != strlen(udata->old_name) || old_version != ((H5A_t *)mesg->native)->shared->version) { H5A_t *attr; /* Attribute to re-add */ @@ -1421,7 +1421,7 @@ H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNU assert(!udata->found); /* Check for correct attribute message to modify */ - if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { + if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { /* Convert message into a null message (i.e. delete it) */ if (H5O__release_mesg(udata->f, oh, mesg, true) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message"); @@ -1679,7 +1679,7 @@ H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, unsig assert(udata->exists && !*udata->exists); /* Check for correct attribute message */ - if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { + if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { /* Indicate that this message is the attribute sought */ *udata->exists = true; diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index e354a55..667c025 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -122,8 +122,8 @@ H5O__copy_obj_by_ref(H5O_loc_t *src_oloc, H5O_loc_t *dst_oloc, H5G_loc_t *dst_ro new_oloc.addr = dst_oloc->addr; /* Pick a default name for the new object */ - HDsnprintf(tmp_obj_name, sizeof(tmp_obj_name), "~obj_pointed_by_%llu", - (unsigned long long)dst_oloc->addr); + snprintf(tmp_obj_name, sizeof(tmp_obj_name), "~obj_pointed_by_%llu", + (unsigned long long)dst_oloc->addr); /* Create a link to the newly copied object */ /* Note: since H5O_copy_header_map actually copied the target object, it diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 9bc949f..bc880bb 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -309,16 +309,16 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int /* Time fields */ tm = HDlocaltime(&oh->atime); - HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); + strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Access Time:", buf); tm = HDlocaltime(&oh->mtime); - HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); + strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Modification Time:", buf); tm = HDlocaltime(&oh->ctime); - HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); + strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Change Time:", buf); tm = HDlocaltime(&oh->btime); - HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); + strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Birth Time:", buf); } /* end if */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index bad4684..620d686 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -339,7 +339,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t size_t max = (size_t)(p_end - *pp + 1); /* Max possible name length */ - actual_name_length = HDstrnlen((const char *)*pp, max); + actual_name_length = strnlen((const char *)*pp, max); if (actual_name_length == max) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "field name not null terminated"); } @@ -348,7 +348,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t * passed via H5Tdecode(), so don't bounds check and hope for * the best. */ - actual_name_length = HDstrlen((const char *)*pp); + actual_name_length = strlen((const char *)*pp); } if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length, p_end)) @@ -636,7 +636,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t size_t max = (size_t)(p_end - *pp + 1); /* Max possible name length */ - actual_name_length = HDstrnlen((const char *)*pp, max); + actual_name_length = strnlen((const char *)*pp, max); if (actual_name_length == max) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "enum name not null terminated"); } @@ -645,7 +645,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t * passed via H5Tdecode(), so don't bounds check and hope for * the best. */ - actual_name_length = HDstrlen((const char *)*pp); + actual_name_length = strlen((const char *)*pp); } if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length, p_end)) @@ -1092,7 +1092,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) { size_t aligned; - z = HDstrlen(dt->shared->u.opaque.tag); + z = strlen(dt->shared->u.opaque.tag); aligned = (z + 7) & (H5T_OPAQUE_TAG_MAX - 8); flags = (unsigned)(flags | aligned); H5MM_memcpy(*pp, dt->shared->u.opaque.tag, MIN(z, aligned)); @@ -1122,10 +1122,10 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) assert(dt->shared->version >= dt->shared->u.compnd.memb[i].type->shared->version); /* Name */ - HDstrcpy((char *)(*pp), dt->shared->u.compnd.memb[i].name); + strcpy((char *)(*pp), dt->shared->u.compnd.memb[i].name); /* Version 3 of the datatype message removed the padding to multiple of 8 bytes */ - n = HDstrlen(dt->shared->u.compnd.memb[i].name); + n = strlen(dt->shared->u.compnd.memb[i].name); if (dt->shared->version >= H5O_DTYPE_VERSION_3) *pp += n + 1; else { @@ -1196,10 +1196,10 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) /* Names, each a multiple of eight bytes */ for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { /* Name */ - HDstrcpy((char *)(*pp), dt->shared->u.enumer.name[i]); + strcpy((char *)(*pp), dt->shared->u.enumer.name[i]); /* Version 3 of the datatype message removed the padding to multiple of 8 bytes */ - n = HDstrlen(dt->shared->u.enumer.name[i]); + n = strlen(dt->shared->u.enumer.name[i]); if (dt->shared->version >= H5O_DTYPE_VERSION_3) *pp += n + 1; else { @@ -1485,7 +1485,7 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg) break; case H5T_OPAQUE: - ret_value += (HDstrlen(dt->shared->u.opaque.tag) + 7) & (H5T_OPAQUE_TAG_MAX - 8); + ret_value += (strlen(dt->shared->u.opaque.tag) + 7) & (H5T_OPAQUE_TAG_MAX - 8); break; case H5T_COMPOUND: { @@ -1499,7 +1499,7 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg) size_t name_len; /* Length of field's name */ /* Get length of field's name */ - name_len = HDstrlen(dt->shared->u.compnd.memb[u].name); + name_len = strlen(dt->shared->u.compnd.memb[u].name); /* Versions of the format >= 3 don't pad out the name */ if (dt->shared->version >= H5O_DTYPE_VERSION_3) @@ -1530,7 +1530,7 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg) size_t name_len; /* Length of field's name */ /* Get length of field's name */ - name_len = HDstrlen(dt->shared->u.enumer.name[u]); + name_len = strlen(dt->shared->u.enumer.name[u]); /* Versions of the format >= 3 don't pad out the name */ if (dt->shared->version >= H5O_DTYPE_VERSION_3) @@ -1915,7 +1915,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_NO_CLASS: case H5T_NCLASSES: default: - HDsnprintf(buf, sizeof(buf), "H5T_CLASS_%d", (int)(dt->shared->type)); + snprintf(buf, sizeof(buf), "H5T_CLASS_%d", (int)(dt->shared->type)); s = buf; break; } /* end switch */ @@ -1930,7 +1930,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of members:", dt->shared->u.compnd.nmembs); for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { - HDsnprintf(buf, sizeof(buf), "Member %u:", i); + snprintf(buf, sizeof(buf), "Member %u:", i); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->shared->u.compnd.memb[i].name); fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3), "Byte offset:", (unsigned long)(dt->shared->u.compnd.memb[i].offset)); @@ -1943,7 +1943,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of members:", dt->shared->u.enumer.nmembs); for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { - HDsnprintf(buf, sizeof(buf), "Member %u:", i); + snprintf(buf, sizeof(buf), "Member %u:", i); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->shared->u.enumer.name[i]); fprintf(stream, "%*s%-*s 0x", indent, "", fwidth, "Raw bytes of value:"); for (k = 0; k < dt->shared->parent->shared->size; k++) @@ -1983,14 +1983,13 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_CSET_RESERVED_13: case H5T_CSET_RESERVED_14: case H5T_CSET_RESERVED_15: - HDsnprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.cset)); + snprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.cset)); s = buf; break; case H5T_CSET_ERROR: default: - HDsnprintf(buf, sizeof(buf), "Unknown character set: %d", - (int)(dt->shared->u.atomic.u.s.cset)); + snprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(dt->shared->u.atomic.u.s.cset)); s = buf; break; } /* end switch */ @@ -2022,14 +2021,13 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_STR_RESERVED_13: case H5T_STR_RESERVED_14: case H5T_STR_RESERVED_15: - HDsnprintf(buf, sizeof(buf), "H5T_STR_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.pad)); + snprintf(buf, sizeof(buf), "H5T_STR_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.pad)); s = buf; break; case H5T_STR_ERROR: default: - HDsnprintf(buf, sizeof(buf), "Unknown string padding: %d", - (int)(dt->shared->u.atomic.u.s.pad)); + snprintf(buf, sizeof(buf), "Unknown string padding: %d", (int)(dt->shared->u.atomic.u.s.pad)); s = buf; break; } /* end switch */ @@ -2048,7 +2046,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_VLEN_BADTYPE: case H5T_VLEN_MAXTYPE: default: - HDsnprintf(buf, sizeof(buf), "H5T_VLEN_%d", dt->shared->u.vlen.type); + snprintf(buf, sizeof(buf), "H5T_VLEN_%d", dt->shared->u.vlen.type); s = buf; break; } /* end switch */ @@ -2066,7 +2064,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_LOC_BADLOC: case H5T_LOC_MAXLOC: default: - HDsnprintf(buf, sizeof(buf), "H5T_LOC_%d", (int)dt->shared->u.vlen.loc); + snprintf(buf, sizeof(buf), "H5T_LOC_%d", (int)dt->shared->u.vlen.loc); s = buf; break; } /* end switch */ @@ -2097,13 +2095,13 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_CSET_RESERVED_13: case H5T_CSET_RESERVED_14: case H5T_CSET_RESERVED_15: - HDsnprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.vlen.cset)); + snprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.vlen.cset)); s = buf; break; case H5T_CSET_ERROR: default: - HDsnprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(dt->shared->u.vlen.cset)); + snprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(dt->shared->u.vlen.cset)); s = buf; break; } /* end switch */ @@ -2135,13 +2133,13 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_STR_RESERVED_13: case H5T_STR_RESERVED_14: case H5T_STR_RESERVED_15: - HDsnprintf(buf, sizeof(buf), "H5T_STR_RESERVED_%d", (int)(dt->shared->u.vlen.pad)); + snprintf(buf, sizeof(buf), "H5T_STR_RESERVED_%d", (int)(dt->shared->u.vlen.pad)); s = buf; break; case H5T_STR_ERROR: default: - HDsnprintf(buf, sizeof(buf), "Unknown string padding: %d", (int)(dt->shared->u.vlen.pad)); + snprintf(buf, sizeof(buf), "Unknown string padding: %d", (int)(dt->shared->u.vlen.pad)); s = buf; break; } /* end switch */ @@ -2181,7 +2179,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_ORDER_ERROR: default: - HDsnprintf(buf, sizeof(buf), "H5T_ORDER_%d", dt->shared->u.atomic.order); + snprintf(buf, sizeof(buf), "H5T_ORDER_%d", dt->shared->u.atomic.order); s = buf; break; } /* end switch */ @@ -2255,9 +2253,9 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_NPAD: default: if (dt->shared->u.atomic.u.f.pad < 0) - HDsnprintf(buf, sizeof(buf), "H5T_PAD_%d", -(dt->shared->u.atomic.u.f.pad)); + snprintf(buf, sizeof(buf), "H5T_PAD_%d", -(dt->shared->u.atomic.u.f.pad)); else - HDsnprintf(buf, sizeof(buf), "bit-%d", dt->shared->u.atomic.u.f.pad); + snprintf(buf, sizeof(buf), "bit-%d", dt->shared->u.atomic.u.f.pad); s = buf; break; } /* end switch */ @@ -2278,7 +2276,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_NORM_ERROR: default: - HDsnprintf(buf, sizeof(buf), "H5T_NORM_%d", (int)(dt->shared->u.atomic.u.f.norm)); + snprintf(buf, sizeof(buf), "H5T_NORM_%d", (int)(dt->shared->u.atomic.u.f.norm)); s = buf; } /* end switch */ fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Normalization:", s); @@ -2315,7 +2313,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt case H5T_SGN_ERROR: case H5T_NSGN: default: - HDsnprintf(buf, sizeof(buf), "H5T_SGN_%d", (int)(dt->shared->u.atomic.u.i.sign)); + snprintf(buf, sizeof(buf), "H5T_SGN_%d", (int)(dt->shared->u.atomic.u.i.sign)); s = buf; break; } /* end switch */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index e2238c0..571c8da 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -450,7 +450,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d /* Determine size needed for destination heap */ heap_size = H5HL_ALIGN(1); /* "empty" name */ for (idx = 0; idx < efl_src->nused; idx++) - heap_size += H5HL_ALIGN(HDstrlen(efl_src->slot[idx].name) + 1); + heap_size += H5HL_ALIGN(strlen(efl_src->slot[idx].name) + 1); /* Create name heap */ if (H5HL_create(file_dst, heap_size, &efl_dst->heap_addr /*out*/) < 0) @@ -478,7 +478,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d /* copy the name from the source */ for (idx = 0; idx < efl_src->nused; idx++) { efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name); - if (H5HL_insert(file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name, + if (H5HL_insert(file_dst, heap, strlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name, &(efl_dst->slot[idx].name_offset)) < 0) HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap"); } @@ -529,7 +529,7 @@ H5O__efl_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int ind for (u = 0; u < mesg->nused; u++) { char buf[64]; - HDsnprintf(buf, sizeof(buf), "File %zu", u); + snprintf(buf, sizeof(buf), "File %zu", u); fprintf(stream, "%*s%s:\n", indent, "", buf); fprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(fwidth - 3, 0), "Name:", mesg->slot[u].name); diff --git a/src/H5Olayout.c b/src/H5Olayout.c index a61c14a..a686ce4 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -604,7 +604,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU "ran off end of input buffer while decoding"); /* Source file name */ - tmp_size = HDstrnlen((const char *)heap_block_p, (size_t)avail_buffer_space); + tmp_size = strnlen((const char *)heap_block_p, (size_t)avail_buffer_space); if (tmp_size == (size_t)avail_buffer_space) HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding - unterminated source " @@ -625,7 +625,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU "ran off end of input buffer while decoding"); /* Source dataset name */ - tmp_size = HDstrnlen((const char *)heap_block_p, (size_t)avail_buffer_space); + tmp_size = strnlen((const char *)heap_block_p, (size_t)avail_buffer_space); if (tmp_size == (size_t)avail_buffer_space) HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding - unterminated source " diff --git a/src/H5Olink.c b/src/H5Olink.c index 9e65f7d..9d4d685 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -303,7 +303,7 @@ H5O__link_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const assert(lnk); /* Get length of link's name */ - len = (uint64_t)HDstrlen(lnk->name); + len = (uint64_t)strlen(lnk->name); assert(len > 0); /* encode */ @@ -370,7 +370,7 @@ H5O__link_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const case H5L_TYPE_SOFT: /* Store the link value */ - len = (uint16_t)HDstrlen(lnk->u.soft.name); + len = (uint16_t)strlen(lnk->u.soft.name); assert(len > 0); UINT16ENCODE(p, len); H5MM_memcpy(p, lnk->u.soft.name, (size_t)len); @@ -486,7 +486,7 @@ H5O__link_size(const H5F_t *f, bool H5_ATTR_UNUSED disable_shared, const void *_ HDcompile_assert(sizeof(uint64_t) >= sizeof(size_t)); /* Get name's length */ - name_len = (uint64_t)HDstrlen(lnk->name); + name_len = (uint64_t)strlen(lnk->name); /* Determine correct value for name size bits */ if (name_len > 4294967295) @@ -514,8 +514,8 @@ H5O__link_size(const H5F_t *f, bool H5_ATTR_UNUSED disable_shared, const void *_ break; case H5L_TYPE_SOFT: - ret_value += 2 + /* Link value length */ - HDstrlen(lnk->u.soft.name); /* Link value */ + ret_value += 2 + /* Link value length */ + strlen(lnk->u.soft.name); /* Link value */ break; case H5L_TYPE_ERROR: @@ -816,7 +816,7 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in if (lnk->type >= H5L_TYPE_UD_MIN) { if (lnk->type == H5L_TYPE_EXTERNAL) { const char *objname = - (const char *)lnk->u.ud.udata + (HDstrlen((const char *)lnk->u.ud.udata) + 1); + (const char *)lnk->u.ud.udata + (strlen((const char *)lnk->u.ud.udata) + 1); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "External File Name:", (const char *)lnk->u.ud.udata); diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 6a45dcd..9cf9400 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -271,8 +271,8 @@ H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, u /* encode */ tm = HDgmtime(mesg); - HDsprintf((char *)p, "%04d%02d%02d%02d%02d%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + sprintf((char *)p, "%04d%02d%02d%02d%02d%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__mtime_encode() */ @@ -416,7 +416,7 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i /* debug */ tm = HDlocaltime(mesg); - HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); + strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Time:", buf); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Oname.c b/src/H5Oname.c index 2184287..d600137 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -122,7 +122,7 @@ H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, ui assert(mesg && mesg->s); /* encode */ - HDstrcpy((char *)p, mesg->s); + strcpy((char *)p, mesg->s); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__name_encode() */ @@ -196,7 +196,7 @@ H5O__name_size(const H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared assert(f); assert(mesg); - ret_value = mesg->s ? HDstrlen(mesg->s) + 1 : 0; + ret_value = mesg->s ? strlen(mesg->s) + 1 : 0; FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__name_size() */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 1f6db59..897fa34 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -192,7 +192,7 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign size_t max = (size_t)(p_end - p + 1); /* Max possible name length */ /* Determine actual name length (without padding, but with null terminator) */ - actual_name_length = HDstrnlen((const char *)p, max); + actual_name_length = strnlen((const char *)p, max); if (actual_name_length == max) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "filter name not null terminated"); actual_name_length += 1; /* include \0 byte */ @@ -206,7 +206,7 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign else filter->name = filter->_name; - HDstrncpy(filter->name, (const char *)p, actual_name_length); + strncpy(filter->name, (const char *)p, actual_name_length); if (H5_IS_BUFFER_OVERFLOW(p, name_length, p_end)) HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); @@ -311,7 +311,7 @@ H5O__pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg) */ if (NULL == (name = filter->name) && (cls = H5Z_find(filter->id))) name = cls->name; - name_length = name ? HDstrlen(name) + 1 : 0; + name_length = name ? strlen(name) + 1 : 0; /* Filter name length */ UINT16ENCODE(p, pline->version == H5O_PLINE_VERSION_1 ? H5O_ALIGN_OLD(name_length) : name_length); @@ -394,7 +394,7 @@ H5O__pline_copy(const void *_src, void *_dst /*out*/) if (src->filter[i].name) { size_t namelen; /* Length of source filter name, including null terminator */ - namelen = HDstrlen(src->filter[i].name) + 1; + namelen = strlen(src->filter[i].name) + 1; /* Allocate space for the filter name, or use the internal buffer */ if (namelen > H5Z_COMMON_NAME_LEN) { @@ -478,7 +478,7 @@ H5O__pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) /* Get the name of the filter, same as done with H5O__pline_encode() */ if (NULL == (name = pline->filter[i].name) && (cls = H5Z_find(pline->filter[i].id))) name = cls->name; - name_len = name ? HDstrlen(name) + 1 : 0; + name_len = name ? strlen(name) + 1 : 0; } /* end else */ ret_value += @@ -529,7 +529,7 @@ H5O__pline_reset(void *mesg) /* Free information for each filter */ for (i = 0; i < pline->nused; i++) { if (pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name) - assert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN); + assert((strlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN); if (pline->filter[i].name != pline->filter[i]._name) pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name); if (pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values) @@ -652,7 +652,7 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in char name[64]; memset(name, 0, 64); - HDsnprintf(name, sizeof(name), "Filter at position %zu", i); + snprintf(name, sizeof(name), "Filter at position %zu", i); fprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); fprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), @@ -671,7 +671,7 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in for (size_t j = 0; j < pline->filter[i].cd_nelmts; j++) { char field_name[32]; - HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); + snprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); fprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), field_name, pline->filter[i].cd_values[j]); } @@ -143,7 +143,7 @@ H5PLappend(const char *search_path) /* Check args */ if (NULL == search_path) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL"); - if (0 == HDstrlen(search_path)) + if (0 == strlen(search_path)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero"); /* Append the search path to the path table */ @@ -175,7 +175,7 @@ H5PLprepend(const char *search_path) /* Check args */ if (NULL == search_path) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL"); - if (0 == HDstrlen(search_path)) + if (0 == strlen(search_path)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero"); /* Prepend the search path to the path table */ @@ -208,7 +208,7 @@ H5PLreplace(const char *search_path, unsigned int idx) /* Check args */ if (NULL == search_path) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL"); - if (0 == HDstrlen(search_path)) + if (0 == strlen(search_path)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero"); /* Check index */ @@ -250,7 +250,7 @@ H5PLinsert(const char *search_path, unsigned int idx) /* Check args */ if (NULL == search_path) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL"); - if (0 == HDstrlen(search_path)) + if (0 == strlen(search_path)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero"); /* Check index */ @@ -355,11 +355,11 @@ H5PLget(unsigned int idx, char *path_buf, size_t buf_size) /* Get the path at the specified index and its length */ if (NULL == (path = H5PL__get_path(idx))) HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, (-1), "no path stored at that index"); - path_len = HDstrlen(path); + path_len = strlen(path); /* If the path buffer is not NULL, copy the path to the buffer */ if (path_buf) { - HDstrncpy(path_buf, path, buf_size); + strncpy(path_buf, path, buf_size); if ((size_t)path_len >= buf_size) path_buf[buf_size - 1] = '\0'; } /* end if */ diff --git a/src/H5PLint.c b/src/H5PLint.c index 86103b4..23eec72 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -141,7 +141,7 @@ H5PL_init(void) * H5PLpublic.h) means we don't want to load plugins. */ if (NULL != (env_var = HDgetenv(HDF5_PLUGIN_PRELOAD))) - if (!HDstrcmp(env_var, H5PL_NO_PLUGIN)) { + if (!strcmp(env_var, H5PL_NO_PLUGIN)) { H5PL_plugin_control_mask_g = 0; H5PL_allow_plugins_g = false; } diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 9b2f987..fafce62 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -109,7 +109,7 @@ H5PL__insert_at(const char *path, unsigned int idx) /* Check args - Just assert on package functions */ assert(path); - assert(HDstrlen(path)); + assert(strlen(path)); /* Expand the table if it is full */ if (H5PL_num_paths_g == H5PL_path_capacity_g) @@ -190,7 +190,7 @@ H5PL__replace_at(const char *path, unsigned int idx) /* Check args - Just assert on package functions */ assert(path); - assert(HDstrlen(path)); + assert(strlen(path)); /* Check that the table entry is in use */ if (!H5PL_paths_g[idx]) @@ -387,7 +387,7 @@ H5PL__append_path(const char *path) /* Check args - Just assert on package functions */ assert(path); - assert(HDstrlen(path)); + assert(strlen(path)); /* Insert the path at the end of the table */ if (H5PL__insert_at(path, H5PL_num_paths_g) < 0) @@ -415,7 +415,7 @@ H5PL__prepend_path(const char *path) /* Check args - Just assert on package functions */ assert(path); - assert(HDstrlen(path)); + assert(strlen(path)); /* Insert the path at the beginning of the table */ if (H5PL__insert_at(path, 0) < 0) @@ -443,7 +443,7 @@ H5PL__replace_path(const char *path, unsigned int idx) /* Check args - Just assert on package functions */ assert(path); - assert(HDstrlen(path)); + assert(strlen(path)); assert(idx < H5PL_path_capacity_g); /* Insert the path at the requested index */ @@ -473,7 +473,7 @@ H5PL__insert_path(const char *path, unsigned int idx) /* Check args - Just assert on package functions */ assert(path); - assert(HDstrlen(path)); + assert(strlen(path)); assert(idx < H5PL_path_capacity_g); /* Insert the path at the requested index */ @@ -625,10 +625,10 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type * or libxxx.xxx.dylib on Mac. */ #ifndef __CYGWIN__ - if (!HDstrncmp(dp->d_name, "lib", (size_t)3) && - (HDstrstr(dp->d_name, ".so") || HDstrstr(dp->d_name, ".dylib"))) { + if (!strncmp(dp->d_name, "lib", (size_t)3) && + (strstr(dp->d_name, ".so") || strstr(dp->d_name, ".dylib"))) { #else - if (!HDstrncmp(dp->d_name, "cyg", (size_t)3) && HDstrstr(dp->d_name, ".dll")) { + if (!strncmp(dp->d_name, "cyg", (size_t)3) && strstr(dp->d_name, ".dll")) { #endif bool plugin_matches; @@ -636,18 +636,18 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type size_t len; /* Allocate & initialize the path name */ - len = HDstrlen(plugin_path) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/ + + len = strlen(plugin_path) + strlen(H5PL_PATH_SEPARATOR) + strlen(dp->d_name) + 1 /*\0*/ + 4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path"); - HDsnprintf(path, len, "%s/%s", plugin_path, dp->d_name); + snprintf(path, len, "%s/%s", plugin_path, dp->d_name); /* Get info for directory entry */ if (HDstat(path, &my_stat) == -1) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5_ITER_ERROR, "can't stat file %s -- error was: %s", path, - HDstrerror(errno)); + strerror(errno)); /* If it is a directory, skip it */ if (S_ISDIR(my_stat.st_mode)) @@ -681,7 +681,7 @@ done: if (dirp) if (HDclosedir(dirp) < 0) HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, H5_ITER_ERROR, "can't close directory: %s", - HDstrerror(errno)); + strerror(errno)); path = (char *)H5MM_xfree(path); @@ -709,24 +709,24 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type /* Specify a file mask. *.* = We want everything! - * skip the path if the directory can't be opened */ - HDsnprintf(service, sizeof(service), "%s\\*.dll", plugin_path); + snprintf(service, sizeof(service), "%s\\*.dll", plugin_path); if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE) HGOTO_DONE(H5_ITER_CONT); /* Loop over all the files */ do { /* Ignore '.' and '..' */ - if (HDstrcmp(fdFile.cFileName, ".") != 0 && HDstrcmp(fdFile.cFileName, "..") != 0) { + if (strcmp(fdFile.cFileName, ".") != 0 && strcmp(fdFile.cFileName, "..") != 0) { bool plugin_matches; size_t len; /* Allocate & initialize the path name */ - len = HDstrlen(plugin_path) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(fdFile.cFileName) + 1; + len = strlen(plugin_path) + strlen(H5PL_PATH_SEPARATOR) + strlen(fdFile.cFileName) + 1; if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path"); - HDsnprintf(path, len, "%s\\%s", plugin_path, fdFile.cFileName); + snprintf(path, len, "%s\\%s", plugin_path, fdFile.cFileName); /* Ignore directories */ if (fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) @@ -863,28 +863,28 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, bool *found * or libxxx.xxx.dylib on Mac. */ #ifndef __CYGWIN__ - if (!HDstrncmp(dp->d_name, "lib", (size_t)3) && - (HDstrstr(dp->d_name, ".so") || HDstrstr(dp->d_name, ".dylib"))) { + if (!strncmp(dp->d_name, "lib", (size_t)3) && + (strstr(dp->d_name, ".so") || strstr(dp->d_name, ".dylib"))) { #else - if (!HDstrncmp(dp->d_name, "cyg", (size_t)3) && HDstrstr(dp->d_name, ".dll")) { + if (!strncmp(dp->d_name, "cyg", (size_t)3) && strstr(dp->d_name, ".dll")) { #endif h5_stat_t my_stat; size_t len; /* Allocate & initialize the path name */ - len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/ + + len = strlen(dir) + strlen(H5PL_PATH_SEPARATOR) + strlen(dp->d_name) + 1 /*\0*/ + 4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path"); - HDsnprintf(path, len, "%s/%s", dir, dp->d_name); + snprintf(path, len, "%s/%s", dir, dp->d_name); /* Get info for directory entry */ if (HDstat(path, &my_stat) == -1) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't stat file %s -- error was: %s", path, - HDstrerror(errno)); + strerror(errno)); /* If it is a directory, skip it */ if (S_ISDIR(my_stat.st_mode)) { @@ -905,7 +905,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, bool *found done: if (dirp) if (HDclosedir(dirp) < 0) - HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", HDstrerror(errno)); + HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", strerror(errno)); path = (char *)H5MM_xfree(path); @@ -934,26 +934,26 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, bool *found *found = false; /* Specify a file mask. *.* = We want everything! */ - HDsnprintf(service, sizeof(service), "%s\\*.dll", dir); + snprintf(service, sizeof(service), "%s\\*.dll", dir); if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE) HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory"); /* Loop over all the files */ do { /* Ignore '.' and '..' */ - if (HDstrcmp(fdFile.cFileName, ".") != 0 && HDstrcmp(fdFile.cFileName, "..") != 0) { + if (strcmp(fdFile.cFileName, ".") != 0 && strcmp(fdFile.cFileName, "..") != 0) { /* XXX: Probably just continue here and move the code below over one tab */ size_t len; /* Allocate & initialize the path name */ - len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(fdFile.cFileName) + 1; + len = strlen(dir) + strlen(H5PL_PATH_SEPARATOR) + strlen(fdFile.cFileName) + 1; if (NULL == (path = (char *)H5MM_calloc(len))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path"); - HDsnprintf(path, len, "%s\\%s", dir, fdFile.cFileName); + snprintf(path, len, "%s\\%s", dir, fdFile.cFileName); /* Ignore directories */ if (fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c index e59de03..3538d7f 100644 --- a/src/H5PLplugin_cache.c +++ b/src/H5PLplugin_cache.c @@ -284,7 +284,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, bool *foun continue; /* Check if specified VOL connector name matches cache entry's name */ - if (!HDstrcmp(search_params->key->vol.u.name, H5PL_cache_g[u].key.vol.u.name)) + if (!strcmp(search_params->key->vol.u.name, H5PL_cache_g[u].key.vol.u.name)) matched = true; } else { @@ -308,7 +308,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, bool *foun continue; /* Check if specified VFD name matches cache entry's name */ - if (!HDstrcmp(search_params->key->vfd.u.name, H5PL_cache_g[u].key.vfd.u.name)) + if (!strcmp(search_params->key->vfd.u.name, H5PL_cache_g[u].key.vfd.u.name)) matched = true; } else { diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 1167fab..71c7963 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -324,7 +324,7 @@ H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size) /* calculate prefix length */ if (NULL != vds_file_pref) - len = HDstrlen(vds_file_pref); + len = strlen(vds_file_pref); enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); @@ -388,7 +388,7 @@ H5P__dapl_vds_file_pref_dec(const void **_pp, void *_value) /* Make a copy of the user's prefix string */ if (NULL == (*vds_file_pref = (char *)H5MM_malloc(len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); - HDstrncpy(*vds_file_pref, *(const char **)pp, len); + strncpy(*vds_file_pref, *(const char **)pp, len); (*vds_file_pref)[len] = '\0'; *pp += len; @@ -465,7 +465,7 @@ H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t H5_AT if (NULL != pref1 && NULL == pref2) HGOTO_DONE(-1); if (NULL != pref1 && NULL != pref2) - ret_value = HDstrcmp(pref1, pref2); + ret_value = strcmp(pref1, pref2); done: FUNC_LEAVE_NOAPI(ret_value) @@ -564,7 +564,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) /* calculate prefix length */ if (NULL != efile_pref) - len = HDstrlen(efile_pref); + len = strlen(efile_pref); enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); @@ -628,7 +628,7 @@ H5P__dapl_efile_pref_dec(const void **_pp, void *_value) /* Make a copy of the user's prefix string */ if (NULL == (*efile_pref = (char *)H5MM_malloc(len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); - HDstrncpy(*efile_pref, *(const char **)pp, len); + strncpy(*efile_pref, *(const char **)pp, len); (*efile_pref)[len] = '\0'; *pp += len; @@ -705,7 +705,7 @@ H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_ if (NULL != pref1 && NULL == pref2) HGOTO_DONE(-1); if (NULL != pref1 && NULL != pref2) - ret_value = HDstrcmp(pref1, pref2); + ret_value = strcmp(pref1, pref2); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1449,9 +1449,9 @@ H5Pget_efile_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) /* Check for prefix being set */ if (my_prefix) { /* Copy to user's buffer, if given */ - len = HDstrlen(my_prefix); + len = strlen(my_prefix); if (prefix) { - HDstrncpy(prefix, my_prefix, size); + strncpy(prefix, my_prefix, size); if (len >= size) prefix[size - 1] = '\0'; } /* end if */ @@ -1539,9 +1539,9 @@ H5Pget_virtual_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) /* Check for prefix being set */ if (my_prefix) { /* Copy to user's buffer, if given */ - len = HDstrlen(my_prefix); + len = strlen(my_prefix); if (prefix) { - HDstrncpy(prefix, my_prefix, size); + strncpy(prefix, my_prefix, size); if (len >= size) prefix[size - 1] = '\0'; } /* end if */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 2e8e8a4..cdee942 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -463,13 +463,13 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) /* Iterate over entries */ for (u = 0; u < layout->storage.u.virt.list_nused; u++) { /* Source file name */ - tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1; + tmp_size = strlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1; H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size); *pp += tmp_size; *size += tmp_size; /* Source dataset name */ - tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1; + tmp_size = strlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1; H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size); *pp += tmp_size; *size += tmp_size; @@ -510,11 +510,11 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) /* Iterate over entries */ for (u = 0; u < layout->storage.u.virt.list_nused; u++) { /* Source file name */ - tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1; + tmp_size = strlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1; *size += tmp_size; /* Source dataset name */ - tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1; + tmp_size = strlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1; *size += tmp_size; /* Source selection */ @@ -632,7 +632,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) /* Decode each entry */ for (u = 0; u < (size_t)nentries; u++) { /* Source file name */ - tmp_size = HDstrlen((const char *)*pp) + 1; + tmp_size = strlen((const char *)*pp) + 1; if (NULL == (tmp_layout.storage.u.virt.list[u].source_file_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, @@ -641,7 +641,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) *pp += tmp_size; /* Source dataset name */ - tmp_size = HDstrlen((const char *)*pp) + 1; + tmp_size = strlen((const char *)*pp) + 1; if (NULL == (tmp_layout.storage.u.virt.list[u].source_dset_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, @@ -884,16 +884,16 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_ HGOTO_DONE(1); /* Compare source file names */ - strcmp_ret = HDstrcmp(layout1->storage.u.virt.list[u].source_file_name, - layout2->storage.u.virt.list[u].source_file_name); + strcmp_ret = strcmp(layout1->storage.u.virt.list[u].source_file_name, + layout2->storage.u.virt.list[u].source_file_name); if (strcmp_ret < 0) HGOTO_DONE(-1); if (strcmp_ret > 0) HGOTO_DONE(1); /* Compare source dataset names */ - strcmp_ret = HDstrcmp(layout1->storage.u.virt.list[u].source_dset_name, - layout2->storage.u.virt.list[u].source_dset_name); + strcmp_ret = strcmp(layout1->storage.u.virt.list[u].source_dset_name, + layout2->storage.u.virt.list[u].source_dset_name); if (strcmp_ret < 0) HGOTO_DONE(-1); if (strcmp_ret > 0) @@ -1442,7 +1442,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) /* Encode file list */ for (u = 0; u < efl->nused; u++) { /* Calculate length of slot name and encode it */ - len = HDstrlen(efl->slot[u].name) + 1; + len = strlen(efl->slot[u].name) + 1; enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); assert(enc_size < 256); @@ -1472,7 +1472,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) /* Calculate size needed for encoding */ *size += (1 + H5VM_limit_enc_size((uint64_t)efl->nused)); for (u = 0; u < efl->nused; u++) { - len = HDstrlen(efl->slot[u].name) + 1; + len = strlen(efl->slot[u].name) + 1; *size += (1 + H5VM_limit_enc_size((uint64_t)len)); *size += len; *size += (1 + H5VM_limit_enc_size((uint64_t)efl->slot[u].offset)); @@ -1689,7 +1689,7 @@ H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t H5_ATTR if (efl1->slot[u].name != NULL && efl2->slot[u].name == NULL) HGOTO_DONE(1); if (efl1->slot[u].name != NULL) - if ((cmp_value = HDstrcmp(efl1->slot[u].name, efl2->slot[u].name)) != 0) + if ((cmp_value = strcmp(efl1->slot[u].name, efl2->slot[u].name)) != 0) HGOTO_DONE(cmp_value); /* Check the file offset of the efl entry */ @@ -2418,8 +2418,8 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si assert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); assert(layout.storage.u.virt.list[idx].source_file_name); if (name && (size > 0)) - (void)HDstrncpy(name, layout.storage.u.virt.list[idx].source_file_name, size); - ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[idx].source_file_name); + (void)strncpy(name, layout.storage.u.virt.list[idx].source_file_name, size); + ret_value = (ssize_t)strlen(layout.storage.u.virt.list[idx].source_file_name); done: FUNC_LEAVE_API(ret_value) @@ -2476,8 +2476,8 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si assert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); assert(layout.storage.u.virt.list[idx].source_dset_name); if (name && (size > 0)) - (void)HDstrncpy(name, layout.storage.u.virt.list[idx].source_dset_name, size); - ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[idx].source_dset_name); + (void)strncpy(name, layout.storage.u.virt.list[idx].source_dset_name, size); + ret_value = (ssize_t)strlen(layout.storage.u.virt.list[idx].source_dset_name); done: FUNC_LEAVE_API(ret_value) @@ -2738,7 +2738,7 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out /* Return values */ if (name_size > 0 && name) - HDstrncpy(name, efl.slot[idx].name, name_size); + strncpy(name, efl.slot[idx].name, name_size); /* XXX: Badness! * * The offset parameter is of type off_t and the offset field of H5O_efl_entry_t diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index f6f7240..b6130f5 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -725,7 +725,7 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression"); /* Get the transform string expression size */ - len = HDstrlen(pexp) + 1; + len = strlen(pexp) + 1; } /* end if */ if (NULL != *pp) { @@ -909,7 +909,7 @@ H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t H5_ATTR_UNU if (pexp1) { assert(pexp2); - ret_value = HDstrcmp(pexp1, pexp2); + ret_value = strcmp(pexp1, pexp2); } /* end if */ } /* end if */ @@ -1039,9 +1039,9 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression"); /* Copy into application buffer */ - len = HDstrlen(pexp); + len = strlen(pexp); if (expression) { - HDstrncpy(expression, pexp, size); + strncpy(expression, pexp, size); if (len >= size) expression[size - 1] = '\0'; } /* end if */ diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index a904b0f..77568c5 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -311,9 +311,9 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata) size_t prop_value_len; /* Encoded size of property's value */ /* Encode (or not, if the 'encode' flag is off) the property's name */ - prop_name_len = HDstrlen(prop->name) + 1; + prop_name_len = strlen(prop->name) + 1; if (udata->encode) { - HDstrcpy((char *)*(udata->pp), prop->name); + strcpy((char *)*(udata->pp), prop->name); *(uint8_t **)(udata->pp) += prop_name_len; } /* end if */ *(udata->enc_size_ptr) += prop_name_len; @@ -683,7 +683,7 @@ H5P__decode(const void *buf) /* Get property list name */ name = (const char *)p; - p += HDstrlen(name) + 1; + p += strlen(name) + 1; /* Find property with name */ if (NULL == (prop = H5P__find_prop_plist(plist, name))) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 3221e27..8338109 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -948,35 +948,35 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver assert(driver_name); assert(driver_id); - if (!HDstrcmp(driver_name, "sec2")) { + if (!strcmp(driver_name, "sec2")) { if ((*driver_id = H5FD_SEC2) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize sec2 VFD"); } - else if (!HDstrcmp(driver_name, "core") || !HDstrcmp(driver_name, "core_paged")) { + else if (!strcmp(driver_name, "core") || !strcmp(driver_name, "core_paged")) { if ((*driver_id = H5FD_CORE) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize core VFD"); } - else if (!HDstrcmp(driver_name, "log")) { + else if (!strcmp(driver_name, "log")) { if ((*driver_id = H5FD_LOG) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize log VFD"); } - else if (!HDstrcmp(driver_name, "family")) { + else if (!strcmp(driver_name, "family")) { if ((*driver_id = H5FD_FAMILY) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize family VFD"); } - else if (!HDstrcmp(driver_name, "multi") || !HDstrcmp(driver_name, "split")) { + else if (!strcmp(driver_name, "multi") || !strcmp(driver_name, "split")) { if ((*driver_id = H5FD_MULTI) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize multi VFD"); } - else if (!HDstrcmp(driver_name, "stdio")) { + else if (!strcmp(driver_name, "stdio")) { if ((*driver_id = H5FD_STDIO) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize stdio VFD"); } - else if (!HDstrcmp(driver_name, "splitter")) { + else if (!strcmp(driver_name, "splitter")) { if ((*driver_id = H5FD_SPLITTER) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize splitter VFD"); } - else if (!HDstrcmp(driver_name, "mpio")) { + else if (!strcmp(driver_name, "mpio")) { #ifdef H5_HAVE_PARALLEL if ((*driver_id = H5FD_MPIO) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize MPI I/O VFD"); @@ -984,7 +984,7 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "MPI-I/O VFD is not enabled"); #endif } - else if (!HDstrcmp(driver_name, "direct")) { + else if (!strcmp(driver_name, "direct")) { #ifdef H5_HAVE_DIRECT if ((*driver_id = H5FD_DIRECT) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Direct I/O VFD"); @@ -992,7 +992,7 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Direct I/O VFD is not enabled"); #endif } - else if (!HDstrcmp(driver_name, "mirror")) { + else if (!strcmp(driver_name, "mirror")) { #ifdef H5_HAVE_MIRROR_VFD if ((*driver_id = H5FD_MIRROR) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize mirror VFD"); @@ -1000,7 +1000,7 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Mirror VFD is not enabled"); #endif } - else if (!HDstrcmp(driver_name, "hdfs")) { + else if (!strcmp(driver_name, "hdfs")) { #ifdef H5_HAVE_LIBHDFS if ((*driver_id = H5FD_HDFS) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize HDFS VFD"); @@ -1008,7 +1008,7 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "HDFS VFD is not enabled"); #endif } - else if (!HDstrcmp(driver_name, "ros3")) { + else if (!strcmp(driver_name, "ros3")) { #ifdef H5_HAVE_ROS3_VFD if ((*driver_id = H5FD_ROS3) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize ROS3 VFD"); @@ -1016,7 +1016,7 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "ROS3 VFD is not enabled"); #endif } - else if (!HDstrcmp(driver_name, "subfiling")) { + else if (!strcmp(driver_name, "subfiling")) { #ifdef H5_HAVE_SUBFILING_VFD if ((*driver_id = H5FD_SUBFILING) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Subfiling VFD"); @@ -1024,7 +1024,7 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Subfiling VFD is not enabled"); #endif } - else if (!HDstrcmp(driver_name, "windows")) { + else if (!strcmp(driver_name, "windows")) { #ifdef H5_HAVE_WINDOWS if ((*driver_id = H5FD_WINDOWS) < 0) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Windows VFD"); @@ -1616,10 +1616,10 @@ H5Pget_driver_config_str(hid_t fapl_id, char *config_buf, size_t buf_size) /* Retrieve configuration string property */ if ((config_str = H5P_peek_driver_config_str(plist))) { - size_t config_str_len = HDstrlen(config_str); + size_t config_str_len = strlen(config_str); if (config_buf) { - HDstrncpy(config_buf, config_str, buf_size); + strncpy(config_buf, config_str, buf_size); if (config_str_len >= buf_size) config_buf[buf_size - 1] = '\0'; } @@ -1916,7 +1916,7 @@ H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, size_t H5_ATTR HGOTO_DONE(-1); if (cls1->name != NULL && cls2->name == NULL) HGOTO_DONE(1); - if (0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + if (0 != (cmp_value = strcmp(cls1->name, cls2->name))) HGOTO_DONE(cmp_value); /* Compare driver infos */ @@ -1941,7 +1941,7 @@ H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, size_t H5_ATTR if (info1->driver_config_str != NULL && info2->driver_config_str == NULL) HGOTO_DONE(1); if (info1->driver_config_str) { - if (0 != (cmp_value = HDstrcmp(info1->driver_config_str, info2->driver_config_str))) + if (0 != (cmp_value = strcmp(info1->driver_config_str, info2->driver_config_str))) HGOTO_DONE(cmp_value); } @@ -4097,7 +4097,7 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) H5_DECODE_UNSIGNED(*pp, config->close_trace_file); - HDstrcpy(config->trace_file_name, (const char *)(*pp)); + strcpy(config->trace_file_name, (const char *)(*pp)); *pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1; H5_DECODE_UNSIGNED(*pp, config->evictions_enabled); @@ -4622,7 +4622,7 @@ H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled /*out*/, char *locati /* Get location size, including terminating NULL */ if (location_size) { if (location_ptr) - *location_size = HDstrlen(location_ptr) + 1; + *location_size = strlen(location_ptr) + 1; else *location_size = 0; } /* end if */ @@ -4658,7 +4658,7 @@ H5P__facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) /* calculate prefix length */ if (NULL != log_location) - len = HDstrlen(log_location); + len = strlen(log_location); enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); @@ -4724,7 +4724,7 @@ H5P__facc_mdc_log_location_dec(const void **_pp, void *_value) /* Make a copy of the user's prefix string */ if (NULL == (*log_location = (char *)H5MM_malloc(len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); - HDstrncpy(*log_location, *(const char **)pp, len); + strncpy(*log_location, *(const char **)pp, len); (*log_location)[len] = '\0'; *pp += len; @@ -4804,7 +4804,7 @@ H5P__facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t H5 if (NULL != pref1 && NULL == pref2) HGOTO_DONE(-1); if (NULL != pref1 && NULL != pref2) - ret_value = HDstrcmp(pref1, pref2); + ret_value = strcmp(pref1, pref2); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pint.c b/src/H5Pint.c index ccdf3a5..da7f887 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -1677,7 +1677,7 @@ H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) /* Check if the class object has the same parent as the new class */ if (obj->parent == key->parent) { /* Check if they have the same name */ - if (HDstrcmp(obj->name, key->name) == 0) { + if (strcmp(obj->name, key->name) == 0) { key->new_class = obj; ret_value = 1; /* Indicate a match */ } /* end if */ @@ -3603,7 +3603,7 @@ H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) assert(prop2); /* Check the name */ - if ((cmp_value = HDstrcmp(prop1->name, prop2->name)) != 0) + if ((cmp_value = strcmp(prop1->name, prop2->name)) != 0) HGOTO_DONE(cmp_value); /* Check the size of properties */ @@ -3738,7 +3738,7 @@ H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) HGOTO_DONE(0); /* Check the name */ - if ((cmp_value = HDstrcmp(pclass1->name, pclass2->name)) != 0) + if ((cmp_value = strcmp(pclass1->name, pclass2->name)) != 0) HGOTO_DONE(cmp_value); /* Check the number of properties */ @@ -5350,13 +5350,13 @@ H5P__get_class_path(H5P_genclass_t *pclass) /* Allocate enough space for the parent class's path, plus the '/' * separator, this class's name and the string terminator */ - ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 1 + + ret_str_len = strlen(par_path) + strlen(pclass->name) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (ret_value = (char *)H5MM_malloc(ret_str_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name"); /* Build the full path for this class */ - HDsnprintf(ret_value, ret_str_len, "%s/%s", par_path, pclass->name); + snprintf(ret_value, ret_str_len, "%s/%s", par_path, pclass->name); /* Free the parent class's path */ H5MM_xfree(par_path); @@ -5411,7 +5411,7 @@ H5P__open_class_path(const char *path) /* Find the generic property class with this full path */ curr_name = tmp_path; curr_class = NULL; - while (NULL != (delimit = HDstrchr(curr_name, '/'))) { + while (NULL != (delimit = strchr(curr_name, '/'))) { /* Change the delimiter to terminate the string */ *delimit = '\0'; diff --git a/src/H5Plapl.c b/src/H5Plapl.c index f70c72c..1057fff 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -658,7 +658,7 @@ H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) /* calculate prefix length */ if (NULL != elink_pref) - len = HDstrlen(elink_pref); + len = strlen(elink_pref); enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); @@ -724,7 +724,7 @@ H5P__lacc_elink_pref_dec(const void **_pp, void *_value) /* Make a copy of the user's prefix string */ if (NULL == (*elink_pref = (char *)H5MM_malloc(len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); - HDstrncpy(*elink_pref, *(const char **)pp, len); + strncpy(*elink_pref, *(const char **)pp, len); (*elink_pref)[len] = '\0'; *pp += len; @@ -804,7 +804,7 @@ H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_ if (NULL != pref1 && NULL == pref2) HGOTO_DONE(-1); if (NULL != pref1 && NULL != pref2) - ret_value = HDstrcmp(pref1, pref2); + ret_value = strcmp(pref1, pref2); done: FUNC_LEAVE_NOAPI(ret_value) @@ -977,9 +977,9 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) /* Check for prefix being set */ if (my_prefix) { /* Copy to user's buffer, if given */ - len = HDstrlen(my_prefix); + len = strlen(my_prefix); if (prefix) { - HDstrncpy(prefix, my_prefix, size); + strncpy(prefix, my_prefix, size); if (len >= size) prefix[size - 1] = '\0'; } /* end if */ diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 2382756..95cc0bd 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -1178,14 +1178,14 @@ H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags /*out*/, si /* Check for actual name */ if (s) { - HDstrncpy(name, s, namelen); + strncpy(name, s, namelen); name[namelen - 1] = '\0'; } /* end if */ else { /* Check for unknown library filter */ /* (probably from a future version of the library) */ if (filter->id < 256) { - HDstrncpy(name, "Unknown library filter", namelen); + strncpy(name, "Unknown library filter", namelen); name[namelen - 1] = '\0'; } /* end if */ else @@ -1572,7 +1572,7 @@ H5P__ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t H5_ATTR_ if (pline1->filter[u].name != NULL && pline2->filter[u].name == NULL) HGOTO_DONE(1); if (pline1->filter[u].name != NULL) - if ((cmp_value = HDstrcmp(pline1->filter[u].name, pline2->filter[u].name)) != 0) + if ((cmp_value = strcmp(pline1->filter[u].name, pline2->filter[u].name)) != 0) HGOTO_DONE(cmp_value); /* Check the number of parameters for the filter */ diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 67337d5..869e363 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -356,7 +356,7 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size) dt_list = *dt_list_ptr; while (dt_list) { /* Get length of encoded path */ - len = HDstrlen(dt_list->path) + 1; + len = strlen(dt_list->path) + 1; /* Encode merge committed dtype list */ if (*pp) { @@ -415,7 +415,7 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) *dt_list = NULL; /* Decode the string sequence */ - len = HDstrlen(*(const char **)pp); + len = strlen(*(const char **)pp); while (len > 0) { /* Create new node & duplicate string */ if (NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) @@ -423,7 +423,7 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) if (NULL == (tmp_dt_list->path = H5MM_strdup(*(const char **)pp))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed"); *pp += len + 1; - assert(len == HDstrlen(tmp_dt_list->path)); + assert(len == strlen(tmp_dt_list->path)); /* Add copied node to dtype list */ if (dt_list_tail) { @@ -437,7 +437,7 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) tmp_dt_list = NULL; /* Compute length of next string */ - len = HDstrlen(*(const char **)pp); + len = strlen(*(const char **)pp); } /* end while */ /* Advance past terminator for string sequence */ @@ -543,7 +543,7 @@ H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, s assert(dt_list2->path); /* Compare paths */ - ret_value = HDstrcmp(dt_list1->path, dt_list2->path); + ret_value = strcmp(dt_list1->path, dt_list2->path); if (ret_value != 0) HGOTO_DONE(ret_value); @@ -113,7 +113,7 @@ H5RS__xstrdup(H5RS_str_t *rs, const char *s) assert(rs); if (s) { - size_t len = HDstrlen(s); + size_t len = strlen(s); /* Determine size of buffer to allocate */ rs->max = H5RS_ALLOC_SIZE; @@ -322,7 +322,7 @@ H5RS_wrap(const char *s) ret_value->s = (char *)s; H5_GCC_CLANG_DIAG_ON("cast-qual") - ret_value->len = HDstrlen(s); + ret_value->len = strlen(s); ret_value->end = ret_value->s + ret_value->len; ret_value->wrapped = true; @@ -372,7 +372,7 @@ H5RS_asprintf_cat(H5RS_str_t *rs, const char *fmt, ...) /* Attempt to write formatted output into the managed string */ va_start(args1, fmt); va_copy(args2, args1); - while ((out_len = (size_t)HDvsnprintf(rs->end, (rs->max - rs->len), fmt, args1)) >= (rs->max - rs->len)) { + while ((out_len = (size_t)vsnprintf(rs->end, (rs->max - rs->len), fmt, args1)) >= (rs->max - rs->len)) { /* Allocate a large enough buffer */ if (H5RS__resize_for_append(rs, out_len) < 0) HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer"); @@ -418,7 +418,7 @@ H5RS_acat(H5RS_str_t *rs, const char *s) /* Concatenate the provided string on to the managed string */ if (*s) { - size_t len = HDstrlen(s); + size_t len = strlen(s); /* Allocate the underlying string, if necessary */ if (H5RS__prepare_for_append(rs) < 0) @@ -464,7 +464,7 @@ H5RS_ancat(H5RS_str_t *rs, const char *s, size_t n) /* Concatenate the provided string on to the managed string */ if (n && *s) { - size_t len = HDstrlen(s); + size_t len = strlen(s); /* Limit characters to copy to the minimum of 'n' and 'len' */ n = MIN(len, n); @@ -677,7 +677,7 @@ H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2) assert(rs2); assert(rs2->s); - FUNC_LEAVE_NOAPI(HDstrcmp(rs1->s, rs2->s)) + FUNC_LEAVE_NOAPI(strcmp(rs1->s, rs2->s)) } /* end H5RS_cmp() */ /*-------------------------------------------------------------------------- @@ -707,7 +707,7 @@ H5RS_len(const H5RS_str_t *rs) assert(rs); assert(rs->s); - FUNC_LEAVE_NOAPI(HDstrlen(rs->s)) + FUNC_LEAVE_NOAPI(strlen(rs->s)) } /* end H5RS_len() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Rint.c b/src/H5Rint.c index c09b261..6a84f1c 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -102,14 +102,13 @@ H5R__print_token(const H5O_token_t token) static char string[64]; /* Print the raw token. */ - HDsnprintf(string, 64, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", - (unsigned char)token.__data[15], (unsigned char)token.__data[14], - (unsigned char)token.__data[13], (unsigned char)token.__data[12], - (unsigned char)token.__data[11], (unsigned char)token.__data[10], - (unsigned char)token.__data[9], (unsigned char)token.__data[8], (unsigned char)token.__data[7], - (unsigned char)token.__data[6], (unsigned char)token.__data[5], (unsigned char)token.__data[4], - (unsigned char)token.__data[3], (unsigned char)token.__data[2], (unsigned char)token.__data[1], - (unsigned char)token.__data[0]); + snprintf(string, 64, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", + (unsigned char)token.__data[15], (unsigned char)token.__data[14], + (unsigned char)token.__data[13], (unsigned char)token.__data[12], + (unsigned char)token.__data[11], (unsigned char)token.__data[10], (unsigned char)token.__data[9], + (unsigned char)token.__data[8], (unsigned char)token.__data[7], (unsigned char)token.__data[6], + (unsigned char)token.__data[5], (unsigned char)token.__data[4], (unsigned char)token.__data[3], + (unsigned char)token.__data[2], (unsigned char)token.__data[1], (unsigned char)token.__data[0]); return string; } @@ -279,13 +278,13 @@ H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *at assert(ref); /* Make sure that attribute name is not longer than supported encode size */ - if (HDstrlen(attr_name) > H5R_MAX_STRING_LEN) + if (strlen(attr_name) > H5R_MAX_STRING_LEN) HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "attribute name too long (%d > %d)", - (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN); + (int)strlen(attr_name), H5R_MAX_STRING_LEN); /* Create new reference */ ref->info.obj.filename = NULL; - if (NULL == (ref->info.attr.name = HDstrdup(attr_name))) + if (NULL == (ref->info.attr.name = strdup(attr_name))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name"); ref->loc_id = H5I_INVALID_HID; @@ -583,7 +582,7 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) ((NULL == ref1->info.obj.filename) && ref2->info.obj.filename)) HGOTO_DONE(false); if (ref1->info.obj.filename && ref1->info.obj.filename && - (0 != HDstrcmp(ref1->info.obj.filename, ref2->info.obj.filename))) + (0 != strcmp(ref1->info.obj.filename, ref2->info.obj.filename))) HGOTO_DONE(false); switch (ref1->type) { @@ -595,7 +594,7 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) break; case H5R_ATTR: assert(ref1->info.attr.name && ref2->info.attr.name); - if (0 != HDstrcmp(ref1->info.attr.name, ref2->info.attr.name)) + if (0 != strcmp(ref1->info.attr.name, ref2->info.attr.name)) HGOTO_DONE(false); break; case H5R_OBJECT1: @@ -644,7 +643,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace"); break; case H5R_ATTR: - if (NULL == (dst_ref->info.attr.name = HDstrdup(src_ref->info.attr.name))) + if (NULL == (dst_ref->info.attr.name = strdup(src_ref->info.attr.name))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name"); break; case H5R_OBJECT1: @@ -662,7 +661,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) if (src_ref->loc_id == H5I_INVALID_HID) { assert(src_ref->info.obj.filename); - if (NULL == (dst_ref->info.obj.filename = HDstrdup(src_ref->info.obj.filename))) + if (NULL == (dst_ref->info.obj.filename = strdup(src_ref->info.obj.filename))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy filename"); dst_ref->loc_id = H5I_INVALID_HID; } @@ -795,7 +794,7 @@ H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size) HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, (-1), "no filename available for that reference"); /* Get the file name length */ - copy_len = HDstrlen(ref->info.obj.filename); + copy_len = strlen(ref->info.obj.filename); assert(copy_len <= H5R_MAX_STRING_LEN); /* Copy the file name */ @@ -832,7 +831,7 @@ H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size) assert(ref->type == H5R_ATTR); /* Get the attribute name length */ - attr_name_len = HDstrlen(ref->info.attr.name); + attr_name_len = strlen(ref->info.attr.name); assert(attr_name_len <= H5R_MAX_STRING_LEN); /* Get the attribute name */ @@ -1245,7 +1244,7 @@ H5R__encode_string(const char *string, unsigned char *buf, size_t *nalloc) assert(nalloc); /* Get the amount of space required to serialize the string */ - string_len = HDstrlen(string); + string_len = strlen(string); if (string_len > H5R_MAX_STRING_LEN) HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "string too long"); @@ -77,7 +77,7 @@ /* Define a code template for comparing string keys for the "CMP" in the H5SL_LOCATE macro */ #define H5SL_LOCATE_STRING_CMP(SLIST, TYPE, PNODE, PKEY, HASHVAL) \ - (((PNODE)->hashval == HASHVAL) ? (HDstrcmp((const char *)(PNODE)->key, (const char *)PKEY) < 0) \ + (((PNODE)->hashval == HASHVAL) ? (strcmp((const char *)(PNODE)->key, (const char *)PKEY) < 0) \ : ((PNODE)->hashval < HASHVAL)) /* Define a code template for comparing H5_obj_t keys for the "CMP" in the H5SL_LOCATE macro */ @@ -95,7 +95,7 @@ /* Define a code template for comparing string keys for the "EQ" in the H5SL_LOCATE macro */ #define H5SL_LOCATE_STRING_EQ(SLIST, TYPE, PNODE, PKEY, HASHVAL) \ - (((PNODE)->hashval == HASHVAL) && (HDstrcmp((const char *)(PNODE)->key, (const char *)PKEY) == 0)) + (((PNODE)->hashval == HASHVAL) && (strcmp((const char *)(PNODE)->key, (const char *)PKEY) == 0)) /* Define a code template for comparing H5_obj_t keys for the "EQ" in the H5SL_LOCATE macro */ #define H5SL_LOCATE_OBJ_EQ(SLIST, TYPE, PNODE, PKEY, HASHVAL) \ @@ -2501,7 +2501,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con H5T_g.asoft = na; H5T_g.soft = x; } /* end if */ - HDstrncpy(H5T_g.soft[H5T_g.nsoft].name, name, (size_t)H5T_NAMELEN); + strncpy(H5T_g.soft[H5T_g.nsoft].name, name, (size_t)H5T_NAMELEN); H5T_g.soft[H5T_g.nsoft].name[H5T_NAMELEN - 1] = '\0'; H5T_g.soft[H5T_g.nsoft].src = src->shared->type; H5T_g.soft[H5T_g.nsoft].dst = dst->shared->type; @@ -2550,7 +2550,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con /* Create a new conversion path */ if (NULL == (new_path = H5FL_CALLOC(H5T_path_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - HDstrncpy(new_path->name, name, (size_t)H5T_NAMELEN); + strncpy(new_path->name, name, (size_t)H5T_NAMELEN); new_path->name[H5T_NAMELEN - 1] = '\0'; if (NULL == (new_path->src = H5T_copy(old_path->src, H5T_COPY_ALL)) || NULL == (new_path->dst = H5T_copy(old_path->dst, H5T_COPY_ALL))) @@ -2698,7 +2698,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c for (i = H5T_g.nsoft - 1; i >= 0; --i) { soft = H5T_g.soft + i; assert(soft); - if (name && *name && HDstrcmp(name, soft->name) != 0) + if (name && *name && strcmp(name, soft->name) != 0) continue; if (src && src->shared->type != soft->src) continue; @@ -2719,7 +2719,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c /* Not a match */ if (((H5T_PERS_SOFT == pers && path->is_hard) || (H5T_PERS_HARD == pers && !path->is_hard)) || - (name && *name && HDstrcmp(name, path->name) != 0) || (src && H5T_cmp(src, path->src, false)) || + (name && *name && strcmp(name, path->name) != 0) || (src && H5T_cmp(src, path->src, false)) || (dst && H5T_cmp(dst, path->dst, false)) || (func && func != path->conv.u.app_func)) { /* * Notify all other functions to recalculate private data since some @@ -3471,8 +3471,8 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo if (old_dt->shared->u.compnd.sorted != H5T_SORT_VALUE) { for (old_match = -1, j = 0; j < old_dt->shared->u.compnd.nmembs; j++) { - if (!HDstrcmp(new_dt->shared->u.compnd.memb[i].name, - old_dt->shared->u.compnd.memb[j].name)) { + if (!strcmp(new_dt->shared->u.compnd.memb[i].name, + old_dt->shared->u.compnd.memb[j].name)) { old_match = (int)j; break; } /* end if */ @@ -4403,8 +4403,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) int j; for (j = 0, swapped = false; j < i; j++) - if (HDstrcmp(dt1->shared->u.compnd.memb[idx1[j]].name, - dt1->shared->u.compnd.memb[idx1[j + 1]].name) > 0) { + if (strcmp(dt1->shared->u.compnd.memb[idx1[j]].name, + dt1->shared->u.compnd.memb[idx1[j + 1]].name) > 0) { unsigned tmp_idx = idx1[j]; idx1[j] = idx1[j + 1]; idx1[j + 1] = tmp_idx; @@ -4415,8 +4415,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) int j; for (j = 0, swapped = false; j < i; j++) - if (HDstrcmp(dt2->shared->u.compnd.memb[idx2[j]].name, - dt2->shared->u.compnd.memb[idx2[j + 1]].name) > 0) { + if (strcmp(dt2->shared->u.compnd.memb[idx2[j]].name, + dt2->shared->u.compnd.memb[idx2[j + 1]].name) > 0) { unsigned tmp_idx = idx2[j]; idx2[j] = idx2[j + 1]; idx2[j + 1] = tmp_idx; @@ -4428,17 +4428,17 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) #ifdef H5T_DEBUG /* I don't quite trust the code above yet :-) --RPM */ for (u = 0; u < dt1->shared->u.compnd.nmembs - 1; u++) { - assert(HDstrcmp(dt1->shared->u.compnd.memb[idx1[u]].name, - dt1->shared->u.compnd.memb[idx1[u + 1]].name)); - assert(HDstrcmp(dt2->shared->u.compnd.memb[idx2[u]].name, - dt2->shared->u.compnd.memb[idx2[u + 1]].name)); + assert(strcmp(dt1->shared->u.compnd.memb[idx1[u]].name, + dt1->shared->u.compnd.memb[idx1[u + 1]].name)); + assert(strcmp(dt2->shared->u.compnd.memb[idx2[u]].name, + dt2->shared->u.compnd.memb[idx2[u + 1]].name)); } #endif /* Compare the members */ for (u = 0; u < dt1->shared->u.compnd.nmembs; u++) { - tmp = HDstrcmp(dt1->shared->u.compnd.memb[idx1[u]].name, - dt2->shared->u.compnd.memb[idx2[u]].name); + tmp = strcmp(dt1->shared->u.compnd.memb[idx1[u]].name, + dt2->shared->u.compnd.memb[idx2[u]].name); if (tmp < 0) HGOTO_DONE(-1); if (tmp > 0) @@ -4494,8 +4494,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) int j; for (j = 0, swapped = false; j < i; j++) - if (HDstrcmp(dt1->shared->u.enumer.name[idx1[j]], - dt1->shared->u.enumer.name[idx1[j + 1]]) > 0) { + if (strcmp(dt1->shared->u.enumer.name[idx1[j]], + dt1->shared->u.enumer.name[idx1[j + 1]]) > 0) { unsigned tmp_idx = idx1[j]; idx1[j] = idx1[j + 1]; idx1[j + 1] = tmp_idx; @@ -4512,8 +4512,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) int j; for (j = 0, swapped = false; j < i; j++) - if (HDstrcmp(dt2->shared->u.enumer.name[idx2[j]], - dt2->shared->u.enumer.name[idx2[j + 1]]) > 0) { + if (strcmp(dt2->shared->u.enumer.name[idx2[j]], + dt2->shared->u.enumer.name[idx2[j + 1]]) > 0) { unsigned tmp_idx = idx2[j]; idx2[j] = idx2[j + 1]; idx2[j + 1] = tmp_idx; @@ -4525,10 +4525,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) #ifdef H5T_DEBUG /* I don't quite trust the code above yet :-) --RPM */ for (u = 0; u < dt1->shared->u.enumer.nmembs - 1; u++) { - assert( - HDstrcmp(dt1->shared->u.enumer.name[idx1[u]], dt1->shared->u.enumer.name[idx1[u + 1]])); - assert( - HDstrcmp(dt2->shared->u.enumer.name[idx2[u]], dt2->shared->u.enumer.name[idx2[u + 1]])); + assert(strcmp(dt1->shared->u.enumer.name[idx1[u]], dt1->shared->u.enumer.name[idx1[u + 1]])); + assert(strcmp(dt2->shared->u.enumer.name[idx2[u]], dt2->shared->u.enumer.name[idx2[u + 1]])); } #endif @@ -4551,8 +4549,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) idx = (lt + rt) / 2; /* compare */ - if ((cmp = HDstrcmp(dt1->shared->u.enumer.name[idx1[u]], - dt2->shared->u.enumer.name[idx2[idx]])) < 0) + if ((cmp = strcmp(dt1->shared->u.enumer.name[idx1[u]], + dt2->shared->u.enumer.name[idx2[idx]])) < 0) rt = idx; else lt = idx + 1; @@ -4565,7 +4563,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) /* Check for exact member name match when not doing * "superset" comparison */ - tmp = HDstrcmp(dt1->shared->u.enumer.name[idx1[u]], dt2->shared->u.enumer.name[idx2[u]]); + tmp = strcmp(dt1->shared->u.enumer.name[idx1[u]], dt2->shared->u.enumer.name[idx2[u]]); if (tmp < 0) HGOTO_DONE(-1); if (tmp > 0) @@ -4621,7 +4619,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset) case H5T_OPAQUE: if (dt1->shared->u.opaque.tag && dt2->shared->u.opaque.tag) - HGOTO_DONE(HDstrcmp(dt1->shared->u.opaque.tag, dt2->shared->u.opaque.tag)); + HGOTO_DONE(strcmp(dt1->shared->u.opaque.tag, dt2->shared->u.opaque.tag)); break; case H5T_ARRAY: @@ -4890,7 +4888,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co if (NULL == (H5T_g.path[0] = H5FL_CALLOC(H5T_path_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path"); - HDsnprintf(H5T_g.path[0]->name, sizeof(H5T_g.path[0]->name), "no-op"); + snprintf(H5T_g.path[0]->name, sizeof(H5T_g.path[0]->name), "no-op"); H5T_g.path[0]->conv.is_app = false; H5T_g.path[0]->conv.u.lib_func = H5T__conv_noop; H5T_g.path[0]->cdata.command = H5T_CONV_INIT; @@ -4955,11 +4953,11 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co if (NULL == (path = H5FL_CALLOC(H5T_path_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path"); if (name && *name) { - HDstrncpy(path->name, name, (size_t)H5T_NAMELEN); + strncpy(path->name, name, (size_t)H5T_NAMELEN); path->name[H5T_NAMELEN - 1] = '\0'; } /* end if */ else - HDsnprintf(path->name, sizeof(path->name), "NONAME"); + snprintf(path->name, sizeof(path->name), "NONAME"); if (NULL == (path->src = H5T_copy(src, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path"); if (NULL == (path->dst = H5T_copy(dst, H5T_COPY_ALL))) @@ -5037,7 +5035,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co /* Finish operation, if no error */ if (!path_init_error) { - HDstrncpy(path->name, H5T_g.soft[i].name, (size_t)H5T_NAMELEN); + strncpy(path->name, H5T_g.soft[i].name, (size_t)H5T_NAMELEN); path->name[H5T_NAMELEN - 1] = '\0'; path->conv = H5T_g.soft[i].conv; path->is_hard = false; diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index a6a27de..f877d52 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -410,7 +410,7 @@ H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) /* Does NAME already exist in PARENT? */ for (i = 0; i < parent->shared->u.compnd.nmembs; i++) - if (!HDstrcmp(parent->shared->u.compnd.memb[i].name, name)) + if (!strcmp(parent->shared->u.compnd.memb[i].name, name)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member name is not unique"); /* Does the new member overlap any existing member ? */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index e73e155..72debe8 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2026,7 +2026,7 @@ H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) for (i = 0; i < src_nmembs; i++) { src2dst[i] = -1; for (j = 0; j < dst_nmembs; j++) { - if (!HDstrcmp(src->shared->u.compnd.memb[i].name, dst->shared->u.compnd.memb[j].name)) { + if (!strcmp(src->shared->u.compnd.memb[i].name, dst->shared->u.compnd.memb[j].name)) { H5_CHECKED_ASSIGN(src2dst[i], int, j, unsigned); break; } /* end if */ @@ -2687,7 +2687,7 @@ H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); for (i = 0, j = 0; i < src->shared->u.enumer.nmembs && j < dst->shared->u.enumer.nmembs; i++, j++) { while (j < dst->shared->u.enumer.nmembs && - HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j]) != 0) + strcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j]) != 0) j++; if (j >= dst->shared->u.enumer.nmembs) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, diff --git a/src/H5Tenum.c b/src/H5Tenum.c index d526508..09407b1 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -171,7 +171,7 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) /* The name and value had better not already exist */ for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { - if (!HDstrcmp(dt->shared->u.enumer.name[i], name)) + if (!strcmp(dt->shared->u.enumer.name[i], name)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "name redefinition"); if (!memcmp((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, dt->shared->size)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "value redefinition"); @@ -378,12 +378,12 @@ H5T__enum_nameof(const H5T_t *dt, const void *value, char *name /*out*/, size_t /* Save result name */ if (!name) { - if (NULL == (name = (char *)H5MM_malloc(HDstrlen(copied_dt->shared->u.enumer.name[md]) + 1))) + if (NULL == (name = (char *)H5MM_malloc(strlen(copied_dt->shared->u.enumer.name[md]) + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); alloc_name = true; } /* end if */ - HDstrncpy(name, copied_dt->shared->u.enumer.name[md], size); - if (HDstrlen(copied_dt->shared->u.enumer.name[md]) >= size) + strncpy(name, copied_dt->shared->u.enumer.name[md], size); + if (strlen(copied_dt->shared->u.enumer.name[md]) >= size) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, NULL, "name has been truncated"); /* Set return value */ @@ -484,7 +484,7 @@ H5T__enum_valueof(const H5T_t *dt, const char *name, void *value /*out*/) while (lt < rt) { md = (lt + rt) / 2; - cmp = HDstrcmp(name, copied_dt->shared->u.enumer.name[md]); + cmp = strcmp(name, copied_dt->shared->u.enumer.name[md]); if (cmp < 0) { rt = md; } diff --git a/src/H5Tfields.c b/src/H5Tfields.c index 4ed4f52..dc839ba 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -215,12 +215,12 @@ H5Tget_member_index(hid_t type_id, const char *name) switch (dt->shared->type) { case H5T_COMPOUND: for (i = 0; i < dt->shared->u.compnd.nmembs; i++) - if (!HDstrcmp(dt->shared->u.compnd.memb[i].name, name)) + if (!strcmp(dt->shared->u.compnd.memb[i].name, name)) HGOTO_DONE((int)i); break; case H5T_ENUM: for (i = 0; i < dt->shared->u.enumer.nmembs; i++) - if (!HDstrcmp(dt->shared->u.enumer.name[i], name)) + if (!strcmp(dt->shared->u.enumer.name[i], name)) HGOTO_DONE((int)i); break; @@ -379,7 +379,7 @@ H5T__sort_name(const H5T_t *dt, int *map) nmembs = dt->shared->u.compnd.nmembs; for (i = nmembs - 1, swapped = true; i > 0 && swapped; --i) { for (j = 0, swapped = false; j < i; j++) { - if (HDstrcmp(dt->shared->u.compnd.memb[j].name, dt->shared->u.compnd.memb[j + 1].name) > + if (strcmp(dt->shared->u.compnd.memb[j].name, dt->shared->u.compnd.memb[j + 1].name) > 0) { H5T_cmemb_t tmp = dt->shared->u.compnd.memb[j]; dt->shared->u.compnd.memb[j] = dt->shared->u.compnd.memb[j + 1]; @@ -396,8 +396,7 @@ H5T__sort_name(const H5T_t *dt, int *map) #ifndef NDEBUG /* I never trust a sort :-) -RPM */ for (i = 0; i < nmembs - 1; i++) { - assert(HDstrcmp(dt->shared->u.compnd.memb[i].name, dt->shared->u.compnd.memb[i + 1].name) < - 0); + assert(strcmp(dt->shared->u.compnd.memb[i].name, dt->shared->u.compnd.memb[i + 1].name) < 0); } #endif } @@ -410,7 +409,7 @@ H5T__sort_name(const H5T_t *dt, int *map) assert(size <= sizeof(tbuf)); for (i = nmembs - 1, swapped = true; i > 0 && swapped; --i) { for (j = 0, swapped = false; j < i; j++) { - if (HDstrcmp(dt->shared->u.enumer.name[j], dt->shared->u.enumer.name[j + 1]) > 0) { + if (strcmp(dt->shared->u.enumer.name[j], dt->shared->u.enumer.name[j + 1]) > 0) { /* Swap names */ char *tmp = dt->shared->u.enumer.name[j]; dt->shared->u.enumer.name[j] = dt->shared->u.enumer.name[j + 1]; @@ -436,7 +435,7 @@ H5T__sort_name(const H5T_t *dt, int *map) #ifndef NDEBUG /* I never trust a sort :-) -RPM */ for (i = 0; i < nmembs - 1; i++) - assert(HDstrcmp(dt->shared->u.enumer.name[i], dt->shared->u.enumer.name[i + 1]) < 0); + assert(strcmp(dt->shared->u.enumer.name[i], dt->shared->u.enumer.name[i + 1]) < 0); #endif } } diff --git a/src/H5Topaque.c b/src/H5Topaque.c index 808eb8c..63282ec 100644 --- a/src/H5Topaque.c +++ b/src/H5Topaque.c @@ -52,7 +52,7 @@ H5Tset_tag(hid_t type_id, const char *tag) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type"); if (!tag) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag"); - if (HDstrlen(tag) >= H5T_OPAQUE_TAG_MAX) + if (strlen(tag) >= H5T_OPAQUE_TAG_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tag too long"); /* Commit */ diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index e503a88..68087a8 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -550,7 +550,7 @@ H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, si /* Copy to ensure correct alignment */ H5MM_memcpy(&s, _vl, sizeof(char *)); - *len = HDstrlen(s); + *len = strlen(s); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T__vlen_mem_str_getlen() */ @@ -129,7 +129,7 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id) /* Check arguments */ if (!name) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL connector name is disallowed"); - if (0 == HDstrlen(name)) + if (0 == strlen(name)) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed"); diff --git a/src/H5VLint.c b/src/H5VLint.c index b7f6e5e..0b18a7c 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -317,7 +317,7 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data) FUNC_ENTER_PACKAGE_NOERR if (H5VL_GET_CONNECTOR_BY_NAME == op_data->key.kind) { - if (0 == HDstrcmp(cls->name, op_data->key.u.name)) { + if (0 == strcmp(cls->name, op_data->key.u.name)) { op_data->found_id = id; ret_value = H5_ITER_STOP; } /* end if */ @@ -399,12 +399,12 @@ H5VL__set_def_conn(void) } /* end else-if */ else { /* Check for VOL connectors that ship with the library */ - if (!HDstrcmp(tok, "native")) { + if (!strcmp(tok, "native")) { connector_id = H5VL_NATIVE; if (H5I_inc_ref(connector_id, false) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount"); } /* end if */ - else if (!HDstrcmp(tok, "pass_through")) { + else if (!strcmp(tok, "pass_through")) { connector_id = H5VL_PASSTHRU; if (H5I_inc_ref(connector_id, false) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount"); @@ -1236,7 +1236,7 @@ H5VL__register_connector_by_class(const H5VL_class_t *cls, bool app_ref, hid_t v if (!cls->name) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the NULL pointer"); - if (0 == HDstrlen(cls->name)) + if (0 == strlen(cls->name)) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the empty string"); if (cls->info_cls.copy && !cls->info_cls.free) @@ -1689,9 +1689,9 @@ H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size) cls = vol_obj->connector->cls; - len = HDstrlen(cls->name); + len = strlen(cls->name); if (name) { - HDstrncpy(name, cls->name, size); + strncpy(name, cls->name, size); if (len >= size) name[size - 1] = '\0'; } /* end if */ @@ -1972,7 +1972,7 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas *cmp_value = 1; HGOTO_DONE(SUCCEED); } /* end if */ - if (0 != (*cmp_value = HDstrcmp(cls1->name, cls2->name))) + if (0 != (*cmp_value = strcmp(cls1->name, cls2->name))) HGOTO_DONE(SUCCEED); /* Compare connector VOL API versions */ @@ -2457,7 +2457,7 @@ H5VL_check_plugin_load(const H5VL_class_t *cls, const H5PL_key_t *key, bool *suc /* Which kind of key are we looking for? */ if (key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) { /* Check if plugin name matches VOL connector class name */ - if (cls->name && !HDstrcmp(cls->name, key->vol.u.name)) + if (cls->name && !strcmp(cls->name, key->vol.u.name)) *success = true; } /* end if */ else { diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c index cc92403..50aca65 100644 --- a/src/H5VLnative_attr.c +++ b/src/H5VLnative_attr.c @@ -314,12 +314,12 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute"); /* Get the length of the name */ - *get_name_args->attr_name_len = HDstrlen(attr->shared->name); + *get_name_args->attr_name_len = strlen(attr->shared->name); /* Copy the name into the user's buffer, if given */ if (get_name_args->buf) { - HDstrncpy(get_name_args->buf, attr->shared->name, - MIN((*get_name_args->attr_name_len + 1), get_name_args->buf_size)); + strncpy(get_name_args->buf, attr->shared->name, + MIN((*get_name_args->attr_name_len + 1), get_name_args->buf_size)); if (*get_name_args->attr_name_len >= get_name_args->buf_size) get_name_args->buf[get_name_args->buf_size - 1] = '\0'; } /* end if */ diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 45081f0..9ebc2c2 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -231,12 +231,12 @@ H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSE HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Get length of file name */ - *file_args->file_name_len = HDstrlen(H5F_OPEN_NAME(f)); + *file_args->file_name_len = strlen(H5F_OPEN_NAME(f)); /* Populate buffer with name, if given */ if (file_args->buf) { - HDstrncpy(file_args->buf, H5F_OPEN_NAME(f), - MIN(*file_args->file_name_len + 1, file_args->buf_size)); + strncpy(file_args->buf, H5F_OPEN_NAME(f), + MIN(*file_args->file_name_len + 1, file_args->buf_size)); if (*file_args->file_name_len >= file_args->buf_size) file_args->buf[file_args->buf_size - 1] = '\0'; } /* end if */ diff --git a/src/H5VLnative_token.c b/src/H5VLnative_token.c index 800858f..353e8cd 100644 --- a/src/H5VLnative_token.c +++ b/src/H5VLnative_token.c @@ -112,7 +112,7 @@ H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *tok if (NULL == (*token_str = H5MM_malloc(addr_ndigits + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for token string"); - HDsnprintf(*token_str, addr_ndigits + 1, "%" PRIuHADDR, addr); + snprintf(*token_str, addr_ndigits + 1, "%" PRIuHADDR, addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -139,7 +139,7 @@ H5VL__native_str_to_token(void *obj, H5I_type_t obj_type, const char *token_str, /* Check parameters */ assert(token_str); - HDsscanf(token_str, "%" PRIuHADDR, &addr); + sscanf(token_str, "%" PRIuHADDR, &addr); if (H5VL_native_addr_to_token(obj, obj_type, addr, token) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert address to object token"); @@ -162,7 +162,7 @@ H5Z_term_package(void) } /* end if */ /* Truncate the comment to fit in the field */ - HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment); + strncpy(comment, H5Z_table_g[i].name, sizeof comment); comment[sizeof(comment) - 1] = '\0'; /* @@ -1612,7 +1612,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* Free information for deleted filter */ if (pline->filter[idx].name && pline->filter[idx].name != pline->filter[idx]._name) - assert((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN); + assert((strlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN); if (pline->filter[idx].name != pline->filter[idx]._name) pline->filter[idx].name = (char *)H5MM_xfree(pline->filter[idx].name); if (pline->filter[idx].cd_values && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) @@ -1625,7 +1625,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* Copy filters down & fix up any client data value arrays using internal storage */ for (; (idx + 1) < pline->nused; idx++) { pline->filter[idx] = pline->filter[idx + 1]; - if (pline->filter[idx].name && (HDstrlen(pline->filter[idx].name) + 1) <= H5Z_COMMON_NAME_LEN) + if (pline->filter[idx].name && (strlen(pline->filter[idx].name) + 1) <= H5Z_COMMON_NAME_LEN) pline->filter[idx].name = pline->filter[idx]._name; if (pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES) pline->filter[idx].cd_values = pline->filter[idx]._cd_values; diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 3b0d79c..1b59efa 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -759,7 +759,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); - HDsscanf(current->tok_begin, "%ld", &factor->value.int_val); + sscanf(current->tok_begin, "%ld", &factor->value.int_val); break; case H5Z_XFORM_FLOAT: @@ -767,7 +767,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); - HDsscanf(current->tok_begin, "%lf", &factor->value.float_val); + sscanf(current->tok_begin, "%lf", &factor->value.float_val); break; case H5Z_XFORM_SYMBOL: @@ -1420,9 +1420,9 @@ H5Z_xform_create(const char *expr) /* Find the number of times "x" is used in this equation, and allocate room for storing that many points * A more sophisticated check is needed to support scientific notation. */ - for (i = 0; i < HDstrlen(expr); i++) { + for (i = 0; i < strlen(expr); i++) { if (isalpha(expr[i])) { - if ((i > 0) && (i < (HDstrlen(expr) - 1))) { + if ((i > 0) && (i < (strlen(expr) - 1))) { if (((expr[i] == 'E') || (expr[i] == 'e')) && (isdigit(expr[i - 1]) || (expr[i - 1] == '.')) && (isdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+'))) @@ -1558,7 +1558,7 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) /* Find the number of times "x" is used in this equation, and allocate room for storing that many * points */ - for (i = 0; i < HDstrlen(new_data_xform_prop->xform_exp); i++) + for (i = 0; i < strlen(new_data_xform_prop->xform_exp); i++) if (isalpha(new_data_xform_prop->xform_exp[i])) count++; @@ -1625,7 +1625,7 @@ H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop) ret_value = false; /* Check for trivial data transformation: expression = "x" */ - if ((HDstrlen(data_xform_prop->xform_exp) == 1) && data_xform_prop->dat_val_pointers && + if ((strlen(data_xform_prop->xform_exp) == 1) && data_xform_prop->dat_val_pointers && (data_xform_prop->dat_val_pointers->num_ptrs == 1)) { ret_value = true; } /* end if */ diff --git a/src/H5dbg.c b/src/H5dbg.c index 69afd01..7a3dfaa 100644 --- a/src/H5dbg.c +++ b/src/H5dbg.c @@ -102,30 +102,30 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark fprintf(stream, " "); if (7 == v) - HDfputc(' ', stream); + fputc(' ', stream); } /* end for */ - HDfputc(' ', stream); + fputc(' ', stream); /* Print the character values */ for (v = 0; v < 16; v++) { if (u + v < buf_size) { if (marker[u + v]) - HDfputc(' ', stream); + fputc(' ', stream); else { c = buf[buf_offset + u + v]; if (isprint(c)) - HDfputc(c, stream); + fputc(c, stream); else - HDfputc('.', stream); + fputc('.', stream); } /* end else */ } /* end if */ if (7 == v) - HDfputc(' ', stream); + fputc(' ', stream); } /* end for */ - HDfputc('\n', stream); + fputc('\n', stream); } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5mpi.c b/src/H5mpi.c index 29c9f39..2cd335d 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -812,7 +812,7 @@ H5_mpio_get_file_sync_required(MPI_File fh, bool *file_sync_required) MPI_Info_get(info_used, "romio_visibility_immediate", MPI_MAX_INFO_VAL - 1, value, &flag)) HGOTO_ERROR(H5E_LIB, H5E_CANTGET, FAIL, "can't get MPI info"); - if (flag && !HDstrcmp(value, "false")) + if (flag && !strcmp(value, "false")) *file_sync_required = true; if (MPI_SUCCESS != MPI_Info_free(&info_used)) @@ -820,9 +820,9 @@ H5_mpio_get_file_sync_required(MPI_File fh, bool *file_sync_required) /* Force setting the flag via env variable (temp solution before the flag is implemented in MPI) */ sync_env_var = HDgetenv("HDF5_DO_MPI_FILE_SYNC"); - if (sync_env_var && (!HDstrcmp(sync_env_var, "TRUE") || !HDstrcmp(sync_env_var, "1"))) + if (sync_env_var && (!strcmp(sync_env_var, "TRUE") || !strcmp(sync_env_var, "1"))) *file_sync_required = true; - if (sync_env_var && (!HDstrcmp(sync_env_var, "FALSE") || !HDstrcmp(sync_env_var, "0"))) + if (sync_env_var && (!strcmp(sync_env_var, "FALSE") || !strcmp(sync_env_var, "0"))) *file_sync_required = false; done: diff --git a/src/H5private.h b/src/H5private.h index b2604a9..b3e3dc8 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -641,12 +641,6 @@ typedef off_t h5_stat_size_t; #ifndef HDfdopen #define HDfdopen(N, S) fdopen(N, S) #endif -#ifndef HDfgetc -#define HDfgetc(F) fgetc(F) -#endif -#ifndef HDfgets -#define HDfgets(S, N, F) fgets(S, N, F) -#endif #ifndef HDfileno #define HDfileno(F) fileno(F) #endif @@ -676,15 +670,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #endif /* HDflock */ -#ifndef HDfputc -#define HDfputc(C, F) fputc(C, F) -#endif -#ifndef HDfputs -#define HDfputs(S, F) fputs(S, F) -#endif -#ifndef HDfscanf -#define HDfscanf fscanf -#endif #ifndef HDfseek #define HDfseek(F, O, W) fseeko(F, O, W) #endif @@ -697,9 +682,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDftruncate #define HDftruncate(F, L) ftruncate(F, L) #endif -#ifndef HDgetc -#define HDgetc(F) getc(F) -#endif #ifndef HDgetcwd #define HDgetcwd(S, Z) getcwd(S, Z) #endif @@ -718,12 +700,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDgetpid #define HDgetpid() getpid() #endif - -/* Don't define HDgets - gets() was deprecated in C99 and removed in C11 */ -#ifdef HDgets -#undef HDgets -#endif - #ifndef HDgettimeofday #define HDgettimeofday(S, P) gettimeofday(S, P) #endif @@ -757,21 +733,9 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDopendir #define HDopendir(S) opendir(S) #endif -#ifndef HDperror -#define HDperror(S) perror(S) -#endif #ifndef HDpread #define HDpread(F, B, C, O) pread(F, B, C, O) #endif -#ifndef HDputc -#define HDputc(C, F) putc(C, F) -#endif -#ifndef HDputchar -#define HDputchar(C) putchar(C) -#endif -#ifndef HDputs -#define HDputs(S) puts(S) -#endif #ifndef HDpwrite #define HDpwrite(F, B, C, O) pwrite(F, B, C, O) #endif @@ -836,9 +800,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDrmdir #define HDrmdir(S) rmdir(S) #endif -#ifndef HDscanf -#define HDscanf scanf /*varargs*/ -#endif #ifndef HDsetbuf #define HDsetbuf(F, S) setbuf(F, S) #endif @@ -863,21 +824,9 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDsleep #define HDsleep(N) sleep(N) #endif -#ifndef HDsnprintf -#define HDsnprintf snprintf /*varargs*/ -#endif -#ifndef HDsprintf -#define HDsprintf sprintf /*varargs*/ -#endif -#ifndef HDsscanf -#define HDsscanf sscanf /*varargs*/ -#endif #ifndef HDstat #define HDstat(S, B) stat(S, B) #endif -#ifndef HDstrcat -#define HDstrcat(X, Y) strcat(X, Y) -#endif #ifndef HDstrcasestr #if defined(H5_HAVE_STRCASESTR) #define HDstrcasestr(X, Y) strcasestr(X, Y) @@ -885,57 +834,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #define HDstrcasestr(X, Y) H5_strcasestr(X, Y) #endif #endif -#ifndef HDstrchr -#define HDstrchr(S, C) strchr(S, C) -#endif -#ifndef HDstrcmp -#define HDstrcmp(X, Y) strcmp(X, Y) -#endif #ifndef HDstrcasecmp #define HDstrcasecmp(X, Y) strcasecmp(X, Y) #endif -#ifndef HDstrcpy -#define HDstrcpy(X, Y) strcpy(X, Y) -#endif -#ifndef HDstrcspn -#define HDstrcspn(X, Y) strcspn(X, Y) -#endif -#ifndef HDstrdup -#define HDstrdup(S) strdup(S) -#endif -#ifndef HDstrerror -#define HDstrerror(N) strerror(N) -#endif -#ifndef HDstrftime -#define HDstrftime(S, Z, F, T) strftime(S, Z, F, T) -#endif -#ifndef HDstrlen -#define HDstrlen(S) strlen(S) -#endif -#ifndef HDstrnlen -#define HDstrnlen(S, L) strnlen(S, L) -#endif -#ifndef HDstrncat -#define HDstrncat(X, Y, Z) strncat(X, Y, Z) -#endif -#ifndef HDstrncmp -#define HDstrncmp(X, Y, Z) strncmp(X, Y, Z) -#endif -#ifndef HDstrncpy -#define HDstrncpy(X, Y, Z) strncpy(X, Y, Z) -#endif #ifndef HDstrndup #define HDstrndup(S, N) strndup(S, N) #endif -#ifndef HDstrrchr -#define HDstrrchr(S, C) strrchr(S, C) -#endif -#ifndef HDstrstr -#define HDstrstr(X, Y) strstr(X, Y) -#endif -#ifndef HDstrtok -#define HDstrtok(X, Y) strtok(X, Y) -#endif #ifndef HDstrtok_r #define HDstrtok_r(X, Y, Z) strtok_r(X, Y, Z) #endif @@ -969,18 +873,6 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #endif #endif -#ifndef HDvfprintf -#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) -#endif -#ifndef HDvprintf -#define HDvprintf(FMT, A) vprintf(FMT, A) -#endif -#ifndef HDvsprintf -#define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A) -#endif -#ifndef HDvsnprintf -#define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A) -#endif #ifndef HDwrite #define HDwrite(F, M, Z) write(F, M, Z) #endif @@ -1095,8 +987,8 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); { \ char *slash, *backslash; \ \ - slash = HDstrrchr(NAME, H5_DIR_SLASH_SEPC); \ - backslash = HDstrrchr(NAME, H5_DIR_SEPC); \ + slash = strrchr(NAME, H5_DIR_SLASH_SEPC); \ + backslash = strrchr(NAME, H5_DIR_SEPC); \ if (backslash > slash) \ (ptr = backslash); \ else \ @@ -1111,7 +1003,7 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #define H5_CHECK_ABSOLUTE(NAME) (H5_CHECK_DELIMITER(*NAME)) #define H5_CHECK_ABS_DRIVE(NAME) (0) #define H5_CHECK_ABS_PATH(NAME) (0) -#define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = HDstrrchr(NAME, H5_DIR_SEPC); +#define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, H5_DIR_SEPC); #endif /* H5_HAVE_WINDOW_PATH */ diff --git a/src/H5system.c b/src/H5system.c index 3ece99a..7ff521e 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -78,7 +78,7 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap) va_list ap; va_copy(ap, _ap); - ret = HDvsnprintf(buf, bufsz, fmt, ap); + ret = vsnprintf(buf, bufsz, fmt, ap); va_end(ap); if (ret >= 0 && (size_t)ret < bufsz) { *bufp = buf; @@ -642,7 +642,7 @@ H5_build_extpath(const char *name, char **extpath /*out*/) if (NULL == (cwdpath = (char *)H5MM_malloc(MAX_PATH_LEN))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); - name_len = HDstrlen(name) + 1; + name_len = strlen(name) + 1; if (NULL == (new_name = (char *)H5MM_malloc(name_len))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); @@ -654,7 +654,7 @@ H5_build_extpath(const char *name, char **extpath /*out*/) if (H5_CHECK_ABS_DRIVE(name)) { drive = HDtoupper(name[0]) - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); - HDstrncpy(new_name, &name[2], name_len); + strncpy(new_name, &name[2], name_len); } /* end if */ /* * Windows: name[0] is a '/' or '\' @@ -662,14 +662,14 @@ H5_build_extpath(const char *name, char **extpath /*out*/) * Unix: does not apply */ else if (H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) { - HDsnprintf(cwdpath, MAX_PATH_LEN, "%c:%c", (drive + 'A' - 1), name[0]); + snprintf(cwdpath, MAX_PATH_LEN, "%c:%c", (drive + 'A' - 1), name[0]); retcwd = cwdpath; - HDstrncpy(new_name, &name[1], name_len); + strncpy(new_name, &name[1], name_len); } /* totally relative for Unix and Windows: get current working directory */ else { retcwd = HDgetcwd(cwdpath, MAX_PATH_LEN); - HDstrncpy(new_name, name, name_len); + strncpy(new_name, name, name_len); } /* end if */ if (retcwd != NULL) { @@ -677,17 +677,17 @@ H5_build_extpath(const char *name, char **extpath /*out*/) size_t path_len; assert(cwdpath); - cwdlen = HDstrlen(cwdpath); + cwdlen = strlen(cwdpath); assert(cwdlen); assert(new_name); - path_len = cwdlen + HDstrlen(new_name) + 2; + path_len = cwdlen + strlen(new_name) + 2; if (NULL == (full_path = (char *)H5MM_malloc(path_len))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); - HDstrncpy(full_path, cwdpath, cwdlen + 1); + strncpy(full_path, cwdpath, cwdlen + 1); if (!H5_CHECK_DELIMITER(cwdpath[cwdlen - 1])) - HDstrncat(full_path, H5_DIR_SEPS, path_len - (cwdlen + 1)); - HDstrncat(full_path, new_name, path_len - (cwdlen + 1) - HDstrlen(H5_DIR_SEPS)); + strncat(full_path, H5_DIR_SEPS, path_len - (cwdlen + 1)); + strncat(full_path, new_name, path_len - (cwdlen + 1) - strlen(H5_DIR_SEPS)); } /* end if */ } /* end else */ @@ -734,8 +734,8 @@ H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) assert(path2); if (path1) - path1_len = HDstrlen(path1); - path2_len = HDstrlen(path2); + path1_len = strlen(path1); + path2_len = strlen(path2); if (path1 == NULL || *path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { @@ -753,7 +753,7 @@ H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) */ if (NULL == (*full_name = (char *)H5MM_malloc(path2_len + 3))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate path2 buffer"); - HDsnprintf(*full_name, (path2_len + 3), "%c:%s", path1[0], path2); + snprintf(*full_name, (path2_len + 3), "%c:%s", path1[0], path2); } /* end if */ else { /* On windows path2 is path absolute name ("\foo\bar"), @@ -777,9 +777,9 @@ H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer"); /* Compose the full file name */ - HDsnprintf(*full_name, (path1_len + path2_len + 2 + 2), "%s%s%s", - path1, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ - (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); + snprintf(*full_name, (path1_len + path2_len + 2 + 2), "%s%s%s", + path1, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ + (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); } /* end else */ done: @@ -1000,7 +1000,7 @@ H5_dirname(const char *path, char **dirname) if (!dirname) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dirname can't be NULL"); - if (NULL == (sep = HDstrrchr(path, H5_DIR_SEPC))) { + if (NULL == (sep = strrchr(path, H5_DIR_SEPC))) { /* Pathname with no file separator characters */ out = H5MM_strdup("."); } @@ -1109,7 +1109,7 @@ H5_basename(const char *path, char **basename) if (!basename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "basename can't be NULL"); - if (NULL == (sep = HDstrrchr(path, H5_DIR_SEPC))) { + if (NULL == (sep = strrchr(path, H5_DIR_SEPC))) { if (*path == '\0') /* Empty pathname */ out = H5MM_strdup("."); @@ -1206,7 +1206,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') { return EOF; } - else if (HDstrcmp(argv[H5_optind], "--") == 0) { + else if (strcmp(argv[H5_optind], "--") == 0) { H5_optind++; return EOF; } @@ -1216,19 +1216,19 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct /* long command line option */ int i; const char ch = '='; - char *arg = HDstrdup(&argv[H5_optind][2]); + char *arg = strdup(&argv[H5_optind][2]); size_t arg_len = 0; H5_optarg = strchr(&argv[H5_optind][2], ch); - arg_len = HDstrlen(&argv[H5_optind][2]); + arg_len = strlen(&argv[H5_optind][2]); if (H5_optarg) { - arg_len -= HDstrlen(H5_optarg); + arg_len -= strlen(H5_optarg); H5_optarg++; /* skip the equal sign */ } arg[arg_len] = 0; for (i = 0; l_opts && l_opts[i].name; i++) { - if (HDstrcmp(arg, l_opts[i].name) == 0) { + if (strcmp(arg, l_opts[i].name) == 0) { /* we've found a matching long command line flag */ optchar = l_opts[i].shortval; @@ -1278,7 +1278,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct /* short command line option */ optchar = argv[H5_optind][sp]; - if (optchar == ':' || (cp = HDstrchr(opts, optchar)) == 0) { + if (optchar == ':' || (cp = strchr(opts, optchar)) == 0) { if (H5_opterr) fprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optchar); diff --git a/src/H5timer.c b/src/H5timer.c index dcb3dbc..ac04d15 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -95,41 +95,41 @@ H5_bandwidth(char *buf /*out*/, size_t bufsize, double nbytes, double nseconds) double bw; if (nseconds <= 0.0) - HDstrcpy(buf, " NaN"); + strcpy(buf, " NaN"); else { bw = nbytes / nseconds; if (H5_DBL_ABS_EQUAL(bw, 0.0)) - HDstrcpy(buf, "0.000 B/s"); + strcpy(buf, "0.000 B/s"); else if (bw < 1.0) - HDsnprintf(buf, bufsize, "%10.4e", bw); + snprintf(buf, bufsize, "%10.4e", bw); else if (bw < (double)H5_KB) { - HDsnprintf(buf, bufsize, "%05.4f", bw); - HDstrcpy(buf + 5, " B/s"); + snprintf(buf, bufsize, "%05.4f", bw); + strcpy(buf + 5, " B/s"); } else if (bw < (double)H5_MB) { - HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_KB); - HDstrcpy(buf + 5, " kB/s"); + snprintf(buf, bufsize, "%05.4f", bw / (double)H5_KB); + strcpy(buf + 5, " kB/s"); } else if (bw < (double)H5_GB) { - HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_MB); - HDstrcpy(buf + 5, " MB/s"); + snprintf(buf, bufsize, "%05.4f", bw / (double)H5_MB); + strcpy(buf + 5, " MB/s"); } else if (bw < (double)H5_TB) { - HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_GB); - HDstrcpy(buf + 5, " GB/s"); + snprintf(buf, bufsize, "%05.4f", bw / (double)H5_GB); + strcpy(buf + 5, " GB/s"); } else if (bw < (double)H5_PB) { - HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_TB); - HDstrcpy(buf + 5, " TB/s"); + snprintf(buf, bufsize, "%05.4f", bw / (double)H5_TB); + strcpy(buf + 5, " TB/s"); } else if (bw < (double)H5_EB) { - HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_PB); - HDstrcpy(buf + 5, " PB/s"); + snprintf(buf, bufsize, "%05.4f", bw / (double)H5_PB); + strcpy(buf + 5, " PB/s"); } else { - HDsnprintf(buf, bufsize, "%10.4e", bw); - if (HDstrlen(buf) > 10) - HDsnprintf(buf, bufsize, "%10.3e", bw); + snprintf(buf, bufsize, "%10.4e", bw); + if (strlen(buf) > 10) + snprintf(buf, bufsize, "%10.3e", bw); } /* end else-if */ } /* end else */ } /* end H5_bandwidth() */ @@ -592,31 +592,30 @@ H5_timer_get_time_string(double seconds) * (name? round_up_size? ?) */ if (seconds < 0.0) - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "N/A"); + snprintf(s, H5TIMER_TIME_STRING_LEN, "N/A"); else if (H5_DBL_ABS_EQUAL(0.0, seconds)) - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "0.0 s"); + snprintf(s, H5TIMER_TIME_STRING_LEN, "0.0 s"); else if (seconds < 1.0E-6) /* t < 1 us, Print time in ns */ - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.f ns", seconds * 1.0E9); + snprintf(s, H5TIMER_TIME_STRING_LEN, "%.f ns", seconds * 1.0E9); else if (seconds < 1.0E-3) /* t < 1 ms, Print time in us */ - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.1f us", seconds * 1.0E6); + snprintf(s, H5TIMER_TIME_STRING_LEN, "%.1f us", seconds * 1.0E6); else if (seconds < 1.0) /* t < 1 s, Print time in ms */ - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.1f ms", seconds * 1.0E3); + snprintf(s, H5TIMER_TIME_STRING_LEN, "%.1f ms", seconds * 1.0E3); else if (seconds < H5_SEC_PER_MIN) /* t < 1 m, Print time in s */ - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.2f s", seconds); + snprintf(s, H5TIMER_TIME_STRING_LEN, "%.2f s", seconds); else if (seconds < H5_SEC_PER_HOUR) /* t < 1 h, Print time in m and s */ - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.f m %.f s", minutes, remainder_sec); + snprintf(s, H5TIMER_TIME_STRING_LEN, "%.f m %.f s", minutes, remainder_sec); else if (seconds < H5_SEC_PER_DAY) /* t < 1 d, Print time in h, m and s */ - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.f h %.f m %.f s", hours, minutes, remainder_sec); + snprintf(s, H5TIMER_TIME_STRING_LEN, "%.f h %.f m %.f s", hours, minutes, remainder_sec); else /* Print time in d, h, m and s */ - HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.f d %.f h %.f m %.f s", days, hours, minutes, - remainder_sec); + snprintf(s, H5TIMER_TIME_STRING_LEN, "%.f d %.f h %.f m %.f s", days, hours, minutes, remainder_sec); return s; } /* end H5_timer_get_time_string() */ diff --git a/src/H5trace.c b/src/H5trace.c index fa81fb8..7657356 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -250,7 +250,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) type = rest + 1; } else { - rest = (char *)HDstrchr(type, ']'); + rest = (char *)strchr(type, ']'); assert(rest); type = rest + 1; asize_idx = -1; @@ -4025,8 +4025,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5_timer_get_times(function_timer, &function_times); H5_timer_get_times(running_timer, &running_times); - HDsnprintf(tmp, sizeof(tmp), "%.6f", (function_times.elapsed - running_times.elapsed)); - H5RS_asprintf_cat(rs, " %*s ", (int)HDstrlen(tmp), ""); + snprintf(tmp, sizeof(tmp), "%.6f", (function_times.elapsed - running_times.elapsed)); + H5RS_asprintf_cat(rs, " %*s ", (int)strlen(tmp), ""); } for (i = 0; i < current_depth; i++) H5RS_aputc(rs, '+'); @@ -4069,7 +4069,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) last_call_depth = current_depth++; H5RS_acat(rs, ")"); } - HDfputs(H5RS_get_str(rs), out); + fputs(H5RS_get_str(rs), out); fflush(out); H5RS_decr(rs); |