diff options
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 86 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 14 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 20 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 12 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 98 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 82 | ||||
-rw-r--r-- | tools/lib/h5tools_error.h | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.c | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 48 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 58 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 42 |
13 files changed, 236 insertions, 236 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index b607197..924f9f3 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -183,7 +183,7 @@ is_exclude_path(char *path, h5trav_type_t type, diff_opt_t *opts) while (NULL != exclude_path_ptr) { /* if exclude path is in group, exclude its members as well */ if (exclude_path_ptr->obj_type == H5TRAV_TYPE_GROUP) { - ret_cmp = HDstrncmp(exclude_path_ptr->obj_path, path, HDstrlen(exclude_path_ptr->obj_path)); + ret_cmp = strncmp(exclude_path_ptr->obj_path, path, strlen(exclude_path_ptr->obj_path)); if (ret_cmp == 0) { /* found matching members */ size_t len_grp; @@ -192,7 +192,7 @@ is_exclude_path(char *path, h5trav_type_t type, diff_opt_t *opts) * This verifies if “/grp1/dset1” is only under “/grp1”, but * not under “/grp1xxx/” group. */ - len_grp = HDstrlen(exclude_path_ptr->obj_path); + len_grp = strlen(exclude_path_ptr->obj_path); if (path[len_grp] == '/') { /* belong to excluded group! */ ret_value = 1; @@ -202,7 +202,7 @@ is_exclude_path(char *path, h5trav_type_t type, diff_opt_t *opts) } /* exclude target is not group, just exclude the object */ else { - ret_cmp = HDstrcmp(exclude_path_ptr->obj_path, path); + ret_cmp = strcmp(exclude_path_ptr->obj_path, path); if (ret_cmp == 0) { /* found matching object */ /* excluded non-group object */ ret_value = 1; @@ -247,7 +247,7 @@ is_exclude_attr(const char *path, h5trav_type_t type, diff_opt_t *opts) while (NULL != exclude_ptr) { /* if exclude path is in group, exclude its members as well */ if (exclude_ptr->obj_type == H5TRAV_TYPE_GROUP) { - ret_cmp = HDstrncmp(exclude_ptr->obj_path, path, HDstrlen(exclude_ptr->obj_path)); + ret_cmp = strncmp(exclude_ptr->obj_path, path, strlen(exclude_ptr->obj_path)); if (ret_cmp == 0) { /* found matching members */ size_t len_grp; @@ -256,7 +256,7 @@ is_exclude_attr(const char *path, h5trav_type_t type, diff_opt_t *opts) * This verifies if “/grp1/dset1” is only under “/grp1”, but * not under “/grp1xxx/” group. */ - len_grp = HDstrlen(exclude_ptr->obj_path); + len_grp = strlen(exclude_ptr->obj_path); if (path[len_grp] == '/') { /* belong to excluded group! */ ret_value = 1; @@ -266,7 +266,7 @@ is_exclude_attr(const char *path, h5trav_type_t type, diff_opt_t *opts) } /* exclude target is not group, just exclude the object */ else { - ret_cmp = HDstrcmp(exclude_ptr->obj_path, path); + ret_cmp = strcmp(exclude_ptr->obj_path, path); if (ret_cmp == 0) { /* found matching object */ /* excluded non-group object */ ret_value = 1; @@ -368,11 +368,11 @@ build_match_list(const char *objname1, trav_info_t *info1, const char *objname2, H5TOOLS_DEBUG("objname1 = %s objname2 = %s ", objname1, objname2); /* if obj1 is not root */ - if (HDstrcmp(objname1, "/") != 0) - path1_offset = HDstrlen(objname1); + if (strcmp(objname1, "/") != 0) + path1_offset = strlen(objname1); /* if obj2 is not root */ - if (HDstrcmp(objname2, "/") != 0) - path2_offset = HDstrlen(objname2); + if (strcmp(objname2, "/") != 0) + path2_offset = strlen(objname2); /*-------------------------------------------------- * build the list @@ -384,7 +384,7 @@ build_match_list(const char *objname1, trav_info_t *info1, const char *objname2, type2_l = info2->paths[curr2].type; /* criteria is string compare */ - cmp = HDstrcmp(path1_lp, path2_lp); + cmp = strcmp(path1_lp, path2_lp); if (cmp == 0) { if (!is_exclude_path(path1_lp, type1_l, opts)) { infile[0] = 1; @@ -703,47 +703,47 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char /* if any object is specified */ if (objname1) { /* make the given object1 fullpath, start with "/" */ - if (HDstrncmp(objname1, "/", 1) != 0) { + if (strncmp(objname1, "/", 1) != 0) { #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if (asprintf(&obj1fullname, "/%s", objname1) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed"); #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ - if ((obj1fullname = (char *)malloc(HDstrlen(objname1) + 2)) == NULL) + if ((obj1fullname = (char *)malloc(strlen(objname1) + 2)) == NULL) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed"); - HDstrcpy(obj1fullname, "/"); - HDstrcat(obj1fullname, objname1); + strcpy(obj1fullname, "/"); + strcat(obj1fullname, objname1); #endif /* H5_HAVE_ASPRINTF */ } else - obj1fullname = HDstrdup(objname1); + obj1fullname = strdup(objname1); H5TOOLS_DEBUG("obj1fullname = %s", obj1fullname); /* make the given object2 fullpath, start with "/" */ - if (HDstrncmp(objname2, "/", 1) != 0) { + if (strncmp(objname2, "/", 1) != 0) { #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if (asprintf(&obj2fullname, "/%s", objname2) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed"); #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ - if ((obj2fullname = (char *)malloc(HDstrlen(objname2) + 2)) == NULL) + if ((obj2fullname = (char *)malloc(strlen(objname2) + 2)) == NULL) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed"); - HDstrcpy(obj2fullname, "/"); - HDstrcat(obj2fullname, objname2); + strcpy(obj2fullname, "/"); + strcat(obj2fullname, objname2); #endif /* H5_HAVE_ASPRINTF */ } else - obj2fullname = HDstrdup(objname2); + obj2fullname = strdup(objname2); H5TOOLS_DEBUG("obj2fullname = %s", obj2fullname); /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink */ H5TOOLS_DEBUG("h5diff check if obj1=%s is root, group, single object or symlink", obj1fullname); - if (!HDstrcmp(obj1fullname, "/")) { + if (!strcmp(obj1fullname, "/")) { obj1type = H5TRAV_TYPE_GROUP; } else { @@ -793,7 +793,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char * check if obj2 is root, group, single object or symlink */ H5TOOLS_DEBUG("h5diff check if obj2=%s is root, group, single object or symlink", obj2fullname); - if (!HDstrcmp(obj2fullname, "/")) { + if (!strcmp(obj2fullname, "/")) { obj2type = H5TRAV_TYPE_GROUP; } else { @@ -843,9 +843,9 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char else { H5TOOLS_DEBUG("h5diff no object specified"); /* set root group */ - obj1fullname = (char *)HDstrdup("/"); + obj1fullname = (char *)strdup("/"); obj1type = H5TRAV_TYPE_GROUP; - obj2fullname = (char *)HDstrdup("/"); + obj2fullname = (char *)strdup("/"); obj2type = H5TRAV_TYPE_GROUP; } @@ -996,13 +996,13 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char if (g_Parallel) { int i; - if ((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) { + if ((strlen(fname1) > MAX_FILENAME) || (strlen(fname2) > MAX_FILENAME)) { fprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME); MPI_Abort(MPI_COMM_WORLD, 0); } /* end if */ - HDstrcpy(filenames[0], fname1); - HDstrcpy(filenames[1], fname2); + strcpy(filenames[0], fname1); + strcpy(filenames[1], fname2); /* Alert the worker tasks that there's going to be work. */ for (i = 1; i < g_nTasks; i++) @@ -1028,7 +1028,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char parallel_print("\n"); /* if given objects is group under root */ - if (HDstrcmp(obj1fullname, "/") != 0 || HDstrcmp(obj2fullname, "/") != 0) + if (strcmp(obj1fullname, "/") != 0 || strcmp(obj2fullname, "/") != 0) parallel_print("group1 group2\n"); else parallel_print("file1 file2\n"); @@ -1126,9 +1126,9 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, * if not root, prepare object name to be pre-appended to group path to * make full path */ - if (HDstrcmp(grp1, "/") != 0) + if (strcmp(grp1, "/") != 0) grp1_path = grp1; - if (HDstrcmp(grp2, "/") != 0) + if (strcmp(grp2, "/") != 0) grp2_path = grp2; /*------------------------------------------------------------------------- @@ -1186,13 +1186,13 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed"); } #else /* H5_HAVE_ASPRINTF */ - if ((obj1_fullpath = (char *)malloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) == + if ((obj1_fullpath = (char *)malloc(strlen(grp1_path) + strlen(table->objs[i].name) + 1)) == NULL) { H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed"); } else { - HDstrcpy(obj1_fullpath, grp1_path); - HDstrcat(obj1_fullpath, table->objs[i].name); + strcpy(obj1_fullpath, grp1_path); + strcat(obj1_fullpath, table->objs[i].name); } #endif /* H5_HAVE_ASPRINTF */ H5TOOLS_DEBUG("diff_match path1 - %s", obj1_fullpath); @@ -1204,22 +1204,22 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed"); } #else /* H5_HAVE_ASPRINTF */ - if ((obj2_fullpath = (char *)malloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) == + if ((obj2_fullpath = (char *)malloc(strlen(grp2_path) + strlen(table->objs[i].name) + 1)) == NULL) { H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed"); } else { - HDstrcpy(obj2_fullpath, grp2_path); - HDstrcat(obj2_fullpath, table->objs[i].name); + strcpy(obj2_fullpath, grp2_path); + strcat(obj2_fullpath, table->objs[i].name); } #endif /* H5_HAVE_ASPRINTF */ H5TOOLS_DEBUG("diff_match path2 - %s", obj2_fullpath); /* get index to figure out type of the object in file1 */ - while (info1->paths[idx1].path && (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0)) + while (info1->paths[idx1].path && (strcmp(obj1_fullpath, info1->paths[idx1].path) != 0)) idx1++; /* get index to figure out type of the object in file2 */ - while (info2->paths[idx2].path && (HDstrcmp(obj2_fullpath, info2->paths[idx2].path) != 0)) + while (info2->paths[idx2].path && (strcmp(obj2_fullpath, info2->paths[idx2].path) != 0)) idx2++; /* Set argdata to pass other args into diff() */ @@ -1246,14 +1246,14 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, */ /*Set up args to pass to worker task. */ - if (HDstrlen(obj1_fullpath) > 255 || HDstrlen(obj2_fullpath) > 255) { + if (strlen(obj1_fullpath) > 255 || strlen(obj2_fullpath) > 255) { printf("The parallel diff only supports object names up to 255 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); } /* end if */ /* set args struct to pass */ - HDstrcpy(args.name1, obj1_fullpath); - HDstrcpy(args.name2, obj2_fullpath); + strcpy(args.name1, obj1_fullpath); + strcpy(args.name2, obj2_fullpath); args.opts = *opts; args.argdata.type[0] = info1->paths[idx1].type; args.argdata.type[1] = info2->paths[idx2].type; @@ -1810,7 +1810,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ */ case H5TRAV_TYPE_LINK: { H5TOOLS_DEBUG("H5TRAV_TYPE_LINK 1:%s 2:%s ", path1, path2); - status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path); + status = strcmp(linkinfo1.trg_path, linkinfo2.trg_path); /* if the target link name is not same then the links are "different" */ nfound = (status != 0) ? 1 : 0; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index dd76983..d8c9ac6 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -519,14 +519,14 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co /* Get pointer to first string */ s1 = *(char **)((void *)mem1); if (s1) - size1 = HDstrlen(s1); + size1 = strlen(s1); else size1 = 0; /* Get pointer to second string */ s2 = *(char **)((void *)mem2); if (s2) - size2 = HDstrlen(s2); + size2 = strlen(s2); else size2 = 0; } @@ -535,7 +535,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co /* Get pointer to first string */ s1 = (char *)mem1; if (s1) - size1 = HDstrlen(s1); + size1 = strlen(s1); else size1 = 0; @@ -545,7 +545,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co /* Get pointer to second string */ s2 = (char *)mem2; if (s2) - size2 = HDstrlen(s2); + size2 = strlen(s2); else size2 = 0; @@ -648,11 +648,11 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co */ err1 = H5Tenum_nameof(opts->m_tid, mem1, enum_name1, sizeof enum_name1); if (err1 < 0) - HDsnprintf(enum_name1, sizeof(enum_name1), "**INVALID VALUE**"); + snprintf(enum_name1, sizeof(enum_name1), "**INVALID VALUE**"); err2 = H5Tenum_nameof(opts->m_tid, mem2, enum_name2, sizeof enum_name2); if (err2 < 0) - HDsnprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**"); + snprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**"); /* One or more bad enum values */ if (err1 < 0 || err2 < 0) { @@ -669,7 +669,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co } else { /* Both enum values were valid */ - if (HDstrcmp(enum_name1, enum_name2) != 0) { + if (strcmp(enum_name1, enum_name2) != 0) { nfound = 1; opts->print_percentage = 0; print_pos(opts, elemtno, 0); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 12abd28..2521177 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -112,7 +112,7 @@ table_attr_mark_exist(const unsigned *exist, char *name, table_attrs_t *table) table->attrs[curr_val].exist[0] = exist[0]; table->attrs[curr_val].exist[1] = exist[1]; if (name) - table->attrs[curr_val].name = (char *)HDstrdup(name); + table->attrs[curr_val].name = (char *)strdup(name); table->nattrs++; } } @@ -186,7 +186,7 @@ build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t **table_out, H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); /* criteria is string compare */ - cmp = HDstrcmp(name1, name2); + cmp = strcmp(name1, name2); if (cmp == 0) { infile[0] = 1; @@ -384,19 +384,19 @@ diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *na H5TOOLS_DEBUG("attr_names: %s - %s", name1, name2); if (name1) { - sz = HDstrlen(name1); + sz = strlen(name1); H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz); if (sz > 0) { opts->obj_name[0] = (char *)malloc(sz + 1); - HDstrncpy(opts->obj_name[0], name1, sz + 1); + strncpy(opts->obj_name[0], name1, sz + 1); } } if (name2) { - sz = HDstrlen(name2); + sz = strlen(name2); H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz); if (sz > 0) { opts->obj_name[1] = (char *)malloc(sz + 1); - HDstrncpy(opts->obj_name[1], name2, sz + 1); + strncpy(opts->obj_name[1], name2, sz + 1); } } H5TOOLS_DEBUG("attr_names: %s - %s", opts->obj_name[0], opts->obj_name[1]); @@ -464,17 +464,17 @@ diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *na H5TOOLS_DEBUG("attr_names: %s - %s : %s - %s", name1, name2, path1, path2); if (name1) { - sz = HDstrlen(name1) + HDstrlen(path1) + 7; + sz = strlen(name1) + strlen(path1) + 7; H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz); opts->obj_name[0] = (char *)calloc(sz + 1, sizeof(char)); - HDsnprintf(opts->obj_name[0], sz, "%s of <%s>", name1, path1); + snprintf(opts->obj_name[0], sz, "%s of <%s>", name1, path1); opts->obj_name[0][sz] = '\0'; } if (name2) { - sz = HDstrlen(name2) + HDstrlen(path2) + 7; + sz = strlen(name2) + strlen(path2) + 7; H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz); opts->obj_name[1] = (char *)calloc(sz + 1, sizeof(char)); - HDsnprintf(opts->obj_name[1], sz, "%s of <%s>", name2, path2); + snprintf(opts->obj_name[1], sz, "%s of <%s>", name2, path2); opts->obj_name[1][sz] = '\0'; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 8ab9db1..3d4b25a 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -274,21 +274,21 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name); opts->obj_name[0] = NULL; if (obj1_name) { - j = (int)HDstrlen(obj1_name); + j = (int)strlen(obj1_name); H5TOOLS_DEBUG("obj1_name: %s - %d", obj1_name, j); if (j > 0) { opts->obj_name[0] = (char *)malloc((size_t)j + 1); - HDstrncpy(opts->obj_name[0], obj1_name, (size_t)j + 1); + strncpy(opts->obj_name[0], obj1_name, (size_t)j + 1); } } opts->obj_name[1] = NULL; if (obj2_name) { - j = (int)HDstrlen(obj2_name); + j = (int)strlen(obj2_name); H5TOOLS_DEBUG("obj2_name: %s - %d", obj2_name, j); if (j > 0) { opts->obj_name[1] = (char *)malloc((size_t)j + 1); - HDstrncpy(opts->obj_name[1], obj2_name, (size_t)j + 1); + strncpy(opts->obj_name[1], obj2_name, (size_t)j + 1); } } @@ -431,9 +431,9 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n opts->obj_name[1] = NULL; if (obj1_name) - opts->obj_name[0] = HDstrdup(diff_basename(obj1_name)); + opts->obj_name[0] = strdup(diff_basename(obj1_name)); if (obj2_name) - opts->obj_name[1] = HDstrdup(diff_basename(obj2_name)); + opts->obj_name[1] = strdup(diff_basename(obj2_name)); H5TOOLS_DEBUG("obj_names: %s - %s", opts->obj_name[0], opts->obj_name[1]); H5TOOLS_DEBUG("read/compare"); diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index fc74a39..4641c93 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -190,7 +190,7 @@ diff_basename(const char *name) return NULL; /* Find the end of the base name */ - i = HDstrlen(name); + i = strlen(name); while (i > 0 && '/' == name[i - 1]) --i; diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index c3bfbd6..36e304d 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -246,7 +246,7 @@ h5tools_set_data_output_file(const char *fname, int is_bin) if (rawdatastream && rawdatastream != stdout) { if (fclose(rawdatastream)) - HDperror("closing rawdatastream"); + perror("closing rawdatastream"); else rawdatastream = NULL; } @@ -294,7 +294,7 @@ h5tools_set_attr_output_file(const char *fname, int is_bin) if (rawattrstream && rawattrstream != stdout) { if (fclose(rawattrstream)) - HDperror("closing rawattrstream"); + perror("closing rawattrstream"); else rawattrstream = NULL; } @@ -343,7 +343,7 @@ h5tools_set_input_file(const char *fname, int is_bin) if (rawinstream && rawinstream != stdin) { if (fclose(rawinstream)) - HDperror("closing rawinstream"); + perror("closing rawinstream"); else rawinstream = NULL; } @@ -391,7 +391,7 @@ h5tools_set_output_file(const char *fname, int is_bin) if (rawoutstream && rawoutstream != stdout) { if (fclose(rawoutstream)) - HDperror("closing rawoutstream"); + perror("closing rawoutstream"); else rawoutstream = NULL; } @@ -438,7 +438,7 @@ h5tools_set_error_file(const char *fname, int is_bin) if (rawerrorstream && rawerrorstream != stderr) { if (fclose(rawerrorstream)) - HDperror("closing rawerrorstream"); + perror("closing rawerrorstream"); else rawerrorstream = NULL; } @@ -485,12 +485,12 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) switch (vfd_info->type) { case VFD_BY_NAME: /* Determine which driver the user wants to open the file with */ - if (!HDstrcmp(vfd_info->u.name, drivernames[SEC2_VFD_IDX])) { + if (!strcmp(vfd_info->u.name, drivernames[SEC2_VFD_IDX])) { /* SEC2 Driver */ if (H5Pset_fapl_sec2(fapl_id) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_sec2 failed"); } - else if (!HDstrcmp(vfd_info->u.name, drivernames[DIRECT_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[DIRECT_VFD_IDX])) { #ifdef H5_HAVE_DIRECT /* Direct Driver */ if (H5Pset_fapl_direct(fapl_id, 1024, 4096, 8 * 4096) < 0) @@ -499,14 +499,14 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) H5TOOLS_GOTO_ERROR(FAIL, "Direct VFD is not enabled"); #endif } - else if (!HDstrcmp(vfd_info->u.name, drivernames[LOG_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[LOG_VFD_IDX])) { unsigned long long log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; /* Log Driver */ if (H5Pset_fapl_log(fapl_id, NULL, log_flags, (size_t)0) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_log failed"); } - else if (!HDstrcmp(vfd_info->u.name, drivernames[WINDOWS_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[WINDOWS_VFD_IDX])) { #ifdef H5_HAVE_WINDOWS /* There is no Windows VFD - use SEC2 */ if (H5Pset_fapl_sec2(fapl_id) < 0) @@ -515,17 +515,17 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) H5TOOLS_GOTO_ERROR(FAIL, "Windows VFD is not enabled"); #endif } - else if (!HDstrcmp(vfd_info->u.name, drivernames[STDIO_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[STDIO_VFD_IDX])) { /* Stdio Driver */ if (H5Pset_fapl_stdio(fapl_id) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_stdio failed"); } - else if (!HDstrcmp(vfd_info->u.name, drivernames[CORE_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[CORE_VFD_IDX])) { /* Core Driver */ if (H5Pset_fapl_core(fapl_id, (size_t)H5_MB, true) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_core failed"); } - else if (!HDstrcmp(vfd_info->u.name, drivernames[FAMILY_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[FAMILY_VFD_IDX])) { /* FAMILY Driver */ /* Set member size to be 0 to indicate the current first member size * is the member size. @@ -533,17 +533,17 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) if (H5Pset_fapl_family(fapl_id, (hsize_t)0, H5P_DEFAULT) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_family failed"); } - else if (!HDstrcmp(vfd_info->u.name, drivernames[SPLIT_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[SPLIT_VFD_IDX])) { /* SPLIT Driver */ if (H5Pset_fapl_split(fapl_id, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_split failed"); } - else if (!HDstrcmp(vfd_info->u.name, drivernames[MULTI_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[MULTI_VFD_IDX])) { /* MULTI Driver */ if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, true) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_multi failed"); } - else if (!HDstrcmp(vfd_info->u.name, drivernames[MPIO_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[MPIO_VFD_IDX])) { #ifdef H5_HAVE_PARALLEL int mpi_initialized, mpi_finalized; @@ -561,7 +561,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) H5TOOLS_GOTO_ERROR(FAIL, "MPI-I/O VFD is not enabled"); #endif /* H5_HAVE_PARALLEL */ } - else if (!HDstrcmp(vfd_info->u.name, drivernames[ROS3_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[ROS3_VFD_IDX])) { #ifdef H5_HAVE_ROS3_VFD if (!vfd_info->info) H5TOOLS_GOTO_ERROR(FAIL, "Read-only S3 VFD info is invalid"); @@ -575,7 +575,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) H5TOOLS_GOTO_ERROR(FAIL, "Read-only S3 VFD is not enabled"); #endif } - else if (!HDstrcmp(vfd_info->u.name, drivernames[HDFS_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[HDFS_VFD_IDX])) { #ifdef H5_HAVE_LIBHDFS if (!vfd_info->info) H5TOOLS_GOTO_ERROR(FAIL, "HDFS VFD info is invalid"); @@ -585,7 +585,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) H5TOOLS_GOTO_ERROR(FAIL, "The HDFS VFD is not enabled"); #endif } - else if (!HDstrcmp(vfd_info->u.name, drivernames[SUBFILING_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[SUBFILING_VFD_IDX])) { #if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD) int mpi_initialized, mpi_finalized; @@ -601,7 +601,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info) H5TOOLS_GOTO_ERROR(FAIL, "The Subfiling VFD is not enabled"); #endif } - else if (!HDstrcmp(vfd_info->u.name, drivernames[ONION_VFD_IDX])) { + else if (!strcmp(vfd_info->u.name, drivernames[ONION_VFD_IDX])) { /* Onion driver */ if (!vfd_info->info) H5TOOLS_GOTO_ERROR(FAIL, "Onion VFD info is invalid"); @@ -676,10 +676,10 @@ h5tools_set_fapl_vol(hid_t fapl_id, h5tools_vol_info_t *vol_info) /* Check for VOL connectors that ship with the library, then try * registering by name if that fails. */ - if (!HDstrcmp(vol_info->u.name, H5VL_NATIVE_NAME)) { + if (!strcmp(vol_info->u.name, H5VL_NATIVE_NAME)) { connector_id = H5VL_NATIVE; } - else if (!HDstrcmp(vol_info->u.name, H5VL_PASSTHRU_NAME)) { + else if (!strcmp(vol_info->u.name, H5VL_PASSTHRU_NAME)) { connector_id = H5VL_PASSTHRU; } else { @@ -895,7 +895,7 @@ h5tools_get_vfd_name(hid_t fid, hid_t fapl_id, char *drivername, size_t driverna else driver_name = "unknown"; - HDstrncpy(drivername, driver_name, drivername_size); + strncpy(drivername, driver_name, drivername_size); drivername[drivername_size - 1] = '\0'; } @@ -1241,7 +1241,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context ctx->cur_column, info->idx_fmt, info->line_suf); if (ctx->cur_column) { PUTSTREAM(OPT(info->line_suf, ""), stream); - HDputc('\n', stream); + putc('\n', stream); PUTSTREAM(OPT(info->line_sep, ""), stream); } H5TOOLS_DEBUG("after CR elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); @@ -1334,7 +1334,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_ /* Terminate previous line, if any */ if (ctx->cur_column) { PUTSTREAM(OPT(info->line_suf, ""), stream); - HDputc('\n', stream); + putc('\n', stream); PUTSTREAM(OPT(info->line_sep, ""), stream); } @@ -1436,8 +1436,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex * current location... */ if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) + - HDstrlen(OPT(info->line_suf, ""))) > ncols) { + (ctx->cur_column + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* * ... and the previous element also occupied more than one @@ -1445,8 +1445,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex */ ctx->need_prefix = true; } - else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) + - HDstrlen(OPT(info->line_suf, ""))) <= ncols) { + else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we * should end the current line and start this element on its @@ -1481,8 +1481,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex * beginning of the line. */ if (info->line_multi_new == 1 && ctx->prev_multiline && - (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) + - HDstrlen(OPT(info->line_suf, ""))) > ncols) + (ctx->cur_column + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = true; H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); @@ -1500,7 +1500,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex * one-at a time. */ multiline = 0; - for (secnum = 0, multiline = 0; (section = HDstrtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) { + for (secnum = 0, multiline = 0; (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) { /* * If the current section plus possible suffix and end-of-line * information would cause the output to wrap then we need to @@ -1510,8 +1510,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex /* * check for displaying prefix for each section */ - if ((ctx->cur_column + HDstrlen(section) + HDstrlen(OPT(info->elmt_suf2, " ")) + - HDstrlen(OPT(info->line_suf, ""))) > ncols) + if ((ctx->cur_column + strlen(section) + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; /* @@ -1535,13 +1535,13 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex } else if ((local_elmt_counter || ctx->continuation) && secnum == 0) { PUTSTREAM(OPT(info->elmt_suf2, " "), stream); - ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); + ctx->cur_column += strlen(OPT(info->elmt_suf2, " ")); } H5TOOLS_DEBUG("section=%s", section); /* Print the section */ PUTSTREAM(section, stream); - ctx->cur_column += HDstrlen(section); + ctx->cur_column += strlen(section); } ctx->prev_multiline = multiline; @@ -1597,8 +1597,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools * current location... */ if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) + - HDstrlen(OPT(info->line_suf, ""))) > ncols) { + (ctx->cur_column + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* * ... and the previous element also occupied more than one @@ -1606,8 +1606,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools */ ctx->need_prefix = true; } - else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) + - HDstrlen(OPT(info->line_suf, ""))) <= ncols) { + else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we * should end the current line and start this element on its @@ -1638,8 +1638,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools * beginning of the line. */ if (info->line_multi_new == 1 && ctx->prev_multiline && - (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) + - HDstrlen(OPT(info->line_suf, ""))) > ncols) + (ctx->cur_column + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = true; /* @@ -1655,7 +1655,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools * one-at a time. */ multiline = 0; - for (secnum = 0, multiline = 0; (section = HDstrtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) { + for (secnum = 0, multiline = 0; (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) { /* * If the current section plus possible suffix and end-of-line * information would cause the output to wrap then we need to @@ -1667,8 +1667,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools * this check to happen for the first line */ if ((!info->skip_first || local_elmt_counter) && - (ctx->cur_column + HDstrlen(section) + HDstrlen(OPT(info->elmt_suf2, " ")) + - HDstrlen(OPT(info->line_suf, ""))) > ncols) + (ctx->cur_column + strlen(section) + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; /* @@ -1690,12 +1690,12 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools } else if ((local_elmt_counter || ctx->continuation) && secnum == 0) { PUTSTREAM(OPT(info->elmt_suf2, " "), stream); - ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); + ctx->cur_column += strlen(OPT(info->elmt_suf2, " ")); } /* Print the section */ PUTSTREAM(section, stream); - ctx->cur_column += HDstrlen(section); + ctx->cur_column += strlen(section); } ctx->prev_multiline = multiline; @@ -1838,7 +1838,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (H5Tis_variable_str(tid)) { s = *(char **)((void *)mem); if (s != NULL) - size = HDstrlen(s); + size = strlen(s); else H5TOOLS_THROW((-1), "NULL string"); } @@ -2333,12 +2333,12 @@ h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char H5O_info2_t oinfo1, oinfo2; bool ret_val = false; - if (name1 && HDstrcmp(name1, ".") != 0) + if (name1 && strcmp(name1, ".") != 0) H5Oget_info_by_name3(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); else H5Oget_info3(loc_id1, &oinfo1, H5O_INFO_BASIC); - if (name2 && HDstrcmp(name2, ".") != 0) + if (name2 && strcmp(name2, ".") != 0) H5Oget_info_by_name3(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); else H5Oget_info3(loc_id2, &oinfo2, H5O_INFO_BASIC); diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 9126500..b636806 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -40,7 +40,7 @@ #define PUTSTREAM(X, S) \ do { \ if (S != NULL) \ - HDfputs(X, S); \ + fputs(X, S); \ } while (0) /* diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 7c221f5..efaddee 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -391,12 +391,12 @@ h5tools_dump_region_attribute(hid_t region_id, FILE *stream, const h5tool_format h5tools_print_datatype(stream, buffer, info, ctx, atype, true); ctx->indent_level--; - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + if (strlen(h5tools_dump_header_format->datatypeblockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) + if (strlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) + if (strlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); dimension_break = @@ -411,12 +411,12 @@ h5tools_dump_region_attribute(hid_t region_id, FILE *stream, const h5tool_format h5tools_print_dataspace(buffer, region_space); - if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + if (strlen(h5tools_dump_header_format->dataspaceblockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + if (strlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + if (strlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); dimension_break = @@ -765,12 +765,12 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *strea h5tools_print_datatype(stream, buffer, info, ctx, dtype, true); ctx->indent_level--; - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + if (strlen(h5tools_dump_header_format->datatypeblockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) + if (strlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) + if (strlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); dimension_break = @@ -785,12 +785,12 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *strea h5tools_print_dataspace(buffer, region_space); - if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + if (strlen(h5tools_dump_header_format->dataspaceblockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + if (strlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + if (strlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); dimension_break = @@ -828,13 +828,13 @@ done: /* Render the dataend element begin */ h5tools_str_reset(buffer); - if (HDstrlen(h5tools_dump_header_format->datablockend)) { + if (strlen(h5tools_dump_header_format->datablockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datablockend); - if (HDstrlen(h5tools_dump_header_format->dataend)) + if (strlen(h5tools_dump_header_format->dataend)) h5tools_str_append(buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->dataend)) + if (strlen(h5tools_dump_header_format->dataend)) h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataend); dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); @@ -1119,12 +1119,12 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *strea h5tools_print_datatype(stream, buffer, info, ctx, dtype, true); ctx->indent_level--; - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + if (strlen(h5tools_dump_header_format->datatypeblockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) + if (strlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) + if (strlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); dimension_break = @@ -1139,12 +1139,12 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *strea h5tools_print_dataspace(buffer, region_space); - if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + if (strlen(h5tools_dump_header_format->dataspaceblockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + if (strlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + if (strlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); dimension_break = @@ -1183,13 +1183,13 @@ done: /* Render the dataend element begin */ h5tools_str_reset(buffer); - if (HDstrlen(h5tools_dump_header_format->datablockend)) { + if (strlen(h5tools_dump_header_format->datablockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datablockend); - if (HDstrlen(h5tools_dump_header_format->dataend)) + if (strlen(h5tools_dump_header_format->dataend)) h5tools_str_append(buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->dataend)) + if (strlen(h5tools_dump_header_format->dataend)) h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataend); dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); @@ -2807,7 +2807,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i h5tools_str_reset(buffer); h5tools_str_append(buffer, "\"%s\"", name[i]); - nchars = (int)HDstrlen(name[i]); + nchars = (int)strlen(name[i]); h5tools_str_append(buffer, "%*s ", MAX(0, 16 - nchars), ""); if (native < 0) { @@ -2891,12 +2891,12 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, h5tools_context h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->datatypebegin, h5tools_dump_header_format->datatypeblockbegin); h5tools_print_datatype(stream, &buffer, info, ctx, type, true); - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + if (strlen(h5tools_dump_header_format->datatypeblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) + if (strlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(&buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) + if (strlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2938,12 +2938,12 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_contex h5tools_print_dataspace(&buffer, type); - if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + if (strlen(h5tools_dump_header_format->dataspaceblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + if (strlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(&buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + if (strlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceend); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -3154,7 +3154,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t * if (dcpl_id >= 0) nfilters = H5Pget_nfilters(dcpl_id); - HDstrcpy(f_name, "\0"); + strcpy(f_name, "\0"); /*------------------------------------------------------------------------- * STORAGE_LAYOUT @@ -3897,12 +3897,12 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_contex h5tools_str_reset(&buffer); - if (HDstrlen(h5tools_dump_header_format->attributeblockend)) { + if (strlen(h5tools_dump_header_format->attributeblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend); - if (HDstrlen(h5tools_dump_header_format->attributeend)) + if (strlen(h5tools_dump_header_format->attributeend)) h5tools_str_append(&buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->attributeend)) + if (strlen(h5tools_dump_header_format->attributeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -4478,13 +4478,13 @@ done: h5tools_simple_prefix(stream, &outputformat, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); - if (HDstrlen(h5tools_dump_header_format->datablockend)) { + if (strlen(h5tools_dump_header_format->datablockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datablockend); - if (HDstrlen(h5tools_dump_header_format->dataend)) + if (strlen(h5tools_dump_header_format->dataend)) h5tools_str_append(&buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->dataend)) + if (strlen(h5tools_dump_header_format->dataend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataend); h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -4496,12 +4496,12 @@ done: h5tools_simple_prefix(stream, &outputformat, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); - if (HDstrlen(h5tools_dump_header_format->subsettingblockend)) { + if (strlen(h5tools_dump_header_format->subsettingblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingblockend); - if (HDstrlen(h5tools_dump_header_format->subsettingend)) + if (strlen(h5tools_dump_header_format->subsettingend)) h5tools_str_append(&buffer, " "); } - if (HDstrlen(h5tools_dump_header_format->subsettingend)) + if (strlen(h5tools_dump_header_format->subsettingend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingend); h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index e085c72..b564511 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -36,7 +36,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; char lib_str[256]; \ \ /* Initialize library version string for error class */ \ - HDsnprintf(lib_str, sizeof(lib_str), "%d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); \ + snprintf(lib_str, sizeof(lib_str), "%d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); \ \ /* Create new HDF5 error stack for the tools to use */ \ if ((H5tools_ERR_STACK_g = H5Ecreate_stack()) < 0) \ diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 1f58d95..a1466bc 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -180,10 +180,10 @@ ref_path_table_lookup(const char *thepath, H5O_token_t *token) { H5O_info2_t oi; - if ((thepath == NULL) || (HDstrlen(thepath) == 0)) + if ((thepath == NULL) || (strlen(thepath) == 0)) return -1; /* Allow lookups on the root group, even though it doesn't have any link info */ - if (HDstrcmp(thepath, "/") != 0) { + if (strcmp(thepath, "/") != 0) { H5L_info2_t li; /* Check for external link first, so we don't return the OID of an object in another file */ @@ -231,7 +231,7 @@ ref_path_table_put(const char *path, const H5O_token_t *token) return (-1); memcpy(&new_node->obj_token, token, sizeof(H5O_token_t)); - new_node->path = HDstrdup(path); + new_node->path = strdup(path); return (H5SL_insert(ref_path_table, new_node, &(new_node->obj_token))); } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 507c6ef..5ef86fb 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -106,7 +106,7 @@ h5tools_str_append(h5tools_str_t *str /*in,out*/, const char *fmt, ...) if (!str->s || str->nalloc <= 0) h5tools_str_reset(str); - if (HDstrlen(fmt) == 0) + if (strlen(fmt) == 0) /* nothing to print */ return str->s; @@ -117,17 +117,17 @@ h5tools_str_append(h5tools_str_t *str /*in,out*/, const char *fmt, ...) size_t avail = str->nalloc - str->len; va_start(ap, fmt); - nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap); + nchars = vsnprintf(str->s + str->len, avail, fmt, ap); va_end(ap); - /* Note: HDvsnprintf() behaves differently on Windows as Unix, when + /* Note: vsnprintf() behaves differently on Windows as Unix, when * buffer is smaller than source string. On Unix, this function * returns length of the source string and copy string up to the * buffer size with NULL at the end of the buffer. However on * Windows with the same condition, this function returns -1 and * doesn't add NULL at the end of the buffer. * Because of this different return results, the strlen of the new string - * is used to handle when HDvsnprintf() returns -1 on Windows due + * is used to handle when vsnprintf() returns -1 on Windows due * to lack of buffer size, so try one more time after realloc more * buffer size before return NULL. */ @@ -135,7 +135,7 @@ h5tools_str_append(h5tools_str_t *str /*in,out*/, const char *fmt, ...) /* failure, such as bad format */ return NULL; - if ((size_t)nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s") != 0))) { + if ((size_t)nchars >= avail || (0 == nchars && (strcmp(fmt, "%s") != 0))) { /* Truncation return value as documented by C99, or zero return value with either of the * following conditions, each of which indicates that the proper C99 return value probably * should have been positive when the format string is @@ -230,14 +230,14 @@ h5tools_str_fmt(h5tools_str_t *str /*in,out*/, size_t start, const char *fmt) assert(fmt); /* If the format string is simply "%s" then don't bother doing anything */ - if (!HDstrcmp(fmt, "%s")) + if (!strcmp(fmt, "%s")) return str->s; /* * Save the input value if there is a `%' anywhere in FMT. Otherwise * don't bother because we don't need a temporary copy. */ - if (HDstrchr(fmt, '%')) { + if (strchr(fmt, '%')) { size_t n = sizeof(_temp); if (str->len - start + 1 > n) { n = str->len - start + 1; @@ -245,7 +245,7 @@ h5tools_str_fmt(h5tools_str_t *str /*in,out*/, size_t start, const char *fmt) assert(temp); } - HDstrncpy(temp, str->s + start, n - 1); + strncpy(temp, str->s + start, n - 1); temp[n - 1] = '\0'; } @@ -669,8 +669,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai H5TOOLS_START_DEBUG(" "); /* Build default formats for long long types */ if (!fmt_llong[0]) { - HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%lld"); - HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu"); + snprintf(fmt_llong, sizeof(fmt_llong), "%%lld"); + snprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu"); } /* Append value depending on data type */ @@ -741,10 +741,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai quote = '\0'; if (H5Tis_variable_str(type)) { /* cp_vp is the pointer into the struct where a `char*' is stored. So we have - * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ + * to dereference the pointer to get the `char*' to pass to strlen(). */ s = *(char **)((void *)cp_vp); if (s != NULL) - size = HDstrlen(s); + size = strlen(s); } else { s = cp_vp; @@ -1494,7 +1494,7 @@ h5tools_escape(char *s /*in,out*/, size_t size) size_t i; const char *escape; char octal[8]; - size_t n = HDstrlen(s); + size_t n = strlen(s); for (i = 0; i < n; i++) { switch (s[i]) { @@ -1533,7 +1533,7 @@ h5tools_escape(char *s /*in,out*/, size_t size) break; default: if (!isprint(s[i])) { - HDsnprintf(octal, sizeof(octal), "\\%03o", (unsigned char)s[i]); + snprintf(octal, sizeof(octal), "\\%03o", (unsigned char)s[i]); escape = octal; } else @@ -1543,7 +1543,7 @@ h5tools_escape(char *s /*in,out*/, size_t size) } if (escape) { - size_t esc_size = HDstrlen(escape); + size_t esc_size = strlen(escape); if (n + esc_size + 1 > size) /*would overflow*/ @@ -1601,26 +1601,26 @@ h5tools_str_replace(const char *string, const char *substr, const char *replacem char *head = NULL; if (substr == NULL || replacement == NULL) - return HDstrdup(string); - newstr = HDstrdup(string); + return strdup(string); + newstr = strdup(string); head = newstr; - while ((tok = HDstrstr(head, substr))) { + while ((tok = strstr(head, substr))) { char *oldstr; oldstr = newstr; - newstr = (char *)malloc(HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement) + 1); + newstr = (char *)malloc(strlen(oldstr) - strlen(substr) + strlen(replacement) + 1); if (newstr == NULL) { free(oldstr); return NULL; } memcpy(newstr, oldstr, (size_t)(tok - oldstr)); - memcpy(newstr + (tok - oldstr), replacement, HDstrlen(replacement)); - memcpy(newstr + (tok - oldstr) + HDstrlen(replacement), tok + HDstrlen(substr), - HDstrlen(oldstr) - HDstrlen(substr) - (size_t)(tok - oldstr)); - memset(newstr + HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement), 0, 1); + memcpy(newstr + (tok - oldstr), replacement, strlen(replacement)); + memcpy(newstr + (tok - oldstr) + strlen(replacement), tok + strlen(substr), + strlen(oldstr) - strlen(substr) - (size_t)(tok - oldstr)); + memset(newstr + strlen(oldstr) - strlen(substr) + strlen(replacement), 0, 1); /* move back head right after the last replacement */ - head = newstr + (tok - oldstr) + HDstrlen(replacement); + head = newstr + (tok - oldstr) + strlen(replacement); free(oldstr); } diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 663d355..5820610 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -68,10 +68,10 @@ parallel_print(const char *format, ...) va_start(ap, format); if (!g_Parallel) - HDvprintf(format, ap); + vprintf(format, ap); else { if (overflow_file == NULL) /*no overflow has occurred yet */ { - bytes_written = HDvsnprintf(outBuff + outBuffOffset, OUTBUFF_SIZE - outBuffOffset, format, ap); + bytes_written = vsnprintf(outBuff + outBuffOffset, OUTBUFF_SIZE - outBuffOffset, format, ap); va_end(ap); va_start(ap, format); @@ -84,13 +84,13 @@ parallel_print(const char *format, ...) fprintf(rawerrorstream, "warning: could not create overflow file. Output may be truncated.\n"); else - bytes_written = HDvfprintf(overflow_file, format, ap); + bytes_written = vfprintf(overflow_file, format, ap); } else outBuffOffset += (unsigned)bytes_written; } else - bytes_written = HDvfprintf(overflow_file, format, ap); + bytes_written = vfprintf(overflow_file, format, ap); } va_end(ap); } @@ -114,7 +114,7 @@ error_msg(const char *fmt, ...) FLUSHSTREAM(rawdatastream); FLUSHSTREAM(rawoutstream); fprintf(rawerrorstream, "%s error: ", h5tools_getprogname()); - HDvfprintf(rawerrorstream, fmt, ap); + vfprintf(rawerrorstream, fmt, ap); va_end(ap); } @@ -138,7 +138,7 @@ warn_msg(const char *fmt, ...) FLUSHSTREAM(rawdatastream); FLUSHSTREAM(rawoutstream); fprintf(rawerrorstream, "%s warning: ", h5tools_getprogname()); - HDvfprintf(rawerrorstream, fmt, ap); + vfprintf(rawerrorstream, fmt, ap); va_end(ap); } @@ -241,10 +241,10 @@ parse_subset_params(const char *dset) H5TOOLS_START_DEBUG(" - dset:%s", dset); /* if dset name is quoted wait till after second quote to look for subset brackets */ if (*dset == '"') - q_dset = HDstrchr(dset, '"'); + q_dset = strchr(dset, '"'); else q_dset = dset; - if ((brace = HDstrrchr(q_dset, '[')) != NULL) { + if ((brace = strrchr(q_dset, '[')) != NULL) { *brace++ = '\0'; s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); @@ -388,8 +388,8 @@ parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems, char * /* create destination string */ - start++; /* advance past opening paren '(' */ - cpy = (char *)malloc(sizeof(char) * (HDstrlen(start))); /* no +1; less '(' */ + start++; /* advance past opening paren '(' */ + cpy = (char *)malloc(sizeof(char) * (strlen(start))); /* no +1; less '(' */ if (cpy == NULL) { ret_value = FAIL; goto done; @@ -699,7 +699,7 @@ find_objs_cb(const char *name, const H5O_info2_t *oinfo, const char *already_see else { /* Use latest version of name */ free(found_obj->objname); - found_obj->objname = HDstrdup(name); + found_obj->objname = strdup(name); /* Mark named datatype as having valid name */ found_obj->recorded = true; @@ -785,7 +785,7 @@ add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, bool /* Set information about object */ memcpy(&table->objs[u].obj_token, obj_token, sizeof(H5O_token_t)); - table->objs[u].objname = HDstrdup(objname); + table->objs[u].objname = strdup(objname); table->objs[u].recorded = record; table->objs[u].displayed = 0; } @@ -843,7 +843,7 @@ H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t link_info->trg_type = H5O_TYPE_UNKNOWN; /* if path is root, return group type */ - if (!HDstrcmp(linkpath, "/")) { + if (!strcmp(linkpath, "/")) { link_info->trg_type = H5O_TYPE_GROUP; H5TOOLS_GOTO_DONE(2); } @@ -1188,50 +1188,50 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_ext_t *fa, const char **values) * fail if value would overflow */ if (*values[0] != '\0' && *values[1] != '\0') { - if (HDstrlen(values[0]) > H5FD_ROS3_MAX_REGION_LEN) { + if (strlen(values[0]) > H5FD_ROS3_MAX_REGION_LEN) { if (show_progress) { printf(" ERROR: aws_region value too long\n"); } ret_value = 0; goto done; } - memcpy(fa->fa.aws_region, values[0], (HDstrlen(values[0]) + 1)); + memcpy(fa->fa.aws_region, values[0], (strlen(values[0]) + 1)); if (show_progress) { printf(" aws_region set\n"); } - if (HDstrlen(values[1]) > H5FD_ROS3_MAX_SECRET_ID_LEN) { + if (strlen(values[1]) > H5FD_ROS3_MAX_SECRET_ID_LEN) { if (show_progress) { printf(" ERROR: secret_id value too long\n"); } ret_value = 0; goto done; } - memcpy(fa->fa.secret_id, values[1], (HDstrlen(values[1]) + 1)); + memcpy(fa->fa.secret_id, values[1], (strlen(values[1]) + 1)); if (show_progress) { printf(" secret_id set\n"); } - if (HDstrlen(values[2]) > H5FD_ROS3_MAX_SECRET_KEY_LEN) { + if (strlen(values[2]) > H5FD_ROS3_MAX_SECRET_KEY_LEN) { if (show_progress) { printf(" ERROR: secret_key value too long\n"); } ret_value = 0; goto done; } - memcpy(fa->fa.secret_key, values[2], (HDstrlen(values[2]) + 1)); + memcpy(fa->fa.secret_key, values[2], (strlen(values[2]) + 1)); if (show_progress) { printf(" secret_key set\n"); } - if (HDstrlen(values[3]) > H5FD_ROS3_MAX_SECRET_TOK_LEN) { + if (strlen(values[3]) > H5FD_ROS3_MAX_SECRET_TOK_LEN) { if (show_progress) { printf(" ERROR: token value too long\n"); } ret_value = 0; goto done; } - memcpy(fa->token, values[3], (HDstrlen(values[3]) + 1)); + memcpy(fa->token, values[3], (strlen(values[3]) + 1)); if (show_progress) { printf(" token set\n"); } @@ -1288,22 +1288,22 @@ h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int delim, H5FD_hdfs_fapl_t * WARNING: No error-checking is done on length of input strings... * Silent overflow is possible, albeit unlikely. */ - if (HDstrncmp(props[0], "", 1)) { - HDstrncpy(fapl_config_out->namenode_name, (const char *)props[0], HDstrlen(props[0])); + if (strncmp(props[0], "", 1)) { + strncpy(fapl_config_out->namenode_name, (const char *)props[0], strlen(props[0])); } - if (HDstrncmp(props[1], "", 1)) { + if (strncmp(props[1], "", 1)) { k = strtoul((const char *)props[1], NULL, 0); if (errno == ERANGE) H5TOOLS_GOTO_ERROR(FAIL, "supposed port number wasn't"); fapl_config_out->namenode_port = (int32_t)k; } - if (HDstrncmp(props[2], "", 1)) { - HDstrncpy(fapl_config_out->kerberos_ticket_cache, (const char *)props[2], HDstrlen(props[2])); + if (strncmp(props[2], "", 1)) { + strncpy(fapl_config_out->kerberos_ticket_cache, (const char *)props[2], strlen(props[2])); } - if (HDstrncmp(props[3], "", 1)) { - HDstrncpy(fapl_config_out->user_name, (const char *)props[3], HDstrlen(props[3])); + if (strncmp(props[3], "", 1)) { + strncpy(fapl_config_out->user_name, (const char *)props[3], strlen(props[3])); } - if (HDstrncmp(props[4], "", 1)) { + if (strncmp(props[4], "", 1)) { k = strtoul((const char *)props[4], NULL, 0); if (errno == ERANGE) H5TOOLS_GOTO_ERROR(FAIL, "supposed buffersize number wasn't"); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 438c705..017e062 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -126,7 +126,7 @@ trav_token_add(trav_addr_t *visited, H5O_token_t *token, const char *path) /* Append it */ idx = visited->nused++; memcpy(&visited->objs[idx].token, token, sizeof(H5O_token_t)); - visited->objs[idx].path = HDstrdup(path); + visited->objs[idx].path = strdup(path); } /* end trav_token_add() */ /*------------------------------------------------------------------------- @@ -172,17 +172,17 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info2_t *linfo, void *_uda /* Create the full path name for the link */ if (udata->is_absolute) { - size_t base_len = HDstrlen(udata->base_grp_name); + size_t base_len = strlen(udata->base_grp_name); size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1; - size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 + + size_t new_name_len = base_len + add_slash + strlen(path) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (new_name = (char *)malloc(new_name_len))) return (H5_ITER_ERROR); if (add_slash) - HDsnprintf(new_name, new_name_len, "%s/%s", udata->base_grp_name, path); + snprintf(new_name, new_name_len, "%s/%s", udata->base_grp_name, path); else - HDsnprintf(new_name, new_name_len, "%s%s", udata->base_grp_name, path); + snprintf(new_name, new_name_len, "%s%s", udata->base_grp_name, path); full_name = new_name; } /* end if */ else @@ -326,7 +326,7 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type) /* Append it */ idx = info->nused++; - info->paths[idx].path = HDstrdup(path); + info->paths[idx].path = strdup(path); info->paths[idx].type = obj_type; info->paths[idx].fileno = 0; @@ -349,7 +349,7 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id) H5O_info2_t oinfo; size_t idx = info->nused - 1; - if (info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".") != 0) + if (info->paths[idx].path && strcmp(info->paths[idx].path, ".") != 0) H5Oget_info_by_name3(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); else H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC); @@ -452,11 +452,11 @@ h5trav_getindex(const trav_info_t *info, const char *obj) /* Loop over all paths in 'info' struct, looking for object */ for (u = 0; u < info->nused; u++) { /* Check for object name having full path (with leading '/') */ - if (HDstrcmp(obj, info->paths[u].path) == 0) + if (strcmp(obj, info->paths[u].path) == 0) return ((ssize_t)u); /* Check for object name without leading '/' */ - if (HDstrcmp(obj, (info->paths[u].path + 1)) == 0) + if (strcmp(obj, (info->paths[u].path + 1)) == 0) return ((ssize_t)u); } /* end for */ @@ -611,11 +611,11 @@ h5trav_getindext(const char *name, const trav_table_t *table) if (table) { for (i = 0; i < table->nobjs; i++) { /* Check for object name having full path (with leading '/') */ - if (HDstrcmp(name, table->objs[i].name) == 0) + if (strcmp(name, table->objs[i].name) == 0) return ((int)i); /* Check for object name without leading '/' */ - if (HDstrcmp(name, table->objs[i].name + 1) == 0) + if (strcmp(name, table->objs[i].name + 1) == 0) return ((int)i); /* search also in the list of links */ @@ -624,11 +624,11 @@ h5trav_getindext(const char *name, const trav_table_t *table) for (j = 0; j < table->objs[i].nlinks; j++) { /* Check for object name having full path (with leading '/') */ - if (HDstrcmp(name, table->objs[i].links[j].new_name) == 0) + if (strcmp(name, table->objs[i].links[j].new_name) == 0) return ((int)i); /* Check for object name without leading '/' */ - if (HDstrcmp(name, table->objs[i].links[j].new_name + 1) == 0) + if (strcmp(name, table->objs[i].links[j].new_name + 1) == 0) return ((int)i); } /* end for */ } /* end if */ @@ -664,7 +664,7 @@ trav_table_add(trav_table_t *table, const char *path, const H5O_info2_t *oinfo) table->objs[new_obj].obj_token = H5O_TOKEN_UNDEF; table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0; table->objs[new_obj].is_same_trgobj = 0; - table->objs[new_obj].name = (char *)HDstrdup(path); + table->objs[new_obj].name = (char *)strdup(path); table->objs[new_obj].type = oinfo ? (h5trav_type_t)oinfo->type : H5TRAV_TYPE_LINK; table->objs[new_obj].nlinks = 0; table->objs[new_obj].sizelinks = 0; @@ -694,7 +694,7 @@ trav_table_addlink(trav_table_t *table, const H5O_token_t *obj_token, const char size_t n; /* already inserted? */ - if (HDstrcmp(table->objs[i].name, path) == 0) + if (strcmp(table->objs[i].name, path) == 0) return; /* allocate space if necessary */ @@ -706,7 +706,7 @@ trav_table_addlink(trav_table_t *table, const H5O_token_t *obj_token, const char /* insert it */ n = table->objs[i].nlinks++; - table->objs[i].links[n].new_name = (char *)HDstrdup(path); + table->objs[i].links[n].new_name = (char *)strdup(path); return; } /* end if */ @@ -741,7 +741,7 @@ trav_table_addflags(const unsigned *flags, char *name, h5trav_type_t type, trav_ table->objs[new_obj].flags[0] = flags[0]; table->objs[new_obj].flags[1] = flags[1]; table->objs[new_obj].is_same_trgobj = 0; - table->objs[new_obj].name = (char *)HDstrdup(name); + table->objs[new_obj].name = (char *)strdup(name); table->objs[new_obj].type = type; table->objs[new_obj].nlinks = 0; table->objs[new_obj].sizelinks = 0; @@ -1086,13 +1086,13 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co visited->objs[idx].path = NULL; if (type == H5L_TYPE_EXTERNAL) { - if (NULL == (visited->objs[idx].file = HDstrdup(file))) { + if (NULL == (visited->objs[idx].file = strdup(file))) { visited->nused--; H5TOOLS_GOTO_ERROR(FAIL, "visited data structure name allocation failed"); } /* end if */ } /* end if */ - if (NULL == (visited->objs[idx].path = HDstrdup(path))) { + if (NULL == (visited->objs[idx].path = strdup(path))) { visited->nused--; if (visited->objs[idx].file) free(visited->objs[idx].file); @@ -1120,10 +1120,10 @@ symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, c for (u = 0; u < visited->nused; u++) { /* Check for symlink values already in array */ /* check type and path pair to distinguish between symbolic links */ - if ((visited->objs[u].type == type) && !HDstrcmp(visited->objs[u].path, path)) { + if ((visited->objs[u].type == type) && !strcmp(visited->objs[u].path, path)) { /* if external link, file need to be matched as well */ if (visited->objs[u].type == H5L_TYPE_EXTERNAL) - if (!HDstrcmp(visited->objs[u].file, file)) + if (!strcmp(visited->objs[u].file, file)) return (true); return (true); |