diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-08-14 19:58:54 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-08-14 19:58:54 (GMT) |
commit | c27d1808480a4ffae4af5ff5384993f63ea6b5d4 (patch) | |
tree | 251081393f02ad4fb6767af9d23be50971761d79 /tools/lib/h5tools_str.c | |
parent | 37b14fd3ed8aae8f3b83df03ca29f82178c25f8f (diff) | |
parent | d3e931c772a1fea1d8d0676dd6dd3fe95b000d9e (diff) | |
download | hdf5-c27d1808480a4ffae4af5ff5384993f63ea6b5d4.zip hdf5-c27d1808480a4ffae4af5ff5384993f63ea6b5d4.tar.gz hdf5-c27d1808480a4ffae4af5ff5384993f63ea6b5d4.tar.bz2 |
[svn-r27507] Merge of r27237-27500 from the trunk.
Tested w/ h5committest
NOTES: - The manifest may still be messed up.
- Cmake fails since the dual binary work needs to be merged with
this repo's CMake externals.
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r-- | tools/lib/h5tools_str.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 2603984..470620f 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -48,6 +48,7 @@ static char *h5tools_escape(char *s, size_t size); static hbool_t h5tools_str_is_zero(const void *_mem, size_t size); static void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch); +void h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, h5tools_context_t *ctx); /*------------------------------------------------------------------------- * Function: h5tools_str_close @@ -144,16 +145,16 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap); HDva_end(ap); - /* Note: HDvsnprintf() 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 upto the - * buffer size with NULL at the end of the buffer. However on - * Windows with the same condition, this function returns -1 and + /* Note: HDvsnprintf() 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 upto 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 * to lack of buffer size, so try one more time after realloc more - * buffer size before return NULL. + * buffer size before return NULL. */ if (nchars < 0) { /* failure, such as bad format */ @@ -277,7 +278,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt) if (HDstrchr(fmt, '%')) { size_t n = sizeof(_temp); if (str->len - start + 1 > n) { - n = str->len - start + 1; + n = str->len - start + 1; temp = (char*)HDmalloc(n); HDassert(temp); } @@ -665,12 +666,12 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, * * PVN, 28 March 2006 * added H5T_NATIVE_LDOUBLE case - * + * * Raymond Lu, 2011-09-01 * CLANG compiler complained about the line (about 800): * tempint = (tempint >> packed_data_offset) & packed_data_mask; - * The right shift may cause undefined behavior if PACKED_DATA_OFFSET is - * 32-bit or more. For every kind of native integers, I changed the code + * The right shift may cause undefined behavior if PACKED_DATA_OFFSET is + * 32-bit or more. For every kind of native integers, I changed the code * to make it zero if PACKED_DATA_OFFSET is greater than or equal to the * size of integer. *------------------------------------------------------------------------- @@ -1371,14 +1372,14 @@ h5tools_str_is_zero(const void *_mem, size_t size) * * Purpose: replace all occurrences of substring. * - * Return: char * + * Return: char * * * Programmer: Peter Cao * March 8, 2012 * * Notes: - * Applications need to call free() to free the memoery allocated for - * the return string + * Applications need to call free() to free the memoery allocated for + * the return string * *------------------------------------------------------------------------- */ @@ -1411,6 +1412,6 @@ h5tools_str_replace ( const char *string, const char *substr, const char *replac head = newstr + (tok - oldstr) + HDstrlen( replacement ); HDfree (oldstr); } - + return newstr; } |