diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-04-10 20:19:35 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-04-10 20:19:35 (GMT) |
commit | 45f6d4c1eed29c45476970a9703304378a5a1073 (patch) | |
tree | 667240a5ea57e8a072bc8ffb59ecb7281867164c /hl/fortran | |
parent | ad4b4b2b90c340bb408ddf32dd5cae780547bad2 (diff) | |
parent | 09fa6e9c54380362f6f283ad60daef679ec91b25 (diff) | |
download | hdf5-45f6d4c1eed29c45476970a9703304378a5a1073.zip hdf5-45f6d4c1eed29c45476970a9703304378a5a1073.tar.gz hdf5-45f6d4c1eed29c45476970a9703304378a5a1073.tar.bz2 |
[svn-r22274] merge from trunk, resolve conflicts
Diffstat (limited to 'hl/fortran')
-rw-r--r--[-rwxr-xr-x] | hl/fortran/COPYING | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/examples/run-hlfortran-ex.sh.in | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5DSfc.c | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5DSff.f90 | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5IMfc.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5IMff.f90 | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5LTf90proto.h | 3 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5LTfc.c | 32 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5LTff.f90 | 16 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5TBfc.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/src/H5TBff.f90 | 0 | ||||
-rw-r--r-- | hl/fortran/src/Makefile.in | 2 | ||||
-rw-r--r-- | hl/fortran/test/tstds.f90 | 10 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/test/tstimage.f90 | 0 | ||||
-rw-r--r-- | hl/fortran/test/tstlite.f90 | 53 | ||||
-rw-r--r--[-rwxr-xr-x] | hl/fortran/test/tsttable.f90 | 0 |
16 files changed, 79 insertions, 41 deletions
diff --git a/hl/fortran/COPYING b/hl/fortran/COPYING index 6903daf..6903daf 100755..100644 --- a/hl/fortran/COPYING +++ b/hl/fortran/COPYING diff --git a/hl/fortran/examples/run-hlfortran-ex.sh.in b/hl/fortran/examples/run-hlfortran-ex.sh.in index 2780bff..2780bff 100755..100644 --- a/hl/fortran/examples/run-hlfortran-ex.sh.in +++ b/hl/fortran/examples/run-hlfortran-ex.sh.in diff --git a/hl/fortran/src/H5DSfc.c b/hl/fortran/src/H5DSfc.c index 6816347..3135cfa 100755..100644 --- a/hl/fortran/src/H5DSfc.c +++ b/hl/fortran/src/H5DSfc.c @@ -283,7 +283,7 @@ nh5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size) * Convert C name to FORTRAN and place it in the given buffer */ - HD5packFstring(c_label, _fcdtocp(label), (size_t)*size+1); + HD5packFstring(c_label, _fcdtocp(label), (size_t)*size); done: *size = (size_t_f)size_c; /* Don't subtract '1' because H5DSget_label doesn't include the @@ -332,7 +332,7 @@ nh5dsget_scale_name_c(hid_t_f *did, _fcd name, size_t_f *size) * Convert C name to FORTRAN and place it in the given buffer */ if(size_c != 0) { - HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size+1); + HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size); *size = (size_t_f)size_c-1; /* (-1) because we don't include the NULL ending in the length*/ } else { *size = (size_t_f)size_c; /* if NULL then no name was found */ diff --git a/hl/fortran/src/H5DSff.f90 b/hl/fortran/src/H5DSff.f90 index c3ec587..c3ec587 100755..100644 --- a/hl/fortran/src/H5DSff.f90 +++ b/hl/fortran/src/H5DSff.f90 diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index 818096e..818096e 100755..100644 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c diff --git a/hl/fortran/src/H5IMff.f90 b/hl/fortran/src/H5IMff.f90 index d78dc06..d78dc06 100755..100644 --- a/hl/fortran/src/H5IMff.f90 +++ b/hl/fortran/src/H5IMff.f90 diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 205871c..8618fc6 100755..100644 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -1140,7 +1140,8 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, _fcd dsetname, int_f *attrnamelen, _fcd attrname, - void *buf); + _fcd buf, + size_t_f *buf_size); HDF5_HL_F90CSTUBDLL int_f diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index c0b7695..674636d 100755..100644 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -17,8 +17,7 @@ #include "H5LTprivate.h" #include "H5LTf90proto.h" - - +#include "H5Eprivate.h" /*------------------------------------------------------------------------- * Function: H5LTmake_dataset_c @@ -1719,13 +1718,13 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, _fcd dsetname, int_f *attrnamelen, _fcd attrname, - void *buf) + _fcd buf, size_t_f *buf_size) { int ret_value = -1; herr_t ret; - hid_t c_loc_id; char *c_name = NULL; char *c_attrname = NULL; + char *c_buf = NULL; int c_namelen; int c_attrnamelen; @@ -1741,26 +1740,33 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) goto done; - /* - * Call H5LTget_attribute_int function. - */ - c_loc_id = (hid_t)*loc_id; - - ret = H5LTget_attribute_string(c_loc_id,c_name,c_attrname,buf); + * Allocate buffer to hold C attribute string + */ + if ((c_buf = HDmalloc((size_t)*buf_size + 1)) == NULL) + goto done; + /* + * Call H5LTget_attribute_int function. + */ + ret = H5LTget_attribute_string((hid_t)*loc_id,c_name,c_attrname,c_buf); if (ret < 0) goto done; - ret_value = 0; + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + HD5packFstring(c_buf, _fcdtocp(buf), (size_t)*buf_size); + ret_value = 0; done: if(c_name!=NULL) free(c_name); if(c_attrname!=NULL) free(c_attrname); - + if(c_buf!=NULL) + free(c_buf); return ret_value; } @@ -2157,7 +2163,7 @@ nh5ltpath_valid_c(hid_t_f *loc_id, /* * convert FORTRAN name to C name */ - if( NULL == (c_path = (char *)HD5f2cstring(path, (int)*pathlen))) + if( NULL == (c_path = (char *)HD5f2cstring(path, (size_t)*pathlen))) goto done; check_object_valid = FALSE; diff --git a/hl/fortran/src/H5LTff.f90 b/hl/fortran/src/H5LTff.f90 index 7d53ab7..0302b61 100755..100644 --- a/hl/fortran/src/H5LTff.f90 +++ b/hl/fortran/src/H5LTff.f90 @@ -5969,9 +5969,10 @@ CONTAINS CHARACTER(len=*), INTENT(inout) :: buf ! data buffer INTEGER :: namelen ! name length INTEGER :: attrlen ! name length + INTEGER(size_t) :: buf_size ! buf size INTERFACE - INTEGER FUNCTION h5ltget_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buf) + INTEGER FUNCTION h5ltget_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buf,buf_size) USE h5global !DEC$IF DEFINED(HDF5F90_WINDOWS) !DEC$ATTRIBUTES C,reference,decorate,alias:'H5LTGET_ATTRIBUTE_STRING_C'::h5ltget_attribute_string_c @@ -5984,12 +5985,15 @@ CONTAINS CHARACTER(len=*), INTENT(in) :: dset_name ! name of the dataset CHARACTER(len=*), INTENT(in) :: attr_name ! name of the attribute CHARACTER(len=*), INTENT(inout) :: buf ! data buffer + INTEGER(size_t) :: buf_size ! data buffer size END FUNCTION h5ltget_attribute_string_c END INTERFACE namelen = LEN(dset_name) attrlen = LEN(attr_name) - errcode = h5ltget_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buf) + buf_size = LEN(buf) + + errcode = h5ltget_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buf,buf_size) END SUBROUTINE h5ltget_attribute_string_f @@ -6335,7 +6339,7 @@ CONTAINS !DEC$attributes dllexport :: h5ltpath_valid_f !DEC$endif ! - INTEGER(hid_t) , INTENT(IN) :: loc_id ! File or group identifier. + INTEGER(hid_t) , INTENT(IN) :: loc_id ! An identifier of an object in the file. CHARACTER(LEN=*), INTENT(IN) :: path ! Path to the object to check, relative to loc_id. LOGICAL , INTENT(IN) :: check_object_valid ! Indicates whether to check if the final component ! of the path resolves to a valid object @@ -6360,14 +6364,16 @@ CONTAINS END FUNCTION h5ltpath_valid_c END INTERFACE + ! Initialize + path_valid = .FALSE. + errcode = 0 + check_object_valid_c = 0 IF(check_object_valid) check_object_valid_c = 1 pathlen = LEN(path) status = h5ltpath_valid_c(loc_id, path, pathlen, check_object_valid_c) - path_valid = .FALSE. - errcode = 0 IF(status.EQ.1)THEN path_valid = .TRUE. ELSE IF(status.LT.0)THEN diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index 0efc9a8..0efc9a8 100755..100644 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c diff --git a/hl/fortran/src/H5TBff.f90 b/hl/fortran/src/H5TBff.f90 index 36e13f9..36e13f9 100755..100644 --- a/hl/fortran/src/H5TBff.f90 +++ b/hl/fortran/src/H5TBff.f90 diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 62d7309..afefdc7 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -436,7 +436,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 102 +LT_VERS_REVISION = 104 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/fortran/test/tstds.f90 b/hl/fortran/test/tstds.f90 index 8817989..c73e1c4 100644 --- a/hl/fortran/test/tstds.f90 +++ b/hl/fortran/test/tstds.f90 @@ -186,7 +186,10 @@ SUBROUTINE test_testds(err) name_len = 25 name = '' CALL H5DSget_scale_name_f(dsid, name, name_len, err) - IF(err.LT.0.OR.name_len.NE.21.OR.TRIM(name).NE."Dimension Scale Set 1")THEN + IF(err.LT.0 .OR. & + name_len.NE.21 .OR. & + TRIM(name).NE."Dimension Scale Set 1" .OR. & + name(22:25).NE.' ')THEN err = FAILED CALL write_test_status(err) RETURN @@ -293,7 +296,10 @@ SUBROUTINE test_testds(err) label_len = 25 label = '' CALL H5DSget_label_f(did, DIM2, label, label_len, err) - IF(err.LT.0.OR.label(1:label_len).NE."Label12".OR.label_len.NE.7)THEN + IF(err.LT.0.OR. & + label(1:label_len).NE."Label12" .OR. & + label_len.NE.7 .OR. & + label(8:25).NE.' ')THEN err = FAILED CALL write_test_status(err) RETURN diff --git a/hl/fortran/test/tstimage.f90 b/hl/fortran/test/tstimage.f90 index 3794bbf..3794bbf 100755..100644 --- a/hl/fortran/test/tstimage.f90 +++ b/hl/fortran/test/tstimage.f90 diff --git a/hl/fortran/test/tstlite.f90 b/hl/fortran/test/tstlite.f90 index 9329dba..0b5a138 100644 --- a/hl/fortran/test/tstlite.f90 +++ b/hl/fortran/test/tstlite.f90 @@ -1342,7 +1342,9 @@ SUBROUTINE test_attributes() IMPLICIT NONE CHARACTER(len=9), PARAMETER :: filename = "dsetf5.h5"! File name + CHARACTER(len=9), PARAMETER :: filename1 ="tattr.h5" ! C written attribute file INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: file_id1 INTEGER, PARAMETER :: DIM1 = 10; ! Dimension of array CHARACTER(LEN=5), PARAMETER :: attrname1 = "attr1" ! Attribute name CHARACTER(LEN=5), PARAMETER :: attrname2 = "attr2" ! Attribute name @@ -1350,9 +1352,11 @@ SUBROUTINE test_attributes() CHARACTER(LEN=5), PARAMETER :: attrname4 = "attr4" ! Attribute name CHARACTER(LEN=5), PARAMETER :: attrname5 = "attr5" ! Attribute name CHARACTER(LEN=8), PARAMETER :: buf1 = "mystring" ! Data buffer + CHARACTER(LEN=16), PARAMETER :: buf_c = "string attribute" CHARACTER(LEN=8) :: bufr1 ! Data buffer CHARACTER(LEN=10) :: bufr1_lg ! Data buffer - CHARACTER(LEN=6) :: bufr1_sm ! Data buffer + CHARACTER(LEN=16) :: bufr_c ! Data buffer + CHARACTER(LEN=18) :: bufr_c_lg ! Data buffer INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer REAL, DIMENSION(DIM1) :: buf3 ! Data buffer @@ -1370,6 +1374,7 @@ SUBROUTINE test_attributes() INTEGER :: rank = 1 ! Dataset rank CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name INTEGER, DIMENSION(DIM1) :: buf ! Data buffer + ! ! Initialize FORTRAN predefined datatypes. @@ -1488,15 +1493,12 @@ SUBROUTINE test_attributes() CALL passed() - - !------------------------------------------------------------------------- ! string !------------------------------------------------------------------------- CALL test_begin(' Set/Get attributes string ') - ! ! write attribute. ! @@ -1530,19 +1532,36 @@ SUBROUTINE test_attributes() STOP ENDIF - ! - ! read attribute into a fortran character buf that is smaller then buf1. - ! - CALL h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1_sm,errcode) - - ! - ! compare read and write buffers. - ! - IF ( buf1(1:6) .NE. bufr1_sm(1:6) ) THEN - PRINT *, 'smaller read buffer differs from write buffer' - PRINT *, buf1, ' and ', bufr1_sm - STOP - ENDIF + ! + ! ** Test reading a string that was created with a C program ** + ! + +!!$ CALL h5fopen_f(filename1, H5F_ACC_RDONLY_F, file_id1, errcode) +!!$ +!!$ CALL h5ltget_attribute_string_f(file_id1, "/", "attr5", bufr_c, errcode) +!!$ ! +!!$ ! compare read and write buffers. +!!$ ! +!!$ IF ( bufr_c .NE. buf_c ) THEN +!!$ PRINT *, 'read buffer differs from write buffer' +!!$ PRINT *, bufr1, ' and ', buf_c +!!$ STOP +!!$ ENDIF +!!$ ! +!!$ ! read attribute into a fortran character buf that is larger then buf_c. +!!$ ! +!!$ CALL h5ltget_attribute_string_f(file_id1, "/", "attr5", bufr_c_lg, errcode) +!!$ +!!$ ! +!!$ ! compare read and write buffers, make sure C NULL character was removed. +!!$ ! +!!$ IF ( buf_c(1:16) .NE. bufr_c_lg(1:16) .AND. bufr_c_lg(17:18) .NE. ' ' ) THEN +!!$ PRINT *, 'larger read buffer differs from write buffer' +!!$ PRINT *, buf_c, ' and ', bufr_c_lg +!!$ STOP +!!$ ENDIF + +!!$ CALL h5fclose_f(file_id1, errcode) CALL passed() diff --git a/hl/fortran/test/tsttable.f90 b/hl/fortran/test/tsttable.f90 index 66ec5c6..66ec5c6 100755..100644 --- a/hl/fortran/test/tsttable.f90 +++ b/hl/fortran/test/tsttable.f90 |