diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-30 20:00:57 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-30 20:00:57 (GMT) |
commit | 2e333eef246daaa4651fbf423517b6f3b86f85c0 (patch) | |
tree | 94a05bd2779ced757e7f623f762027633fa5ce71 /test | |
parent | 25f3bf9011ad0876998a1db37f21eb7a214b93d4 (diff) | |
download | hdf5-2e333eef246daaa4651fbf423517b6f3b86f85c0.zip hdf5-2e333eef246daaa4651fbf423517b6f3b86f85c0.tar.gz hdf5-2e333eef246daaa4651fbf423517b6f3b86f85c0.tar.bz2 |
[svn-r12829] Description:
Clean up more compiler warnings, esp. on Linux/64 platform.
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
Diffstat (limited to 'test')
-rw-r--r-- | test/tid.c | 18 | ||||
-rw-r--r-- | test/titerate.c | 32 | ||||
-rw-r--r-- | test/tmisc.c | 104 | ||||
-rw-r--r-- | test/trefer.c | 26 | ||||
-rw-r--r-- | test/tselect.c | 142 | ||||
-rw-r--r-- | test/tskiplist.c | 44 | ||||
-rw-r--r-- | test/tunicode.c | 378 |
7 files changed, 372 insertions, 372 deletions
@@ -71,7 +71,7 @@ static int basic_id_test(void) goto out; /* Register a type */ - myType = H5Iregister_type(64, 0, (H5I_free_t) free ); + myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); CHECK(myType, H5I_BADID, "H5Iregister_type"); if(myType == H5I_BADID) @@ -107,7 +107,7 @@ static int basic_id_test(void) goto out; H5E_BEGIN_TRY - testSize = H5Iget_name(arrayID, nameString, 9); + testSize = H5Iget_name(arrayID, nameString, (size_t)9); H5E_END_TRY VERIFY(testSize, -1, "H5Iget_name"); @@ -164,7 +164,7 @@ static int basic_id_test(void) H5E_END_TRY /* Register another type and another object in that type */ - myType = H5Iregister_type(64, 0, (H5I_free_t) free ); + myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); CHECK(myType, H5I_BADID, "H5Iregister_type"); if(myType == H5I_BADID) @@ -293,7 +293,7 @@ static int id_predefined_test(void ) goto out; /* Create a datatype ID and try to perform illegal functions on it */ - typeID = H5Tcreate(H5T_OPAQUE, 42); + typeID = H5Tcreate(H5T_OPAQUE, (size_t)42); CHECK(typeID, H5I_INVALID_HID, "H5Tcreate"); if(typeID == H5I_INVALID_HID) goto out; @@ -353,7 +353,7 @@ static int test_id_type_list(void) H5I_type_t testType; int i; /* Just a counter variable */ - startType = H5Iregister_type(8, 0, (H5I_free_t) free ); + startType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); CHECK(startType, H5I_BADID, "H5Iregister_type"); if(startType == H5I_BADID) goto out; @@ -368,7 +368,7 @@ static int test_id_type_list(void) /* Create types up to MAX_NUM_TYPES */ for(i = startType + 1; i < MAX_NUM_TYPES; i++) { - currentType = H5Iregister_type(8, 0, (H5I_free_t) free ); + currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); CHECK(currentType, H5I_BADID, "H5Iregister_type"); if(currentType == H5I_BADID) goto out; @@ -377,7 +377,7 @@ static int test_id_type_list(void) /* Wrap around to low type ID numbers */ for(i = H5I_NTYPES; i < startType; i++) { - currentType = H5Iregister_type(8, 0, (H5I_free_t) free ); + currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); CHECK(currentType, H5I_BADID, "H5Iregister_type"); if(currentType == H5I_BADID) goto out; @@ -385,7 +385,7 @@ static int test_id_type_list(void) /* There should be no room at the inn for a new ID type*/ H5E_BEGIN_TRY - testType = H5Iregister_type(8, 0, (H5I_free_t) free ); + testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); H5E_END_TRY VERIFY(testType, H5I_BADID, "H5Iregister_type"); @@ -394,7 +394,7 @@ static int test_id_type_list(void) /* Now delete a type and try to insert again */ H5Idestroy_type(H5I_NTYPES); - testType = H5Iregister_type(8, 0, (H5I_free_t) free ); + testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); VERIFY(testType, H5I_NTYPES, "H5Iregister_type"); if(testType != H5I_NTYPES) diff --git a/test/titerate.c b/test/titerate.c index 3241901..df77dea 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -164,7 +164,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) /* Create a group and named datatype under root group for testing * H5Gget_objtype_by_idx. */ - grp = H5Gcreate(file, "grp", 0); + grp = H5Gcreate(file, "grp", (size_t)0); CHECK(ret, FAIL, "H5Gcreate"); lnames[NDATASETS] = HDstrdup("grp"); @@ -190,7 +190,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) CHECK(ret, FAIL, "H5Fclose"); /* Sort the dataset names */ - HDqsort(lnames, NDATASETS + 2, sizeof(char *), iter_strcmp); + HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Iterate through the datasets in the root group in various ways */ @@ -211,7 +211,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) for(i = 0; i< (int)num_membs; i++) { H5G_obj_t obj_type; /* Type of object in file */ - ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN); + ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)NAMELEN); CHECK(ret, FAIL, "H5Gget_objname_by_idx"); obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i); @@ -219,7 +219,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) } /* end for */ H5E_BEGIN_TRY { - ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, NAMELEN); + ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, (size_t)NAMELEN); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Gget_objname_by_idx"); @@ -239,7 +239,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) for(i = 0; i< (int)num_membs; i++) { H5G_obj_t obj_type; /* Type of object in file */ - ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, NAMELEN); + ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, (size_t)NAMELEN); CHECK(ret, FAIL, "H5Gget_objname_by_idx"); obj_type = H5Gget_objtype_by_idx(file, (hsize_t)i); @@ -247,7 +247,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) } H5E_BEGIN_TRY { - ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)(NDATASETS + 3), dataset_name, NAMELEN); + ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)(NDATASETS + 3), dataset_name, (size_t)NAMELEN); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Gget_objname_by_idx"); } @@ -604,7 +604,7 @@ static void test_iter_group_large(hid_t fapl) names[i].type = H5G_GROUP; /* Create a group */ - group = H5Gcreate(file, gname, 0); + group = H5Gcreate(file, gname, (size_t)0); CHECK(group, FAIL, "H5Gcreate"); /* Close a group */ @@ -655,7 +655,7 @@ static void test_iter_group_large(hid_t fapl) CHECK(ret, FAIL, "H5Tclose"); /* Need to sort the names in the root group, cause that's what the library does */ - HDqsort(names, (ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2); + HDqsort(names, (size_t)(ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2); /* Iterate through the file to see members of the root group */ curr_name = &names[0]; @@ -723,7 +723,7 @@ static void test_grp_memb_funcs(hid_t fapl) /* Create a group and named datatype under root group for testing * H5Gget_objtype_by_idx. */ - grp = H5Gcreate(file, "grp", 0); + grp = H5Gcreate(file, "grp", (size_t)0); CHECK(ret, FAIL, "H5Gcreate"); dnames[NDATASETS] = HDstrdup("grp"); @@ -749,7 +749,7 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); /* Sort the dataset names */ - HDqsort(dnames, (NDATASETS + 2), sizeof(char *), iter_strcmp); + HDqsort(dnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Iterate through the datasets in the root group in various ways */ file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); @@ -769,7 +769,7 @@ static void test_grp_memb_funcs(hid_t fapl) H5G_obj_t obj_type; /* Type of object in file */ /* Test with NULL for name, to query length */ - name_len = H5Gget_objname_by_idx(root_group, (hsize_t)i, NULL, NAMELEN); + name_len = H5Gget_objname_by_idx(root_group, (hsize_t)i, NULL, (size_t)NAMELEN); CHECK(name_len, FAIL, "H5Gget_objname_by_idx"); ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)(name_len + 1)); @@ -794,12 +794,12 @@ static void test_grp_memb_funcs(hid_t fapl) } /* end for */ H5E_BEGIN_TRY { - ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, NAMELEN); + ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, (size_t)NAMELEN); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Gget_objname_by_idx"); /* Sort the dataset names */ - HDqsort(obj_names, (NDATASETS + 2), sizeof(char *), iter_strcmp); + HDqsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Compare object names */ for(i = 0; i< (int)num_membs; i++) { @@ -845,10 +845,10 @@ static void test_links(hid_t fapl) CHECK(file, FAIL, "H5Fcreate"); /* create groups */ - gid = H5Gcreate (file, "/g1", 0); + gid = H5Gcreate(file, "/g1", (size_t)0); CHECK(gid, FAIL, "H5Gcreate"); - gid1 = H5Gcreate (file, "/g1/g1.1", 0); + gid1 = H5Gcreate(file, "/g1/g1.1", (size_t)0); CHECK(gid1, FAIL, "H5Gcreate"); /* create soft and hard links to the group "/g1". */ @@ -865,7 +865,7 @@ static void test_links(hid_t fapl) /* Test these two functions, H5Gget_num_objs and H5Gget_objname_by_idx */ for(i = 0; i < nobjs; i++) { /* Get object name */ - name_len = H5Gget_objname_by_idx(gid, i, obj_name, NAMELEN); + name_len = H5Gget_objname_by_idx(gid, i, obj_name, (size_t)NAMELEN); CHECK(name_len, FAIL, "H5Gget_objname_by_idx"); obj_type = H5Gget_objtype_by_idx(gid, i); diff --git a/test/tmisc.c b/test/tmisc.c index db1605e..8bb3374 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -375,13 +375,13 @@ static hid_t misc2_create_type(void) type_tmp = H5Tcopy (H5T_C_S1); CHECK(type_tmp, FAIL, "H5Tcopy"); - ret = H5Tset_size (type_tmp, H5T_VARIABLE); + ret = H5Tset_size(type_tmp, H5T_VARIABLE); CHECK(ret, FAIL, "H5Tset_size"); - type = H5Tcreate (H5T_COMPOUND, sizeof(misc2_struct)); + type = H5Tcreate(H5T_COMPOUND, sizeof(misc2_struct)); CHECK(type, FAIL, "H5Tcreate"); - ret = H5Tinsert (type, "string", offsetof(misc2_struct, string), type_tmp); + ret = H5Tinsert(type, "string", offsetof(misc2_struct, string), type_tmp); CHECK(ret, FAIL, "H5Tinsert"); ret = H5Tclose(type_tmp); @@ -615,18 +615,18 @@ test_misc4(void) CHECK(file1, FAIL, "H5Fcreate"); /* Create the first group */ - group1 = H5Gcreate(file1, MISC4_GROUP_1, 0); + group1 = H5Gcreate(file1, MISC4_GROUP_1, (size_t)0); CHECK(group1, FAIL, "H5Gcreate"); /* Create the second group */ - group2 = H5Gcreate(file1, MISC4_GROUP_2, 0); + group2 = H5Gcreate(file1, MISC4_GROUP_2, (size_t)0); CHECK(group2, FAIL, "H5Gcreate"); file2 = H5Fcreate(MISC4_FILE_2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file2, FAIL, "H5Fcreate"); /* Create the first group */ - group3 = H5Gcreate(file2, MISC4_GROUP_1, 0); + group3 = H5Gcreate(file2, MISC4_GROUP_1, (size_t)0); CHECK(group3, FAIL, "H5Gcreate"); /* Get the stat information for each group */ @@ -677,13 +677,13 @@ create_struct3(void) misc5_struct3_hndl *str3hndl; /* New 'struct3' created */ herr_t ret; /* For error checking */ - str3hndl=malloc(sizeof(misc5_struct3_hndl)); + str3hndl = HDmalloc(sizeof(misc5_struct3_hndl)); CHECK(str3hndl,NULL,"malloc"); - str3hndl->st3h_base=H5Tcreate( H5T_COMPOUND, sizeof(misc5_struct3)); - CHECK(str3hndl->st3h_base,FAIL,"H5Tcreate"); + str3hndl->st3h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct3)); + CHECK(str3hndl->st3h_base, FAIL, "H5Tcreate"); - ret=H5Tinsert(str3hndl->st3h_base, "st3_el1", HOFFSET( misc5_struct3, st3_el1), H5T_NATIVE_INT); + ret = H5Tinsert(str3hndl->st3h_base, "st3_el1", HOFFSET( misc5_struct3, st3_el1), H5T_NATIVE_INT); CHECK(ret,FAIL,"H5Tinsert"); str3hndl->st3h_id=H5Tvlen_create(str3hndl->st3h_base); @@ -720,14 +720,14 @@ create_struct2(void) misc5_struct2_hndl *str2hndl; /* New 'struct2' created */ herr_t ret; /* For error checking */ - str2hndl=malloc(sizeof(misc5_struct2_hndl)); - CHECK(str2hndl,NULL,"malloc"); + str2hndl = HDmalloc(sizeof(misc5_struct2_hndl)); + CHECK(str2hndl, NULL, "malloc"); - str2hndl->st2h_base=H5Tcreate( H5T_COMPOUND, sizeof(misc5_struct2)); - CHECK(str2hndl->st2h_base,FAIL,"H5Tcreate"); + str2hndl->st2h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct2)); + CHECK(str2hndl->st2h_base, FAIL, "H5Tcreate"); - ret=H5Tinsert(str2hndl->st2h_base, "st2_el1", HOFFSET( misc5_struct2, st2_el1), H5T_NATIVE_INT); - CHECK(ret,FAIL,"H5Tinsert"); + ret = H5Tinsert(str2hndl->st2h_base, "st2_el1", HOFFSET(misc5_struct2, st2_el1), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); str2hndl->st2h_st3hndl=create_struct3(); CHECK(str2hndl->st2h_st3hndl,NULL,"create_struct3"); @@ -786,14 +786,14 @@ create_struct1(void) misc5_struct1_hndl *str1hndl; /* New 'struct1' created */ herr_t ret; /* For error checking */ - str1hndl=malloc(sizeof(misc5_struct1_hndl)); - CHECK(str1hndl,NULL,"malloc"); + str1hndl = HDmalloc(sizeof(misc5_struct1_hndl)); + CHECK(str1hndl, NULL, "malloc"); - str1hndl->st1h_base=H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct1)); - CHECK(str1hndl->st1h_base,FAIL,"H5Tcreate"); + str1hndl->st1h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct1)); + CHECK(str1hndl->st1h_base, FAIL, "H5Tcreate"); - ret=H5Tinsert(str1hndl->st1h_base, "st1_el1", HOFFSET(misc5_struct1, st1_el1), H5T_NATIVE_INT); - CHECK(ret,FAIL,"H5Tinsert"); + ret = H5Tinsert(str1hndl->st1h_base, "st1_el1", HOFFSET(misc5_struct1, st1_el1), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); str1hndl->st1h_st2hndl=create_struct2(); CHECK(str1hndl->st1h_st2hndl,NULL,"create_struct2"); @@ -1100,8 +1100,8 @@ test_misc7(void) CHECK(sid,FAIL,"H5Screate"); /* Create the compound datatype to commit*/ - tid=H5Tcreate(H5T_COMPOUND,32); - CHECK(tid,FAIL,"H5Tcreate"); + tid = H5Tcreate(H5T_COMPOUND, (size_t)32); + CHECK(tid, FAIL, "H5Tcreate"); /* Attempt to commit an empty compound datatype */ ret=H5Tcommit(fid,MISC7_TYPENAME1,tid); @@ -1112,8 +1112,8 @@ test_misc7(void) VERIFY(ret,FAIL,"H5Dcreate"); /* Add a field to the compound datatype */ - ret=H5Tinsert(tid,"a",0,H5T_NATIVE_INT); - CHECK(ret,FAIL,"H5Tinsert"); + ret = H5Tinsert(tid, "a", (size_t)0, H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); /* Attempt to commit the compound datatype now - should work */ ret=H5Tcommit(fid,MISC7_TYPENAME1,tid); @@ -1673,7 +1673,7 @@ test_misc9(void) fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - ret=H5Pset_fapl_core(fapl, 1024, 0); + ret = H5Pset_fapl_core(fapl, (size_t)1024, 0); CHECK(ret, FAIL, "H5Pset_fapl_core"); fid = H5Fopen(MISC9_FILE, H5F_ACC_RDWR, fapl); @@ -1826,7 +1826,7 @@ test_misc11(void) ret=H5Pset_userblock(fcpl,(hsize_t)MISC11_USERBLOCK); CHECK(ret, FAIL, "H5Pset_userblock"); - ret=H5Pset_sizes(fcpl,MISC11_SIZEOF_OFF,MISC11_SIZEOF_LEN); + ret = H5Pset_sizes(fcpl, (size_t)MISC11_SIZEOF_OFF, (size_t)MISC11_SIZEOF_LEN); CHECK(ret, FAIL, "H5Pset_sizes"); ret=H5Pset_sym_k(fcpl,MISC11_SYM_IK,MISC11_SYM_LK); @@ -1964,13 +1964,13 @@ test_misc12(void) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a datatype to refer to */ - tid1 = H5Tcopy (H5T_C_S1); + tid1 = H5Tcopy(H5T_C_S1); CHECK(tid1, FAIL, "H5Tcopy"); - ret = H5Tset_size (tid1,H5T_VARIABLE); + ret = H5Tset_size(tid1, H5T_VARIABLE); CHECK(ret, FAIL, "H5Tset_size"); - cparms = H5Pcreate (H5P_DATASET_CREATE); + cparms = H5Pcreate(H5P_DATASET_CREATE); CHECK(cparms, FAIL, "H5Pcreate"); ret = H5Pset_chunk ( cparms, 1, chkdims1); @@ -2160,11 +2160,11 @@ create_hdf_file(const char *name) CHECK(ret, FAIL, "H5Tclose"); /* Create a group in the root group */ - gid = H5Gcreate(fid, MISC13_GROUP1_NAME, 0); + gid = H5Gcreate(fid, MISC13_GROUP1_NAME, (size_t)0); CHECK(gid, FAIL, "H5Gcreate"); /* Create another group in the new group */ - gid2 = H5Gcreate(gid, MISC13_GROUP2_NAME, 0); + gid2 = H5Gcreate(gid, MISC13_GROUP2_NAME, (size_t)0); CHECK(gid2, FAIL, "H5Gcreate"); /* Close the second group */ @@ -2214,7 +2214,7 @@ insert_user_block(const char *old_name, const char *new_name,const char *str,siz int ret; /* Generic status value */ /* Allocate space for the user block */ - user_block=HDcalloc(size,1); + user_block = HDcalloc(size, (size_t)1); CHECK(user_block, NULL, "HDcalloc"); /* Copy in the user block data */ @@ -2225,7 +2225,7 @@ insert_user_block(const char *old_name, const char *new_name,const char *str,siz CHECK(new_fp, NULL, "HDfopen"); /* Write the user block to the new file */ - written=HDfwrite(user_block,1,size,new_fp); + written = HDfwrite(user_block, (size_t)1, size, new_fp); VERIFY(written, size, "HDfwrite"); /* Open the old file */ @@ -2233,13 +2233,13 @@ insert_user_block(const char *old_name, const char *new_name,const char *str,siz CHECK(old_fp, NULL, "HDfopen"); /* Allocate space for the copy buffer */ - copy_buf=malloc(MISC13_COPY_BUF_SIZE); + copy_buf = HDmalloc((size_t)MISC13_COPY_BUF_SIZE); CHECK(copy_buf, NULL, "HDmalloc"); /* Copy data from the old file to the new file */ - while((read_in=fread(copy_buf,1,MISC13_COPY_BUF_SIZE,old_fp))>0) { + while((read_in = HDfread(copy_buf, (size_t)1, (size_t)MISC13_COPY_BUF_SIZE, old_fp)) > 0) { /* Write the data to the new file */ - written=fwrite(copy_buf,1,read_in,new_fp); + written = HDfwrite(copy_buf, (size_t)1, read_in, new_fp); VERIFY(written, read_in, "HDfwrite"); } /* end while */ @@ -2383,7 +2383,7 @@ test_misc13(void) verify_file(MISC13_FILE_1,(hsize_t)0,0); /* Create a new file by inserting a user block in front of the first file */ - insert_user_block(MISC13_FILE_1,MISC13_FILE_2,"Test String",MISC13_USERBLOCK_SIZE); + insert_user_block(MISC13_FILE_1, MISC13_FILE_2, "Test String", (size_t)MISC13_USERBLOCK_SIZE); /* Verify file contents are still correct */ verify_file(MISC13_FILE_2,(hsize_t)MISC13_USERBLOCK_SIZE,0); @@ -2684,13 +2684,13 @@ test_misc16(void) CHECK(sid, FAIL, "H5Screate_simple"); /* Create a datatype to refer to */ - tid = H5Tcopy (H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); CHECK(tid, FAIL, "H5Tcopy"); - ret = H5Tset_size (tid,MISC16_STR_SIZE); + ret = H5Tset_size(tid, (size_t)MISC16_STR_SIZE); CHECK(ret, FAIL, "H5Tset_size"); - /*ret = H5Tset_strpad (tid,H5T_STR_NULLPAD); + /*ret = H5Tset_strpad(tid,H5T_STR_NULLPAD); CHECK(ret, FAIL, "H5Tset_strpad");*/ /* Create a dataset */ @@ -3062,7 +3062,7 @@ test_misc19(void) /* Check H5I operations on datatypes */ /* Create a datatype */ - tid = H5Tcreate(H5T_OPAQUE,16); + tid = H5Tcreate(H5T_OPAQUE, (size_t)16); CHECK(tid, FAIL, "H5Tcreate"); /* Check the reference count */ @@ -3234,7 +3234,7 @@ test_misc19(void) CHECK(fid, FAIL, "H5Fcreate"); /* Create a group */ - gid = H5Gcreate(fid,MISC19_GROUP_NAME,0); + gid = H5Gcreate(fid, MISC19_GROUP_NAME, (size_t)0); CHECK(gid, FAIL, "H5Gcreate"); /* Check the reference count */ @@ -3792,7 +3792,7 @@ test_misc23(void) /* Build some infrastructure */ - group_id = H5Gcreate(file_id, "/A", 0); + group_id = H5Gcreate(file_id, "/A", (size_t)0); CHECK(group_id, FAIL, "H5Gcreate"); space_id = H5Screate_simple(1, dims, NULL); @@ -3807,12 +3807,12 @@ test_misc23(void) **********************************************************************/ H5E_BEGIN_TRY { - tmp_id = H5Gcreate(file_id, "/A/B00a/grp", 0); + tmp_id = H5Gcreate(file_id, "/A/B00a/grp", (size_t)0); } H5E_END_TRY; VERIFY(tmp_id, FAIL, "H5Gcreate"); - tmp_id = H5Gcreate(file_id, "/A/grp", 0); + tmp_id = H5Gcreate(file_id, "/A/grp", (size_t)0); CHECK(tmp_id, FAIL, "H5Gcreate"); status = H5Gclose(tmp_id); @@ -4349,7 +4349,7 @@ test_misc25a(void) /* Create dataype for attribute */ tid = H5Tcopy(H5T_C_S1); CHECK(tid, FAIL, "H5Tcopy"); - ret = H5Tset_size(tid, MISC25A_ATTR1_LEN); + ret = H5Tset_size(tid, (size_t)MISC25A_ATTR1_LEN); CHECK(ret, FAIL, "H5Tset_size"); /* Add 1st attribute on first group */ @@ -4375,7 +4375,7 @@ test_misc25a(void) /* Create dataype for attribute */ tid = H5Tcopy(H5T_C_S1); CHECK(tid, FAIL, "H5Tcopy"); - ret = H5Tset_size(tid, MISC25A_ATTR2_LEN); + ret = H5Tset_size(tid, (size_t)MISC25A_ATTR2_LEN); CHECK(ret, FAIL, "H5Tset_size"); /* Add 2nd attribute on first group */ @@ -4448,7 +4448,7 @@ test_misc25a(void) /* Create dataype for attribute */ tid = H5Tcopy(H5T_C_S1); CHECK(tid, FAIL, "H5Tcopy"); - ret = H5Tset_size(tid, MISC25A_ATTR3_LEN); + ret = H5Tset_size(tid, (size_t)MISC25A_ATTR3_LEN); CHECK(ret, FAIL, "H5Tset_size"); /* Add 3rd attribute on first group (smaller than 2nd attribute) */ @@ -4496,7 +4496,7 @@ test_misc25a(void) /* Create dataype for attribute */ tid = H5Tcopy(H5T_C_S1); CHECK(tid, FAIL, "H5Tcopy"); - ret = H5Tset_size(tid, MISC25A_ATTR2_LEN); + ret = H5Tset_size(tid, (size_t)MISC25A_ATTR2_LEN); CHECK(ret, FAIL, "H5Tset_size"); /* Re-create 2nd attribute on first group */ @@ -4560,7 +4560,7 @@ test_misc25a(void) /* Create dataype for attribute */ tid = H5Tcopy(H5T_C_S1); CHECK(tid, FAIL, "H5Tcopy"); - ret = H5Tset_size(tid, MISC25A_ATTR2_LEN); + ret = H5Tset_size(tid, (size_t)MISC25A_ATTR2_LEN); CHECK(ret, FAIL, "H5Tset_size"); /* Re-create 2nd attribute on first group */ diff --git a/test/trefer.c b/test/trefer.c index 614539f..24911be 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -243,11 +243,11 @@ test_reference_obj(void) CHECK(group, FAIL, "H5Rdereference"); /* Get group's comment */ - ret=H5Gget_comment(group,".",10,read_comment); + ret = H5Gget_comment(group, ".", (size_t)10, read_comment); CHECK(ret, FAIL, "H5Gget_comment"); /* Check for correct comment value */ - if(HDstrcmp(write_comment,read_comment)!=0) + if(HDstrcmp(write_comment, read_comment) != 0) TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n",write_comment,read_comment); /* Close group */ @@ -323,10 +323,10 @@ test_reference_region(void) MESSAGE(5, ("Testing Dataset Region Reference Functions\n")); /* Allocate write & read buffers */ - wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf=malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); - dwbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - drbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + rbuf = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + drbuf = HDcalloc(sizeof(uint8_t),(size_t)(SPACE2_DIM1 * SPACE2_DIM2)); /* Create file */ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -389,7 +389,7 @@ test_reference_region(void) coord1[7][0]=9; coord1[7][1]=0; coord1[8][0]=7; coord1[8][1]=1; coord1[9][0]=3; coord1[9][1]=3; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); + ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); ret = (int)H5Sget_select_npoints(sid2); @@ -584,10 +584,10 @@ test_reference_region_1D(void) MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n")); /* Allocate write & read buffers */ - wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf=malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); - dwbuf=malloc(sizeof(uint8_t)*SPACE3_DIM1); - drbuf=calloc(sizeof(uint8_t),SPACE3_DIM1); + wbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + rbuf = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); + drbuf = HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); /* Create file */ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -650,7 +650,7 @@ test_reference_region_1D(void) coord1[7][0]=89; coord1[8][0]=97; coord1[9][0]=03; - ret = H5Sselect_elements(sid3,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); + ret = H5Sselect_elements(sid3, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); ret = (int)H5Sget_select_npoints(sid3); @@ -1054,7 +1054,7 @@ test_reference_group(void) VERIFY(nobjs, 3, "H5Gget_num_objs"); - ret = H5Gget_objname_by_idx(gid, (hsize_t)0, objname, NAME_SIZE); + ret = H5Gget_objname_by_idx(gid, (hsize_t)0, objname, (size_t)NAME_SIZE); CHECK(ret, FAIL, "H5Gget_objname_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Gget_objname_by_idx"); diff --git a/test/tselect.c b/test/tselect.c index 030d8b7..43299cc 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -221,8 +221,8 @@ test_select_hyper(hid_t xfer_plist) MESSAGE(5, ("Testing Hyperslab Selection Functions\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -415,8 +415,8 @@ test_select_point(hid_t xfer_plist) MESSAGE(5, ("Testing Element Selection Functions\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -446,7 +446,7 @@ test_select_point(hid_t xfer_plist) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); + ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -471,7 +471,7 @@ test_select_point(hid_t xfer_plist) coord1[7][0]=1; coord1[7][1]=14; coord1[7][2]= 6; coord1[8][0]=2; coord1[8][1]= 2; coord1[8][2]= 5; coord1[9][0]=0; coord1[9][1]= 6; coord1[9][2]=13; - ret = H5Sselect_elements(sid1,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hsize_t **)coord1); + ret = H5Sselect_elements(sid1, H5S_SELECT_APPEND, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -496,7 +496,7 @@ test_select_point(hid_t xfer_plist) coord2[7][0]=29; coord2[7][1]= 4; coord2[8][0]= 8; coord2[8][1]= 8; coord2[9][0]=19; coord2[9][1]=17; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); + ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -525,7 +525,7 @@ test_select_point(hid_t xfer_plist) coord2[7][0]=12; coord2[7][1]= 2; coord2[8][0]=21; coord2[8][1]=12; coord2[9][0]= 9; coord2[9][1]=18; - ret = H5Sselect_elements(sid2,H5S_SELECT_PREPEND,POINT1_NPOINTS,(const hsize_t **)coord2); + ret = H5Sselect_elements(sid2, H5S_SELECT_PREPEND, (size_t)POINT1_NPOINTS, (const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -567,7 +567,7 @@ test_select_point(hid_t xfer_plist) coord3[7][0]= 1; coord3[7][1]=22; coord3[8][0]=12; coord3[8][1]=21; coord3[9][0]=11; coord3[9][1]= 6; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3); + ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -591,7 +591,7 @@ test_select_point(hid_t xfer_plist) coord3[7][0]= 9; coord3[7][1]=16; coord3[8][0]=12; coord3[8][1]=22; coord3[9][0]=13; coord3[9][1]= 9; - ret = H5Sselect_elements(sid2,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hsize_t **)coord3); + ret = H5Sselect_elements(sid2, H5S_SELECT_APPEND, (size_t)POINT1_NPOINTS, (const hsize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -690,8 +690,8 @@ test_select_all(hid_t xfer_plist) MESSAGE(5, ("Testing 'All' Selection Functions\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE4_DIM1*SPACE4_DIM2*SPACE4_DIM3); - rbuf=calloc(sizeof(uint8_t),SPACE4_DIM1*SPACE4_DIM2*SPACE4_DIM3); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++) @@ -774,8 +774,8 @@ test_select_all_hyper(hid_t xfer_plist) MESSAGE(5, ("Testing 'All' Selection Functions\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -913,8 +913,8 @@ test_select_combo(void) MESSAGE(5, ("Testing Combination of Hyperslab & Element Selection Functions\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -944,7 +944,7 @@ test_select_combo(void) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); + ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Select 1x10 hyperslab for writing memory dataset */ @@ -1077,8 +1077,8 @@ test_select_hyper_stride(hid_t xfer_plist) MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1141,8 +1141,8 @@ test_select_hyper_stride(hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Sort the locations into the proper order */ - qsort(loc1,72,sizeof(size_t),compare_size_t); - qsort(loc2,72,sizeof(size_t),compare_size_t); + HDqsort(loc1, (size_t)72, sizeof(size_t), compare_size_t); + HDqsort(loc2, (size_t)72, sizeof(size_t), compare_size_t); /* Compare data read with data written out */ for(i=0; i<72; i++) { tbuf=wbuf+loc1[i]; @@ -1202,8 +1202,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) MESSAGE(5, ("Testing Contiguous Hyperslabs Functionality\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint16_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1329,8 +1329,8 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) MESSAGE(5, ("Testing More Contiguous Hyperslabs Functionality\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint16_t)*SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); - rbuf=HDcalloc(sizeof(uint16_t),SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); + wbuf = HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4); + rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE8_DIM1; i++) @@ -1453,8 +1453,8 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) MESSAGE(5, ("Testing Yet More Contiguous Hyperslabs Functionality\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint16_t)*SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); - rbuf=HDcalloc(sizeof(uint16_t),SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); + wbuf = HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4); + rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE8_DIM4; i++) @@ -1590,9 +1590,9 @@ test_select_hyper_copy(void) MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); - rbuf2=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); + rbuf2 = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1747,9 +1747,9 @@ test_select_point_copy(void) MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); - rbuf2=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); + rbuf2 = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1779,7 +1779,7 @@ test_select_point_copy(void) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); + ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Select sequence of ten points for write dataset */ @@ -1793,7 +1793,7 @@ test_select_point_copy(void) coord2[7][0]=29; coord2[7][1]= 4; coord2[8][0]= 8; coord2[8][1]= 8; coord2[9][0]=19; coord2[9][1]=17; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); + ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Make a copy of the dataspace to write */ @@ -1837,7 +1837,7 @@ test_select_point_copy(void) coord3[7][0]= 1; coord3[7][1]=22; coord3[8][0]=12; coord3[8][1]=21; coord3[9][0]=11; coord3[9][1]= 6; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3); + ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Make a copy of the dataspace to read */ @@ -1920,8 +1920,8 @@ test_select_hyper_offset(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with Offsets\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -2075,8 +2075,8 @@ test_select_hyper_offset2(void) MESSAGE(5, ("Testing More Hyperslab Selection Functions with Offsets\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2); - rbuf=HDcalloc(sizeof(uint8_t),SPACE7_DIM1*SPACE7_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE7_DIM1 * SPACE7_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -2195,8 +2195,8 @@ test_select_point_offset(void) MESSAGE(5, ("Testing Element Selection Functions\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -2226,7 +2226,7 @@ test_select_point_offset(void) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); + ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Check a valid offset */ @@ -2261,7 +2261,7 @@ test_select_point_offset(void) coord2[7][0]=23; coord2[7][1]= 4; coord2[8][0]= 8; coord2[8][1]= 8; coord2[9][0]=19; coord2[9][1]=17; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); + ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Choose a valid offset for the memory dataspace */ @@ -2297,7 +2297,7 @@ test_select_point_offset(void) coord3[7][0]= 1; coord3[7][1]=22; coord3[8][0]=12; coord3[8][1]=21; coord3[9][0]=11; coord3[9][1]= 6; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3); + ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Read selection from disk */ @@ -2372,8 +2372,8 @@ test_select_hyper_union(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3230,8 +3230,8 @@ test_select_hyper_and_2d(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with intersection of 2-D hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3356,8 +3356,8 @@ test_select_hyper_xor_2d(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with XOR of 2-D hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3484,8 +3484,8 @@ test_select_hyper_notb_2d(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTB of 2-D hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3611,8 +3611,8 @@ test_select_hyper_nota_2d(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTA of 2-D hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3768,8 +3768,8 @@ test_select_hyper_union_random_5d(hid_t read_plist) MESSAGE(5, ("Testing Hyperslab Selection Functions with random unions of 5-D hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=HDmalloc(sizeof(int)*SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5); - rbuf=HDcalloc(sizeof(int),SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5); + wbuf = HDmalloc(sizeof(int) * SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5); + rbuf = HDcalloc(sizeof(int), (size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5)); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE5_DIM1; i++) @@ -3896,7 +3896,7 @@ printf("random I/O, after H5Dread()\n"); } /* Set the read buffer back to all zeroes */ - memset(rbuf,0,SPACE6_DIM1); + HDmemset(rbuf, 0, (size_t)SPACE6_DIM1); } /* end for */ /* Close memory dataspace */ @@ -3958,8 +3958,8 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) MESSAGE(5, ("Testing Hyperslab I/O on Large Chunks\n")); /* Allocate the transfer buffers */ - data = HDmalloc(sizeof(short)*X*Y*Z); - data_out = HDcalloc(NX*NY*NZ,sizeof(short)); + data = HDmalloc(sizeof(short) * X * Y * Z); + data_out = HDcalloc((size_t)(NX * NY * NZ), sizeof(short)); /* * Data buffer initialization. @@ -4191,8 +4191,8 @@ test_select_point_chunk(void) MESSAGE(5, ("Testing Point Selections on Chunked Datasets\n")); /* Allocate the transfer buffers */ - data = (unsigned*)HDmalloc(sizeof(unsigned)*SPACE7_DIM1*SPACE7_DIM2); - data_out = (unsigned*)HDcalloc(SPACE7_DIM1*SPACE7_DIM2,sizeof(unsigned)); + data = (unsigned*)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); + data_out = (unsigned*)HDcalloc((size_t)(SPACE7_DIM1 * SPACE7_DIM2), sizeof(unsigned)); /* * Data buffer initialization. @@ -4247,7 +4247,7 @@ test_select_point_chunk(void) points[6][1]=1; points[7][0]=6; /* In same chunk as point #3, but "earlier" in chunk */ points[7][1]=6; - ret = H5Sselect_elements(pnt1_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hsize_t **)points); + ret = H5Sselect_elements(pnt1_space, H5S_SELECT_SET, (size_t)SPACE7_NPOINTS, (const hsize_t **)points); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create 1st hyperslab selection */ @@ -4283,7 +4283,7 @@ test_select_point_chunk(void) points[6][1]=2; points[7][0]=7; /* In same chunk as point #3, but "earlier" in chunk */ points[7][1]=7; - ret = H5Sselect_elements(pnt2_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hsize_t **)points); + ret = H5Sselect_elements(pnt2_space, H5S_SELECT_SET, (size_t)SPACE7_NPOINTS, (const hsize_t **)points); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create 2nd hyperslab selection */ @@ -5555,7 +5555,7 @@ test_scalar_select(void) /* Select one element in memory with a point selection */ coord1[0]=0; coord1[1]= 2; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,1,(const hsize_t **)&coord1); + ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)1, (const hsize_t **)&coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Write single point to disk */ @@ -5674,7 +5674,7 @@ test_scalar_select2(void) /* Select one element in memory with a point selection */ coord1[0]=0; H5E_BEGIN_TRY { - ret = H5Sselect_elements(sid,H5S_SELECT_SET,1,(const hsize_t **)&coord1); + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t **)&coord1); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sselect_elements"); @@ -5760,8 +5760,8 @@ test_shape_same(void) CHECK(single_pt_sid, FAIL, "H5Screate_simple"); /* Select sequence of ten points for multiple point selection */ - coord1[0][0]=2; coord1[0][1]=2; - ret = H5Sselect_elements(single_pt_sid,H5S_SELECT_SET,1,(const hsize_t **)coord1); + coord1[0][0] = 2; coord1[0][1] = 2; + ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create dataspace for multiple point selection */ @@ -5779,7 +5779,7 @@ test_shape_same(void) coord2[7][0]=1; coord2[7][1]=0; coord2[8][0]=5; coord2[8][1]=1; coord2[9][0]=9; coord2[9][1]=3; - ret = H5Sselect_elements(mult_pt_sid,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); + ret = H5Sselect_elements(mult_pt_sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create dataspace for single hyperslab selection */ @@ -6392,7 +6392,7 @@ test_shape_same(void) for(v=0; v<2; v++) { coord2[v][0]=u; coord2[v][1]=(v*2)+2; } /* end for */ - ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,2,(const hsize_t **)coord2); + ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, (size_t)2, (const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ @@ -7602,7 +7602,7 @@ test_select_bounds(void) coord[1][0]= 3; coord[1][1]= 96; coord[2][0]= 96; coord[2][1]= 3; coord[3][0]= 96; coord[3][1]= 96; - ret = H5Sselect_elements(sid,H5S_SELECT_SET,SPACE11_NPOINTS,(const hsize_t **)coord); + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)SPACE11_NPOINTS, (const hsize_t **)coord); CHECK(ret, FAIL, "H5Sselect_elements"); /* Get bounds for point selection */ diff --git a/test/tskiplist.c b/test/tskiplist.c index 5b54dbd..cea7983 100644 --- a/test/tskiplist.c +++ b/test/tskiplist.c @@ -69,7 +69,7 @@ test_skiplist_init(void) size_t u,v; /* Local index variables */ /* Initialize random number seed */ - curr_time=time(NULL); + curr_time = HDtime(NULL); HDsrandom((unsigned long)curr_time); /* Create randomized set of numbers */ @@ -95,13 +95,13 @@ test_skiplist_init(void) HDmemcpy(sort_rand_num,rand_num,sizeof(int)*NUM_ELEMS); /* Sort random numbers */ - HDqsort(sort_rand_num,NUM_ELEMS,sizeof(int),tst_sort); + HDqsort(sort_rand_num, (size_t)NUM_ELEMS, sizeof(int), tst_sort); /* Copy random values to reverse sorted array */ - HDmemcpy(rev_sort_rand_num,rand_num,sizeof(int)*NUM_ELEMS); + HDmemcpy(rev_sort_rand_num, rand_num, sizeof(int) * NUM_ELEMS); /* Sort random numbers */ - HDqsort(rev_sort_rand_num,NUM_ELEMS,sizeof(int),tst_rev_sort); + HDqsort(rev_sort_rand_num, (size_t)NUM_ELEMS, sizeof(int), tst_rev_sort); } /* end test_tst_init() */ /**************************************************************** @@ -120,7 +120,7 @@ test_skiplist_create(void) MESSAGE(6, ("Testing Creating & Closing Skip Lists\n")); /* Try creating a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5,16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Try closing the skip list */ @@ -150,7 +150,7 @@ test_skiplist_insert(void) MESSAGE(7, ("Testing Insertion Into Skip List\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -211,7 +211,7 @@ test_skiplist_insert_many(void) MESSAGE(7, ("Testing Insertion of Many Items Into Skip List\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -285,7 +285,7 @@ test_skiplist_remove(void) MESSAGE(7, ("Testing Removal From Skip List\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -364,7 +364,7 @@ test_skiplist_remove_many(void) MESSAGE(7, ("Testing Removal of Many Items From Skip List\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -464,7 +464,7 @@ test_skiplist_firstnext(void) MESSAGE(7, ("Testing Iterating Over Skip List With First/Next\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -556,7 +556,7 @@ test_skiplist_string(void) MESSAGE(7, ("Testing Skip List With String Keys\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_STR, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -618,7 +618,7 @@ test_skiplist_iterate(void) MESSAGE(7, ("Testing Iterating Over Skip List\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -668,7 +668,7 @@ test_skiplist_hsize(void) MESSAGE(7, ("Testing Skip List With hsize_t Keys\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_HSIZE, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_HSIZE, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -723,7 +723,7 @@ test_skiplist_unsigned(void) MESSAGE(7, ("Testing Skip List With unsigned Keys\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -776,7 +776,7 @@ test_skiplist_lastprev(void) MESSAGE(7, ("Testing Iterating Over Skip List With Last/Prev\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Check that the skip list has no elements */ @@ -844,7 +844,7 @@ test_skiplist_find(void) MESSAGE(7, ("Testing Skip List 'Find' Operation\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Insert objects into the skip list */ @@ -900,7 +900,7 @@ test_skiplist_add(void) MESSAGE(7, ("Testing Skip List 'Add' Operation\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Insert objects into the skip list */ @@ -962,7 +962,7 @@ test_skiplist_destroy(void) MESSAGE(7, ("Testing Skip List 'Destroy' Operation\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Insert objects into the skip list */ @@ -998,7 +998,7 @@ test_skiplist_free(void) MESSAGE(7, ("Testing Skip List 'Free' Operation\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_INT, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Insert objects into the skip list */ @@ -1054,7 +1054,7 @@ test_skiplist_less(void) MESSAGE(7, ("Testing Skip List 'Less' Operation\n")); /* Create a skip list */ - slist=H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Insert objects into the skip list */ @@ -1118,7 +1118,7 @@ test_skiplist_greater(void) MESSAGE(7, ("Testing Skip List 'Greater' Operation\n")); /* Create a skip list */ - slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Insert objects into the skip list */ @@ -1181,7 +1181,7 @@ test_skiplist_remove_first(void) MESSAGE(7, ("Testing Skip List 'Greater' Operation\n")); /* Create a skip list */ - slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, 16); + slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16); CHECK(slist, NULL, "H5SL_create"); /* Insert objects into the skip list */ diff --git a/test/tunicode.c b/test/tunicode.c index 16d3764..2d318ef 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -122,195 +122,195 @@ void test_fl_string(hid_t fid, const char *string) */ void test_strpad(hid_t UNUSED fid, const char *string) { - /* buf is used to hold the data that H5Tconvert operates on. */ - char buf[LONG_BUF_SIZE]; - - /* cmpbuf holds the output that H5Tconvert should produce, - * to compare against the actual output. */ - char cmpbuf[LONG_BUF_SIZE]; - - /* new_string is a slightly modified version of the UTF-8 - * string to make the tests run more smoothly. */ - char new_string[MAX_STRING_LENGTH + 2]; - - unsigned int length; /* Length of new_string in bytes */ - unsigned int small_len; /* Size of the small datatype */ - unsigned int big_len; /* Size of the larger datatype */ - hid_t src_type, dst_type; - herr_t ret; - - /* The following tests are simpler if the UTF-8 string contains - * the right number of bytes (even or odd, depending on the test). - * We create a 'new_string' whose length is convenient by prepending - * an 'x' to 'string' when necessary. */ - length = strlen(string); - if(length % 2 != 1) - { - strcpy(new_string, "x"); - strcat(new_string, string); - length++; - } else { - strcpy(new_string, string); - } - - - /* Convert a null-terminated string to a shorter and longer null - * terminated string. */ - - /* Create a src_type that holds the UTF-8 string and its final NULL */ - big_len = length + 1; /* +1 byte for final NULL */ - src_type = mkstr(big_len, H5T_STR_NULLTERM); - CHECK(src_type, FAIL, "mkstr"); - /* Create a dst_type that holds half of the UTF-8 string and a final - * NULL */ - small_len = (length +1) / 2; - dst_type = mkstr(small_len, H5T_STR_NULLTERM); - CHECK(dst_type, FAIL, "mkstr"); - - /* Fill the buffer with two copies of the UTF-8 string, each with a - * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ - strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); - - ret = H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Tconvert"); - - /* After conversion, the buffer should look like - * "abc\0abc\0abcdefg\0". Note that this is just what the bytes look - * like; UTF-8 characters may well have been truncated. - * To check that the conversion worked properly, we'll build this - * string manually. */ - strncpy(cmpbuf, new_string, small_len -1); - cmpbuf[small_len - 1] = '\0'; - strncpy(&cmpbuf[small_len], new_string, small_len -1); - cmpbuf[2 * small_len - 1] = '\0'; - strcpy(&cmpbuf[2 * small_len], new_string); - - VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); - - /* Now convert from smaller datatype to bigger datatype. This should - * leave our buffer looking like: "abc\0\0\0\0\0abc\0\0\0\0\0" */ - ret = H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Tconvert"); - - /* First fill the buffer with NULLs */ - HDmemset(cmpbuf, '\0', LONG_BUF_SIZE); - /* Copy in the characters */ - strncpy(cmpbuf, new_string, small_len -1); - strncpy(&cmpbuf[big_len], new_string, small_len -1); - - VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); - - ret = H5Tclose(src_type); - CHECK(ret, FAIL, "H5Tclose"); - ret = H5Tclose(dst_type); - CHECK(ret, FAIL, "H5Tclose"); - - - /* Now test null padding. Null-padded strings do *not* need - * terminating NULLs, so the sizes of the datatypes are slightly - * different and we want a string with an even number of characters. */ - length = strlen(string); - if(length % 2 != 0) - { - strcpy(new_string, "x"); - strcat(new_string, string); - length++; - } else { - strcpy(new_string, string); - } - - /* Create a src_type that holds the UTF-8 string */ - big_len = length; - src_type = mkstr(big_len, H5T_STR_NULLPAD); - CHECK(src_type, FAIL, "mkstr"); - /* Create a dst_type that holds half of the UTF-8 string */ - small_len = length / 2; - dst_type = mkstr(small_len, H5T_STR_NULLPAD); - CHECK(dst_type, FAIL, "mkstr"); - - /* Fill the buffer with two copies of the UTF-8 string. - * It will look like "abcdefghabcdefgh". */ - strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); - - ret = H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Tconvert"); - - /* After conversion, the buffer should look like - * "abcdabcdabcdefgh". Note that this is just what the bytes look - * like; UTF-8 characters may well have been truncated. - * To check that the conversion worked properly, we'll build this - * string manually. */ - strncpy(cmpbuf, new_string, small_len); - strncpy(&cmpbuf[small_len], new_string, small_len); - strncpy(&cmpbuf[2 * small_len], new_string, big_len); - - VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); - - /* Now convert from smaller datatype to bigger datatype. This should - * leave our buffer looking like: "abcd\0\0\0\0abcd\0\0\0\0" */ - ret = H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Tconvert"); - - /* First fill the buffer with NULLs */ - HDmemset(cmpbuf, '\0', LONG_BUF_SIZE); - /* Copy in the characters */ - strncpy(cmpbuf, new_string, small_len); - strncpy(&cmpbuf[big_len], new_string, small_len); - - VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); - - ret = H5Tclose(src_type); - CHECK(ret, FAIL, "H5Tclose"); - ret = H5Tclose(dst_type); - CHECK(ret, FAIL, "H5Tclose"); - - - /* Test space padding. This is very similar to null-padding; we can - use the same values of length, small_len, and big_len. */ - - src_type = mkstr(big_len, H5T_STR_SPACEPAD); - CHECK(src_type, FAIL, "mkstr"); - dst_type = mkstr(small_len, H5T_STR_SPACEPAD); - CHECK(src_type, FAIL, "mkstr"); - - /* Fill the buffer with two copies of the UTF-8 string. - * It will look like "abcdefghabcdefgh". */ - strcpy(buf, new_string); - strcpy(&buf[big_len], new_string); - - ret = H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Tconvert"); - - /* After conversion, the buffer should look like - * "abcdabcdabcdefgh". Note that this is just what the bytes look - * like; UTF-8 characters may have been truncated. - * To check that the conversion worked properly, we'll build this - * string manually. */ - strncpy(cmpbuf, new_string, small_len); - strncpy(&cmpbuf[small_len], new_string, small_len); - strncpy(&cmpbuf[2 * small_len], new_string, big_len); - - VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); - - /* Now convert from smaller datatype to bigger datatype. This should - * leave our buffer looking like: "abcd abcd " */ - ret = H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Tconvert"); - - /* First fill the buffer with spaces */ - HDmemset(cmpbuf, ' ', LONG_BUF_SIZE); - /* Copy in the characters */ - strncpy(cmpbuf, new_string, small_len); - strncpy(&cmpbuf[big_len], new_string, small_len); - - VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); - - ret = H5Tclose(src_type); - CHECK(ret, FAIL, "H5Tclose"); - ret = H5Tclose(dst_type); - CHECK(ret, FAIL, "H5Tclose"); + /* buf is used to hold the data that H5Tconvert operates on. */ + char buf[LONG_BUF_SIZE]; + + /* cmpbuf holds the output that H5Tconvert should produce, + * to compare against the actual output. */ + char cmpbuf[LONG_BUF_SIZE]; + + /* new_string is a slightly modified version of the UTF-8 + * string to make the tests run more smoothly. */ + char new_string[MAX_STRING_LENGTH + 2]; + + size_t length; /* Length of new_string in bytes */ + size_t small_len; /* Size of the small datatype */ + size_t big_len; /* Size of the larger datatype */ + hid_t src_type, dst_type; + herr_t ret; + + /* The following tests are simpler if the UTF-8 string contains + * the right number of bytes (even or odd, depending on the test). + * We create a 'new_string' whose length is convenient by prepending + * an 'x' to 'string' when necessary. */ + length = HDstrlen(string); + if(length % 2 != 1) + { + HDstrcpy(new_string, "x"); + HDstrcat(new_string, string); + length++; + } else { + HDstrcpy(new_string, string); + } + + + /* Convert a null-terminated string to a shorter and longer null + * terminated string. */ + + /* Create a src_type that holds the UTF-8 string and its final NULL */ + big_len = length + 1; /* +1 byte for final NULL */ + src_type = mkstr(big_len, H5T_STR_NULLTERM); + CHECK(src_type, FAIL, "mkstr"); + /* Create a dst_type that holds half of the UTF-8 string and a final + * NULL */ + small_len = (length + 1) / 2; + dst_type = mkstr(small_len, H5T_STR_NULLTERM); + CHECK(dst_type, FAIL, "mkstr"); + + /* Fill the buffer with two copies of the UTF-8 string, each with a + * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ + strncpy(buf, new_string, big_len); + strncpy(&buf[big_len], new_string, big_len); + + ret = H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tconvert"); + + /* After conversion, the buffer should look like + * "abc\0abc\0abcdefg\0". Note that this is just what the bytes look + * like; UTF-8 characters may well have been truncated. + * To check that the conversion worked properly, we'll build this + * string manually. */ + HDstrncpy(cmpbuf, new_string, small_len - 1); + cmpbuf[small_len - 1] = '\0'; + HDstrncpy(&cmpbuf[small_len], new_string, small_len -1); + cmpbuf[2 * small_len - 1] = '\0'; + HDstrcpy(&cmpbuf[2 * small_len], new_string); + + VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); + + /* Now convert from smaller datatype to bigger datatype. This should + * leave our buffer looking like: "abc\0\0\0\0\0abc\0\0\0\0\0" */ + ret = H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tconvert"); + + /* First fill the buffer with NULLs */ + HDmemset(cmpbuf, '\0', LONG_BUF_SIZE); + /* Copy in the characters */ + HDstrncpy(cmpbuf, new_string, small_len -1); + HDstrncpy(&cmpbuf[big_len], new_string, small_len -1); + + VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); + + ret = H5Tclose(src_type); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Tclose(dst_type); + CHECK(ret, FAIL, "H5Tclose"); + + + /* Now test null padding. Null-padded strings do *not* need + * terminating NULLs, so the sizes of the datatypes are slightly + * different and we want a string with an even number of characters. */ + length = HDstrlen(string); + if(length % 2 != 0) + { + HDstrcpy(new_string, "x"); + HDstrcat(new_string, string); + length++; + } else { + HDstrcpy(new_string, string); + } + + /* Create a src_type that holds the UTF-8 string */ + big_len = length; + src_type = mkstr(big_len, H5T_STR_NULLPAD); + CHECK(src_type, FAIL, "mkstr"); + /* Create a dst_type that holds half of the UTF-8 string */ + small_len = length / 2; + dst_type = mkstr(small_len, H5T_STR_NULLPAD); + CHECK(dst_type, FAIL, "mkstr"); + + /* Fill the buffer with two copies of the UTF-8 string. + * It will look like "abcdefghabcdefgh". */ + strncpy(buf, new_string, big_len); + strncpy(&buf[big_len], new_string, big_len); + + ret = H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tconvert"); + + /* After conversion, the buffer should look like + * "abcdabcdabcdefgh". Note that this is just what the bytes look + * like; UTF-8 characters may well have been truncated. + * To check that the conversion worked properly, we'll build this + * string manually. */ + HDstrncpy(cmpbuf, new_string, small_len); + HDstrncpy(&cmpbuf[small_len], new_string, small_len); + HDstrncpy(&cmpbuf[2 * small_len], new_string, big_len); + + VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); + + /* Now convert from smaller datatype to bigger datatype. This should + * leave our buffer looking like: "abcd\0\0\0\0abcd\0\0\0\0" */ + ret = H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tconvert"); + + /* First fill the buffer with NULLs */ + HDmemset(cmpbuf, '\0', LONG_BUF_SIZE); + /* Copy in the characters */ + HDstrncpy(cmpbuf, new_string, small_len); + HDstrncpy(&cmpbuf[big_len], new_string, small_len); + + VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); + + ret = H5Tclose(src_type); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Tclose(dst_type); + CHECK(ret, FAIL, "H5Tclose"); + + + /* Test space padding. This is very similar to null-padding; we can + use the same values of length, small_len, and big_len. */ + + src_type = mkstr(big_len, H5T_STR_SPACEPAD); + CHECK(src_type, FAIL, "mkstr"); + dst_type = mkstr(small_len, H5T_STR_SPACEPAD); + CHECK(src_type, FAIL, "mkstr"); + + /* Fill the buffer with two copies of the UTF-8 string. + * It will look like "abcdefghabcdefgh". */ + HDstrcpy(buf, new_string); + HDstrcpy(&buf[big_len], new_string); + + ret = H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tconvert"); + + /* After conversion, the buffer should look like + * "abcdabcdabcdefgh". Note that this is just what the bytes look + * like; UTF-8 characters may have been truncated. + * To check that the conversion worked properly, we'll build this + * string manually. */ + HDstrncpy(cmpbuf, new_string, small_len); + HDstrncpy(&cmpbuf[small_len], new_string, small_len); + HDstrncpy(&cmpbuf[2 * small_len], new_string, big_len); + + VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); + + /* Now convert from smaller datatype to bigger datatype. This should + * leave our buffer looking like: "abcd abcd " */ + ret = H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tconvert"); + + /* First fill the buffer with spaces */ + HDmemset(cmpbuf, ' ', LONG_BUF_SIZE); + /* Copy in the characters */ + HDstrncpy(cmpbuf, new_string, small_len); + HDstrncpy(&cmpbuf[big_len], new_string, small_len); + + VERIFY(HDmemcmp(buf, cmpbuf, 2*big_len), 0, "HDmemcmp"); + + ret = H5Tclose(src_type); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Tclose(dst_type); + CHECK(ret, FAIL, "H5Tclose"); } |