diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-02-05 21:15:57 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-02-05 21:15:57 (GMT) |
commit | 51875fc8881cdfa0c939fba82b7a00012a2c611e (patch) | |
tree | 1ae643e19692541d5e53070a522cc19d1a60784a /hl/src/H5TB.c | |
parent | a82e85c2d408386b14859f40c572a3911aaaa682 (diff) | |
download | hdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.zip hdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.tar.gz hdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.tar.bz2 |
[svn-r13239]
bug fix on H5TBwrite_fields_index and name functions, the space on the H5Dwrite call was all selected
Diffstat (limited to 'hl/src/H5TB.c')
-rw-r--r-- | hl/src/H5TB.c | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 4d9ec84..a7f9ebf 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -502,8 +502,9 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, hid_t member_type_id; hid_t nmtype_id; hsize_t count[1]; - hsize_t offset[1]; - hid_t sid=-1; + hsize_t offset[1]; + hid_t mem_space_id=-1; + hid_t file_space_id=-1; char *member_name; hssize_t nfields; hssize_t i, j; @@ -587,34 +588,34 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, } /* Get the dataspace handle */ - if ( (sid = H5Dget_space( did )) < 0 ) + if ( (file_space_id = H5Dget_space( did )) < 0 ) + goto out; + if ( (mem_space_id = H5Screate_simple(1, &nrecords, NULL)) < 0 ) goto out; /* Define a hyperslab in the dataset */ offset[0] = start; count[0] = nrecords; - if ( H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) + if ( H5Sselect_hyperslab( file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) goto out; /* Write */ - if ( H5Dwrite( did, write_type_id, H5S_ALL, sid, PRESERVE, data ) < 0 ) + if ( H5Dwrite( did, write_type_id, mem_space_id, file_space_id, PRESERVE, data ) < 0 ) goto out; - /* End access to the write id */ + /* close */ if ( H5Tclose( write_type_id ) ) goto out; - - /* Release the datatype. */ if ( H5Tclose( tid ) < 0 ) return -1; - - /* End access to the dataset */ if ( H5Dclose( did ) < 0 ) return -1; - - /* End access to the property list */ if ( H5Pclose( PRESERVE ) < 0 ) return -1; + if ( H5Sclose( file_space_id ) < 0 ) + return -1; + if ( H5Sclose( mem_space_id ) < 0 ) + return -1; return 0; @@ -623,7 +624,8 @@ out: H5E_BEGIN_TRY { H5Pclose(PRESERVE); H5Dclose(did); - H5Sclose(sid); + H5Sclose(file_space_id); + H5Sclose(mem_space_id); H5Tclose(write_type_id); H5Tclose(tid); } H5E_END_TRY; @@ -673,7 +675,8 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, hid_t nmtype_id; hsize_t count[1]; hsize_t offset[1]; - hid_t sid=-1; + hid_t mem_space_id=-1; + hid_t file_space_id=-1; char *member_name; hsize_t i, j; hid_t PRESERVE; @@ -744,35 +747,35 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, } - /* Get the dataspace handle */ - if ( (sid = H5Dget_space( did )) < 0 ) + /* Get the dataspace handles */ + if ( (file_space_id = H5Dget_space( did )) < 0 ) + goto out; + if ( (mem_space_id = H5Screate_simple(1, &nrecords, NULL)) < 0 ) goto out; /* Define a hyperslab in the dataset */ offset[0] = start; count[0] = nrecords; - if ( H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) + if ( H5Sselect_hyperslab( file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) goto out; /* Write */ - if ( H5Dwrite( did, write_type_id, H5S_ALL, sid, PRESERVE, data ) < 0 ) + if ( H5Dwrite( did, write_type_id, mem_space_id, file_space_id, PRESERVE, data ) < 0 ) goto out; - /* End access to the write id */ + /* close */ if ( H5Tclose( write_type_id ) ) goto out; - - /* Release the datatype. */ if ( H5Tclose( tid ) < 0 ) return -1; - - /* End access to the dataset */ if ( H5Dclose( did ) < 0 ) return -1; - - /* End access to the property list */ if ( H5Pclose( PRESERVE ) < 0 ) return -1; + if ( H5Sclose( file_space_id ) < 0 ) + return -1; + if ( H5Sclose( mem_space_id ) < 0 ) + return -1; return 0; @@ -781,7 +784,8 @@ out: H5E_BEGIN_TRY { H5Pclose(PRESERVE); H5Dclose(did); - H5Sclose(sid); + H5Sclose(file_space_id); + H5Sclose(mem_space_id); H5Tclose(write_type_id); H5Tclose(tid); } H5E_END_TRY; |