summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Pf.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-18 16:10:46 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-18 16:10:46 (GMT)
commitb0eb42058c02bff41cacae11880b4fbf174821db (patch)
treec389ee389c680cccbd2a5c5f11107b588f4bcfa0 /fortran/src/H5Pf.c
parentdcf8866b6af90aa0bf50ebeceda6b0f184a07c17 (diff)
downloadhdf5-b0eb42058c02bff41cacae11880b4fbf174821db.zip
hdf5-b0eb42058c02bff41cacae11880b4fbf174821db.tar.gz
hdf5-b0eb42058c02bff41cacae11880b4fbf174821db.tar.bz2
[svn-r14208] Description:
Make H5Pget_filter_by_id() API versioned and switch internal usage to H5Pget_filter_by_id2(). Add simple regression test for H5Pget_filter_by_id1(). Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'fortran/src/H5Pf.c')
-rw-r--r--fortran/src/H5Pf.c54
1 files changed, 24 insertions, 30 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index 02864fe..f674530 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1550,7 +1550,7 @@ nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f*
unsigned i;
int ret_value = -1;
- if(NULL == (c_name = (char *)malloc((size_t)*namelen)))
+ if(NULL == (c_name = (char *)malloc((size_t)*namelen + 1)))
goto DONE;
if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * c_cd_nelmts_in)))
@@ -3277,9 +3277,10 @@ nh5pall_filters_avail_c ( hid_t_f *prp_id , int_f *status)
ret_value = 0;
return ret_value;
}
+
/*----------------------------------------------------------------------------
* Name: h5pget_filter_by_id_c
- * Purpose: Call H5Pget_filter_by_id to get information about a filter
+ * Purpose: Call H5Pget_filter_by_id2 to get information about a filter
* in a pipeline
* Inputs: prp_id - property list identifier
* filter_id - filter id
@@ -3297,49 +3298,42 @@ nh5pall_filters_avail_c ( hid_t_f *prp_id , int_f *status)
int_f
nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name)
{
- int_f ret_value = -1;
- hid_t c_prp_id;
- H5Z_filter_t c_filter_id;
- unsigned int c_flags;
- size_t c_cd_nelmts, c_namelen;
- size_t c_cd_nelmts_in;
- unsigned int * c_cd_values;
- char* c_name;
+ unsigned int c_flags;
+ size_t c_cd_nelmts = (size_t)*cd_nelmts;
+ size_t c_cd_nelmts_in = (size_t)*cd_nelmts;
+ unsigned int *c_cd_values = NULL;
+ char *c_name = NULL;
unsigned i;
- herr_t status;
- c_cd_nelmts_in = (size_t)*cd_nelmts;
- c_cd_nelmts = (size_t)*cd_nelmts;
- c_namelen = (size_t)*namelen + 1;
- c_name = (char*)malloc(sizeof(char)*c_namelen);
- if (!c_name) return ret_value;
+ int_f ret_value = -1;
- c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts_in));
- if (!c_cd_values) {HDfree(c_name);
- return ret_value;
- }
+ if(NULL == (c_name = (char *)malloc((size_t)*namelen + 1)))
+ goto DONE;
+ if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * ((int)c_cd_nelmts_in))))
+ goto DONE;
/*
- * Call H5Pget_filter_by_id function.
+ * Call H5Pget_filter_by_id2 function.
*/
- c_prp_id = (hid_t)*prp_id;
- c_filter_id = (H5Z_filter_t)*filter_id;
- status = H5Pget_filter_by_id(c_prp_id, c_filter_id, &c_flags, &c_cd_nelmts, c_cd_values, c_namelen, c_name, NULL);
- if (status < 0) goto DONE;
+ if(H5Pget_filter_by_id2((hid_t)*prp_id, (H5Z_filter_t)*filter_id, &c_flags, &c_cd_nelmts, c_cd_values, (size_t)*namelen, c_name, NULL) < 0)
+ goto DONE;
*cd_nelmts = (size_t_f)c_cd_nelmts;
*flags = (int_f)c_flags;
- HD5packFstring(c_name, _fcdtocp(name), strlen(c_name));
+ HD5packFstring(c_name, _fcdtocp(name), HDstrlen(c_name));
- for (i = 0; i < c_cd_nelmts_in; i++)
+ for(i = 0; i < c_cd_nelmts_in; i++)
cd_values[i] = (int_f)c_cd_values[i];
ret_value = 0;
DONE:
- HDfree(c_name);
- HDfree(c_cd_values);
- return ret_value;
+ if(c_name)
+ HDfree(c_name);
+ if(c_cd_values)
+ HDfree(c_cd_values);
+
+ return ret_value;
}
/*----------------------------------------------------------------------------