mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-31 17:10:47 +08:00
[svn-r25631] Fix fo HDFFV-8912
This commit is contained in:
parent
17893b24ea
commit
9140500b86
@ -175,13 +175,30 @@ SUBROUTINE test_table1()
|
||||
CALL h5tbwrite_field_name_f(file_id,dsetname1,field_names(4),start,nrecords,type_sizer,&
|
||||
bufr,errcode)
|
||||
|
||||
|
||||
!-------------------------------------------------------------------------
|
||||
! read field
|
||||
!-------------------------------------------------------------------------
|
||||
|
||||
! Read an invalid field, should fail
|
||||
CALL h5tbread_field_name_f(file_id,dsetname1,'DoesNotExist',start,nrecords,type_sizec,&
|
||||
bufsr,errcode)
|
||||
|
||||
IF(errcode.GE.0)THEN
|
||||
PRINT *, 'error in h5tbread_field_name_f'
|
||||
CALL h5fclose_f(file_id, errcode)
|
||||
CALL h5close_f(errcode)
|
||||
STOP
|
||||
ENDIF
|
||||
|
||||
! Read a valid field, should pass
|
||||
CALL h5tbread_field_name_f(file_id,dsetname1,field_names(1),start,nrecords,type_sizec,&
|
||||
bufsr,errcode)
|
||||
IF(errcode.LT.0)THEN
|
||||
PRINT *, 'error in h5tbread_field_name_f'
|
||||
CALL h5fclose_f(file_id, errcode)
|
||||
CALL h5close_f(errcode)
|
||||
STOP
|
||||
ENDIF
|
||||
|
||||
!
|
||||
! compare read and write buffers.
|
||||
@ -329,8 +346,6 @@ SUBROUTINE test_table1()
|
||||
! we insert a field callsed "field5" with the same type and buffer as field 4 (Real)
|
||||
!-------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
CALL test_begin(' Insert field ')
|
||||
|
||||
CALL h5tbinsert_field_f(file_id,dsetname1,"field5",field_types(4),4,bufr,errcode)
|
||||
|
@ -982,7 +982,7 @@ herr_t H5TBread_fields_name(hid_t loc_id,
|
||||
if((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
|
||||
goto out;
|
||||
|
||||
/* iterate tru the members */
|
||||
/* iterate through the members */
|
||||
for(i = 0, j = 0; i < nfields; i++) {
|
||||
/* get the member name */
|
||||
if(NULL == (member_name = H5Tget_member_name(ftype_id, (unsigned)i)))
|
||||
@ -1028,6 +1028,10 @@ herr_t H5TBread_fields_name(hid_t loc_id,
|
||||
member_name = NULL;
|
||||
} /* end for */
|
||||
|
||||
/* check to make sure field was found, no reason to continue if it does not exist */
|
||||
if(j == 0)
|
||||
goto out;
|
||||
|
||||
/* get the dataspace handle */
|
||||
if((sid = H5Dget_space(did)) < 0)
|
||||
goto out;
|
||||
|
@ -1186,14 +1186,19 @@ static int test_table(hid_t fid, int do_write)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* read the "Pressure" field */
|
||||
start = 0;
|
||||
nrecords = NRECORDS;
|
||||
|
||||
/* read an invalid field, should fail */
|
||||
if ( H5TBread_fields_name(fid,"table10","DoesNotExist",start,nrecords,
|
||||
sizeof(float),0,field_sizes_pre,pressure_out) >=0)
|
||||
goto out;
|
||||
|
||||
/* read the "Pressure" field */
|
||||
if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords,
|
||||
sizeof(float),0,field_sizes_pre,pressure_out)<0)
|
||||
goto out;
|
||||
|
||||
|
||||
/* Compare the extracted table with the initial values */
|
||||
for( i = 0; i < NRECORDS; i++ )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user