diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2009-05-13 19:29:07 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2009-05-13 19:29:07 (GMT) |
commit | 0423a2ce6e5052ee838aa8be2b33f4ee78d62a5a (patch) | |
tree | e7488faa51aba8302dc05c75b7014e72788bb215 /hl/fortran/test | |
parent | 8e0bce9dabef2d78e11d7c12e83bb2789acac756 (diff) | |
download | hdf5-0423a2ce6e5052ee838aa8be2b33f4ee78d62a5a.zip hdf5-0423a2ce6e5052ee838aa8be2b33f4ee78d62a5a.tar.gz hdf5-0423a2ce6e5052ee838aa8be2b33f4ee78d62a5a.tar.bz2 |
[svn-r16948] merge 16947
#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
tested: linux g95, windows fortran intel 11
Diffstat (limited to 'hl/fortran/test')
-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 !------------------------------------------------------------------------- |