diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-01-11 01:51:42 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-01-11 01:51:42 (GMT) |
commit | 536a32c59be69f9ae75604a31d0ec34c57cf9f00 (patch) | |
tree | 605e0c0272cce05f9b8b8ed1799c384c9894ed0e | |
parent | a7e0ef996a63b87cc0295b58f37f037c848a6929 (diff) | |
download | hdf5-536a32c59be69f9ae75604a31d0ec34c57cf9f00.zip hdf5-536a32c59be69f9ae75604a31d0ec34c57cf9f00.tar.gz hdf5-536a32c59be69f9ae75604a31d0ec34c57cf9f00.tar.bz2 |
C and POSIX call cleanup
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"; } @@ -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))) @@ -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); @@ -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); @@ -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); @@ -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]); @@ -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 */ @@ -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; i<T_NUMCLASSES; i++) { - fprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n); - fprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]); + HDfprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n); + HDfprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]); } } @@ -195,7 +195,7 @@ main (void) error: - puts("***** APPLICATION REFERENCE COUNT TESTS FAILED *****"); + HDputs("***** APPLICATION REFERENCE COUNT TESTS FAILED *****"); return 1; } @@ -524,7 +524,7 @@ reader(char *filename, hid_t fapl) } if(zero) { H5_FAILED(); - printf(" %d zero%s\n", zero, 1 == zero ? "" : "s"); + HDprintf(" %d zero%s\n", zero, 1 == zero ? "" : "s"); } else if(wrong) { SKIPPED(); HDputs(" Possible overlap with another region."); @@ -765,7 +765,7 @@ main (int ac, char **av) family_size_def = (hsize_t)HDstrtoull(*av, NULL, 0); } else{ - printf("***Missing fsize value***\n"); + HDprintf("***Missing fsize value***\n"); usage(); return 1; } diff --git a/test/bittests.c b/test/bittests.c index ccd725c..e29c188 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -57,13 +57,13 @@ test_find (void) n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_LSB, TRUE); if(-1 != n) { H5_FAILED(); - puts (" Zero length test failed (lsb)!"); + HDputs (" Zero length test failed (lsb)!"); goto failed; } n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_MSB, TRUE); if(-1 != n) { H5_FAILED(); - puts (" Zero length test failed (msb)!"); + HDputs (" Zero length test failed (msb)!"); goto failed; } @@ -73,13 +73,13 @@ test_find (void) n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE); if(-1 != n) { H5_FAILED(); - puts (" Zero buffer test failed (lsb)!"); + HDputs (" Zero buffer test failed (lsb)!"); goto failed; } n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE); if(-1 != n) { H5_FAILED(); - puts (" Zero buffer test failed (msb)!"); + HDputs (" Zero buffer test failed (msb)!"); goto failed; } @@ -90,13 +90,13 @@ test_find (void) n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE); if((ssize_t)i != n) { H5_FAILED(); - printf (" Test for set bit %d failed (lsb)!\n", i); + HDprintf (" Test for set bit %d failed (lsb)!\n", i); goto failed; } n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE); if((ssize_t)i != n) { H5_FAILED(); - printf (" Test for set bit %d failed (msb)!\n", i); + HDprintf (" Test for set bit %d failed (msb)!\n", i); goto failed; } } @@ -106,13 +106,13 @@ test_find (void) n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, FALSE); if(-1 != n) { H5_FAILED(); - puts (" One buffer test failed (lsb)!"); + HDputs (" One buffer test failed (lsb)!"); goto failed; } n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, FALSE); if(-1 != n) { H5_FAILED(); - puts (" One buffer test failed (msb)!"); + HDputs (" One buffer test failed (msb)!"); goto failed; } @@ -123,13 +123,13 @@ test_find (void) n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE); if ((ssize_t)i!=n) { H5_FAILED(); - printf (" Test for clear bit %d failed (lsb)!\n", i); + HDprintf (" Test for clear bit %d failed (lsb)!\n", i); goto failed; } n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_MSB, FALSE); if ((ssize_t)i!=n) { H5_FAILED(); - printf (" Test for clear bit %d failed (lsb)!\n", i); + HDprintf (" Test for clear bit %d failed (lsb)!\n", i); goto failed; } } @@ -139,9 +139,9 @@ test_find (void) return 0; failed: - printf (" v = 0x"); - for (i=0; i<(int)sizeof(v1); i++) printf ("%02x", v1[i]); - printf ("\n"); + HDprintf (" v = 0x"); + for (i=0; i<(int)sizeof(v1); i++) HDprintf ("%02x", v1[i]); + HDprintf ("\n"); return -1; } @@ -185,12 +185,12 @@ test_copy (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 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<SPACE1_DIM1; i++) - str_used+=HDstrlen(wdata[i])+1; + str_used += HDstrlen(wdata[i])+1; /* Compare against the strings actually written */ VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size"); @@ -198,7 +198,7 @@ test_vlstrings_basic(void) /* Compare data read in */ for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { @@ -300,7 +300,7 @@ test_vlstrings_special(void) /* Compare data read in */ for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i])); continue; } /* end if */ if((wdata[i] == NULL && rdata[i] != NULL) || (rdata[i] == NULL && wdata[i] != NULL)) { @@ -527,7 +527,7 @@ test_compact_vlstring(void) /* Compare data read in */ for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)HDstrlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0) { @@ -802,33 +802,33 @@ static void test_vl_rewrite(void) /* Create in file 1 */ for(i=0; i<REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); write_scalar_dset(file1, type, space, name, name); } /* Effectively copy data from file 1 to 2 */ for(i=0; i<REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file1, type, space, name, name); write_scalar_dset(file2, type, space, name, name); } /* Read back from file 2 */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file2, type, space, name, name); } /* end for */ /* Remove from file 2. */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); ret = H5Ldelete(file2, name, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end for */ /* Effectively copy from file 1 to file 2 */ for(i = 0; i < REWRITE_NDATASETS; i++) { - sprintf(name, "/set_%d", i); + HDsprintf(name, "/set_%d", i); read_scalar_dset(file1, type, space, name, name); write_scalar_dset(file2, type, space, name, name); } /* end for */ @@ -378,7 +378,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR if(config == TEST_API_REOPEN_FILE) { if(oinfo.meta_size.obj.heap_size != exp_meta_size) { - printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR } } @@ -11619,7 +11619,7 @@ main(void) for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++) nerrors += test_api((test_api_config_t)test_api_config, fapl); for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { - printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); + HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); nerrors += test_basic_io(bit_config, fapl); nerrors += test_vds_prefix(bit_config, fapl); nerrors += test_unlim(bit_config, fapl); @@ -11634,14 +11634,14 @@ main(void) if(nerrors) goto error; - printf("All virtual dataset tests passed.\n"); + HDprintf("All virtual dataset tests passed.\n"); h5_cleanup(FILENAME, fapl); return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); - printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ @@ -412,8 +412,8 @@ test_core(void) for(j = 0; j < CORE_DSET_DIM2; j++) if(*pr++ != *pw++) { H5_FAILED(); - printf(" Read different values than written in data set.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -480,8 +480,8 @@ test_core(void) for(j = 0; j < CORE_DSET_DIM2; j++) if(*pw++ != *pr++) { H5_FAILED(); - printf(" Read different values than written in data set.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -597,7 +597,7 @@ test_direct(void) if(file<0) { H5Pclose (fapl); SKIPPED(); - printf(" Probably the file system doesn't support Direct I/O\n"); + HDprintf(" Probably the file system doesn't support Direct I/O\n"); return 0; } @@ -674,8 +674,8 @@ test_direct(void) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set 1.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -706,8 +706,8 @@ test_direct(void) for(i = 0; i < DSET2_DIM; i++) if(wdata2[i] != rdata2[i]) { H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); + HDprintf(" Read different values than written in data set 2.\n"); + HDprintf(" At index %d\n", i); TEST_ERROR; } /* end if */ @@ -1199,19 +1199,19 @@ test_multi(void) memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3; @@ -1431,12 +1431,12 @@ test_multi_compat(void) memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; @@ -1446,17 +1446,19 @@ test_multi_compat(void) h5_fixname(FILENAME[9], fapl, newname, sizeof newname); /* Make copy for the data file in the build directory, to protect the - * original file in the source directory */ - sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); - sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); + * original file in the source directory + */ + HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); + HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); h5_make_local_copy(filename_s, newname_s); - sprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); - sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); + HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); + HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); h5_make_local_copy(filename_r, newname_r); /* Reopen the file for read only. Verify 1.8 library can open file - * created with 1.6 library. */ + * created with 1.6 library. + */ if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; |