diff options
Diffstat (limited to 'hl/src/H5LT.c')
-rw-r--r-- | hl/src/H5LT.c | 314 |
1 files changed, 157 insertions, 157 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 657e562..3ed8b31 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -304,7 +304,7 @@ image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void * if (udata->vfd_ref_count != 1) goto out; - if (NULL == (udata->vfd_image_ptr = HDrealloc(ptr, size))) + if (NULL == (udata->vfd_image_ptr = realloc(ptr, size))) goto out; udata->vfd_image_size = size; @@ -356,7 +356,7 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata) * references */ if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 && !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) { - HDfree(udata->fapl_image_ptr); + free(udata->fapl_image_ptr); udata->app_image_ptr = NULL; udata->fapl_image_ptr = NULL; udata->vfd_image_ptr = NULL; @@ -375,7 +375,7 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata) * references */ if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 && !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) { - HDfree(udata->vfd_image_ptr); + free(udata->vfd_image_ptr); udata->app_image_ptr = NULL; udata->fapl_image_ptr = NULL; udata->vfd_image_ptr = NULL; @@ -463,7 +463,7 @@ udata_free(void *_udata) /* checks that there are no references outstanding before deallocating udata */ if (udata->ref_count == 0 && udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0) - HDfree(udata); + free(udata); return (SUCCEED); @@ -734,7 +734,7 @@ H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, const char *buf) if ((tid = H5Tcopy(H5T_C_S1)) < 0) goto out; - size = HDstrlen(buf) + 1; /* extra null term */ + size = strlen(buf) + 1; /* extra null term */ if (H5Tset_size(tid, size) < 0) goto out; @@ -824,7 +824,7 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) alloc_incr = min_incr; /* Configure FAPL to use the core file driver */ - if (H5Pset_fapl_core(fapl, alloc_incr, FALSE) < 0) + if (H5Pset_fapl_core(fapl, alloc_incr, false) < 0) goto out; /* Set callbacks for file image ops ONLY if the file image is NOT copied */ @@ -832,7 +832,7 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) H5LT_file_image_ud_t *udata; /* Pointer to udata structure */ /* Allocate buffer to communicate user data to callbacks */ - if (NULL == (udata = (H5LT_file_image_ud_t *)HDmalloc(sizeof(H5LT_file_image_ud_t)))) + if (NULL == (udata = (H5LT_file_image_ud_t *)malloc(sizeof(H5LT_file_image_ud_t)))) goto out; /* Initialize udata with info about app buffer containing file image and flags */ @@ -852,7 +852,7 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) /* Set file image callbacks */ if (H5Pset_file_image_callbacks(fapl, &callbacks) < 0) { - HDfree(udata); + free(udata); goto out; } /* end if */ } /* end if */ @@ -868,7 +868,7 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) file_open_flags = H5F_ACC_RDONLY; /* define a unique file name */ - HDsnprintf(file_name, (sizeof(file_name) - 1), "file_image_%ld", file_name_counter++); + snprintf(file_name, (sizeof(file_name) - 1), "file_image_%ld", file_name_counter++); /* Assign file image in FAPL to the core file driver */ if ((file_id = H5Fopen(file_name, file_open_flags, fapl)) < 0) @@ -1293,7 +1293,7 @@ find_dataset(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if (HDstrncmp(name, (char *)op_data, HDstrlen((char *)op_data)) == 0) + if (strncmp(name, (char *)op_data, strlen((char *)op_data)) == 0) ret = 1; return ret; @@ -1382,7 +1382,7 @@ H5LTset_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_na if ((attr_type = H5Tcopy(H5T_C_S1)) < 0) goto out; - attr_size = HDstrlen(attr_data) + 1; /* extra null term */ + attr_size = strlen(attr_data) + 1; /* extra null term */ if (H5Tset_size(attr_type, (size_t)attr_size) < 0) goto out; @@ -2020,19 +2020,19 @@ H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) goto out; if (lang_type != H5LT_DDL) { - HDfprintf(stderr, "only DDL is supported for now.\n"); + fprintf(stderr, "only DDL is supported for now.\n"); goto out; } - input_len = HDstrlen(text); + input_len = strlen(text); myinput = HDstrdup(text); if ((type_id = H5LTyyparse()) < 0) { - HDfree(myinput); + free(myinput); goto out; } - HDfree(myinput); + free(myinput); input_len = 0; return type_id; @@ -2055,7 +2055,7 @@ out: *------------------------------------------------------------------------- */ static char * -realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str_to_add) +realloc_and_append(bool _no_user_buf, size_t *len, char *buf, const char *str_to_add) { size_t size_str_to_add, size_str; @@ -2066,16 +2066,16 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str goto out; /* If the buffer isn't big enough, reallocate it. Otherwise, go to do strcat. */ - if (str_to_add && ((ssize_t)(*len - (HDstrlen(buf) + HDstrlen(str_to_add) + 1)) < LIMIT)) { - *len += ((HDstrlen(buf) + HDstrlen(str_to_add) + 1) / INCREMENT + 1) * INCREMENT; + if (str_to_add && ((ssize_t)(*len - (strlen(buf) + strlen(str_to_add) + 1)) < LIMIT)) { + *len += ((strlen(buf) + strlen(str_to_add) + 1) / INCREMENT + 1) * INCREMENT; } - else if (!str_to_add && ((ssize_t)(*len - HDstrlen(buf) - 1) < LIMIT)) { + else if (!str_to_add && ((ssize_t)(*len - strlen(buf) - 1) < LIMIT)) { *len += INCREMENT; } - tmp_realloc = (char *)HDrealloc(buf, *len); + tmp_realloc = (char *)realloc(buf, *len); if (tmp_realloc == NULL) { - HDfree(buf); + free(buf); buf = NULL; goto out; } @@ -2085,19 +2085,19 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str if (str_to_add) { /* find the size of the buffer to add */ - size_str_to_add = HDstrlen(str_to_add); + size_str_to_add = strlen(str_to_add); /* find the size of the current buffer */ - size_str = HDstrlen(buf); + size_str = strlen(buf); /* Check to make sure the appended string does not * extend past the allocated buffer; if it does then truncate the string */ if (size_str < *len - 1) { if (size_str + size_str_to_add < *len - 1) { - HDstrcat(buf, str_to_add); + strcat(buf, str_to_add); } else { - HDstrncat(buf, str_to_add, (*len - 1) - size_str); + strncat(buf, str_to_add, (*len - 1) - size_str); } } else { @@ -2125,16 +2125,16 @@ out: *------------------------------------------------------------------------- */ static char * -indentation(size_t x, char *str, hbool_t no_u_buf, size_t *s_len) +indentation(size_t x, char *str, bool no_u_buf, size_t *s_len) { char tmp_str[TMP_LEN]; if (x < 80) { - HDmemset(tmp_str, ' ', x); + memset(tmp_str, ' ', x); tmp_str[x] = '\0'; } else - HDsnprintf(tmp_str, TMP_LEN, "error: the indentation exceeds the number of cols."); + snprintf(tmp_str, TMP_LEN, "error: the indentation exceeds the number of cols."); if (!(str = realloc_and_append(no_u_buf, s_len, str, tmp_str))) goto out; @@ -2156,7 +2156,7 @@ out: * *-----------------------------------------------------------------------*/ static char * -print_enum(hid_t type, char *str, size_t *str_len, hbool_t no_ubuf, size_t indt) +print_enum(hid_t type, char *str, size_t *str_len, bool no_ubuf, size_t indt) { char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ @@ -2190,8 +2190,8 @@ print_enum(hid_t type, char *str, size_t *str_len, hbool_t no_ubuf, size_t indt) dst_size = H5Tget_size(native); /* Get the names and raw values of all members */ - name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)); - value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(dst_size, super_size)); + name = (char **)calloc((size_t)nmembs, sizeof(char *)); + value = (unsigned char *)calloc((size_t)nmembs, MAX(dst_size, super_size)); for (i = 0; i < nmembs; i++) { if ((name[i] = H5Tget_member_name(type, (unsigned)i)) == NULL) @@ -2215,22 +2215,22 @@ print_enum(hid_t type, char *str, size_t *str_len, hbool_t no_ubuf, size_t indt) for (i = 0; i < nmembs; i++) { if (!(str = indentation(indt + COL, str, no_ubuf, str_len))) goto out; - nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]); + nchars = snprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]); if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - HDmemset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1); + memset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1); tmp_str[MAX(3, 19 - nchars)] = '\0'; if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; if (H5T_SGN_NONE == H5Tget_sign(native)) - HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int *)((void *)(value + (size_t)i * dst_size)))); + snprintf(tmp_str, TMP_LEN, "%u", *((unsigned int *)((void *)(value + (size_t)i * dst_size)))); else - HDsnprintf(tmp_str, TMP_LEN, "%d", *((int *)((void *)(value + (size_t)i * dst_size)))); + snprintf(tmp_str, TMP_LEN, "%d", *((int *)((void *)(value + (size_t)i * dst_size)))); if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - HDsnprintf(tmp_str, TMP_LEN, ";\n"); + snprintf(tmp_str, TMP_LEN, ";\n"); if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; } @@ -2239,8 +2239,8 @@ print_enum(hid_t type, char *str, size_t *str_len, hbool_t no_ubuf, size_t indt) for (i = 0; i < nmembs; i++) H5free_memory(name[i]); - HDfree(name); - HDfree(value); + free(name); + free(value); H5Tclose(super); return str; @@ -2249,8 +2249,8 @@ out: if (0 == nmembs) { str = realloc_and_append(no_ubuf, str_len, str, "\n"); - HDassert((indt + 4) < TMP_LEN); - HDmemset(tmp_str, ' ', (indt + 4) + 1); + assert((indt + 4) < TMP_LEN); + memset(tmp_str, ' ', (indt + 4) + 1); tmp_str[(indt + 4)] = '\0'; str = realloc_and_append(no_ubuf, str_len, str, tmp_str); str = realloc_and_append(no_ubuf, str_len, str, " <empty>"); @@ -2260,12 +2260,12 @@ out: if (name) { for (i = 0; i < nmembs; i++) if (name[i]) - HDfree(name[i]); - HDfree(name); + free(name[i]); + free(name); } /* end if */ if (value) - HDfree(value); + free(value); if (super >= 0) H5Tclose(super); @@ -2299,13 +2299,13 @@ H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len) goto out; if (len && !str) { - text_str = (char *)HDcalloc(str_len, sizeof(char)); + text_str = (char *)calloc(str_len, sizeof(char)); text_str[0] = '\0'; if (!(text_str = H5LT_dtype_to_text(dtype, text_str, lang_type, &str_len, 1))) goto out; - *len = HDstrlen(text_str) + 1; + *len = strlen(text_str) + 1; if (text_str) - HDfree(text_str); + free(text_str); text_str = NULL; } else if (len && str) { @@ -2317,7 +2317,7 @@ H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len) return ret; out: - HDfree(text_str); + free(text_str); return FAIL; } @@ -2338,7 +2338,7 @@ out: *------------------------------------------------------------------------- */ char * -H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hbool_t no_user_buf) +H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, bool no_user_buf) { H5T_class_t tcls; char tmp_str[TMP_LEN]; @@ -2348,7 +2348,7 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb goto out; if (lang != H5LT_DDL) { - HDsnprintf(dt_str, *slen, "only DDL is supported for now"); + snprintf(dt_str, *slen, "only DDL is supported for now"); goto out; } @@ -2359,112 +2359,112 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb case H5T_INTEGER: case H5T_BITFIELD: if (H5Tequal(dtype, H5T_STD_I8BE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_I8BE"); + snprintf(dt_str, *slen, "H5T_STD_I8BE"); } else if (H5Tequal(dtype, H5T_STD_I8LE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_I8LE"); + snprintf(dt_str, *slen, "H5T_STD_I8LE"); } else if (H5Tequal(dtype, H5T_STD_I16BE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_I16BE"); + snprintf(dt_str, *slen, "H5T_STD_I16BE"); } else if (H5Tequal(dtype, H5T_STD_I16LE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_I16LE"); + snprintf(dt_str, *slen, "H5T_STD_I16LE"); } else if (H5Tequal(dtype, H5T_STD_I32BE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_I32BE"); + snprintf(dt_str, *slen, "H5T_STD_I32BE"); } else if (H5Tequal(dtype, H5T_STD_I32LE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_I32LE"); + snprintf(dt_str, *slen, "H5T_STD_I32LE"); } else if (H5Tequal(dtype, H5T_STD_I64BE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_I64BE"); + snprintf(dt_str, *slen, "H5T_STD_I64BE"); } else if (H5Tequal(dtype, H5T_STD_I64LE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_I64LE"); + snprintf(dt_str, *slen, "H5T_STD_I64LE"); } else if (H5Tequal(dtype, H5T_STD_U8BE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_U8BE"); + snprintf(dt_str, *slen, "H5T_STD_U8BE"); } else if (H5Tequal(dtype, H5T_STD_U8LE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_U8LE"); + snprintf(dt_str, *slen, "H5T_STD_U8LE"); } else if (H5Tequal(dtype, H5T_STD_U16BE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_U16BE"); + snprintf(dt_str, *slen, "H5T_STD_U16BE"); } else if (H5Tequal(dtype, H5T_STD_U16LE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_U16LE"); + snprintf(dt_str, *slen, "H5T_STD_U16LE"); } else if (H5Tequal(dtype, H5T_STD_U32BE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_U32BE"); + snprintf(dt_str, *slen, "H5T_STD_U32BE"); } else if (H5Tequal(dtype, H5T_STD_U32LE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_U32LE"); + snprintf(dt_str, *slen, "H5T_STD_U32LE"); } else if (H5Tequal(dtype, H5T_STD_U64BE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_U64BE"); + snprintf(dt_str, *slen, "H5T_STD_U64BE"); } else if (H5Tequal(dtype, H5T_STD_U64LE)) { - HDsnprintf(dt_str, *slen, "H5T_STD_U64LE"); + snprintf(dt_str, *slen, "H5T_STD_U64LE"); } else if (H5Tequal(dtype, H5T_NATIVE_SCHAR)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_SCHAR"); + snprintf(dt_str, *slen, "H5T_NATIVE_SCHAR"); } else if (H5Tequal(dtype, H5T_NATIVE_UCHAR)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_UCHAR"); + snprintf(dt_str, *slen, "H5T_NATIVE_UCHAR"); } else if (H5Tequal(dtype, H5T_NATIVE_SHORT)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_SHORT"); + snprintf(dt_str, *slen, "H5T_NATIVE_SHORT"); } else if (H5Tequal(dtype, H5T_NATIVE_USHORT)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_USHORT"); + snprintf(dt_str, *slen, "H5T_NATIVE_USHORT"); } else if (H5Tequal(dtype, H5T_NATIVE_INT)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_INT"); + snprintf(dt_str, *slen, "H5T_NATIVE_INT"); } else if (H5Tequal(dtype, H5T_NATIVE_UINT)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_UINT"); + snprintf(dt_str, *slen, "H5T_NATIVE_UINT"); } else if (H5Tequal(dtype, H5T_NATIVE_LONG)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_LONG"); + snprintf(dt_str, *slen, "H5T_NATIVE_LONG"); } else if (H5Tequal(dtype, H5T_NATIVE_ULONG)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_ULONG"); + snprintf(dt_str, *slen, "H5T_NATIVE_ULONG"); } else if (H5Tequal(dtype, H5T_NATIVE_LLONG)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_LLONG"); + snprintf(dt_str, *slen, "H5T_NATIVE_LLONG"); } else if (H5Tequal(dtype, H5T_NATIVE_ULLONG)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_ULLONG"); + snprintf(dt_str, *slen, "H5T_NATIVE_ULLONG"); } else { - HDsnprintf(dt_str, *slen, "undefined integer"); + snprintf(dt_str, *slen, "undefined integer"); } break; case H5T_FLOAT: if (H5Tequal(dtype, H5T_IEEE_F32BE)) { - HDsnprintf(dt_str, *slen, "H5T_IEEE_F32BE"); + snprintf(dt_str, *slen, "H5T_IEEE_F32BE"); } else if (H5Tequal(dtype, H5T_IEEE_F32LE)) { - HDsnprintf(dt_str, *slen, "H5T_IEEE_F32LE"); + snprintf(dt_str, *slen, "H5T_IEEE_F32LE"); } else if (H5Tequal(dtype, H5T_IEEE_F64BE)) { - HDsnprintf(dt_str, *slen, "H5T_IEEE_F64BE"); + snprintf(dt_str, *slen, "H5T_IEEE_F64BE"); } else if (H5Tequal(dtype, H5T_IEEE_F64LE)) { - HDsnprintf(dt_str, *slen, "H5T_IEEE_F64LE"); + snprintf(dt_str, *slen, "H5T_IEEE_F64LE"); } else if (H5Tequal(dtype, H5T_NATIVE_FLOAT)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_FLOAT"); + snprintf(dt_str, *slen, "H5T_NATIVE_FLOAT"); } else if (H5Tequal(dtype, H5T_NATIVE_DOUBLE)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_DOUBLE"); + snprintf(dt_str, *slen, "H5T_NATIVE_DOUBLE"); } else if (H5Tequal(dtype, H5T_NATIVE_LDOUBLE)) { - HDsnprintf(dt_str, *slen, "H5T_NATIVE_LDOUBLE"); + snprintf(dt_str, *slen, "H5T_NATIVE_LDOUBLE"); } else { - HDsnprintf(dt_str, *slen, "undefined float"); + snprintf(dt_str, *slen, "undefined float"); } break; @@ -2492,16 +2492,16 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb goto out; /* Print lead-in */ - HDsnprintf(dt_str, *slen, "H5T_STRING {\n"); + snprintf(dt_str, *slen, "H5T_STRING {\n"); indent += COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; if (is_vlstr) - HDsnprintf(tmp_str, TMP_LEN, "STRSIZE H5T_VARIABLE;\n"); + snprintf(tmp_str, TMP_LEN, "STRSIZE H5T_VARIABLE;\n"); else - HDsnprintf(tmp_str, TMP_LEN, "STRSIZE %d;\n", (int)size); + snprintf(tmp_str, TMP_LEN, "STRSIZE %d;\n", (int)size); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2510,13 +2510,13 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb goto out; if (str_pad == H5T_STR_NULLTERM) - HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLTERM;\n"); + snprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLTERM;\n"); else if (str_pad == H5T_STR_NULLPAD) - HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLPAD;\n"); + snprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLPAD;\n"); else if (str_pad == H5T_STR_SPACEPAD) - HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_SPACEPAD;\n"); + snprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_SPACEPAD;\n"); else - HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_ERROR;\n"); + snprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_ERROR;\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2525,11 +2525,11 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb goto out; if (cset == H5T_CSET_ASCII) - HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_ASCII;\n"); + snprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_ASCII;\n"); else if (cset == H5T_CSET_UTF8) - HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_UTF8;\n"); + snprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_UTF8;\n"); else - HDsnprintf(tmp_str, TMP_LEN, "CSET unknown;\n"); + snprintf(tmp_str, TMP_LEN, "CSET unknown;\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2555,7 +2555,7 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb /* Check C variable-length string first. Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { - HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n"); + snprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; goto next; @@ -2574,7 +2574,7 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb } if (H5Tequal(tmp_type, str_type)) { - HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n"); + snprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; goto next; @@ -2596,7 +2596,7 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb /* Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { - HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n"); + snprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; goto next; @@ -2616,14 +2616,14 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hb /* Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { - HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n"); + snprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; goto next; } /* Type doesn't match any of above. */ - HDsnprintf(tmp_str, TMP_LEN, "CTYPE unknown_one_character_type;\n"); + snprintf(tmp_str, TMP_LEN, "CTYPE unknown_one_character_type;\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2635,7 +2635,7 @@ next: indent -= COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "}"); + snprintf(tmp_str, TMP_LEN, "}"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2645,12 +2645,12 @@ next: char *tag = NULL; /* Print lead-in */ - HDsnprintf(dt_str, *slen, "H5T_OPAQUE {\n"); + snprintf(dt_str, *slen, "H5T_OPAQUE {\n"); indent += COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype)); + snprintf(tmp_str, TMP_LEN, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype)); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2658,13 +2658,13 @@ next: goto out; tag = H5Tget_tag(dtype); if (tag) { - HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"%s\";\n", tag); + snprintf(tmp_str, TMP_LEN, "OPQ_TAG \"%s\";\n", tag); if (tag) H5free_memory(tag); tag = NULL; } else - HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"\";\n"); + snprintf(tmp_str, TMP_LEN, "OPQ_TAG \"\";\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2672,7 +2672,7 @@ next: indent -= COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "}"); + snprintf(tmp_str, TMP_LEN, "}"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2684,7 +2684,7 @@ next: char *stmp = NULL; /* Print lead-in */ - HDsnprintf(dt_str, *slen, "H5T_ENUM {\n"); + snprintf(dt_str, *slen, "H5T_ENUM {\n"); indent += COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; @@ -2693,21 +2693,21 @@ next: goto out; if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) goto out; - stmp = (char *)HDcalloc(super_len, sizeof(char)); + stmp = (char *)calloc(super_len, sizeof(char)); if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { - HDfree(stmp); + free(stmp); goto out; } if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { - HDfree(stmp); + free(stmp); goto out; } if (stmp) - HDfree(stmp); + free(stmp); stmp = NULL; - HDsnprintf(tmp_str, TMP_LEN, ";\n"); + snprintf(tmp_str, TMP_LEN, ";\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; H5Tclose(super); @@ -2719,7 +2719,7 @@ next: indent -= COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "}"); + snprintf(tmp_str, TMP_LEN, "}"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2731,7 +2731,7 @@ next: char *stmp = NULL; /* Print lead-in */ - HDsnprintf(dt_str, *slen, "H5T_VLEN {\n"); + snprintf(dt_str, *slen, "H5T_VLEN {\n"); indent += COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; @@ -2740,20 +2740,20 @@ next: goto out; if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) goto out; - stmp = (char *)HDcalloc(super_len, sizeof(char)); + stmp = (char *)calloc(super_len, sizeof(char)); if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { - HDfree(stmp); + free(stmp); goto out; } if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { - HDfree(stmp); + free(stmp); goto out; } if (stmp) - HDfree(stmp); + free(stmp); stmp = NULL; - HDsnprintf(tmp_str, TMP_LEN, "\n"); + snprintf(tmp_str, TMP_LEN, "\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; H5Tclose(super); @@ -2762,7 +2762,7 @@ next: indent -= COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "}"); + snprintf(tmp_str, TMP_LEN, "}"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2776,7 +2776,7 @@ next: int ndims; /* Print lead-in */ - HDsnprintf(dt_str, *slen, "H5T_ARRAY {\n"); + snprintf(dt_str, *slen, "H5T_ARRAY {\n"); indent += COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; @@ -2789,11 +2789,11 @@ next: /* Print array dimensions */ for (i = 0; i < ndims; i++) { - HDsnprintf(tmp_str, TMP_LEN, "[%d]", (int)dims[i]); + snprintf(tmp_str, TMP_LEN, "[%d]", (int)dims[i]); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; } - HDsnprintf(tmp_str, TMP_LEN, " "); + snprintf(tmp_str, TMP_LEN, " "); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2801,19 +2801,19 @@ next: goto out; if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) goto out; - stmp = (char *)HDcalloc(super_len, sizeof(char)); + stmp = (char *)calloc(super_len, sizeof(char)); if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { - HDfree(stmp); + free(stmp); goto out; } if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { - HDfree(stmp); + free(stmp); goto out; } if (stmp) - HDfree(stmp); + free(stmp); stmp = NULL; - HDsnprintf(tmp_str, TMP_LEN, "\n"); + snprintf(tmp_str, TMP_LEN, "\n"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; H5Tclose(super); @@ -2822,7 +2822,7 @@ next: indent -= COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "}"); + snprintf(tmp_str, TMP_LEN, "}"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; @@ -2840,7 +2840,7 @@ next: if ((nmembs = H5Tget_nmembers(dtype)) < 0) goto out; - HDsnprintf(dt_str, *slen, "H5T_COMPOUND {\n"); + snprintf(dt_str, *slen, "H5T_COMPOUND {\n"); indent += COL; for (i = 0; i < nmembs; i++) { @@ -2859,30 +2859,30 @@ next: if (H5LTdtype_to_text(mtype, NULL, lang, &mlen) < 0) goto out; - mtmp = (char *)HDcalloc(mlen, sizeof(char)); + mtmp = (char *)calloc(mlen, sizeof(char)); if (H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0) { - HDfree(mtmp); + free(mtmp); goto out; } if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp))) { - HDfree(mtmp); + free(mtmp); goto out; } if (mtmp) - HDfree(mtmp); + free(mtmp); mtmp = NULL; if (H5T_COMPOUND == mclass) indent -= COL; - HDsnprintf(tmp_str, TMP_LEN, " \"%s\"", mname); + snprintf(tmp_str, TMP_LEN, " \"%s\"", mname); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; if (mname) H5free_memory(mname); mname = NULL; - HDsnprintf(tmp_str, TMP_LEN, " : %lu;\n", (unsigned long)moffset); + snprintf(tmp_str, TMP_LEN, " : %lu;\n", (unsigned long)moffset); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; } @@ -2891,30 +2891,30 @@ next: indent -= COL; if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "}"); + snprintf(tmp_str, TMP_LEN, "}"); if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; break; } case H5T_TIME: - HDsnprintf(dt_str, *slen, "H5T_TIME: not yet implemented"); + snprintf(dt_str, *slen, "H5T_TIME: not yet implemented"); break; case H5T_NO_CLASS: - HDsnprintf(dt_str, *slen, "H5T_NO_CLASS"); + snprintf(dt_str, *slen, "H5T_NO_CLASS"); break; case H5T_REFERENCE: - if (H5Tequal(dtype, H5T_STD_REF_DSETREG) == TRUE) { - HDsnprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_DSETREG }"); + if (H5Tequal(dtype, H5T_STD_REF_DSETREG) == true) { + snprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_DSETREG }"); } else { - HDsnprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_OBJECT }"); + snprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_OBJECT }"); } break; case H5T_NCLASSES: break; default: - HDsnprintf(dt_str, *slen, "unknown data type"); + snprintf(dt_str, *slen, "unknown data type"); } return dt_str; @@ -3451,7 +3451,7 @@ H5LT_set_attribute_string(hid_t dset_id, const char *name, const char *buf) if ((tid = H5Tcopy(H5T_C_S1)) < 0) return FAIL; - size = HDstrlen(buf) + 1; /* extra null term */ + size = strlen(buf) + 1; /* extra null term */ if (H5Tset_size(tid, (size_t)size) < 0) goto out; @@ -3507,7 +3507,7 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) htri_t ret_value; /* Initialize */ - ret_value = FALSE; + ret_value = false; /* check the arguments */ if (path == NULL) { @@ -3522,17 +3522,17 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) } /* Find the length of the path */ - path_length = HDstrlen(path); + path_length = strlen(path); /* Check if the identifier is the object itself, i.e. path is '.' */ - if (HDstrncmp(path, ".", path_length) == 0) { + if (strncmp(path, ".", path_length) == 0) { if (check_object_valid) { obj_exists = H5Oexists_by_name(loc_id, path, H5P_DEFAULT); ret_value = obj_exists; goto done; } else { - ret_value = TRUE; /* Since the object is the identifier itself, + ret_value = true; /* Since the object is the identifier itself, * we can only check if loc_id is a valid type */ goto done; } @@ -3547,18 +3547,18 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) curr_name = tmp_path; /* check if absolute pathname */ - if (HDstrncmp(path, "/", 1) == 0) + if (strncmp(path, "/", 1) == 0) curr_name++; /* check if relative path name starts with "./" */ - if (HDstrncmp(path, "./", 2) == 0) + if (strncmp(path, "./", 2) == 0) curr_name += 2; - while ((delimit = HDstrchr(curr_name, '/')) != NULL) { + while ((delimit = strchr(curr_name, '/')) != NULL) { /* Change the delimiter to terminate the string */ *delimit = '\0'; - obj_exists = FALSE; + obj_exists = false; if ((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) { ret_value = FAIL; goto done; @@ -3566,8 +3566,8 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) /* If target link does not exist then no reason to * continue checking the path */ - if (link_exists != TRUE) { - ret_value = FALSE; + if (link_exists != true) { + ret_value = false; goto done; } @@ -3577,7 +3577,7 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) goto done; } - if (obj_exists != TRUE) + if (obj_exists != true) break; /* Change the delimiter back to '/' */ @@ -3596,8 +3596,8 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) } else { ret_value = link_exists; - /* Determine if link resolves to an actual object for check_object_valid TRUE */ - if (check_object_valid == TRUE && link_exists == TRUE) { + /* Determine if link resolves to an actual object for check_object_valid true */ + if (check_object_valid == true && link_exists == true) { if ((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) { ret_value = FAIL; } @@ -3609,7 +3609,7 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) done: if (tmp_path != NULL) - HDfree(tmp_path); + free(tmp_path); return ret_value; } |