diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2005-02-17 19:45:29 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2005-02-17 19:45:29 (GMT) |
commit | 644f2303a163ed475e469653a536b9114cf699be (patch) | |
tree | a424b06af1a77bd9be0026faad7413faf84f7630 | |
parent | 4c9881c24cb1a2ca13455a69d492a6cd78b58bca (diff) | |
download | hdf5-644f2303a163ed475e469653a536b9114cf699be.zip hdf5-644f2303a163ed475e469653a536b9114cf699be.tar.gz hdf5-644f2303a163ed475e469653a536b9114cf699be.tar.bz2 |
[svn-r10033] Purpose: Bug fix
Description: On SGI Altix(cobalt) Linux, wrong values were printed out with enum data type.
No apparent reason was found out.
Solution: Use another pointer to the buffer containing enum data type values to do print.
Platforms tested: cobalt - very simple change.
-rw-r--r-- | tools/h5dump/h5dump.c | 11 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 7c7383c..af32b3b 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -3667,6 +3667,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 */ @@ -3729,11 +3730,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"); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 3230b52..b06bc08 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -762,6 +762,7 @@ display_enum_type(hid_t type, int ind) { 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 */ @@ -819,11 +820,17 @@ display_enum_type(hid_t type, int ind) 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)))); + *((unsigned long_long*)((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))); } } |