summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_str.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-09 04:18:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-09 04:18:18 (GMT)
commit14dcb6db33f88011c3499d439c53890ab09d1ba2 (patch)
treecc05060f7dd94342c2e06726ef6b550bf4a7d8f1 /tools/lib/h5tools_str.c
parent20720af231c875330a6074f65ee1c54e6a806fbb (diff)
downloadhdf5-14dcb6db33f88011c3499d439c53890ab09d1ba2.zip
hdf5-14dcb6db33f88011c3499d439c53890ab09d1ba2.tar.gz
hdf5-14dcb6db33f88011c3499d439c53890ab09d1ba2.tar.bz2
[svn-r12736] Description:
Add "use the latest format" support for dataspace object header encode/ decode routines and clean up format a bit for the latest format (new to 1.8.x releases) Remove storing 'perm' parameter for array datatypes in memory and the file, and add test to make certain that if any user applications are attempting to store them, we get some reports back. (Should be unlikely, since the RefMan says that the parameter is not implemented and is unsupported). Carry those changes into the tests, etc. Clean up a bunch more compiler warnings. Tested on: FreeBSD/32 4.11 (sleipnir) w/threadsafe Linux/32 2.4 (heping) w/FORTRAN & C++ Linux/64 2.4 (mir) w/enable-1.6-compat
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r--tools/lib/h5tools_str.c117
1 files changed, 59 insertions, 58 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 7ad5db7..76bb81f 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -46,6 +46,7 @@
static char *h5tools_escape(char *s, size_t size);
static hbool_t h5tools_is_zero(const void *_mem, size_t size);
+static void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch);
/*-------------------------------------------------------------------------
* Function: h5tools_str_close
@@ -460,69 +461,69 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5tool_format_t
*
*-------------------------------------------------------------------------
*/
-void
-h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, unsigned char ch)
+static void
+h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch)
{
if (info->str_locale == ESCAPE_HTML) {
if (ch <= ' ' || ch > '~')
h5tools_str_append(str, "%%%02x", ch);
else
- h5tools_str_append(str, "%c", (char)ch);
+ h5tools_str_append(str, "%c", ch);
} else {
switch (ch) {
- case '"':
- if (!info->do_escape)
- h5tools_str_append(str, "\"");
- else
- h5tools_str_append(str, "\\\"");
- break;
- case '\\':
- if (!info->do_escape)
- h5tools_str_append(str, "\\");
- else
- h5tools_str_append(str, "\\\\");
- break;
- case '\b':
- if (!info->do_escape)
- h5tools_str_append(str, "\b");
- else
- h5tools_str_append(str, "\\b");
- break;
- case '\f':
- if (!info->do_escape)
- h5tools_str_append(str, "\f");
- else
- h5tools_str_append(str, "\\f");
- break;
- case '\n':
- if (!info->do_escape) {
- h5tools_str_append(str, "\n");
- h5tools_str_append(str, " ");
- }
- else
- h5tools_str_append(str, "\\n");
- break;
- case '\r':
- if (!info->do_escape) {
- h5tools_str_append(str, "\r");
- h5tools_str_append(str, " ");
- }
- else
- h5tools_str_append(str, "\\r");
- break;
- case '\t':
- if (!info->do_escape)
- h5tools_str_append(str, "\t");
- else
- h5tools_str_append(str, "\\t");
- break;
- default:
- if (isprint(ch))
- h5tools_str_append(str, "%c", (char)ch);
- else
- h5tools_str_append(str, "\\%03o", ch);
-
- break;
+ case '"':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\"");
+ else
+ h5tools_str_append(str, "\\\"");
+ break;
+ case '\\':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\\");
+ else
+ h5tools_str_append(str, "\\\\");
+ break;
+ case '\b':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\b");
+ else
+ h5tools_str_append(str, "\\b");
+ break;
+ case '\f':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\f");
+ else
+ h5tools_str_append(str, "\\f");
+ break;
+ case '\n':
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\n");
+ h5tools_str_append(str, " ");
+ }
+ else
+ h5tools_str_append(str, "\\n");
+ break;
+ case '\r':
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\r");
+ h5tools_str_append(str, " ");
+ }
+ else
+ h5tools_str_append(str, "\\r");
+ break;
+ case '\t':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\t");
+ else
+ h5tools_str_append(str, "\\t");
+ break;
+ default:
+ if (isprint(ch))
+ h5tools_str_append(str, "%c", ch);
+ else
+ h5tools_str_append(str, "\\%03o", ch);
+
+ break;
}
}
}
@@ -632,7 +633,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
#endif
} else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
H5Tequal(type, H5T_NATIVE_UCHAR))) {
- h5tools_print_char(str, info, (unsigned char)(*ucp_vp));
+ h5tools_print_char(str, info, (char)(*ucp_vp));
} else if (H5T_STRING == H5Tget_class(type)) {
unsigned int i;
char quote = '\0';
@@ -686,7 +687,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
/* Print the character */
- h5tools_print_char(str, info, (unsigned char)(s[i]));
+ h5tools_print_char(str, info, s[i]);
/* Print the repeat count */
if (info->str_repeat && j > info->str_repeat) {