summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2013-03-05 05:06:59 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2013-03-05 05:06:59 (GMT)
commitebb18c51862f36cfad5da44a5fb42d18f9a44856 (patch)
treeed1622c74ca6a21f8a409d41e871fe80dbea9acb /fortran/src
parent1cffcb401afa5ec6f7a6135bf107b190fa75ccdf (diff)
downloadhdf5-ebb18c51862f36cfad5da44a5fb42d18f9a44856.zip
hdf5-ebb18c51862f36cfad5da44a5fb42d18f9a44856.tar.gz
hdf5-ebb18c51862f36cfad5da44a5fb42d18f9a44856.tar.bz2
[svn-r23325] Description
------------ Fix for: HDFFV-8149: h5pset_external_f API - the offset is declared integer which can cause problem if use 64-bit integer Added new type off_t, modified source files and added a new test. Tested (jam, intel, gnu)
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/H5Pf.c38
-rw-r--r--fortran/src/H5Pff.f9021
-rw-r--r--fortran/src/H5f90proto.h4
-rw-r--r--fortran/src/H5match_types.c13
4 files changed, 46 insertions, 30 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index 6fc8487..dba2aa4 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1937,28 +1937,29 @@ DONE:
/****if* H5Pf/h5pset_external_c
* NAME
- * h5pset_external_c
+ * h5pset_external_c
* PURPOSE
- * Call H5Pset_external to add an external file to the
- * list of external files.
+ * Call H5Pset_external to add an external file to the
+ * list of external files.
* INPUTS
- * prp_id - property list identifier
- * name - Name of an external file
- * namelen - length of name
- * offset - Offset, in bytes, from the beginning of the file
- * to the location in the file where the data starts.
- * bytes - Number of bytes reserved in the file for the data.
+ * prp_id - property list identifier
+ * name - Name of an external file
+ * namelen - length of name
+ * offset - Offset, in bytes, from the beginning of the file
+ * to the location in the file where the data starts.
+ * bytes - Number of bytes reserved in the file for the data.
* RETURNS
- * 0 on success, -1 on failure
+ * 0 on success, -1 on failure
* AUTHOR
* Xiangyang Su
- * Wednesday, February 23, 2000
+ * Wednesday, February 23, 2000
* HISTORY
- *
+ * Changed type of 'offset' from int_f to off_t_f -- MSB January 9, 2012
+ *
* SOURCE
*/
int_f
-nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, hsize_t_f*bytes)
+nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, off_t_f* offset, hsize_t_f*bytes)
/******/
{
int ret_value = -1;
@@ -2029,14 +2030,14 @@ nh5pget_external_count_c (hid_t_f *prp_id, int_f* count)
/****if* H5Pf/h5pget_external_c
* NAME
- * h5pget_external_c
+ * h5pget_external_c
* PURPOSE
- * Call H5Pget_external to get nformation about an external file.
+ * Call H5Pget_external to get nformation about an external file.
* INPUTS
* prp_id - property list identifier
* name_size - length of name
* idx - External file index.
- *OUTPUT
+ * OUTPUT
* name - Name of an external file
* offset - Offset, in bytes, from the beginning of the file
* to the location in the file where the data starts.
@@ -2047,11 +2048,12 @@ nh5pget_external_count_c (hid_t_f *prp_id, int_f* count)
* Xiangyang Su
* Wednesday, February 23, 2000
* HISTORY
+ * Changed type of 'offset' from integer to off_t -- MSB January 9, 2012
*
* SOURCE
*/
int_f
-nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, int_f* offset, hsize_t_f*bytes)
+nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, off_t_f* offset, hsize_t_f*bytes)
/******/
{
int ret_value = -1;
@@ -2079,7 +2081,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name,
if (status < 0) goto DONE;
- *offset = (int_f)c_offset;
+ *offset = (off_t_f)c_offset;
*bytes = (hsize_t_f)size;
/* Note: if the size of the fortran buffer is larger then the returned string
* from the function then we need to give HD5packFstring the fortran buffer size so
diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90
index 203460a..a3c9a60 100644
--- a/fortran/src/H5Pff.f90
+++ b/fortran/src/H5Pff.f90
@@ -2329,14 +2329,16 @@ CONTAINS
! HISTORY
! Explicit Fortran interfaces were added for
! called C functions (it is needed for Windows
-! port). March 14, 2001
+! port). March 14, 2001
+!
+! Changed type of 'offset' from integer to off_t -- MSB January 9, 2012
!
! Fortran90 Interface:
- SUBROUTINE h5pset_external_f(prp_id, name, offset,bytes, hdferr)
+ SUBROUTINE h5pset_external_f(prp_id, name, offset, bytes, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Name of an external file
- INTEGER, INTENT(IN) :: offset ! Offset, in bytes, from the beginning
+ INTEGER(OFF_T), INTENT(IN) :: offset ! Offset, in bytes, from the beginning
! of the file to the location in the file
! where the data starts.
INTEGER(HSIZE_T), INTENT(IN) :: bytes ! Number of bytes reserved in the
@@ -2347,9 +2349,6 @@ CONTAINS
INTEGER :: namelen
-! INTEGER, EXTERNAL :: h5pset_external_c
-! MS FORTRAN needs explicit interface for C functions called here.
-!
INTERFACE
INTEGER FUNCTION h5pset_external_c(prp_id, name,namelen, offset, bytes)
USE H5GLOBAL
@@ -2360,7 +2359,7 @@ CONTAINS
INTEGER(HID_T), INTENT(IN) :: prp_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER :: namelen
- INTEGER, INTENT(IN) :: offset
+ INTEGER(OFF_T), INTENT(IN) :: offset
INTEGER(HSIZE_T), INTENT(IN) :: bytes
END FUNCTION h5pset_external_c
END INTERFACE
@@ -2453,7 +2452,9 @@ CONTAINS
! HISTORY
! Explicit Fortran interfaces were added for
! called C functions (it is needed for Windows
-! port). March 14, 2001
+! port). March 14, 2001
+!
+! Changed type of 'offset' from integer to off_t -- MSB January 9, 2012
!
! Fortran90 Interface:
SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset,bytes, hdferr)
@@ -2462,7 +2463,7 @@ CONTAINS
INTEGER, INTENT(IN) :: idx ! External file index.
INTEGER(SIZE_T), INTENT(IN) :: name_size ! Maximum length of name array
CHARACTER(LEN=*), INTENT(OUT) :: name ! Name of an external file
- INTEGER, INTENT(OUT) :: offset ! Offset, in bytes, from the beginning
+ INTEGER(OFF_T), INTENT(OUT) :: offset ! Offset, in bytes, from the beginning
! of the file to the location in the file
! where the data starts.
INTEGER(HSIZE_T), INTENT(OUT) :: bytes ! Number of bytes reserved in the
@@ -2485,7 +2486,7 @@ CONTAINS
INTEGER, INTENT(IN) :: idx
INTEGER(SIZE_T), INTENT(IN) :: name_size
CHARACTER(LEN=*), INTENT(OUT) :: name
- INTEGER, INTENT(OUT) :: offset
+ INTEGER(OFF_T), INTENT(OUT) :: offset
INTEGER(HSIZE_T), INTENT(OUT) :: bytes
END FUNCTION h5pget_external_c
END INTERFACE
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 53b6874..4b02b6c 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -1065,9 +1065,9 @@ H5_FCDLL int_f nh5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags
H5_FCDLL int_f nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters);
H5_FCDLL int_f nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id);
H5_FCDLL 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);
-H5_FCDLL int_f nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, hsize_t_f*bytes);
+H5_FCDLL int_f nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, off_t_f* offset, hsize_t_f*bytes);
H5_FCDLL int_f nh5pget_external_count_c (hid_t_f *prp_id, int_f* count);
-H5_FCDLL int_f nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, int_f* offset, hsize_t_f*bytes);
+H5_FCDLL int_f nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, off_t_f* offset, hsize_t_f*bytes);
H5_FCDLL int_f nh5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right);
H5_FCDLL int_f nh5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right);
H5_FCDLL int_f nh5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info);
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 4c83d21..eb30775 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -321,6 +321,19 @@ int main(void)
return -1;
#endif
+ /* off_t */
+#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_OFF_T >= 8
+ writeToFiles("OFF_T", "off_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND);
+#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_OFF_T >= 4
+ writeToFiles("OFF_T", "off_t_f", 4, H5_FORTRAN_HAS_INTEGER_4_KIND);
+#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_OFF_T >= 2
+ writeToFiles("OFF_T", "off_t_f", 2, H5_FORTRAN_HAS_INTEGER_2_KIND);
+#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_OFF_T >= 1
+ writeToFiles("OFF_T", "off_t_f", 1, H5_FORTRAN_HAS_INTEGER_1_KIND);
+#else
+ /* Error: couldn't find a size for off_t */
+ return -1;
+#endif
/* size_t */
#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_SIZE_T >= 8