summaryrefslogtreecommitdiffstats
path: root/hl/fortran/src
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2009-03-23 19:40:57 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2009-03-23 19:40:57 (GMT)
commita75fb8d89897d86cb6172a61b2d8bf8ce7397299 (patch)
treef4e68cbfda43709249a008b7076c5dcd1d4a614a /hl/fortran/src
parent9fe181052710b58a7e851cda60f8c11664448ea4 (diff)
downloadhdf5-a75fb8d89897d86cb6172a61b2d8bf8ce7397299.zip
hdf5-a75fb8d89897d86cb6172a61b2d8bf8ce7397299.tar.gz
hdf5-a75fb8d89897d86cb6172a61b2d8bf8ce7397299.tar.bz2
[svn-r16597] #1047 (B1) The h5lt info routines are returning data in transposed form. ISSUE : the dimension array of the function h5ltget_dataset_info_f was not transposed (because of C-FORTRAN storage order, the FORTRAN function calls the C function with the same name). SOLUTION: transpose the array. ACTION: add a test case.
tested: h5committest
Diffstat (limited to 'hl/fortran/src')
-rwxr-xr-xhl/fortran/src/H5LTfc.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c
index 93d65ef..61c7547 100755
--- a/hl/fortran/src/H5LTfc.c
+++ b/hl/fortran/src/H5LTfc.c
@@ -1247,6 +1247,7 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id,
size_t c_type_size;
hsize_t c_dims[32];
int i;
+ int c_rank;
/*
* Convert FORTRAN name to C name
@@ -1261,15 +1262,23 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id,
c_loc_id = (hid_t)*loc_id;
ret = H5LTget_dataset_info(c_loc_id, c_name, c_dims, &c_classtype, &c_type_size);
+ if (ret < 0) return ret_value;
*type_class = c_classtype;
*type_size = (size_t_f)c_type_size;
- for (i = 0; i < 32 ; i++) {
- dims[i] = (hsize_t_f) c_dims[i];
- }
+ /*
+ * Transpose dimension arrays because of C-FORTRAN storage order
+ */
+ ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank);
if (ret < 0) return ret_value;
+
+ for (i = 0; i < c_rank ; i++) {
+ dims[i] = (hsize_t_f) c_dims[c_rank - i - 1];
+ }
+
+
ret_value = 0;
return ret_value;
}
@@ -1375,6 +1384,7 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id,
size_t c_type_size;
hsize_t c_dims[32];
int i;
+ int c_rank;
/*
* Convert FORTRAN name to C name
@@ -1388,20 +1398,27 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id,
if (c_attrname == NULL) return ret_value;
/*
- * Call H5LTget_dataset_ndims function.
+ * Call H5LTget_attribute_info function.
*/
c_loc_id = (hid_t)*loc_id;
ret = H5LTget_attribute_info(c_loc_id,c_name,c_attrname,c_dims,&c_classtype,&c_type_size);
+ if (ret < 0) return ret_value;
*type_class = c_classtype;
*type_size = (size_t_f)c_type_size;
- for (i = 0; i < 32 ; i++) {
- dims[i] = (hsize_t_f) c_dims[i];
- }
+/*
+ * Transpose dimension arrays because of C-FORTRAN storage order
+ */
+ ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank);
if (ret < 0) return ret_value;
+
+ for (i = 0; i < c_rank ; i++) {
+ dims[i] = (hsize_t_f) c_dims[c_rank - i - 1];
+ }
+
ret_value = 0;
return ret_value;
}