diff options
author | MuQun Yang <ymuqun@hdfgroup.org> | 2001-08-13 20:56:33 (GMT) |
---|---|---|
committer | MuQun Yang <ymuqun@hdfgroup.org> | 2001-08-13 20:56:33 (GMT) |
commit | 018a8be1165ad0ac1b7725b4a0f2d9e58384aa9f (patch) | |
tree | 80f74dac86b4805a815e4df3ffdbc6fb0de295ae /tools | |
parent | e5451a115739b034cfef5ab1669cf1bc8d7bc476 (diff) | |
download | hdf5-018a8be1165ad0ac1b7725b4a0f2d9e58384aa9f.zip hdf5-018a8be1165ad0ac1b7725b4a0f2d9e58384aa9f.tar.gz hdf5-018a8be1165ad0ac1b7725b4a0f2d9e58384aa9f.tar.bz2 |
[svn-r4338]
Purpose:
check-in the second time to update the handling of data transfer in h4toh5.
This will make up for the cvs conflict checking a couple hours ago.
Description:
Solution:
Platforms tested:
eirene
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h4toh5/h4toh5image.c | 185 | ||||
-rw-r--r-- | tools/h4toh5/h4toh5sds.c | 21 |
2 files changed, 11 insertions, 195 deletions
diff --git a/tools/h4toh5/h4toh5image.c b/tools/h4toh5/h4toh5image.c index 9662904..94fa08f 100644 --- a/tools/h4toh5/h4toh5image.c +++ b/tools/h4toh5/h4toh5image.c @@ -411,9 +411,7 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in /* HDF4 can support various compression methods including simple RLE, NBIT, Skip Huffman, gzip,Jpeg , HDF5 currently only supports gzip compression. By default, we will compress HDF5 dataset by using gzip compression if HDF5 file is compressed. */ -<<<<<<< h4toh5image.c -======= - + /* we don't use data transfer property list. write_plist = H5Pcreate_list(H5P_DATASET_XFER_NEW); bufsize = h4memsize *h5dims[1]*ncomp; @@ -422,11 +420,9 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); - H5Pclose_list(write_plist); return FAIL; } - ->>>>>>> 1.3 + */ if (ncomp == 1) { h5d_sid = H5Screate_simple(2,h5dims,NULL); @@ -436,10 +432,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 return FAIL; } @@ -450,10 +442,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 return FAIL; } @@ -463,123 +451,14 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 return FAIL; } - } -<<<<<<< h4toh5image.c -======= - - else { /* compound datatype. */ - - h5_ctype = H5Tcreate(H5T_COMPOUND,ncomp*h4size); - if (h5_ctype < 0) { - printf("error in generating hdf5 compound data type. \n"); - free(image_data); - free(h5cimage_name); - H5Pclose(create_plist); - H5Pclose_list(write_plist); - return FAIL; - } - - h5_cmemtype = H5Tcreate(H5T_COMPOUND,ncomp*h4memsize); - if (h5_cmemtype < 0) { - printf("error in generating hdf5 memory compound data type. \n"); - free(image_data); - free(h5cimage_name); - H5Pclose(create_plist); - H5Pclose_list(write_plist); - return FAIL; - } - ->>>>>>> 1.3 + } - else { /* 24-bit image */ + else { /* 24-bit image */ -<<<<<<< h4toh5image.c h5d_sid = H5Screate_simple(3,h5dims24,NULL); -======= - { - 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); - H5Pclose_list(write_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); - free(h5cimage_name); - H5Pclose(create_plist); - H5Pclose_list(write_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); - H5Pclose_list(write_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); - H5Pclose_list(write_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); - free(h5cimage_name); - H5Pclose(create_plist); - H5Pclose_list(write_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); - H5Pclose_list(write_plist); - return FAIL; - } - } - - h5d_sid = H5Screate_simple(2,h5dims,NULL); ->>>>>>> 1.3 - if(h5d_sid < 0) { - printf("error in creating space. \n"); - free(image_data); - free(h5cimage_name); - H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 - return FAIL; - } h5dset = H5Dcreate(h5_group,h5cimage_name,h5ty_id,h5d_sid, create_plist); @@ -588,10 +467,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 return FAIL; } @@ -601,13 +476,9 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in free(image_data); free(h5cimage_name); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 return FAIL; } - } + } free(image_data); /* convert image annotation into attribute of image dataset. @@ -622,10 +493,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in printf("failed to convert image annotation into hdf5 attribute.\n"); free(h5cimage_name); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); return FAIL; @@ -635,10 +502,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in printf("failed to convert image annotation into hdf5 attribute.\n"); free(h5cimage_name); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); return FAIL; @@ -648,10 +511,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in printf("failed to convert image annotation into hdf5 attribute.\n"); free(h5cimage_name); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); return FAIL; @@ -665,10 +524,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(gr_tranattrs(ri_id,h5dset,ngrattrs,check_gloattr)==FAIL){ printf(" cannot obtain attributes. \n"); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); return FAIL; @@ -692,10 +547,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(h4_transpredattrs(h5dset,HDF4_OBJECT_TYPE,grlabel)==FAIL){ printf("error in getting hdf4 image type attribute \n"); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -706,10 +557,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(h4_transpredattrs(h5dset,HDF4_OBJECT_NAME,image_name)==FAIL){ printf("error in getting hdf4 image name attribute. \n"); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -719,10 +566,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(h4_transpredattrs(h5dset,HDF4_IMAGE_CLASS,image_class)==FAIL){ printf("error in getting hdf4 image class attribute. \n"); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -782,10 +625,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(gr_ref == 0) { printf("error in obtaining reference number of GR.\n"); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -795,10 +634,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(h4_transnumattr(h5dset,HDF4_REF_NUM,gr_ref)==FAIL) { printf("error in getting hdf4 image number attribute.\n"); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -810,10 +645,6 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in if(gr_palette(file_id,ri_id,h5dset,h5_palgroup,h4_attr)== FAIL) { printf("error in translating palette into h5 dataset.\n"); H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - H5Pclose_list(write_plist); ->>>>>>> 1.3 H5Sclose(h5d_sid); H5Dclose(h5dset); free(h5cimage_name); @@ -821,16 +652,12 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup,in } ret = H5Pclose(create_plist); -<<<<<<< h4toh5image.c -======= - ret = H5Pclose_list(write_plist); ->>>>>>> 1.3 ret = H5Sclose(h5d_sid); ret = H5Dclose(h5dset); istat = GRendaccess(ri_id); free(h5cimage_name); return SUCCEED; -} + } /**** palette routine. ****/ /*------------------------------------------------------------------------- diff --git a/tools/h4toh5/h4toh5sds.c b/tools/h4toh5/h4toh5sds.c index d693019..9637763 100644 --- a/tools/h4toh5/h4toh5sds.c +++ b/tools/h4toh5/h4toh5sds.c @@ -436,12 +436,10 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Pclose(create_plist); return FAIL; } -<<<<<<< h4toh5sds.c - /* write_plist = H5Pcreate(H5P_DATASET_XFER); -======= + /* comment this out. + write_plist = H5Pcreate(H5P_DATASET_XFER); write_plist = H5Pcreate_list(H5P_DATASET_XFER_NEW); ->>>>>>> 1.4 bufsize = h4memsize; for(i=1;i<sds_rank;i++) bufsize *= h5dims[i]; @@ -458,15 +456,15 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int return FAIL; } if (H5Dwrite(h5dset,h5_memtype,h5d_sid,h5d_sid,write_plist, - (void *)sds_data)<0) { */ - if (H5Dwrite(h5dset,h5_memtype,h5d_sid,h5d_sid,NULL, + (void *)sds_data)<0) { + */ + if (H5Dwrite(h5dset,h5_memtype,h5d_sid,h5d_sid,H5P_DEFAULT, (void *)sds_data)<0) { printf("failed to write data into hdf5 dataset"); printf(" converted from SDS.\n"); H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); free(sds_start); free(sds_edge); free(sds_stride); @@ -493,7 +491,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); return FAIL; } @@ -507,7 +504,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); return FAIL; } @@ -521,7 +517,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); return FAIL; } @@ -536,7 +531,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); return FAIL; } check_gloattr = 0; @@ -549,7 +543,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); printf(" Error in obtaining sds attributes. \n"); return FAIL; } @@ -570,7 +563,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); printf("unable to transfer sds label to HDF4 OBJECT TYPE.\n"); return FAIL; } @@ -585,7 +577,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); printf("unable to transfer sds name to HDF5 dataset attribute.\n"); return FAIL; } @@ -600,14 +591,12 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int H5Sclose(h5d_sid); H5Dclose(h5dset); H5Pclose(create_plist); - H5Pclose_list(write_plist); printf("unable to transfer sds ref. to HDF5 dataset attribute.\n"); return FAIL; } } istat = SDendaccess(sds_id); ret = H5Pclose(create_plist); - ret = H5Pclose_list(write_plist); ret = H5Sclose(h5d_sid); ret = H5Dclose(h5dset); free(sds_data); |