diff options
author | MuQun Yang <ymuqun@hdfgroup.org> | 2000-10-12 22:47:38 (GMT) |
---|---|---|
committer | MuQun Yang <ymuqun@hdfgroup.org> | 2000-10-12 22:47:38 (GMT) |
commit | 8abdfea352aaebde90c67e4c0657ef866caaab79 (patch) | |
tree | d47612916b6ba2951e2046c8ab324a6a63686080 /tools | |
parent | c23193d9de5ba54f166fb468c535c08ed8dc835f (diff) | |
download | hdf5-8abdfea352aaebde90c67e4c0657ef866caaab79.zip hdf5-8abdfea352aaebde90c67e4c0657ef866caaab79.tar.gz hdf5-8abdfea352aaebde90c67e4c0657ef866caaab79.tar.bz2 |
[svn-r2674]
Purpose:
1. fix size of dimensional name list so that the size of dimensional name in dumper output
will not change because of different versions of hdf library(h4toh5util.h and h4toh5sds.c).
2. fix bzero routine for windows platform(h4toh5util.h,h4toh5util.c,h4toh5anno.c,h4toh5main.c,
h4toh5sds.c)
Description:
1. change the MAX_DIM_NAME into 276(MAX_NC_NAME +dimension group name) and hopefully we will
not expand the size of MAX_NC_NAME(currently 256) for a long time.
2. create a new routine(h4toh5_ZeroMemory) to zero out memory. Use ZeroMemory in windows and
bzero at UNIX.
Solution:
see Description.
Platforms tested:
LINUX(eirene),WINDOWS 2000, sun 5.6(baldric and arabica),HP-UX11(opus),DEC(gondolin),IRIX 6.5(paz).
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h4toh5main.h | 10 | ||||
-rw-r--r-- | tools/h4toh5util.c | 29 | ||||
-rw-r--r-- | tools/h4toh5util.h | 4 |
3 files changed, 35 insertions, 8 deletions
diff --git a/tools/h4toh5main.h b/tools/h4toh5main.h index 8966011..bac5baf 100644 --- a/tools/h4toh5main.h +++ b/tools/h4toh5main.h @@ -1,9 +1,12 @@ +#ifndef H4TOH5MAIN_H +#define H4TOH5MAIN_H #include "hdf.h" #include "mfhdf.h" #include "hdf5.h" #include "h4toh5util.h" #include <fcntl.h> #include <errno.h> + /* subroutines adapted from h5toh4 tools and used for h4toh5main.c */ void PrintOptions_h4toh5(void); int test_file(char *filename,int oflag,mode_t mode); @@ -54,3 +57,10 @@ int Annoobj_h4_to_h5(int32,int32,int32,hid_t); /*subroutines for h4toh5pal.c*/ int Palette_h4_to_h5(int32,int32 ,hid_t,char *); +#endif + + + + + + diff --git a/tools/h4toh5util.c b/tools/h4toh5util.c index f401354..a36ca93 100644 --- a/tools/h4toh5util.c +++ b/tools/h4toh5util.c @@ -1,4 +1,17 @@ #include "h4toh5util.h" +/* Function h4toh5_ZeroMemory +* Purpose: Zero out memory +* return: None +* In: size_t n(DWORD in windows) + void* s(PVOID in windows) +*/ +void h4toh5_ZeroMemory(void*s,size_t n) { +#ifdef WIN32 + ZeroMemory(s,n); +#else + bzero(s,n); +#endif +} /*------------------------------------------------------------------------- * Function: h5string_to_int @@ -1332,7 +1345,7 @@ char* get_obj_aboname(char* obj_name,char* refstr,char* path_name, printf("error in allocating memory. \n"); return NULL; } - bzero(abo_objname,strlen(path_name)+strlen(objstr)+ + h4toh5_ZeroMemory(abo_objname,strlen(path_name)+strlen(objstr)+ strlen(refstr)+3); strcpy(abo_objname,path_name); strcat(abo_objname,"/"); @@ -1347,7 +1360,7 @@ char* get_obj_aboname(char* obj_name,char* refstr,char* path_name, printf("error in allocating memory. \n"); return NULL; } - bzero(abo_objname,strlen(objstr)+strlen(refstr)+3); + h4toh5_ZeroMemory(abo_objname,strlen(objstr)+strlen(refstr)+3); strcat(abo_objname,"/"); strcat(abo_objname,objstr); strcat(abo_objname,"_"); @@ -1393,7 +1406,7 @@ char* make_objname_no(char* refstr,char* path_name,const char*objstr) { printf("error in allocating memory. \n"); return NULL; } - bzero(new_objname,strlen(objstr)+strlen(refstr)+3); + h4toh5_ZeroMemory(new_objname,strlen(objstr)+strlen(refstr)+3); strcpy(new_objname,"/"); strcat(new_objname,objstr); strcat(new_objname,"_"); @@ -1407,7 +1420,7 @@ char* make_objname_no(char* refstr,char* path_name,const char*objstr) { printf("error in allocating memory. \n"); return NULL; } - bzero(new_objname,strlen(path_name)+strlen(objstr)+strlen(refstr)+3); + h4toh5_ZeroMemory(new_objname,strlen(path_name)+strlen(objstr)+strlen(refstr)+3); strcpy(new_objname,path_name); strcat(new_objname,"/"); strcat(new_objname,objstr); @@ -1443,7 +1456,7 @@ char* make_objname_yes(char* obj_name,char* path_name){ printf("error in allocating memory. \n"); return NULL; } - bzero(new_objname,strlen(obj_name)+2); + h4toh5_ZeroMemory(new_objname,strlen(obj_name)+2); strcpy(new_objname,"/"); strcat(new_objname,obj_name); } @@ -1453,7 +1466,7 @@ char* make_objname_yes(char* obj_name,char* path_name){ printf("error in allocating memory. \n"); return NULL; } - bzero(new_objname,strlen(path_name)+strlen(obj_name)+2); + h4toh5_ZeroMemory(new_objname,strlen(path_name)+strlen(obj_name)+2); strcpy(new_objname,path_name); strcat(new_objname,"/"); strcat(new_objname,obj_name); @@ -1485,7 +1498,7 @@ char* trans_obj_name(int32 obj_tag,int32 index) { printf("cannot allocate memory for object name. \n"); return NULL; } - bzero(obj_name,strlen(HDF4_PALETTE)+strlen(ATTR)+8); + h4toh5_ZeroMemory(obj_name,strlen(HDF4_PALETTE)+strlen(ATTR)+8); if(conv_int_str(index,indstr)== FAIL) { printf("indstr is not allocated. \n"); @@ -1590,7 +1603,7 @@ char *correct_name(char* oldname){ } newname = malloc(strlen(oldname)+1); - bzero(newname,strlen(oldname)+1); + h4toh5_ZeroMemory(newname,strlen(oldname)+1); newname = strncpy(newname, oldname, strlen(oldname)); while(strchr(newname,ORI_SLASH)!= NULL){ diff --git a/tools/h4toh5util.h b/tools/h4toh5util.h index cd6bcf4..0cba454 100644 --- a/tools/h4toh5util.h +++ b/tools/h4toh5util.h @@ -95,6 +95,8 @@ converter.*/ #define VG_DEFHASHSIZE 64 #define VD_DEFHASHSIZE 64 #define MAXREF_LENGTH 5 +/*considering the string size of HDF4_DIMGROUP. we add this into 276.*/ +#define MAX_DIM_NAME 276 int32 estnum_vg; int32 estnum_vd; @@ -135,6 +137,8 @@ struct table* pal_hashtab; struct name_table* name_hashtab; struct name_table* dim_hashtab; +/* routine for zeroing out the memory. */ +void h4toh5_ZeroMemory(void*s,size_t n); /* look-up table, object reference is the key.*/ int lookup(int,int,struct table*); |