From 82f9e0338ad3ba2f0cb9116305b1304f4ba0f12c Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 21 Nov 2000 12:39:38 -0500 Subject: [svn-r2984] Purpose: Bug fix Description: The code for determining what a string should print out if it was declared as H5T_STR_NULLTERM (C strings), H5T_STR_SPACEPAD (Fortran strings), or H5T_STR_NULLPAD (print null characters to the end of the line) was mucked. A user had a problem with it and suggested a change, but the change didn't seem to work properly. Also, if the string was H5T_STR_SPACEPAD, it could have stopped when encountering a NULL even if it hadn't gotten to the end of the string. Solution: Reworked the code to make it more understandable what's happening and to add in support for H5T_STR_SPACEPAD which may have been missing before. Platforms tested: Linux --- tools/h5tools.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/h5tools.c b/tools/h5tools.c index 5a7b7d2..6f7b421 100644 --- a/tools/h5tools.c +++ b/tools/h5tools.c @@ -764,8 +764,8 @@ h5dump_sprint(h5dump_str_t *str/*in,out*/, const h5dump_t *info, quote = '\0'; pad = H5Tget_strpad(type); - for (i=0; - i < size && ((pad == H5T_STR_NULLPAD) ? 1 : (cp_vp[i] != '\0')); + for (i = 0; + i < size && (cp_vp[i] != '\0' || pad != H5T_STR_NULLTERM); i++) { int j = 1; -- cgit v0.12