summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-30 13:55:10 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-30 13:55:10 (GMT)
commitc50c23d387121f2acaf364fa3c1f5d407c4ffb43 (patch)
tree70719be38921637a74c90894d837973017bc68f0 /fortran/src
parent926a033b139974a8a9fd6ddec7150bcbdb556675 (diff)
downloadhdf5-c50c23d387121f2acaf364fa3c1f5d407c4ffb43.zip
hdf5-c50c23d387121f2acaf364fa3c1f5d407c4ffb43.tar.gz
hdf5-c50c23d387121f2acaf364fa3c1f5d407c4ffb43.tar.bz2
[svn-r14129] Description:
Add H5O{set|get}_comment routines, which were overlooked before. Move H5G{set|get}_comment routines to deprecated code section, replacing internal calls with H5O{set|get}_comment. Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) Solaris/32 5.10 (linew) AIX/32 5.3 (copper) Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/H5Gf.c132
1 files changed, 62 insertions, 70 deletions
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c
index 3b25a79..e405944 100644
--- a/fortran/src/H5Gf.c
+++ b/fortran/src/H5Gf.c
@@ -580,40 +580,35 @@ DONE:
*---------------------------------------------------------------------------*/
int_f
-nh5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, int_f*commentlen)
+nh5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment,
+ int_f*commentlen)
{
- int ret_value = -1;
- hid_t c_loc_id;
- char *c_name, *c_comment;
- size_t c_namelen, c_commentlen;
- herr_t c_ret_value;
- /*
- * Convert Fortran name to C name
- */
- c_namelen = *namelen;
- c_commentlen =*commentlen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if(c_name == NULL) return ret_value;
-
- c_comment = (char *)HD5f2cstring(comment, c_commentlen);
- if(c_comment == NULL) { HDfree (c_name);
- return ret_value;
- }
- /*
- * Call H5Gset_comment function
- */
- c_loc_id = (hid_t)*loc_id;
- c_ret_value = H5Gset_comment(c_loc_id, c_name, c_comment);
- if(c_ret_value < 0) goto DONE;
- ret_value = 0;
+ char *c_name = NULL, *c_comment = NULL;
+ int ret_value = -1;
+
+ /*
+ * Convert Fortran name to C name
+ */
+ if(NULL == (c_name = (char *)HD5f2cstring(name, c_namelen)))
+ goto DONE;
+ if(NULL == (c_comment = (char *)HD5f2cstring(comment, (size_t)*commentlen)))
+ goto DONE;
+
+ /*
+ * Call H5Gset_comment function
+ */
+ if(H5Oset_comment((hid_t)*loc_id, c_name, c_comment, H5P_DEFAULT) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- HDfree(c_name);
- HDfree(c_comment);
- return ret_value ;
+ if(c_name)
+ HDfree(c_name);
+ if(c_comment)
+ HDfree(c_comment);
+ return ret_value;
}
-
/*----------------------------------------------------------------------------
* Name: h5gget_comment_c
* Purpose: Call H5Gget_comment to retrieve comments for the specified object
@@ -629,48 +624,45 @@ DONE:
*---------------------------------------------------------------------------*/
int_f
-nh5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, _fcd comment)
+nh5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize,
+ _fcd comment)
{
- int ret_value = -1;
- hid_t c_loc_id;
- char *c_name;
- size_t c_namelen;
- char *c_comment = NULL;
- size_t c_bufsize;
- herr_t c_ret_value;
-
- /*
- * Convert Fortran name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if(c_name == NULL) return ret_value;
-
- /*
- * Allocate buffer to hold the comment
- */
- c_bufsize = (size_t)*bufsize;
- if(c_bufsize) c_comment = (char *)malloc(c_bufsize + 1);
- if(c_comment == NULL) {
- HDfree(c_name);
- return ret_value;
- }
-
- /*
- * Call H5Gget_comment function
- */
- c_loc_id = *loc_id;
- c_ret_value = H5Gget_comment(c_loc_id, c_name, c_bufsize, c_comment);
- if(c_ret_value < 0) goto DONE;
-
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- HD5packFstring(c_comment, _fcdtocp(comment), (size_t)*bufsize);
- ret_value = 0;
+ char *c_name = NULL, *c_comment = NULL;
+ size_t c_bufsize;
+ int ret_value = -1;
+
+ /*
+ * Convert Fortran name to C name
+ */
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ goto DONE;
+
+ /*
+ * Allocate buffer to hold the comment
+ */
+ c_bufsize = (size_t)*bufsize;
+ if(c_bufsize) {
+ if(NULL == (c_comment = (char *)HDmalloc(c_bufsize + 1)))
+ goto DONE;
+ } /* end if */
+
+ /*
+ * Call H5Gget_comment function
+ */
+ if(H5Oget_comment((hid_t)*loc_id, c_name, c_comment, c_bufsize, H5P_DEFAULT) < 0)
+ goto DONE;
+
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_comment, _fcdtocp(comment), c_bufsize);
+ ret_value = 0;
DONE:
- HDfree(c_name);
- HDfree(c_comment);
- return ret_value ;
+ if(c_name)
+ HDfree(c_name);
+ if(c_comment)
+ HDfree(c_comment);
+ return ret_value;
}
+