diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-28 13:11:38 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-28 13:11:38 (GMT) |
commit | 3360c3af0c100ac4d3a2fe2865f34661da862ec5 (patch) | |
tree | 9caf7dba62679504aa39ec02ebb72d8b8b5a848d /fortran/src/H5Pf.c | |
parent | 5b4d3279099e7e4fad6e0092c77aa93dfd35d616 (diff) | |
download | hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.zip hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.gz hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.bz2 |
[svn-r18175] Description:
Bring r17986:18172 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'fortran/src/H5Pf.c')
-rw-r--r-- | fortran/src/H5Pf.c | 155 |
1 files changed, 83 insertions, 72 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 0929d7a..ee2145d 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -17,6 +17,7 @@ /* This files contains C stubs for H5P Fortran APIs */ #include "H5f90.h" +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5pcreate_c @@ -32,16 +33,17 @@ int_f nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ) { - hid_t c_class; - int ret_value = 0; - hid_t c_prp_id; + hid_t c_prp_id; + int_f ret_value = 0; - c_class = (hid_t)*class; - c_prp_id = H5Pcreate(c_class); + c_prp_id = H5Pcreate((hid_t)*class); + if(c_prp_id < 0) + HGOTO_DONE(FAIL) - if ( c_prp_id < 0 ) ret_value = -1; - *prp_id = (hid_t_f)c_prp_id; - return ret_value; + *prp_id = (hid_t_f)c_prp_id; + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -57,11 +59,12 @@ nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ) int_f nh5pclose_c ( hid_t_f *prp_id ) { - int ret_value = 0; - hid_t c_prp_id=(*prp_id); + int_f ret_value = 0; - if ( H5Pclose(c_prp_id) < 0 ) ret_value = -1; - return ret_value; + if(H5Pclose((hid_t)*prp_id) < 0) + ret_value = -1; + + return ret_value; } @@ -79,15 +82,17 @@ nh5pclose_c ( hid_t_f *prp_id ) int_f nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id) { - int ret_value = 0; - hid_t c_prp_id; - hid_t c_new_prp_id; + hid_t c_new_prp_id; + int_f ret_value = 0; - c_prp_id = *prp_id; - c_new_prp_id = H5Pcopy(c_prp_id); - if ( c_new_prp_id < 0 ) ret_value = -1; - *new_prp_id = (hid_t_f)c_new_prp_id; - return ret_value; + c_new_prp_id = H5Pcopy((hid_t)*prp_id); + if(c_new_prp_id < 0) + HGOTO_DONE(FAIL) + + *new_prp_id = (hid_t_f)c_new_prp_id; + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -105,17 +110,17 @@ nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id) int_f nh5pequal_c ( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f * c_flag) { - int ret_value = 0; - hid_t c_plist1_id; - hid_t c_plist2_id; - htri_t c_c_flag; - - c_plist1_id = (hid_t)*plist1_id; - c_plist2_id = (hid_t)*plist2_id; - c_c_flag = H5Pequal(c_plist1_id, c_plist2_id); - if ( c_c_flag < 0 ) ret_value = -1; - *c_flag = (int_f)c_c_flag; - return ret_value; + htri_t c_c_flag; + int_f ret_value = 0; + + c_c_flag = H5Pequal((hid_t)*plist1_id, (hid_t)*plist2_id); + if(c_c_flag < 0) + HGOTO_DONE(FAIL) + + *c_flag = (int_f)c_c_flag; + +done: + return ret_value; } @@ -139,20 +144,19 @@ nh5pequal_c ( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f * c_flag) int_f nh5pget_class_c ( hid_t_f *prp_id , int_f *classtype) { - int ret_value = 0; - hid_t c_prp_id; - hid_t c_classtype; + hid_t c_classtype; + int_f ret_value = 0; - c_prp_id = *prp_id; - c_classtype = H5Pget_class(c_prp_id); - if (c_classtype == H5P_ROOT ) { + c_classtype = H5Pget_class((hid_t)*prp_id); + if(c_classtype == H5P_ROOT) { *classtype = H5P_ROOT; - ret_value = -1; - return ret_value; - } - *classtype = (int_f)c_classtype; + HGOTO_DONE(FAIL) + } - return ret_value; + *classtype = (int_f)c_classtype; + +done: + return ret_value; } /*---------------------------------------------------------------------------- @@ -3962,33 +3966,39 @@ nh5pget_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options) int_f nh5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len, size_t_f *size) { - int_f ret_value = -1; - char *c_expression = NULL; /* Buffer to hold C string */ - size_t c_expression_len; - ssize_t ret; + char *c_expression = NULL; /* Buffer to hold C string */ + size_t c_expression_len; + ssize_t ret; + int_f ret_value = 0; + c_expression_len = (size_t)*expression_len + 1; - c_expression_len = (size_t)*expression_len + 1; + /* + * Allocate memory to store the expression. + */ + if(c_expression_len) { + c_expression = (char*)HDmalloc(c_expression_len); + if(NULL == c_expression) + HGOTO_DONE(FAIL) + } /* end if */ - /* should expression_len be size_t_f? */ - /* - * Allocate memory to store the expression. - */ - if( c_expression_len) c_expression = (char*) HDmalloc(c_expression_len); - if (c_expression == NULL) return ret_value; + /* + * Call H5Pget_data_transform function. + */ + ret = H5Pget_data_transform((hid_t)*plist_id, c_expression, c_expression_len); + if(ret < 0) + HGOTO_DONE(FAIL) - /* - * Call h5pget_data_transform function. - */ - ret = H5Pget_data_transform((hid_t)*plist_id, c_expression, c_expression_len); - if(ret < 0) return ret_value; - /* or strlen ? */ - HD5packFstring(c_expression, _fcdtocp(expression), c_expression_len-1); + /* or strlen ? */ + HD5packFstring(c_expression, _fcdtocp(expression), c_expression_len - 1); - *size = (size_t_f)ret; + *size = (size_t_f)ret; - ret_value = 0; - return ret_value; +done: + if(c_expression) + HDfree(c_expression); + + return ret_value; } /*---------------------------------------------------------------------------- @@ -4012,23 +4022,24 @@ nh5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_l int_f nh5pset_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len) { - int_f ret_value = -1; /* Return value */ char* c_expression = NULL; /* Buffer to hold C string */ - herr_t ret; + int_f ret_value = 0; /* Return value */ + /* * Convert FORTRAN name to C name */ if(NULL == (c_expression = HD5f2cstring(expression, (size_t)*expression_len))) - return ret_value; + HGOTO_DONE(FAIL) + /* - * Call h5pset_data_transform function. + * Call H5Pset_data_transform function. */ - ret = H5Pset_data_transform((hid_t)*plist_id, c_expression); - if(ret<0) return ret_value; + if(H5Pset_data_transform((hid_t)*plist_id, c_expression) < 0) + HGOTO_DONE(FAIL) - ret_value = 0; - if(c_expression) - HDfree(c_expression); +done: + if(c_expression) + HDfree(c_expression); return ret_value; } |