diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-08-27 14:20:51 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-08-27 14:20:51 (GMT) |
commit | de9ac452f35c09890d7725083746c211bbd2b879 (patch) | |
tree | b4bf97aca49de97ab5846fecfb1f0d79f4508faf | |
parent | 0a1a9bfa9f4340dccc16d82b355dc4cbd218a8ee (diff) | |
download | hdf5-de9ac452f35c09890d7725083746c211bbd2b879.zip hdf5-de9ac452f35c09890d7725083746c211bbd2b879.tar.gz hdf5-de9ac452f35c09890d7725083746c211bbd2b879.tar.bz2 |
Add HD prefix
-rw-r--r-- | tools/misc/talign.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/tools/misc/talign.c b/tools/misc/talign.c index 751dad1..7f1f038 100644 --- a/tools/misc/talign.c +++ b/tools/misc/talign.c @@ -51,14 +51,14 @@ int main(void) int result = 0; herr_t error = 1; - printf("%-70s", "Testing alignment in compound datatypes"); + HDprintf("%-70s", "Testing alignment in compound datatypes"); - strcpy(string5, "Hi!"); + HDstrcpy(string5, "Hi!"); HDunlink(fname); fil = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fil < 0) { - puts("*FAILED*"); + HDputs("*FAILED*"); return 1; } @@ -123,35 +123,37 @@ int main(void) data = (char *)HDmalloc(H5Tget_size(fix)); if(!data) { - perror("malloc() failed"); - abort(); + HDperror("malloc() failed"); + HDabort(); } set = H5Dopen2(fil, setname, H5P_DEFAULT); H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); H5Dclose(set); out: if(error < 0) { result = 1; - puts("*FAILED - HDF5 library error*"); - } else if(fok[0] != fptr[0] || fok[1] != fptr[1] - || fnok[0] != fptr[2] || fnok[1] != fptr[3]) { + HDputs("*FAILED - HDF5 library error*"); + } else if(!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) + || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) + || !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) + || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) { char *mname; result = 1; mname = H5Tget_member_name(fix, 0); - printf("%14s (%2d) %6s = %s\n", + HDprintf("%14s (%2d) %6s = %s\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0), string5, (char *)(data + H5Tget_member_offset(fix, 0))); if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); mname = H5Tget_member_name(fix, 1); - printf("Data comparison:\n" + HDprintf("Data comparison:\n" "%14s (%2d) %6f = %f\n" " %6f = %f\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1), @@ -160,9 +162,9 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 2)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); mname = H5Tget_member_name(fix, 2); - printf("%14s (%2d) %6f = %f\n" + HDprintf("%14s (%2d) %6f = %f\n" " %6f = %6f\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2), (double)fnok[0], (double)fptr[0], @@ -170,8 +172,8 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); - printf("\n" + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); + HDprintf("\n" "Short circuit\n" " %6f = %f\n" " %6f = %f\n" @@ -181,9 +183,9 @@ out: (double)fok[1], (double)fptr[1], (double)fnok[0], (double)fptr[2], (double)fnok[1], (double)fptr[3]); - puts("*FAILED - compound type alignmnent problem*"); + HDputs("*FAILED - compound type alignmnent problem*"); } else { - puts(" PASSED"); + HDputs(" PASSED"); } if(data) @@ -198,7 +200,7 @@ out: H5Pclose(plist); H5Fclose(fil); HDunlink(fname); - fflush(stdout); + HDfflush(stdout); return result; } |