summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2000-10-12 22:52:28 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2000-10-12 22:52:28 (GMT)
commitbddc59c0ead7bc5e6cf5cc832a8281580c9e1208 (patch)
treececd7df83613f210a6505346e336f640ed5d013b
parent8abdfea352aaebde90c67e4c0657ef866caaab79 (diff)
downloadhdf5-bddc59c0ead7bc5e6cf5cc832a8281580c9e1208.zip
hdf5-bddc59c0ead7bc5e6cf5cc832a8281580c9e1208.tar.gz
hdf5-bddc59c0ead7bc5e6cf5cc832a8281580c9e1208.tar.bz2
[svn-r2675]
Purpose: fix "zero memory" routine and change dimensional scale name size to MAX_DIM_NAME Description: change bzero into h4toh5_ZeroMemory change dimensional scale name size(orginally MAX_NC_NAME) to MAX_DIM_NAME at converter. Solution: see description Platforms tested: arabica,baldric,gondolin(DEC),opus(HP 11),eirene(Linux),paz(IRIX6.5)
-rw-r--r--tools/h4toh5anno.c8
-rw-r--r--tools/h4toh5main.c12
-rw-r--r--tools/h4toh5sds.c33
3 files changed, 27 insertions, 26 deletions
diff --git a/tools/h4toh5anno.c b/tools/h4toh5anno.c
index 6f11594..199d5f1 100644
--- a/tools/h4toh5anno.c
+++ b/tools/h4toh5anno.c
@@ -79,7 +79,7 @@ int Annofil_h4_to_h5(int32 file_id,hid_t h5group){
printf("error in allocating memory. \n");
return FAIL;
}
- bzero(ann_buf,(ann_length+1)*sizeof(char));
+ h4toh5_ZeroMemory(ann_buf,(ann_length+1)*sizeof(char));
istat = ANreadann(ann_id,ann_buf,ann_length+1);
if(istat==FAIL) {
@@ -176,7 +176,7 @@ int Annofil_h4_to_h5(int32 file_id,hid_t h5group){
ANendaccess(ann_id);
return FAIL;
}
- bzero(ann_buf,ann_length+1);
+ h4toh5_ZeroMemory(ann_buf,ann_length+1);
istat = ANreadann(ann_id,ann_buf,ann_length+1);
@@ -357,7 +357,7 @@ int Annoobj_h4_to_h5(int32 file_id,int32 obj_ref, int32 obj_tag,
ANend(an_id);
return FAIL;
}
- bzero(ann_buf,(ann_length+1)*sizeof(char));
+ h4toh5_ZeroMemory(ann_buf,(ann_length+1)*sizeof(char));
status = ANreadann(ann_id,ann_buf,ann_length+1);
if(status == FAIL) {
printf("error in reading data.\n");
@@ -466,7 +466,7 @@ int Annoobj_h4_to_h5(int32 file_id,int32 obj_ref, int32 obj_tag,
return FAIL;
}
- bzero(ann_buf,(ann_length+1)*sizeof(char));
+ h4toh5_ZeroMemory(ann_buf,(ann_length+1)*sizeof(char));
ANreadann(ann_id,ann_buf,ann_length+1);
if ((sh5str_type = mkstr(ann_length+1,H5T_STR_NULLTERM))<0) {
diff --git a/tools/h4toh5main.c b/tools/h4toh5main.c
index ca8d7fd..0947bb8 100644
--- a/tools/h4toh5main.c
+++ b/tools/h4toh5main.c
@@ -705,7 +705,7 @@ int h4toh5lonevgs(int32 file_id,int32 sd_id,hid_t h5group,hid_t h5_dimg,hid_t h5
}
/*obtain group name and class name.*/
- bzero(vgroup_class,VGNAMELENMAX);
+ h4toh5_ZeroMemory(vgroup_class,VGNAMELENMAX);
istat = Vgetclass(vgroup_id,vgroup_class);
if(istat == FAIL) {
printf("error in getting vgroup class.\n");
@@ -714,7 +714,7 @@ int h4toh5lonevgs(int32 file_id,int32 sd_id,hid_t h5group,hid_t h5_dimg,hid_t h5
return FAIL;
}
- bzero(vgroup_name,VGNAMELENMAX);
+ h4toh5_ZeroMemory(vgroup_name,VGNAMELENMAX);
istat = Vgetname(vgroup_id,vgroup_name);
if(istat == FAIL ) {
printf("error in getting vgroup name. \n");
@@ -863,7 +863,7 @@ int h4toh5vgrings(int32 file_id,int32 sd_id,hid_t h5group,hid_t h5_dimg,hid_t h5
return FAIL;
}
- bzero(vgroup_name,VGNAMELENMAX);
+ h4toh5_ZeroMemory(vgroup_name,VGNAMELENMAX);
istat = Vgetname(vgroup_id,vgroup_name);
if(istat ==FAIL) {
printf("error in obtaining vgroup names. \n");
@@ -871,7 +871,7 @@ int h4toh5vgrings(int32 file_id,int32 sd_id,hid_t h5group,hid_t h5_dimg,hid_t h5
return FAIL;
}
- bzero(vgroup_class,VGNAMELENMAX);
+ h4toh5_ZeroMemory(vgroup_class,VGNAMELENMAX);
if(Vgetclass(vgroup_id,vgroup_class) == FAIL) {
printf("error in obtaining vgroup class name. \n");
Vdetach(vgroup_id);
@@ -1061,7 +1061,7 @@ int h4toh5lonevds(int32 file_id, hid_t h5group){
return FAIL;
}
- bzero(vdata_class,VGNAMELENMAX);
+ h4toh5_ZeroMemory(vdata_class,VGNAMELENMAX);
istat = VSgetclass(vdata_id,vdata_class);
if(istat == FAIL) {
printf("error in getting vdata class name.\n");
@@ -1070,7 +1070,7 @@ int h4toh5lonevds(int32 file_id, hid_t h5group){
return FAIL;
}
- bzero(vdata_name,VGNAMELENMAX);
+ h4toh5_ZeroMemory(vdata_name,VGNAMELENMAX);
istat = VSQueryname(vdata_id,vdata_name);
if(istat == FAIL) {
printf("error in getting vdata name. \n");
diff --git a/tools/h4toh5sds.c b/tools/h4toh5sds.c
index 6d16938..a2592bb 100644
--- a/tools/h4toh5sds.c
+++ b/tools/h4toh5sds.c
@@ -26,7 +26,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup){
int32 sds_ref;
int32 istat;
int i;
- int empty;
int32 num_sdsattrs;
void* sds_data;
@@ -44,8 +43,6 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup){
hid_t h5d_sid;
hid_t h5ty_id;
hid_t h5_memtype;
- hid_t h5str_type;
- hid_t h5str_memtype;
hsize_t h5dims[MAX_VAR_DIMS];
char* h5csds_name;
@@ -555,7 +552,6 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
int32 sdsdim_id;
int32 sdsdim_type = 0;
int32 sds_dimscasize[1];
- int32 sds_dimrank;
int32 istat;
int i;
int j;
@@ -563,12 +559,10 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
int check_gloattr;
int32 num_sdsdimattrs;
- int empty;
int check_sdsdim;
void* dim_scadata;
- char sdsdim_name[MAX_NC_NAME];
- char sds_name[MAX_NC_NAME];
+ char sdsdim_name[MAX_NC_NAME+1];
char* cor_sdsdimname;
size_t h4dim_memsize;
size_t h4dim_size;
@@ -593,13 +587,15 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
hsize_t h5dimscas[1];
hsize_t h5dim_dims[1];
hsize_t attr_refDims[1];
- hobj_ref_t dim_refdat;
- hobj_ref_t* alldim_refdat;
+
+ hobj_ref_t dim_refdat;
+ hobj_ref_t* alldim_refdat;
+
char* h5sdsdim_name;
- char h5sdsdim_allname[MAX_VAR_DIMS * MAX_NC_NAME];
- char h5newsdsdim_name[MAX_NC_NAME];
- char h5dimpath_name[MAX_NC_NAME];
+ char h5sdsdim_allname[MAX_VAR_DIMS * MAX_DIM_NAME];
+ char h5newsdsdim_name[MAX_DIM_NAME];
+ char h5dimpath_name[MAX_DIM_NAME];
herr_t ret;
h5dim_dims[0] = (hsize_t)sds_rank;
@@ -653,7 +649,7 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
return FAIL;
}
free(cor_sdsdimname);
- strcpy(&h5sdsdim_allname[k*MAX_NC_NAME],h5sdsdim_name);
+ strcpy(&h5sdsdim_allname[k*MAX_DIM_NAME],h5sdsdim_name);
/*if it is not touched, get name of the dimensional scale data. */
if (check_sdsdim == 1){/* the dimension is touched. */
@@ -784,8 +780,9 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
}
for(i=0;i<j;i++){
- bzero(h5newsdsdim_name,MAX_NC_NAME);
- strcpy(h5newsdsdim_name,&h5sdsdim_allname[i*MAX_NC_NAME]);
+ h4toh5_ZeroMemory(h5newsdsdim_name,MAX_DIM_NAME);
+ strcpy(h5newsdsdim_name,&h5sdsdim_allname[i*MAX_DIM_NAME]);
+
ret = H5Rcreate(&dim_refdat,sh5_dimgroup,h5newsdsdim_name,
H5R_OBJECT,-1);
if(ret <0) {
@@ -796,6 +793,7 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
return FAIL;
}
alldim_refdat[i] = dim_refdat;
+
}
attribID = H5Acreate(sh5dset,DIMSCALE,attr_refType,attr_refSpace,
@@ -808,7 +806,10 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
printf("error in generating H5 attribute ID. \n");
return FAIL;
}
+
ret = H5Awrite(attribID,attr_refType,(void *)alldim_refdat);
+
+
H5Sclose(attr_refSpace);
H5Tclose(attr_refType);
H5Aclose(attribID);
@@ -823,7 +824,7 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
return FAIL;
}
- h5str_dimntype = mkstr(MAX_NC_NAME,H5T_STR_NULLTERM);
+ h5str_dimntype = mkstr(MAX_DIM_NAME,H5T_STR_NULLTERM);
if(h5str_dimntype < 0) {
H5Sclose(h5dim_namesid);
printf("error in generating H5T_STRING type.\n");