diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2000-11-09 23:01:29 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2000-11-09 23:01:29 (GMT) |
commit | ab5bf9f979fed3a665f302b4e8b93ca1628b5d23 (patch) | |
tree | c500e7b7df4979a5933af31336c1583256e325ce /tools/h4toh5image.c | |
parent | 66c44914cc582da845571768161302b1b18b26bd (diff) | |
download | hdf5-ab5bf9f979fed3a665f302b4e8b93ca1628b5d23.zip hdf5-ab5bf9f979fed3a665f302b4e8b93ca1628b5d23.tar.gz hdf5-ab5bf9f979fed3a665f302b4e8b93ca1628b5d23.tar.bz2 |
[svn-r2851] Purpose:
Updated for new array datatypes.
Description:
I missed these tools earlier when I wasn't compiling with HDF4...
Solution:
Updated them (correctly, I hope) to use the new array datatype instead of
compound datatype array fields.
Platforms tested:
FreeBSD 4.1.1 (hawkwind)
Diffstat (limited to 'tools/h4toh5image.c')
-rw-r--r-- | tools/h4toh5image.c | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/tools/h4toh5image.c b/tools/h4toh5image.c index f651ee9..0f779a3 100644 --- a/tools/h4toh5image.c +++ b/tools/h4toh5image.c @@ -80,7 +80,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup) { size_t h4size; size_t h4memsize; - size_t fielddim[1]; + hsize_t fielddim[1]; hsize_t h5dims[2]; herr_t ret; hid_t create_plist; @@ -254,8 +254,19 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup) { fielddim[0] = ncomp; - ret = H5Tinsert_array(h5_ctype,"HDF4Image_data",0,1,fielddim,NULL, - h5ty_id); + { + hid_t arr_type; /* Array datatype for inserting fields */ + + /* Create array datatype */ + if((arr_type=H5Tarray_create(h5ty_id,1,fielddim,NULL))<0) { + printf("error creating array datatype.\n"); + free(image_data); + free(h5cimage_name); + H5Pclose(create_plist); + return FAIL; + } + + ret = H5Tinsert(h5_ctype,"HDF4Image_data",0,arr_type); if(ret < 0) { printf("error in inserting array of compound datatype. \n"); free(image_data); @@ -264,8 +275,25 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup) { return FAIL; } - ret = H5Tinsert_array(h5_cmemtype,"HDF4Image_data",0,1,fielddim,NULL, - h5memtype); + /* Close array datatype */ + if(H5Tclose(arr_type)<0) { + printf("error closing array datatype.\n"); + free(image_data); + free(h5cimage_name); + H5Pclose(create_plist); + return FAIL; + } + + /* Create array datatype */ + if((arr_type=H5Tarray_create(h5memtype,1,fielddim,NULL))<0) { + printf("error creating array datatype.\n"); + free(image_data); + free(h5cimage_name); + H5Pclose(create_plist); + return FAIL; + } + + ret = H5Tinsert(h5_cmemtype,"HDF4Image_data",0,arr_type); if(ret < 0) { printf("error in inserting array of compound datatype at memory. \n"); free(image_data); @@ -273,6 +301,16 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup) { H5Pclose(create_plist); return FAIL; } + + /* Close array datatype */ + if(H5Tclose(arr_type)<0) { + printf("error closing array datatype.\n"); + free(image_data); + free(h5cimage_name); + H5Pclose(create_plist); + return FAIL; + } + } h5d_sid = H5Screate_simple(2,h5dims,NULL); if(h5d_sid < 0) { |