summaryrefslogtreecommitdiffstats
path: root/hl/fortran/src/H5LTfc.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2009-05-13 16:19:44 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2009-05-13 16:19:44 (GMT)
commitc7741d35374aa20a2bb7e25f2511228e8a8fcfb5 (patch)
tree35c19b6896132fe2c6307292da2b46207446f203 /hl/fortran/src/H5LTfc.c
parent36431fa74c46846e52ba465a20fc6e0ad7efb5c6 (diff)
downloadhdf5-c7741d35374aa20a2bb7e25f2511228e8a8fcfb5.zip
hdf5-c7741d35374aa20a2bb7e25f2511228e8a8fcfb5.tar.gz
hdf5-c7741d35374aa20a2bb7e25f2511228e8a8fcfb5.tar.bz2
[svn-r16945] bug fix. call free on a string allocated by HD5f2cstring
tested: linux, windows
Diffstat (limited to 'hl/fortran/src/H5LTfc.c')
-rwxr-xr-xhl/fortran/src/H5LTfc.c2287
1 files changed, 1232 insertions, 1055 deletions
diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c
index 61c7547..412b19e 100755
--- a/hl/fortran/src/H5LTfc.c
+++ b/hl/fortran/src/H5LTfc.c
@@ -1,17 +1,17 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+* Copyright by The HDF Group. *
+* Copyright by the Board of Trustees of the University of Illinois. *
+* All rights reserved. *
+* *
+* This file is part of HDF5. The full HDF5 copyright notice, including *
+* terms governing use, modification, and redistribution, is contained in *
+* the files COPYING and Copyright.html. COPYING can be found at the root *
+* of the source code distribution tree; Copyright.html can be found at the *
+* root level of an installed copy of the electronic HDF5 document set and *
+* is linked from the top-level documents page. It can also be found at *
+* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+* access to either file, you may request a copy from help@hdfgroup.org. *
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This files contains C stubs for H5D Fortran APIs */
@@ -21,23 +21,23 @@
/*-------------------------------------------------------------------------
- * Function: H5LTmake_dataset_c
- *
- * Purpose: Call H5LTmake_dataset
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September 09, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTmake_dataset_c
+*
+* Purpose: Call H5LTmake_dataset
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: September 09, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltmake_dataset_c (hid_t_f *loc_id,
@@ -48,57 +48,66 @@ nh5ltmake_dataset_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- hid_t c_type_id;
- char *c_name;
- int c_namelen;
- hsize_t *c_dims;
- int i;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_dims = malloc(sizeof(hsize_t) * (*rank ));
- if (!c_dims) return ret_value;
-
-/*
- * Transpose dimension arrays because of C-FORTRAN storage order
- */
- for (i = 0; i < *rank ; i++) {
- c_dims[i] = dims[*rank - i - 1];
- }
-
-/*
- * Call H5LTmake_dataset function.
- */
- c_loc_id = (hid_t)*loc_id;
- c_type_id = (hid_t)*type_id;
-
- ret = H5LTmake_dataset(c_loc_id, c_name, *rank, c_dims, c_type_id, buf );
-
- free (c_dims);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ hid_t c_type_id;
+ char *c_name = NULL;
+ hsize_t *c_dims = NULL;
+ int c_namelen;
+ int i;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_dims = malloc(sizeof(hsize_t) * (*rank ));
+ if (c_dims == NULL)
+ goto done;
+
+ /*
+ * transpose dimension arrays because of C-FORTRAN storage order
+ */
+ for (i = 0; i < *rank ; i++)
+ {
+ c_dims[i] = dims[*rank - i - 1];
+ }
+
+ /*
+ * call H5LTmake_dataset function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+ c_type_id = (hid_t)*type_id;
+
+ ret = H5LTmake_dataset(c_loc_id, c_name, *rank, c_dims, c_type_id, buf );
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_dims!=NULL)
+ free(c_dims);
+ return ret_value;
}
int_f
nh5ltmake_dataset_int1_c (hid_t_f *loc_id,
int_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf)
+ _fcd name,
+ int_f *rank,
+ hsize_t_f *dims,
+ hid_t_f *type_id,
+ void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_int2_c (hid_t_f *loc_id,
@@ -109,7 +118,7 @@ nh5ltmake_dataset_int2_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_int3_c (hid_t_f *loc_id,
@@ -120,7 +129,7 @@ nh5ltmake_dataset_int3_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_fl1_c (hid_t_f *loc_id,
@@ -131,7 +140,7 @@ nh5ltmake_dataset_fl1_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_fl2_c (hid_t_f *loc_id,
@@ -142,7 +151,7 @@ nh5ltmake_dataset_fl2_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_fl3_c (hid_t_f *loc_id,
@@ -153,7 +162,7 @@ nh5ltmake_dataset_fl3_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_dl1_c (hid_t_f *loc_id,
@@ -164,7 +173,7 @@ nh5ltmake_dataset_dl1_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_dl2_c (hid_t_f *loc_id,
@@ -175,7 +184,7 @@ nh5ltmake_dataset_dl2_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_dl3_c (hid_t_f *loc_id,
@@ -186,21 +195,43 @@ nh5ltmake_dataset_dl3_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_nint1_c (hid_t_f *loc_id,
- int_f *namelen,
+ int_f *namelen,
_fcd name,
int_f *rank,
hsize_t_f *dims,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_nint2_c (hid_t_f *loc_id,
+ int_f *namelen,
+ _fcd name,
+ int_f *rank,
+ hsize_t_f *dims,
+ hid_t_f *type_id,
+ void *buf)
+{
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+}
+int_f
+nh5ltmake_dataset_nint3_c (hid_t_f *loc_id,
+ int_f *namelen,
+ _fcd name,
+ int_f *rank,
+ hsize_t_f *dims,
+ hid_t_f *type_id,
+ void *buf)
+{
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+}
+int_f
+nh5ltmake_dataset_nfl1_c (hid_t_f *loc_id,
int_f *namelen,
_fcd name,
int_f *rank,
@@ -208,10 +239,10 @@ nh5ltmake_dataset_nint2_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
-nh5ltmake_dataset_nint3_c (hid_t_f *loc_id,
+nh5ltmake_dataset_nfl2_c (hid_t_f *loc_id,
int_f *namelen,
_fcd name,
int_f *rank,
@@ -219,92 +250,70 @@ nh5ltmake_dataset_nint3_c (hid_t_f *loc_id,
hid_t_f *type_id,
void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
-}
-int_f
-nh5ltmake_dataset_nfl1_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf)
-{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
-}
-int_f
-nh5ltmake_dataset_nfl2_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf)
-{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_nfl3_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf)
+ int_f *namelen,
+ _fcd name,
+ int_f *rank,
+ hsize_t_f *dims,
+ hid_t_f *type_id,
+ void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_ndl1_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf)
+ int_f *namelen,
+ _fcd name,
+ int_f *rank,
+ hsize_t_f *dims,
+ hid_t_f *type_id,
+ void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_ndl2_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf)
+ int_f *namelen,
+ _fcd name,
+ int_f *rank,
+ hsize_t_f *dims,
+ hid_t_f *type_id,
+ void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
int_f
nh5ltmake_dataset_ndl3_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf)
+ int_f *namelen,
+ _fcd name,
+ int_f *rank,
+ hsize_t_f *dims,
+ hid_t_f *type_id,
+ void *buf)
{
- return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
+ return nh5ltmake_dataset_c (loc_id, namelen, name, rank, dims, type_id, buf);
}
/*-------------------------------------------------------------------------
- * Function: H5LTread_dataset_c
- *
- * Purpose: Call H5LTmake_dataset
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September 09, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTread_dataset_c
+*
+* Purpose: Call H5LTmake_dataset
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: September 09, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltread_dataset_c (hid_t_f *loc_id,
@@ -314,231 +323,239 @@ nh5ltread_dataset_c (hid_t_f *loc_id,
void *buf,
hsize_t_f *dims)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- hid_t c_type_id;
- char *c_name;
- int c_namelen;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return ret_value;
-
-/*
- * Call H5LTread_dataset function.
- */
- c_loc_id = (hid_t)*loc_id;
- c_type_id = (hid_t)*type_id;
-
- ret = H5LTread_dataset(c_loc_id, c_name, c_type_id, buf );
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ hid_t c_type_id;
+ char *c_name = NULL;
+ int c_namelen;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ /*
+ * call H5LTread_dataset function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+ c_type_id = (hid_t)*type_id;
+
+ ret = H5LTread_dataset(c_loc_id, c_name, c_type_id, buf );
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+
+ return ret_value;
}
int_f
nh5ltread_dataset_int1_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_int2_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_int3_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_fl1_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_fl2_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_fl3_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_dl1_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_dl2_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_dl3_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_nint1_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_nint2_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_nint3_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_nfl1_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_nfl2_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_nfl3_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_ndl1_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_ndl2_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
int_f
nh5ltread_dataset_ndl3_c (hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf,
- hsize_t_f *dims)
+ int_f *namelen,
+ _fcd name,
+ hid_t_f *type_id,
+ void *buf,
+ hsize_t_f *dims)
{
- return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
+ return nh5ltread_dataset_c(loc_id, namelen, name, type_id, buf, dims);
}
/*-------------------------------------------------------------------------
- * Function: H5LTmake_dataset_string_c
- *
- * Purpose: Call H5LTmake_dataset
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September 09, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTmake_dataset_string_c
+*
+* Purpose: Call H5LTmake_dataset
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: September 09, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltmake_dataset_string_c (hid_t_f *loc_id,
@@ -546,50 +563,58 @@ nh5ltmake_dataset_string_c (hid_t_f *loc_id,
_fcd name,
char *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return ret_value;
-
-/*
- * Call H5LTmake_dataset_string function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5LTmake_dataset_string(c_loc_id,c_name,buf);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ int c_namelen;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ /*
+ * call H5LTmake_dataset_string function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ ret = H5LTmake_dataset_string(c_loc_id,c_name,buf);
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTread_dataset_string_c
- *
- * Purpose: Call H5LTread_dataset_string
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September 09, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTread_dataset_string_c
+*
+* Purpose: Call H5LTread_dataset_string
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: September 09, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltread_dataset_string_c (hid_t_f *loc_id,
@@ -597,541 +622,643 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id,
_fcd name,
char *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return ret_value;
-
-/*
- * Call H5LTread_dataset_string function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5LTread_dataset_string(c_loc_id,c_name,buf);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ int c_namelen;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ /*
+ * call H5LTread_dataset_string function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ ret = H5LTread_dataset_string(c_loc_id,c_name,buf);
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTset_attribute_int_c
- *
- * Purpose: Call H5LTset_attribute_int
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTset_attribute_int_c
+*
+* Purpose: Call H5LTset_attribute_int
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltset_attribute_int_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- size_t_f *size,
- void *buf)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ size_t_f *size,
+ void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- char *c_attrname;
- int c_namelen;
- int c_attrnamelen;
- size_t c_size;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = (int)*attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTset_attribute_int function.
- */
- c_loc_id = (hid_t)*loc_id;
- c_size = (size_t)*size;
-
- if (sizeof(int_f) == sizeof(int))
- ret = H5LTset_attribute_int(c_loc_id,c_name,c_attrname,buf,c_size);
- else if (sizeof(int_f) == sizeof(long))
- ret = H5LTset_attribute_long(c_loc_id,c_name,c_attrname,buf,c_size);
- else if (sizeof(int_f) == sizeof(long long))
- ret = H5LTset_attribute_long_long(c_loc_id,c_name,c_attrname,buf,c_size);
- else
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+ size_t c_size;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = (int)*attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * call H5LTset_attribute_int function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+ c_size = (size_t)*size;
+
+ if (sizeof(int_f) == sizeof(int))
+ ret = H5LTset_attribute_int(c_loc_id,c_name,c_attrname,buf,c_size);
+ else if (sizeof(int_f) == sizeof(long))
+ ret = H5LTset_attribute_long(c_loc_id,c_name,c_attrname,buf,c_size);
+ else if (sizeof(int_f) == sizeof(long long))
+ ret = H5LTset_attribute_long_long(c_loc_id,c_name,c_attrname,buf,c_size);
+ else
+ goto done;
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTset_attribute_float_c
- *
- * Purpose: Call H5LTset_attribute_float
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTset_attribute_float_c
+*
+* Purpose: Call H5LTset_attribute_float
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltset_attribute_float_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- size_t_f *size,
- void *buf)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ size_t_f *size,
+ void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- char *c_attrname;
- int c_namelen;
- int c_attrnamelen;
- size_t c_size;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = *attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTset_attribute_float function.
- */
- c_loc_id = (hid_t)*loc_id;
- c_size = (size_t)*size;
-
- ret = H5LTset_attribute_float(c_loc_id,c_name,c_attrname,buf,c_size);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+ size_t c_size;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = *attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * Call H5LTset_attribute_float function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+ c_size = (size_t)*size;
+
+ ret = H5LTset_attribute_float(c_loc_id,c_name,c_attrname,buf,c_size);
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTset_attribute_double_c
- *
- * Purpose: Call H5LTset_attribute_double
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTset_attribute_double_c
+*
+* Purpose: Call H5LTset_attribute_double
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltset_attribute_double_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- size_t_f *size,
- void *buf)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ size_t_f *size,
+ void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- char *c_attrname;
- int c_namelen;
- int c_attrnamelen;
- size_t c_size;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = *attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTset_attribute_double function.
- */
- c_loc_id = (hid_t)*loc_id;
- c_size = (size_t)*size;
-
- ret = H5LTset_attribute_double(c_loc_id,c_name,c_attrname,buf,c_size);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+ size_t c_size;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = *attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * Call H5LTset_attribute_double function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+ c_size = (size_t)*size;
+
+ ret = H5LTset_attribute_double(c_loc_id,c_name,c_attrname,buf,c_size);
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTset_attribute_string_c
- *
- * Purpose: Call H5LTset_attribute_string
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTset_attribute_string_c
+*
+* Purpose: Call H5LTset_attribute_string
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltset_attribute_string_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- void *buf)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- char *c_attrname;
- int c_namelen;
- int c_attrnamelen;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = *attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTset_attribute_string function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5LTset_attribute_string(c_loc_id,c_name,c_attrname,buf);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = *attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * call H5LTset_attribute_string function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ ret = H5LTset_attribute_string(c_loc_id,c_name,c_attrname,buf);
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTget_attribute_int_c
- *
- * Purpose: Call H5LTget_attribute_int
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTget_attribute_int_c
+*
+* Purpose: Call H5LTget_attribute_int
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltget_attribute_int_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- void *buf)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
- char *c_attrname;
- int c_attrnamelen;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = (int)*namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = (int)*attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTget_attribute_int function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- if(sizeof(int_f) == sizeof(int))
- ret = H5LTget_attribute_int(c_loc_id,c_name,c_attrname,buf);
- else if (sizeof(int_f) == sizeof(long))
- ret = H5LTget_attribute_long(c_loc_id,c_name,c_attrname,buf);
- else if (sizeof(int_f) == sizeof(long long))
- ret = H5LTget_attribute_long_long(c_loc_id,c_name,c_attrname,buf);
- else
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = (int)*namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = (int)*attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * call H5LTget_attribute_int function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ if(sizeof(int_f) == sizeof(int))
+ ret = H5LTget_attribute_int(c_loc_id,c_name,c_attrname,buf);
+ else if (sizeof(int_f) == sizeof(long))
+ ret = H5LTget_attribute_long(c_loc_id,c_name,c_attrname,buf);
+ else if (sizeof(int_f) == sizeof(long long))
+ ret = H5LTget_attribute_long_long(c_loc_id,c_name,c_attrname,buf);
+ else
+ goto done;
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTget_attribute_float_c
- *
- * Purpose: Call H5LTget_attribute_float
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTget_attribute_float_c
+*
+* Purpose: Call H5LTget_attribute_float
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltget_attribute_float_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- void *buf)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
- char *c_attrname;
- int c_attrnamelen;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = (int)*namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = (int)*attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTget_attribute_int function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5LTget_attribute_float(c_loc_id,c_name,c_attrname,buf);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = (int)*namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = (int)*attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * call H5LTget_attribute_int function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ ret = H5LTget_attribute_float(c_loc_id,c_name,c_attrname,buf);
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTget_attribute_double_c
- *
- * Purpose: Call H5LTget_attribute_double
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTget_attribute_double_c
+*
+* Purpose: Call H5LTget_attribute_double
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltget_attribute_double_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- void *buf)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
- char *c_attrname;
- int c_attrnamelen;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = (int)*namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = (int)*attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTget_attribute_int function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5LTget_attribute_double(c_loc_id,c_name,c_attrname,buf);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = (int)*namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = (int)*attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * call H5LTget_attribute_int function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ ret = H5LTget_attribute_double(c_loc_id,c_name,c_attrname,buf);
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTget_attribute_string_c
- *
- * Purpose: Call H5LTget_attribute_string
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTget_attribute_string_c
+*
+* Purpose: Call H5LTget_attribute_string
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltget_attribute_string_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- void *buf)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
- char *c_attrname;
- int c_attrnamelen;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = (int)*namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = (int)*attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTget_attribute_int function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5LTget_attribute_string(c_loc_id,c_name,c_attrname,buf);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = (int)*namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = (int)*attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * Call H5LTget_attribute_int function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ ret = H5LTget_attribute_string(c_loc_id,c_name,c_attrname,buf);
+
+ if (ret < 0)
+ goto done;
+
+ ret_value = 0;
+
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
+
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: H5LTget_dataset_ndims_c
- *
- * Purpose: Call H5LTget_dataset_ndims
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September 09, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: H5LTget_dataset_ndims_c
+*
+* Purpose: Call H5LTget_dataset_ndims
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: September 09, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltget_dataset_ndims_c(hid_t_f *loc_id,
@@ -1139,96 +1266,111 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id,
_fcd name,
int_f *rank)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
- int c_rank;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = (int)*namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return ret_value;
-
-/*
- * Call H5LTget_dataset_ndims function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank);
-
- if (ret < 0) return ret_value;
- *rank = (int_f)c_rank;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ int c_namelen;
+ int c_rank;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = (int)*namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ /*
+ * Call H5LTget_dataset_ndims function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank);
+
+ if (ret < 0)
+ goto done;
+
+ *rank = (int_f)c_rank;
+ ret_value = 0;
+
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: h5ltfind_dataset_c
- *
- * Purpose: Call H5LTfind_dataset
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September 09, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: h5ltfind_dataset_c
+*
+* Purpose: Call H5LTfind_dataset
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: September 09, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltfind_dataset_c(hid_t_f *loc_id,
int_f *namelen,
_fcd name)
{
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ int c_namelen;
+ herr_t ret;
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = (int)*namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return -1;
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = (int)*namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL) return -1;
-/*
- * Call H5LTget_dataset_ndims function.
- */
- c_loc_id = (hid_t)*loc_id;
+ /*
+ * Call H5LTget_dataset_ndims function.
+ */
+ c_loc_id = (hid_t)*loc_id;
- return( H5LTfind_dataset(c_loc_id, c_name));
+ ret = H5LTfind_dataset(c_loc_id, c_name);
+
+ if(c_name!=NULL)
+ free(c_name);
+
+ return ret;
}
/*-------------------------------------------------------------------------
- * Function: h5ltget_dataset_info_c
- *
- * Purpose: Call H5LTget_dataset_info
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September 09, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: h5ltget_dataset_info_c
+*
+* Purpose: Call H5LTget_dataset_info
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: September 09, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltget_dataset_info_c(hid_t_f *loc_id,
@@ -1238,187 +1380,222 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id,
int_f *type_class,
size_t_f *type_size)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- int c_namelen;
- H5T_class_t c_classtype;
- size_t c_type_size;
- hsize_t c_dims[32];
- int i;
- int c_rank;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = (int)*namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return ret_value;
-
-/*
- * Call H5LTget_dataset_ndims function.
- */
- 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;
-
- /*
- * 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;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ int c_namelen;
+ H5T_class_t c_classtype;
+ size_t c_type_size;
+ hsize_t c_dims[32];
+ int i;
+ int c_rank;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = (int)*namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ /*
+ * call H5LTget_dataset_ndims function.
+ */
+ 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)
+ goto done;
+
+ *type_class = c_classtype;
+ *type_size = (size_t_f)c_type_size;
+
+ /*
+ * transpose dimension arrays because of C-FORTRAN storage order
+ */
+
+ ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank);
+ if (ret < 0)
+ goto done;
+
+ for (i = 0; i < c_rank ; i++)
+ {
+ dims[i] = (hsize_t_f) c_dims[c_rank - i - 1];
+ }
+
+
+ ret_value = 0;
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: h5ltget_attribute_ndims_c
- *
- * Purpose: Call H5LTget_attribute_ndims
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: October 05, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: h5ltget_attribute_ndims_c
+*
+* Purpose: Call H5LTget_attribute_ndims
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: October 05, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltget_attribute_ndims_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd dsetname,
- int_f *attrnamelen,
- _fcd attrname,
- int_f *rank)
+ int_f *namelen,
+ _fcd dsetname,
+ int_f *attrnamelen,
+ _fcd attrname,
+ int_f *rank)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- char *c_attrname;
- int c_namelen;
- int c_attrnamelen;
- int c_rank;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen =(int) *namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = (int)*attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * Call H5LTset_attribute_ndims function.
- */
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank);
-
- if (ret < 0) return ret_value;
- *rank = (int_f)c_rank;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+ int c_rank;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen =(int) *namelen;
+ c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = (int)*attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * Call H5LTset_attribute_ndims function.
+ */
+ c_loc_id = (hid_t)*loc_id;
+
+ ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank);
+
+ if (ret < 0)
+ goto done;
+
+ *rank = (int_f)c_rank;
+ ret_value = 0;
+
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: h5ltget_attribute_info_c
- *
- * Purpose: Call H5LTget_attribute_info
- *
- * Return: Success: 0, Failure: -1
- *
- * Programmer: pvn@ncsa.uiuc.edu
- *
- * Date: September 09, 2004
- *
- * Comments:
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
+* Function: h5ltget_attribute_info_c
+*
+* Purpose: Call H5LTget_attribute_info
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: pvn@ncsa.uiuc.edu
+*
+* Date: September 09, 2004
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
int_f
nh5ltget_attribute_info_c(hid_t_f *loc_id,
- int_f *namelen,
- _fcd name,
- int_f *attrnamelen,
- _fcd attrname,
- hsize_t_f *dims,
- int_f *type_class,
- size_t_f *type_size)
+ int_f *namelen,
+ _fcd name,
+ int_f *attrnamelen,
+ _fcd attrname,
+ hsize_t_f *dims,
+ int_f *type_class,
+ size_t_f *type_size)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name;
- char *c_attrname;
- int c_namelen;
- int c_attrnamelen;
- H5T_class_t c_classtype;
- size_t c_type_size;
- hsize_t c_dims[32];
- int i;
- int c_rank;
-
-/*
- * Convert FORTRAN name to C name
- */
- c_namelen = (int)*namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return ret_value;
-
- c_attrnamelen = (int)*attrnamelen;
- c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
- if (c_attrname == NULL) return ret_value;
-
-/*
- * 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;
-
-/*
- * 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;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char *c_name = NULL;
+ char *c_attrname = NULL;
+ int c_namelen;
+ int c_attrnamelen;
+ H5T_class_t c_classtype;
+ size_t c_type_size;
+ hsize_t c_dims[32];
+ int i;
+ int c_rank;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ c_namelen = (int)*namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL)
+ goto done;
+
+ c_attrnamelen = (int)*attrnamelen;
+ c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen);
+ if (c_attrname == NULL)
+ goto done;
+
+ /*
+ * 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)
+ goto done;
+
+ *type_class = c_classtype;
+ *type_size = (size_t_f)c_type_size;
+
+ /*
+ * 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)
+ goto done;
+
+ for (i = 0; i < c_rank ; i++)
+ {
+ dims[i] = (hsize_t_f) c_dims[c_rank - i - 1];
+ }
+
+ ret_value = 0;
+
+
+done:
+ if(c_name!=NULL)
+ free(c_name);
+ if(c_attrname!=NULL)
+ free(c_attrname);
+
+
+ return ret_value;
}