From 536a32c59be69f9ae75604a31d0ec34c57cf9f00 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 10 Jan 2019 17:51:42 -0800 Subject: C and POSIX call cleanup --- bin/checkposix | 244 +++++++++++++++++++++++++++++++------------------- src/H5AC.c | 2 +- src/H5B.c | 6 +- src/H5Bdbg.c | 6 +- src/H5Cmpio.c | 12 +-- src/H5Dchunk.c | 15 ++-- src/H5Dearray.c | 4 +- src/H5Dfarray.c | 4 +- src/H5E.c | 8 +- src/H5EAdbg.c | 6 +- src/H5EAtest.c | 2 +- src/H5Eint.c | 8 +- src/H5FAtest.c | 2 +- src/H5FL.c | 8 +- src/H5Fmpi.c | 2 +- src/H5HFdbg.c | 2 +- src/H5Ofill.c | 24 ++--- src/H5Omtime.c | 2 +- src/H5Oname.c | 2 +- src/H5PB.c | 2 +- src/H5ST.c | 16 ++-- src/H5Sdbg.c | 8 +- src/H5T.c | 2 +- src/H5Tconv.c | 2 +- src/H5VLcallback.c | 2 +- src/H5VLnative_file.c | 4 +- src/H5Ztrans.c | 4 +- src/H5dbg.c | 2 +- src/H5private.h | 5 +- src/H5timer.c | 16 ++-- test/accum.c | 6 +- test/app_ref.c | 6 +- test/big.c | 4 +- test/bittests.c | 174 +++++++++++++++++------------------ test/h5test.c | 12 +-- test/mount.c | 38 ++++---- test/titerate.c | 8 +- test/tselect.c | 24 ++--- test/tsohm.c | 30 +++---- test/ttime.c | 6 +- test/tunicode.c | 2 +- test/tvlstr.c | 18 ++-- test/vds.c | 8 +- test/vfd.c | 44 ++++----- 44 files changed, 435 insertions(+), 367 deletions(-) diff --git a/bin/checkposix b/bin/checkposix index 7ab741c..30128e3 100755 --- a/bin/checkposix +++ b/bin/checkposix @@ -13,101 +13,165 @@ require 5.003; # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# Robb Matzke, matzke@llnl.gov -# 30 Aug 1997 +# Dana Robinson +# Spring 2019 +# (Original by Robb Matzke) # -# Purpose: Given the names of C source files this script will print the -# file name, line number, and function name of any function that -# doesn't begin with the letter `h' or `H' as stipulated by the -# HDF5 programming style guide. +# Purpose: Given the names of C source files this script will print the +# file name, line number, and function name of any function that +# doesn't begin with the letter 'h' or 'H' as stipulated by the +# HDF5 programming style guide. # -# Emacs users can run this script as the compile command and -# use `next-error' (usually bound to M-`) to find each name -# violation. - -if(<>) { - if($ARGV =~ /\//) { - ($filename) = ($ARGV =~ /^.*\/([A-Za-z0-9_]*)\.c$/); - } else { - ($filename) = ($ARGV =~ /([A-Za-z0-9_]*)\.c$/); +# Emacs users can run this script as the compile command and +# use 'next-error' (usually bound to M-`) to find each name +# violation. + +use File::Basename; + +# Loop over all files passed to the function +foreach $arg (@ARGV) { + + # Get the filename from the path + $filename = fileparse($arg); + + # Skip files that don't include H5private.h + # H5system. has to be inspected by hand since it wraps POSIX files + # + # H5detect and H5make_libsettings are created before the library exists + # so calls that link to function replacements won't work. We'll ignore + # it here. + # + # If a user specifies one file, process it no matter what so people + # can inspect files we normally skip (like H5system.c). + if($#ARGV gt 0 and $filename =~ /H5FDmulti|H5FDstdio|H5VLpassthru|H5system|H5detect|H5make_libsettings/) { + print "$filename is exempt from using Standard library macro wrappers\n"; + next; } - if($filename =~ /H5FDmulti|H5FDstdio/) { - print "$ARGV is exempt from using Standard library macro wrappers\n"; - } else { - while (<>) { - - # Get rid of comments by removing the inside part. - s|/\*.*?\*/||g; - if ($in_comment) { - if (/\*\//) { - s|.*?\*/||; - $in_comment = 0; - } else { - $_="\n"; - } - } elsif (m|/\*|) { - s|/\*.*||; - $in_comment = 1; - } - - # Get rid of string constants if they begin and end on this line. - s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g; - - # Get rid of preprocessor directives - s/^\#.*//; - - # Skip callbacks invoked as methods in a struct - next if $_ =~ /\b(\)?->|\.)\(?([a-z_A-Z]\w*)\s*\(/; - - # Now find all function calls on this line which don't start with 'H' - while (($name)=/\b([a-z_A-GI-Z]\w*)\s*\(/) { - $_ = $'; + # Open the file + open(my $fh, "<", $arg) or do { + warn "NOTE: Unable to open $arg: !$\n"; + next; + }; + + # Loop over all lines in the file to find undecorated functions + while (<$fh>) { + + # Get rid of comments by removing the inside part. + s|/\*.*?\*/||g; + if ($in_comment) { + if (/\*\//) { + s|.*?\*/||; + $in_comment = 0; + } else { + $_="\n"; + } + } elsif (m|/\*|) { + s|/\*.*||; + $in_comment = 1; + } + + # Get rid of string constants if they begin and end on this line. + s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g; + + # Get rid of preprocessor directives + s/^\#.*//; + + # Skip callbacks invoked as methods in a struct + next if $_ =~ /\b(\)?]?->|\.)\(?([a-z_A-Z]\w*)\s*\(/; + + # Now find all function calls on this line which don't start with 'H' + while (($name)=/\b([a-z_A-GI-Z]\w*)\s*\(/) { + $_ = $'; - # Ignore C statements that look sort of like function - # calls. - next if $name =~ /^(if|for|offsetof|return|sizeof|switch|while|void)$/; - - # Ignore things that get misdetected because of the simplified - # parsing that takes place here. - next if $name =~ /^(int|herr_t|_term_interface)$/; - - # These are really HDF5 functions/macros even though they don't - # start with `h' or `H'. - next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NOFS|_NOCLEAR|_NOINIT)?(_NOFUNC|_TAG)?$/; - next if $name =~ /^(BEGIN|END)_FUNC$/; - next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)(_VAR)?$/; - next if $name =~ /^CI_(PRINT_STATS|INC_SRC|INC_DST)$/; - next if $name =~ /^(ABS|ADDR_OVERFLOW|ALL_MEMBERS|BOUND|CONSTR|DETECT_[I|F|M]|DOWN)$/; - next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/; - next if $name =~ /^(UNIQUE_MEMBERS)$/; - next if $name =~ /^addr_defined$/; - - # These functions/macros are exempt. - next if $name =~ /^(main|[fs]?printf|va_(start|arg|end))$/; - - # These are Windows system calls. Ignore them. - next if $name =~ /^(_get_osfhandle|GetFileInformationByHandle|SetFilePointer|GetLastError|SetEndOfFile)$/; - next if $name =~ /^(FindNextFile|FindClose|_tzset|Wgettimeofday|GetSystemTimeAsFileTime|Wgetlogin|GetUserName)$/; - - # These are MPI function calls. Ignore them. - next if $name =~ /^(MPI_|MPE_)/; - - # These are POSIX threads function calls. Ignore them. - next if $name =~ /^pthread_/; - - # These are Windows threads function calls. Ignore them. - next if $name =~ /^(_beginthread|(Initialize|Enter|Leave)CriticalSection|TlsAlloc)$/; - - # These are zlib & szlib function calls. Ignore them. - next if $name =~ /^(inflate|SZ_)/; - next if $name =~ /^compress2$/; - - print "$ARGV:$.: $name\n"; - } - - } continue { - close ARGV if eof; # reset line number + # Ignore C statements that look sort of like function + # calls. + next if $name =~ /^(if|for|offsetof|return|sizeof|switch|while|void)$/; + + # Ignore things that get misdetected because of the simplified + # parsing that takes place here. + next if $name =~ /^(int|herr_t|_term_interface|_term_package)$/; + + # These are really HDF5 functions/macros even though they don't + # start with `h' or `H'. + next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NOFS|_NOCLEAR|_NOINIT)?(_NOFUNC|_TAG)?$/; + next if $name =~ /^(BEGIN|END)_FUNC$/; + next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)(_VAR)?$/; + next if $name =~ /^CI_(PRINT_STATS|INC_SRC|INC_DST)$/; + next if $name =~ /^(ABS|ADDR_OVERFLOW|ALL_MEMBERS|BOUND|CONSTR|DETECT_[I|F|M]|DOWN)$/; + next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/; + next if $name =~ /^(UNIQUE_MEMBERS|S_ISDIR)$/; + next if $name =~ /^addr_defined$/; + + # These functions/macros are exempt. + # op, cb, and OP are often spuriously flagged so ignore them. + next if $name =~ /^(main|op|cb|OP)$/; + + # This often appears in preprocessor lines that span multiple lines + next if $name =~ /^(defined)$/; + + # These are Windows system calls. Ignore them. + next if $name =~ /^(_get_osfhandle|GetFileInformationByHandle|SetFilePointer|GetLastError|SetEndOfFile)$/; + next if $name =~ /^(FindNextFile|FindClose|_tzset|Wgettimeofday|GetSystemTimeAsFileTime|Wgetlogin|GetUserName)$/; + next if $name =~ /^(DeleteCriticalSection|TlsFree|TlsGetValue|CreateThread)$/; + next if $name =~ /^(ExpandEnvironmentStringsA|LockFileEx|UnlockFileEx)$/; + next if $name =~ /^(DllMain|LocalAlloc|LocalFree)$/; + next if $name =~ /^(FindFirstFileA|FindNextFileA)$/; + next if $name =~ /^(_beginthread|(Initialize|Enter|Leave)CriticalSection|TlsAlloc)$/; + + # These are MPI function calls. Ignore them. + next if $name =~ /^(MPI_|MPE_)/; + + # These are POSIX threads function calls. Ignore them. + next if $name =~ /^pthread_/; + + # These are zlib & szlib function calls. Ignore them. + next if $name =~ /^(inflate|SZ_)/; + next if $name =~ /^compress2$/; + + # These is an H5Dfill function. Ignore it in this file. + if($filename =~ /H5Dfill/) { + next if $name =~ /^(alloc_func)$/; + } + + # These are H5Zscaleoffset functions. Ignore them in this file. + if($filename =~ /H5Zscaleoffset/) { + next if $name =~ /^(pow_fun|round_fun|abs_fun|lround_fun|llround_fun)$/; + } + + # TESTING (not comprehensive - just noise reduction) + + # Test macros and functions (testhdf5.h) + next if $name =~ /^(AddTest|TestErrPrintf|TestSummary|TestCleanup|TestShutdown)$/; + next if $name =~ /^(CHECK|CHECK_PTR|CHECK_PTR_NULL|CHECK_PTR_EQ|CHECK_I)$/; + next if $name =~ /^(VERIFY|VERIFY_STR|VERIFY|TYPE|MESSAGE|ERROR)$/; + + # Test macros and functions (h5test.h) + next if $name =~ /^(TESTING|PASSED|SKIPPED|FAIL_PUTS_ERROR|FAIL_STACK_ERROR|TEST_ERROR)$/; + next if $name =~ /^(GetTestExpress)$/; + + # Ignore functions that start with test_ or check_ + next if $name =~ /^test_/; + next if $name =~ /^check_/; + + # Ignore functions that start with h5_ + next if $name =~ /^h5_/; + + # Ignore usage functions + next if $name =~ /^usage$/; + + print "$filename:$.: $name\n"; } + } + + # Close the file + close($fh); +} + +if($#ARGV gt 0) { + print "\n"; + print "NOTE:\n"; + print "If any files were skipped due to being exempt, you can inspect them manually\n"; + print "by using this script on them one at a time, which will always process the file.\n"; } diff --git a/src/H5AC.c b/src/H5AC.c index 0a5411a..6f966d8 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -349,7 +349,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co aux_ptr->sync_point_done = NULL; aux_ptr->p0_image_len = 0; - sprintf(prefix, "%d:", mpi_rank); + HDsprintf(prefix, "%d:", mpi_rank); if(mpi_rank == 0) { if(NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) diff --git a/src/H5B.c b/src/H5B.c index 71b9020..2772bb9 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -436,8 +436,8 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, side = "LEFT"; else side = "MIDDLE"; - fprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s", - shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side); + HDfprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s", + shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side); } #endif @@ -464,7 +464,7 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, nright = shared->two_k - nleft; #ifdef H5B_DEBUG if(H5DEBUG(B)) - fprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright); + HDfprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright); #endif /* diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index c491783..665e826 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -193,13 +193,13 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) FUNC_ENTER_PACKAGE if(0 == ncalls++) { - if(H5DEBUG(B)) - fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n"); + if(H5DEBUG(B)) + HDfprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n"); } /* end if */ /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index ecaed62..84ec16c 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -214,10 +214,10 @@ H5C_apply_candidate_list(H5F_t * f, HDmemset(tbl_buf, 0, sizeof(tbl_buf)); - sprintf(&(tbl_buf[0]), "candidate list = "); + HDsprintf(&(tbl_buf[0]), "candidate list = "); for(u = 0; u < num_candidates; u++) - sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u))); - sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); + HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u))); + HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); HDfprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ @@ -280,10 +280,10 @@ H5C_apply_candidate_list(H5F_t * f, #if H5C_APPLY_CANDIDATE_LIST__DEBUG for ( i = 0; i < 1024; i++ ) tbl_buf[i] = '\0'; - sprintf(&(tbl_buf[0]), "candidate assignment table = "); + HDsprintf(&(tbl_buf[0]), "candidate assignment table = "); for(i = 0; i <= mpi_size; i++) - sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]); - sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); + HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]); + HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); HDfprintf(stdout, "%s", tbl_buf); HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index b5a5c39..debdbde 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -6303,15 +6303,16 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers) HGOTO_DONE(SUCCEED) if (headers) { - fprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n"); - fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n", + HDfprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n"); + HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n", "Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes"); - fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n", + HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n", "-----", "----", "------", "--------", "-----", "-------"); } #ifdef H5AC_DEBUG - if (H5DEBUG(AC)) headers = TRUE; + if (H5DEBUG(AC)) + headers = TRUE; #endif if (headers) { @@ -6322,12 +6323,12 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers) miss_rate = 0.0; } if (miss_rate > 100) { - sprintf(ascii, "%7d%%", (int) (miss_rate + 0.5)); + HDsprintf(ascii, "%7d%%", (int) (miss_rate + 0.5)); } else { - sprintf(ascii, "%7.2f%%", miss_rate); + HDsprintf(ascii, "%7.2f%%", miss_rate); } - fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", + HDfprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->stats.nhits, rdcc->stats.nmisses, ascii, rdcc->stats.ninits, (long)(rdcc->stats.nflushes)-(long)(rdcc->stats.ninits)); } diff --git a/src/H5Dearray.c b/src/H5Dearray.c index a20145a..a8fffbc 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -437,7 +437,7 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); @@ -596,7 +596,7 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, elmt->filter_mask); diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index 372ae26..2d85e3b 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -434,7 +434,7 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); @@ -699,7 +699,7 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, elmt->filter_mask); diff --git a/src/H5E.c b/src/H5E.c index 170133e..267bd4e 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -1386,7 +1386,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, */ /* Format the description */ - va_start(ap, fmt); + HDva_start(ap, fmt); va_started = TRUE; #ifdef H5_HAVE_VASPRINTF @@ -1402,8 +1402,8 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { /* shutdown & restart the va_list */ - va_end(ap); - va_start(ap, fmt); + HDva_end(ap); + HDva_start(ap, fmt); /* Release the previous description, it's too small */ H5MM_xfree(tmp); @@ -1421,7 +1421,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, done: if(va_started) - va_end(ap); + HDva_end(ap); #ifdef H5_HAVE_VASPRINTF /* Memory was allocated with HDvasprintf so it needs to be freed * with HDfree diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 1a2b973..3d6c2ed 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -264,7 +264,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, ""); for(u = 0; u < iblock->ndblk_addrs; u++) { /* Print address */ - sprintf(temp_str, "Address #%u:", u); + HDsprintf(temp_str, "Address #%u:", u); HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, iblock->dblk_addrs[u]); @@ -280,7 +280,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, ""); for(u = 0; u < iblock->nsblk_addrs; u++) { /* Print address */ - sprintf(temp_str, "Address #%u:", u); + HDsprintf(temp_str, "Address #%u:", u); HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, iblock->sblk_addrs[u]); @@ -371,7 +371,7 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, HDfprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, ""); for(u = 0; u < sblock->ndblks; u++) { /* Print address */ - sprintf(temp_str, "Address #%u:", u); + HDsprintf(temp_str, "Address #%u:", u); HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, sblock->dblk_addrs[u]); diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 7c02e16..814e64f 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -336,7 +336,7 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, (unsigned long long)*(const uint64_t *)elmt); diff --git a/src/H5Eint.c b/src/H5Eint.c index 540c9b1..c5c9966 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -706,7 +706,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin */ /* Start the variable-argument parsing */ - va_start(ap, fmt); + HDva_start(ap, fmt); va_started = TRUE; #ifdef H5_HAVE_VASPRINTF @@ -722,8 +722,8 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { /* shutdown & restart the va_list */ - va_end(ap); - va_start(ap, fmt); + HDva_end(ap); + HDva_start(ap, fmt); /* Release the previous description, it's too small */ H5MM_xfree(tmp); @@ -741,7 +741,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin done: if(va_started) - va_end(ap); + HDva_end(ap); #ifdef H5_HAVE_VASPRINTF /* Memory was allocated with HDvasprintf so it needs to be freed * with HDfree diff --git a/src/H5FAtest.c b/src/H5FAtest.c index 27cd8b7..e55d408 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -315,7 +315,7 @@ H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, (unsigned long long)*(const uint64_t *)elmt); diff --git a/src/H5FL.c b/src/H5FL.c index 89a580a..21bbf02 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -642,7 +642,7 @@ H5FL__reg_term(void) tmp = H5FL_reg_gc_head.first->next; #ifdef H5FL_DEBUG -printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated); +HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ if(H5FL_reg_gc_head.first->list->allocated > 0) { @@ -1312,7 +1312,7 @@ H5FL__blk_term(void) tmp = H5FL_blk_gc_head.first->next; #ifdef H5FL_DEBUG -printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated); +HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ @@ -1780,7 +1780,7 @@ H5FL__arr_term(void) /* Check if the list has allocations outstanding */ #ifdef H5FL_DEBUG -printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated); +HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ if(H5FL_arr_gc_head.first->list->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ @@ -2408,7 +2408,7 @@ H5FL__fac_term_all(void) tmp = H5FL_fac_gc_head.first->next; #ifdef H5FL_DEBUG -printf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); +HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* The list cannot have any allocations outstanding */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 6ddbfbb..5bbd717 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -94,7 +94,7 @@ H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle) FUNC_ENTER_NOAPI(FAIL) - assert(f && f->shared); + HDassert(f && f->shared); /* Dispatch to driver */ if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl, (void **)f_handle)) < 0) diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index fc437dc..22de0c4 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -483,7 +483,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) /* Flag overlaps */ if (overlap) - fprintf(udata->stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); + HDfprintf(udata->stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); else udata->amount_free += len; } /* end if */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 125da36..fd50cb9 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -890,40 +890,40 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Space Allocation Time:"); switch(fill->alloc_time) { case H5D_ALLOC_TIME_EARLY: - fprintf(stream,"Early\n"); + HDfprintf(stream,"Early\n"); break; case H5D_ALLOC_TIME_LATE: - fprintf(stream,"Late\n"); + HDfprintf(stream,"Late\n"); break; case H5D_ALLOC_TIME_INCR: - fprintf(stream,"Incremental\n"); + HDfprintf(stream,"Incremental\n"); break; case H5D_ALLOC_TIME_DEFAULT: case H5D_ALLOC_TIME_ERROR: default: - fprintf(stream,"Unknown!\n"); + HDfprintf(stream,"Unknown!\n"); break; } /* end switch */ HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:"); switch(fill->fill_time) { case H5D_FILL_TIME_ALLOC: - fprintf(stream,"On Allocation\n"); + HDfprintf(stream,"On Allocation\n"); break; case H5D_FILL_TIME_NEVER: - fprintf(stream,"Never\n"); + HDfprintf(stream,"Never\n"); break; case H5D_FILL_TIME_IFSET: - fprintf(stream,"If Set\n"); + HDfprintf(stream,"If Set\n"); break; case H5D_FILL_TIME_ERROR: default: - fprintf(stream,"Unknown!\n"); + HDfprintf(stream,"Unknown!\n"); break; } /* end switch */ @@ -931,20 +931,20 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, H5P_is_fill_value_defined((const H5O_fill_t *)fill, &fill_status); switch(fill_status) { case H5D_FILL_VALUE_UNDEFINED: - fprintf(stream,"Undefined\n"); + HDfprintf(stream,"Undefined\n"); break; case H5D_FILL_VALUE_DEFAULT: - fprintf(stream,"Default\n"); + HDfprintf(stream,"Default\n"); break; case H5D_FILL_VALUE_USER_DEFINED: - fprintf(stream,"User Defined\n"); + HDfprintf(stream,"User Defined\n"); break; case H5D_FILL_VALUE_ERROR: default: - fprintf(stream,"Unknown!\n"); + HDfprintf(stream,"Unknown!\n"); break; } /* end switch */ diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 172f9ab..fbf7613 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -289,7 +289,7 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, /* encode */ tm = HDgmtime(mesg); - sprintf((char*)p, "%04d%02d%02d%02d%02d%02d", + HDsprintf((char*)p, "%04d%02d%02d%02d%02d%02d", 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); diff --git a/src/H5Oname.c b/src/H5Oname.c index a710944..1f20f10 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -297,7 +297,7 @@ H5O__name_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", mesg->s); diff --git a/src/H5PB.c b/src/H5PB.c index a325ad1..88a6151 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -252,7 +252,7 @@ H5PB_print_stats(const H5PB_t *page_buf) HDassert(page_buf); - printf("PAGE BUFFER STATISTICS:\n"); + HDprintf("PAGE BUFFER STATISTICS:\n"); HDprintf("******* METADATA\n"); HDprintf("\t Total Accesses: %u\n", page_buf->accesses[0]); diff --git a/src/H5ST.c b/src/H5ST.c index dd5b63c..3a1020b 100644 --- a/src/H5ST.c +++ b/src/H5ST.c @@ -743,19 +743,19 @@ H5ST__dump_internal(H5ST_ptr_t p) FUNC_ENTER_STATIC_NOERR if(p) { - printf("p=%p\n", (void *)p); - printf("\tp->up=%p\n", (void *)p->up); - printf("\tp->parent=%p\n", (void *)p->parent); - printf("\tp->lokid=%p\n", (void *)p->lokid); - printf("\tp->hikid=%p\n", (void *)p->hikid); - printf("\tp->eqkid=%p\n", (void *)p->eqkid); - printf("\tp->splitchar=%c\n", p->splitchar); + HDprintf("p=%p\n", (void *)p); + HDprintf("\tp->up=%p\n", (void *)p->up); + HDprintf("\tp->parent=%p\n", (void *)p->parent); + HDprintf("\tp->lokid=%p\n", (void *)p->lokid); + HDprintf("\tp->hikid=%p\n", (void *)p->hikid); + HDprintf("\tp->eqkid=%p\n", (void *)p->eqkid); + HDprintf("\tp->splitchar=%c\n", p->splitchar); H5ST__dump_internal(p->lokid); if(p->splitchar) H5ST__dump_internal(p->eqkid); else - printf("%s\n", (char *)p->eqkid); + HDprintf("%s\n", (char *)p->eqkid); H5ST__dump_internal(p->hikid); } /* end if */ diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index ebd05ce..0f76f1e 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -94,24 +94,24 @@ H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth) switch(H5S_GET_EXTENT_TYPE(mesg)) { case H5S_NULL: - fprintf(stream, "%*s%-*s H5S_NULL\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s H5S_NULL\n", indent, "", fwidth, "Space class:"); break; case H5S_SCALAR: - fprintf(stream, "%*s%-*s H5S_SCALAR\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s H5S_SCALAR\n", indent, "", fwidth, "Space class:"); break; case H5S_SIMPLE: - fprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth, "Space class:"); H5O_debug_id(H5O_SDSPACE_ID, f, &(mesg->extent), stream, indent + 3, MAX(0, fwidth - 3)); break; case H5S_NO_CLASS: default: - fprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth, "Space class:", (long)(H5S_GET_EXTENT_TYPE(mesg))); break; } /* end switch */ diff --git a/src/H5T.c b/src/H5T.c index 9544488..ad36492 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1397,7 +1397,7 @@ H5T_top_term_package(void) if((path->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), "H5T: conversion function " + HDfprintf(H5DEBUG(T), "H5T: conversion function " "0x%08lx failed to free private data for " "%s (ignored)\n", (unsigned long)(path->conv.u.lib_func), path->name); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index e6d83bb..9a1105b 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2771,7 +2771,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_FREE: #ifdef H5T_DEBUG if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), " Using %s mapping function%s\n", + HDfprintf(H5DEBUG(T), " Using %s mapping function%s\n", priv->length?"O(1)":"O(log N)", priv->length?"":", where N is the number of enum members"); } diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 811162d..9572182 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -2988,7 +2988,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t /* Get the file access property list to access the file */ HDva_copy(tmp_args, arguments); - fapl_id = va_arg(tmp_args, hid_t); + fapl_id = HDva_arg(tmp_args, hid_t); HDva_end(tmp_args); /* Get the VOL info from the FAPL */ diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index e7f27e1..624cd30 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -755,7 +755,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR /* H5Fget_dset_no_attrs_hint */ case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG: { - hbool_t *minimize = va_arg(arguments, hbool_t *); + hbool_t *minimize = HDva_arg(arguments, hbool_t *); *minimize = H5F_GET_MIN_DSET_OHDR(f); break; } @@ -763,7 +763,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR /* H5Fset_dset_no_attrs_hint */ case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: { - int minimize = va_arg(arguments, int); + int minimize = HDva_arg(arguments, int); if(H5F_set_min_dset_ohdr(f, (hbool_t)minimize) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set file's dataset object header minimization flag") break; diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 67646a0..f8fc325 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -850,7 +850,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - sscanf(current->tok_begin, "%ld", &factor->value.int_val); + HDsscanf(current->tok_begin, "%ld", &factor->value.int_val); break; case H5Z_XFORM_FLOAT: @@ -858,7 +858,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - sscanf(current->tok_begin, "%lf", &factor->value.float_val); + HDsscanf(current->tok_begin, "%lf", &factor->value.float_val); break; case H5Z_XFORM_SYMBOL: diff --git a/src/H5dbg.c b/src/H5dbg.c index dd50034..4939bca 100644 --- a/src/H5dbg.c +++ b/src/H5dbg.c @@ -113,7 +113,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, } /* end else */ } /* end if */ else - fprintf(stream, " "); + HDfprintf(stream, " "); if(7 == v) HDfputc(' ', stream); } /* end for */ diff --git a/src/H5private.h b/src/H5private.h index f58faec..d1841b9 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1334,8 +1334,9 @@ typedef off_t h5_stat_size_t; #define HDsrandom(S) srand(S) #endif /* HDsrandom */ #endif /* H5_HAVE_RAND_R */ -/* sscanf() variable arguments */ - +#ifndef HDsscanf + #define HDsscanf(S,FMT,...) sscanf(S,FMT,__VA_ARGS__) +#endif /* HDsscanf */ #ifndef HDstrcat #define HDstrcat(X,Y) strcat(X,Y) #endif /* HDstrcat */ diff --git a/src/H5timer.c b/src/H5timer.c index 0ba8bd1..4b1ec06 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -213,26 +213,26 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds) if(H5_DBL_ABS_EQUAL(bw, (double)0.0F)) HDstrcpy(buf, "0.000 B/s"); else if(bw < (double)1.0F) - sprintf(buf, "%10.4e", bw); + HDsprintf(buf, "%10.4e", bw); else if(bw < (double)H5_KB) { - sprintf(buf, "%05.4f", bw); + HDsprintf(buf, "%05.4f", bw); HDstrcpy(buf+5, " B/s"); } else if(bw < (double)H5_MB) { - sprintf(buf, "%05.4f", bw / (double)H5_KB); + HDsprintf(buf, "%05.4f", bw / (double)H5_KB); HDstrcpy(buf+5, " kB/s"); } else if(bw < (double)H5_GB) { - sprintf(buf, "%05.4f", bw / (double)H5_MB); + HDsprintf(buf, "%05.4f", bw / (double)H5_MB); HDstrcpy(buf+5, " MB/s"); } else if(bw < (double)H5_TB) { - sprintf(buf, "%05.4f", bw / (double)H5_GB); + HDsprintf(buf, "%05.4f", bw / (double)H5_GB); HDstrcpy(buf+5, " GB/s"); } else if(bw < (double)H5_PB) { - sprintf(buf, "%05.4f", bw / (double)H5_TB); + HDsprintf(buf, "%05.4f", bw / (double)H5_TB); HDstrcpy(buf+5, " TB/s"); } else { - sprintf(buf, "%10.4e", bw); + HDsprintf(buf, "%10.4e", bw); if(HDstrlen(buf) > 10) - sprintf(buf, "%10.3e", bw); + HDsprintf(buf, "%10.3e", bw); } } } /* end H5_bandwidth() */ diff --git a/test/accum.c b/test/accum.c index 7af353c..da90995 100644 --- a/test/accum.c +++ b/test/accum.c @@ -100,7 +100,7 @@ main(void) /* Test Setup */ - puts("Testing the metadata accumulator"); + HDputs("Testing the metadata accumulator"); /* File access property list */ h5_reset(); @@ -152,7 +152,7 @@ main(void) if(nerrors) goto error; - puts("All metadata accumulator tests passed."); + HDputs("All metadata accumulator tests passed."); h5_cleanup(FILENAME, fapl); return 0; @@ -160,7 +160,7 @@ main(void) error: if(api_ctx_pushed) H5CX_pop(); - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); return 1; } /* end main() */ diff --git a/test/app_ref.c b/test/app_ref.c index 3ef3fef..a4853fa 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -83,8 +83,8 @@ Abrt_Handler (int H5_ATTR_UNUSED sig) int i, n; for (i=0; i0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find copied region in destination"); + HDputs (" Unabled to find copied region in destination"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found copied bits when we shouldn't have"); + HDputs (" Found copied bits when we shouldn't have"); goto failed; } @@ -199,25 +199,25 @@ test_copy (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first copied bit in destination " + HDprintf (" Unable to find first copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found copied bits and shouldn't have!"); + HDputs (" Found copied bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last copied bit in destination " + HDprintf (" Unable to find last copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order zeros are present and shouldn't be!"); + HDputs (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -228,25 +228,25 @@ test_copy (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last copied bit in destination " + HDprintf (" Unable to find last copied bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found copied bits but shouldn't have (reverse)!"); + HDputs (" Found copied bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of copied data " + HDprintf (" Unable to find beginning of copied data " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading original data but shouldn't have!"); + HDputs (" Found leading original data but shouldn't have!"); goto failed; } @@ -256,14 +256,14 @@ test_copy (void) return 0; failed: - printf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", i, (unsigned long)s_offset, (unsigned long)d_offset, (unsigned long)size); - printf (" s = 0x"); - for (j=sizeof(v1)-1; j>=0; --j) printf ("%02x", v1[j]); - printf ("\n d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" s = 0x"); + for (j=sizeof(v1)-1; j>=0; --j) HDprintf ("%02x", v1[j]); + HDprintf ("\n d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -311,7 +311,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if(n != (ssize_t)offset + shift_dist) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -323,7 +323,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -338,7 +338,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -350,7 +350,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if(n != (ssize_t)(offset + size) - shift_dist - 1) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -373,7 +373,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (n >= 0) { H5_FAILED(); - printf (" Unable to verify all bits are zero in destination(LSB) " + HDprintf (" Unable to verify all bits are zero in destination(LSB) " "(n=%d)\n", (int)n); goto failed; } @@ -382,7 +382,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n >= 0) { H5_FAILED(); - printf (" Unable to verify all bits are zero in destination(MSB) " + HDprintf (" Unable to verify all bits are zero in destination(MSB) " "(n=%d)\n", (int)n); goto failed; } @@ -392,11 +392,11 @@ test_shift (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", i, (unsigned long)offset, (unsigned long)size, (unsigned long)shift_dist); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -446,13 +446,13 @@ test_increment (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (size!=1 && (size_t)n!=offset+size-1) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } if(size==1 && n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bit in destination " + HDprintf (" Unable to verify all-zero bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -464,13 +464,13 @@ test_increment (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (size!=1 && n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if(size==1 && n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bit in destination " + HDprintf (" Unable to verify all-zero bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -480,10 +480,10 @@ test_increment (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -530,7 +530,7 @@ test_decrement (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -542,7 +542,7 @@ test_decrement (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -552,10 +552,10 @@ test_decrement (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -602,7 +602,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -614,7 +614,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -630,7 +630,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bits in destination " + HDprintf (" Unable to verify all-zero bits in destination " "(n=%d)\n", (int)n); goto failed; } @@ -642,7 +642,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bits in destination " + HDprintf (" Unable to verify all-zero bits in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -652,10 +652,10 @@ test_negate (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -697,12 +697,12 @@ test_set (void) for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find set region in buffer"); + HDputs (" Unabled to find set region in buffer"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found set bits when we shouldn't have"); + HDputs (" Found set bits when we shouldn't have"); goto failed; } @@ -711,25 +711,25 @@ test_set (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first set bit in destination " + HDprintf (" Unable to find first set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found set bits and shouldn't have!"); + HDputs (" Found set bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last set bit in destination " + HDprintf (" Unable to find last set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order zeros are present and shouldn't be!"); + HDputs (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -740,25 +740,25 @@ test_set (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last set bit in destination " + HDprintf (" Unable to find last set bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found set bits but shouldn't have (reverse)!"); + HDputs (" Found set bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of set bit region " + HDprintf (" Unable to find beginning of set bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading zeros but shouldn't have!"); + HDputs (" Found leading zeros but shouldn't have!"); goto failed; } @@ -768,11 +768,11 @@ test_set (void) return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -814,12 +814,12 @@ test_clear (void) for (j=0; j<(int)sizeof(v2); j++) if (0xff!=v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find cleared region in buffer"); + HDputs (" Unabled to find cleared region in buffer"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found cleared bits when we shouldn't have"); + HDputs (" Found cleared bits when we shouldn't have"); goto failed; } @@ -828,25 +828,25 @@ test_clear (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 0); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first cleared bit in destination " + HDprintf (" Unable to find first cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found cleared bits and shouldn't have!"); + HDputs (" Found cleared bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 1); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last cleared bit in destination " + HDprintf (" Unable to find last cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order ones are present and shouldn't be!"); + HDputs (" High-order ones are present and shouldn't be!"); goto failed; } @@ -857,25 +857,25 @@ test_clear (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 0); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last cleared bit in destination " + HDprintf (" Unable to find last cleared bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found cleared bits but shouldn't have (reverse)!"); + HDputs (" Found cleared bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 1); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of cleared bit region " + HDprintf (" Unable to find beginning of cleared bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading ones but shouldn't have!"); + HDputs (" Found leading ones but shouldn't have!"); goto failed; } @@ -885,11 +885,11 @@ test_clear (void) return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -928,11 +928,11 @@ main(void) nerrors += test_negate() < 0 ? 1 : 0; if(nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S"); exit(EXIT_FAILURE); } - printf("All bit tests passed.\n"); + HDprintf("All bit tests passed.\n"); H5close(); diff --git a/test/h5test.c b/test/h5test.c index ea5e2f8..d17156a 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1270,7 +1270,7 @@ h5_set_info_object(void) int ret_value=0; /* handle any MPI INFO hints via $HDF5_MPI_INFO */ - if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ + if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){ char *next, *valp; valp = envp = next = HDstrdup(envp); @@ -1332,7 +1332,7 @@ h5_set_info_object(void) /* actually set the darned thing */ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { - printf("MPI_Info_set failed\n"); + HDprintf("MPI_Info_set failed\n"); ret_value = -1; } } @@ -1508,9 +1508,9 @@ print_func(const char *format, ...) va_list arglist; int ret_value; - va_start(arglist, format); + HDva_start(arglist, format); ret_value = vprintf(format, arglist); - va_end(arglist); + HDva_end(arglist); return ret_value; } @@ -1595,7 +1595,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) int len; static char* env = NULL; - assert(name); + HDassert(name); MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); @@ -1603,7 +1603,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) if(mpi_initialized && !mpi_finalized) { MPI_Comm_rank(comm, &mpi_rank); MPI_Comm_size(comm, &mpi_size); - assert(root < mpi_size); + HDassert(root < mpi_size); /* The root task does the getenv call * and sends the result to the other tasks */ diff --git a/test/mount.c b/test/mount.c index c6230ee..b7d2858 100644 --- a/test/mount.c +++ b/test/mount.c @@ -192,7 +192,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting a file on itself should have failed."); + HDputs(" Mounting a file on itself should have failed."); TEST_ERROR } /* end if */ @@ -208,7 +208,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting two files at one mount point should have failed."); + HDputs(" Mounting two files at one mount point should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -227,7 +227,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting same file opened twice at one mount point should have failed."); + HDputs(" Mounting same file opened twice at one mount point should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -240,7 +240,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Creating a cycle with mount points should have failed."); + HDputs(" Creating a cycle with mount points should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -423,7 +423,7 @@ test_hide(hid_t fapl) } H5E_END_TRY; if(grp >= 0) { H5_FAILED(); - puts(" Name is still accessible under mount point."); + HDputs(" Name is still accessible under mount point."); TEST_ERROR } /* end if */ @@ -434,7 +434,7 @@ test_hide(hid_t fapl) if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - puts(" Hard link failed for hidden object."); + HDputs(" Hard link failed for hidden object."); TEST_ERROR } /* end if */ @@ -503,7 +503,7 @@ test_assoc(hid_t fapl) if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - puts(" Association failed."); + HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -628,7 +628,7 @@ test_move(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Moving an object across files should't have been possible"); + HDputs(" Moving an object across files should't have been possible"); TEST_ERROR } /* end if */ @@ -834,7 +834,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Incorrect traversal from mount point!"); + HDputs(" Incorrect traversal from mount point!"); TEST_ERROR } /* end if */ @@ -851,7 +851,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Traversal through mount point should not have worked!"); + HDputs(" Traversal through mount point should not have worked!"); TEST_ERROR } /* end if */ H5E_BEGIN_TRY { @@ -859,7 +859,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Traversal through mount point should not have worked!"); + HDputs(" Traversal through mount point should not have worked!"); TEST_ERROR } /* end if */ @@ -873,7 +873,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); + HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__); TEST_ERROR } /* end if */ H5E_BEGIN_TRY { @@ -881,7 +881,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); + HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -1005,7 +1005,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Interfile hard link should not have been allowed!"); + HDputs(" Interfile hard link should not have been allowed!"); TEST_ERROR } /* end if */ @@ -1015,7 +1015,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Interfile renaming should not have been allowed!"); + HDputs(" Interfile renaming should not have been allowed!"); TEST_ERROR } /* end if */ @@ -1033,7 +1033,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(dset >= 0) { H5_FAILED(); - puts(" Dataset and shared type must be in the same file!"); + HDputs(" Dataset and shared type must be in the same file!"); TEST_ERROR } /* end if */ @@ -1172,7 +1172,7 @@ test_close(hid_t fapl) if(H5Fclose(file1) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { H5_FAILED(); - puts(" File1 contents are not accessible!"); + HDputs(" File1 contents are not accessible!"); TEST_ERROR } /* end if */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR @@ -4379,13 +4379,13 @@ main(void) if (nerrors) goto error; - puts("All mount tests passed."); + HDputs("All mount tests passed."); h5_cleanup(FILENAME, fapl); return 0; error: - puts("***** MOUNT ERRORS *****"); + HDputs("***** MOUNT ERRORS *****"); return 1; } diff --git a/test/titerate.c b/test/titerate.c index de652a7..2a6f521 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -104,7 +104,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ return(count2 > 10 ? 1 : 0); default: - printf("invalid iteration command"); + HDprintf("invalid iteration command"); return(-1); } /* end switch */ } /* end liter_cb() */ @@ -151,7 +151,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(filespace, FAIL, "H5Screate"); for(i=0; i< NDATASETS; i++) { - sprintf(name,"Dataset %d",i); + HDsprintf(name,"Dataset %d",i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -725,7 +725,7 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(filespace, FAIL, "H5Screate"); for(i = 0; i < NDATASETS; i++) { - sprintf(name, "Dataset %d", i); + HDsprintf(name, "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -976,6 +976,6 @@ test_iterate(void) void cleanup_iterate(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tselect.c b/test/tselect.c index 3c93e7a..12935ea 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -11982,7 +11982,7 @@ test_space_rebuild(void) rebuild_stat = FALSE; rebuild_stat = H5S_get_rebuild_status_test(sid_reg1); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12061,7 +12061,7 @@ test_space_rebuild(void) rebuild_stat = FALSE; rebuild_stat = H5S_get_rebuild_status_test(sid_reg2); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12098,7 +12098,7 @@ test_space_rebuild(void) rebuild_stat = TRUE; rebuild_stat = H5S_get_rebuild_status_test(sid_irreg2); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12150,7 +12150,7 @@ test_space_rebuild(void) rebuild_stat = FALSE; rebuild_stat = H5S_get_rebuild_status_test(sid_reg3); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ @@ -12193,7 +12193,7 @@ test_space_rebuild(void) rebuild_stat = TRUE; rebuild_stat = H5S_get_rebuild_status_test(sid_irreg3); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12253,7 +12253,7 @@ test_space_rebuild(void) rebuild_stat = FALSE; rebuild_stat = H5S_get_rebuild_status_test(sid_reg4); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12306,7 +12306,7 @@ test_space_rebuild(void) rebuild_stat = TRUE; rebuild_stat = H5S_get_rebuild_status_test(sid_irreg4); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12370,7 +12370,7 @@ test_space_rebuild(void) rebuild_stat = FALSE; rebuild_stat = H5S_get_rebuild_status_test(sid_reg5); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12428,7 +12428,7 @@ test_space_rebuild(void) rebuild_stat = TRUE; rebuild_stat = H5S_get_rebuild_status_test(sid_irreg5); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12491,7 +12491,7 @@ test_space_rebuild(void) rebuild_stat = TRUE; rebuild_stat = H5S_get_rebuild_status_test(sid_spec); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ ret = FAIL; @@ -12514,7 +12514,7 @@ test_space_rebuild(void) rebuild_stat = FALSE; rebuild_stat = H5S_get_rebuild_status_test(sid_spec); - assert(rebuild_stat!=FAIL); + HDassert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(!rebuild_stat){ ret = FAIL; @@ -13848,6 +13848,6 @@ test_select(void) void cleanup_select(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/tsohm.c b/test/tsohm.c index bd73d00..5c3707f 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -621,12 +621,12 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos HDmemset(&rdata, 0, sizeof(rdata)); \ if (0 > H5Dread((dset_id), (dtype_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata)) { \ H5_FAILED(); AT(); \ - printf("Can't read data\n"); \ + HDprintf("Can't read data\n"); \ goto error; \ } \ if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \ H5_FAILED(); AT(); \ - printf("incorrect read data\n"); \ + HDprintf("incorrect read data\n"); \ goto error; \ } \ } /* TSOHM_S1H_VERIFY_DATA() definition */ @@ -1383,7 +1383,7 @@ size2_verify_plist1(hid_t plist) ret = H5Pget_fill_value(plist, dtype1_id, &fill1); CHECK_I(ret, "H5Pget_fill_value"); - ret = memcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); + ret = HDmemcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); VERIFY(ret, 0, "memcmp"); ret = H5Tclose(dtype1_id); @@ -1482,15 +1482,15 @@ size2_verify_plist2(hid_t plist) static void size2_dump_struct(const char *name, size2_helper_struct *sizes) { - puts(name); - printf(" empty size: %llu\n", (unsigned long long)sizes->empty_size); - printf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size)); - printf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset)); - printf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset)); - printf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1)); - printf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2)); - printf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved)); - printf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1)); + HDputs(name); + HDprintf(" empty size: %llu\n", (unsigned long long)sizes->empty_size); + HDprintf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size)); + HDprintf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset)); + HDprintf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset)); + HDprintf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1)); + HDprintf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2)); + HDprintf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved)); + HDprintf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1)); } /* size2_dump_struct */ #endif /* NOT_NOW */ @@ -3862,8 +3862,8 @@ test_sohm(void) void cleanup_sohm(void) { - remove(FILENAME); - remove(FILENAME_SRC); - remove(FILENAME_DST); + HDremove(FILENAME); + HDremove(FILENAME_SRC); + HDremove(FILENAME_DST); } /* cleanup_sohm */ diff --git a/test/ttime.c b/test/ttime.c index 48c9ba8..5b3436d 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -178,13 +178,13 @@ test_time_io(void) tid = H5Dget_type(dsid); CHECK(tid, FAIL, "H5Dget_type"); if( H5Tget_class (tid) == H5T_TIME) - fprintf(stderr,"datatype class is H5T_TIME\n"); + HDfprintf(stderr,"datatype class is H5T_TIME\n"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); status = H5Dread (dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timethen); CHECK(status, FAIL, "H5Dread"); -fprintf(stderr,"time written was: %s\n", HDctime(&timethen)); +HDfprintf(stderr,"time written was: %s\n", HDctime(&timethen)); status = H5Dclose(dsid); CHECK(status, FAIL, "H5Dclose"); @@ -231,6 +231,6 @@ test_time(void) void cleanup_time(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tunicode.c b/test/tunicode.c index 5a60036..255dc50 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -854,7 +854,7 @@ void test_unicode(void) */ void cleanup_unicode(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/tvlstr.c b/test/tvlstr.c index da6195c..77589bb 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -183,7 +183,7 @@ test_vlstrings_basic(void) /* Count the actual number of bytes used by the strings */ for(i=0,str_used=0; i