diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2010-06-28 21:47:00 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2010-06-28 21:47:00 (GMT) |
commit | 5ed817f734dbc8252e2066db751c26d354af0b30 (patch) | |
tree | d528baad7e3480e6e0ba7dc6f104c9dc30c82f32 | |
parent | 016560f36432ae120ee72c4ffb25da727200e842 (diff) | |
download | hdf5-5ed817f734dbc8252e2066db751c26d354af0b30.zip hdf5-5ed817f734dbc8252e2066db751c26d354af0b30.tar.gz hdf5-5ed817f734dbc8252e2066db751c26d354af0b30.tar.bz2 |
[svn-r19035] Purpose:
Change h5ls not to manipulate special characters in object name or attribute name for smart display.
Description:
Merged from hdf5 trunk r19034.
Related to "But1784 h5ls has input and output issues with links that have '\' characters in them."
Tested:
jam, amani
-rw-r--r-- | release_docs/RELEASE.txt | 3 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 34 |
2 files changed, 36 insertions, 1 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7e1c20c..44e216f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -112,7 +112,8 @@ Bug Fixes since HDF5-1.8.5 Tools ----- - - None + - Change h5ls not to manipulate special characters in object name or + attribute name for smart display. bug#1784 (JKM 2010/06/28) F90 API diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 835af10..789e02a 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -170,6 +170,8 @@ usage: %s [OPTIONS] [OBJECTS...]\n\ * Thursday, November 5, 1998 * * Modifications: + * Add _H5LS_CONVERT_SPECIAL_CHAR_ #ifdef section and make it not to + * convert special chars to visible chars. (Jonathan Kim 06/24/2010) * *------------------------------------------------------------------------- */ @@ -178,6 +180,27 @@ display_string(FILE *stream, const char *s, hbool_t escape_spaces) { int nprint=0; +#ifdef _H5LS_CONVERT_SPECIAL_CHAR_ + /*------------------------------------------------------------------- + * _H5LS_CONVERT_SPECIAL_CHAR_ is not defined, so this code section + * will not be compiled. + * This code section is due to be removed after verifying no problem + * at customer sites. (However we may keep it just for the future + * reference as it survived over ten years) + * + * Reason for Obsolete: + * This portion of code converts special characters or '\' to string, + * so when those characters are in object or attribute name, h5ls display + * as visible characters. + * However if a user come up with object or attribute name with special + * character in programming, this code takes away control over '\' + * (escape character) from the user and causes confusion for the output, + * also it’s not possible to handle all the cases in this way. + * This also causes discrepancy from how the string data saved in + * HDF5 file. + * Also other HDF tools don’t convert characters like this, so this + * causes inconsistent output among tools. + *-------------------------------------------------------------/ for (/*void*/; s && *s; s++) { switch (*s) { case '"': @@ -230,6 +253,17 @@ display_string(FILE *stream, const char *s, hbool_t escape_spaces) break; } } +#else + if (stream) + { + nprint = fprintf(stream,s); + } + else + { + nprint = strlen(s); + } +#endif /* _H5LS_CONVERT_SPECIAL_CHAR_ */ + return nprint; } |