summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-06-13 15:31:14 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-06-13 15:31:14 (GMT)
commite5d1da02244603f19e165c573326835f7a634b47 (patch)
treea1db74ff9e2ae82fc6b1a000a81ebee454970a46 /fortran
parentc348d7d6062f34554f8d432ea9d80bf2c936c734 (diff)
downloadhdf5-e5d1da02244603f19e165c573326835f7a634b47.zip
hdf5-e5d1da02244603f19e165c573326835f7a634b47.tar.gz
hdf5-e5d1da02244603f19e165c573326835f7a634b47.tar.bz2
fixed invalid pointer
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5VLff.F903
-rw-r--r--fortran/test/vol_connector.F9027
2 files changed, 22 insertions, 8 deletions
diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90
index 0c5e8fd..9abc157 100644
--- a/fortran/src/H5VLff.F90
+++ b/fortran/src/H5VLff.F90
@@ -232,7 +232,8 @@ CONTAINS
hdferr = 0
IF(PRESENT(name_len))THEN
- name_len = INT(H5VLget_connector_name(obj_id, c_name, 0_SIZE_T), SIZE_T)
+ c_name(1:1)(1:1) = C_NULL_CHAR
+ name_len = INT(H5VLget_connector_name(obj_id, c_name, 1_SIZE_T), SIZE_T)
IF(name_len.LT.0) hdferr = H5I_INVALID_HID_F
ELSE
l = INT(LEN(name)+1,SIZE_T)
diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90
index 94f572b..623767b 100644
--- a/fortran/test/vol_connector.F90
+++ b/fortran/test/vol_connector.F90
@@ -55,9 +55,10 @@ CONTAINS
LOGICAL :: is_registered = .FALSE.
INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1
CHARACTER(LEN=64) :: name
+ CHARACTER(LEN=1) :: name_null
+ CHARACTER(LEN=6) :: name_exact
INTEGER(SIZE_T) :: name_len
INTEGER(hid_t) :: file_id
- INTEGER :: cmp = -1
! The null VOL connector should not be registered at the start of the test
CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error)
@@ -87,6 +88,22 @@ CONTAINS
CALL check("H5VLget_connector_name_f",error,total_error)
CALL VERIFY("H5VLget_connector_name_f", name, NATIVE_VOL_CONNECTOR_NAME, total_error)
+ CALL H5VLget_connector_name_f(file_id, name_null, error, name_len)
+ CALL check("H5VLget_connector_name_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error)
+
+ CALL H5VLget_connector_name_f(file_id, name_null, error)
+ CALL check("H5VLget_connector_name_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_name_f", name_null, NATIVE_VOL_CONNECTOR_NAME(1:1), total_error)
+
+ CALL H5VLget_connector_name_f(file_id, name_exact, error, name_len)
+ CALL check("H5VLget_connector_name_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error)
+
+ CALL H5VLget_connector_name_f(file_id, name_exact, error)
+ CALL check("H5VLget_connector_name_f",error,total_error)
+ CALL VERIFY("H5VLget_connector_name_f", name_exact, NATIVE_VOL_CONNECTOR_NAME, total_error)
+
CALL H5Fclose_f(file_id, error)
CALL check("H5Fclose_f",error,total_error)
@@ -149,19 +166,15 @@ CONTAINS
LOGICAL :: is_registered = .FALSE.
INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1
- CHARACTER(LEN=64) :: name
- INTEGER(SIZE_T) :: name_len
INTEGER(hid_t) :: file_id
- INTEGER :: cmp = -1
INTEGER(hid_t) :: fapl_id
TYPE(C_PTR) :: f_ptr
- INTEGER(hid_t), TARGET :: under_fapl
CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error)
+
CALL check("H5VLis_connector_registered_f",error,total_error)
CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error)
-
! The null VOL connector should not be registered at the start of the test
CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error)
CALL check("H5VLis_connector_registered_f",error,total_error)
@@ -169,7 +182,7 @@ CONTAINS
CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error)
CALL check("H5VLregister_connector_by_name_f",error,total_error)
-
+
! The connector should be registered now
CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error)
CALL check("H5VLis_connector_registered_f",error,total_error)