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/h4toh5util.c | |
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/h4toh5util.c')
-rw-r--r-- | tools/h4toh5util.c | 29 |
1 files changed, 21 insertions, 8 deletions
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){ |