summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Ef.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-28 13:11:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-28 13:11:38 (GMT)
commit3360c3af0c100ac4d3a2fe2865f34661da862ec5 (patch)
tree9caf7dba62679504aa39ec02ebb72d8b8b5a848d /fortran/src/H5Ef.c
parent5b4d3279099e7e4fad6e0092c77aa93dfd35d616 (diff)
downloadhdf5-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/H5Ef.c')
-rw-r--r--fortran/src/H5Ef.c189
1 files changed, 102 insertions, 87 deletions
diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c
index d3983af..4f9d652 100644
--- a/fortran/src/H5Ef.c
+++ b/fortran/src/H5Ef.c
@@ -16,7 +16,7 @@
/* This files contains C stubs for H5E Fortran APIs */
#include "H5f90.h"
-
+#include "H5Eprivate.h"
/*----------------------------------------------------------------------------
* Name: h5eclear_c
@@ -30,18 +30,18 @@
*---------------------------------------------------------------------------*/
int_f
-nh5eclear_c( )
+nh5eclear_c(void)
{
- int ret_val = -1;
- herr_t status;
-
- /*
- * Call H5Eclear function.
- */
- status = H5Eclear2(H5E_DEFAULT);
- if(status < 0) return ret_val;
- ret_val = 0;
- return ret_val;
+ int_f ret_value = 0;
+
+ /*
+ * Call H5Eclear function.
+ */
+ if(H5Eclear2(H5E_DEFAULT) < 0)
+ HGOTO_DONE(FAIL)
+
+done:
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -59,26 +59,28 @@ nh5eclear_c( )
int_f
nh5eprint_c1(_fcd name, int_f* namelen)
{
- int ret_val = -1;
- herr_t status;
- FILE * file;
- char* c_name;
- size_t c_namelen;
- c_namelen = *namelen;
- c_name = (char*)HD5f2cstring(name, c_namelen);
- if(c_name == NULL) return ret_val;
- file = fopen(c_name, "a");
- if(!file) goto DONE;
- /*
- * Call H5Eprint2 function.
- */
- status = H5Eprint2(H5E_DEFAULT, file);
- if (status >=0 ) ret_val = 0;
- fclose(file);
-
-DONE:
- HDfree(c_name);
- return ret_val;
+ FILE *file = NULL;
+ char *c_name = NULL;
+ int_f ret_value = 0;
+
+ if(NULL == (c_name = (char*)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
+ if(NULL == (file = HDfopen(c_name, "a")))
+ HGOTO_DONE(FAIL)
+
+ /*
+ * Call H5Eprint2 function.
+ */
+ if(H5Eprint2(H5E_DEFAULT, file) < 0)
+ HGOTO_DONE(FAIL)
+
+done:
+ if(file)
+ HDfclose(file);
+ if(c_name)
+ HDfree(c_name);
+
+ return ret_value;
}
@@ -94,17 +96,18 @@ DONE:
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5eprint_c2()
+nh5eprint_c2(void)
{
- int ret_val = -1;
- herr_t status;
-
- /*
- * Call H5Eprint2 function.
- */
- status = H5Eprint2(H5E_DEFAULT, NULL);
- if(status >= 0) ret_val = 0;
- return ret_val;
+ int_f ret_value = 0;
+
+ /*
+ * Call H5Eprint2 function.
+ */
+ if(H5Eprint2(H5E_DEFAULT, NULL) < 0)
+ HGOTO_DONE(FAIL)
+
+done:
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -121,24 +124,28 @@ nh5eprint_c2()
int_f
nh5eget_major_c(int_f* error_no, _fcd name, size_t_f* namelen)
{
- int ret_val = -1;
- char *c_name = NULL;
- size_t c_namelen;
- hid_t c_error_no;
- c_error_no = (hid_t)*error_no;
-
- c_namelen = (size_t)*namelen;
- if(c_namelen) c_name = (char*) HDmalloc(c_namelen + 1);
-
- /*
- * Call H5Eget_major function.
- */
- H5Eget_msg(c_error_no, NULL, c_name, c_namelen);
- HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen);
-
- if(!strcmp(c_name, "Invalid major error number")) return ret_val;
- ret_val = 0;
- return ret_val;
+ char *c_name = NULL;
+ size_t c_namelen = (size_t)*namelen;
+ int_f ret_value = 0;
+
+ if(c_namelen) {
+ if(NULL == (c_name = (char *)HDmalloc(c_namelen + 1)))
+ HGOTO_DONE(FAIL)
+ } /* end if */
+
+ /*
+ * Call H5Eget_major function.
+ */
+ H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen);
+ HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen);
+ if(!HDstrcmp(c_name, "Invalid major error number"))
+ HGOTO_DONE(FAIL)
+
+done:
+ if(c_name)
+ HDfree(c_name);
+
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -155,24 +162,28 @@ nh5eget_major_c(int_f* error_no, _fcd name, size_t_f* namelen)
int_f
nh5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen)
{
- int ret_val = -1;
- char *c_name = NULL;
- size_t c_namelen;
- hid_t c_error_no;
- c_error_no = (hid_t)*error_no;
-
- c_namelen = (size_t)*namelen;
- if(c_namelen) c_name = (char*) HDmalloc(c_namelen + 1);
-
- /*
- * Call H5Eget_minor function.
- */
- H5Eget_msg(c_error_no, NULL, c_name, c_namelen);
- HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen);
-
- if(!strcmp(c_name, "Invalid minor error number")) return ret_val;
- ret_val = 0;
- return ret_val;
+ char *c_name = NULL;
+ size_t c_namelen = (size_t)*namelen;
+ int_f ret_value = 0;
+
+ if(c_namelen) {
+ if(NULL == (c_name = (char *)HDmalloc(c_namelen + 1)))
+ HGOTO_DONE(FAIL)
+ } /* end if */
+
+ /*
+ * Call H5Eget_minor function.
+ */
+ H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen);
+ HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen);
+ if(!HDstrcmp(c_name, "Invalid minor error number"))
+ HGOTO_DONE(FAIL)
+
+done:
+ if(c_name)
+ HDfree(c_name);
+
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -188,13 +199,17 @@ nh5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen)
int_f
nh5eset_auto_c(int_f* printflag)
{
- int ret_val = -1;
- herr_t status = -1;
-
- if (*printflag == 1)
- status = H5Eset_auto2(H5E_DEFAULT, H5Eprint2, stderr);
- else if (*printflag == 0)
- status = H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
- if (status >= 0) ret_val = 0;
- return ret_val;
+ herr_t status = -1;
+ int_f ret_value = 0;
+
+ if(*printflag == 1)
+ status = H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, stderr);
+ else if(*printflag == 0)
+ status = H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+ if(status < 0)
+ HGOTO_DONE(FAIL)
+
+done:
+ return ret_value;
}
+