summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Tf.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-18 22:02:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-18 22:02:19 (GMT)
commita5984f59f71739531fb78c3933a726e73dd54328 (patch)
tree839fdd36b93e7976c97b9a351e3937266d1dd7b3 /fortran/src/H5Tf.c
parentcf56cd041d119914d7a9bee79c22e59a8ce85059 (diff)
downloadhdf5-a5984f59f71739531fb78c3933a726e73dd54328.zip
hdf5-a5984f59f71739531fb78c3933a726e73dd54328.tar.gz
hdf5-a5984f59f71739531fb78c3933a726e73dd54328.tar.bz2
[svn-r14212] Description:
Make H5Tarray_create() and H5Tget_array_dims() versioned, and drop the "perm" parameter from the '2' versions. Shift internal library usage to '2' versions. Add simple regression tests for '1' versions. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'fortran/src/H5Tf.c')
-rw-r--r--fortran/src/H5Tf.c80
1 files changed, 29 insertions, 51 deletions
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index 1bd5212..7c3befc 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -1070,7 +1070,7 @@ nh5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f * offset)
/*----------------------------------------------------------------------------
* Name: h5tget_array_dims_c
- * Purpose: Call H5Tget_array_dims to get
+ * Purpose: Call H5Tget_array_dims2 to get
* dimensions of array datatype
* Inputs: type_id - identifier of the array datatype
* Outputs: dims - dimensions(sizes of dimensions) of the array
@@ -1083,33 +1083,23 @@ nh5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f * offset)
int_f
nh5tget_array_dims_c ( hid_t_f *type_id , hsize_t_f * dims)
{
- int ret_value = -1;
- hid_t c_type_id;
- hsize_t * c_dims;
- int rank, i;
- herr_t status;
+ hsize_t c_dims[H5S_MAX_RANK];
+ int rank, i;
+ int ret_value = -1;
- rank = H5Tget_array_ndims((hid_t)*type_id);
- if (rank < 0) return ret_value;
- c_dims = (hsize_t*)malloc(sizeof(hsize_t)*rank);
- if(!c_dims) return ret_value;
+ if((rank = H5Tget_array_ndims((hid_t)*type_id)) < 0)
+ goto DONE;
- c_type_id = (hid_t)*type_id;
- status = H5Tget_array_dims(c_type_id, c_dims, NULL);
- if (status < 0) {
- HDfree(c_dims);
- return ret_value;
- }
+ if(H5Tget_array_dims2((hid_t)*type_id, c_dims) < 0)
+ goto DONE;
- for(i =0; i < rank; i++)
- {
- dims[rank-i-1] = (hsize_t_f)c_dims[i];
- }
+ for(i = 0; i < rank; i++)
+ dims[(rank - i) - 1] = (hsize_t_f)c_dims[i];
- ret_value = 0;
- HDfree(c_dims);
+ ret_value = 0;
- return ret_value;
+DONE:
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -1296,7 +1286,7 @@ nh5tpack_c(hid_t_f * type_id)
/*----------------------------------------------------------------------------
* Name: h5tarray_create_c
- * Purpose: Call H5Tarray_create to create array datatype
+ * Purpose: Call H5Tarray_create2 to create array datatype
* Inputs: base_id - identifier of array base datatype
* rank - array's rank
* dims - Size of new member array
@@ -1309,38 +1299,26 @@ nh5tpack_c(hid_t_f * type_id)
int_f
nh5tarray_create_c(hid_t_f * base_id, int_f *rank, hsize_t_f* dims, hid_t_f* type_id)
{
- int ret_value = -1;
- hid_t c_base_id;
- hid_t c_type_id;
- int c_rank;
- hsize_t *c_dims;
- int i;
-
- c_dims = (hsize_t*)malloc(sizeof(hsize_t)*(*rank));
- if(!c_dims) return ret_value;
+ hsize_t c_dims[H5S_MAX_RANK];
+ hid_t c_type_id;
+ unsigned u; /* Local index variable */
+ int ret_value = -1;
- /*
- * Transpose dimension arrays because of C-FORTRAN storage order
- */
- for (i = 0; i < *rank ; i++) {
- c_dims[i] = (hsize_t)dims[*rank - i - 1];
- }
-
- c_base_id = (hid_t)*base_id;
- c_rank = (int)*rank;
- c_type_id = H5Tarray_create(c_base_id, c_rank, c_dims, NULL);
+ /*
+ * Transpose dimension arrays because of C-FORTRAN storage order
+ */
+ for(u = 0; u < (unsigned)*rank ; u++)
+ c_dims[u] = (hsize_t)dims[(*rank - u) - 1];
- if(c_type_id < 0) {
- HDfree(c_dims);
- return ret_value;
- }
+ if((c_type_id = H5Tarray_create2((hid_t)*base_id, (unsigned)*rank, c_dims)) < 0)
+ goto DONE;
- *type_id = (hid_t_f)c_type_id;
- ret_value = 0;
- HDfree(c_dims);
- return ret_value;
+ *type_id = (hid_t_f)c_type_id;
+ ret_value = 0;
+DONE:
+ return ret_value;
}