summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-02-17 20:49:08 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-02-17 20:49:08 (GMT)
commit055c563da4a40227019834908cc4405ab845782d (patch)
tree5f2a3b18c0da8578cee183b9c7f3de9f4710f28b /tools/h5dump
parent45f2b1102643829180f81297faec88cc903414c7 (diff)
downloadhdf5-055c563da4a40227019834908cc4405ab845782d.zip
hdf5-055c563da4a40227019834908cc4405ab845782d.tar.gz
hdf5-055c563da4a40227019834908cc4405ab845782d.tar.bz2
[svn-r10035] Purpose: Bug fix
Description: On SGI Altix(cobalt) Linux, wrong values were printed out for enum data type members. No apparent reason was discovered. Solution: use another pointer to the buffer containing the member value. It seems fix the problem. Platforms tested: cobalt - simple change, where the bug was discovered.
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index b7974f4..f241c8f 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -3671,6 +3671,7 @@ print_enum(hid_t type)
{
char **name = NULL; /*member names */
unsigned char *value = NULL; /*value array */
+ unsigned char *copy = NULL; /*a pointer to value array */
unsigned nmembs; /*number of members */
int nchars; /*number of output characters */
hid_t super; /*enum base integer type */
@@ -3733,11 +3734,17 @@ print_enum(hid_t type)
for (j = 0; j < dst_size; j++)
printf("%02x", value[i * dst_size + j]);
} else if (H5T_SGN_NONE == H5Tget_sign(native)) {
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value+i*dst_size;
HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long_long *)
- ((void *) (value + i * dst_size))));
+ ((void *)copy)));
} else {
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value+i*dst_size;
HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "d",
- *((long_long *) ((void *) (value + i * dst_size))));
+ *((long_long *) ((void *)copy)));
}
printf(";\n");