diff options
author | MuQun Yang <ymuqun@hdfgroup.org> | 2001-12-12 16:44:05 (GMT) |
---|---|---|
committer | MuQun Yang <ymuqun@hdfgroup.org> | 2001-12-12 16:44:05 (GMT) |
commit | 59d30c94ef1c82527f16b5a93cf742d0013e42a6 (patch) | |
tree | 3dc7e65fceca400e2d1b2a50e53a507206ef0901 | |
parent | 74c1fcc3b7d01a2e2ad3d36b5113bbc3df79b565 (diff) | |
download | hdf5-59d30c94ef1c82527f16b5a93cf742d0013e42a6.zip hdf5-59d30c94ef1c82527f16b5a93cf742d0013e42a6.tar.gz hdf5-59d30c94ef1c82527f16b5a93cf742d0013e42a6.tar.bz2 |
[svn-r4702]
Purpose:
bug fixed
Description:
Make HDF4 dataset converted from Vdata extensible.
Solution:
Platforms tested:
RedHat 6.2(Linux)
-rw-r--r-- | tools/h4toh5/h4toh5vdata.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tools/h4toh5/h4toh5vdata.c b/tools/h4toh5/h4toh5vdata.c index 07a2fa5..d1cd389 100644 --- a/tools/h4toh5/h4toh5vdata.c +++ b/tools/h4toh5/h4toh5vdata.c @@ -85,6 +85,7 @@ int Vdata_h4_to_h5(int32 file_id,int32 vdata_id, hid_t group_id,int h4_attr) { hid_t h5_ctype; hid_t h5_cmemtype; + hid_t create_plist; hid_t* h5memtype = NULL; hid_t* h5type = NULL; @@ -92,6 +93,8 @@ int Vdata_h4_to_h5(int32 file_id,int32 vdata_id, hid_t group_id,int h4_attr) { size_t* h4memsize = NULL; size_t* h4size = NULL; hsize_t h5_vddims[1]; + hsize_t h5_maxvddims[1]; + hsize_t h5_chunkdims[1]; char* h5cvdata_name; int check_vdname; @@ -230,7 +233,6 @@ int Vdata_h4_to_h5(int32 file_id,int32 vdata_id, hid_t group_id,int h4_attr) { for (i=0;i<nfields;i++) { /* obtain field order.*/ fieldorder = VFfieldorder(vdata_id,i); - if(fieldorder == FAIL){ printf("error in obtaining field order. \n"); free(h5memtype); @@ -256,9 +258,10 @@ int Vdata_h4_to_h5(int32 file_id,int32 vdata_id, hid_t group_id,int h4_attr) { return FAIL; } - h5_vddims[0] = n_records; - h5d_sid = H5Screate_simple(1,h5_vddims,NULL); + h5_vddims[0] = n_records; + h5_maxvddims[0] = H5S_UNLIMITED; + h5d_sid = H5Screate_simple(1,h5_vddims,h5_maxvddims); if(h5d_sid <0){ printf("error in obtaining space id.\n"); free(h5memtype); @@ -290,7 +293,21 @@ int Vdata_h4_to_h5(int32 file_id,int32 vdata_id, hid_t group_id,int h4_attr) { return FAIL; } - h5dset = H5Dcreate(group_id,h5cvdata_name,h5_ctype,h5d_sid,H5P_DEFAULT); + h5_chunkdims[0] = h5_vddims[0]; + create_plist = H5Pcreate(H5P_DATASET_CREATE); + if (H5Pset_chunk(create_plist,1,h5_chunkdims)<0){ + printf("failed to set up chunking information for "); + printf("property list.\n"); + free(h5memtype); + free(h5type); + free(h4memsize); + free(h4size); + free(vd_data); + free(h5cvdata_name); + H5Pclose(create_plist); + return FAIL; + } + h5dset = H5Dcreate(group_id,h5cvdata_name,h5_ctype,h5d_sid,create_plist); if(h5dset <0) { printf("error in obtaining dataset.\n"); free(h5memtype); |