summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2015-03-09 15:51:09 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2015-03-09 15:51:09 (GMT)
commit1f4f709e8cdfaa4bc35d58c665008793d7e1cca1 (patch)
tree1e6de1167338d6b57b43ba6ce1d8f0852f05d324 /fortran/src
parent2a4ea9b24e5d28598b627fca39fb42a9baedfaa3 (diff)
downloadhdf5-1f4f709e8cdfaa4bc35d58c665008793d7e1cca1.zip
hdf5-1f4f709e8cdfaa4bc35d58c665008793d7e1cca1.tar.gz
hdf5-1f4f709e8cdfaa4bc35d58c665008793d7e1cca1.tar.bz2
[svn-r26401] Fixed warnings in the C stubs for Fortran wrappers. See Crucible review HDF5-238.
Tested on platypus with gcc/gfortran 4.9.2, jam and emu with the default compilers.
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/H5Af.c6
-rw-r--r--fortran/src/H5Df.c26
-rw-r--r--fortran/src/H5Gf.c37
-rw-r--r--fortran/src/H5Rf.c4
4 files changed, 53 insertions, 20 deletions
diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c
index 8291320..240fbc3 100644
--- a/fortran/src/H5Af.c
+++ b/fortran/src/H5Af.c
@@ -1652,7 +1652,7 @@ nh5aget_info_c (hid_t_f *loc_id, int_f *corder_valid, int_f *corder,
*corder = (int_f)ainfo.corder;
*cset = (int_f)ainfo.cset;
- *data_size = (hsize_t)ainfo.data_size;
+ *data_size = (hsize_t_f)ainfo.data_size;
done:
return ret_value;
@@ -1728,7 +1728,7 @@ nh5aget_info_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
*corder_valid = 1;
*corder = (int_f)ainfo.corder;
*cset = (int_f)ainfo.cset;
- *data_size = (hsize_t)ainfo.data_size;
+ *data_size = (hsize_t_f)ainfo.data_size;
done:
if(c_obj_name)
@@ -1797,7 +1797,7 @@ nh5aget_info_by_name_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
*corder_valid = 1;
*corder = (int_f)ainfo.corder;
*cset = (int_f)ainfo.cset;
- *data_size = (hsize_t)ainfo.data_size;
+ *data_size = (hsize_t_f)ainfo.data_size;
done:
if(c_obj_name)
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c
index ecfa946..a108384 100644
--- a/fortran/src/H5Df.c
+++ b/fortran/src/H5Df.c
@@ -621,7 +621,7 @@ nh5dwrite_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_
hid_t c_file_space_id;
hid_t c_xfer_prp;
hobj_ref_t *buf_c;
- int i, n;
+ unsigned int i, n;
/*
* Define transfer property
@@ -631,7 +631,7 @@ nh5dwrite_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_
/*
* Allocate temporary buffer and copy references from Fortran.
*/
- n = (int)*dims;
+ n = (unsigned int)*dims;
buf_c = (hobj_ref_t*)HDmalloc(sizeof(hobj_ref_t)*(n));
if ( buf_c != NULL ) {
for (i = 0; i < n; i++)
@@ -688,9 +688,9 @@ nh5dwrite_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_
hid_t c_file_space_id;
hid_t c_xfer_prp;
hdset_reg_ref_t *buf_c = NULL;
- int i, n;
+ unsigned int i, n;
- n = (int)*dims;
+ n = (unsigned int)*dims;
/*
* Define transfer property
*/
@@ -1494,7 +1494,7 @@ nh5dset_extent_c ( hid_t_f *dset_id , hsize_t_f *dims)
* Reverse dimensions due to C-FORTRAN storage order.
*/
for(i = 0; i < rank; i++)
- c_dims[i] = dims[rank - i - 1];
+ c_dims[i] = (hsize_t)dims[rank - i - 1];
status = H5Dset_extent((hid_t)*dset_id, c_dims);
@@ -1642,7 +1642,7 @@ nh5dwrite_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_
hsize_t num_elem;
max_len = (size_t)dims[0];
- num_elem = dims[1];
+ num_elem = (hsize_t)dims[1];
c_dset_id = (hid_t)*dset_id;
c_mem_type_id = (hid_t)*mem_type_id;
@@ -1711,7 +1711,7 @@ nh5dread_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_s
size_t max_len;
hvl_t *c_buf;
- hssize_t i;
+ hsize_t i;
hssize_t num_elem;
c_dset_id = (hid_t)*dset_id;
@@ -1731,7 +1731,7 @@ nh5dread_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_s
*/
status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
if ( status < 0 ) goto DONE;
- for (i=0; i < num_elem; i++) {
+ for (i=0; i < (hsize_t)num_elem; i++) {
len[i] = (size_t_f)c_buf[i].len;
memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(int_f));
}
@@ -1786,7 +1786,7 @@ nh5dwrite_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_sp
hsize_t num_elem;
max_len = (size_t)dims[0];
- num_elem = dims[1];
+ num_elem = (hsize_t)dims[1];
c_dset_id = (hid_t)*dset_id;
c_mem_type_id = (hid_t)*mem_type_id;
@@ -1873,7 +1873,7 @@ nh5dread_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa
hsize_t num_elem;
max_len = (size_t)dims[0];
- num_elem = dims[1];
+ num_elem = (hsize_t)dims[1];
c_dset_id = (hid_t)*dset_id;
c_mem_type_id = (hid_t)*mem_type_id;
@@ -1957,7 +1957,7 @@ nh5dwrite_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa
hsize_t num_elem;
max_len = (size_t)dims[0];
- num_elem = dims[1];
+ num_elem = (hsize_t)dims[1];
c_dset_id = (hid_t)*dset_id;
c_mem_type_id = (hid_t)*mem_type_id;
@@ -2026,7 +2026,7 @@ nh5dread_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spac
size_t max_len;
hvl_t *c_buf;
- hssize_t i;
+ hsize_t i;
hssize_t num_elem;
c_dset_id = (hid_t)*dset_id;
@@ -2046,7 +2046,7 @@ nh5dread_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spac
*/
status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
if ( status <0 ) goto DONE;
- for (i=0; i < num_elem; i++) {
+ for (i=0; i < (hsize_t)num_elem; i++) {
len[i] = (size_t_f)c_buf[i].len;
memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(real_f));
}
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c
index 5ebb3e7..ad3ea49 100644
--- a/fortran/src/H5Gf.c
+++ b/fortran/src/H5Gf.c
@@ -178,7 +178,7 @@ nh5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx,
char *c_name = NULL;
size_t c_obj_namelen;
char *c_obj_name = NULL;
- hsize_t c_idx = *idx;
+ hsize_t c_idx = (hsize_t)*idx;
hid_t gid = (-1); /* Temporary group ID */
int ret_value = -1;
@@ -191,7 +191,7 @@ nh5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx,
/*
* Allocate buffer to hold name of the object
*/
- c_obj_namelen = *obj_namelen;
+ c_obj_namelen = (size_t)*obj_namelen;
if(c_obj_namelen)
if(NULL == (c_obj_name = (char *)HDmalloc(c_obj_namelen + 1)))
goto DONE;
@@ -352,6 +352,23 @@ nh5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name,
goto DONE;
break;
+ /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */
+ case H5L_TYPE_EXTERNAL:
+ ret_value = -1;
+ goto DONE;
+ break;
+
+ case H5L_TYPE_MAX:
+ ret_value = -1;
+ goto DONE;
+ break;
+
+ case H5L_TYPE_ERROR:
+ ret_value = -1;
+ goto DONE;
+ break;
+ /* End of the warnings fix */
+
default: /* Unknown/unhandled link type */
goto DONE;
} /* end switch */
@@ -421,6 +438,22 @@ nh5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen,
if(H5Lcreate_soft(c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto DONE;
break;
+ /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */
+ case H5L_TYPE_EXTERNAL:
+ ret_value = -1;
+ goto DONE;
+ break;
+
+ case H5L_TYPE_MAX:
+ ret_value = -1;
+ goto DONE;
+ break;
+
+ case H5L_TYPE_ERROR:
+ ret_value = -1;
+ goto DONE;
+ break;
+ /* End of the warnings fix */
default: /* Unknown/unhandled link type */
goto DONE;
diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c
index e35de21..19fa6b1 100644
--- a/fortran/src/H5Rf.c
+++ b/fortran/src/H5Rf.c
@@ -153,7 +153,7 @@ h5rcreate_ptr_c (void *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *r
/*
* Convert FORTRAN name to C name
*/
- c_namelen = *namelen;
+ c_namelen = (size_t)*namelen;
c_name = (char *)HD5f2cstring(name, c_namelen);
if (c_name == NULL) return ret_value;
@@ -567,7 +567,7 @@ h5rget_name_ptr_c (hid_t_f *loc_id, int_f *ref_type, void *ref, _fcd name, size_
/*
* Allocate buffer to hold name of an attribute
*/
- if ((c_buf = HDmalloc(c_bufsize)) == NULL)
+ if ((c_buf = (char *)HDmalloc(c_bufsize)) == NULL)
return ret_value;
/*