From 548eec307006ebd01294fad2886421f07c3c92c8 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 5 May 2009 10:05:17 -0500 Subject: [svn-r16920] Description: Merge these trunk revisions which occurred during the 1.8.3 release code freeze back to the 1.8 branch: From Quincey: 16845 16847 16849 16851 16858 16869 16897 From Ray: 16859 16880 From Allen: 16863 Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.6 (amazon) in debug mode Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode --- MANIFEST | 3 + bin/make_overflow | 219 +++++++ config/gnu-flags | 61 +- configure | 470 +++++++++++++++ configure.in | 14 + examples/h5_shared_mesg.c | 4 +- hl/src/H5LT.c | 12 +- hl/src/H5LTparse.c | 78 +-- hl/src/H5LTparse.y | 27 +- hl/test/Makefile.am | 2 +- hl/test/test_lite.c | 33 +- src/H5Apkg.h | 16 +- src/H5Aprivate.h | 1 - src/H5B2int.c | 19 +- src/H5B2pkg.h | 4 +- src/H5C.c | 15 + src/H5Cprivate.h | 12 + src/H5Dchunk.c | 35 +- src/H5Dcompact.c | 12 +- src/H5Dcontig.c | 38 +- src/H5Defl.c | 12 +- src/H5Dint.c | 48 +- src/H5Dmpio.c | 5 +- src/H5Dpkg.h | 16 +- src/H5Eprivate.h | 2 +- src/H5FDsec2.c | 6 - src/H5FL.c | 16 +- src/H5FLprivate.h | 16 +- src/H5FScache.c | 2 +- src/H5FSsection.c | 20 +- src/H5Gpkg.h | 12 +- src/H5Oprivate.h | 10 +- src/H5Zdeflate.c | 4 +- src/H5config.h.in | 3 + src/H5overflow.h | 1381 +++++++++++++++++++++++++++++++++++++++++++++ src/H5overflow.txt | 43 ++ src/H5private.h | 114 +++- src/H5win32defs.h | 1 + src/Makefile.am | 6 +- src/Makefile.in | 6 +- test/Makefile.am | 4 +- test/Makefile.in | 3 +- test/big.c | 8 +- test/dsets.c | 385 ++++++++++++- 44 files changed, 2978 insertions(+), 220 deletions(-) create mode 100755 bin/make_overflow create mode 100644 src/H5overflow.h create mode 100644 src/H5overflow.txt diff --git a/MANIFEST b/MANIFEST index 9d78d42..b2405eb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -57,6 +57,7 @@ ./bin/locate_sw ./bin/ltmain.sh ./bin/make_err +./bin/make_overflow ./bin/make_vers ./bin/makehelp ./bin/missing @@ -427,6 +428,8 @@ ./src/H5err.txt ./src/H5config.h.in ./src/H5detect.c +./src/H5overflow.txt +./src/H5overflow.h ./src/H5private.h ./src/H5public.h ./src/H5system.c diff --git a/bin/make_overflow b/bin/make_overflow new file mode 100755 index 0000000..ced486a --- /dev/null +++ b/bin/make_overflow @@ -0,0 +1,219 @@ +#!/usr/bin/perl -w +require 5.003; +use strict; + +# Global settings + +# List of supported C types to generate overflow assignment code for +my @ctypes = ( () ); + +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +# Create assignment overflow #ifdefs +# +# Programmer: Quincey Koziol +# Creation Date: 2009/04/09 + +############################################################################## +# Parse a meaningful line (not a comment or blank line) into the appropriate +# data structure +# +sub parse_line ($) { + my $line = shift; # Get the line to parse + + # Parse get the type name and whether it's signed or unsigned +#print "line=$line\n"; + if($line =~ /.*SIGNED\s*;\s*$/ || $line =~ /.*UNSIGNED\s*;\s*$/) { + my $name; # The name of the type + my $signed; # Whether the type is signed or not + + # Get the type's name & signed status + ($name, $signed) = ($line =~ /^\s*(\w*)\s*,\s*(\w*)\s*;\s*$/); +#print "name = '$name', signed = '$signed'\n"; + + # Append the type to the list of C types already parsed + push @ctypes, [$name, $signed]; + + } + # Unknown keyword + else { + die "unknown keyword: $line"; + } +} + +############################################################################## +# Print the copyright into an open file +# +sub print_copyright ($) { + my $fh = shift; + + print $fh "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"; + print $fh " * Copyright by The HDF Group. *\n"; + print $fh " * Copyright by the Board of Trustees of the University of Illinois. *\n"; + print $fh " * All rights reserved. *\n"; + print $fh " * *\n"; + print $fh " * This file is part of HDF5. The full HDF5 copyright notice, including *\n"; + print $fh " * terms governing use, modification, and redistribution, is contained in *\n"; + print $fh " * the files COPYING and Copyright.html. COPYING can be found at the root *\n"; + print $fh " * of the source code distribution tree; Copyright.html can be found at the *\n"; + print $fh " * root level of an installed copy of the electronic HDF5 document set and *\n"; + print $fh " * is linked from the top-level documents page. It can also be found at *\n"; + print $fh " * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *\n"; + print $fh " * access to either file, you may request a copy from help\@hdfgroup.org. *\n"; + print $fh " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n"; +} + +############################################################################## +# Print the "do not change this file" warning +# +sub print_warning ($) { + my $fh = shift; + + print $fh "\n/* Generated automatically by bin/make_overflow -- do not edit */\n"; + print $fh "/* Add new types to H5overflow.txt file */\n\n"; +} + +############################################################################## +# Print start of ifdef's to prevent a file from being re-included +# +sub print_startprotect ($$) { + my ($fh, $file) = @_; + + # Clip off the ".h" part of the name + $file =~ s/(\w*)\.h/$1/; + + # Print the ifdef info + print $fh "\n#ifndef _${file}_H\n"; + print $fh "#define _${file}_H\n"; +} + +############################################################################## +# Print assignment overflow macros for each type +# +sub print_typemacros ($) { + my $fh = shift; # File handle for output file + my ($src_aref, $dst_aref); # References for each type's information + + # Print the descriptive comment + print $fh "\n\n/* Each type in this file is tested for assignment to the other types,\n"; + print $fh " * and range checks are defined for bad assignments at run-time.\n"; + print $fh " */\n"; + + for $src_aref (@ctypes) { + # Print a descriptive comment + print $fh "\n/* Assignment checks for @$src_aref[0] */\n\n"; + + for $dst_aref (@ctypes) { + if (@$src_aref[0] ne @$dst_aref[0]) { + # Print a descriptive comment + print $fh "/* src: @$src_aref[0], dst: @$dst_aref[0] */\n"; + + # Print actual type size checks & macro definitions + print $fh "#if H5_SIZEOF_", uc @$src_aref[0], " < H5_SIZEOF_", uc @$dst_aref[0], "\n"; + print $fh " #define ASSIGN_", @$src_aref[0], "_TO_", @$dst_aref[0], "(dst, dsttype, src, srctype) \\\n"; + if ( @$src_aref[1] eq @$dst_aref[1]) { + print $fh " ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)\n"; + } elsif ( @$src_aref[1] eq "SIGNED") { + print $fh " ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)\n"; + } else { + print $fh " ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)\n"; + } + print $fh "#elif H5_SIZEOF_", uc @$src_aref[0], " > H5_SIZEOF_", uc @$dst_aref[0], "\n"; + print $fh " #define ASSIGN_", @$src_aref[0], "_TO_", @$dst_aref[0], "(dst, dsttype, src, srctype) \\\n"; + print $fh " ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)\n"; + print $fh "#else /* H5_SIZEOF_", uc @$src_aref[0], " == H5_SIZEOF_", uc @$dst_aref[0], " */\n"; + print $fh " #define ASSIGN_", @$src_aref[0], "_TO_", @$dst_aref[0], "(dst, dsttype, src, srctype) \\\n"; + if ( @$src_aref[1] eq @$dst_aref[1]) { + print $fh " ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)\n"; + } elsif ( @$src_aref[1] eq "SIGNED") { + print $fh " ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)\n"; + } else { + print $fh " ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)\n"; + } + print $fh "#endif /* src: @$src_aref[0] dst: @$dst_aref[0] */\n\n"; + } + } + } + +} + +############################################################################## +# Print end of ifdef's to prevent a file from being re-included +# +sub print_endprotect ($$) { + my ($fh, $file) = @_; + + # Clip off the ".h" part of the name + $file =~ s/(\w*)\.h/$1/; + + # Print the endif info + print $fh "#endif /* ${file}_H */\n\n"; +} + +############################################################################## +# Create the generated portion of the public header file +# +sub create_public ($) { + my $prefix = shift; # Get the prefix for the generated file + my $file = "H5overflow.h"; # Name of file to generate + my $name; # Name of function + + # Rename previous file +# rename "${prefix}${file}", "${prefix}${file}~" or die "unable to make backup"; + + # Open new header file + open HEADER, ">${prefix}${file}" or die "unable to modify source"; + + # Create file contents + print_copyright(*HEADER); + print_warning(*HEADER); + print_startprotect(*HEADER, $file); + print_typemacros(*HEADER); + print_endprotect(*HEADER, $file); + + # Close header file + close HEADER; +} + +############################################################################## +# Read symbol version file (given as command-line argument) in and process it +# into internal data structures, then create header files. +# +my $file; # Filename of input file + +for $file (@ARGV) { + my $prefix; # Local prefix for generated files + my $line; # Line from input file + +#print "file = '$file'\n"; + ($prefix) = ($file =~ /(^.*\/)/); +#print "prefix = '$prefix'\n"; + # Read in the entire file + open SOURCE, $file or die "$file: $!\n"; + while ( defined ($line=) ) { + # Skip blank lines and those lines whose first character is a '#' + if(!($line =~ /(^\s*#.*$)|(^\s*$)/)) { + # Construct data structures for later printing + parse_line($line); + } + } + close SOURCE; + + # Create header files + print "Generating 'H5overflow.h'\n"; + create_public($prefix); +} + diff --git a/config/gnu-flags b/config/gnu-flags index c99a664..fe3eba3 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -190,10 +190,67 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# Closer to the gcc 4.4 release, we should check for additional flags to +# Closer to the gcc 4.5 release, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-4.[34]*) + gcc-4.[45]*) + # Replace -ansi flag with -std=c99 flag + H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" + + # Disable warnings about using 'long long' type + H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CFLAGS="$H5_CFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CFLAGS="$H5_CFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc4.0+ know about + H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know 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=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Try out the new "stack protector" feature in gcc 4.1 + # (Strictly speaking this isn't really a "warning" flag, so it's added to + # the debugging flags) + #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + ;; + + gcc-4.3*) # Replace -ansi flag with -std=c99 flag H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" diff --git a/configure b/configure index 16e8c2c..9a71a79 100755 --- a/configure +++ b/configure @@ -25859,6 +25859,467 @@ cat >>confdefs.h <<_ACEOF _ACEOF +{ echo "$as_me:$LINENO: checking for unsigned" >&5 +echo $ECHO_N "checking for unsigned... $ECHO_C" >&6; } +if test "${ac_cv_type_unsigned+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef unsigned ac__type_new_; +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_unsigned=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of unsigned" >&5 +echo $ECHO_N "checking size of unsigned... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_unsigned+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef unsigned ac__type_sizeof_; +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef unsigned ac__type_sizeof_; +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef unsigned ac__type_sizeof_; +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef unsigned ac__type_sizeof_; +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef unsigned ac__type_sizeof_; +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_unsigned=$ac_lo;; +'') if test "$ac_cv_type_unsigned" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_unsigned=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef unsigned ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +#include +#include +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_unsigned=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_unsigned" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_unsigned=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned" >&5 +echo "${ECHO_T}$ac_cv_sizeof_unsigned" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED $ac_cv_sizeof_unsigned +_ACEOF + + { echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6; } if test "${ac_cv_type_long+set}" = set; then @@ -48229,6 +48690,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi + if test "X$PARALLEL" = "Xyes" -a -z "$RUNPARALLEL"; then + for path in `echo $PATH | ${TR} ":" " "`; do + if test -x $path/aprun; then + RUNPARALLEL="aprun -q -n \$\${NPROCS:=3}" + break; + fi + done + fi + if test "X$PARALLEL" = "Xyes" -a -z "$RUNPARALLEL"; then RUNPARALLEL="mpirun -np \$\${NPROCS:=3}" fi diff --git a/configure.in b/configure.in index 6481875..41429f6 100644 --- a/configure.in +++ b/configure.in @@ -1306,6 +1306,7 @@ AC_C_BIGENDIAN AC_CHECK_SIZEOF([char], [1]) AC_CHECK_SIZEOF([short], [2]) AC_CHECK_SIZEOF([int], [4]) +AC_CHECK_SIZEOF([unsigned], [4]) AC_CHECK_SIZEOF([long], [4]) AC_CHECK_SIZEOF([long long], [8]) AC_CHECK_SIZEOF([__int64], [8]) @@ -2477,6 +2478,19 @@ case "X-$enable_parallel" in fi dnl Set RUNPARALLEL to mpirun if not set yet. + dnl Check for building on Cray if RUNPARALLEL is not yet set by checking + dnl for 'aprun' command (which is the parallel job launcher, like mpirun). + if test "X$PARALLEL" = "Xyes" -a -z "$RUNPARALLEL"; then + dnl Find the path where aprun is located. + for path in `echo $PATH | ${TR} ":" " "`; do + if test -x $path/aprun; then + RUNPARALLEL="aprun -q -n \$\${NPROCS:=3}" + break; + fi + done + fi + + dnl Set RUNPARALLEL to mpirun if not set yet. if test "X$PARALLEL" = "Xyes" -a -z "$RUNPARALLEL"; then RUNPARALLEL="mpirun -np \$\${NPROCS:=3}" fi diff --git a/examples/h5_shared_mesg.c b/examples/h5_shared_mesg.c index a2edb38..0c7f2f0 100644 --- a/examples/h5_shared_mesg.c +++ b/examples/h5_shared_mesg.c @@ -261,9 +261,9 @@ create_standard_file(const char *filename, hid_t fcpl_id) * disk, so this type will be an array type rather than an atomic type. * However, any type can be shared. */ - temp_type_id = H5Tarray_create2(H5T_NATIVE_INT, 10, dims); + temp_type_id = H5Tarray_create2(H5T_NATIVE_INT, 2, dims); if(temp_type_id < 0) goto error; - type_id = H5Tarray_create2(temp_type_id, 10, dims); + type_id = H5Tarray_create2(temp_type_id, 2, dims); if(type_id < 0) goto error; ret = H5Tclose(temp_type_id); if(ret < 0) goto error; diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 7c073d6..e797d14 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1792,6 +1792,7 @@ herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t * if((ret = H5LT_dtype_to_text(dtype, &text_str, lang_type, &str_len, 1)) < 0) goto out; *len = strlen(text_str) + 1; + free(text_str); } else if(len && str) { if((ret = H5LT_dtype_to_text(dtype, &str, lang_type, len, 0)) < 0) goto out; @@ -2076,6 +2077,9 @@ next: break; } case H5T_OPAQUE: + { + char *tag; + /* Print lead-in */ sprintf(*dt_str, "H5T_OPAQUE {\n"); indent += COL; @@ -2085,7 +2089,12 @@ next: strcat(*dt_str, tmp_str); indentation(indent + COL, *dt_str); - sprintf(tmp_str, "OPQ_TAG \"%s\";\n", H5Tget_tag(dtype)); + tag = H5Tget_tag(dtype); + if(tag) { + sprintf(tmp_str, "OPQ_TAG \"%s\";\n", tag); + free(tag); + } else + sprintf(tmp_str, "OPQ_TAG \"\";\n"); strcat(*dt_str, tmp_str); /* Print closing */ @@ -2094,6 +2103,7 @@ next: strcat(*dt_str, "}"); break; + } case H5T_ENUM: { hid_t super; diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 6e5e08b..98dcbd5 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -14,11 +14,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This file was generated by Yacc with the command "yacc -pH5LTyy -o H5LTparse.c -d H5LTparse.y" - * Do NOT modify it by hand. + * on jam. Do NOT modify it by hand. */ - #ifndef lint -static char const +static char const yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $"; #endif #include @@ -92,7 +91,7 @@ struct arr_info { }; /*stack for nested array type*/ struct arr_info arr_stack[STACK_SIZE]; -int asindex = -1; /*pointer to the top of array stack*/ +int asindex = -1; /*pointer to the top of array stack*/ hbool_t is_str_size = 0; /*flag to lexer for string size*/ hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ @@ -100,7 +99,7 @@ H5T_pad_t str_pad; /*variable for string padding*/ H5T_cset_t str_cset; /*variable for string character set*/ hbool_t is_variable = 0; /*variable for variable-length string*/ size_t str_size; /*variable for string size*/ - + hid_t enum_id; /*type ID*/ hbool_t is_enum = 0; /*flag to lexer for enum type*/ hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ @@ -823,9 +822,9 @@ case 46: break; case 47: #line 156 "H5LTparse.y" -{ yyval.ival = cmpd_stack[csindex].id; +{ yyval.ival = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; - cmpd_stack[csindex].first_memb = 1; + cmpd_stack[csindex].first_memb = 1; csindex--; } break; @@ -835,7 +834,7 @@ case 50: break; case 51: #line 167 "H5LTparse.y" -{ +{ size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; @@ -849,7 +848,7 @@ case 51: cmpd_stack[csindex].first_memb = 0; } else { origin_size = H5Tget_size(dtype_id); - + if(yyvsp[-1].ival == 0) { new_size = origin_size + H5Tget_size(yyvsp[-6].ival); H5Tset_size(dtype_id, new_size); @@ -860,10 +859,10 @@ case 51: H5Tinsert(dtype_id, yyvsp[-3].sval, yyvsp[-1].ival, yyvsp[-6].ival); } } - + cmpd_stack[csindex].is_field = 0; H5Tclose(yyvsp[-6].ival); - + new_size = H5Tget_size(dtype_id); } break; @@ -887,7 +886,7 @@ case 56: break; case 57: #line 213 "H5LTparse.y" -{ +{ yyval.ival = H5Tarray_create2(yyvsp[-1].ival, arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; @@ -901,9 +900,9 @@ break; case 61: #line 224 "H5LTparse.y" { unsigned ndims = arr_stack[asindex].ndims; - arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; + arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; - arr_stack[asindex].is_dim = 0; + arr_stack[asindex].is_dim = 0; } break; case 64: @@ -916,10 +915,10 @@ case 65: break; case 66: #line 241 "H5LTparse.y" -{ +{ size_t size = (size_t)yylval.ival; yyval.ival = H5Tcreate(H5T_OPAQUE, size); - is_opq_size = 0; + is_opq_size = 0; } break; case 67: @@ -928,7 +927,7 @@ case 67: break; case 68: #line 247 "H5LTparse.y" -{ +{ H5Tset_tag(yyvsp[-6].ival, yylval.sval); is_opq_tag = 0; } @@ -943,12 +942,12 @@ case 72: break; case 73: #line 260 "H5LTparse.y" -{ +{ if(yyvsp[-1].ival == H5T_VARIABLE_TOKEN) is_variable = 1; - else + else str_size = yylval.ival; - is_str_size = 0; + is_str_size = 0; } break; case 74: @@ -964,7 +963,7 @@ case 74: break; case 75: #line 277 "H5LTparse.y" -{ +{ if(yyvsp[-1].ival == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; else if(yyvsp[-1].ival == H5T_CSET_UTF8_TOKEN) @@ -982,7 +981,7 @@ case 76: break; case 77: #line 291 "H5LTparse.y" -{ +{ hid_t str_id = yyvsp[-1].ival; /*set string size*/ @@ -991,12 +990,12 @@ case 77: is_variable = 0; } else H5Tset_size(str_id, str_size); - + /*set string padding and character set*/ H5Tset_strpad(str_id, str_pad); H5Tset_cset(str_id, str_cset); - yyval.ival = str_id; + yyval.ival = str_id; } break; case 78: @@ -1043,7 +1042,7 @@ case 91: #line 330 "H5LTparse.y" { is_enum_memb = 1; /*indicate member of enum*/ - enum_memb_symbol = strdup(yylval.sval); + enum_memb_symbol = strdup(yylval.sval); } break; case 92: @@ -1056,21 +1055,34 @@ case 92: long long llong_val=(long long)yylval.ival; hid_t super = H5Tget_super(enum_id); hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); - + H5T_order_t super_order = H5Tget_order(super); + H5T_order_t native_order = H5Tget_order(native); + if(is_enum && is_enum_memb) { /*if it's an enum member*/ /*To handle machines of different endianness*/ - if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) + if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &char_val); - else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) + } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &short_val); - else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) + } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &int_val); - else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) + } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &long_val); - else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) + } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); + } - is_enum_memb = 0; + is_enum_memb = 0; if(enum_memb_symbol) free(enum_memb_symbol); } @@ -1078,7 +1090,7 @@ case 92: H5Tclose(native); } break; -#line 1063 "H5LTparse.c" +#line 1076 "H5LTparse.c" } yyssp -= yym; yystate = *yyssp; diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index 7866add..a021efc 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -337,22 +337,35 @@ enum_def : '"' enum_symbol '"' { short short_val=(short)yylval.ival; int int_val=(int)yylval.ival; long long_val=(long)yylval.ival; - long_long llong_val=(long_long)yylval.ival; + long long llong_val=(long long)yylval.ival; hid_t super = H5Tget_super(enum_id); hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); - + H5T_order_t super_order = H5Tget_order(super); + H5T_order_t native_order = H5Tget_order(native); + if(is_enum && is_enum_memb) { /*if it's an enum member*/ /*To handle machines of different endianness*/ - if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) + if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &char_val); - else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) + } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &short_val); - else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) + } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &int_val); - else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) + } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &long_val); - else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) + } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); + } is_enum_memb = 0; if(enum_memb_symbol) free(enum_memb_symbol); diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am index 99832e8..1e8a380 100644 --- a/hl/test/Makefile.am +++ b/hl/test/Makefile.am @@ -33,7 +33,7 @@ TEST_PROG=test_lite test_image test_table test_ds test_packet check_PROGRAMS=$(TEST_PROG) # Temporary files. These files are the ones created by running `make test'. -CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-6].h5 test_image[1-3].h5 \ +CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-7].h5 test_image[1-3].h5 \ test_lite[1-2].h5 test_table.h5 test_packet_table.h5 \ test_packet_compress.h5 diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 6de2e31..ad12fb2 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1291,6 +1291,7 @@ static int test_enums(void) H5T_class_t type_class; char* dt_str; size_t str_len; + H5T_order_t native_order = H5Tget_order(H5T_NATIVE_INT); TESTING3(" text for enum types"); @@ -1302,6 +1303,12 @@ static int test_enums(void) if(type_class != H5T_ENUM) goto out; + /* Convert the variable before using it */ + if(!H5Tequal(H5T_STD_I32LE, H5T_NATIVE_INT)) { + if(H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32LE, 1, &value1, NULL, H5P_DEFAULT) < 0) + goto out; + } + if(H5Tenum_nameof(dtype, &value1, name1, size)<0) goto out; if(strcmp(name1, "BLUE")) @@ -1309,6 +1316,13 @@ static int test_enums(void) if(H5Tenum_valueof(dtype, name2, &value2)<0) goto out; + + /* Convert the variable before comparing it */ + if(!H5Tequal(H5T_STD_I32LE, H5T_NATIVE_INT)) { + if(H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32LE, 1, &value2, NULL, H5P_DEFAULT) < 0) + goto out; + } + if(value2 != 8) goto out; @@ -1317,10 +1331,12 @@ static int test_enums(void) dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) goto out; - /*if(strcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { - printf("dt=\n%s\n", dt_str); - goto out; - }*/ + if(strcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { + + printf("dt=\n%s\n", dt_str); + goto out; + } + free(dt_str); if(H5Tclose(dtype)<0) @@ -1427,10 +1443,11 @@ static int test_arrays(void) dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) goto out; - /*if(strcmp(dt_str, "H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }")) { - printf("dt=\n%s\n", dt_str); - goto out; - }*/ + if(strcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) { + printf("dt=\n%s\n", dt_str); + goto out; + } + free(dt_str); if(H5Tclose(dtype)<0) diff --git a/src/H5Apkg.h b/src/H5Apkg.h index b166b06..3c62635 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -163,14 +163,16 @@ typedef struct { typedef herr_t (*H5A_lib_iterate_t)(const H5A_t *attr, void *op_data); /* Describe kind of callback to make for each attribute */ -struct H5A_attr_iter_op_t { - enum { +typedef enum H5A_attr_iter_op_type_t { #ifndef H5_NO_DEPRECATED_SYMBOLS - H5A_ATTR_OP_APP, /* Application callback */ + H5A_ATTR_OP_APP, /* Application callback */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5A_ATTR_OP_APP2, /* Revised application callback */ - H5A_ATTR_OP_LIB /* Library internal callback */ - } op_type; + H5A_ATTR_OP_APP2, /* Revised application callback */ + H5A_ATTR_OP_LIB /* Library internal callback */ +} H5A_attr_iter_op_type_t; + +typedef struct H5A_attr_iter_op_t { + H5A_attr_iter_op_type_t op_type; union { #ifndef H5_NO_DEPRECATED_SYMBOLS H5A_operator1_t app_op; /* Application callback for each attribute */ @@ -178,7 +180,7 @@ struct H5A_attr_iter_op_t { H5A_operator2_t app_op2; /* Revised application callback for each attribute */ H5A_lib_iterate_t lib_op; /* Library internal callback for each attribute */ } u; -}; +} H5A_attr_iter_op_t; /*****************************/ diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index d46e46b..0c0e519 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -37,7 +37,6 @@ /* Forward references of package typedefs */ typedef struct H5A_t H5A_t; -typedef struct H5A_attr_iter_op_t H5A_attr_iter_op_t; /*****************************/ diff --git a/src/H5B2int.c b/src/H5B2int.c index 638f1be..39e3a56 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -149,6 +149,8 @@ H5B2_shared_init (H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type, unsigned split_percent, unsigned merge_percent) { H5B2_shared_t *shared = NULL; /* Shared B-tree information */ + size_t sz_max_nrec; /* Temporary variable for range checking */ + unsigned u_max_nrec_size; /* Temporary variable for range checking */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -182,7 +184,8 @@ HDmemset(shared->page, 0, shared->node_size); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize leaf node info */ - shared->node_info[0].max_nrec = H5B2_NUM_LEAF_REC(shared->node_size, shared->rrec_size); + sz_max_nrec = H5B2_NUM_LEAF_REC(shared->node_size, shared->rrec_size); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[0].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned) shared->node_info[0].split_nrec = (shared->node_info[0].max_nrec * shared->split_percent) / 100; shared->node_info[0].merge_nrec = (shared->node_info[0].max_nrec * shared->merge_percent) / 100; shared->node_info[0].cum_max_nrec = shared->node_info[0].max_nrec; @@ -203,7 +206,8 @@ HDmemset(shared->page, 0, shared->node_size); /* Compute size to store # of records in each node */ /* (uses leaf # of records because its the largest) */ - shared->max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[0].max_nrec); + u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[0].max_nrec); + H5_ASSIGN_OVERFLOW(/* To: */ shared->max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t) HDassert(shared->max_nrec_size <= H5B2_SIZEOF_RECORDS_PER_NODE); /* Initialize internal node info */ @@ -217,7 +221,8 @@ HDmemset(shared->page, 0, shared->node_size); shared->node_info[u].cum_max_nrec = ((shared->node_info[u].max_nrec + 1) * shared->node_info[u - 1].cum_max_nrec) + shared->node_info[u].max_nrec; - shared->node_info[u].cum_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[u].cum_max_nrec); + u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[u].cum_max_nrec); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[u].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t) if((shared->node_info[u].nat_rec_fac = H5FL_fac_init(shared->type->nrec_size * shared->node_info[u].max_nrec)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") @@ -551,6 +556,8 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, unsigned *bt2_flags_ptr) H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ unsigned new_root_flags = H5AC__NO_FLAGS_SET; /* Cache flags for new root node */ H5B2_node_ptr_t old_root_ptr; /* Old node pointer to root node in B-tree */ + size_t sz_max_nrec; /* Temporary variable for range checking */ + unsigned u_max_nrec_size; /* Temporary variable for range checking */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_split_root) @@ -571,12 +578,14 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, unsigned *bt2_flags_ptr) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Update node info for new depth of tree */ - shared->node_info[shared->depth].max_nrec = H5B2_NUM_INT_REC(f, shared, shared->depth); + sz_max_nrec = H5B2_NUM_INT_REC(f, shared, shared->depth); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[shared->depth].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned) shared->node_info[shared->depth].split_nrec = (shared->node_info[shared->depth].max_nrec * shared->split_percent) / 100; shared->node_info[shared->depth].merge_nrec = (shared->node_info[shared->depth].max_nrec * shared->merge_percent) / 100; shared->node_info[shared->depth].cum_max_nrec = ((shared->node_info[shared->depth].max_nrec + 1) * shared->node_info[shared->depth - 1].cum_max_nrec) + shared->node_info[shared->depth].max_nrec; - shared->node_info[shared->depth].cum_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[shared->depth].cum_max_nrec); + u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[shared->depth].cum_max_nrec); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[shared->depth].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t) if((shared->node_info[shared->depth].nat_rec_fac = H5FL_fac_init(shared->type->nrec_size * shared->node_info[shared->depth].max_nrec)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") if((shared->node_info[shared->depth].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (shared->node_info[shared->depth].max_nrec + 1))) == NULL) diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index d05220b..c5af54f 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -124,7 +124,7 @@ typedef struct { unsigned split_nrec; /* Number of records to split node at */ unsigned merge_nrec; /* Number of records to merge node at */ hsize_t cum_max_nrec; /* Cumulative max. # of records below this node's depth */ - unsigned char cum_max_nrec_size; /* Size to store cumulative max. # of records for this node (in bytes) */ + uint8_t cum_max_nrec_size; /* Size to store cumulative max. # of records for this node (in bytes) */ H5FL_fac_head_t *nat_rec_fac; /* Factory for native record blocks */ H5FL_fac_head_t *node_ptr_fac; /* Factory for node pointer blocks */ } H5B2_node_info_t; @@ -149,7 +149,7 @@ typedef struct H5B2_shared_t { unsigned depth; /* B-tree's overall depth */ /* Derived information from user's information */ - unsigned char max_nrec_size; /* Size to store max. # of records in any node (in bytes) */ + uint8_t max_nrec_size; /* Size to store max. # of records in any node (in bytes) */ } H5B2_shared_t; /* The B-tree information */ diff --git a/src/H5C.c b/src/H5C.c index 6046ef6..56b608d 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -2798,6 +2798,7 @@ static herr_t H5C_epoch_marker_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, unsigned *flags_ptr); static herr_t H5C_epoch_marker_dest(H5F_t *f, void *thing); static herr_t H5C_epoch_marker_clear(H5F_t *f, void *thing, hbool_t dest); +static herr_t H5C_epoch_marker_notify(H5C_notify_action_t action, void *thing); static herr_t H5C_epoch_marker_size(const H5F_t *f, const void *thing, size_t *size_ptr); const H5C_class_t epoch_marker_class = @@ -2888,6 +2889,20 @@ done: } static herr_t +H5C_epoch_marker_notify(H5C_notify_action_t UNUSED action, + void UNUSED * thing) +{ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5C_epoch_marker_notify) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + +static herr_t H5C_epoch_marker_size(const H5F_t UNUSED * f, const void UNUSED * thing, size_t UNUSED * size_ptr) diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 4ce321c..93e4a31 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -121,6 +121,16 @@ typedef struct H5C_t H5C_t; #define H5C_CALLBACK__SIZE_CHANGED_FLAG 0x1 #define H5C_CALLBACK__RENAMED_FLAG 0x2 +/* Actions that can be reported to 'notify' client callback */ +typedef enum H5C_notify_action_t { + H5C_NOTIFY_ACTION_AFTER_INSERT, /* Entry has been added to the cache */ + /* (could be loaded from file with + * 'protect' call, or inserted + * with 'set' call) + */ + H5C_NOTIFY_ACTION_BEFORE_EVICT /* Entry is about to be evicted from cache */ +} H5C_notify_action_t; + typedef void *(*H5C_load_func_t)(H5F_t *f, hid_t dxpl_id, haddr_t addr, @@ -137,6 +147,8 @@ typedef herr_t (*H5C_dest_func_t)(H5F_t *f, typedef herr_t (*H5C_clear_func_t)(H5F_t *f, void *thing, hbool_t dest); +typedef herr_t (*H5C_notify_func_t)(H5C_notify_action_t action, + void *thing); typedef herr_t (*H5C_size_func_t)(const H5F_t *f, const void *thing, size_t *size_ptr); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 0691a95..d972043 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -146,7 +146,7 @@ typedef struct H5D_chunk_it_ud4_t { /********************/ /* Chunked layout operation callbacks */ -static herr_t H5D_chunk_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, +static herr_t H5D_chunk_construct(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); static herr_t H5D_chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, @@ -189,7 +189,7 @@ static herr_t H5D_chunk_mem_cb(void *elem, hid_t type_id, unsigned ndims, /* Chunked storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ - H5D_chunk_new, + H5D_chunk_construct, H5D_chunk_is_space_alloc, H5D_chunk_io_init, H5D_chunk_read, @@ -242,7 +242,7 @@ H5FL_DEFINE_STATIC(H5D_chunk_prune_stack_t); /*------------------------------------------------------------------------- - * Function: H5D_chunk_new + * Function: H5D_chunk_construct * * Purpose: Constructs new chunked layout information for dataset * @@ -254,7 +254,7 @@ H5FL_DEFINE_STATIC(H5D_chunk_prune_stack_t); *------------------------------------------------------------------------- */ static herr_t -H5D_chunk_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, +H5D_chunk_construct(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist) { const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ @@ -264,7 +264,7 @@ H5D_chunk_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_new) + FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_construct) /* Sanity checks */ HDassert(f); @@ -320,7 +320,7 @@ H5D_chunk_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_chunk_new() */ +} /* end H5D_chunk_construct() */ /*------------------------------------------------------------------------- @@ -2193,6 +2193,11 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * if(H5Z_pipeline(&(dset->shared->dcpl_cache.pline), 0, &(udata.filter_mask), dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &alloc, &buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed") +#if H5_SIZEOF_SIZE_T > 4 + /* Check for the chunk expanding too much to encode in a 32-bit value */ + if(nbytes > ((size_t)0xffffffff)) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") +#endif /* H5_SIZEOF_SIZE_T > 4 */ H5_ASSIGN_OVERFLOW(udata.nbytes, nbytes, size_t, uint32_t); /* Indicate that the chunk must go through 'insert' method */ @@ -3055,6 +3060,11 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Push the chunk through the filters */ if(H5Z_pipeline(pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &orig_chunk_size, &buf_size, &fb_info.fill_buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") +#if H5_SIZEOF_SIZE_T > 4 + /* Check for the chunk expanding too much to encode in a 32-bit value */ + if(orig_chunk_size > ((size_t)0xffffffff)) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") +#endif /* H5_SIZEOF_SIZE_T > 4 */ } /* end if */ } /* end if */ @@ -3119,6 +3129,12 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) if(H5Z_pipeline(pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &buf_size, &fb_info.fill_buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") +#if H5_SIZEOF_SIZE_T > 4 + /* Check for the chunk expanding too much to encode in a 32-bit value */ + if(nbytes > ((size_t)0xffffffff)) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") +#endif /* H5_SIZEOF_SIZE_T > 4 */ + /* Keep the number of bytes the chunk turned in to */ chunk_size = nbytes; } /* end if */ @@ -3826,7 +3842,7 @@ H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout) idx_info.layout = layout; /* Delete the chunked storage information in the file */ - if((layout->u.chunk.ops->delete)(&idx_info) < 0) + if((layout->u.chunk.ops->idx_delete)(&idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk index") done: @@ -4085,6 +4101,11 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if(has_filters && (is_vlen || fix_ref) ) { if(H5Z_pipeline(pline, 0, &(udata_dst.filter_mask), H5Z_NO_EDC, cb_struct, &nbytes, &buf_size, &buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed") +#if H5_SIZEOF_SIZE_T > 4 + /* Check for the chunk expanding too much to encode in a 32-bit value */ + if(nbytes > ((size_t)0xffffffff)) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") +#endif /* H5_SIZEOF_SIZE_T > 4 */ H5_ASSIGN_OVERFLOW(udata_dst.nbytes, nbytes, size_t, uint32_t); udata->buf = buf; udata->buf_size = buf_size; diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index ad95e18..f773f5f 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -57,7 +57,7 @@ /********************/ /* Layout operation callbacks */ -static herr_t H5D_compact_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, +static herr_t H5D_compact_construct(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); static hbool_t H5D_compact_is_space_alloc(const H5O_layout_t *layout); static herr_t H5D_compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, @@ -77,7 +77,7 @@ static ssize_t H5D_compact_writevv(const H5D_io_info_t *io_info, /* Compact storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{ - H5D_compact_new, + H5D_compact_construct, H5D_compact_is_space_alloc, H5D_compact_io_init, H5D_contig_read, @@ -154,7 +154,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_compact_new + * Function: H5D_compact_construct * * Purpose: Constructs new compact layout information for dataset * @@ -167,14 +167,14 @@ done: */ /* ARGSUSED */ static herr_t -H5D_compact_new(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset, +H5D_compact_construct(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset, const H5P_genplist_t UNUSED *dc_plist) { hssize_t tmp_size; /* Temporary holder for raw data size */ hsize_t comp_data_size; /* Size of compact data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_compact_new) + FUNC_ENTER_NOAPI_NOINIT(H5D_compact_construct) /* Sanity checks */ HDassert(f); @@ -197,7 +197,7 @@ H5D_compact_new(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dse done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_compact_new() */ +} /* end H5D_compact_construct() */ /*------------------------------------------------------------------------- diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 112eea5..1275ee1 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -61,7 +61,7 @@ /********************/ /* Layout operation callbacks */ -static herr_t H5D_contig_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, +static herr_t H5D_contig_construct(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); static hbool_t H5D_contig_is_space_alloc(const H5O_layout_t *layout); static herr_t H5D_contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, @@ -79,7 +79,7 @@ static herr_t H5D_contig_write_one(H5D_io_info_t *io_info, hsize_t offset, /* Contiguous storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{ - H5D_contig_new, + H5D_contig_construct, H5D_contig_is_space_alloc, H5D_contig_io_init, H5D_contig_read, @@ -360,7 +360,7 @@ H5D_contig_get_addr(const H5D_t *dset) /*------------------------------------------------------------------------- - * Function: H5D_contig_new + * Function: H5D_contig_construct * * Purpose: Constructs new contiguous layout information for dataset * @@ -373,17 +373,20 @@ H5D_contig_get_addr(const H5D_t *dset) */ /* ARGSUSED */ static herr_t -H5D_contig_new(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset, +H5D_contig_construct(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset, const H5P_genplist_t UNUSED *dc_plist) { - hssize_t tmp_size; /* Temporary holder for raw data size */ + hssize_t snelmts; /* Temporary holder for number of elements in dataspace */ + hsize_t nelmts; /* Number of elements in dataspace */ + size_t dt_size; /* Size of datatype */ + hsize_t tmp_size; /* Temporary holder for raw data size */ hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */ hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ int ndims; /* Rank of dataspace */ int i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_contig_new) + FUNC_ENTER_NOAPI_NOINIT(H5D_contig_construct) /* Sanity checks */ HDassert(f); @@ -402,16 +405,31 @@ H5D_contig_new(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset if(max_dim[i] > dim[i]) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible contiguous non-external dataset") - /* Compute the total size of dataset */ - tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(dset->shared->type); - H5_ASSIGN_OVERFLOW(dset->shared->layout.u.contig.size, tmp_size, hssize_t, hsize_t); + /* Retrieve the number of elements in the dataspace */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace") + nelmts = (hsize_t)snelmts; + + /* Get the datatype's size */ + if(0 == (dt_size = H5T_GET_SIZE(dset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") + + /* Compute the size of the dataset's contiguous storage */ + tmp_size = nelmts * dt_size; + + /* Check for overflow during multiplication */ + if(nelmts != (tmp_size / dt_size)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") + + /* Assign the dataset's contiguous storage size */ + dset->shared->layout.u.contig.size = tmp_size; /* Get the sieve buffer size for this dataset */ dset->shared->cache.contig.sieve_buf_size = H5F_SIEVE_BUF_SIZE(f); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_contig_new() */ +} /* end H5D_contig_construct() */ /*------------------------------------------------------------------------- diff --git a/src/H5Defl.c b/src/H5Defl.c index f3b346e..a22ca2d 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -49,7 +49,7 @@ /********************/ /* Layout operation callbacks */ -static herr_t H5D_efl_new(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, +static herr_t H5D_efl_construct(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); static hbool_t H5D_efl_is_space_alloc(const H5O_layout_t *layout); static herr_t H5D_efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, @@ -75,7 +75,7 @@ static herr_t H5D_efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, /* External File List (EFL) storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ - H5D_efl_new, + H5D_efl_construct, H5D_efl_is_space_alloc, H5D_efl_io_init, H5D_contig_read, @@ -97,7 +97,7 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ /*------------------------------------------------------------------------- - * Function: H5D_efl_new + * Function: H5D_efl_construct * * Purpose: Constructs new EFL layout information for dataset * @@ -109,7 +109,7 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ *------------------------------------------------------------------------- */ static herr_t -H5D_efl_new(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset, +H5D_efl_construct(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist) { size_t dt_size; /* Size of datatype */ @@ -122,7 +122,7 @@ H5D_efl_new(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset, int i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_efl_new) + FUNC_ENTER_NOAPI_NOINIT(H5D_efl_construct) /* Sanity checks */ HDassert(f); @@ -167,7 +167,7 @@ H5D_efl_new(H5F_t *f, hid_t UNUSED dapl_id, hid_t UNUSED dxpl_id, H5D_t *dset, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_efl_new() */ +} /* end H5D_efl_construct() */ /*------------------------------------------------------------------------- diff --git a/src/H5Dint.c b/src/H5Dint.c index 0e71ef8..00bc347 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -457,8 +457,9 @@ H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id) { H5S_t *space; /* Dataset's dataspace */ hsize_t space_allocated; /* The number of bytes allocated for chunks */ - hssize_t total_elem; /* The total number of elements in dataspace */ - size_t type_size; /* The size of the datatype for the dataset */ + hssize_t snelmts; /* Temporary holder for number of elements in dataspace */ + hsize_t nelmts; /* Number of elements in dataspace */ + size_t dt_size; /* Size of datatype */ hsize_t full_size; /* The number of bytes in the dataset when fully populated */ herr_t ret_value = SUCCEED; @@ -471,16 +472,20 @@ H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id) HDassert(space); /* Get the total number of elements in dataset's dataspace */ - if((total_elem=H5S_GET_EXTENT_NPOINTS(space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get # of dataspace elements") + if((snelmts = H5S_GET_EXTENT_NPOINTS(space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace") + nelmts = (hsize_t)snelmts; /* Get the size of the dataset's datatype */ - if((type_size = H5T_get_size(dset->shared->type)) == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get size of datatype") + if(0 == (dt_size = H5T_GET_SIZE(dset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") /* Compute the maximum size of the dataset in bytes */ - H5_CHECK_OVERFLOW(total_elem,hssize_t,hsize_t); - full_size=((hsize_t)total_elem)*type_size; + full_size = nelmts * dt_size; + + /* Check for overflow during multiplication */ + if(nelmts != (full_size / dt_size)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ space_allocated = H5D_get_storage_size(dset, dxpl_id); @@ -1132,7 +1137,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize I/O operations") /* Create the layout information for the new dataset */ - if((new_dset->shared->layout.ops->new)(file, dapl_id, dxpl_id, new_dset, dc_plist) < 0) + if((new_dset->shared->layout.ops->construct)(file, dapl_id, dxpl_id, new_dset, dc_plist) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize layout information") /* Indicate that the layout information was initialized */ @@ -1392,10 +1397,29 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04 */ if(dataset->shared->layout.version < 3) { - hssize_t tmp_size; /* Temporary holder for raw data size */ + hssize_t snelmts; /* Temporary holder for number of elements in dataspace */ + hsize_t nelmts; /* Number of elements in dataspace */ + size_t dt_size; /* Size of datatype */ + hsize_t tmp_size; /* Temporary holder for raw data size */ + + /* Retrieve the number of elements in the dataspace */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(dataset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace") + nelmts = (hsize_t)snelmts; + + /* Get the datatype's size */ + if(0 == (dt_size = H5T_GET_SIZE(dataset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") + + /* Compute the size of the dataset's contiguous storage */ + tmp_size = nelmts * dt_size; + + /* Check for overflow during multiplication */ + if(nelmts != (tmp_size / dt_size)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") - tmp_size = H5S_GET_EXTENT_NPOINTS(dataset->shared->space) * H5T_get_size(dataset->shared->type); - H5_ASSIGN_OVERFLOW(dataset->shared->layout.u.contig.size, tmp_size, hssize_t, hsize_t); + /* Assign the dataset's contiguous storage size */ + dataset->shared->layout.u.contig.size = tmp_size; } /* end if */ /* Get the sieve buffer size for this dataset */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 6693348..afa9201 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -956,7 +956,10 @@ if(H5DEBUG(D)) /* Chunk address relative to the first chunk */ chunk_addr_info_array[u].chunk_addr -= ctg_store.contig.dset_addr; - H5_ASSIGN_OVERFLOW(chunk_disp_array[u], chunk_addr_info_array[u].chunk_addr, haddr_t, MPI_Aint); + + /* Assign chunk address to MPI displacement */ + /* (assume MPI_Aint big enough to hold it) */ + chunk_disp_array[u] = (MPI_Aint)chunk_addr_info_array[u].chunk_addr; } /* end for */ /* Initialize the buffer with the constant value 1 */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 791e223..69126ee 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -100,7 +100,7 @@ struct H5D_io_info_t; struct H5D_chunk_map_t; /* Function pointers for I/O on particular types of dataset layouts */ -typedef herr_t (*H5D_layout_new_func_t)(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, +typedef herr_t (*H5D_layout_construct_func_t)(H5F_t *f, hid_t dapl_id, hid_t dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist); typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_layout_t *layout); typedef herr_t (*H5D_layout_io_init_func_t)(const struct H5D_io_info_t *io_info, @@ -123,7 +123,7 @@ typedef herr_t (*H5D_layout_io_term_func_t)(const struct H5D_chunk_map_t *cm); /* Typedef for grouping layout I/O routines */ typedef struct H5D_layout_ops_t { - H5D_layout_new_func_t new; /* Layout constructor for new datasets */ + H5D_layout_construct_func_t construct; /* Layout constructor for new datasets */ H5D_layout_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage is allocated */ H5D_layout_io_init_func_t io_init; /* I/O initialization routine */ H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */ @@ -177,6 +177,11 @@ typedef union H5D_storage_t { } H5D_storage_t; /* Typedef for raw data I/O operation info */ +typedef enum H5D_io_op_type_t { + H5D_IO_OP_READ, /* Read operation */ + H5D_IO_OP_WRITE /* Write operation */ +} H5D_io_op_type_t; + typedef struct H5D_io_info_t { H5D_t *dset; /* Pointer to dataset being operated on */ #ifndef H5_HAVE_PARALLEL @@ -196,10 +201,7 @@ typedef struct H5D_io_info_t { H5D_storage_t *store; /* Dataset storage info */ H5D_layout_ops_t layout_ops; /* Dataset layout I/O operation function pointers */ H5D_io_ops_t io_ops; /* I/O operation function pointers */ - enum { - H5D_IO_OP_READ, /* Read operation */ - H5D_IO_OP_WRITE /* Write operation */ - } op_type; + H5D_io_op_type_t op_type; union { void *rbuf; /* Pointer to buffer for read */ const void *wbuf; /* Pointer to buffer to write */ @@ -294,7 +296,7 @@ typedef struct H5D_chunk_ops_t { H5D_chunk_get_addr_func_t get_addr; /* Routine to retrieve address of chunk in file */ H5D_chunk_iterate_func_t iterate; /* Routine to iterate over chunks */ H5D_chunk_remove_func_t remove; /* Routine to remove a chunk from an index */ - H5D_chunk_delete_func_t delete; /* Routine to delete index & all chunks from file*/ + H5D_chunk_delete_func_t idx_delete; /* Routine to delete index & all chunks from file*/ H5D_chunk_copy_setup_func_t copy_setup; /* Routine to perform any necessary setup for copying chunks */ H5D_chunk_copy_shutdown_func_t copy_shutdown; /* Routine to perform any necessary shutdown for copying chunks */ H5D_chunk_size_func_t size; /* Routine to get size of indexing information */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 05ce10e..6b1c80c 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -40,7 +40,7 @@ typedef struct H5E_t H5E_t; */ #define HCOMMON_ERROR(maj, min, str) \ HERROR(maj, min, str); \ - (void)H5E_dump_api_stack((int)H5_IS_API(FUNC)); + err_occurred = TRUE; /* * HDONE_ERROR macro, used to facilitate error reporting between a diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index ac669d6..5f035f8 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -422,9 +422,6 @@ H5FD_sec2_close(H5FD_t *_file) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_close, FAIL) -#ifdef QAK -HDfprintf(stderr, "%s: file->eof = %a, file->eoa = %a\n", FUNC, file->eof, file->eoa); -#endif /* QAK */ /* Sanity check */ HDassert(file); @@ -863,9 +860,6 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_truncate, FAIL) -#ifdef QAK -HDfprintf(stderr, "%s: file->eof = %a, file->eoa = %a\n", FUNC, file->eof, file->eoa); -#endif /* QAK */ HDassert(file); diff --git a/src/H5FL.c b/src/H5FL.c index dca300c..c72491d 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -101,10 +101,10 @@ typedef struct H5FL_blk_gc_list_t { static H5FL_blk_gc_list_t H5FL_blk_gc_head={0,NULL}; /* A garbage collection node for factory free lists */ -typedef struct H5FL_fac_gc_node_t { +struct H5FL_fac_gc_node_t { H5FL_fac_head_t *list; /* Pointer to the head of the list to garbage collect */ struct H5FL_fac_gc_node_t *next; /* Pointer to the next node in the list of things to garbage collect */ -} H5FL_fac_gc_node_t; +}; /* The garbage collection head for factory free lists */ typedef struct H5FL_fac_gc_list_t { @@ -113,18 +113,8 @@ typedef struct H5FL_fac_gc_list_t { } H5FL_fac_gc_list_t; /* Data structure to store each block in factory free list */ -typedef struct H5FL_fac_node_t { +struct H5FL_fac_node_t { struct H5FL_fac_node_t *next; /* Pointer to next block in free list */ -} H5FL_fac_node_t; - -/* Data structure for free list block factory */ -struct H5FL_fac_head_t { - unsigned init; /* Whether the free list has been initialized */ - unsigned allocated; /* Number of blocks allocated */ - unsigned onlist; /* Number of blocks on free list */ - size_t size; /* Size of the blocks in the list */ - H5FL_fac_node_t *list; /* List of free blocks */ - H5FL_fac_gc_node_t *prev_gc; /* Previous garbage collection node in list */ }; /* The head of the list of factory things to garbage collect */ diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 4bc4005..cd7e31d 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -348,8 +348,20 @@ typedef struct H5FL_seq_head_t { #define H5FL_SEQ_REALLOC(t,obj,new_elem) (t *)H5MM_realloc(obj,(new_elem)*sizeof(t)) #endif /* H5_NO_SEQ_FREE_LISTS */ -/* Forward declaration of the data structure for free list block factory */ -typedef struct H5FL_fac_head_t H5FL_fac_head_t; +/* Forward declarations of the data structures for free list block factory */ +typedef struct H5FL_fac_gc_node_t H5FL_fac_gc_node_t; +typedef struct H5FL_fac_node_t H5FL_fac_node_t; + +/* Data structure for free list block factory */ +typedef struct H5FL_fac_head_t { + unsigned init; /* Whether the free list has been initialized */ + unsigned allocated; /* Number of blocks allocated */ + unsigned onlist; /* Number of blocks on free list */ + size_t size; /* Size of the blocks in the list */ + H5FL_fac_node_t *list; /* List of free blocks */ + H5FL_fac_gc_node_t *prev_gc; /* Previous garbage collection node in list */ +} H5FL_fac_head_t; + /* * Macros for defining & using free list factories diff --git a/src/H5FScache.c b/src/H5FScache.c index a7af72b..c215985 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -201,7 +201,7 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version") /* Client ID */ - fspace->client = *p++; + fspace->client = (H5FS_client_t)*p++; if(fspace->client >= H5FS_NUM_CLIENT_ID) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 77e6d1a..9ad6c70 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -232,7 +232,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") /* Re-protect the section info with read-write access */ - if(NULL == (fspace->sinfo = H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, H5AC_WRITE))) + if(NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, H5AC_WRITE))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to load free space sections") /* Switch the access mode we have */ @@ -251,7 +251,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); #endif /* H5FS_SINFO_DEBUG */ /* Protect the free space sections */ - if(NULL == (fspace->sinfo = H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, accmode))) + if(NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, accmode))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to load free space sections") /* Remember that we protected the section info & the access mode */ @@ -1186,7 +1186,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) greater_sect_node_valid = TRUE; /* Get section for 'less than' skip list node */ - tmp_sect = H5SL_item(less_sect_node); + tmp_sect = (H5FS_section_info_t *)H5SL_item(less_sect_node); /* Get classes for right & left sections */ tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; @@ -1229,7 +1229,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) /* Check for node after new node able to merge with new node */ if(greater_sect_node) { /* Get section for 'greater than' skip list node */ - tmp_sect = H5SL_item(greater_sect_node); + tmp_sect = (H5FS_section_info_t *)H5SL_item(greater_sect_node); /* Get classes for right & left sections */ sect_cls = &fspace->sect_cls[(*sect)->type]; @@ -1307,7 +1307,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); /* Check for last node in the merge list */ if(NULL != (last_node = H5SL_last(fspace->sinfo->merge_list))) { /* Get the pointer to the last section, from the last node */ - *sect = H5SL_item(last_node); + *sect = (H5FS_section_info_t *)H5SL_item(last_node); HDassert(*sect); /* Indicate that this section needs to be removed if it causes a shrink */ @@ -1500,7 +1500,7 @@ if(_section_) */ /* Look for a section after block to extend */ - if((sect = H5SL_greater(fspace->sinfo->merge_list, &addr))) { + if((sect = (H5FS_section_info_t *)H5SL_greater(fspace->sinfo->merge_list, &addr))) { /* Check if this section adjoins the block and is large enough to * fulfill extension request. * @@ -1640,10 +1640,10 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); H5SL_node_t *curr_sect_node=NULL; /* Get the free space node for free space sections of the same size */ - curr_fspace_node = H5SL_item(curr_size_node); + curr_fspace_node = (H5FS_node_t *)H5SL_item(curr_size_node); /* Get the Skip list which holds pointers to actual free list sections */ - curr_sect_node = H5SL_first(curr_fspace_node->sect_list); + curr_sect_node = (H5SL_node_t *)H5SL_first(curr_fspace_node->sect_list); while(curr_sect_node != NULL) { H5FS_section_info_t *curr_sect=NULL; @@ -1651,7 +1651,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); H5FS_section_info_t *split_sect=NULL; /* Get section node */ - curr_sect = H5SL_item(curr_sect_node); + curr_sect = (H5FS_section_info_t *)H5SL_item(curr_sect_node); HDassert(H5F_addr_defined(curr_sect->addr)); HDassert(curr_fspace_node->sect_size == curr_sect->size); @@ -1666,7 +1666,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); if ((curr_sect->size >= (request + frag_size)) && (cls->split)) { /* remove the section with aligned address */ - if(NULL == (*node = H5SL_remove(curr_fspace_node->sect_list, &curr_sect->addr))) + if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove(curr_fspace_node->sect_list, &curr_sect->addr))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") /* Decrement # of sections in section size node */ if(H5FS_size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 0840ee7..3d25109 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -144,13 +144,15 @@ struct H5G_t { typedef herr_t (*H5G_lib_iterate_t)(const H5O_link_t *lnk, void *op_data); /* Describe kind of callback to make for each link */ -typedef struct { - enum { +typedef enum H5G_link_iterate_op_type_t { #ifndef H5_NO_DEPRECATED_SYMBOLS - H5G_LINK_OP_OLD, /* "Old" application callback */ + H5G_LINK_OP_OLD, /* "Old" application callback */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5G_LINK_OP_NEW /* "New" application callback */ - } op_type; + H5G_LINK_OP_NEW /* "New" application callback */ +} H5G_link_iterate_op_type_t; + +typedef struct { + H5G_link_iterate_op_type_t op_type; union { #ifndef H5_NO_DEPRECATED_SYMBOLS H5G_iterate_t op_old; /* "Old" application callback for each link */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 82f6b12..c9c4b27 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -539,11 +539,13 @@ typedef herr_t (*H5O_lib_operator_t)(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, hbool_t *oh_modified/*out*/, void *operator_data/*in,out*/); /* Some syntactic sugar to make the compiler happy with two different kinds of iterator callbacks */ +typedef enum H5O_mesg_operator_type_t { + H5O_MESG_OP_APP, /* Application callback */ + H5O_MESG_OP_LIB /* Library internal callback */ +} H5O_mesg_operator_type_t; + typedef struct { - enum { - H5O_MESG_OP_APP, /* Application callback */ - H5O_MESG_OP_LIB /* Library internal callback */ - } op_type; + H5O_mesg_operator_type_t op_type; union { H5O_operator_t app_op; /* Application callback for each message */ H5O_lib_operator_t lib_op; /* Library internal callback for each message */ diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index 7cda2c8..c0bcd70 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -94,9 +94,9 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, /* Set the uncompression parameters */ HDmemset(&z_strm, 0, sizeof(z_strm)); z_strm.next_in = *buf; - H5_ASSIGN_OVERFLOW(z_strm.avail_in,nbytes,size_t,uInt); + H5_ASSIGN_OVERFLOW(z_strm.avail_in,nbytes,size_t,unsigned); z_strm.next_out = outbuf; - H5_ASSIGN_OVERFLOW(z_strm.avail_out,nalloc,size_t,uInt); + H5_ASSIGN_OVERFLOW(z_strm.avail_out,nalloc,size_t,unsigned); /* Initialize the uncompression routines */ if (Z_OK!=inflateInit(&z_strm)) diff --git a/src/H5config.h.in b/src/H5config.h.in index a3e879b..8ac19fc 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -584,6 +584,9 @@ /* The size of `uint_least8_t', as computed by sizeof. */ #undef SIZEOF_UINT_LEAST8_T +/* The size of `unsigned', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED + /* The size of `__int64', as computed by sizeof. */ #undef SIZEOF___INT64 diff --git a/src/H5overflow.h b/src/H5overflow.h new file mode 100644 index 0000000..1c00acf --- /dev/null +++ b/src/H5overflow.h @@ -0,0 +1,1381 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Generated automatically by bin/make_overflow -- do not edit */ +/* Add new types to H5overflow.txt file */ + + +#ifndef _H5overflow_H +#define _H5overflow_H + + +/* Each type in this file is tested for assignment to the other types, + * and range checks are defined for bad assignments at run-time. + */ + +/* Assignment checks for unsigned */ + +/* src: unsigned, dst: int */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_INT + #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_INT + #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_INT */ + #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: int */ + +/* src: unsigned, dst: uint8_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT8_T + #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT8_T + #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT8_T */ + #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: uint8_t */ + +/* src: unsigned, dst: uint32_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT32_T + #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT32_T + #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT32_T */ + #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: uint32_t */ + +/* src: unsigned, dst: uint64_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT64_T + #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT64_T + #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT64_T */ + #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: uint64_t */ + +/* src: unsigned, dst: size_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_SIZE_T + #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_SIZE_T + #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_SIZE_T */ + #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: size_t */ + +/* src: unsigned, dst: ssize_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_SSIZE_T + #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_SSIZE_T + #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: ssize_t */ + +/* src: unsigned, dst: haddr_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HADDR_T + #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HADDR_T + #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HADDR_T */ + #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: haddr_t */ + +/* src: unsigned, dst: hsize_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HSIZE_T + #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HSIZE_T + #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: hsize_t */ + +/* src: unsigned, dst: hssize_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HSSIZE_T + #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HSSIZE_T + #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: hssize_t */ + +/* src: unsigned, dst: h5_stat_size_t */ +#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: unsigned dst: h5_stat_size_t */ + + +/* Assignment checks for int */ + +/* src: int, dst: unsigned */ +#if H5_SIZEOF_INT < H5_SIZEOF_UNSIGNED + #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_UNSIGNED + #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: unsigned */ + +/* src: int, dst: uint8_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_UINT8_T + #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_UINT8_T + #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_UINT8_T */ + #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: uint8_t */ + +/* src: int, dst: uint32_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_UINT32_T + #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_UINT32_T + #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_UINT32_T */ + #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: uint32_t */ + +/* src: int, dst: uint64_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_UINT64_T + #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_UINT64_T + #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_UINT64_T */ + #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: uint64_t */ + +/* src: int, dst: size_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_SIZE_T + #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_SIZE_T + #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_SIZE_T */ + #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: size_t */ + +/* src: int, dst: ssize_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_SSIZE_T + #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_SSIZE_T + #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: ssize_t */ + +/* src: int, dst: haddr_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_HADDR_T + #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_HADDR_T + #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_HADDR_T */ + #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: haddr_t */ + +/* src: int, dst: hsize_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_HSIZE_T + #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_HSIZE_T + #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: hsize_t */ + +/* src: int, dst: hssize_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_HSSIZE_T + #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_HSSIZE_T + #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: hssize_t */ + +/* src: int, dst: h5_stat_size_t */ +#if H5_SIZEOF_INT < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_INT > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_INT == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: int dst: h5_stat_size_t */ + + +/* Assignment checks for uint8_t */ + +/* src: uint8_t, dst: unsigned */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: unsigned */ + +/* src: uint8_t, dst: int */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_INT + #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_INT + #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_INT */ + #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: int */ + +/* src: uint8_t, dst: uint32_t */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_UINT32_T + #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UINT32_T + #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UINT32_T */ + #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: uint32_t */ + +/* src: uint8_t, dst: uint64_t */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_UINT64_T + #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UINT64_T + #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UINT64_T */ + #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: uint64_t */ + +/* src: uint8_t, dst: size_t */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_SIZE_T + #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_SIZE_T + #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_SIZE_T */ + #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: size_t */ + +/* src: uint8_t, dst: ssize_t */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_SSIZE_T + #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_SSIZE_T + #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: ssize_t */ + +/* src: uint8_t, dst: haddr_t */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_HADDR_T + #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HADDR_T + #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HADDR_T */ + #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: haddr_t */ + +/* src: uint8_t, dst: hsize_t */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_HSIZE_T + #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HSIZE_T + #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: hsize_t */ + +/* src: uint8_t, dst: hssize_t */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_HSSIZE_T + #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HSSIZE_T + #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: hssize_t */ + +/* src: uint8_t, dst: h5_stat_size_t */ +#if H5_SIZEOF_UINT8_T < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint8_t dst: h5_stat_size_t */ + + +/* Assignment checks for uint32_t */ + +/* src: uint32_t, dst: unsigned */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: unsigned */ + +/* src: uint32_t, dst: int */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_INT + #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_INT + #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_INT */ + #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: int */ + +/* src: uint32_t, dst: uint8_t */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_UINT8_T + #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UINT8_T + #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UINT8_T */ + #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: uint8_t */ + +/* src: uint32_t, dst: uint64_t */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_UINT64_T + #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UINT64_T + #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UINT64_T */ + #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: uint64_t */ + +/* src: uint32_t, dst: size_t */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_SIZE_T + #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_SIZE_T + #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_SIZE_T */ + #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: size_t */ + +/* src: uint32_t, dst: ssize_t */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_SSIZE_T + #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_SSIZE_T + #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: ssize_t */ + +/* src: uint32_t, dst: haddr_t */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_HADDR_T + #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HADDR_T + #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HADDR_T */ + #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: haddr_t */ + +/* src: uint32_t, dst: hsize_t */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_HSIZE_T + #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HSIZE_T + #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: hsize_t */ + +/* src: uint32_t, dst: hssize_t */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_HSSIZE_T + #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HSSIZE_T + #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: hssize_t */ + +/* src: uint32_t, dst: h5_stat_size_t */ +#if H5_SIZEOF_UINT32_T < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint32_t dst: h5_stat_size_t */ + + +/* Assignment checks for uint64_t */ + +/* src: uint64_t, dst: unsigned */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: unsigned */ + +/* src: uint64_t, dst: int */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_INT + #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_INT + #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_INT */ + #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: int */ + +/* src: uint64_t, dst: uint8_t */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_UINT8_T + #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UINT8_T + #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UINT8_T */ + #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: uint8_t */ + +/* src: uint64_t, dst: uint32_t */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_UINT32_T + #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UINT32_T + #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UINT32_T */ + #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: uint32_t */ + +/* src: uint64_t, dst: size_t */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_SIZE_T + #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_SIZE_T + #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_SIZE_T */ + #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: size_t */ + +/* src: uint64_t, dst: ssize_t */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_SSIZE_T + #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_SSIZE_T + #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: ssize_t */ + +/* src: uint64_t, dst: haddr_t */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_HADDR_T + #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HADDR_T + #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HADDR_T */ + #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: haddr_t */ + +/* src: uint64_t, dst: hsize_t */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_HSIZE_T + #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HSIZE_T + #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: hsize_t */ + +/* src: uint64_t, dst: hssize_t */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_HSSIZE_T + #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HSSIZE_T + #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: hssize_t */ + +/* src: uint64_t, dst: h5_stat_size_t */ +#if H5_SIZEOF_UINT64_T < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: uint64_t dst: h5_stat_size_t */ + + +/* Assignment checks for size_t */ + +/* src: size_t, dst: unsigned */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: unsigned */ + +/* src: size_t, dst: int */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_INT + #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_INT + #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_INT */ + #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: int */ + +/* src: size_t, dst: uint8_t */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT8_T + #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT8_T + #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT8_T */ + #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: uint8_t */ + +/* src: size_t, dst: uint32_t */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT32_T + #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT32_T + #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT32_T */ + #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: uint32_t */ + +/* src: size_t, dst: uint64_t */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT64_T + #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT64_T + #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT64_T */ + #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: uint64_t */ + +/* src: size_t, dst: ssize_t */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_SSIZE_T + #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_SSIZE_T + #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: ssize_t */ + +/* src: size_t, dst: haddr_t */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_HADDR_T + #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HADDR_T + #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HADDR_T */ + #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: haddr_t */ + +/* src: size_t, dst: hsize_t */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_HSIZE_T + #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HSIZE_T + #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: hsize_t */ + +/* src: size_t, dst: hssize_t */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_HSSIZE_T + #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HSSIZE_T + #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: hssize_t */ + +/* src: size_t, dst: h5_stat_size_t */ +#if H5_SIZEOF_SIZE_T < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: size_t dst: h5_stat_size_t */ + + +/* Assignment checks for ssize_t */ + +/* src: ssize_t, dst: unsigned */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: unsigned */ + +/* src: ssize_t, dst: int */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_INT + #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_INT + #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_INT */ + #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: int */ + +/* src: ssize_t, dst: uint8_t */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT8_T + #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT8_T + #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT8_T */ + #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: uint8_t */ + +/* src: ssize_t, dst: uint32_t */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT32_T + #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT32_T + #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT32_T */ + #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: uint32_t */ + +/* src: ssize_t, dst: uint64_t */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT64_T + #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT64_T + #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT64_T */ + #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: uint64_t */ + +/* src: ssize_t, dst: size_t */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_SIZE_T + #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_SIZE_T + #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_SIZE_T */ + #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: size_t */ + +/* src: ssize_t, dst: haddr_t */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HADDR_T + #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HADDR_T + #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HADDR_T */ + #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: haddr_t */ + +/* src: ssize_t, dst: hsize_t */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HSIZE_T + #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HSIZE_T + #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: hsize_t */ + +/* src: ssize_t, dst: hssize_t */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HSSIZE_T + #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HSSIZE_T + #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: hssize_t */ + +/* src: ssize_t, dst: h5_stat_size_t */ +#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: ssize_t dst: h5_stat_size_t */ + + +/* Assignment checks for haddr_t */ + +/* src: haddr_t, dst: unsigned */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: unsigned */ + +/* src: haddr_t, dst: int */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_INT + #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_INT + #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_INT */ + #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: int */ + +/* src: haddr_t, dst: uint8_t */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT8_T + #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT8_T + #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT8_T */ + #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: uint8_t */ + +/* src: haddr_t, dst: uint32_t */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT32_T + #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT32_T + #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT32_T */ + #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: uint32_t */ + +/* src: haddr_t, dst: uint64_t */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT64_T + #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT64_T + #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT64_T */ + #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: uint64_t */ + +/* src: haddr_t, dst: size_t */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_SIZE_T + #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_SIZE_T + #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_SIZE_T */ + #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: size_t */ + +/* src: haddr_t, dst: ssize_t */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_SSIZE_T + #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_SSIZE_T + #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: ssize_t */ + +/* src: haddr_t, dst: hsize_t */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_HSIZE_T + #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_HSIZE_T + #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: hsize_t */ + +/* src: haddr_t, dst: hssize_t */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_HSSIZE_T + #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_HSSIZE_T + #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: hssize_t */ + +/* src: haddr_t, dst: h5_stat_size_t */ +#if H5_SIZEOF_HADDR_T < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: haddr_t dst: h5_stat_size_t */ + + +/* Assignment checks for hsize_t */ + +/* src: hsize_t, dst: unsigned */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: unsigned */ + +/* src: hsize_t, dst: int */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_INT + #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_INT + #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_INT */ + #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: int */ + +/* src: hsize_t, dst: uint8_t */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT8_T + #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT8_T + #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT8_T */ + #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: uint8_t */ + +/* src: hsize_t, dst: uint32_t */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT32_T + #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT32_T + #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT32_T */ + #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: uint32_t */ + +/* src: hsize_t, dst: uint64_t */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT64_T + #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT64_T + #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT64_T */ + #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: uint64_t */ + +/* src: hsize_t, dst: size_t */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_SIZE_T + #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_SIZE_T + #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_SIZE_T */ + #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: size_t */ + +/* src: hsize_t, dst: ssize_t */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_SSIZE_T + #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_SSIZE_T + #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: ssize_t */ + +/* src: hsize_t, dst: haddr_t */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_HADDR_T + #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_HADDR_T + #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_HADDR_T */ + #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: haddr_t */ + +/* src: hsize_t, dst: hssize_t */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_HSSIZE_T + #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_HSSIZE_T + #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: hssize_t */ + +/* src: hsize_t, dst: h5_stat_size_t */ +#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hsize_t dst: h5_stat_size_t */ + + +/* Assignment checks for hssize_t */ + +/* src: hssize_t, dst: unsigned */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: unsigned */ + +/* src: hssize_t, dst: int */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_INT + #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_INT + #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_INT */ + #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: int */ + +/* src: hssize_t, dst: uint8_t */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT8_T + #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT8_T + #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT8_T */ + #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: uint8_t */ + +/* src: hssize_t, dst: uint32_t */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT32_T + #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT32_T + #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT32_T */ + #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: uint32_t */ + +/* src: hssize_t, dst: uint64_t */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT64_T + #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT64_T + #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT64_T */ + #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: uint64_t */ + +/* src: hssize_t, dst: size_t */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_SIZE_T + #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_SIZE_T + #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_SIZE_T */ + #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: size_t */ + +/* src: hssize_t, dst: ssize_t */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_SSIZE_T + #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_SSIZE_T + #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: ssize_t */ + +/* src: hssize_t, dst: haddr_t */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_HADDR_T + #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_HADDR_T + #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_HADDR_T */ + #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: haddr_t */ + +/* src: hssize_t, dst: hsize_t */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_HSIZE_T + #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_HSIZE_T + #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: hsize_t */ + +/* src: hssize_t, dst: h5_stat_size_t */ +#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T + #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ + #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) +#endif /* src: hssize_t dst: h5_stat_size_t */ + + +/* Assignment checks for h5_stat_size_t */ + +/* src: h5_stat_size_t, dst: unsigned */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UNSIGNED + #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UNSIGNED + #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UNSIGNED */ + #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: unsigned */ + +/* src: h5_stat_size_t, dst: int */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_INT + #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_INT + #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_INT */ + #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: int */ + +/* src: h5_stat_size_t, dst: uint8_t */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT8_T + #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT8_T + #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT8_T */ + #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: uint8_t */ + +/* src: h5_stat_size_t, dst: uint32_t */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT32_T + #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT32_T + #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT32_T */ + #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: uint32_t */ + +/* src: h5_stat_size_t, dst: uint64_t */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT64_T + #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT64_T + #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT64_T */ + #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: uint64_t */ + +/* src: h5_stat_size_t, dst: size_t */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_SIZE_T + #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_SIZE_T + #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_SIZE_T */ + #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: size_t */ + +/* src: h5_stat_size_t, dst: ssize_t */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_SSIZE_T + #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_SSIZE_T + #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_SSIZE_T */ + #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: ssize_t */ + +/* src: h5_stat_size_t, dst: haddr_t */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HADDR_T + #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HADDR_T + #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HADDR_T */ + #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: haddr_t */ + +/* src: h5_stat_size_t, dst: hsize_t */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HSIZE_T + #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HSIZE_T + #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HSIZE_T */ + #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: hsize_t */ + +/* src: h5_stat_size_t, dst: hssize_t */ +#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HSSIZE_T + #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HSSIZE_T + #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) +#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HSSIZE_T */ + #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ + ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) +#endif /* src: h5_stat_size_t dst: hssize_t */ + +#endif /* H5overflow_H */ + diff --git a/src/H5overflow.txt b/src/H5overflow.txt new file mode 100644 index 0000000..ea62fa0 --- /dev/null +++ b/src/H5overflow.txt @@ -0,0 +1,43 @@ +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +# This file is used to generate the headers that is needed for detecting +# overflows between types at run-time +# +# The bin/make_overflow script reads in this file and creates the appropriate +# file in the src/ directory when the generated header is out of date with +# respect to this file. +# +# Blank lines and lines beginning with '#' are ignored +# +# The format of this file is as follows: +# , ; +# +# Where is a valid C type (like 'int8_t', 'hssize_t', etc. and whether +# the type is signed or unsigned follows. +# +# Programmer: Quincey Koziol +# Creation Date: 2009/04/09 + +unsigned, UNSIGNED; +int, SIGNED; +uint8_t, UNSIGNED; +uint32_t, UNSIGNED; +uint64_t, UNSIGNED; +size_t, UNSIGNED; +ssize_t, SIGNED; +haddr_t, UNSIGNED; +hsize_t, UNSIGNED; +hssize_t, SIGNED; +h5_stat_size_t, UNSIGNED; diff --git a/src/H5private.h b/src/H5private.h index 27a8f65..998b7c3 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -436,35 +436,6 @@ #endif /* - * A macro for detecting over/under-flow when casting between types - */ -#ifndef NDEBUG -#define H5_CHECK_OVERFLOW(var, vartype, casttype) \ -{ \ - casttype _tmp_overflow = (casttype)(var); \ - assert((var) == (vartype)_tmp_overflow); \ -} -#else /* NDEBUG */ -#define H5_CHECK_OVERFLOW(var, vartype, casttype) -#endif /* NDEBUG */ - -/* - * A macro for detecting over/under-flow when assigning between types - */ -#ifndef NDEBUG -#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \ -{ \ - srctype _tmp_overflow = (srctype)(src); \ - dsttype _tmp_overflow2 = (dsttype)(_tmp_overflow); \ - assert((dsttype)_tmp_overflow == _tmp_overflow2); \ - (dst) = _tmp_overflow2; \ -} -#else /* NDEBUG */ -#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \ - (dst) = (dsttype)(src); -#endif /* NDEBUG */ - -/* * Data types and functions for timing certain parts of the library. */ typedef struct { @@ -758,6 +729,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* HDstat */ typedef struct stat64 h5_stat_t; typedef off64_t h5_stat_size_t; + #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF64_T #else /* H5_SIZEOF_OFF_T!=8 && ... */ #ifndef HDfstat #define HDfstat(F,B) fstat(F,B) @@ -767,6 +739,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* HDstat */ typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; + #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #endif /* H5_SIZEOF_OFF_T!=8 && ... */ #endif /* !defined(HDfstat) || !defined(HDstat) */ @@ -1231,6 +1204,9 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #ifndef HDstrtoul #define HDstrtoul(S,R,N) strtoul(S,R,N) #endif /* HDstrtoul */ +#ifndef HDstrtoull + #define HDstrtoull(S,R,N) strtoull(S,R,N) +#endif /* HDstrtoul */ #ifndef HDstrxfrm #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) #endif /* HDstrxfrm */ @@ -1370,6 +1346,78 @@ extern char *strdup(const char *s); #define HDpthread_self_ulong() ((unsigned long)pthread_self()) #endif /* HDpthread_self_ulong */ +/* + * A macro for detecting over/under-flow when casting between types + */ +#ifndef NDEBUG +#define H5_CHECK_OVERFLOW(var, vartype, casttype) \ +{ \ + casttype _tmp_overflow = (casttype)(var); \ + assert((var) == (vartype)_tmp_overflow); \ +} +#else /* NDEBUG */ +#define H5_CHECK_OVERFLOW(var, vartype, casttype) +#endif /* NDEBUG */ + +/* + * A macro for detecting over/under-flow when assigning between types + */ +#ifndef NDEBUG +#define ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) \ +{ \ + srctype _tmp_src = (srctype)(src); \ + dsttype _tmp_dst = (dsttype)(_tmp_src); \ + assert(_tmp_src == (srctype)_tmp_dst); \ + (dst) = _tmp_dst; \ +} + +#define ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) \ + (dst) = (dsttype)(src); + +#define ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) \ +{ \ + srctype _tmp_src = (srctype)(src); \ + dsttype _tmp_dst = (dsttype)(_tmp_src); \ + assert(_tmp_src >= 0); \ + assert(_tmp_src == _tmp_dst); \ + (dst) = _tmp_dst; \ +} + +#define ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) \ + (dst) = (dsttype)(src); + +#define ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) \ +{ \ + srctype _tmp_src = (srctype)(src); \ + dsttype _tmp_dst = (dsttype)(_tmp_src); \ + assert(_tmp_dst >= 0); \ + assert(_tmp_src == (srctype)_tmp_dst); \ + (dst) = _tmp_dst; \ +} + +#define ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) \ +{ \ + srctype _tmp_src = (srctype)(src); \ + dsttype _tmp_dst = (dsttype)(_tmp_src); \ + assert(_tmp_src >= 0); \ + assert(_tmp_src == (srctype)_tmp_dst); \ + (dst) = _tmp_dst; \ +} + +#define ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) \ + (dst) = (dsttype)(src); + +/* Include the generated overflow header file */ +#include "H5overflow.h" + +#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \ + H5_GLUE4(ASSIGN_,srctype,_TO_,dsttype)(dst,dsttype,src,srctype)\ + +#else /* NDEBUG */ +#define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \ + (dst) = (dsttype)(src); +#endif /* NDEBUG */ + #if defined(H5_HAVE_WINDOW_PATH) /* directory delimiter for Windows: slash and backslash are acceptable on Windows */ @@ -1687,6 +1735,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_ENTER_COMMON(func_name,asrt) \ static const char FUNC[]=#func_name; \ + hbool_t err_occurred = FALSE; \ FUNC_ENTER_COMMON_NOFUNC(func_name,asrt); /* Threadsafety initialization code for API routines */ @@ -1856,7 +1905,9 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_LEAVE_API(ret_value) \ FINISH_MPE_LOG; \ H5TRACE_RETURN(ret_value); \ - H5_POP_FUNC; \ + H5_POP_FUNC \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ return (ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ @@ -1865,6 +1916,8 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_LEAVE_API_NOFS(ret_value) \ FINISH_MPE_LOG; \ H5TRACE_RETURN(ret_value); \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ return (ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ @@ -1896,6 +1949,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Macro for "glueing" together items, for re-scanning macros */ #define H5_GLUE(x,y) x##y #define H5_GLUE3(x,y,z) x##y##z +#define H5_GLUE4(w,x,y,z) w##x##y##z /* Compile-time "assert" macro */ #define HDcompile_assert(e) do { enum { compile_assert__ = 1 / (e) }; } while(0) diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 26dab36..d710ada 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -56,6 +56,7 @@ typedef __int64 h5_stat_size_t; #define HDunlink(S) _unlink(S) #define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) #define HDwrite(F,M,Z) _write(F,M,Z) +#define HDstrtoull(S,R,N) _strtoui64(S,R,N) /* Non-POSIX functions */ diff --git a/src/Makefile.am b/src/Makefile.am index 62df62e..8e6d275 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -101,7 +101,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ # Public headers -include_HEADERS = hdf5.h H5api_adpt.h H5pubconf.h H5public.h H5version.h \ +include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ H5Apublic.h H5ACpublic.h \ H5Cpublic.h H5Dpublic.h \ H5Epubgen.h H5Epublic.h H5Fpublic.h H5FDpublic.h H5FDcore.h H5FDdirect.h \ @@ -139,6 +139,10 @@ $(top_srcdir)/src/H5Edefin.h: $(top_srcdir)/src/H5err.txt $(top_srcdir)/src/H5version.h: $(top_srcdir)/src/H5vers.txt perl $(top_srcdir)/bin/make_vers $? +# Assignment overflow macro generation +$(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt + perl $(top_srcdir)/bin/make_overflow $? + # Add TRACE macros to library source files. This is done via the trace script # in the hdf5/bin directory. If the file contains HDF5 API macros, a "clean" # version of the source file is saved with a tilde (~) after its name and diff --git a/src/Makefile.in b/src/Makefile.in index 9a0108d..f371a76 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -483,7 +483,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ # Public headers -include_HEADERS = hdf5.h H5api_adpt.h H5pubconf.h H5public.h H5version.h \ +include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ H5Apublic.h H5ACpublic.h \ H5Cpublic.h H5Dpublic.h \ H5Epubgen.h H5Epublic.h H5Fpublic.h H5FDpublic.h H5FDcore.h H5FDdirect.h \ @@ -1153,6 +1153,10 @@ $(top_srcdir)/src/H5Edefin.h: $(top_srcdir)/src/H5err.txt $(top_srcdir)/src/H5version.h: $(top_srcdir)/src/H5vers.txt perl $(top_srcdir)/bin/make_vers $? +# Assignment overflow macro generation +$(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt + perl $(top_srcdir)/bin/make_overflow $? + # Add TRACE macros to library source files. This is done via the trace script # in the hdf5/bin directory. If the file contains HDF5 API macros, a "clean" # version of the source file is saved with a tilde (~) after its name and diff --git a/test/Makefile.am b/test/Makefile.am index d85c72c..958d4c5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -104,8 +104,8 @@ flush2.chkexe_: flush1.chkexe_ # the temporary file name in ways that the makefile is not aware of. CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offset.h5 \ max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \ - huge_chunks.h5 chunk_cache.h5 big_chunk.h5 extend.h5 istore.h5 \ - extlinks*.h5 links*.h5 \ + huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ + extend.h5 istore.h5 extlinks*.h5 links*.h5 \ tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 \ extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 dt_arith[1-2] \ links.h5 links[0-6]*.h5 extlinks[0-9].h5 tmp \ diff --git a/test/Makefile.in b/test/Makefile.in index df2934c..09eed73 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -627,7 +627,8 @@ TRACE = perl $(top_srcdir)/bin/trace CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \ compact_dataset.h5 dataset.h5 dset_offset.h5 \ max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \ - huge_chunks.h5 chunk_cache.h5 big_chunk.h5 extend.h5 istore.h5 \ + huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ + extend.h5 istore.h5 \ extlinks*.h5 links*.h5 tfile[1-4].h5 th5s[1-3].h5 lheap.h5 \ fheap.h5 ohdr.h5 stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw \ gheap[0-4].h5 dt_arith[1-2] links.h5 links[0-6]*.h5 \ diff --git a/test/big.c b/test/big.c index 8176929..dde9d7a 100644 --- a/test/big.c +++ b/test/big.c @@ -505,7 +505,6 @@ main (int ac, char **av) hid_t fapl=-1; hsize_t family_size; hsize_t family_size_def; /* default family file size */ - double family_size_def_dbl; /* default family file size */ unsigned long seed = 0; /* Random # seed */ int cflag=1; /* check file system before test */ char filename[1024]; @@ -518,11 +517,8 @@ main (int ac, char **av) if (strcmp("-fsize", *av)==0){ /* specify a different family file size */ ac--; av++; - if (ac > 0){ - family_size_def_dbl = atof(*av); - H5_ASSIGN_OVERFLOW(family_size_def,family_size_def_dbl,double,hsize_t); - if (family_size_def <= 0) - family_size_def = (hsize_t)FAMILY_SIZE; + if (ac > 0) { + family_size_def = (hsize_t)HDstrtoull(*av, NULL, 0); } else{ printf("***Missing fsize value***\n"); diff --git a/test/dsets.c b/test/dsets.c index 78aa999..71324d8 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -45,6 +45,7 @@ const char *FILENAME[] = { "huge_chunks", "chunk_cache", "big_chunk", + "chunk_expand", NULL }; #define FILENAME_BUF_SIZE 1024 @@ -106,8 +107,10 @@ const char *FILENAME[] = { /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS 305 #define H5Z_FILTER_CORRUPT 306 -#define H5Z_FILTER_BOGUS2 307 -#define H5Z_FILTER_DEPREC 308 +#define H5Z_FILTER_CAN_APPLY_TEST 307 +#define H5Z_FILTER_SET_LOCAL_TEST 308 +#define H5Z_FILTER_DEPREC 309 +#define H5Z_FILTER_EXPAND 310 /* Flags for testing filters */ #define DISABLE_FLETCHER32 0 @@ -188,6 +191,8 @@ static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); static size_t filter_corrupt(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); +static size_t filter_expand(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /*------------------------------------------------------------------------- @@ -1116,7 +1121,7 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id) add_on=(unsigned)H5Tget_size(type_id); /* Get the filter's current parameters */ - if(H5Pget_filter_by_id2(dcpl_id, H5Z_FILTER_BOGUS2, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) + if(H5Pget_filter_by_id2(dcpl_id, H5Z_FILTER_SET_LOCAL_TEST, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) return(FAIL); /* Check that the parameter values were passed along correctly */ @@ -1130,7 +1135,7 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id) cd_values[3]=add_on; /* Amount the data was modified by */ /* Modify the filter's parameters for this dataset */ - if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_BOGUS2, flags, (size_t)BOGUS2_ALL_NPARMS, + if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SET_LOCAL_TEST, flags, (size_t)BOGUS2_ALL_NPARMS, cd_values) < 0) return(FAIL); @@ -4796,10 +4801,10 @@ test_types(hid_t file) /* This message derives from H5Z */ const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{ - H5Z_CLASS_T_VERS, - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, - "bogus", /* Filter name for debugging */ + H5Z_CLASS_T_VERS, + H5Z_FILTER_CAN_APPLY_TEST, /* Filter id number */ + 1, 1, + "can_apply_test", /* Filter name for debugging */ can_apply_bogus, /* The "can apply" callback */ NULL, /* The "set local" callback */ filter_bogus, /* The actual filter function */ @@ -4849,7 +4854,7 @@ test_can_apply(hid_t file) printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } - if(H5Pset_filter(dcpl, H5Z_FILTER_BOGUS, 0, (size_t)0, NULL) < 0) { + if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) { H5_FAILED(); printf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; @@ -5156,10 +5161,10 @@ error: /* This message derives from H5Z */ const H5Z_class2_t H5Z_SET_LOCAL_TEST[1] = {{ - H5Z_CLASS_T_VERS, - H5Z_FILTER_BOGUS2, /* Filter id number */ - 1, 1, - "bogus2", /* Filter name for debugging */ + H5Z_CLASS_T_VERS, + H5Z_FILTER_SET_LOCAL_TEST, /* Filter id number */ + 1, 1, + "set_local_test", /* Filter name for debugging */ NULL, /* The "can apply" callback */ set_local_bogus2, /* The "set local" callback */ filter_bogus2, /* The actual filter function */ @@ -5229,7 +5234,7 @@ test_set_local(hid_t fapl) printf(" Line %d: Can't register 'set local' filter\n",__LINE__); goto error; } - if(H5Pset_filter(dcpl, H5Z_FILTER_BOGUS2, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) { + if(H5Pset_filter(dcpl, H5Z_FILTER_SET_LOCAL_TEST, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) { H5_FAILED(); printf(" Line %d: Can't set bogus2 filter\n",__LINE__); goto error; @@ -5740,7 +5745,6 @@ test_filters_endianess(void) hid_t dsid=-1; /* dataset ID */ hid_t sid=-1; /* dataspace ID */ hid_t dcpl=-1; /* dataset creation property list ID */ - int i; char *srcdir = getenv("srcdir"); /* the source directory */ char data_file[512]=""; /* buffer to hold name of existing file */ @@ -6384,11 +6388,11 @@ test_deprec(hid_t file) if(H5Zregister(H5Z_DEPREC) < 0) goto error; if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error; + puts(""); if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; - PASSED(); return 0; error: @@ -6762,7 +6766,7 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Define cache size to be smaller than chunk size */ rdcc_nelmts = BYPASS_CHUNK_DIM/5; rdcc_nbytes = sizeof(int)*BYPASS_CHUNK_DIM/5; - if(H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, 0) < 0) FAIL_STACK_ERROR + if(H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, (double)0.0) < 0) FAIL_STACK_ERROR /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_local)) < 0) FAIL_STACK_ERROR @@ -6879,6 +6883,352 @@ error: return -1; } /* end test_big_chunks_bypass_cache() */ +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_EXPAND[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_EXPAND, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "expand", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_expand, /* The actual filter function */ +}}; + +/* Global "expansion factor" for filter_expand() routine */ +static size_t filter_expand_factor_g = 0; + + +/*------------------------------------------------------------------------- + * Function: filter_expand + * + * Purpose: For testing library's behavior when a filter expands a chunk + * too much. + * + * Note: This filter doesn't actually re-allocate the buffer to be + * larger, it just changes the buffer size to a value that's too + * large. The library should throw an error before using the + * incorrect buffer information. + * + * Return: Success: Data chunk size + * Failure: 0 + * + * Programmer: Quincey Koziol + * Mar 31, 2009 + * + *------------------------------------------------------------------------- + */ +static size_t +filter_expand(unsigned int flags, size_t UNUSED cd_nelmts, + const unsigned int UNUSED *cd_values, size_t nbytes, + size_t *buf_size, void UNUSED **buf) +{ + size_t ret_value = 0; + + if(flags & H5Z_FLAG_REVERSE) { + /* Don't do anything when filter is applied in reverse */ + *buf_size = nbytes; + ret_value = nbytes; + } /* end if */ + else { + /* Check for expanding the chunk */ + if(filter_expand_factor_g > 0) { + /* Expand the buffer size beyond what can be encoded */ + *buf_size = nbytes * 256 * 256 * 256 * filter_expand_factor_g; + ret_value = *buf_size; + } /* end if */ + else { + /* Don't expand the chunk's size */ + *buf_size = nbytes; + ret_value = nbytes; + } /* end else */ + } /* end else */ + + return ret_value; +} /* end filter_expand() */ + + +/*------------------------------------------------------------------------- + * Function: test_chunk_expand + * + * Purpose: Tests support for proper error handling when a chunk expands + * too much after a filter is applied + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Tuesday, March 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_chunk_expand(hid_t fapl) +{ + char filename[FILENAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t dcpl = -1; /* Dataset creation property list ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t scalar_sid = -1;/* Scalar dataspace ID */ + hid_t dsid = -1; /* Dataset ID */ + hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */ + hsize_t hs_offset; /* Hyperslab offset */ + hsize_t hs_size; /* Hyperslab size */ + H5D_alloc_time_t alloc_time; /* Storage allocation time */ + unsigned write_elem, read_elem; /* Element written/read */ + unsigned u; /* Local index variable */ + herr_t status; /* Generic return value */ + + TESTING("filter expanding chunks too much"); + + h5_fixname(FILENAME[10], fapl, filename, sizeof filename); + + if(sizeof(size_t) <= 4) { + SKIPPED(); + puts(" Current machine can't test for error"); + } /* end if */ + else { + /* Register "expansion" filter */ + if(H5Zregister(H5Z_EXPAND) < 0) FAIL_STACK_ERROR + + /* Check that the filter was registered */ + if(TRUE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR + + /* Loop over storage allocation time */ + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + /* Create file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + + /* Create dataset creation property list */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + + /* Set chunking */ + chunk_dim = 10; + if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR + + /* Set fill time */ + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR + + /* Set allocation time */ + if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR + + /* Set "expand" filter */ + if(H5Pset_filter(dcpl, H5Z_FILTER_EXPAND, 0, (size_t)0, NULL) < 0) FAIL_STACK_ERROR + + /* Create scalar dataspace */ + if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR + + /* Create 1-D dataspace */ + dim = 100; + max_dim = H5S_UNLIMITED; + if((sid = H5Screate_simple(1, &dim, &max_dim)) < 0) FAIL_STACK_ERROR + + /* Create chunked dataset */ + if(H5D_ALLOC_TIME_EARLY == alloc_time) { + /* Make the expansion factor large enough to cause failure right away */ + filter_expand_factor_g = 8; + + H5E_BEGIN_TRY { + dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } H5E_END_TRY; + if(dsid >= 0) FAIL_PUTS_ERROR("should fail to create dataset when allocation time is early"); + } /* end if */ + else { + if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Fill elements */ + hs_size = 1; + for(u = 0; u < 100; u++) { + /* Select a single element in the dataset */ + hs_offset = u; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) FAIL_STACK_ERROR + + /* Read (unwritten) element from dataset */ + read_elem = 1; + if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR + + /* Verify unwritten element is fill value (0) */ + if(read_elem != 0) FAIL_PUTS_ERROR("invalid unwritten element read"); + + /* Don't expand chunks yet */ + filter_expand_factor_g = 0; + + /* Write element to dataset */ + write_elem = u; + if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR + + /* Read element from dataset */ + read_elem = write_elem + 1; + if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR + + /* Verify written element is read in */ + if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read"); + + /* Expand chunks now */ + filter_expand_factor_g = 8; + + /* Write element to dataset */ + write_elem = u; + H5E_BEGIN_TRY { + status = H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem); + } H5E_END_TRY; + if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early"); + } /* end for */ + + /* Incrementally extend dataset and verify write/reads */ + while(dim < 1000) { + /* Extend dataset */ + dim += 100; + if(H5Dset_extent(dsid, &dim) < 0) FAIL_STACK_ERROR + + /* Close old dataspace */ + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + + /* Get dataspace for dataset now */ + if((sid = H5Dget_space(dsid)) < 0) FAIL_STACK_ERROR + + /* Fill new elements */ + hs_size = 1; + for(u = 0; u < 100; u++) { + /* Select a single element in the dataset */ + hs_offset = (dim + u) - 100; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) FAIL_STACK_ERROR + + /* Read (unwritten) element from dataset */ + read_elem = 1; + if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR + + /* Verify unwritten element is fill value (0) */ + if(read_elem != 0) FAIL_PUTS_ERROR("invalid unwritten element read"); + + /* Don't expand chunks yet */ + filter_expand_factor_g = 0; + + /* Write element to dataset */ + write_elem = u; + if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR + + /* Read element from dataset */ + read_elem = write_elem + 1; + if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR + + /* Verify written element is read in */ + if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read"); + + /* Expand chunks now */ + filter_expand_factor_g = 8; + + /* Write element to dataset */ + write_elem = u; + H5E_BEGIN_TRY { + status = H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem); + } H5E_END_TRY; + if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early"); + } /* end for */ + } /* end while */ + + /* Close dataset */ + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + } /* end else */ + + /* Close everything */ + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* If the dataset was created, do some extra testing */ + if(H5D_ALLOC_TIME_EARLY != alloc_time) { + /* Re-open file & dataset */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + + /* Open dataset */ + if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Create scalar dataspace */ + if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR + + /* Get dataspace for dataset now */ + if((sid = H5Dget_space(dsid)) < 0) FAIL_STACK_ERROR + + /* Read elements */ + hs_size = 1; + for(u = 0; u < 1000; u++) { + /* Select a single element in the dataset */ + hs_offset = u; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) FAIL_STACK_ERROR + + /* Read element from dataset */ + read_elem = u + 1; + if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR + + /* Verify unwritten element is proper value */ + if(read_elem != (u % 100)) FAIL_PUTS_ERROR("invalid element read"); + + /* Don't expand chunks yet */ + filter_expand_factor_g = 0; + + /* Write element to dataset */ + write_elem = u % 100; + if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) FAIL_STACK_ERROR + + /* Read element from dataset */ + read_elem = write_elem + 1; + if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) FAIL_STACK_ERROR + + /* Verify written element is read in */ + if(read_elem != write_elem) FAIL_PUTS_ERROR("invalid written element read"); + + /* Expand chunks now */ + filter_expand_factor_g = 8; + + /* Write element to dataset */ + write_elem = u % 100; + H5E_BEGIN_TRY { + status = H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem); + } H5E_END_TRY; + if(status >= 0) FAIL_PUTS_ERROR("should fail to write to dataset when allocation time is not early"); + } /* end for */ + + /* Close everything */ + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* Re-open file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + + /* Delete dataset */ + if(H5Ldelete(fid, "dset", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close everything */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + } /* end if */ + } /* end for */ + + /* Unregister "expansion" filter */ + if(H5Zunregister(H5Z_FILTER_EXPAND) < 0) FAIL_STACK_ERROR + + /* Check that the filter was unregistered */ + if(FALSE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR + + PASSED(); + } /* end else */ + + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dsid); + H5Sclose(sid); + H5Sclose(scalar_sid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end test_chunk_expand() */ + /*------------------------------------------------------------------------- * Function: main @@ -7002,6 +7352,7 @@ main(void) nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); if(H5Fclose(file) < 0) goto error; -- cgit v0.12