summaryrefslogtreecommitdiffstats
path: root/hl/fortran/src/H5LTfc.c
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2012-03-30 00:45:04 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2012-03-30 00:45:04 (GMT)
commitd63add741b14efdf55a4bbcc6c79fcd99988ac96 (patch)
treef958f72d2a6725aeaffe548617076b765e12e923 /hl/fortran/src/H5LTfc.c
parente320fb15f8ef82eede9633cd3a0bd9d1395344f2 (diff)
downloadhdf5-d63add741b14efdf55a4bbcc6c79fcd99988ac96.zip
hdf5-d63add741b14efdf55a4bbcc6c79fcd99988ac96.tar.gz
hdf5-d63add741b14efdf55a4bbcc6c79fcd99988ac96.tar.bz2
[svn-r22206] Merged changes from the trunk in to the branch, used:
svn merge -r r22040:22205 https://svn.hdfgroup.uiuc.edu/hdf5/trunk/hl Tested: jam (gnu and intel compilers)
Diffstat (limited to 'hl/fortran/src/H5LTfc.c')
-rw-r--r--hl/fortran/src/H5LTfc.c81
1 files changed, 69 insertions, 12 deletions
diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c
index 484acf1..674636d 100644
--- a/hl/fortran/src/H5LTfc.c
+++ b/hl/fortran/src/H5LTfc.c
@@ -17,8 +17,7 @@
#include "H5LTprivate.h"
#include "H5LTf90proto.h"
-
-
+#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
* Function: H5LTmake_dataset_c
@@ -1719,13 +1718,13 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id,
_fcd dsetname,
int_f *attrnamelen,
_fcd attrname,
- void *buf)
+ _fcd buf, size_t_f *buf_size)
{
int ret_value = -1;
herr_t ret;
- hid_t c_loc_id;
char *c_name = NULL;
char *c_attrname = NULL;
+ char *c_buf = NULL;
int c_namelen;
int c_attrnamelen;
@@ -1741,26 +1740,33 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id,
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);
+ * Allocate buffer to hold C attribute string
+ */
+ if ((c_buf = HDmalloc((size_t)*buf_size + 1)) == NULL)
+ goto done;
+ /*
+ * Call H5LTget_attribute_int function.
+ */
+ ret = H5LTget_attribute_string((hid_t)*loc_id,c_name,c_attrname,c_buf);
if (ret < 0)
goto done;
- ret_value = 0;
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_buf, _fcdtocp(buf), (size_t)*buf_size);
+ ret_value = 0;
done:
if(c_name!=NULL)
free(c_name);
if(c_attrname!=NULL)
free(c_attrname);
-
+ if(c_buf!=NULL)
+ free(c_buf);
return ret_value;
}
@@ -2124,3 +2130,54 @@ done:
return ret_value;
}
+
+/*-------------------------------------------------------------------------
+* Function: h5ltpath_valid_c
+*
+* Purpose: Calls h5ltpath_valid
+*
+* Return: Success: 0, Failure: -1
+*
+* Programmer: M. Scot Breitenfeld
+*
+* Date: February 18, 2012
+*
+* Comments:
+*
+* Modifications:
+*
+*
+*-------------------------------------------------------------------------
+*/
+
+int_f
+nh5ltpath_valid_c(hid_t_f *loc_id,
+ _fcd path,
+ int_f *pathlen,
+ int_f *check_object_valid_c)
+{
+ htri_t ret = -1;
+ char *c_path = NULL;
+ hbool_t check_object_valid;
+
+ /*
+ * convert FORTRAN name to C name
+ */
+ if( NULL == (c_path = (char *)HD5f2cstring(path, (size_t)*pathlen)))
+ goto done;
+
+ check_object_valid = FALSE;
+ if(*check_object_valid_c == 1)
+ check_object_valid = TRUE;
+
+ /*
+ * call H5LTpath_valid function.
+ */
+ ret = H5LTpath_valid( (hid_t)*loc_id, c_path, check_object_valid );
+
+done:
+ if(c_path != NULL)
+ free(c_path);
+
+ return (int_f)ret;
+}