diff options
author | Quincey Koziol <koziol@koziol.gov> | 2019-06-28 14:10:43 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@koziol.gov> | 2019-06-28 14:10:43 (GMT) |
commit | d5130bb57332ce0049302c5836bbf666b23513cd (patch) | |
tree | fd710a4a2d419a0d3829a933905d8e5bef0f9e7f | |
parent | 2c69584fb124c20e1dd06c31f2baf240b50b381c (diff) | |
download | hdf5-d5130bb57332ce0049302c5836bbf666b23513cd.zip hdf5-d5130bb57332ce0049302c5836bbf666b23513cd.tar.gz hdf5-d5130bb57332ce0049302c5836bbf666b23513cd.tar.bz2 |
Updated configure & CMake compiler flags for GCC 8.x, along with corresponding
changes to warnhist script (and some extra improvements for condensing C++
and Java warnings), and fixed a bunch of warnings.
57 files changed, 544 insertions, 413 deletions
diff --git a/bin/warnhist b/bin/warnhist index 5750c77..df7565e 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -156,6 +156,7 @@ while (<>) { my $offset; my $warning; my $extra; + my $extra2; # Retain last FORTRAN compile line, which comes a few lines before warning if($_ =~ /.*\.[fF]90:.*/) { @@ -168,21 +169,27 @@ while (<>) { ($last_c_name, $toss) = split /\:/, $_; } + # Skip lines that don't have the word "warning" next if $_ !~ /[Ww]arning:/; # Skip warnings from linker next if $_ =~ /ld: warning:/; + # "Hide" the C++ '::' symbol until we've parsed out the parts of the line + while($_ =~ /\:\:/) { + $_ =~ s/\:\:/@@@@/g; + } + # Check for weird formatting of warning message if($_ =~ /^cc1: warning:.*/) { $name = $last_c_name; $line = "??"; - ($toss, $toss, $warning, $extra) = split /\:/, $_; + ($toss, $toss, $warning, $extra, $extra2) = split /\:/, $_; # Check for FORTRAN warning output } elsif($_ =~ /^Warning:.*/) { $name = $last_fort_name; $line = $last_fort_line; - ($toss, $warning, $extra) = split /\:/, $_; + ($toss, $warning, $extra, $extra2) = split /\:/, $_; #print "1:",$.,":",$_; # $_ = <>; #print "2:",$.,":",$_; @@ -202,11 +209,11 @@ while (<>) { next } } else { - # Check for 'character offset' field + # Check for 'character offset' field appended to file & line # if($_ =~ /^.*[0-9]+\:[0-9]+\:/) { - ($name, $line, $offset, $toss, $warning, $extra) = split /\:/, $_; + ($name, $line, $offset, $toss, $warning, $extra, $extra2) = split /\:/, $_; } else { - ($name, $line, $toss, $warning, $extra) = split /\:/, $_; + ($name, $line, $toss, $warning, $extra, $extra2) = split /\:/, $_; } } @@ -216,6 +223,14 @@ while (<>) { if(length $extra ) { $warning = join ':', $warning, $extra; } + if(length $extra2 ) { + $warning = join ':', $warning, $extra2; + } + + # Restore the C++ '::' symbol now that we've parsed out the parts of the line + while($warning =~ /@@@@/) { + $warning =~ s/@@@@/\:\:/g; + } # Trim leading '..' paths from filename while($name =~ /^\.\.\//) { @@ -265,14 +280,18 @@ while (<>) { # Skip supplemental warning message next if $warning =~ /near initialization for/; + # Skip C++ supplemental warning message + next if $warning =~ /in call to/; + # Skip GCC warning that should be a note next if $_ =~ /\(this will be reported only once per input file\)/; - # Eliminate "{aka <some type>}" info - if($warning =~ /\s\{aka [A-Za-z_0-9\s\*]*\}'/) { - $warning =~ s/\s\{aka [A-Za-z_0-9\s\*]*\}//g; + # Eliminate "{aka <some type>}" and "{aka '<some type>'}" info + if($warning =~ /\s\{aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'?/) { + $warning =~ s/\s\{aka '?[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'?\}//g; } +# print "warning = $warning\n"; # Genericize warnings if($warning =~ /variable '[A-Za-z_0-9]*' set but not used.*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; @@ -293,9 +312,9 @@ while (<>) { $warning =~ s/'[A-Za-z_0-9\s]*'/'-'/g; } elsif($warning =~ /cast discards '[A-Za-z_0-9\(\)\s]*'.*/) { $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g; - } elsif($warning =~ /size of '[A-Za-z_0-9\(\)\s\*]*' is [0-9]* bytes.*/) { + } elsif($warning =~ /size of '[A-Za-z_0-9\(\)\s\*\.]*' is [0-9]* bytes.*/) { $warning =~ s/is [0-9]* bytes/is - bytes/g; - $warning =~ s/'[A-Za-z_0-9\(\)\s\*]*'/'-'/g; + $warning =~ s/'[A-Za-z_0-9\(\)\s\*\.]*'/'-'/g; } elsif($warning =~ /passing argument [0-9]* of '[A-Za-z_0-9\(\)\s]*' from incompatible.*/) { $warning =~ s/passing argument [0-9]*/passing argument -/g; $warning =~ s/'[A-Za-z_0-9\(\)\s]*'/'-'/g; @@ -416,21 +435,37 @@ while (<>) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow \[-Winline\].*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-overflow=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-overflow=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; - $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing up to [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) { - $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[L]*[dfsu]' directive writing (between [0-9]+ and [0-9]+)|(up to [0-9]+) bytes into a region of size (between [0-9]+ and [0-9]+)|([0-9]+) \[-Wformat-overflow=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[L]*[dfsu]'/'-'/g; $warning =~ s/[0-9]+/-/g; - } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-truncation=\].*/) { + } elsif($warning =~ /'(%[0-9]*[\.\*]*[0-9]*[dfsu])|([A-Za-z_0-9\/]+)' directive output may be truncated writing (between [0-9]+ and [0-9]+)|(up to [0-9]+)|(likely 1 or more) byte(s)? into a region of size (between [0-9]+ and [0-9]+)|([0-9]+) \[-Wformat-truncation=\].*/) { $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/'[A-Za-z_0-9\/]+'/'-'/g; $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /conversion to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change the sign of the result \[-Wsign-conversion\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + } elsif($warning =~ /unsigned conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '[0-9]+' \[-Wsign-conversion\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + $warning =~ s/'-?[0-9]+'/'-'/g; + } elsif($warning =~ /conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' may change value \[-Wconversion\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + } elsif($warning =~ /overflow in conversion from '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' changes value from '-?[0-9]+' to '-?[0-9]+' \[-Woverflow\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + $warning =~ s/'-?[0-9]+'/'-'/g; + } elsif($warning =~ /cast between incompatible function types from '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' to '[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*' \[-Wcast-function-type\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\(\)\*\,\ ]*'/'-'/g; + } elsif($warning =~ /(return|initialization|assignment) discards '[A-Za-z_0-9]*' qualifier from pointer target type \[-Wdiscarded-qualifiers\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /'[A-Za-z_0-9]*' attribute on function returning '[A-Za-z_0-9]*' \[-Wattributes\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /ignoring return value of '[A-Za-z_0-9]*', declared with attribute warn_unused_result \[-Wunused-result\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /passing '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' chooses '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' over '[A-Za-z_0-9]+[A-Za-z_0-9\ ]*' \[-Wsign-promo\].*/) { + $warning =~ s/'[A-Za-z_0-9]+[A-Za-z_0-9\ ]*'/'-'/g; + } elsif($warning =~ /'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*' should be initialized in the member initialization list \[-Weffc\+\+\].*/) { + $warning =~ s/'[A-Za-z_\:0-9]+[A-Za-z_\:0-9\ ]*'/'-'/g; + } elsif($warning =~ /\[deprecation\] [A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]* has been deprecated.*/) { + $warning =~ s/[A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]*/-\(-\) in -/g; } # Increment count for [generic] warning diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 4712f50..106d6d7 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -143,7 +143,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2560 -Wvla") # Append more extra warning flags that only gcc 4.4+ know about set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") @@ -203,6 +203,11 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict") endif () + # Append more extra warning flags that only gcc 8.x+ know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc") + endif () + endif () #----------------------------------------------------------------------------- diff --git a/config/gnu-flags b/config/gnu-flags index c55391d..ced54c9 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -118,6 +118,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith" H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" + # As of GCC 8.x, the -Wunsafe-loop-optimizations has been removed H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" # Production @@ -187,10 +188,10 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# When the gcc 8.x release is out, we should check for additional flags to +# When the gcc 9.x release is out, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-[789].*) + gcc-[89].*) # Append warning flags that only gcc 4.2+ knows about # (none, or incorporated in -Wall / -Wextra now) @@ -198,7 +199,56 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" + + # Append warning flags that only gcc 4.4+ knows about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append warning flags that only gcc 4.5+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + + # Append warning flags that only gcc 4.6+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + + # Append warning flags that only gcc 4.7+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + + # Append warning flags that only gcc 4.8+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + + # Append warning flags that only gcc 4.9+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdate-time" + + # Append warning flags that only gcc 5.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + + # Append warning flags that only gcc 6.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" + + # Append warning flags that only gcc 7.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" + + # Append warning flags that only gcc 8.x+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" + ;; + + + gcc-7*) + # Append warning flags that only gcc 4.2+ knows about + # (none, or incorporated in -Wall / -Wextra now) + + # Append warning flags that only gcc 4.3+ knows about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -242,7 +292,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -282,7 +332,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -319,7 +369,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -353,7 +403,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -384,7 +434,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -414,7 +464,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -439,7 +489,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" @@ -459,7 +509,7 @@ case "$cc_vendor-$cc_version" in # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560 -Wvla" # Append warning flags that only gcc 4.4+ knows about H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 1031914..e3a5809 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -1031,22 +1031,21 @@ h5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_ hsize_t *c_block = NULL; H5S_seloper_t c_op; - herr_t status; int rank; int i; rank = H5Sget_simple_extent_ndims(*space_id); if (rank < 0 ) return ret_value; - c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_start == NULL) goto DONE; - c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_count == NULL) goto DONE; - c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_stride == NULL) goto DONE; - c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_block == NULL) goto DONE; diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 57f7dda..e39e85a 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -143,7 +143,7 @@ void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char int main(void) { int i; - char chrA[32],chrB[32]; + char chrA[64],chrB[64]; int IntKinds[] = H5_FORTRAN_INTEGER_KINDS; int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; @@ -347,8 +347,8 @@ int main(void) for(i=0;i<H5_FORTRAN_NUM_REAL_KINDS;i++) { if (RealKinds[i] > 0) { - sprintf(chrA, "Fortran_REAL_%s", Real_C_TYPES[i]); - sprintf(chrB, "real_%s_f", Real_C_TYPES[i]); + snprintf(chrA, sizeof(chrA), "Fortran_REAL_%s", Real_C_TYPES[i]); + snprintf(chrB, sizeof(chrB), "real_%s_f", Real_C_TYPES[i]); writeToFiles("float",chrA, chrB, RealKinds[i]); } } diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index 78b6453..bc3668c 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -273,7 +273,6 @@ CONTAINS INTEGER :: len, i INTEGER :: idx INTEGER :: ierr - TYPE(C_PTR) :: cptr visit_obj_cb = 0 diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 3ebca95..bb72ce6 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2423,9 +2423,9 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) goto out; if (H5T_SGN_NONE == H5Tget_sign(native)) - HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)(value + (size_t)i * dst_size))); + HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int *)((void *)(value + (size_t)i * dst_size)))); else - HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)(value + (size_t)i * dst_size))); + HDsnprintf(tmp_str, TMP_LEN, "%d", *((int *)((void *)(value + (size_t)i * dst_size)))); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; diff --git a/src/H5B2int.c b/src/H5B2int.c index 9940cd7..2d77276 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -1573,23 +1573,20 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_ /* Iterate through records, in order */ for(u = 0; u < curr_node->node_nrec && !ret_value; u++) { /* Descend into child node, if current node is an internal node */ - if(depth > 0) { + if(depth > 0) if((ret_value = H5B2__iterate_node(hdr, (uint16_t)(depth - 1), &(node_ptrs[u]), node, op, op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed"); - } /* end if */ /* Make callback for current record */ - if(!ret_value) { + if(!ret_value) if((ret_value = (op)(H5B2_NAT_NREC(native, hdr, u), op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "iterator function failed"); - } /* end if */ } /* end for */ /* Descend into last child node, if current node is an internal node */ - if(!ret_value && depth > 0) { + if(!ret_value && depth > 0) if((ret_value = H5B2__iterate_node(hdr, (uint16_t)(depth - 1), &(node_ptrs[u]), node, op, op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed"); - } /* end if */ done: /* Unpin the node if it was pinned */ @@ -106,6 +106,9 @@ /* Local Typedefs */ /******************/ +/* Alias for pointer to cache entry, for use when allocating sequences of them */ +typedef H5C_cache_entry_t *H5C_cache_entry_ptr_t; + /********************/ /* Local Prototypes */ @@ -207,8 +210,8 @@ H5FL_DEFINE(H5C_tag_info_t); /* Declare a free list to manage the H5C_t struct */ H5FL_DEFINE_STATIC(H5C_t); -/* Declare a free list to manage flush dependency arrays */ -H5FL_BLK_DEFINE_STATIC(parent); +/* Declare a free list to manage arrays of cache entries */ +H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t); @@ -3600,7 +3603,7 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) /* Array does not exist yet, allocate it */ HDassert(!child_entry->flush_dep_parent); - if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_MALLOC(parent, H5C_FLUSH_DEP_PARENT_INIT * sizeof(H5C_cache_entry_t *)))) + if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT; } /* end if */ @@ -3608,7 +3611,7 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) /* Resize existing array */ HDassert(child_entry->flush_dep_parent); - if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_REALLOC(parent, child_entry->flush_dep_parent, 2 * child_entry->flush_dep_parent_nalloc * sizeof(H5C_cache_entry_t *)))) + if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, 2 * child_entry->flush_dep_parent_nalloc))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc *= 2; } /* end else */ @@ -3766,12 +3769,12 @@ H5C_destroy_flush_dependency(void *parent_thing, void * child_thing) /* Shrink or free the parent array if apporpriate */ if(child_entry->flush_dep_nparents == 0) { - child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_FREE(parent, child_entry->flush_dep_parent); + child_entry->flush_dep_parent = H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent); child_entry->flush_dep_parent_nalloc = 0; } /* end if */ else if(child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT && child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) { - if(NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_REALLOC(parent, child_entry->flush_dep_parent, (child_entry->flush_dep_parent_nalloc / 4) * sizeof(H5C_cache_entry_t *)))) + if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, child_entry->flush_dep_parent_nalloc / 4))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc /= 4; } /* end if */ @@ -287,9 +287,9 @@ typedef struct H5CX_t { hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */ /* Cached DAPL properties */ - char *extfile_prefix; /* Prefix for external file */ + const char *extfile_prefix; /* Prefix for external file */ hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */ - char *vds_prefix; /* Prefix for VDS */ + const char *vds_prefix; /* Prefix for VDS */ hbool_t vds_prefix_valid; /* Whether the prefix for VDS is valid */ /* Cached FAPL properties */ @@ -361,8 +361,8 @@ typedef struct H5CX_dcpl_cache_t { /* Typedef for cached default dataset access property list information */ /* (Same as the cached DXPL struct, above, except for the default DXPL) */ typedef struct H5CX_dapl_cache_t { - char *extfile_prefix; /* Prefix for external file */ - char *vds_prefix; /* Prefix for VDS */ + const char *extfile_prefix; /* Prefix for external file */ + const char *vds_prefix; /* Prefix for VDS */ } H5CX_dapl_cache_t; /* Typedef for cached default file access property list information */ @@ -2491,7 +2491,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5CX_get_ext_file_prefix(char **extfile_prefix) +H5CX_get_ext_file_prefix(const char **extfile_prefix) { H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2548,7 +2548,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5CX_get_vds_prefix(char **vds_prefix) +H5CX_get_vds_prefix(const char **vds_prefix) { H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 638c32a..2f86adf 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -129,8 +129,8 @@ H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks); H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag); /* "Getter" routines for DAPL properties cached in API context */ -H5_DLL herr_t H5CX_get_ext_file_prefix(char **prefix_extfile); -H5_DLL herr_t H5CX_get_vds_prefix(char **prefix_vds); +H5_DLL herr_t H5CX_get_ext_file_prefix(const char **prefix_extfile); +H5_DLL herr_t H5CX_get_vds_prefix(const char **prefix_vds); /* "Getter" routines for FAPL properties cached in API context */ H5_DLL herr_t H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound); diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index d25e0f0..56554f8 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -204,9 +204,9 @@ const H5B2_class_t H5D_BT2_FILT[1] = {{ /* B-tree class information */ /* Declare a free list to manage the H5D_bt2_ctx_t struct */ H5FL_DEFINE_STATIC(H5D_bt2_ctx_t); -/* Declare a free list to manage the page elements */ -H5FL_BLK_DEFINE(chunk_dim); +/* Declare a free list to manage the page elements */ +H5FL_ARR_DEFINE_STATIC(uint32_t, H5O_LAYOUT_NDIMS); @@ -247,7 +247,7 @@ H5D__bt2_crt_context(void *_udata) ctx->ndims = udata->ndims; /* Set up the "local" information for this dataset's chunk dimension sizes */ - if(NULL == (my_dim = (uint32_t *)H5FL_BLK_MALLOC(chunk_dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)))) + if(NULL == (my_dim = (uint32_t *)H5FL_ARR_MALLOC(uint32_t, H5O_LAYOUT_NDIMS))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims") H5MM_memcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)); ctx->dim = my_dim; @@ -292,7 +292,7 @@ H5D__bt2_dst_context(void *_ctx) /* Free array for chunk dimension sizes */ if(ctx->dim) - (void)H5FL_BLK_FREE(chunk_dim, ctx->dim); + (void)H5FL_ARR_FREE(uint32_t, ctx->dim); /* Release callback context */ ctx = H5FL_FREE(H5D_bt2_ctx_t, ctx); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index a8dc398..6fdea92 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2018,7 +2018,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) if(H5S_SEL_ALL == chunk_sel_type) { /* Adjust the chunk coordinates */ for(u = 0; u < fm->f_ndims; u++) - coords[u] -= adjust[u]; + coords[u] = (hsize_t)((hssize_t)coords[u] - adjust[u]); /* Set to same shape as chunk */ if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, coords, NULL, fm->chunk_dim, NULL) < 0) @@ -6703,7 +6703,7 @@ done: */ herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, - H5F_block_t *new_chunk, hbool_t *need_insert, hsize_t scaled[]) + H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled) { hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dint.c b/src/H5Dint.c index cd120d0..2824dcd 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -50,7 +50,7 @@ /* General stuff */ static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); -static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); +static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id); @@ -114,8 +114,8 @@ static hbool_t H5D_top_package_initialize_s = FALSE; /* Prefixes of VDS and external file from the environment variables * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ -const static char *H5D_prefix_ext_env = NULL; -const static char *H5D_prefix_vds_env = NULL; +static const char *H5D_prefix_ext_env = NULL; +static const char *H5D_prefix_vds_env = NULL; /*------------------------------------------------------------------------- @@ -522,7 +522,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) +H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type) { htri_t relocatable; /* Flag whether the type is relocatable */ htri_t immutable; /* Flag whether the type is immutable */ @@ -570,7 +570,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Get a datatype ID for the dataset's datatype */ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") - } + } /* end if */ /* Not a custom datatype, just use it directly */ else { if(H5I_inc_ref(type_id, FALSE) < 0) @@ -579,7 +579,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Use existing datatype */ dset->shared->type_id = type_id; dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */ - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1090,7 +1090,7 @@ done: static herr_t H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix /*out*/) { - char *prefix = NULL; /* prefix used to look for the file */ + const char *prefix = NULL; /* prefix used to look for the file */ char *filepath = NULL; /* absolute path of directory the HDF5 file is in */ size_t filepath_len; /* length of file path */ size_t prefix_len; /* length of prefix */ @@ -1109,20 +1109,20 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** * to be reentrant. */ if(H5F_PREFIX_VDS == prefix_type) { - prefix = (char *)H5D_prefix_vds_env; + prefix = H5D_prefix_vds_env; - if(prefix == NULL || *prefix == '\0') { + if(prefix == NULL || *prefix == '\0') if(H5CX_get_vds_prefix(&prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file") - } - } else if(H5F_PREFIX_EFILE == prefix_type) { - prefix = (char *)H5D_prefix_ext_env; + } /* end if */ + else if(H5F_PREFIX_EFILE == prefix_type) { + prefix = H5D_prefix_ext_env; - if(prefix == NULL || *prefix == '\0') { + if(prefix == NULL || *prefix == '\0') if(H5CX_get_ext_file_prefix(&prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file") - } - } else + } /* end else-if */ + else HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "prefix name is not sensible") /* Prefix has to be checked for NULL / empty string again because the @@ -1175,7 +1175,7 @@ H5D_t * H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id) { - const H5T_t *type = NULL; /* Datatype for dataset (VOL pointer) */ + H5T_t *type = NULL; /* Datatype for dataset (VOL pointer) */ H5T_t *dt = NULL; /* Datatype for dataset (non-VOL pointer) */ H5D_t *new_dset = NULL; H5P_genplist_t *dc_plist = NULL; /* New Property list */ @@ -1197,10 +1197,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); /* Get the dataset's datatype */ - if(NULL == (dt = (const H5T_t *)H5I_object(type_id))) + if(NULL == (dt = (H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") /* If this is a named datatype, get the pointer via the VOL plugin */ - type = (const H5T_t *)H5T_get_actual_type(dt); + type = H5T_get_actual_type(dt); /* Check if the datatype is "sensible" for use in a dataset */ if(H5T_is_sensible(type) != TRUE) @@ -2196,7 +2196,7 @@ H5D_nameof(const H5D_t *dataset) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(dataset ? (H5G_name_t *)&(dataset->path) : (H5G_name_t *)NULL) + FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : NULL) } /* end H5D_nameof() */ @@ -3263,7 +3263,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_flush_all(const H5F_t *f) +H5D_flush_all(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3273,7 +3273,7 @@ H5D_flush_all(const H5F_t *f) HDassert(f); /* Iterate over all the open datasets */ - if(H5I_iterate(H5I_DATASET, H5D__flush_all_cb, (void *)f, FALSE) < 0) /* Casting away const OK -QAK */ + if(H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0) /* Casting away const OK -QAK */ HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to flush cached dataset info") done: diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index db67101..638c8a5 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -646,7 +646,7 @@ H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes); H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, - H5F_block_t *new_chunk, hbool_t *need_insert, hsize_t scaled[]); + H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled); H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim); H5_DLL herr_t H5D__chunk_set_sizes(H5D_t *dset); diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index bc44d2a..511e380 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -166,7 +166,7 @@ H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id); H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset); -H5_DLL herr_t H5D_flush_all(const H5F_t *f); +H5_DLL herr_t H5D_flush_all(H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset); diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 18d642f..ec40298 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -63,6 +63,9 @@ /* Local Typedefs */ /******************/ +/* Alias for pointer to factory, for use when allocating sequences of them */ +typedef H5FL_fac_head_t *H5FL_fac_head_ptr_t; + /********************/ /* Package Typedefs */ @@ -83,9 +86,6 @@ /* Library Private Variables */ /*****************************/ -/* Alias for pointer to factory, for use when allocating sequences of them */ -typedef H5FL_fac_head_t *H5FL_fac_head_ptr_t; - /*******************/ /* Local Variables */ @@ -1055,7 +1055,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) #endif /* H5FL_TRACK */ /* Get the pointer to the native block info header in front of the native block to free */ - temp=(H5FL_blk_list_t *)((unsigned char *)block-sizeof(H5FL_blk_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - sizeof(H5FL_blk_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Save the block's size for later */ free_size=temp->size; @@ -1133,7 +1133,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ H5FL_blk_list_t *temp; /* Temp. ptr to the new block node allocated */ /* Get the pointer to the chunk info header in front of the chunk to free */ - temp=(H5FL_blk_list_t *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* check if we are actually changing the size of the buffer */ if(new_size!=temp->size) { @@ -1430,7 +1430,7 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) HDassert(head->init); /* Get the pointer to the info header in front of the block to free */ - temp=(H5FL_arr_list_t *)((unsigned char *)obj-sizeof(H5FL_arr_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - -sizeof(H5FL_arr_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Get the number of elements */ free_nelem=temp->nelem; @@ -1619,7 +1619,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, size_t new_elem) HDassert((int)new_elem <= head->maxelem); /* Get the pointer to the info header in front of the block to free */ - temp = (H5FL_arr_list_t *)((unsigned char *)obj - sizeof(H5FL_arr_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - sizeof(H5FL_arr_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Check if the size is really changing */ if(temp->nelem != new_elem) { diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 4aa44f9..d5a68d7 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -189,10 +189,10 @@ typedef struct H5FL_blk_head_t { /* Declare a static free list to manage objects of type 't' */ #define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t) -/* Allocate an block of type 't' */ +/* Allocate a block of type 't' */ #define H5FL_BLK_MALLOC(t,size) (uint8_t *)H5FL_blk_malloc(&(H5FL_BLK_NAME(t)),size H5FL_TRACK_INFO) -/* Allocate an block of type 't' and clear it to zeros */ +/* Allocate a block of type 't' and clear it to zeros */ #define H5FL_BLK_CALLOC(t,size) (uint8_t *)H5FL_blk_calloc(&(H5FL_BLK_NAME(t)),size H5FL_TRACK_INFO) /* Free a block of type 't' */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index f4ff645..631937b 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -54,6 +54,7 @@ /********************/ static herr_t H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr); static herr_t H5F__update_super_ext_driver_msg(H5F_t *f); +static herr_t H5F__fsinfo_set_version(const H5F_t *f, H5O_fsinfo_t *fsinfo); /*********************/ @@ -1393,7 +1394,7 @@ H5F__super_init(H5F_t *f) fsinfo.mapped = FALSE; /* Set the version for the fsinfo message */ - if(H5O__fsinfo_set_version(f, &fsinfo) < 0) + if(H5F__fsinfo_set_version(f, &fsinfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") f->shared->fs_version = fsinfo.version; @@ -1825,7 +1826,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__fsinfo_set_version + * Function: H5F__fsinfo_set_version * * Purpose: Set the version to encode the fsinfo message with. * @@ -1835,13 +1836,13 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) +static herr_t +H5F__fsinfo_set_version(const H5F_t *f, H5O_fsinfo_t *fsinfo) { unsigned version; /* Message version */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -1855,12 +1856,12 @@ H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) /* Version bounds check */ if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || - version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") /* Set the message version */ fsinfo->version = version; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__fsinfo_set_version() */ +} /* end H5F__fsinfo_set_version() */ @@ -2023,7 +2023,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) */ if((!udata->app_ref) || (item->app_count > 0)) { H5I_type_t type = udata->obj_type; - const void *obj_ptr = NULL; + void *obj_ptr; herr_t cb_ret_val; /* The stored object pointer might be an H5VL_object_t, in which @@ -43,7 +43,7 @@ #define H5MM_SIG_SIZE 4 #define H5MM_HEAD_GUARD_SIZE 8 #define H5MM_TAIL_GUARD_SIZE 8 -#define H5MM_BLOCK_FROM_BUF(mem) ((H5MM_block_t *)((unsigned char *)mem - (offsetof(H5MM_block_t, b) + H5MM_HEAD_GUARD_SIZE))) +#define H5MM_BLOCK_FROM_BUF(mem) ((H5MM_block_t *)((void *)((unsigned char *)mem - (offsetof(H5MM_block_t, b) + H5MM_HEAD_GUARD_SIZE)))) #endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ @@ -154,7 +154,7 @@ H5MM__is_our_block(void *mem) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE static void +static void H5MM__sanity_check_block(const H5MM_block_t *block) { HDassert(block->u.info.size > 0); @@ -180,7 +180,7 @@ H5MM__sanity_check_block(const H5MM_block_t *block) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE static void +static void H5MM__sanity_check(void *mem) { H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); @@ -201,7 +201,7 @@ H5MM__sanity_check(void *mem) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void H5MM_sanity_check_all(void) { H5MM_block_t *curr = NULL; @@ -226,7 +226,7 @@ H5MM_sanity_check_all(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void H5MM_final_sanity_check(void) { HDassert(0 == H5MM_curr_alloc_bytes_s); @@ -44,7 +44,7 @@ /* First block in page */ #define H5MP_PAGE_FIRST_BLOCK(p) \ - (H5MP_page_blk_t *)((unsigned char *)(p) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) + (H5MP_page_blk_t *)((void *)((unsigned char *)(p) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))) /******************/ @@ -294,7 +294,7 @@ found: H5MP_page_blk_t *new_free; /* New free block created */ /* Carve out new free block after block to allocate */ - new_free = (H5MP_page_blk_t *)(((unsigned char *)alloc_free) + needed); + new_free = (H5MP_page_blk_t *)((void *)(((unsigned char *)alloc_free) + needed)); /* Link into existing lists */ new_free->next = alloc_free->next; @@ -361,7 +361,7 @@ H5MP_free(H5MP_pool_t *mp, void *spc) HDassert(spc); /* Get block header for space to free */ - spc_blk = (H5MP_page_blk_t *)(((unsigned char *)spc) - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))); + spc_blk = (H5MP_page_blk_t *)((void *)(((unsigned char *)spc) - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)))); /* Mark block as free */ HDassert(spc_blk->is_free == FALSE); diff --git a/src/H5MPtest.c b/src/H5MPtest.c index b3f2e24..0cba847 100644 --- a/src/H5MPtest.c +++ b/src/H5MPtest.c @@ -134,7 +134,7 @@ H5MP_pool_is_free_size_correct(const H5MP_pool_t *mp) size_t page_free; /* Size of blocks on free list */ /* Iterate through the blocks in page, accumulating free space */ - blk = (H5MP_page_blk_t *)((unsigned char *)page + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))); + blk = (H5MP_page_blk_t *)((void *)((unsigned char *)page + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))); page_free = 0; while(blk != NULL) { if(blk->is_free) diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 39d8bac..8f301af 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1765,7 +1765,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s 0x", indent, "", fwidth, "Raw bytes of value:"); for(k = 0; k < dt->shared->parent->shared->size; k++) - HDfprintf(stream, "%02x", dt->shared->u.enumer.value[i*dt->shared->parent->shared->size + k]); + HDfprintf(stream, "%02x", (unsigned)*((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->parent->shared->size) + k)); HDfprintf(stream, "\n"); } /* end for */ } /* end else if */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 8109ac0..05c6ddf 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -89,7 +89,6 @@ H5R__init_package(void) /* Mark "top" of interface as initialized */ H5R_top_package_initialize_s = TRUE; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__init_package() */ @@ -4287,8 +4287,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) idx = u; } /* end else */ - tmp = HDmemcmp(dt1->shared->u.enumer.value+idx1[u]*base_size, - dt2->shared->u.enumer.value+idx2[idx]*base_size, + tmp = HDmemcmp((uint8_t *)dt1->shared->u.enumer.value + idx1[u] * base_size, + (uint8_t *)dt2->shared->u.enumer.value + idx2[idx] * base_size, base_size); if(tmp<0) HGOTO_DONE(-1); if(tmp>0) HGOTO_DONE(1); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 7d47483..48c3282 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -668,8 +668,8 @@ { \ size_t elmtno; /*element number */ \ H5T_CONV_DECL_PREC(PREC) /*declare precision variables, or not */ \ - uint8_t *src_buf; /*'raw' source buffer */ \ - uint8_t *dst_buf; /*'raw' destination buffer */ \ + void *src_buf; /*'raw' source buffer */ \ + void *dst_buf; /*'raw' destination buffer */ \ ST *src, *s; /*source buffer */ \ DT *dst, *d; /*destination buffer */ \ H5T_t *st, *dt; /*datatype descriptors */ \ @@ -745,22 +745,22 @@ /* If we're down to the last few elements, just wrap up */ \ /* with a "real" reverse copy */ \ if(safe<2) { \ - src = (ST *)(src_buf = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride); \ - dst = (DT *)(dst_buf = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride); \ + src = (ST *)(src_buf = (void *)((uint8_t *)buf + (nelmts - 1) * (size_t)s_stride)); \ + dst = (DT *)(dst_buf = (void *)((uint8_t *)buf + (nelmts - 1) * (size_t)d_stride)); \ s_stride = -s_stride; \ d_stride = -d_stride; \ \ safe=nelmts; \ } /* end if */ \ else { \ - src = (ST *)(src_buf = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride); \ - dst = (DT *)(dst_buf = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride); \ + src = (ST *)(src_buf = (void *)((uint8_t *)buf + (nelmts - safe) * (size_t)s_stride)); \ + dst = (DT *)(dst_buf = (void *)((uint8_t *)buf + (nelmts - safe) * (size_t)d_stride)); \ } /* end else */ \ } /* end if */ \ else { \ /* Single forward pass over all data */ \ - src = (ST *)(src_buf = (uint8_t*)buf); \ - dst = (DT *)(dst_buf = (uint8_t*)buf); \ + src = (ST *)(src_buf = buf); \ + dst = (DT *)(dst_buf = buf); \ safe=nelmts; \ } /* end else */ \ \ @@ -889,9 +889,9 @@ done: \ H5_GLUE(H5T_CONV_LOOP_,POST_DALIGN_GUTS)(DT) \ \ /* Advance pointers */ \ - src_buf += s_stride; \ + src_buf = (void *)((uint8_t *)src_buf + s_stride); \ src = (ST *)src_buf; \ - dst_buf += d_stride; \ + dst_buf = (void *)((uint8_t *)dst_buf + d_stride); \ dst = (DT *)dst_buf; \ } @@ -2658,11 +2658,11 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) if(1 == src->shared->size || sizeof(short) == src->shared->size || sizeof(int) == src->shared->size) { for(i = 0; i < src->shared->u.enumer.nmembs; i++) { if(1 == src->shared->size) - n = *((signed char *)(src->shared->u.enumer.value + i)); + n = *((signed char *)((uint8_t *)src->shared->u.enumer.value + i)); else if (sizeof(short) == src->shared->size) - n = *((short *)(src->shared->u.enumer.value + i * src->shared->size)); + n = *((short *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); else - n = *((int *)(src->shared->u.enumer.value + i * src->shared->size)); + n = *((int *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); if(0 == i) { domain[0] = domain[1] = n; } else { @@ -2683,11 +2683,11 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) map[i] = -1; /*entry unused*/ for(i = 0; i < src->shared->u.enumer.nmembs; i++) { if(1 == src->shared->size) - n = *((signed char *)(src->shared->u.enumer.value + i)); + n = *((signed char *)((uint8_t *)src->shared->u.enumer.value + i)); else if(sizeof(short) == src->shared->size) - n = *((short *)(src->shared->u.enumer.value + i * src->shared->size)); + n = *((short *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); else - n = *((int *)(src->shared->u.enumer.value + i * src->shared->size)); + n = *((int *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); n -= priv->base; HDassert(n >= 0 && (unsigned)n < priv->length); HDassert(map[n] < 0); @@ -2835,9 +2835,9 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(1 == src->shared->size) n = *((signed char*)s); else if(sizeof(short) == src->shared->size) - n = *((short*)s); + n = *((short *)((void *)s)); else - n = *((int*)s); + n = *((int *)((void *)s)); n -= priv->base; if(n < 0 || (unsigned)n >= priv->length || priv->src2dst[n] < 0) { /*overflow*/ @@ -2853,7 +2853,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") } else H5MM_memcpy(d, - dst->shared->u.enumer.value + (unsigned)priv->src2dst[n] * dst->shared->size, + (uint8_t *)dst->shared->u.enumer.value + ((unsigned)priv->src2dst[n] * dst->shared->size), dst->shared->size); } /* end if */ else { @@ -2865,7 +2865,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, while(lt < rt) { md = (lt + rt) / 2; - cmp = HDmemcmp(s, src->shared->u.enumer.value + md * src->shared->size, + cmp = HDmemcmp(s, (uint8_t *)src->shared->u.enumer.value + (md * src->shared->size), src->shared->size); if(cmp < 0) rt = md; @@ -2889,7 +2889,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, else { HDassert(priv->src2dst[md] >= 0); H5MM_memcpy(d, - dst->shared->u.enumer.value + (unsigned)priv->src2dst[md] * dst->shared->size, + (uint8_t *)dst->shared->u.enumer.value + ((unsigned)priv->src2dst[md] * dst->shared->size), dst->shared->size); } /* end else */ } /* end else */ diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index eb648f3..605310a 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -416,7 +416,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); for (k = 0; k < base_size; k++) - HDfprintf(stream, "%02lx", (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k)); + HDfprintf(stream, "%02lx", (unsigned long)((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k)); } /* end for */ HDfprintf(stream, "\n"); } diff --git a/src/H5Tenum.c b/src/H5Tenum.c index ff88fab..6daa497 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -187,9 +187,7 @@ herr_t H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) { unsigned i; - char **names=NULL; - uint8_t *values=NULL; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -198,15 +196,17 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) HDassert(value); /* The name and value had better not already exist */ - for (i=0; i<dt->shared->u.enumer.nmembs; i++) { - if (!HDstrcmp(dt->shared->u.enumer.name[i], name)) + for(i = 0; i < dt->shared->u.enumer.nmembs; i++) { + if(!HDstrcmp(dt->shared->u.enumer.name[i], name)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "name redefinition") - if (!HDmemcmp(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size)) + if(!HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, dt->shared->size)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "value redefinition") - } + } /* end for */ /* Increase table sizes */ if(dt->shared->u.enumer.nmembs >= dt->shared->u.enumer.nalloc) { + char **names; + uint8_t *values; unsigned n = MAX(32, 2*dt->shared->u.enumer.nalloc); if(NULL == (names = (char **)H5MM_realloc(dt->shared->u.enumer.name, n * sizeof(char *)))) @@ -217,13 +217,13 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") dt->shared->u.enumer.value = values; dt->shared->u.enumer.nalloc = n; - } + } /* end for */ /* Insert new member at end of member arrays */ dt->shared->u.enumer.sorted = H5T_SORT_NONE; i = dt->shared->u.enumer.nmembs++; dt->shared->u.enumer.name[i] = H5MM_xstrdup(name); - H5MM_memcpy(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, dt->shared->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -298,7 +298,7 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value/*out*/) HDassert(dt); HDassert(value); - H5MM_memcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size); + H5MM_memcpy(value, (uint8_t *)dt->shared->u.enumer.value + (membno * dt->shared->size), dt->shared->size); FUNC_LEAVE_NOAPI(SUCCEED) } @@ -416,7 +416,7 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t si rt = copied_dt->shared->u.enumer.nmembs; while(lt < rt) { md = (lt + rt) / 2; - cmp = HDmemcmp(value, copied_dt->shared->u.enumer.value + md * copied_dt->shared->size, copied_dt->shared->size); + cmp = HDmemcmp(value, (uint8_t *)copied_dt->shared->u.enumer.value + (md * copied_dt->shared->size), copied_dt->shared->size); if(cmp < 0) rt = md; else if(cmp > 0) @@ -569,7 +569,7 @@ H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/) if (cmp!=0) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "string doesn't exist in the enumeration type") - H5MM_memcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size); + H5MM_memcpy(value, (uint8_t *)copied_dt->shared->u.enumer.value + (md * copied_dt->shared->size), copied_dt->shared->size); done: if(copied_dt) diff --git a/src/H5Tfields.c b/src/H5Tfields.c index 8202c2c..be0b5f2 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -344,17 +344,17 @@ H5T__sort_value(const H5T_t *dt, int *map) HDassert(size <= sizeof(tbuf)); for(i = (nmembs - 1), swapped = TRUE; i > 0 && swapped; --i) { for(j = 0, swapped = FALSE; j < i; j++) { - if(HDmemcmp(dt->shared->u.enumer.value + (j * size), dt->shared->u.enumer.value + ((j + 1) * size), size) > 0) { + if(HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (j * size), (uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), size) > 0) { /* Swap names */ char *tmp = dt->shared->u.enumer.name[j]; dt->shared->u.enumer.name[j] = dt->shared->u.enumer.name[j + 1]; dt->shared->u.enumer.name[j + 1] = tmp; /* Swap values */ - H5MM_memcpy(tbuf, dt->shared->u.enumer.value + (j * size), size); - H5MM_memcpy(dt->shared->u.enumer.value + (j * size), - dt->shared->u.enumer.value + ((j + 1) * size), size); - H5MM_memcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); + H5MM_memcpy(tbuf, (uint8_t *)dt->shared->u.enumer.value + (j * size), size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + (j * size), + (uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); /* Swap map */ if(map) { @@ -371,7 +371,7 @@ H5T__sort_value(const H5T_t *dt, int *map) #ifndef NDEBUG /* I never trust a sort :-) -RPM */ for(i = 0; i < (nmembs - 1); i++) - HDassert(HDmemcmp(dt->shared->u.enumer.value + (i * size), dt->shared->u.enumer.value + ((i + 1) * size), size) < 0); + HDassert(HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (i * size), (uint8_t *)dt->shared->u.enumer.value + ((i + 1) * size), size) < 0); #endif } /* end if */ } /* end else */ @@ -457,10 +457,10 @@ H5T__sort_name(const H5T_t *dt, int *map) dt->shared->u.enumer.name[j+1] = tmp; /* Swap values */ - H5MM_memcpy(tbuf, dt->shared->u.enumer.value+j*size, size); - H5MM_memcpy(dt->shared->u.enumer.value+j*size, - dt->shared->u.enumer.value+(j+1)*size, size); - H5MM_memcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size); + H5MM_memcpy(tbuf, (uint8_t *)dt->shared->u.enumer.value + (j * size), size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + (j * size), + (uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), size); + H5MM_memcpy((uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); /* Swap map */ if (map) { diff --git a/src/H5Tnative.c b/src/H5Tnative.c index d213c45..6daa544 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -516,6 +516,11 @@ done: } /* end H5T__get_native_type() */ /* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wduplicated-branches" @@ -661,6 +666,11 @@ done: #pragma GCC diagnostic pop /* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wduplicated-branches" @@ -790,6 +800,11 @@ done: #pragma GCC diagnostic pop /* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wduplicated-branches" diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index c909f18..7798e37 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -239,7 +239,7 @@ typedef struct H5T_enum_t { unsigned nalloc; /*num entries allocated */ unsigned nmembs; /*number of members defined in enum */ H5T_sort_t sorted; /*how are members sorted? */ - uint8_t *value; /*array of values */ + void *value; /*array of values */ char **name; /*array of symbol names */ } H5T_enum_t; diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index d3e8fc0..7bdc283 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -482,23 +482,23 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) { \ if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ - *(int *)&buf[i] = (int)(((unsigned int)1 << *minbits) - 1); \ + *(int *)((void *)&buf[i]) = (int)(((unsigned int)1 << *minbits) - 1); \ else \ - *(int *)&buf[i] = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) { \ if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ - *(long *)&buf[i] = (long)(((unsigned long)1 << *minbits) - 1); \ + *(long *)((void *)&buf[i]) = (long)(((unsigned long)1 << *minbits) - 1); \ else \ - *(long *)&buf[i] = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) { \ if(abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \ - *(long long *)&buf[i] = (long long)(((unsigned long long)1 << *minbits) - 1); \ + *(long long *)((void *)&buf[i]) = (long long)(((unsigned long long)1 << *minbits) - 1); \ else \ - *(long long *)&buf[i] = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ } \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ @@ -509,13 +509,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - *(int *)&buf[i] = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - *(long *)&buf[i] = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - *(long long *)&buf[i] = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ + *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -619,16 +619,16 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type) == sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((*(int *)&buf[i] == (int)(((unsigned int)1 << minbits) - 1)) ? \ - filval : (type)(*(int *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = (type)((*(int *)((void *)&buf[i]) == (int)(((unsigned int)1 << minbits) - 1)) ? \ + filval : (type)(*(int *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type) == sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((*(long *)&buf[i] == (long)(((unsigned long)1 << minbits) - 1)) ? \ - filval : (type)(*(long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = (type)((*(long *)((void *)&buf[i]) == (long)(((unsigned long)1 << minbits) - 1)) ? \ + filval : (type)(*(long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type) == sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((*(long long *)&buf[i] == (long long)(((unsigned long long)1 << minbits) - 1)) ? \ - filval : (type)(*(long long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = (type)((*(long long *)((void *)&buf[i]) == (long long)(((unsigned long long)1 << minbits) - 1)) ? \ + filval : (type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -638,13 +638,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = ((type)(*(int *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = ((type)(*(long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = ((type)(*(long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = ((type)(*(long long *)&buf[i]) / pow_fun(10.0f, (type)D_val) + min); \ + buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } diff --git a/src/H5detect.c b/src/H5detect.c index 4424009..32b7d34 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -46,6 +46,11 @@ static const char *FileHeader = "\n\ #include "H5Tpublic.h" #include "H5Rpublic.h" +/* Disable warning about cast increasing the alignment of the target type, + * that's _exactly_ what this code is probing. -QAK + */ +#pragma GCC diagnostic ignored "-Wcast-align" + #if defined(__has_attribute) # if __has_attribute(no_sanitize_address) # define HDF_NO_UBSAN __attribute__((no_sanitize_address)) diff --git a/src/H5system.c b/src/H5system.c index 35123db..5d2663e 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -95,12 +95,16 @@ static hbool_t H5_ntzset = FALSE; * Programmer: Robb Matzke * Thursday, April 9, 1998 * - * Modifications: - * Robb Matzke, 1999-07-27 - * The `%a' format refers to an argument of `haddr_t' type - * instead of `haddr_t*' and the return value is correct. *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the fprintf() calls with + * format_templ in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" int HDfprintf(FILE *stream, const char *fmt, ...) { @@ -426,6 +430,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) HDva_end(ap); return nout; } /* end HDfprintf() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 1944ce1..22950e9 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -910,7 +910,7 @@ initialize_stype1(unsigned char *buf, size_t num) stype1 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype1 *)buf + i; + s_ptr = (stype1 *)((void *)buf) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) @@ -953,7 +953,7 @@ initialize_stype2(unsigned char *buf, size_t num) stype2 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype2 *)buf + i; + s_ptr = (stype2 *)((void *)buf) + i; s_ptr->a = (int)(i * 8 + 0); s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) @@ -1000,7 +1000,7 @@ initialize_stype3(unsigned char *buf, size_t num) stype3 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype3 *)buf + i; + s_ptr = (stype3 *)((void *)buf) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) @@ -1031,7 +1031,7 @@ initialize_stype4(unsigned char *buf, size_t num) stype4 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype4 *)buf + i; + s_ptr = (stype4 *)((void *)buf) + i; s_ptr->a = (int)(i * 8 + 0); s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) @@ -2219,7 +2219,7 @@ main (int argc, char *argv[]) fprintf(stderr, "usage: %s [--noopt]\n", argv[0]); exit(EXIT_FAILURE); } - H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, H5T__conv_struct_opt); + H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, (H5T_conv_t)((void (*) (void))H5T__conv_struct_opt)); } /* Create the file */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 2729ba1..645608b 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -627,7 +627,7 @@ test_hard_query(void) /* Unregister the hard conversion from int to float. Verify the conversion * is a soft conversion. */ - H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float); + H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) { H5_FAILED(); printf("Can't query conversion function\n"); @@ -636,7 +636,7 @@ test_hard_query(void) /* Register the hard conversion from int to float. Verify the conversion * is a hard conversion. */ - H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float); + H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) { H5_FAILED(); printf("Can't query conversion function\n"); @@ -2578,34 +2578,34 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); switch (dst_type) { case INT_SCHAR: - printf(" %29d\n", (int)*((signed char*)hw)); + printf(" %29d\n", (int)*((signed char*)((void *)hw))); break; case INT_UCHAR: - printf(" %29u\n", (unsigned)*((unsigned char*)hw)); + printf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw))); break; case INT_SHORT: - printf(" %29hd\n", *((short*)hw)); + printf(" %29hd\n", *((short*)((void *)hw))); break; case INT_USHORT: - printf(" %29hu\n", *((unsigned short*)hw)); + printf(" %29hu\n", *((unsigned short*)((void *)hw))); break; case INT_INT: - printf(" %29d\n", *((int*)hw)); + printf(" %29d\n", *((int*)((void *)hw))); break; case INT_UINT: - printf(" %29u\n", *((unsigned*)hw)); + printf(" %29u\n", *((unsigned*)((void *)hw))); break; case INT_LONG: - printf(" %29ld\n", *((long*)hw)); + printf(" %29ld\n", *((long*)((void *)hw))); break; case INT_ULONG: - printf(" %29lu\n", *((unsigned long*)hw)); + printf(" %29lu\n", *((unsigned long*)((void *)hw))); break; case INT_LLONG: - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw))); break; case INT_ULLONG: - HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw))); break; case FLT_FLOAT: case FLT_DOUBLE: @@ -4485,44 +4485,44 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); switch (dst_type) { case INT_SCHAR: - printf(" %29d\n", (int)*((signed char*)hw)); + printf(" %29d\n", (int)*((signed char*)((void *)hw))); break; case INT_UCHAR: - printf(" %29u\n", (unsigned)*((unsigned char*)hw)); + printf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw))); break; case INT_SHORT: - printf(" %29hd\n", *((short*)hw)); + printf(" %29hd\n", *((short*)((void *)hw))); break; case INT_USHORT: - printf(" %29hu\n", *((unsigned short*)hw)); + printf(" %29hu\n", *((unsigned short*)((void *)hw))); break; case INT_INT: - printf(" %29d\n", *((int*)hw)); + printf(" %29d\n", *((int*)((void *)hw))); break; case INT_UINT: - printf(" %29u\n", *((unsigned int*)hw)); + printf(" %29u\n", *((unsigned int*)((void *)hw))); break; case INT_LONG: - printf(" %29ld\n", *((long*)hw)); + printf(" %29ld\n", *((long*)((void *)hw))); break; case INT_ULONG: - printf(" %29lu\n", *((unsigned long*)hw)); + printf(" %29lu\n", *((unsigned long*)((void *)hw))); break; case INT_LLONG: - HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw)); + HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw))); break; case INT_ULLONG: - HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw)); + HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw))); break; case FLT_FLOAT: - printf(" %29f\n", (double)*((float*)hw)); + printf(" %29f\n", (double)*((float*)((void *)hw))); break; case FLT_DOUBLE: - printf(" %29f\n", *((double*)hw)); + printf(" %29f\n", *((double*)((void *)hw))); break; #if H5_SIZEOF_LONG_DOUBLE !=0 case FLT_LDOUBLE: - printf(" %29Lf\n", *((long double*)hw)); + printf(" %29Lf\n", *((long double*)((void *)hw))); break; #endif case OTHER: diff --git a/test/dtypes.c b/test/dtypes.c index 2056245..39fad9f 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -716,7 +716,7 @@ test_compound_2(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = i*8+1; s_ptr->c[0] = i*8+2; @@ -754,8 +754,8 @@ test_compound_2(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || @@ -847,7 +847,7 @@ test_compound_3(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = i*8+1; s_ptr->c[0] = i*8+2; @@ -884,8 +884,8 @@ test_compound_3(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] || @@ -978,7 +978,7 @@ test_compound_4(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = (i*8+1) & 0x7fff; s_ptr->c[0] = i*8+2; @@ -1017,8 +1017,8 @@ test_compound_4(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || @@ -1215,7 +1215,7 @@ test_compound_6(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->b = (i*8+1) & 0x7fff; s_ptr->d = (i*8+6) & 0x7fff; } @@ -1244,8 +1244,8 @@ test_compound_6(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) { H5_FAILED(); @@ -1694,14 +1694,20 @@ test_compound_8(void) static int test_compound_9(void) { - typedef struct cmpd_struct { + typedef struct cmpd_struct_w { int i1; const char* str; int i2; - } cmpd_struct; + } cmpd_struct_w; - cmpd_struct wdata = {11, "variable-length string", 22}; - cmpd_struct rdata; + typedef struct cmpd_struct_r { + int i1; + char* str; + int i2; + } cmpd_struct_r; + + cmpd_struct_w wdata = {11, "variable-length string", 22}; + cmpd_struct_r rdata; hid_t file; hid_t cmpd_tid, str_id, dup_tid; hid_t space_id; @@ -1720,13 +1726,13 @@ test_compound_9(void) } /* end if */ /* Create first compound datatype */ - if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { + if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_w))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) { + if(H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct_w, i1), H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i1'\n"); goto error; @@ -1739,13 +1745,13 @@ test_compound_9(void) goto error; } /* end if */ - if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, str), str_id) < 0) { + if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct_w, str), str_id) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i1'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) { + if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct_w, i2), H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'i2'\n"); goto error; @@ -2541,27 +2547,42 @@ error: static int test_compound_14(void) { - typedef struct cmpd_struct_1 { + typedef struct cmpd_struct_1_w { char c1; char c2; const char* str; - } cmpd_struct_1; + } cmpd_struct_1_w; - typedef struct cmpd_struct_2 { + typedef struct cmpd_struct_1_r { char c1; char c2; char* str; + } cmpd_struct_1_r; + + typedef struct cmpd_struct_2_w { + char c1; + char c2; + const char* str; long l1; long l2; long l3; long l4; - } cmpd_struct_2; + } cmpd_struct_2_w; - cmpd_struct_1 wdata1 = {'A', 'B', "variable-length string"}; + typedef struct cmpd_struct_2_r { + char c1; + char c2; + char* str; + long l1; + long l2; + long l3; + long l4; + } cmpd_struct_2_r; - cmpd_struct_1 rdata1; - cmpd_struct_2 wdata2 = {'C', 'D', "another vlen!", 1, 2, -1, 9001}; - cmpd_struct_2 rdata2; + cmpd_struct_1_w wdata1 = {'A', 'B', "variable-length string"}; + cmpd_struct_1_r rdata1; + cmpd_struct_2_w wdata2 = {'C', 'D', "another vlen!", 1, 2, -1, 9001}; + cmpd_struct_2_r rdata2; hid_t file; hid_t cmpd_m1_tid, cmpd_f1_tid, cmpd_m2_tid, cmpd_f2_tid, str_id; hid_t space_id; @@ -2580,19 +2601,19 @@ test_compound_14(void) } /* end if */ /* Create memory compound datatype 1 */ - if((cmpd_m1_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_1))) < 0) { + if((cmpd_m1_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_1_w))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m1_tid,"c1",HOFFSET(struct cmpd_struct_1,c1),H5T_NATIVE_CHAR) < 0) { + if(H5Tinsert(cmpd_m1_tid,"c1",HOFFSET(struct cmpd_struct_1_w, c1), H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c1'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m1_tid,"c2",HOFFSET(struct cmpd_struct_1,c2),H5T_NATIVE_CHAR) < 0) { + if(H5Tinsert(cmpd_m1_tid,"c2",HOFFSET(struct cmpd_struct_1_w, c2), H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c2'\n"); goto error; @@ -2605,7 +2626,7 @@ test_compound_14(void) goto error; } /* end if */ - if(H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1, str), str_id) < 0) { + if(H5Tinsert(cmpd_m1_tid, "vl_string", HOFFSET(cmpd_struct_1_w, str), str_id) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'vl_string'\n"); goto error; @@ -2637,49 +2658,49 @@ test_compound_14(void) } /* end if */ /* Create memory compound datatype 2 */ - if((cmpd_m2_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_2))) < 0) { + if((cmpd_m2_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_2_w))) < 0) { H5_FAILED(); AT(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"c1",HOFFSET(struct cmpd_struct_2,c1),H5T_NATIVE_CHAR) < 0) { + if(H5Tinsert(cmpd_m2_tid,"c1",HOFFSET(struct cmpd_struct_2_w, c1), H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c1'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"c2",HOFFSET(struct cmpd_struct_2,c2),H5T_NATIVE_CHAR) < 0) { + if(H5Tinsert(cmpd_m2_tid,"c2",HOFFSET(struct cmpd_struct_2_w, c2), H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'c2'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2, str), str_id) < 0) { + if(H5Tinsert(cmpd_m2_tid, "vl_string", HOFFSET(cmpd_struct_2_w, str), str_id) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'vl_string'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"l1",HOFFSET(struct cmpd_struct_2,l1),H5T_NATIVE_LONG) < 0) { + if(H5Tinsert(cmpd_m2_tid,"l1",HOFFSET(struct cmpd_struct_2_w, l1), H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'l1'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"l2",HOFFSET(struct cmpd_struct_2,l2),H5T_NATIVE_LONG) < 0) { + if(H5Tinsert(cmpd_m2_tid,"l2",HOFFSET(struct cmpd_struct_2_w, l2), H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'l2'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"l3",HOFFSET(struct cmpd_struct_2,l3),H5T_NATIVE_LONG) < 0) { + if(H5Tinsert(cmpd_m2_tid,"l3",HOFFSET(struct cmpd_struct_2_w, l3), H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'l3'\n"); goto error; } /* end if */ - if(H5Tinsert(cmpd_m2_tid,"l4",HOFFSET(struct cmpd_struct_2,l4),H5T_NATIVE_LONG) < 0) { + if(H5Tinsert(cmpd_m2_tid,"l4",HOFFSET(struct cmpd_struct_2_w, l4), H5T_NATIVE_LONG) < 0) { H5_FAILED(); AT(); printf("Can't insert field 'l4'\n"); goto error; diff --git a/test/links.c b/test/links.c index 3166954..2658101 100644 --- a/test/links.c +++ b/test/links.c @@ -3569,27 +3569,27 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsnprintf(sv[H5FD_MEM_SUPER], sizeof(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'); + HDsnprintf(sv[H5FD_MEM_BTREE], sizeof(sv[H5FD_MEM_BTREE]), "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsnprintf(sv[H5FD_MEM_DRAW], sizeof(sv[H5FD_MEM_DRAW]), "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsnprintf(sv[H5FD_MEM_GHEAP], sizeof(sv[H5FD_MEM_GHEAP]), "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); + HDsnprintf(sv[H5FD_MEM_LHEAP], sizeof(sv[H5FD_MEM_LHEAP]), "%%s-%c.h5", 'l'); memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2; - sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); + HDsnprintf(sv[H5FD_MEM_OHDR], sizeof(sv[H5FD_MEM_OHDR]), "%%s-%c.h5", 'o'); memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5; @@ -4628,7 +4628,7 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* set up name for target link: "<drive-letter>:tmp/extlinks12" */ drive = HDgetdrive(); - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[32]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks12" */ @@ -4713,11 +4713,11 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* set up name for main file: "<drive-letter>:tmp/extlinks0" */ drive = HDgetdrive(); - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[13]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* set up name for target link: "<drive-letter>:extlinks13" */ - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[33]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks13" */ @@ -4813,7 +4813,7 @@ external_link_win5(hid_t fapl, hbool_t new_format) h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* set up name for target link: "<drive-letter+1>:tmp/extlinks14" */ - sprintf(tmpname, "%c:%s", ((drive+1)+'A'-1), FILENAME[35]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[35]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks14" */ @@ -4906,7 +4906,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for target link: "<drive-letter+1>:tmp/extlinks15" */ - sprintf(tmpname, "%c:%s", ((drive+1)+'A'-1), FILENAME[36]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[36]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks15" */ @@ -5085,7 +5085,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* set up name for target link: "<drive-letter>:\CWD\extlinks10" */ drive = HDgetdrive(); - sprintf(tmpname, "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]); + HDsnprintf(tmpname, sizeof(tmpname), "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "extlinks10" */ @@ -5569,7 +5569,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Create enough objects in the root group to change it into a "dense" group */ for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid2) < 0) TEST_ERROR } /* end for */ @@ -5612,7 +5612,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Remove enough objects in the root group to change it into a "compact" group */ for(u = 0; u < ((max_compact - min_dense) + 1); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -5897,7 +5897,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) /* Create enough objects in the root group to change it into a "dense" group */ for(u = 0; u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid2) < 0) TEST_ERROR } /* end for */ @@ -5966,7 +5966,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) /* Remove enough objects in the root group to change it into a "compact" group */ for(u = 0; u < ((max_compact - min_dense) + 3); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -10654,7 +10654,7 @@ corder_create_compact(hid_t fapl) /* Create several links, but keep group in compact form */ for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10693,7 +10693,7 @@ corder_create_compact(hid_t fapl) H5L_info_t linfo; /* Link information */ /* Retrieve information for link */ - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ @@ -10774,7 +10774,7 @@ corder_create_dense(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10786,7 +10786,7 @@ corder_create_dense(hid_t fapl) } /* end for */ /* Create another link, to push group into dense form */ - sprintf(objname, "filler %u", max_compact); + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10826,7 +10826,7 @@ corder_create_dense(hid_t fapl) H5L_info_t linfo; /* Link information */ /* Retrieve information for link */ - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ @@ -10928,13 +10928,13 @@ corder_transition(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR } /* end for */ /* Create another link, to push group into dense form */ - sprintf(objname, "filler %u", max_compact); + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10949,7 +10949,7 @@ corder_transition(hid_t fapl) /* Delete several links from group, until it resumes compact form */ for(u = max_compact; u >= min_dense; u--) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ @@ -10963,7 +10963,7 @@ corder_transition(hid_t fapl) } /* end for */ /* Delete another link, to push group into compact form */ - sprintf(objname, "filler %u", (min_dense - 1)); + HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1)); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ @@ -10974,7 +10974,7 @@ corder_transition(hid_t fapl) /* Re-add links to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR } /* end for */ @@ -11012,7 +11012,7 @@ corder_transition(hid_t fapl) /* Delete several links from group, until it resumes compact form */ for(u = max_compact; u >= min_dense; u--) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ @@ -11026,7 +11026,7 @@ corder_transition(hid_t fapl) } /* end for */ /* Delete another link, to push group into compact form */ - sprintf(objname, "filler %u", (min_dense - 1)); + HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1)); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Verify state of group */ @@ -11037,7 +11037,7 @@ corder_transition(hid_t fapl) /* Re-add links to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(group_id2) < 0) TEST_ERROR } /* end for */ @@ -11053,10 +11053,10 @@ corder_transition(hid_t fapl) /* Delete all the links */ for(u = max_compact; u > 0; u--) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ - sprintf(objname, "filler %u", (unsigned)0); + HDsnprintf(objname, sizeof(objname), "filler %u", (unsigned)0); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR /* Close the group */ @@ -11156,7 +11156,7 @@ corder_delete(hid_t fapl) /* Create links until the group is in dense form */ for(u = 0; u < max_compact * 2; u++) { - sprintf(objname, "filler %u", u); + HDsnprintf(objname, sizeof(objname), "filler %u", u); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(group_id2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -11238,7 +11238,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, H5L_info_t linfo; /* Link info struct */ /* Make link value for increasing/native order queries */ - sprintf(valname, "value %02u", (unsigned)n); + HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); /* Verify the link information for first link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); @@ -11449,7 +11449,7 @@ link_info_by_idx(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Check for creating hard or soft link */ if(hard_link) { @@ -11461,7 +11461,7 @@ link_info_by_idx(hid_t fapl) } /* end if */ else { /* Make value for link */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Create soft link */ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -11491,7 +11491,7 @@ link_info_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Check for creating hard or soft link */ if(hard_link) { @@ -11503,7 +11503,7 @@ link_info_by_idx(hid_t fapl) } /* end if */ else { /* Make value for link */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Create soft link */ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -11603,7 +11603,7 @@ link_info_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Check for creating hard or soft link */ if(hard_link) { @@ -11621,7 +11621,7 @@ link_info_by_idx_old(hid_t fapl) } /* end if */ else { /* Make value for link */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Create soft link */ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -11633,10 +11633,10 @@ link_info_by_idx_old(hid_t fapl) unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */ /* Make link name for increasing/native order queries */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Make link value for increasing/native order queries */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Verify link information (in increasing order) */ if(hard_link) { @@ -11669,10 +11669,10 @@ link_info_by_idx_old(hid_t fapl) /* Make link name for decreasing order queries */ - sprintf(objname, "filler %02u", dec_u); + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); /* Make link value for decreasing order queries */ - sprintf(valname, "value %02u", dec_u); + HDsnprintf(valname, sizeof(valname), "value %02u", dec_u); /* Verify link information (in decreasing order) */ if(hard_link) { @@ -11827,7 +11827,7 @@ delete_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11865,9 +11865,9 @@ delete_by_idx(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else - sprintf(objname, "filler %02u", (max_compact - (u + 2))); + HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -11882,7 +11882,7 @@ delete_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11921,9 +11921,9 @@ delete_by_idx(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else - sprintf(objname, "filler %02u", ((max_compact * 2) - (u + 2))); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -11949,7 +11949,7 @@ delete_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11982,9 +11982,9 @@ delete_by_idx(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); else - sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12007,9 +12007,9 @@ delete_by_idx(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 3)); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); else - sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12106,7 +12106,7 @@ delete_by_idx_old(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -12152,9 +12152,9 @@ delete_by_idx_old(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); else - sprintf(objname, "filler %02u", dec_u); + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12179,7 +12179,7 @@ delete_by_idx_old(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -12213,9 +12213,9 @@ delete_by_idx_old(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 1)); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); else - sprintf(objname, "filler %02u", dec_u); + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12240,9 +12240,9 @@ delete_by_idx_old(hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 3)); + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); else - sprintf(objname, "filler %02u", dec_u); + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ @@ -12323,7 +12323,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, } /* end if */ /* Verify name of link */ - sprintf(objname, "filler %02u", (unsigned)my_info.corder); + HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); if(HDstrcmp(link_name, objname)) return(H5_ITER_ERROR); @@ -12669,7 +12669,7 @@ link_iterate(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -12695,7 +12695,7 @@ link_iterate(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -12795,7 +12795,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf } /* end if */ /* Verify name of link */ - sprintf(objname, "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); + HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); if(HDstrcmp(link_name, objname)) return(H5_ITER_ERROR); @@ -13082,7 +13082,7 @@ link_iterate_old(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13211,7 +13211,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Mount a file over a group in main group */ mnt_idx = 2; - sprintf(mntname, "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); + HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR /* Open the object that the file is mounted on */ @@ -13269,7 +13269,7 @@ open_by_idx(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t *objno = NULL; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13363,7 +13363,7 @@ open_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13376,7 +13376,7 @@ open_by_idx(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13398,7 +13398,7 @@ open_by_idx(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13411,7 +13411,7 @@ open_by_idx(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13494,7 +13494,7 @@ open_by_idx_old(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13540,7 +13540,7 @@ open_by_idx_old(hid_t fapl) hid_t group_id2; /* Group ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13553,7 +13553,7 @@ open_by_idx_old(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13637,7 +13637,7 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, /* Open each object in group by name and check that it's the correct one */ for(u = 0; u < max_links; u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Query the object's information, by name */ if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR @@ -13705,7 +13705,7 @@ object_info(hid_t fapl) H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t *objno = NULL; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13799,7 +13799,7 @@ object_info(hid_t fapl) hid_t attr_id; /* Attribute ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13811,7 +13811,7 @@ object_info(hid_t fapl) /* Create attributes on new object */ for(v = 0; v < u; v++) { /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); /* Create attribute */ if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13824,7 +13824,7 @@ object_info(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13847,7 +13847,7 @@ object_info(hid_t fapl) hid_t attr_id; /* Attribute ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13859,7 +13859,7 @@ object_info(hid_t fapl) /* Create attributes on new object */ for(v = 0; v < u; v++) { /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); /* Create attribute */ if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13872,7 +13872,7 @@ object_info(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -13950,7 +13950,7 @@ object_info_old(hid_t fapl) H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13996,7 +13996,7 @@ object_info_old(hid_t fapl) hid_t attr_id; /* Attribute ID */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14008,7 +14008,7 @@ object_info_old(hid_t fapl) /* Create attributes on new object */ for(v = 0; v < u; v++) { /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); /* Create attribute */ if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14021,7 +14021,7 @@ object_info_old(hid_t fapl) if(H5Gclose(group_id2) < 0) TEST_ERROR /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR } /* end for */ @@ -14102,7 +14102,7 @@ group_info(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14187,7 +14187,7 @@ group_info(hid_t fapl) hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14221,7 +14221,7 @@ group_info(hid_t fapl) /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ - sprintf(objname2, "filler %02u", v); + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); /* Create hard link, with group object */ if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14301,7 +14301,7 @@ group_info(hid_t fapl) /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Retrieve soft link group's information, by name */ @@ -14328,7 +14328,7 @@ group_info(hid_t fapl) hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14362,7 +14362,7 @@ group_info(hid_t fapl) /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ - sprintf(objname2, "filler %02u", v); + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); /* Create hard link, with group object */ if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14442,7 +14442,7 @@ group_info(hid_t fapl) /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Retrieve soft link group's information, by name */ @@ -14519,7 +14519,7 @@ group_info_old(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14558,7 +14558,7 @@ group_info_old(hid_t fapl) hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14592,7 +14592,7 @@ group_info_old(hid_t fapl) /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ - sprintf(objname2, "filler %02u", v); + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); /* Create hard link, with group object */ if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -14672,7 +14672,7 @@ group_info_old(hid_t fapl) /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Retrieve soft link group's information, by name */ diff --git a/test/objcopy.c b/test/objcopy.c index e646c87..1f89e16 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -986,15 +986,15 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, * for each */ for(elmt=0; elmt<nelmts; elmt++) { /* Check vlen lengths */ - if(((const hvl_t *)memb1)->len - != ((const hvl_t *)memb2)->len) + if(((const hvl_t *)((const void *)memb1))->len + != ((const hvl_t *)((const void *)memb2))->len) TEST_ERROR /* Check vlen data */ if(!compare_data(parent1, parent2, pid, base_id, - ((const hvl_t *)memb1)->len, - ((const hvl_t *)memb1)->p, - ((const hvl_t *)memb2)->p, obj_owner)) + ((const hvl_t *)((const void *)memb1))->len, + ((const hvl_t *)((const void *)memb1))->p, + ((const hvl_t *)((const void *)memb2))->p, obj_owner)) TEST_ERROR /* Update member pointers */ @@ -13425,7 +13425,7 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl hid_t fid1 = -1, fid2 = -1; /* File IDs */ hid_t gid = -1; /* Group ID */ int i; - char grp_name[8]; + char grp_name[16]; char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; diff --git a/test/tarray.c b/test/tarray.c index d8ededf..eb71ad6 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1074,7 +1074,7 @@ test_array_free_custom(void *_mem, void *info) if(_mem != NULL) { mem = ((unsigned char *)_mem) - extra; - *mem_used -= *(size_t *)mem; + *mem_used -= *(size_t *)((void *)mem); HDfree(mem); } /* end if */ diff --git a/test/tchecksum.c b/test/tchecksum.c index ffbab45..6e509fb 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -252,7 +252,7 @@ test_checksum(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE H5_ATTR_CONST void +void cleanup_checksum(void) { /* no file to clean */ diff --git a/test/tconfig.c b/test/tconfig.c index b652ca4..1a81d50 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -83,7 +83,7 @@ test_configure(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void cleanup_configure(void) { /* no file to clean */ @@ -106,7 +106,7 @@ cleanup_configure(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void test_config_ctypes(void) { /* standard C89 basic types */ @@ -215,7 +215,7 @@ test_config_ctypes(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +void test_exit_definitions(void) { /* Verify the EXIT_SUCCESS and EXIT_FAILURE are 0 and 1 respectively. */ diff --git a/test/tmeta.c b/test/tmeta.c index 7eeb493..ceb7d2b 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -121,7 +121,7 @@ test_metadata(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE H5_ATTR_CONST void +void cleanup_metadata(void) { /* no file to clean */ diff --git a/test/tsohm.c b/test/tsohm.c index 5c3707f..8cf4d2f 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -595,7 +595,7 @@ error: *------------------------------------------------------------------------- */ static hid_t -size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_closing) +size1_helper(hid_t file, const char *filename, hid_t fapl_id, unsigned test_file_closing) { dtype1_struct wdata; dtype1_struct rdata; @@ -749,10 +749,10 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned o hid_t file = -1; herr_t ret; - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); + file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); CHECK_I(file, "H5Fcreate"); - file = size1_helper(file, FILENAME, fapl_id, open_close); + file = size1_helper(file, filename, fapl_id, open_close); CHECK_I(file, "size1_helper"); ret = H5Oget_info_by_name2(file, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); @@ -761,7 +761,7 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned o ret = H5Fclose(file); CHECK_I(ret, "H5Fclose"); - return h5_get_file_size(FILENAME, fapl_id); + return h5_get_file_size(filename, fapl_id); } /* getsize_testsize1 */ @@ -790,7 +790,9 @@ test_sohm_size1(void) hsize_t oh_sizes[3]; unsigned oh_size_index = 0; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ hsize_t norm_oh_size; +#endif /* Jira HDFFV-10646 */ hsize_t sohm_oh_size; hsize_t sohm_btree_oh_size; h5_stat_size_t norm_empty_filesize; @@ -886,7 +888,9 @@ test_sohm_size1(void) norm_empty_filesize = file_sizes[0]; norm_final_filesize = file_sizes[1]; norm_final_filesize2 = file_sizes[2]; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ norm_oh_size = oh_sizes[0]; +#endif /* Jira HDFFV-10646 */ sohm_empty_filesize = file_sizes[3]; sohm_final_filesize = file_sizes[4]; @@ -941,6 +945,7 @@ test_sohm_size1(void) } /* test_sohm_size1 */ +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ /*--------------------------------------------------------------------------- * Function: test_sohm_size_consistency_open_create @@ -1045,6 +1050,7 @@ test_sohm_size_consistency_open_create(void) ret = H5Pclose(fapl_id); CHECK_I(ret, "H5Pclose"); } /* test_sohm_size_consistency_open_create */ +#endif /* Jira HDFFV-10645 */ /*------------------------------------------------------------------------- @@ -1176,6 +1182,7 @@ static void test_sohm_attrs(void) { hid_t fcpl_id; + hid_t file_id; unsigned i = 0; #define TSOHM_TSA_NFLAGS_1 7 unsigned flags1[TSOHM_TSA_NFLAGS_1] = { @@ -1293,8 +1300,8 @@ test_sohm_attrs(void) ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); - VERIFY(ret, -1, "H5Fcreate"); + file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + VERIFY(file_id, -1, "H5Fcreate"); ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); diff --git a/test/tvlstr.c b/test/tvlstr.c index 77589bb..5f715ce 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -94,7 +94,7 @@ void test_vlstr_free_custom(void *_mem, void *info) if(_mem!=NULL) { mem=((unsigned char *)_mem)-extra; - *mem_used-=*(size_t *)mem; + *mem_used-=*(size_t *)((void *)mem); HDfree(mem); } /* end if */ } diff --git a/test/tvltypes.c b/test/tvltypes.c index 8824066..ffa2aff 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -88,7 +88,7 @@ void test_vltypes_free_custom(void *_mem, void *mem_used) */ unsigned char *mem = ((unsigned char *)_mem) - extra; /* Pointer to actual block allocated */ - *(size_t *)mem_used -= *(size_t *)mem; + *(size_t *)mem_used -= *(size_t *)((void *)mem); HDfree(mem); } /* end if */ } @@ -12152,7 +12152,6 @@ main(void) hid_t my_fapl = -1; /* File access property list */ int test_api_config; unsigned bit_config; - unsigned latest = FALSE; /* Using the latest library version bound */ H5F_libver_t low, high; /* Low and high bounds */ int nerrors = 0; @@ -12180,10 +12179,6 @@ main(void) if(high < H5F_LIBVER_V110) continue; - /* Whether to use latest hyperslab/point selection version */ - if(low >= H5F_LIBVER_V112) - latest = TRUE; - /* Set the low/high version bounds */ if(H5Pset_libver_bounds(my_fapl, low, high) < 0) TEST_ERROR diff --git a/test/vds_env.c b/test/vds_env.c index d3a28fb..9c7b698 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -302,7 +302,6 @@ main(void) hid_t fapl, my_fapl; unsigned bit_config; H5F_libver_t low, high; /* Low and high bounds */ - unsigned latest = FALSE; /* Using the latest library version bound */ int nerrors = 0; /* Testing setup */ @@ -327,10 +326,6 @@ main(void) if(high < H5F_LIBVER_V110) continue; - /* Whether to use latest hyperslab/point selection version */ - if(low >= H5F_LIBVER_V112) - latest = TRUE; - /* Set the low/high version bounds */ if(H5Pset_libver_bounds(my_fapl, low, high) < 0) TEST_ERROR diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 0169131..ac385c9 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -516,14 +516,14 @@ static hsize_t diff_datum( if (H5Tis_variable_str(m_type)) { h5difftrace("diff_datum H5T_STRING variable\n"); /* Get pointer to first string */ - s1 = *(char**) mem1; + s1 = *(char **)((void *)mem1); if (s1) size1 = HDstrlen(s1); else size1 = 0; /* Get pointer to second string */ - s2 = *(char**) mem2; + s2 = *(char **)((void *)mem2); if (s2) size2 = HDstrlen(s2); else @@ -828,10 +828,10 @@ static hsize_t diff_datum( size = H5Tget_size(memb_type); /* get the number of sequence elements */ - nelmts = ((hvl_t *) mem1)->len; + nelmts = ((hvl_t *)((void *)mem1))->len; for (j = 0; j < nelmts; j++) - nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index, + nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index, rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members); H5Tclose(memb_type); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index d93f7b0..f103647 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1283,7 +1283,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t mem = ((unsigned char*)_mem) + block_index * size; if (H5Tis_variable_str(tid)) { - s = *(char**) mem; + s = *(char **)((void *)mem); if (s != NULL) size = HDstrlen(s); else @@ -1375,10 +1375,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; /* Get the number of sequence elements */ - nelmts = ((hvl_t *) mem)->len; + nelmts = ((hvl_t *)((void *)mem))->len; /* dump the array element */ - if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { + if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *)((void *)mem))->p)), nelmts) < 0) { H5Tclose(memb); H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3e8f1fe..17e3f18 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -787,7 +787,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if(H5Tis_variable_str(type)) { /* cp_vp is the pointer into the struct where a `char*' is stored. So we have * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ - s = *(char**) cp_vp; + s = *(char **)((void *)cp_vp); if(s != NULL) size = HDstrlen(s); } else { @@ -1240,7 +1240,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, "%s", OPT(info->vlen_pre, "(")); /* Get the number of sequence elements */ - nelmts = ((hvl_t *) cp_vp)->len; + nelmts = ((hvl_t *)((void *)cp_vp))->len; for(i = 0; i < nelmts; i++) { if(i) h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK)); @@ -1264,7 +1264,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai ctx->indent_level++; /* Dump the array element */ - h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx); + h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *)((void *)cp_vp))->p)) + i * size, ctx); ctx->indent_level--; } /* end for */ diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index ec76511..2fa9fd0 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -2881,7 +2881,7 @@ xml_print_refs(hid_t did, int source) goto error; } - refbuf = (hobj_ref_t *) buf; + refbuf = (hobj_ref_t *)((void *)buf); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -3057,7 +3057,7 @@ xml_print_strs(hid_t did, int source) for (i = 0; i < (hsize_t)ssiz; i++) { if (is_vlstr) { - onestring = *(char **) bp; + onestring = *(char **)((void *)bp); if (onestring) str_size = HDstrlen(onestring); } diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index b9ed9ce..257a047 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -259,7 +259,7 @@ convert(hid_t fid, const char *dname) error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); h5tools_setstatus(EXIT_FAILURE); goto error; - } + } else if(verbose_g) HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); @@ -268,11 +268,11 @@ convert(hid_t fid, const char *dname) HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); h5tools_setstatus(EXIT_SUCCESS); goto done; - } + } else if (verbose_g) HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); - break; + break; case H5D_CONTIGUOUS: if(verbose_g) @@ -302,8 +302,8 @@ convert(hid_t fid, const char *dname) if(noop_g) { if(verbose_g) HDfprintf(stdout, "Not converting the dataset\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + h5tools_setstatus(EXIT_SUCCESS); + goto done; } if(verbose_g) diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index ce866b4..08ebfc7 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -130,7 +130,7 @@ int main(void) set = H5Dopen2(fil, setname, H5P_DEFAULT); H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); H5Dclose(set); out: @@ -151,7 +151,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); mname = H5Tget_member_name(fix, 1); printf("Data comparison:\n" "%14s (%2d) %6f = %f\n" @@ -162,7 +162,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 2)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); mname = H5Tget_member_name(fix, 2); printf("%14s (%2d) %6f = %f\n" " %6f = %6f\n", @@ -172,7 +172,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); printf("\n" "Short circuit\n" " %6f = %f\n" diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 47734b6..3962edd 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -79,7 +79,7 @@ counter (unsigned flags, size_t cd_nelmts, } /*---------------------------------------------------------------------------*/ -double retrieve_time(void) +static double retrieve_time(void) { #ifdef H5_HAVE_GETTIMEOFDAY struct timeval t; |