diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2009-05-13 19:10:25 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2009-05-13 19:10:25 (GMT) |
commit | 8745d8b7cceee7c72f3d445808a110ad7ba71a30 (patch) | |
tree | a913a4236cab3a0e81b4fb65bc92919a1f4d84d2 /hl/fortran/test/tstlite.f90 | |
parent | c7741d35374aa20a2bb7e25f2511228e8a8fcfb5 (diff) | |
download | hdf5-8745d8b7cceee7c72f3d445808a110ad7ba71a30.zip hdf5-8745d8b7cceee7c72f3d445808a110ad7ba71a30.tar.gz hdf5-8745d8b7cceee7c72f3d445808a110ad7ba71a30.tar.bz2 |
[svn-r16947] 1. #1522 (B1) h5ltread_dataset_string_f error with g95
ISSUE: h5ltread_dataset_string_f causes library assertion with g95.
SOLUTION: convert the fortran string buffer to a C buffer with HD5f2cstring, and pass this string to the C function
TEST: added a test call in the fortran test lite program
DOCS: added the note in RELEASE.txt "- Lite: the h5ltread_dataset_string_f and h5ltget_attribute_string_f functions had memory problems with the g95 fortran compiler. (PVN - 5/13/2009) 1522
Diffstat (limited to 'hl/fortran/test/tstlite.f90')
-rw-r--r-- | hl/fortran/test/tstlite.f90 | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/hl/fortran/test/tstlite.f90 b/hl/fortran/test/tstlite.f90 index 9332c10..168bb99 100644 --- a/hl/fortran/test/tstlite.f90 +++ b/hl/fortran/test/tstlite.f90 @@ -717,6 +717,40 @@ end do call passed() + +!------------------------------------------------------------------------- +! string +!------------------------------------------------------------------------- + +call test_begin(' Make/Read datasets (string) ') + + +! +! write dataset. +! +call h5ltmake_dataset_string_f(file_id, dsetname5, buf1, errcode) + +! +! read dataset. +! +call h5ltread_dataset_string_f(file_id, dsetname5, buf1r, errcode) + +! +! compare read and write buffers. +! +if ( buf1 .ne. buf1r ) then + print *, 'read buffer differs from write buffer' + print *, buf1, ' and ', buf1r + stop +endif + +call passed() + + + + + + call test_begin(' Get dataset dimensions/info ') !------------------------------------------------------------------------- @@ -799,8 +833,8 @@ character(LEN=5), parameter :: attrname2 = "attr2" ! Attribute name character(LEN=5), parameter :: attrname3 = "attr3" ! Attribute name character(LEN=5), parameter :: attrname4 = "attr4" ! Attribute name character(LEN=5), parameter :: attrname5 = "attr5" ! Attribute name -character(LEN=9), parameter :: buf1 = "mystring" ! Data buffer -character(LEN=9) :: bufr1 ! Data buffer +character(LEN=8), parameter :: buf1 = "mystring" ! Data buffer +character(LEN=8) :: bufr1 ! Data buffer integer, dimension(DIM1) :: buf2 ! Data buffer integer, dimension(DIM1) :: bufr2 ! Data buffer real, dimension(DIM1) :: buf3 ! Data buffer @@ -936,6 +970,38 @@ end do call passed() + + +!------------------------------------------------------------------------- +! string +!------------------------------------------------------------------------- + +call test_begin(' Set/Get attributes string ') + + +! +! write attribute. +! +call h5ltset_attribute_string_f(file_id,dsetname1,attrname5,buf1,errcode) + +! +! read attribute. +! +call h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1,errcode) + +! +! compare read and write buffers. +! + +if ( buf1 .ne. bufr1 ) then + print *, 'read buffer differs from write buffer' + print *, buf1, ' and ', bufr1 + stop + endif + + +call passed() + !------------------------------------------------------------------------- ! get attribute rank !------------------------------------------------------------------------- |