diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-23 20:40:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-23 20:40:14 (GMT) |
commit | e40557304fcfc662bb1a445abca516ee4b246d94 (patch) | |
tree | c9f1692443a62e0c481c7c0278e39d7b83d1b419 /test | |
parent | 1062b4f9d7080a3e439df7d3d527aee43f96d085 (diff) | |
download | hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.zip hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.tar.gz hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.tar.bz2 |
[svn-r12803] Description:
Finish new version of the I/O pipeline message, which is much smaller than
the previous version. This version is used with the "use the latest version
of the format" flag.
Closed several memory leaks/overruns (found with valgrind).
Also, lots of compiler & formatting cleanups.
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 225 | ||||
-rw-r--r-- | test/dtransform.c | 2 | ||||
-rw-r--r-- | test/fillval.c | 61 | ||||
-rw-r--r-- | test/tarray.c | 4 | ||||
-rw-r--r-- | test/tattr.c | 22 | ||||
-rw-r--r-- | test/tfile.c | 14 | ||||
-rw-r--r-- | test/th5o.c | 8 | ||||
-rw-r--r-- | test/th5s.c | 14 |
8 files changed, 195 insertions, 155 deletions
diff --git a/test/dsets.c b/test/dsets.c index 8a8f9f0..b35e965 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1651,7 +1651,7 @@ error: */ #ifdef H5_HAVE_FILTER_SZIP static herr_t -test_filter_noencoder(const char *dset_name) +test_filter_noencoder(const char *dset_name, hid_t fapl) { hid_t file_id = -1; hid_t dset_id = -1; @@ -1677,7 +1677,7 @@ test_filter_noencoder(const char *dset_name) } HDstrcat(testfile, NOENCODER_FILENAME); - file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); + file_id = H5Fopen(testfile, H5F_ACC_RDWR, fapl); if (file_id < 0) goto error; dset_id = H5Dopen(file_id, dset_name); @@ -1749,15 +1749,15 @@ test_filter_noencoder(const char *dset_name) error: H5_FAILED(); if (dset_id != -1) - H5Dclose(dset_id); + H5Dclose(dset_id); if (test_dset_id != -1) - H5Dclose(test_dset_id); + H5Dclose(test_dset_id); if (space_id != -1) - H5Sclose(space_id); + H5Sclose(space_id); if (dcpl_id != -1) - H5Pclose(dcpl_id); + H5Pclose(dcpl_id); if (file_id != -1) - H5Fclose(file_id); + H5Fclose(file_id); return -1; } #endif /* H5_HAVE_FILTER_SZIP */ @@ -1868,7 +1868,11 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_filters(hid_t file) +test_filters(hid_t file, hid_t +#ifndef H5_HAVE_FILTER_SZIP +UNUSED +#endif /* H5_HAVE_FILTER_SZIP */ + fapl) { hid_t dc; /* Dataset creation property list ID */ const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ @@ -2006,7 +2010,7 @@ test_filters(hid_t file) if ( h5_szip_can_encode() != 1) { puts(""); - if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error; + if(test_filter_noencoder(NOENCODER_SZIP_DATASET, fapl) < 0) goto error; } else { SKIPPED(); } @@ -5696,12 +5700,10 @@ error: * Programmer: Pedro Vicente * Monday, March 8, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -test_filters_endianess(void) +test_filters_endianess(hid_t fapl) { hid_t fid=-1; /* file ID */ hid_t dsid=-1; /* dataset ID */ @@ -5727,7 +5729,7 @@ test_filters_endianess(void) *------------------------------------------------------------------------- */ /* create a file using default properties */ - fid=H5Fcreate("test_filters.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); + if((fid = H5Fcreate("test_filters.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; /* create a data space */ if ((sid = H5Screate_simple(rank,dims,NULL))<0) goto error; @@ -5756,17 +5758,15 @@ test_filters_endianess(void) */ /* compose the name of the file to open, using the srcdir, if appropriate */ - strcpy(data_file, ""); - if ( srcdir ) - { - strcpy(data_file, srcdir); - strcat(data_file, "/"); + HDstrcpy(data_file, ""); + if ( srcdir ) { + HDstrcpy(data_file, srcdir); + HDstrcat(data_file, "/"); } - strcat( data_file, "test_filters_le.hdf5"); + strcat( data_file, "test_filters_le.hdf5"); /* open */ - if ((fid=H5Fopen(data_file,H5F_ACC_RDONLY,H5P_DEFAULT))<0) - goto error; + if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto error; /* read */ if (auxread_fdata(fid,"dset")<0) goto error; @@ -5780,17 +5780,15 @@ test_filters_endianess(void) */ /* compose the name of the file to open, using the srcdir, if appropriate */ - strcpy(data_file, ""); - if ( srcdir ) - { - strcpy(data_file, srcdir); - strcat(data_file, "/"); + HDstrcpy(data_file, ""); + if ( srcdir ) { + HDstrcpy(data_file, srcdir); + HDstrcat(data_file, "/"); } - strcat( data_file, "test_filters_be.hdf5"); + HDstrcat( data_file, "test_filters_be.hdf5"); /* open */ - if ((fid=H5Fopen(data_file,H5F_ACC_RDONLY,H5P_DEFAULT))<0) - goto error; + if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto error; /* read */ if (auxread_fdata(fid,"dset")<0) goto error; @@ -5982,92 +5980,125 @@ error: int main(void) { - hid_t file, grp, fapl; - int mdc_nelmts; - size_t rdcc_nelmts; - size_t rdcc_nbytes; - double rdcc_w0; - int nerrors=0; - char filename[1024]; - const char *envval = NULL; + int nerrors = 0; + const char *envval; /* Don't run this test using certain file drivers */ envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) + if(envval == NULL) envval = "nomatch"; - if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { + if(HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { + char filename[1024]; + hid_t file, grp, fapl, fapl2; + hbool_t new_format; + int mdc_nelmts; + size_t rdcc_nelmts; + size_t rdcc_nbytes; + double rdcc_w0; + + /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); /* Set the random # seed */ HDsrandom((unsigned long)HDtime(NULL)); + /* Copy the file access property list */ + if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR + + /* Set the "use the latest version of the format" flag for creating objects in the file */ + if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Turn off the chunk cache, so all the chunks are immediately written to disk */ - if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0)<0) goto error; - rdcc_nbytes=0; - if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0)<0) goto error; + /* Test with old & new format groups */ + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { - goto error; - } + /* Set the FAPL for the type of format */ + if(new_format) { + puts("\nTesting with new file format:"); + my_fapl = fapl2; + } /* end if */ + else { + puts("Testing with old file format:"); + my_fapl = fapl; + } /* end else */ - /* Cause the library to emit initial messages */ - if ((grp = H5Gcreate (file, "emit diagnostics", 0))<0) goto error; - if (H5Gset_comment(grp, ".", "Causes diagnostic messages to be emitted")<0) - goto error; - if (H5Gclose (grp)<0) goto error; - - nerrors += test_create(file)<0 ?1:0; - nerrors += test_simple_io(fapl)<0 ?1:0; - nerrors += test_compact_io(fapl)<0 ?1:0; - nerrors += test_max_compact(fapl)<0 ?1:0; - nerrors += test_conv_buffer(file)<0 ?1:0; - nerrors += test_tconv(file)<0 ?1:0; - nerrors += test_filters(file)<0 ?1:0; - nerrors += test_onebyte_shuffle(file)<0 ?1:0; - nerrors += test_nbit_int(file)<0 ?1:0; - nerrors += test_nbit_float(file)<0 ?1:0; - nerrors += test_nbit_double(file)<0 ?1:0; - nerrors += test_nbit_array(file)<0 ?1:0; - nerrors += test_nbit_compound(file)<0 ?1:0; - nerrors += test_nbit_compound_2(file)<0 ?1:0; - nerrors += test_nbit_compound_3(file)<0 ?1:0; - nerrors += test_scaleoffset_int(file)<0 ?1:0; - nerrors += test_scaleoffset_int_2(file)<0 ?1:0; - nerrors += test_scaleoffset_float(file)<0 ?1:0; - nerrors += test_scaleoffset_float_2(file)<0 ?1:0; - nerrors += test_scaleoffset_double(file)<0 ?1:0; - nerrors += test_scaleoffset_double_2(file)<0 ?1:0; - nerrors += test_multiopen (file)<0 ?1:0; - nerrors += test_types(file)<0 ?1:0; - nerrors += test_userblock_offset(fapl)<0 ?1:0; - nerrors += test_missing_filter(file)<0 ?1:0; - nerrors += test_can_apply(file)<0 ?1:0; - nerrors += test_set_local(fapl)<0 ?1:0; - nerrors += test_can_apply_szip(file)<0 ?1:0; - nerrors += test_compare_dcpl(file)<0 ?1:0; - nerrors += test_filter_delete(file)<0 ?1:0; - nerrors += test_filters_endianess()<0 ?1:0; - nerrors += test_zero_dims(file)<0 ?1:0; - nerrors += test_missing_chunk(file)<0 ?1:0; - - if (H5Fclose(file)<0) goto error; - - if (nerrors) goto error; + /* Turn off the chunk cache, so all the chunks are immediately written to disk */ + if(H5Pget_cache(my_fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) + goto error; + rdcc_nbytes = 0; + if(H5Pset_cache(my_fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) + goto error; + + /* Create the file for this test */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + goto error; + + /* Cause the library to emit initial messages */ + if((grp = H5Gcreate(file, "emit diagnostics", 0)) < 0) + goto error; + if(H5Gset_comment(grp, ".", "Causes diagnostic messages to be emitted") < 0) + goto error; + if(H5Gclose(grp) < 0) + goto error; + + nerrors += (test_create(file) < 0 ? 1: 0); + nerrors += (test_simple_io(my_fapl) < 0 ? 1: 0); + nerrors += (test_compact_io(my_fapl) < 0 ? 1: 0); + nerrors += (test_max_compact(my_fapl) < 0 ? 1: 0); + nerrors += (test_conv_buffer(file) < 0 ? 1: 0); + nerrors += (test_tconv(file) < 0 ? 1: 0); + nerrors += (test_filters(file, my_fapl) < 0 ? 1: 0); + nerrors += (test_onebyte_shuffle(file) < 0 ? 1: 0); + nerrors += (test_nbit_int(file) < 0 ? 1: 0); + nerrors += (test_nbit_float(file) < 0 ? 1: 0); + nerrors += (test_nbit_double(file) < 0 ? 1: 0); + nerrors += (test_nbit_array(file) < 0 ? 1: 0); + nerrors += (test_nbit_compound(file) < 0 ? 1: 0); + nerrors += (test_nbit_compound_2(file) < 0 ? 1: 0); + nerrors += (test_nbit_compound_3(file) < 0 ? 1: 0); + nerrors += (test_scaleoffset_int(file) < 0 ? 1: 0); + nerrors += (test_scaleoffset_int_2(file) < 0 ? 1: 0); + nerrors += (test_scaleoffset_float(file) < 0 ? 1: 0); + nerrors += (test_scaleoffset_float_2(file) < 0 ? 1: 0); + nerrors += (test_scaleoffset_double(file) < 0 ? 1: 0); + nerrors += (test_scaleoffset_double_2(file) < 0 ? 1: 0); + nerrors += (test_multiopen (file) < 0 ? 1: 0); + nerrors += (test_types(file) < 0 ? 1: 0); + nerrors += (test_userblock_offset(my_fapl) < 0 ? 1: 0); + nerrors += (test_missing_filter(file) < 0 ? 1: 0); + nerrors += (test_can_apply(file) < 0 ? 1: 0); + nerrors += (test_set_local(my_fapl) < 0 ? 1: 0); + nerrors += (test_can_apply_szip(file) < 0 ? 1: 0); + nerrors += (test_compare_dcpl(file) < 0 ? 1: 0); + nerrors += (test_filter_delete(file) < 0 ? 1: 0); + nerrors += (test_filters_endianess(my_fapl) < 0 ? 1: 0); + nerrors += (test_zero_dims(file) < 0 ? 1: 0); + nerrors += (test_missing_chunk(file) < 0 ? 1: 0); + + if(H5Fclose(file) < 0) + goto error; + } /* end for */ + + /* Close 2nd FAPL */ + H5Pclose(fapl2); + + if(nerrors) + goto error; printf("All dataset tests passed.\n"); h5_cleanup(FILENAME, fapl); - } + } /* end if */ else - { puts("All dataset tests skipped - Incompatible with current Virtual File Driver"); - } + return 0; - error: - nerrors = MAX(1, nerrors); - printf("***** %d DATASET TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); - return 1; +error: + nerrors = MAX(1, nerrors); + printf("***** %d DATASET TEST%s FAILED! *****\n", + nerrors, 1 == nerrors ? "" : "S"); + return 1; } + diff --git a/test/dtransform.c b/test/dtransform.c index 8f6ebd3..ac5a3c2 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -586,8 +586,10 @@ int test_set(void) { H5_FAILED(); fprintf(stderr, " ERROR: Data transform get before set succeeded (it shouldn't have)\n"); + free(ptrgetTest); goto error; } + free(ptrgetTest); TESTING("H5Pset_data_transform (set with NULL transform)"); INVALID_SET_TEST(NULL); diff --git a/test/fillval.c b/test/fillval.c index 3691e38..f0e80cd 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -626,14 +626,16 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } /* Create dataset */ - if ((fspace=H5Screate_simple(5, cur_size, cur_size))<0) goto error; - if (datatype==H5T_INTEGER && (dset1=H5Dcreate(file, dname, H5T_NATIVE_INT, - fspace, dcpl))<0) goto error; - if (datatype==H5T_COMPOUND && (dset2=H5Dcreate(file, dname, ctype_id, - fspace, dcpl))<0) goto error; + if((fspace = H5Screate_simple(5, cur_size, cur_size)) < 0) + goto error; + if(datatype == H5T_INTEGER && (dset1 = H5Dcreate(file, dname, H5T_NATIVE_INT, fspace, dcpl)) < 0) + goto error; + if(datatype == H5T_COMPOUND && (dset2 = H5Dcreate(file, dname, ctype_id, fspace, dcpl)) < 0) + goto error; /* Read some data and make sure it's the fill value */ - if ((mspace=H5Screate_simple(5, one, NULL))<0) goto error; + if((mspace = H5Screate_simple(5, one, NULL)) < 0) + goto error; for (i=0; i<1000; i++) { for (j=0; j<5; j++) { hs_offset[j] = rand() % cur_size[j]; @@ -689,25 +691,25 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* case for atomic datatype */ if(datatype==H5T_INTEGER) { /*check for overflow*/ - assert((nelmts*sizeof(int))==(hsize_t)((size_t)(nelmts*sizeof(int)))); - buf = malloc((size_t)(nelmts*sizeof(int))); - for (u=0; u<nelmts; u++) buf[u] = 9999; + HDassert((nelmts*sizeof(int))==(hsize_t)((size_t)(nelmts*sizeof(int)))); + buf = HDmalloc((size_t)(nelmts * sizeof(int))); + for(u = 0; u < nelmts; u++) + buf[u] = 9999; if (H5Dwrite(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf)<0) goto error; } /* case for compound datatype */ else if(datatype==H5T_COMPOUND) { - assert((nelmts*sizeof(comp_datatype))== - (hsize_t)((size_t)(nelmts*sizeof(comp_datatype)))); - buf_c = (comp_datatype*)calloc((size_t)nelmts,sizeof(comp_datatype)); + HDassert((nelmts*sizeof(comp_datatype))== + (hsize_t)((size_t)(nelmts*sizeof(comp_datatype)))); + buf_c = (comp_datatype*)HDcalloc((size_t)nelmts,sizeof(comp_datatype)); for (u=0; u<nelmts; u++) { buf_c[u].a = (float)1111.11; buf_c[u].x = 2222; buf_c[u].y = 3333.3333; buf_c[u].z = 'd'; } - if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, - buf_c)<0) goto error; + if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c)<0) goto error; } /* Check if space is allocated */ @@ -721,24 +723,25 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, printf(" Got %d\n", allocation); goto error; } - free(buf); + HDfree(buf); buf = NULL; H5Sclose(mspace); /* Read some data and make sure it's the right value */ - if ((mspace=H5Screate_simple(5, one, NULL))<0) goto error; - for (i=0; i<1000; i++) { - for (j=0, odd=0; j<5; j++) { + if((mspace = H5Screate_simple(5, one, NULL)) < 0) + goto error; + for(i = 0; i < 1000; i++) { + for(j = 0, odd = 0; j < 5; j++) { hs_offset[j] = rand() % cur_size[j]; odd += (int)(hs_offset[j]%2); - } - if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, - one, NULL)<0) goto error; + } /* end for */ + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) + goto error; /* case for atomic datatype */ - if (datatype==H5T_INTEGER) { - if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, - &val_rd)<0) goto error; + if(datatype==H5T_INTEGER) { + if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0) + goto error; if(fill_time == H5D_FILL_TIME_ALLOC) { should_be = odd ? fillval : 9999; if (val_rd!=should_be) { @@ -769,9 +772,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } } /* end for datatype==H5T_INTEGER */ /* case for compound datatype */ - else if (datatype==H5T_COMPOUND) { - if (H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, - &rd_c)<0) goto error; + else if(datatype==H5T_COMPOUND) { + if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) + goto error; if(fill_time == H5D_FILL_TIME_ALLOC) { if(odd) { should_be_c.a=fill_c.a; @@ -822,6 +825,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } } /* end for datatype==H5T_COMPOUND */ } + if(datatype == H5T_COMPOUND) { + HDfree(buf_c); + buf_c = NULL; + } /* end if */ if (H5Sclose(mspace)<0) goto error; if (datatype==H5T_INTEGER && H5Dclose(dset1)<0) goto error; diff --git a/test/tarray.c b/test/tarray.c index 14dfcd8..44deb02 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -215,7 +215,7 @@ test_array_funcs(void) norm=H5Tget_norm(type); CHECK(norm, FAIL, "H5Tget_norm"); - ret=H5Tset_offset(type, 16); + ret=H5Tset_offset(type, (size_t)16); CHECK(ret, FAIL, "H5Tset_offset"); H5E_BEGIN_TRY { @@ -1579,7 +1579,7 @@ test_array_bkg(void) /* Initialize the names of data members */ /* ------------------------------------ */ for (i = 0; i < dtsinfo.nsubfields; i++) - dtsinfo.name[i] = (char *)calloc(20, sizeof(char)); + dtsinfo.name[i] = (char *)HDcalloc((size_t)20, sizeof(char)); strcpy(dtsinfo.name[0], "One"); strcpy(dtsinfo.name[1], "Two"); diff --git a/test/tattr.c b/test/tattr.c index ed60126..969734b 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -189,7 +189,7 @@ test_attr_basic_write(hid_t fapl) CHECK(attr, FAIL, "H5Aopen_name"); /* Verify new attribute name */ - attr_name_size = H5Aget_name(attr, 0, NULL); + attr_name_size = H5Aget_name(attr, (size_t)0, NULL); CHECK(attr_name_size, FAIL, "H5Aget_name"); if(attr_name_size>0) @@ -222,7 +222,7 @@ test_attr_basic_write(hid_t fapl) CHECK(attr, FAIL, "H5Aopen_name"); /* Verify new attribute name */ - attr_name_size = H5Aget_name(attr2, 0, NULL); + attr_name_size = H5Aget_name(attr2, (size_t)0, NULL); CHECK(attr_name_size, FAIL, "H5Aget_name"); if(attr_name_size>0) @@ -784,7 +784,7 @@ test_attr_compound_read(hid_t fapl) } /* end if */ /* Verify Name */ - name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); + name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR4_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR4_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR4_NAME); @@ -1131,7 +1131,7 @@ test_attr_mult_read(hid_t fapl) TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); /* Verify Name */ - name_len=H5Aget_name(attr, ATTR_NAME_LEN, attr_name); + name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR1_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); @@ -1187,13 +1187,13 @@ test_attr_mult_read(hid_t fapl) TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__,i,j,attr_data2[i][j],i,j,read_data2[i][j]); /* Verify Name */ - name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); + name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR2_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR2_NAME); /* Verify Name with too small of a buffer */ - name_len=H5Aget_name(attr,HDstrlen(ATTR2_NAME), attr_name); + name_len=H5Aget_name(attr, HDstrlen(ATTR2_NAME), attr_name); VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name"); HDstrcpy(temp_name,ATTR2_NAME); /* make a copy of the name */ temp_name[HDstrlen(ATTR2_NAME)-1]='\0'; /* truncate it to match the one retrieved */ @@ -1246,13 +1246,13 @@ test_attr_mult_read(hid_t fapl) TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]); /* Verify Name */ - name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); + name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR3_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); /* Verify Name with too small of a buffer */ - name_len=H5Aget_name(attr,HDstrlen(ATTR3_NAME), attr_name); + name_len=H5Aget_name(attr, HDstrlen(ATTR3_NAME), attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); HDstrcpy(temp_name,ATTR3_NAME); /* make a copy of the name */ temp_name[HDstrlen(ATTR3_NAME)-1]='\0'; /* truncate it to match the one retrieved */ @@ -1431,7 +1431,7 @@ test_attr_delete(hid_t fapl) CHECK(attr, FAIL, "H5Aopen_idx"); /* Verify Name */ - name_len=H5Aget_name(attr,ATTR_NAME_LEN,attr_name); + name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN,attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR1_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); @@ -1445,7 +1445,7 @@ test_attr_delete(hid_t fapl) CHECK(attr, FAIL, "H5Aopen_idx"); /* Verify Name */ - name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); + name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR3_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); @@ -1467,7 +1467,7 @@ test_attr_delete(hid_t fapl) CHECK(attr, FAIL, "H5Aopen_idx"); /* Verify Name */ - name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); + name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR3_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); diff --git a/test/tfile.c b/test/tfile.c index ebc666d..7e4ed01 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1594,16 +1594,16 @@ test_file_getname(void) CHECK(file_id, FAIL, "H5Fcreate"); /* Get and verify file name */ - name_len = H5Fget_name(file_id, name, TESTA_NAME_BUF_SIZE); + name_len = H5Fget_name(file_id, name, (size_t)TESTA_NAME_BUF_SIZE); CHECK(name_len, FAIL, "H5Fget_name"); VERIFY_STR(name, FILE1, "H5Fget_name"); /* Create a group in the root group */ - group_id = H5Gcreate(file_id, TESTA_GROUPNAME, 0); + group_id = H5Gcreate(file_id, TESTA_GROUPNAME, (size_t)0); CHECK(group_id, FAIL, "H5Gcreate"); /* Get and verify file name */ - name_len = H5Fget_name(group_id, name, TESTA_NAME_BUF_SIZE); + name_len = H5Fget_name(group_id, name, (size_t)TESTA_NAME_BUF_SIZE); CHECK(name_len, FAIL, "H5Fget_name"); VERIFY_STR(name, FILE1, "H5Fget_name"); @@ -1614,7 +1614,7 @@ test_file_getname(void) /* Try get file name from data space. Supposed to fail because * it's illegal operation. */ H5E_BEGIN_TRY { - name_len = H5Fget_name(space_id, name, TESTA_NAME_BUF_SIZE); + name_len = H5Fget_name(space_id, name, (size_t)TESTA_NAME_BUF_SIZE); } H5E_END_TRY; VERIFY(name_len, FAIL, "H5Fget_name"); @@ -1623,7 +1623,7 @@ test_file_getname(void) CHECK(dataset_id, FAIL, "H5Dcreate"); /* Get and verify file name */ - name_len = H5Fget_name(dataset_id, name, TESTA_NAME_BUF_SIZE); + name_len = H5Fget_name(dataset_id, name, (size_t)TESTA_NAME_BUF_SIZE); CHECK(name_len, FAIL, "H5Fget_name"); VERIFY_STR(name, FILE1, "H5Fget_name"); @@ -1632,7 +1632,7 @@ test_file_getname(void) CHECK(attr_id, FAIL, "H5Acreate"); /* Get and verify file name */ - name_len = H5Fget_name(attr_id, name, TESTA_NAME_BUF_SIZE); + name_len = H5Fget_name(attr_id, name, (size_t)TESTA_NAME_BUF_SIZE); CHECK(name_len, FAIL, "H5Fget_name"); VERIFY_STR(name, FILE1, "H5Fget_name"); @@ -1652,7 +1652,7 @@ test_file_getname(void) CHECK(ret, FAIL, "H5Tcommit"); /* Get and verify file name */ - name_len = H5Fget_name(type_id, name, TESTA_NAME_BUF_SIZE); + name_len = H5Fget_name(type_id, name, (size_t)TESTA_NAME_BUF_SIZE); CHECK(name_len, FAIL, "H5Fget_name"); VERIFY_STR(name, FILE1, "H5Fget_name"); diff --git a/test/th5o.c b/test/th5o.c index 019dda2..345ec5f 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -56,7 +56,7 @@ test_h5o_open(void) /* Create a group, dataset, and committed datatype within the file */ /* Create the group */ - grp = H5Gcreate(fid, "group", 0); + grp = H5Gcreate(fid, "group", (size_t)0); CHECK(grp, FAIL, "H5Gcreate"); ret = H5Gclose(grp); CHECK(ret, FAIL, "H5Gclose"); @@ -161,7 +161,7 @@ test_h5o_close(void) /* Create a group, dataset, and committed datatype within the file */ /* Create the group and close it with H5Oclose */ - grp = H5Gcreate(fid, "group", 0); + grp = H5Gcreate(fid, "group", (size_t)0); CHECK(grp, FAIL, "H5Gcreate"); VERIFY(H5Iget_type(grp), H5I_GROUP, "H5Iget_type"); ret = H5Oclose(grp); @@ -258,7 +258,7 @@ test_h5o_open_by_addr(void) /* Create a group, dataset, and committed datatype within the file */ /* Create the group */ - grp = H5Gcreate(fid, "group", 0); + grp = H5Gcreate(fid, "group", (size_t)0); CHECK(grp, FAIL, "H5Gcreate"); ret = H5Gclose(grp); CHECK(ret, FAIL, "H5Gclose"); @@ -387,7 +387,7 @@ test_h5o_refcount(void) /* Create a group, dataset, and committed datatype within the file */ /* Create the group */ - grp = H5Gcreate(fid, "group", 0); + grp = H5Gcreate(fid, "group", (size_t)0); CHECK(grp, FAIL, "H5Gcreate"); /* Commit the type inside the group */ diff --git a/test/th5s.c b/test/th5s.c index 9fbe35f..359f023 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -363,7 +363,7 @@ test_h5s_null(void) hsize_t coord[1][1]; /* Coordinates for point selection */ coord[0][0]=0; - ret = H5Sselect_elements(sid, H5S_SELECT_SET, 1, (const hsize_t **)coord); + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t **)coord); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sselect_elements"); @@ -559,7 +559,7 @@ test_h5s_encode(void) CHECK(ret, FAIL, "H5Sencode"); if(sbuf_size>0) - sbuf = (unsigned char*)calloc(1, sbuf_size); + sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size); /* Try decoding bogus buffer */ H5E_BEGIN_TRY { @@ -614,7 +614,7 @@ test_h5s_encode(void) CHECK(ret, FAIL, "H5Sencode"); if(null_size>0) - null_sbuf = (unsigned char*)calloc(1, null_size); + null_sbuf = (unsigned char*)HDcalloc((size_t)1, null_size); ret = H5Sencode(sid2, null_sbuf, &null_size); CHECK(ret, FAIL, "H5Sencode"); @@ -646,7 +646,7 @@ test_h5s_encode(void) CHECK(ret, FAIL, "H5Sencode"); if(scalar_size>0) - scalar_buf = (unsigned char*)calloc(1, scalar_size); + scalar_buf = (unsigned char*)HDcalloc((size_t)1, scalar_size); ret = H5Sencode(sid3, scalar_buf, &scalar_size); CHECK(ret, FAIL, "H5Sencode"); @@ -674,9 +674,9 @@ test_h5s_encode(void) ret = H5Sclose(decoded_sid3); CHECK(ret, FAIL, "H5Sclose"); - free(sbuf); - free(null_sbuf); - free(scalar_buf); + HDfree(sbuf); + HDfree(null_sbuf); + HDfree(scalar_buf); } /* test_h5s_encode() */ /**************************************************************** |