summaryrefslogtreecommitdiffstats
path: root/hl/src/H5LTparse.y
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2009-04-28 21:42:33 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2009-04-28 21:42:33 (GMT)
commit71b49b0f9bd3cd5ac7d9a331260f3d5bfb3eb6d8 (patch)
treefd6ed60dd18d7838bb68552133e36d580739457c /hl/src/H5LTparse.y
parent4d6fcb288ac03d577335e115268bc7bc6397b2dd (diff)
downloadhdf5-71b49b0f9bd3cd5ac7d9a331260f3d5bfb3eb6d8.zip
hdf5-71b49b0f9bd3cd5ac7d9a331260f3d5bfb3eb6d8.tar.gz
hdf5-71b49b0f9bd3cd5ac7d9a331260f3d5bfb3eb6d8.tar.bz2
[svn-r16880] Fixed a bug in H5LTtext_to_dtype. When the data type is enumerate and the super type is different from
the native integer, the value wasn't converted. I fixed it and corrected the test, too. Tested with h5committest.
Diffstat (limited to 'hl/src/H5LTparse.y')
-rw-r--r--hl/src/H5LTparse.y27
1 files changed, 20 insertions, 7 deletions
diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y
index 7866add..a021efc 100644
--- a/hl/src/H5LTparse.y
+++ b/hl/src/H5LTparse.y
@@ -337,22 +337,35 @@ enum_def : '"' enum_symbol '"' {
short short_val=(short)yylval.ival;
int int_val=(int)yylval.ival;
long long_val=(long)yylval.ival;
- long_long llong_val=(long_long)yylval.ival;
+ long long llong_val=(long long)yylval.ival;
hid_t super = H5Tget_super(enum_id);
hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND);
-
+ H5T_order_t super_order = H5Tget_order(super);
+ H5T_order_t native_order = H5Tget_order(native);
+
if(is_enum && is_enum_memb) { /*if it's an enum member*/
/*To handle machines of different endianness*/
- if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR))
+ if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &char_val);
- else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT))
+ } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &short_val);
- else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT))
+ } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &int_val);
- else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG))
+ } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &long_val);
- else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG))
+ } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) {
+ if(super_order != native_order)
+ H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val);
+ }
is_enum_memb = 0;
if(enum_memb_symbol) free(enum_memb_symbol);