diff options
Diffstat (limited to 'test/tmisc.c')
-rw-r--r-- | test/tmisc.c | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/test/tmisc.c b/test/tmisc.c index cb61eaa..5539cee 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -15,7 +15,7 @@ /*********************************************************** * -* Test program: tmisc +* Test program: tmisc * * Test miscellaneous features not tested elsewhere. Generally * regression tests for bugs that are reported and don't @@ -23,7 +23,7 @@ * *************************************************************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#define H5D_PACKAGE /*suppress error about including H5Dpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5D_TESTING @@ -31,10 +31,10 @@ #include "hdf5.h" #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Dpkg.h" /* Datasets */ +#include "H5Dpkg.h" /* Datasets */ /* Definitions for misc. test #1 */ -#define MISC1_FILE "tmisc1.h5" +#define MISC1_FILE "tmisc1.h5" #define MISC1_VAL (13417386) /* 0xccbbaa */ #define MISC1_VAL2 (15654348) /* 0xeeddcc */ #define MISC1_DSET_NAME "/scalar_set" @@ -166,8 +166,8 @@ typedef struct /* Definitions for misc. test #12 */ #define MISC12_FILE "tmisc12.h5" #define MISC12_DSET_NAME "Dataset" -#define MISC12_SPACE1_RANK 1 -#define MISC12_SPACE1_DIM1 4 +#define MISC12_SPACE1_RANK 1 +#define MISC12_SPACE1_DIM1 4 #define MISC12_CHUNK_SIZE 2 #define MISC12_APPEND_SIZE 5 @@ -453,7 +453,7 @@ static void test_misc2_write_attribute(void) ret = H5Aread(att1, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - free(data_check.string); + HDfree(data_check.string); ret = H5Aclose(att1); CHECK(ret, FAIL, "HAclose"); @@ -464,8 +464,6 @@ static void test_misc2_write_attribute(void) ret = H5Fclose(file1); CHECK(ret, FAIL, "H5Fclose"); - - root2 = H5Gopen2(file2, "/", H5P_DEFAULT); CHECK(root2, FAIL, "H5Gopen2"); @@ -480,7 +478,7 @@ static void test_misc2_write_attribute(void) ret = H5Aread(att2, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - free(data_check.string); + HDfree(data_check.string); ret = H5Aclose(att2); CHECK(ret, FAIL, "HAclose"); @@ -497,8 +495,8 @@ static void test_misc2_write_attribute(void) ret = H5Fclose(file2); CHECK(ret, FAIL, "H5Fclose"); - free(string_att1); - free(string_att2); + HDfree(string_att1); + HDfree(string_att2); return; } @@ -524,7 +522,7 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name ret = H5Aread(att, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - free(data_check.string); + HDfree(data_check.string); ret = H5Aclose(att); CHECK(ret, FAIL, "H5Aclose"); @@ -732,7 +730,7 @@ delete_struct3(misc5_struct3_hndl *str3hndl) ret=H5Tclose(str3hndl->st3h_base); CHECK(ret,FAIL,"H5Tclose"); - free(str3hndl); + HDfree(str3hndl); } static void @@ -783,7 +781,7 @@ delete_struct2(misc5_struct2_hndl *str2hndl) H5Tclose(str2hndl->st2h_base); CHECK(ret,FAIL,"H5Tclose"); - free(str2hndl); + HDfree(str2hndl); } static void @@ -794,7 +792,7 @@ set_struct2(misc5_struct2 *buf) buf->st2_el1=MISC5_DBGELVAL2; buf->st2_el2.len=MISC5_DBGNELM3; - buf->st2_el2.p=malloc((buf->st2_el2.len)*sizeof(misc5_struct3)); + buf->st2_el2.p=HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); CHECK(buf->st2_el2.p,NULL,"malloc"); for(i=0; i<(buf->st2_el2.len); i++) @@ -804,7 +802,7 @@ set_struct2(misc5_struct2 *buf) static void clear_struct2(misc5_struct2 *buf) { - free(buf->st2_el2.p); + HDfree(buf->st2_el2.p); } /*********************** struct1 ***********************/ @@ -849,7 +847,7 @@ delete_struct1(misc5_struct1_hndl *str1hndl) ret=H5Tclose(str1hndl->st1h_base); CHECK(ret,FAIL,"H5Tclose"); - free(str1hndl); + HDfree(str1hndl); } static void @@ -860,7 +858,7 @@ set_struct1(misc5_struct1 *buf) buf->st1_el1=MISC5_DBGELVAL1; buf->st1_el2.len=MISC5_DBGNELM2; - buf->st1_el2.p=malloc((buf->st1_el2.len)*sizeof(misc5_struct2)); + buf->st1_el2.p=HDmalloc((buf->st1_el2.len)*sizeof(misc5_struct2)); CHECK(buf->st1_el2.p,NULL,"malloc"); for(i=0; i<(buf->st1_el2.len); i++) @@ -874,7 +872,7 @@ clear_struct1(misc5_struct1 *buf) for(i=0;i<buf->st1_el2.len;i++) clear_struct2(&((( misc5_struct2 *)(buf->st1_el2.p))[i])); - free(buf->st1_el2.p); + HDfree(buf->st1_el2.p); } static void @@ -910,7 +908,7 @@ test_misc5(void) /* Create the variable-length buffer */ buf.len = MISC5_DBGNELM1; - buf.p = malloc((buf.len) * sizeof(misc5_struct1)); + buf.p = HDmalloc((buf.len) * sizeof(misc5_struct1)); CHECK(buf.p, NULL, "malloc"); /* Create the top-level VL information */ @@ -926,7 +924,7 @@ test_misc5(void) clear_struct1(&(((misc5_struct1 *)(buf.p))[j])); /* Free the variable-length buffer */ - free(buf.p); + HDfree(buf.p); /* Close dataset */ ret = H5Dclose(dataset_id); @@ -1236,10 +1234,10 @@ test_misc8(void) MESSAGE(5, ("Testing dataset storage sizes\n")); /* Allocate space for the data to write & read */ - wdata=malloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); + wdata=HDmalloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); CHECK(wdata,NULL,"malloc"); #ifdef VERIFY_DATA - rdata=malloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); + rdata=HDmalloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); CHECK(rdata,NULL,"malloc"); #endif /* VERIFY_DATA */ @@ -1677,7 +1675,7 @@ test_misc8(void) CHECK(ret, FAIL, "H5Fclose"); /* Free the read & write buffers */ - free(wdata); + HDfree(wdata); #ifdef VERIFY_DATA free(rdata); #endif /* VERIFY_DATA */ @@ -1800,10 +1798,10 @@ test_misc11(void) unsigned sym_ik; /* Symbol table B-tree initial 'K' value */ unsigned istore_ik; /* Indexed storage B-tree initial 'K' value */ unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */ - unsigned nindexes; /* Shared message number of indexes */ - H5F_info2_t finfo; /* global information about file */ - H5F_file_space_type_t strategy; /* File/free space strategy */ - hsize_t threshold; /* Free-space section threshold */ + unsigned nindexes; /* Shared message number of indexes */ + H5F_info2_t finfo; /* global information about file */ + H5F_file_space_type_t strategy; /* File/free space strategy */ + hsize_t threshold; /* Free-space section threshold */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1958,10 +1956,10 @@ test_misc12(void) hsize_t dimsn[] = {MISC12_APPEND_SIZE}; hsize_t maxdims1[1] = {H5S_UNLIMITED}; hsize_t chkdims1[1] = {MISC12_CHUNK_SIZE}; - hsize_t newsize[1] = {MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE}; - hsize_t offset[1] = {MISC12_SPACE1_DIM1}; - hsize_t count[1] = {MISC12_APPEND_SIZE}; - int i; /* counting variable */ + hsize_t newsize[1] = {MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE}; + hsize_t offset[1] = {MISC12_SPACE1_DIM1}; + hsize_t count[1] = {MISC12_APPEND_SIZE}; + int i; /* counting variable */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -2215,7 +2213,7 @@ create_hdf_file(const char *name) /* Close the file */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); CHECK(ret, FAIL, "H5Fclose"); } @@ -2245,7 +2243,7 @@ insert_user_block(const char *old_name, const char *new_name,const char *str,siz VERIFY(written, size, "HDfwrite"); /* Open the old file */ - old_fp=fopen(old_name,"rb"); + old_fp=HDfopen(old_name,"rb"); CHECK(old_fp, NULL, "HDfopen"); /* Allocate space for the copy buffer */ @@ -2268,10 +2266,10 @@ insert_user_block(const char *old_name, const char *new_name,const char *str,siz VERIFY(ret, 0, "HDfclose"); /* Free the copy buffer */ - free(copy_buf); + HDfree(copy_buf); /* Free the user block */ - free(user_block); + HDfree(user_block); } static void @@ -4452,7 +4450,6 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -4496,7 +4493,6 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); - /* Re-open file */ fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -5125,7 +5121,7 @@ test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info_t UNUSED { H5O_info_t object_info; - return H5Oget_info_by_name(loc_id, name, &object_info, H5P_DEFAULT); + return H5Oget_info_by_name(loc_id, name, &object_info, H5P_DEFAULT); } static int @@ -5174,7 +5170,7 @@ test_misc30(void) CHECK(fid, FAIL, "H5Fopen"); if(get_info) { - ret = test_misc30_get_info(fid); + ret = test_misc30_get_info(fid); CHECK(ret, FAIL, "test_misc30_get_info"); } |