summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST2
-rwxr-xr-xbin/trace4
-rwxr-xr-xconfigure90
-rw-r--r--configure.in22
-rw-r--r--examples/h5_elink_unix2win.c6
-rw-r--r--examples/h5_extlink.c18
-rw-r--r--fortran/test/t.c19
-rw-r--r--fortran/test/t.h2
-rw-r--r--fortran/test/tH5F.f9010
-rw-r--r--fortran/test/tf.f9035
-rw-r--r--src/H5A.c4
-rw-r--r--src/H5Apublic.h2
-rw-r--r--src/H5B2int.c50
-rw-r--r--src/H5B2private.h6
-rw-r--r--src/H5Dio.c477
-rw-r--r--src/H5Edefin.h1
-rw-r--r--src/H5Einit.h5
-rw-r--r--src/H5Epubgen.h2
-rw-r--r--src/H5Eterm.h3
-rw-r--r--src/H5F.c152
-rw-r--r--src/H5FD.c608
-rw-r--r--src/H5FDpublic.h20
-rw-r--r--src/H5FS.c11
-rw-r--r--src/H5FScache.c8
-rw-r--r--src/H5G.c70
-rw-r--r--src/H5Gbtree2.c376
-rw-r--r--src/H5Gdense.c1374
-rw-r--r--src/H5Gdeprec.c22
-rw-r--r--src/H5Gent.c112
-rw-r--r--src/H5Glink.c351
-rw-r--r--src/H5Gloc.c21
-rw-r--r--src/H5Gnode.c451
-rw-r--r--src/H5Gobj.c888
-rw-r--r--src/H5Goh.c8
-rw-r--r--src/H5Gpkg.h152
-rw-r--r--src/H5Gprivate.h18
-rw-r--r--src/H5Gpublic.h15
-rw-r--r--src/H5Gstab.c155
-rw-r--r--src/H5Gtest.c142
-rw-r--r--src/H5Gtraverse.c60
-rw-r--r--src/H5HFcache.c2
-rw-r--r--src/H5HL.c125
-rw-r--r--src/H5L.c158
-rw-r--r--src/H5Lexternal.c8
-rw-r--r--src/H5Lpkg.h2
-rw-r--r--src/H5Lprivate.h6
-rw-r--r--src/H5Lpublic.h58
-rw-r--r--src/H5O.c173
-rw-r--r--src/H5Oginfo.c44
-rw-r--r--src/H5Olinfo.c237
-rw-r--r--src/H5Olink.c340
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Oprivate.h51
-rw-r--r--src/H5Ostab.c26
-rw-r--r--src/H5Pgcpl.c83
-rw-r--r--src/H5Plcpl.c3
-rw-r--r--src/H5Ppublic.h7
-rw-r--r--src/H5Pstrcpl.c3
-rw-r--r--src/H5S.c113
-rw-r--r--src/H5T.c36
-rw-r--r--src/H5Tcommit.c2
-rw-r--r--src/H5api_adpt.h1
-rw-r--r--src/H5config.h.in3
-rw-r--r--src/H5err.txt1
-rw-r--r--src/H5public.h8
-rw-r--r--src/H5trace.c264
-rwxr-xr-xsrc/Makefile.am4
-rw-r--r--src/Makefile.in53
-rw-r--r--test/Makefile.am2
-rw-r--r--test/Makefile.in6
-rw-r--r--test/be_extlink1.h5bin1120 -> 880 bytes
-rw-r--r--test/be_extlink2.h5bin2840 -> 2744 bytes
-rw-r--r--test/cache_common.c2
-rw-r--r--test/gen_new_group.c25
-rw-r--r--test/gen_udlinks.c3
-rw-r--r--test/h5test.c13
-rw-r--r--test/h5test.h3
-rw-r--r--test/le_extlink1.h5bin1120 -> 880 bytes
-rw-r--r--test/le_extlink2.h5bin2840 -> 2744 bytes
-rw-r--r--test/links.c2231
-rw-r--r--test/mount.c14
-rwxr-xr-xtest/objcopy.c2138
-rw-r--r--test/stab.c577
-rw-r--r--test/tattr.c4
-rw-r--r--test/tfile.c23
-rw-r--r--test/titerate.c348
-rw-r--r--test/tmisc.c10
-rw-r--r--test/unlink.c1377
-rw-r--r--tools/h5diff/h5diffgentest.c8
-rw-r--r--tools/h5dump/h5dump.c18
-rw-r--r--tools/h5dump/h5dumpgentest.c69
-rw-r--r--tools/h5jam/h5jamgentest.c157
-rw-r--r--tools/h5ls/h5ls.c4
-rw-r--r--tools/h5repack/h5repack_refs.c4
-rw-r--r--tools/h5repack/testh5repack_dset.c2
-rw-r--r--tools/h5repack/testh5repack_main.c2
-rw-r--r--tools/h5repack/testh5repack_make.c12
-rw-r--r--tools/lib/h5diff.c4
-rw-r--r--tools/lib/h5trav.c2
-rw-r--r--tools/misc/h5stat.c4
-rw-r--r--tools/testfiles/file3.h5bin3512 -> 4056 bytes
-rw-r--r--tools/testfiles/tall-2A.h5.xml24
-rw-r--r--tools/testfiles/tall.h5bin9744 -> 9152 bytes
-rw-r--r--tools/testfiles/tall.h5.xml24
-rw-r--r--tools/testfiles/tboot1.ddl2
-rw-r--r--tools/testfiles/tcontents.ddl2
-rw-r--r--tools/testfiles/textlink.h5bin1264 -> 928 bytes
-rw-r--r--tools/testfiles/tfcontents1.h5bin6696 -> 6744 bytes
-rw-r--r--tools/testfiles/tmany.h5bin18896 -> 18464 bytes
-rw-r--r--tools/testfiles/tmany.h5.xml42
-rw-r--r--tools/testfiles/tudlink.h5bin1120 -> 928 bytes
-rw-r--r--tools/testfiles/twithub.h5bin8852 -> 8852 bytes
-rw-r--r--tools/testfiles/twithub513.h5bin10920 -> 8852 bytes
113 files changed, 8510 insertions, 6231 deletions
diff --git a/MANIFEST b/MANIFEST
index 933485e..e2480e4 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -497,6 +497,8 @@
./src/H5FSpublic.h
./src/H5FSsection.c
./src/H5G.c
+./src/H5Gbtree2.c
+./src/H5Gdense.c
./src/H5Gdeprec.c
./src/H5Gent.c
./src/H5Glink.c
diff --git a/bin/trace b/bin/trace
index 73810bf..c35c2bf 100755
--- a/bin/trace
+++ b/bin/trace
@@ -50,7 +50,7 @@ $Source = "";
"H5FD_stream_fapl_t*" => "x",
"H5G_obj_t" => "Go",
"H5G_stat_t*" => "Gs",
- "H5L_link_t" => "Ll",
+ "H5L_type_t" => "Ll",
"unsigned long" => "Lu",
"hsize_t" => "h",
"hssize_t" => "Hs",
@@ -88,7 +88,7 @@ $Source = "";
"H5E_auto_t" => "x",
"H5E_walk_t" => "x",
"H5G_iterate_t" => "x",
- "H5L_link_class_t" => "x",
+ "H5L_class_t" => "x",
"H5MM_allocate_t" => "x",
"H5MM_free_t" => "x",
"H5P_cls_create_func_t" => "x",
diff --git a/configure b/configure
index 472467d..742be4c 100755
--- a/configure
+++ b/configure
@@ -1071,8 +1071,6 @@ Optional Features:
is most packages.
--enable-codestack Enable the function stack tracing (for developer
debugging).
- --enable-group-revision Enable the group revision code (for internal
- developers only).
--enable-metadata-trace-file
Enable metadata trace file collection.
--enable-trace Enable API tracing capability. Default=no if debug
@@ -3521,7 +3519,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:3524:" \
+echo "$as_me:3522:" \
"checking for Fortran compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -3816,7 +3814,7 @@ _ACEOF
# flags.
ac_save_FFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_verb"
-(eval echo $as_me:3819: \"$ac_link\") >&5
+(eval echo $as_me:3817: \"$ac_link\") >&5
ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
echo "$ac_fc_v_output" >&5
FCFLAGS=$ac_save_FFLAGS
@@ -3894,7 +3892,7 @@ _ACEOF
# flags.
ac_save_FFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_cv_prog_fc_v"
-(eval echo $as_me:3897: \"$ac_link\") >&5
+(eval echo $as_me:3895: \"$ac_link\") >&5
ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
echo "$ac_fc_v_output" >&5
FCFLAGS=$ac_save_FFLAGS
@@ -6619,7 +6617,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6622 "configure"' > conftest.$ac_ext
+ echo '#line 6620 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7749,7 +7747,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:7752:" \
+echo "$as_me:7750:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -8818,11 +8816,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8821: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8819: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8825: \$? = $ac_status" >&5
+ echo "$as_me:8823: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -9073,11 +9071,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9076: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9074: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9080: \$? = $ac_status" >&5
+ echo "$as_me:9078: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -9133,11 +9131,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9136: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9134: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9140: \$? = $ac_status" >&5
+ echo "$as_me:9138: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -11405,7 +11403,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 11408 "configure"
+#line 11406 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11503,7 +11501,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 11506 "configure"
+#line 11504 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13739,11 +13737,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13742: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13740: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13746: \$? = $ac_status" >&5
+ echo "$as_me:13744: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -13799,11 +13797,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13802: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13800: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13806: \$? = $ac_status" >&5
+ echo "$as_me:13804: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -15218,7 +15216,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 15221 "configure"
+#line 15219 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15316,7 +15314,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 15319 "configure"
+#line 15317 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16171,11 +16169,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16174: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16172: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16178: \$? = $ac_status" >&5
+ echo "$as_me:16176: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -16231,11 +16229,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16234: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16232: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16238: \$? = $ac_status" >&5
+ echo "$as_me:16236: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18287,11 +18285,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18290: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18288: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18294: \$? = $ac_status" >&5
+ echo "$as_me:18292: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -18542,11 +18540,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18545: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18543: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18549: \$? = $ac_status" >&5
+ echo "$as_me:18547: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -18602,11 +18600,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18605: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18603: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18609: \$? = $ac_status" >&5
+ echo "$as_me:18607: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -20874,7 +20872,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 20877 "configure"
+#line 20875 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20972,7 +20970,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 20975 "configure"
+#line 20973 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -48163,32 +48161,6 @@ echo "${ECHO_T}no" >&6
;;
esac
-echo "$as_me:$LINENO: checking whether group revision code is enabled" >&5
-echo $ECHO_N "checking whether group revision code is enabled... $ECHO_C" >&6
-# Check whether --enable-group-revision or --disable-group-revision was given.
-if test "${enable_group_revision+set}" = set; then
- enableval="$enable_group_revision"
- GROUPREVISION=$enableval
-fi;
-
-case "X-$GROUPREVISION" in
- X-yes)
- GROUPREVISION=yes
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-cat >>confdefs.h <<\_ACEOF
-#define GROUP_REVISION 1
-_ACEOF
-
- ;;
- *)
- GROUPREVISION=no
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
- ;;
-esac
-
echo "$as_me:$LINENO: checking whether metadata trace file code is enabled" >&5
echo $ECHO_N "checking whether metadata trace file code is enabled... $ECHO_C" >&6
# Check whether --enable-metadata-trace-file or --disable-metadata-trace-file was given.
diff --git a/configure.in b/configure.in
index cdb6fad..3f726f7 100644
--- a/configure.in
+++ b/configure.in
@@ -2027,28 +2027,6 @@ case "X-$CODESTACK" in
esac
dnl ----------------------------------------------------------------------
-dnl Check if they would like the group revision code compiled in
-dnl
-AC_MSG_CHECKING([whether group revision code is enabled])
-AC_ARG_ENABLE([group-revision],
- [AC_HELP_STRING([--enable-group-revision],
- [Enable the group revision code (for internal developers only).])],
- [GROUPREVISION=$enableval])
-
-case "X-$GROUPREVISION" in
- X-yes)
- GROUPREVISION=yes
- AC_MSG_RESULT([yes])
- AC_DEFINE([GROUP_REVISION], [1],
- [Define if the group revision code is to be compiled in])
- ;;
- *)
- GROUPREVISION=no
- AC_MSG_RESULT([no])
- ;;
-esac
-
-dnl ----------------------------------------------------------------------
dnl Check if they would like the metadata trace file code compiled in
dnl
AC_MSG_CHECKING([whether metadata trace file code is enabled])
diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c
index 35ab271..b354661 100644
--- a/examples/h5_elink_unix2win.c
+++ b/examples/h5_elink_unix2win.c
@@ -118,9 +118,9 @@ error:
return -1;
}
-const H5L_link_class_t elink_unix2win_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
- H5L_LINK_EXTERNAL, /* Link type id number */
+const H5L_class_t elink_unix2win_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ H5L_TYPE_EXTERNAL, /* Link type id number */
"unix2win external link", /* Link class name for debugging */
NULL, /* Creation callback */
NULL, /* Move callback */
diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c
index 92ac398..45dc01f 100644
--- a/examples/h5_extlink.c
+++ b/examples/h5_extlink.c
@@ -219,12 +219,12 @@ void soft_link_example()
* A link class can have NULL for any callback except its traverse
* callback.
*/
- const H5L_link_class_t UD_soft_class[1] = {{
+ const H5L_class_t UD_soft_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
* This field is always H5L_LINK_CLASS_T_VERS */
UD_SOFT_CLASS, /* Link class id number. This can be any
- * value between H5L_LINK_UD_MIN (64) and
- * H5L_LINK_MAX (255). It should be a
+ * value between H5L_TYPE_UD_MIN (64) and
+ * H5L_TYPE_MAX (255). It should be a
* value that isn't already being used by
* another kind of link. We'll use 65. */
"UD_soft_link", /* Link class name for debugging */
@@ -318,12 +318,12 @@ void hard_link_example()
* A link class can have NULL for any callback except its traverse
* callback.
*/
- const H5L_link_class_t UD_hard_class[1] = {{
+ const H5L_class_t UD_hard_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
* This field is always H5L_LINK_CLASS_T_VERS */
UD_HARD_CLASS, /* Link class id number. This can be any
- * value between H5L_LINK_UD_MIN (64) and
- * H5L_LINK_MAX (255). It should be a
+ * value between H5L_TYPE_UD_MIN (64) and
+ * H5L_TYPE_MAX (255). It should be a
* value that isn't already being used by
* another kind of link. We'll use 66. */
"UD_hard_link", /* Link class name for debugging */
@@ -533,12 +533,12 @@ void plist_link_example()
* A link class can have NULL for any callback except its traverse
* callback.
*/
- const H5L_link_class_t UD_plist_class[1] = {{
+ const H5L_class_t UD_plist_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
* This field is always H5L_LINK_CLASS_T_VERS */
UD_PLIST_CLASS, /* Link class id number. This can be any
- * value between H5L_LINK_UD_MIN (64) and
- * H5L_LINK_MAX (255). It should be a
+ * value between H5L_TYPE_UD_MIN (64) and
+ * H5L_TYPE_MAX (255). It should be a
* value that isn't already being used by
* another kind of link. We'll use 67. */
"UD_plist_link", /* Link class name for debugging */
diff --git a/fortran/test/t.c b/fortran/test/t.c
index 5c4286c..cb71fd2 100644
--- a/fortran/test/t.c
+++ b/fortran/test/t.c
@@ -128,22 +128,3 @@ nh5_exit_c(int_f *status)
HDexit((int)*status);
} /* h5_exit_c */
-
-/*----------------------------------------------------------------------------
- * Name: h5_group_revision_c
- * Purpose: Checks if H5_GROUP_REVISION variable defined
- * Inputs:
- * Returns: 1 if defines, 0 otherwise
- * Programmer: Elena Pourmal
- * Saturday, May 13, 2006
- * Modifications:
- *---------------------------------------------------------------------------*/
-int_f
-nh5_group_revision_c()
-{
- int_f ret =0;
-#ifdef H5_GROUP_REVISION
- ret = 1;
-#endif
- return ret;
-} /* h5_group_revision_c */
diff --git a/fortran/test/t.h b/fortran/test/t.h
index 47062ac..79c6d4b 100644
--- a/fortran/test/t.h
+++ b/fortran/test/t.h
@@ -25,7 +25,6 @@ char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
# define nh5_fixname_c H5_FC_FUNC_(h5_fixname_c, H5_FIXNAME_C)
# define nh5_cleanup_c H5_FC_FUNC_(h5_cleanup_c, H5_CLEANUP_C)
# define nh5_exit_c H5_FC_FUNC_(h5_exit_c, H5_EXIT_C)
-# define nh5_group_revision_c H5_FC_FUNC_(h5_group_revision_c, H5_GROUP_REVISION_C)
H5_FCTESTDLL int_f nh5_fixname_c
(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl, _fcd full_name, size_t_f *full_namelen);
@@ -36,4 +35,3 @@ H5_FCTESTDLL int_f nh5_cleanup_c
H5_FCTESTDLL void nh5_exit_c
(int_f *status);
-H5_FCTESTDLL int_f nh5_group_revision_c();
diff --git a/fortran/test/tH5F.f90 b/fortran/test/tH5F.f90
index 2cc4766..091b1a5 100644
--- a/fortran/test/tH5F.f90
+++ b/fortran/test/tH5F.f90
@@ -747,16 +747,8 @@
! Check the free space now
CALL h5fget_freespace_f(fid, free_space, error)
- CALL h5_group_revision_f(flag)
CALL check("h5fget_freespace_f",error,total_error)
- if(flag .eq. 1) then
- free_space_out = 232
- else
- free_space_out = 1024
- endif
- if(error .eq.0 .and. free_space .ne. free_space_out) then
-! if(error .eq.0 .and. free_space .ne. 232) then
-! if(error .eq.0 .and. free_space .ne. 1024) then
+ if(error .eq.0 .and. free_space .ne. 0) then
total_error = total_error + 1
write(*,*) "3: Wrong amount of free space reported, ", free_space
endif
diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90
index 6dc3c02..cc9c9fa 100644
--- a/fortran/test/tf.f90
+++ b/fortran/test/tf.f90
@@ -201,38 +201,3 @@
END SUBROUTINE h5_exit_f
-!----------------------------------------------------------------------
-! Name: h5_group_revision_f
-!
-! Purpose: Checks if group revisions are defined
-!
-! Inputs:
-!
-! Outputs:
-! flag
-!
-! Programmer: Elena Pourmal
-! May 13, 2006
-!
-!
-!----------------------------------------------------------------------
- SUBROUTINE h5_group_revision_f(flag)
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_DLL)
-!DEC$attributes dllexport :: h5_group_revision_f
-!DEC$endif
- IMPLICIT NONE
- INTEGER, INTENT(OUT) :: flag ! Return code
- INTEGER :: flag1
- INTERFACE
- INTEGER FUNCTION h5_group_revision_c()
- !DEC$ IF DEFINED(HDF5F90_WINDOWS)
- !MS$ATTRIBUTES C,reference,alias:'_H5_GROUP_REVISION_C':: h5_group_revision_c
- !DEC$ ENDIF
- END FUNCTION h5_group_revision_c
- END INTERFACE
-
- flag = h5_group_revision_c()
-
- END SUBROUTINE h5_group_revision_f
diff --git a/src/H5A.c b/src/H5A.c
index 24e27b4..e8540cf 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1008,7 +1008,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */
-#ifdef H5_GROUP_REVISION
/*--------------------------------------------------------------------------
NAME
@@ -1063,8 +1062,7 @@ H5Aget_create_plist(hid_t attr_id)
done:
FUNC_LEAVE_API(ret_value)
-}
-#endif /* H5_GROUP_REVISION */
+} /* end H5Aget_create_plist() */
/*--------------------------------------------------------------------------
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index c932e54..ec9904a 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -38,9 +38,7 @@ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
H5_DLL herr_t H5Aclose(hid_t attr_id);
H5_DLL hid_t H5Aget_space(hid_t attr_id);
H5_DLL hid_t H5Aget_type(hid_t attr_id);
-#ifdef H5_GROUP_REVISION
H5_DLL hid_t H5Aget_create_plist(hid_t attr_id);
-#endif /* H5_GROUP_REVISION */
H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id);
H5_DLL int H5Aget_num_attrs(hid_t loc_id);
diff --git a/src/H5B2int.c b/src/H5B2int.c
index e974583..e97487d 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -2115,12 +2115,13 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data)
{
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
- void *node=NULL; /* Pointers to current node */
- uint8_t *native; /* Pointers to node's native records */
- H5B2_node_ptr_t *node_ptrs=NULL; /* Pointers to node's node pointers */
+ const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
+ void *node = NULL; /* Pointers to current node */
+ uint8_t *node_native; /* Pointers to node's native records */
+ uint8_t *native = NULL; /* Pointers to copy of node's native records */
+ H5B2_node_ptr_t *node_ptrs = NULL; /* Pointers to node's node pointers */
unsigned u; /* Local index */
- herr_t ret_value = H5B2_ITER_CONT;
+ herr_t ret_value = H5B2_ITER_CONT; /* Iterator return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_iterate_node)
@@ -2145,8 +2146,14 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Set up information about current node */
curr_node_class = H5AC_BT2_INT;
node = internal;
- native = internal->int_native;
- node_ptrs = internal->node_ptrs;
+ node_native = internal->int_native;
+
+ /* Allocate space for the node pointers in memory */
+ if((node_ptrs = H5FL_FAC_MALLOC(shared->node_info[depth].node_ptr_fac)) == NULL)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
+
+ /* Copy the node pointers */
+ HDmemcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (curr_node->node_nrec + 1)));
} /* end if */
else {
H5B2_leaf_t *leaf; /* Pointer to leaf node */
@@ -2158,9 +2165,21 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Set up information about current node */
curr_node_class = H5AC_BT2_LEAF;
node = leaf;
- native = leaf->leaf_native;
+ node_native = leaf->leaf_native;
} /* end else */
+ /* Allocate space for the native keys in memory */
+ if((native = H5FL_FAC_MALLOC(shared->node_info[depth].nat_rec_fac)) == NULL)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
+
+ /* Copy the native keys */
+ HDmemcpy(native, node_native, (shared->type->nrec_size * curr_node->node_nrec));
+
+ /* Unlock the node */
+ if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
+ node = NULL;
+
/* Iterate through records, in order */
for(u = 0; u < curr_node->node_nrec && !ret_value; u++) {
/* Descend into child node, if current node is an internal node */
@@ -2170,8 +2189,10 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
} /* end if */
/* Make callback for current record */
- if((ret_value = (op)(H5B2_NAT_NREC(native, shared, u), op_data)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
+ if(!ret_value) {
+ if((ret_value = (op)(H5B2_NAT_NREC(native, shared, u), op_data)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
+ } /* end if */
} /* end for */
/* Descend into last child node, if current node is an internal node */
@@ -2181,10 +2202,11 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
} /* end if */
done:
- /* Unlock current node */
- if(node)
- if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
+ /* Release the node pointers & native records, if they were copied */
+ if(node_ptrs)
+ H5FL_FAC_FREE(shared->node_info[depth].node_ptr_fac, node_ptrs);
+ if(native)
+ H5FL_FAC_FREE(shared->node_info[depth].nat_rec_fac, native);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_iterate_node() */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 82c90f4..2ed9555 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -56,13 +56,15 @@ typedef enum H5B2_subid_t {
H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects */
H5B2_FHEAP_HUGE_DIR_ID, /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */
H5B2_FHEAP_HUGE_FILT_DIR_ID, /* B-tree is for fractal heap directly accessed, filtered 'huge' objects */
+ H5B2_GRP_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" link storage in groups */
+ H5B2_GRP_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" link storage in groups */
H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
} H5B2_subid_t;
/* Define the operator callback function pointer for H5B2_iterate() */
typedef int (*H5B2_operator_t)(const void *record, void *op_data);
-/* Define the 'found' callback function pointer for H5B2_find() & H5B2_neighbor() */
+/* Define the 'found' callback function pointer for H5B2_find(), H5B2_neighbor() & H5B2_index() */
typedef herr_t (*H5B2_found_t)(const void *record, void *op_data);
/* Define the 'modify' callback function pointer for H5B2_modify() */
@@ -106,7 +108,7 @@ struct H5B2_class_t {
/* v2 B-tree metadata statistics info */
typedef struct H5B2_stat_t {
unsigned depth; /* Depth of B-tree */
- unsigned nrecords; /* Number of records */
+ hsize_t nrecords; /* Number of records */
} H5B2_stat_t;
/*****************************/
diff --git a/src/H5Dio.c b/src/H5Dio.c
index b615f44..333852e 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -196,7 +196,7 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
/* Fill the selection in the memory buffer */
- if(H5D_fill(fill,fill_type,buf,buf_type,space, H5AC_dxpl_id)<0)
+ if(H5D_fill(fill,fill_type,buf,buf_type,space, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
done:
@@ -258,8 +258,8 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_t
/* Get the maximum buffer size needed and allocate it */
buf_size=MAX(src_type_size,dst_type_size);
- if (NULL==(tconv_buf = H5FL_BLK_MALLOC(type_elem,buf_size)) || NULL==(bkg_buf = H5FL_BLK_CALLOC(type_elem,buf_size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ if(NULL == (tconv_buf = H5FL_BLK_MALLOC(type_elem,buf_size)) || NULL==(bkg_buf = H5FL_BLK_CALLOC(type_elem,buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Check for actual fill value to replicate */
if(fill==NULL)
@@ -270,23 +270,23 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_t
HDmemcpy(tconv_buf,fill,src_type_size);
/* Set up type conversion function */
- if (NULL == (tpath = H5T_path_find(fill_type, buf_type, NULL, NULL, dxpl_id, FALSE)))
+ if(NULL == (tpath = H5T_path_find(fill_type, buf_type, NULL, NULL, dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* Convert memory buffer into disk buffer */
- if (!H5T_path_noop(tpath)) {
- if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill_type, H5T_COPY_ALL)))<0 ||
- (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(buf_type, H5T_COPY_ALL)))<0)
+ if(!H5T_path_noop(tpath)) {
+ if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill_type, H5T_COPY_ALL))) < 0 ||
+ (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(buf_type, H5T_COPY_ALL))) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
/* Perform data type conversion */
- if (H5T_convert(tpath, src_id, dst_id, 1, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0)
+ if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
} /* end if */
} /* end if */
/* Fill the selection in the memory buffer */
- if(H5S_select_fill(tconv_buf, dst_type_size, space, buf)<0)
+ if(H5S_select_fill(tconv_buf, dst_type_size, space, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
done:
@@ -333,48 +333,48 @@ H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Get maximum temporary buffer size */
- if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &cache->max_temp_buf)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size")
+ if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &cache->max_temp_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size")
/* Get temporary buffer pointer */
- if(H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &cache->tconv_buf)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer")
+ if(H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &cache->tconv_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer")
/* Get background buffer pointer */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &cache->bkgr_buf)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer")
+ if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &cache->bkgr_buf) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer")
/* Get background buffer type */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &cache->bkgr_buf_type)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+ if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &cache->bkgr_buf_type) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
/* Get B-tree split ratios */
- if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
+ if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
/* Get I/O vector size */
- if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size")
+ if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size")
#ifdef H5_HAVE_PARALLEL
/* Collect Parallel I/O information for possible later use */
- if(H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &cache->xfer_mode)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
- if(H5P_get(dx_plist, H5D_XFER_IO_XFER_OPT_MODE_NAME, &cache->xfer_opt_mode)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
+ if(H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &cache->xfer_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
+ if(H5P_get(dx_plist, H5D_XFER_IO_XFER_OPT_MODE_NAME, &cache->xfer_opt_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
#endif /*H5_HAVE_PARALLEL*/
/* Get error detection properties */
- if(H5P_get(dx_plist, H5D_XFER_EDC_NAME, &cache->err_detect)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve error detection info")
+ if(H5P_get(dx_plist, H5D_XFER_EDC_NAME, &cache->err_detect) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve error detection info")
/* Get filter callback function */
- if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function")
+ if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function")
/* Get the data transform property */
- if(H5P_get(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve data transform info")
+ if(H5P_get(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve data transform info")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -417,8 +417,8 @@ H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache)
if(dxpl_id==H5P_DATASET_XFER_DEFAULT)
*cache=&H5D_def_dxpl_cache;
else
- if(H5D_get_dxpl_cache_real(dxpl_id,*cache)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTGET, FAIL, "Can't retrieve DXPL values")
+ if(H5D_get_dxpl_cache_real(dxpl_id,*cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't retrieve DXPL values")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -634,23 +634,23 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
file_space = dataset->shared->space;
if(!mem_space)
mem_space = file_space;
- if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space))<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
+ if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
/* Fill the DXPL cache values for later use */
- if(H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
+ if(H5D_get_dxpl_cache(dxpl_id,&dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
#ifdef H5_HAVE_PARALLEL
/* Collective access is not permissible without a MPI based VFD */
if (dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->oloc.file))
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only")
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same */
if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
/* Make sure that both selections have their extents set */
if( !(H5S_has_extent(file_space)) )
@@ -673,7 +673,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
- if(H5P_is_fill_value_defined(&dataset->shared->dcpl_cache.fill, &fill_status)<0)
+ if(H5P_is_fill_value_defined(&dataset->shared->dcpl_cache.fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* Should be impossible, but check anyway... */
@@ -686,7 +686,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_DONE(SUCCEED)
/* Go fill the user's selection with the dataset's fill value */
- if(H5D_fill(dataset->shared->dcpl_cache.fill.buf,dataset->shared->type,buf,mem_type,mem_space,dxpl_id)<0)
+ if(H5D_fill(dataset->shared->dcpl_cache.fill.buf,dataset->shared->type,buf,mem_type,mem_space,dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed")
else
HGOTO_DONE(SUCCEED)
@@ -704,8 +704,8 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* Set up I/O operation */
- if(H5D_ioinfo_init(dataset,dxpl_cache,dxpl_id,mem_space,file_space,tpath,&io_info)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
+ if(H5D_ioinfo_init(dataset,dxpl_cache,dxpl_id,mem_space,file_space,tpath,&io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
#ifdef H5_HAVE_PARALLEL
io_info_init = TRUE;
#endif /*H5_HAVE_PARALLEL*/
@@ -713,12 +713,12 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Determine correct I/O routine to invoke */
if(dataset->shared->layout.type!=H5D_CHUNKED) {
if(H5D_contig_read(&io_info, nelmts, mem_type, mem_space, file_space, tpath,
- dataset->shared->type_id, mem_type_id, buf)<0)
+ dataset->shared->type_id, mem_type_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
} /* end if */
else {
if(H5D_chunk_read(&io_info, nelmts, mem_type, mem_space, file_space, tpath,
- dataset->shared->type_id, mem_type_id, buf)<0)
+ dataset->shared->type_id, mem_type_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
} /* end else */
@@ -794,7 +794,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* This is because they use the global heap in the file and we don't */
/* support parallel access of that yet */
if(H5T_detect_class(mem_type, H5T_VLEN)>0)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet")
/* If MPI based VFD is used, no VL datatype support yet. */
/* This is because they use the global heap in the file and we don't */
@@ -804,13 +804,13 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
*/
if (H5T_get_class(mem_type, TRUE)==H5T_REFERENCE &&
H5T_get_ref_type(mem_type)==H5R_DATASET_REGION)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet")
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
/* Collective access is not permissible without a MPI based VFD */
if (dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only")
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only")
} /* end else */
#endif /*H5_HAVE_PARALLEL*/
@@ -818,13 +818,13 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
file_space = dataset->shared->space;
if (!mem_space)
mem_space = file_space;
- if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space))<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
+ if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
/* Make certain that the number of elements in each selection is the same */
if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
/* Make sure that both selections have their extents set */
if( !(H5S_has_extent(file_space)) )
@@ -844,7 +844,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Get the number of elements in file dataset's dataspace */
if((file_nelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, FAIL, "can't retrieve number of elements in file dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "can't retrieve number of elements in file dataset")
/* Always allow fill values to be written if the dataset has a VL datatype */
if(H5T_detect_class(dataset->shared->type, H5T_VLEN))
@@ -853,7 +853,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
full_overwrite = (hsize_t)file_nelmts==nelmts ? TRUE : FALSE;
/* Allocate storage */
- if(H5D_alloc_storage(dataset->oloc.file, dxpl_id, dataset, H5D_ALLOC_WRITE, TRUE, full_overwrite)<0)
+ if(H5D_alloc_storage(dataset->oloc.file, dxpl_id, dataset, H5D_ALLOC_WRITE, TRUE, full_overwrite) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
} /* end if */
@@ -869,8 +869,8 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* Set up I/O operation */
- if(H5D_ioinfo_init(dataset,dxpl_cache,dxpl_id,mem_space,file_space,tpath,&io_info)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
+ if(H5D_ioinfo_init(dataset,dxpl_cache,dxpl_id,mem_space,file_space,tpath,&io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
#ifdef H5_HAVE_PARALLEL
io_info_init = TRUE;
#endif /*H5_HAVE_PARALLEL*/
@@ -878,12 +878,12 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Determine correct I/O routine to invoke */
if(dataset->shared->layout.type!=H5D_CHUNKED) {
if(H5D_contig_write(&io_info, nelmts, mem_type, mem_space, file_space, tpath,
- mem_type_id, dataset->shared->type_id, buf)<0)
+ mem_type_id, dataset->shared->type_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
} /* end if */
else {
if(H5D_chunk_write(&io_info, nelmts, mem_type, mem_space, file_space, tpath,
- mem_type_id, dataset->shared->type_id, buf)<0)
+ mem_type_id, dataset->shared->type_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
} /* end else */
@@ -898,7 +898,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* Update modification time. We have to do this explicitly because
* writing to a dataset doesn't necessarily change the object header.
*/
- if (H5O_touch(&(dataset->oloc), FALSE, dxpl_id)<0)
+ if (H5O_touch(&(dataset->oloc), FALSE, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time")
#endif /* OLD_WAY */
@@ -989,7 +989,7 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
#ifdef H5_HAVE_PARALLEL
if(io_info->dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE) {
- if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,FALSE)<0)
+ if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "contiguous read failed in collective mode");
}
else
@@ -1038,17 +1038,17 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
/* Sanity check elements in temporary buffer */
if (request_nelmts==0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/* Figure out the strip mine size. */
- if (H5S_select_iter_init(&file_iter, file_space, src_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(&file_iter, file_space, src_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&mem_iter, mem_space, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(&mem_iter, mem_space, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&bkg_iter, mem_space, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
+ if (H5S_select_iter_init(&bkg_iter, mem_space, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init=1; /*file selection iteration info has been initialized */
/*
@@ -1071,13 +1071,13 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
/* (Need calloc()-like call since memory needs to be initialized) */
if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(request_nelmts*dst_type_size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
} /* end if */
/* Start strip mining... */
@@ -1123,13 +1123,13 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[1].bkg_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
/*
* Perform data type conversion.
*/
- if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0, tconv_buf, bkg_buf, io_info->dxpl_id)<0)
+ if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed")
/* Do the data transform after the conversion (since we're using type mem_type) */
@@ -1151,23 +1151,22 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[1].scat_ncalls++;
#endif
if (status<0)
- HGOTO_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
-
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end for */
done:
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if (tconv_buf && NULL==dxpl_cache->tconv_buf)
@@ -1247,7 +1246,7 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
H5_CHECK_OVERFLOW(nelmts,hsize_t,size_t);
#ifdef H5_HAVE_PARALLEL
if(io_info->dxpl_cache->xfer_mode == H5FD_MPIO_COLLECTIVE) {
- if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,TRUE)<0)
+ if(H5D_contig_collective_io(io_info,file_space,mem_space,buf,TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "contiguous write failed in collective mode");
}
else
@@ -1296,17 +1295,17 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
/* Sanity check elements in temporary buffer */
if (request_nelmts==0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/* Figure out the strip mine size. */
- if (H5S_select_iter_init(&file_iter, file_space, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(&file_iter, file_space, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&mem_iter, mem_space, src_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(&mem_iter, mem_space, src_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&bkg_iter, file_space, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
+ if (H5S_select_iter_init(&bkg_iter, file_space, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init=1; /*file selection iteration info has been initialized */
/*
@@ -1333,13 +1332,13 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
/* (Don't need calloc()-like call since file data is already initialized) */
if((bkg_buf=H5FL_BLK_MALLOC(type_conv,(request_nelmts*dst_type_size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
} /* end if */
/* Start strip mining... */
@@ -1364,7 +1363,7 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].gath_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
if (H5T_BKG_YES==need_bkg) {
#ifdef H5S_DEBUG
@@ -1380,13 +1379,13 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].bkg_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed")
} /* end if */
/*
* Perform data type conversion.
*/
- if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0, tconv_buf, bkg_buf, io_info->dxpl_id)<0)
+ if(H5T_convert(tpath, src_id, dst_id, smine_nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed")
/* Do the data transform after the type conversion (since we're using dataset->shared->type). */
@@ -1409,22 +1408,22 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].scat_ncalls++;
#endif
if (status<0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "scatter failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
done:
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if (tconv_buf && NULL==dxpl_cache->tconv_buf)
@@ -1484,7 +1483,7 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_read)
/* Map elements between file and memory for each chunk*/
- if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm)<0)
+ if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't build chunk mapping")
/* Set dataset storage for I/O info */
@@ -1583,7 +1582,7 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
/* Sanity check elements in temporary buffer */
if (request_nelmts==0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/*
* Get a temporary buffer for type conversion unless the app has already
@@ -1605,13 +1604,13 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
/* (Need calloc()-like call since memory needs to be initialized) */
if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(request_nelmts*dst_type_size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
} /* end if */
/* Loop over all the chunks, performing I/O on each */
@@ -1627,14 +1626,14 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
chunk_info=H5SL_item(chunk_node);
/* initialize selection iterator */
- if (H5S_select_iter_init(&file_iter, chunk_info->fspace, src_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(&file_iter, chunk_info->fspace, src_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&bkg_iter, chunk_info->mspace, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
+ if (H5S_select_iter_init(&bkg_iter, chunk_info->mspace, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init=1; /*file selection iteration info has been initialized */
/* Pass in chunk's coordinates in a union*/
@@ -1682,14 +1681,13 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[1].bkg_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
/*
* Perform data type conversion.
*/
- if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0,
- tconv_buf, bkg_buf, io_info->dxpl_id)<0)
+ if(H5T_convert(tpath, src_id, dst_id, smine_nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed")
/* Do the data transform after the conversion (since we're using type mem_type) */
@@ -1711,23 +1709,23 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[1].scat_ncalls++;
#endif
if (status<0)
- HGOTO_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end for */
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
file_iter_init=0;
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
mem_iter_init=0;
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
bkg_iter_init=0;
} /* end if */
@@ -1738,16 +1736,16 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts,
done:
/* Release selection iterators, if necessary */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if (tconv_buf && NULL==dxpl_cache->tconv_buf)
@@ -1812,7 +1810,7 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_write)
/* Map elements between file and memory for each chunk*/
- if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm)<0)
+ if(H5D_create_chunk_map(dataset, mem_type, file_space, mem_space, &fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't build chunk mapping")
/* Set dataset storage for I/O info */
@@ -1905,7 +1903,7 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
/* Sanity check elements in temporary buffer */
if (request_nelmts==0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/*
* Get a temporary buffer for type conversion unless the app has already
@@ -1931,13 +1929,13 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
/* (Don't need calloc()-like call since file data is already initialized) */
if((bkg_buf=H5FL_BLK_MALLOC(type_conv,(request_nelmts*dst_type_size)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
} /* end if */
/* Loop over all the chunks, performing I/O on each */
@@ -1953,14 +1951,14 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
chunk_info=H5SL_item(chunk_node);
/* initialize selection iterator */
- if (H5S_select_iter_init(&file_iter, chunk_info->fspace, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(&file_iter, chunk_info->fspace, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, src_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(&mem_iter, chunk_info->mspace, src_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init=1; /*file selection iteration info has been initialized */
- if (H5S_select_iter_init(&bkg_iter, chunk_info->fspace, dst_type_size)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
+ if (H5S_select_iter_init(&bkg_iter, chunk_info->fspace, dst_type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init=1; /*file selection iteration info has been initialized */
/*pass in chunk's coordinates in a union*/
@@ -2005,14 +2003,13 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].bkg_ncalls++;
#endif
if (n!=smine_nelmts)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file gather failed")
} /* end if */
/*
* Perform data type conversion.
*/
- if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0,
- tconv_buf, bkg_buf, io_info->dxpl_id)<0)
+ if(H5T_convert(tpath, src_id, dst_id, smine_nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed")
/* Do the data transform after the type conversion (since we're using dataset->shared->type) */
@@ -2036,23 +2033,23 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
io_info->stats->stats[0].scat_ncalls++;
#endif
if (status<0)
- HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "scatter failed")
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
file_iter_init=0;
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
mem_iter_init=0;
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
bkg_iter_init=0;
} /* end if */
@@ -2063,16 +2060,16 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts,
done:
/* Release selection iterators, if necessary */
if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if (tconv_buf && NULL==dxpl_cache->tconv_buf)
@@ -2128,8 +2125,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* Check if the memory space is scalar & make equivalent memory space */
- if((sm_ndims = H5S_GET_EXTENT_NDIMS(mem_space))<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number")
+ if((sm_ndims = H5S_GET_EXTENT_NDIMS(mem_space)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number")
if(sm_ndims==0) {
hsize_t dims[H5O_LAYOUT_NDIMS]; /* Temporary dimension information */
@@ -2137,7 +2134,7 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
for(u=0; u<dataset->shared->layout.u.chunk.ndims-1; u++)
dims[u]=1;
if((equiv_mspace = H5S_create_simple(dataset->shared->layout.u.chunk.ndims-1,dims,NULL))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create equivalent dataspace for scalar space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create equivalent dataspace for scalar space")
/* Indicate that this space needs to be released */
equiv_mspace_init=1;
@@ -2155,8 +2152,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* Get dim number and dimensionality for each dataspace */
fm->f_ndims=f_ndims=dataset->shared->layout.u.chunk.ndims-1;
- if(H5S_get_simple_extent_dims(file_space, fm->f_dims, NULL)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
+ if(H5S_get_simple_extent_dims(file_space, fm->f_dims, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality")
/* Normalize hyperslab selections by adjusting them by the offset */
/* (It might be worthwhile to normalize both the file and memory dataspaces
@@ -2164,8 +2161,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
* speed up hyperslab calculations by removing the extra checks and/or
* additions involving the offset and the hyperslab selection -QAK)
*/
- if(H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
+ if(H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
file_space_normalized = TRUE;
/* Decide the number of chunks in each dimension*/
@@ -2178,8 +2175,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
} /* end for */
/* Compute the "down" size of 'chunks' information */
- if(H5V_array_down(f_ndims,fm->chunks,fm->down_chunks)<0)
- HGOTO_ERROR (H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
+ if(H5V_array_down(f_ndims,fm->chunks,fm->down_chunks) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute 'down' sizes")
/* calculate total chunk in file map*/
fm->select_chunk = NULL;
@@ -2189,14 +2186,14 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
if(IS_H5FD_MPI(dataset->oloc.file)) {
H5_CHECK_OVERFLOW(fm->total_chunks, hsize_t, size_t);
if(NULL == (fm->select_chunk = (hbool_t *) H5MM_calloc((size_t)fm->total_chunks * sizeof(hbool_t))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
}
/* Initialize skip list for chunk selections */
- if((fm->fsel=H5SL_create(H5SL_TYPE_HSIZE,0.5,H5D_DEFAULT_SKIPLIST_HEIGHT))==NULL)
+ if((fm->fsel = H5SL_create(H5SL_TYPE_HSIZE, 0.5, (size_t)H5D_DEFAULT_SKIPLIST_HEIGHT))==NULL)
HGOTO_ERROR(H5E_DATASET,H5E_CANTCREATE,FAIL,"can't create skip list for chunk selections")
/* Initialize "last chunk" information */
@@ -2210,9 +2207,9 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* Get type of selection on disk & in memory */
if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<H5S_SEL_NONE)
- HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<H5S_SEL_NONE)
- HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
/* If the selection is NONE or POINTS, set the flag to FALSE */
if(fsel_type == H5S_SEL_POINTS || fsel_type == H5S_SEL_NONE)
@@ -2222,12 +2219,12 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* Check if file selection is a point selection */
if(!sel_hyper_flag) {
/* Create temporary datatypes for selection iteration */
- if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL)))<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
+ if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL))) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
/* Spaces aren't the same shape, iterate over the memory selection directly */
- if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_file_cb, fm)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
+ if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_file_cb, fm) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
/* Reset "last chunk" info */
fm->last_index=(hsize_t)-1;
@@ -2235,8 +2232,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
} /* end if */
else {
/* Build the file selection for each chunk */
- if(H5D_create_chunk_file_map_hyper(fm,dataset)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
+ if(H5D_create_chunk_file_map_hyper(fm,dataset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
/* Clean file chunks' hyperslab span "scratch" information */
curr_node=H5SL_first(fm->fsel);
@@ -2248,8 +2245,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
assert(chunk_info);
/* Clean hyperslab span's "scratch" information */
- if(H5S_hyper_reset_scratch(chunk_info->fspace)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
+ if(H5S_hyper_reset_scratch(chunk_info->fspace) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
/* Get the next chunk node in the skip list */
curr_node=H5SL_next(curr_node);
@@ -2264,39 +2261,39 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
/* If the selections are the same shape, use the file chunk information
* to generate the memory chunk information quickly.
*/
- if(H5D_create_chunk_mem_map_hyper(fm)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
+ if(H5D_create_chunk_mem_map_hyper(fm) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
} /* end if */
else {
size_t elmt_size; /* Memory datatype size */
/* Make a copy of equivalent memory space */
if((tmp_mspace = H5S_copy(equiv_mspace,TRUE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* De-select the mem space copy */
- if(H5S_select_none(tmp_mspace)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select memory space")
+ if(H5S_select_none(tmp_mspace) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select memory space")
/* Save chunk template information */
fm->mchunk_tmpl=tmp_mspace;
/* Create temporary datatypes for selection iteration */
if(f_tid<0) {
- if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL)))<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
+ if((f_tid = H5I_register(H5I_DATATYPE, H5T_copy(dataset->shared->type, H5T_COPY_ALL))) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register file datatype")
} /* end if */
/* Create selection iterator for memory selection */
if((elmt_size=H5T_get_size(mem_type))==0)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
- if (H5S_select_iter_init(&(fm->mem_iter), equiv_mspace, elmt_size)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
+ if (H5S_select_iter_init(&(fm->mem_iter), equiv_mspace, elmt_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init=1; /* Selection iteration info has been initialized */
/* Spaces aren't the same shape, iterate over the memory selection directly */
- if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_mem_cb, fm)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
+ if(H5S_select_iterate(&bogus, f_tid, file_space, H5D_chunk_mem_cb, fm) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
/* Clean up hyperslab stuff, if necessary */
if(fm->msel_type!=H5S_SEL_POINTS) {
@@ -2310,8 +2307,8 @@ H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *f
assert(chunk_info);
/* Clean hyperslab span's "scratch" information */
- if(H5S_hyper_reset_scratch(chunk_info->mspace)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
+ if(H5S_hyper_reset_scratch(chunk_info->mspace) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset span scratch info")
/* Get the next chunk node in the skip list */
curr_node=H5SL_next(curr_node);
@@ -2323,12 +2320,12 @@ done:
/* Release the [potentially partially built] chunk mapping information if an error occurs */
if(ret_value<0) {
if(tmp_mspace && !fm->mchunk_tmpl) {
- if(H5S_close(tmp_mspace)<0)
+ if(H5S_close(tmp_mspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
} /* end if */
- if (H5D_destroy_chunk_map(fm)<0)
- HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping")
+ if (H5D_destroy_chunk_map(fm) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping")
} /* end if */
/* Reset the global dataspace info */
@@ -2336,20 +2333,20 @@ done:
fm->mem_space=NULL;
if(equiv_mspace_init && equiv_mspace) {
- if(H5S_close(equiv_mspace)<0)
+ if(H5S_close(equiv_mspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
} /* end if */
if(iter_init) {
- if (H5S_SELECT_ITER_RELEASE(&(fm->mem_iter))<0)
- HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if (H5S_SELECT_ITER_RELEASE(&(fm->mem_iter)) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
}
if(f_tid!=(-1)) {
- if(H5I_dec_ref(f_tid)<0)
- HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
+ if(H5I_dec_ref(f_tid) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
} /* end if */
if(file_space_normalized) {
- if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset)<0)
- HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
+ if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -2418,7 +2415,7 @@ H5D_destroy_chunk_map(const fm_map *fm)
/* Free the chunk info skip list */
if(fm->fsel) {
if(H5SL_count(fm->fsel)>0)
- if(H5SL_iterate(fm->fsel,H5D_free_chunk_info,NULL)<0)
+ if(H5SL_iterate(fm->fsel,H5D_free_chunk_info,NULL) < 0)
HGOTO_ERROR(H5E_PLIST,H5E_CANTNEXT,FAIL,"can't iterate over chunks")
H5SL_close(fm->fsel);
@@ -2426,7 +2423,7 @@ H5D_destroy_chunk_map(const fm_map *fm)
/* Free the memory chunk dataspace template */
if(fm->mchunk_tmpl)
- if(H5S_close(fm->mchunk_tmpl)<0)
+ if(H5S_close(fm->mchunk_tmpl) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
if(fm->select_chunk) H5MM_xfree(fm->select_chunk);
done:
@@ -2467,12 +2464,12 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
assert(fm->f_ndims>0);
/* Get number of elements selected in file */
- if((ssel_points=H5S_GET_SELECT_NPOINTS(fm->file_space))<0)
+ if((ssel_points=H5S_GET_SELECT_NPOINTS(fm->file_space)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
H5_ASSIGN_OVERFLOW(sel_points,ssel_points,hssize_t,hsize_t);
/* Get bounding box for selection (to reduce the number of chunks to iterate over) */
- if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Set initial chunk location & hyperslab size */
@@ -2485,8 +2482,8 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
/* Calculate the index of this chunk */
- if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Iterate through each chunk in the dataset */
while(sel_points) {
@@ -2499,28 +2496,28 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
/* Create "temporary" chunk for selection operations (copy file space) */
if((tmp_fchunk = H5S_copy(fm->file_space,TRUE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */
- if(H5S_hyper_convert(tmp_fchunk)<0) {
+ if(H5S_hyper_convert(tmp_fchunk) < 0) {
(void)H5S_close(tmp_fchunk);
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees")
} /* end if */
/* "AND" temporary chunk and current chunk */
- if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,fm->chunk_dim,NULL)<0) {
+ if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,fm->chunk_dim,NULL) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't create chunk selection")
} /* end if */
/* Resize chunk's dataspace dimensions to size of chunk */
- if(H5S_set_extent_real(tmp_fchunk,fm->chunk_dim)<0) {
+ if(H5S_set_extent_real(tmp_fchunk,fm->chunk_dim) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions")
} /* end if */
/* Move selection back to have correct offset in chunk */
- if(H5S_hyper_adjust_u(tmp_fchunk,coords)<0) {
+ if(H5S_hyper_adjust_u(tmp_fchunk,coords) < 0) {
(void)H5S_close(tmp_fchunk);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
} /* end if */
@@ -2530,7 +2527,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
/* Allocate the file & memory chunk information */
if (NULL==(new_chunk_info = H5FL_MALLOC (H5D_chunk_info_t))) {
(void)H5S_close(tmp_fchunk);
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
} /* end if */
/* Initialize the chunk information */
@@ -2555,13 +2552,13 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
new_chunk_info->coords[fm->f_ndims]=0;
/* Insert the new chunk into the skip list */
- if(H5SL_insert(fm->fsel,new_chunk_info,&new_chunk_info->index)<0) {
+ if(H5SL_insert(fm->fsel,new_chunk_info,&new_chunk_info->index) < 0) {
H5D_free_chunk_info(new_chunk_info,NULL,NULL);
HGOTO_ERROR(H5E_DATASPACE,H5E_CANTINSERT,FAIL,"can't insert chunk into skip list")
} /* end if */
/* Get number of elements selected in chunk */
- if((schunk_points=H5S_GET_SELECT_NPOINTS(tmp_fchunk))<0)
+ if((schunk_points=H5S_GET_SELECT_NPOINTS(tmp_fchunk)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
H5_ASSIGN_OVERFLOW(new_chunk_info->chunk_points,schunk_points,hssize_t,size_t);
@@ -2601,8 +2598,8 @@ H5D_create_chunk_file_map_hyper(fm_map *fm,const H5D_t *dset)
} while(coords[curr_dim]>sel_end[curr_dim]);
/* Re-Calculate the index of this chunk */
- if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ if(H5V_chunk_index(fm->f_ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
} /* end if */
} /* end while */
@@ -2660,7 +2657,7 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
if(fm->mem_space_copy) {
/* Copy the memory dataspace & selection to be the chunk's dataspace & selection */
if((chunk_info->mspace = H5S_copy(fm->mem_space,FALSE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
} /* end if */
else {
/* Just point at the memory dataspace & selection */
@@ -2673,11 +2670,11 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
} /* end if */
else {
/* Get bounding box for file selection */
- if(H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Get bounding box for memory selection */
- if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Calculate the adjustment for memory selection from file selection */
@@ -2701,15 +2698,15 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
/* Copy the memory dataspace */
if((chunk_info->mspace = H5S_copy(fm->mem_space,TRUE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Release the current selection */
- if(H5S_SELECT_RELEASE(chunk_info->mspace)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
+ if(H5S_SELECT_RELEASE(chunk_info->mspace) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
/* Copy the file chunk's selection */
- if(H5S_select_copy(chunk_info->mspace,chunk_info->fspace,FALSE)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
+ if(H5S_select_copy(chunk_info->mspace,chunk_info->fspace,FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
/* Compensate for the chunk offset */
for(u=0; u<fm->f_ndims; u++) {
@@ -2718,7 +2715,7 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
} /* end for */
/* Adjust the selection */
- if(H5S_hyper_adjust_s(chunk_info->mspace,chunk_adjust)<0) /*lint !e772 The chunk_adjust array will always be initialized */
+ if(H5S_hyper_adjust_s(chunk_info->mspace,chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
/* Get the next chunk node in the skip list */
@@ -2757,8 +2754,8 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_file_cb)
/* Calculate the index of this chunk */
- if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Find correct chunk in file & memory skip list */
if(chunk_index==fm->last_index) {
@@ -2777,7 +2774,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
/* Allocate the file & memory chunk information */
if (NULL==(chunk_info = H5FL_MALLOC (H5D_chunk_info_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
/* Initialize the chunk information */
@@ -2787,14 +2784,14 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
/* Create a dataspace for the chunk */
if((fspace = H5S_create_simple(fm->f_ndims,fm->chunk_dim,NULL))==NULL) {
H5FL_FREE(H5D_chunk_info_t,chunk_info);
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk")
} /* end if */
/* De-select the chunk space */
- if(H5S_select_none(fspace)<0) {
+ if(H5S_select_none(fspace) < 0) {
(void)H5S_close(fspace);
H5FL_FREE(H5D_chunk_info_t,chunk_info);
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace")
} /* end if */
/* Set the file chunk dataspace */
@@ -2815,7 +2812,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
chunk_info->coords[fm->f_ndims]=0;
/* Insert the new chunk into the skip list */
- if(H5SL_insert(fm->fsel,chunk_info,&chunk_info->index)<0) {
+ if(H5SL_insert(fm->fsel,chunk_info,&chunk_info->index) < 0) {
H5D_free_chunk_info(chunk_info,NULL,NULL);
HGOTO_ERROR(H5E_DATASPACE,H5E_CANTINSERT,FAIL,"can't insert chunk into skip list")
} /* end if */
@@ -2831,8 +2828,8 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
coords_in_chunk[u]=coords[u]%fm->layout->u.chunk.dim[u];
/* Add point to file selection for chunk */
- if(H5S_select_elements(chunk_info->fspace,H5S_SELECT_APPEND,1,(const hsize_t **)coords_in_chunk)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
+ if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, (const hsize_t **)coords_in_chunk) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
/* Increment the number of elemented selected in chunk */
chunk_info->chunk_points++;
@@ -2868,8 +2865,8 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_mem_cb)
/* Calculate the index of this chunk */
- if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
+ if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index")
/* Find correct chunk in file & memory skip list */
if(chunk_index==fm->last_index) {
@@ -2890,7 +2887,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
if(chunk_info->mspace==NULL) {
/* Copy the template memory chunk dataspace */
if((chunk_info->mspace = H5S_copy(fm->mchunk_tmpl,FALSE))==NULL)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space")
} /* end else */
/* Update the "last chunk seen" information */
@@ -2899,22 +2896,22 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
} /* end else */
/* Get coordinates of selection iterator for memory */
- if(H5S_SELECT_ITER_COORDS(&fm->mem_iter,coords_in_mem)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates")
+ if(H5S_SELECT_ITER_COORDS(&fm->mem_iter,coords_in_mem) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates")
/* Add point to memory selection for chunk */
if(fm->msel_type==H5S_SEL_POINTS) {
- if(H5S_select_elements(chunk_info->mspace,H5S_SELECT_APPEND,1,(const hsize_t **)coords_in_mem)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
+ if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, (const hsize_t **)coords_in_mem) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
} /* end if */
else {
- if(H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
+ if(H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
} /* end else */
/* Move memory selection iterator to next element in selection */
- if(H5S_SELECT_ITER_NEXT(&fm->mem_iter,1)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location")
+ if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3042,7 +3039,7 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
if(check_prop > 0) {
int prop_value = 0;
- if(H5Pset(dxpl_id,H5D_XFER_COLL_CHUNK_NAME,&prop_value)<0)
+ if(H5Pset(dxpl_id,H5D_XFER_COLL_CHUNK_NAME,&prop_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "unable to set property value");
} /* end if */
} /* end if */
diff --git a/src/H5Edefin.h b/src/H5Edefin.h
index b785882..4a4a98c 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -103,6 +103,7 @@ hid_t H5E_BADMESG_g = FAIL; /* Unrecognized message */
hid_t H5E_CANTDELETE_g = FAIL; /* Can't delete message */
hid_t H5E_BADITER_g = FAIL; /* Iteration failed */
hid_t H5E_CANTPACK_g = FAIL; /* Can't pack messages */
+hid_t H5E_CANTRESET_g = FAIL; /* Can't reset object */
/* System level errors */
hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */
diff --git a/src/H5Einit.h b/src/H5Einit.h
index 28ede80..1ac6a99 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -377,6 +377,11 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTRESET_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* System level errors */
assert(H5E_SYSERRSTR_g==(-1));
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index 3e0ca3a..c705ddc 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -168,6 +168,7 @@ H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */
#define H5E_CANTDELETE (H5OPEN H5E_CANTDELETE_g)
#define H5E_BADITER (H5OPEN H5E_BADITER_g)
#define H5E_CANTPACK (H5OPEN H5E_CANTPACK_g)
+#define H5E_CANTRESET (H5OPEN H5E_CANTRESET_g)
H5_DLLVAR hid_t H5E_LINKCOUNT_g; /* Bad object header link count */
H5_DLLVAR hid_t H5E_VERSION_g; /* Wrong version number */
H5_DLLVAR hid_t H5E_ALIGNMENT_g; /* Alignment error */
@@ -175,6 +176,7 @@ H5_DLLVAR hid_t H5E_BADMESG_g; /* Unrecognized message */
H5_DLLVAR hid_t H5E_CANTDELETE_g; /* Can't delete message */
H5_DLLVAR hid_t H5E_BADITER_g; /* Iteration failed */
H5_DLLVAR hid_t H5E_CANTPACK_g; /* Can't pack messages */
+H5_DLLVAR hid_t H5E_CANTRESET_g; /* Can't reset object */
/* System level errors */
#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g)
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index 43191bc..2f0028a 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -104,7 +104,8 @@ H5E_ALIGNMENT_g=
H5E_BADMESG_g=
H5E_CANTDELETE_g=
H5E_BADITER_g=
-H5E_CANTPACK_g=
+H5E_CANTPACK_g=
+H5E_CANTRESET_g=
/* System level errors */
H5E_SYSERRSTR_g=
diff --git a/src/H5F.c b/src/H5F.c
index 455c658..dfb6d94 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -232,52 +232,52 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE)<0)
+ if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register the user block size */
- if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for symbol table leaf nodes */
- if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 1/2 rank for btree internal nodes */
- if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for an address */
- if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the byte number for object size */
- if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the superblock version number */
- if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the free-space version number */
- if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the object directory version number */
- if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the shared-header version number */
- if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
} /* end if */
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_FILE_CREATE_g==(-1)) {
/* Register the default file creation property list */
- if((H5P_LST_FILE_CREATE_g = H5P_create_id(crt_pclass))<0)
+ if((H5P_LST_FILE_CREATE_g = H5P_create_id(crt_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@@ -289,78 +289,78 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(acs_pclass,&nprops,FALSE)<0)
+ if(H5P_get_nprops_pclass(acs_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register the initial metadata cache resize configuration */
- if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_INIT_CONFIG_NAME,H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_INIT_CONFIG_NAME,H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache (elements) */
- if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache(bytes) */
- if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the preemption for reading chunks */
- if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the threshold for alignment */
- if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the alignment */
- if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum metadata allocation block size */
- if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the maximum sieve buffer size */
- if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the minimum "small data" allocation block size */
- if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the garbage collection reference */
- if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver ID */
- if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver info */
- if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file close degree */
- if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the offset of family driver info */
- if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of new family file size. It's used by h5repart only. */
- if(H5P_register(acs_pclass,H5F_ACS_FAMILY_NEWSIZE_NAME,H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FAMILY_NEWSIZE_NAME,H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */
- if(H5P_register(acs_pclass,H5F_ACS_FAMILY_TO_SEC2_NAME,H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_FAMILY_TO_SEC2_NAME,H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the data type of multi driver info */
- if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the 'use the latest version of the format' flag */
@@ -371,7 +371,7 @@ H5F_init_interface(void)
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_FILE_ACCESS_g==(-1)) {
/* Register the default file access property list */
- if((H5P_LST_FILE_ACCESS_g = H5P_create_id(acs_pclass))<0)
+ if((H5P_LST_FILE_ACCESS_g = H5P_create_id(acs_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@@ -383,20 +383,20 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(mnt_pclass,&nprops,FALSE)<0)
+ if(H5P_get_nprops_pclass(mnt_pclass,&nprops,FALSE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register property of whether symlinks is local to file */
- if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
} /* end if */
/* Only register the default property list if it hasn't been created yet */
if(H5P_LST_MOUNT_g==(-1)) {
/* Register the default file mount property list */
- if((H5P_LST_MOUNT_g = H5P_create_id(mnt_pclass))<0)
+ if((H5P_LST_MOUNT_g = H5P_create_id(mnt_pclass)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
} /* end if */
@@ -489,7 +489,7 @@ H5F_acs_create(hid_t fapl_id, void UNUSED *copy_data)
if(driver_id > 0) {
/* Set the driver for the property list */
- if(H5FD_fapl_open(plist, driver_id, driver_info)<0)
+ if(H5FD_fapl_open(plist, driver_id, driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
} /* end if */
@@ -539,7 +539,7 @@ H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id, void UNUSED *copy_data)
if(driver_id > 0) {
/* Set the driver for the property list */
- if(H5FD_fapl_open(new_plist, driver_id, driver_info)<0)
+ if(H5FD_fapl_open(new_plist, driver_id, driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
} /* end if */
@@ -588,7 +588,7 @@ H5F_acs_close(hid_t fapl_id, void UNUSED *close_data)
if(driver_id > 0) {
/* Close the driver for the property list */
- if(H5FD_fapl_close(driver_id, driver_info)<0)
+ if(H5FD_fapl_close(driver_id, driver_info) < 0)
HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */
}
@@ -885,7 +885,7 @@ H5F_get_access_plist(H5F_t *f)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't free the old driver information")
/* Increment the reference count on the driver ID and insert it into the property list */
- if(H5I_inc_ref(f->shared->lf->driver_id)<0)
+ if(H5I_inc_ref(f->shared->lf->driver_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver")
if(H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &(f->shared->lf->driver_id)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID")
@@ -936,7 +936,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types)
if( (types&H5F_OBJ_ALL)==0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type")
- if((ret_value = H5F_get_obj_count(f, types))<0)
+ if((ret_value = H5F_get_obj_count(f, types)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOUNT, FAIL, "can't get object count")
done:
@@ -1328,9 +1328,9 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id)
*/
for (n=8; n<maxpow; n++) {
addr = (8==n) ? 0 : (haddr_t)1 << n;
- if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN)<0)
+ if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature")
- if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, (size_t)H5F_SIGNATURE_LEN, buf)<0)
+ if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature")
if (!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN))
break;
@@ -1396,7 +1396,7 @@ H5Fis_hdf5(const char *name)
done:
/* Close the file */
if (file)
- if(H5FD_close(file)<0 && ret_value>=0)
+ if(H5FD_close(file) < 0 && ret_value>=0)
HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
FUNC_LEAVE_API(ret_value)
@@ -1475,13 +1475,13 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
f->shared->fcpl_id = H5P_copy_plist(plist);
/* Get the FCPL values to cache */
- if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &f->shared->sizeof_addr)<0)
+ if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &f->shared->sizeof_addr) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for address")
- if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size)<0)
+ if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size")
- if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, &f->shared->sym_leaf_k)<0)
+ if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, &f->shared->sym_leaf_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size")
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &f->shared->btree_k[0])<0)
+ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &f->shared->btree_k[0]) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get rank for btree internal nodes")
/* Check for non-default indexed storage B-tree internal 'K' value
@@ -1510,11 +1510,11 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get preempt read chunk")
- if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold))<0)
+ if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold")
if(H5P_get(plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment")
- if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME,&(f->shared->gc_ref))<0)
+ if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME,&(f->shared->gc_ref)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference")
if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size")
@@ -1530,7 +1530,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache")
/* Create the file's "open object" information */
- if(H5FO_create(f)<0)
+ if(H5FO_create(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Add new "shared" struct to list of open files */
@@ -1541,7 +1541,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
f->shared->nrefs++;
/* Create the file's "top open object" information */
- if(H5FO_top_create(f)<0)
+ if(H5FO_top_create(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Set return value */
@@ -1614,12 +1614,12 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
*/
if (f->shared->root_grp) {
/* Free the ID to name buffer */
- if(H5G_free_grp_name(f->shared->root_grp)<0)
+ if(H5G_free_grp_name(f->shared->root_grp) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
/* Free the memory for the root group */
- if(H5G_free(f->shared->root_grp)<0)
+ if(H5G_free(f->shared->root_grp) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
f->shared->root_grp=NULL;
@@ -1627,11 +1627,11 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
if (H5AC_dest(f, dxpl_id))
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
- if (H5FO_dest(f)<0)
+ if (H5FO_dest(f) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
f->shared->cwfs = H5MM_xfree (f->shared->cwfs);
- if (H5G_node_close(f)<0)
+ if (H5G_node_close(f) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
@@ -1644,7 +1644,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close property list")
/* Close low-level file */
- if (H5FD_close(f->shared->lf)<0)
+ if (H5FD_close(f->shared->lf) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file")
@@ -1823,7 +1823,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
* exists), or if the new request adds write access (since the
* readers don't expect the file to change under them).
*/
- if(H5FD_close(lf)<0)
+ if(H5FD_close(lf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info")
if (flags & H5F_ACC_TRUNC)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to truncate a file which is already open")
@@ -1843,7 +1843,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
* open it are different than the desired flags. Close the tentative
* file and open it for real.
*/
- if(H5FD_close(lf)<0) {
+ if(H5FD_close(lf) < 0) {
file = NULL; /*to prevent destruction of wrong file*/
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info")
} /* end if */
@@ -1911,7 +1911,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
/* (This must be after the space for the superblock is allocated in
* the file)
*/
- if (H5G_mkroot(file, dxpl_id, NULL)<0)
+ if (H5G_mkroot(file, dxpl_id, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group")
/* Write the superblock to the file */
@@ -1927,7 +1927,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
/* Make sure we can open the root group */
- if (H5G_mkroot(file, dxpl_id, &root_loc)<0)
+ if (H5G_mkroot(file, dxpl_id, &root_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group")
}
@@ -1957,7 +1957,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
done:
if (!ret_value && file)
- if(H5F_dest(file, dxpl_id)<0)
+ if(H5F_dest(file, dxpl_id) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2065,7 +2065,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file")
/* Get an atom for the file */
- if ((ret_value = H5I_register(H5I_FILE, new_file))<0)
+ if ((ret_value = H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
/* Keep this ID in file object structure */
@@ -2073,7 +2073,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
done:
if (ret_value<0 && new_file)
- if(H5F_close(new_file)<0)
+ if(H5F_close(new_file) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
FUNC_LEAVE_API(ret_value)
}
@@ -2145,7 +2145,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file")
/* Get an atom for the file */
- if ((ret_value = H5I_register(H5I_FILE, new_file))<0)
+ if ((ret_value = H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
/* Keep this ID in file object structure */
@@ -2153,7 +2153,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
done:
if (ret_value<0 && new_file)
- if(H5F_close(new_file)<0)
+ if(H5F_close(new_file) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file")
FUNC_LEAVE_API(ret_value)
}
@@ -2673,7 +2673,7 @@ H5Fclose(hid_t file_id)
* Decrement reference count on atom. When it reaches zero the file will
* be closed.
*/
- if(H5I_dec_ref (file_id) < 0)
+ if(H5I_dec_ref(file_id) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
@@ -2726,7 +2726,7 @@ H5Freopen(hid_t file_id)
/* Duplicate old file's name */
new_file->name = H5MM_xstrdup(old_file->name);
- if ((ret_value=H5I_register(H5I_FILE, new_file))<0)
+ if ((ret_value=H5I_register(H5I_FILE, new_file)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
/* Keep this ID in file object structure */
@@ -2734,7 +2734,7 @@ H5Freopen(hid_t file_id)
done:
if (ret_value<0 && new_file)
- if(H5F_dest(new_file, H5AC_dxpl_id)<0)
+ if(H5F_dest(new_file, H5AC_dxpl_id) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
FUNC_LEAVE_API(ret_value)
}
@@ -3135,7 +3135,7 @@ H5F_get_fileno(const H5F_t *f, unsigned long *filenum)
assert(filenum);
/* Retrieve the file's serial number */
- if(H5FD_get_fileno(f->shared->lf,filenum)<0)
+ if(H5FD_get_fileno(f->shared->lf,filenum) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno")
done:
@@ -3171,7 +3171,7 @@ H5F_get_id(H5F_t *file)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
} else {
/* Increment reference count on atom. */
- if(H5I_inc_ref(file->file_id)<0)
+ if(H5I_inc_ref(file->file_id) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
} /* end else */
@@ -3271,7 +3271,7 @@ H5F_mpi_get_rank(const H5F_t *f)
assert(f && f->shared);
/* Dispatch to driver */
- if ((ret_value=H5FD_mpi_get_rank(f->shared->lf))<0)
+ if ((ret_value=H5FD_mpi_get_rank(f->shared->lf)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed")
done:
@@ -3339,7 +3339,7 @@ H5F_mpi_get_size(const H5F_t *f)
assert(f && f->shared);
/* Dispatch to driver */
- if ((ret_value=H5FD_mpi_get_size(f->shared->lf))<0)
+ if ((ret_value=H5FD_mpi_get_size(f->shared->lf)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed")
done:
@@ -3522,7 +3522,7 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t
abs_addr = f->shared->base_addr + addr;
/* Read the data */
- if (H5FD_read(f->shared->lf, type, dxpl_id, abs_addr, size, buf)<0)
+ if(H5FD_read(f->shared->lf, type, dxpl_id, abs_addr, size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
done:
@@ -3682,9 +3682,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
/*-------------------------------------------------------------------------
* Function: H5Fget_freespace
*
- * Purpose: Retrieves the amount of free space (of a given type) in the
- * file. If TYPE is 'H5FD_MEM_DEFAULT', then the amount of free
- * space for all types is returned.
+ * Purpose: Retrieves the amount of free space in the file.
*
* Return: Success: Amount of free space for type
* Failure: Negative
@@ -3693,8 +3691,6 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
* koziol@ncsa.uiuc.edu
* Oct 6, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -3707,11 +3703,11 @@ H5Fget_freespace(hid_t file_id)
H5TRACE1("Hs","i",file_id);
/* Check args */
- if(NULL==(file=H5I_object_verify(file_id, H5I_FILE)))
+ if(NULL == (file = H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Go get the actual amount of free space in the file */
- if((ret_value = H5FD_get_freespace(file->shared->lf))<0)
+ if((ret_value = H5FD_get_freespace(file->shared->lf)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
done:
diff --git a/src/H5FD.c b/src/H5FD.c
index 84066f2..3388492 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -73,6 +73,9 @@ H5FL_BLK_DEFINE_STATIC(meta_accum);
#define H5FD_ACCUM_THROTTLE 8
#define H5FD_ACCUM_THRESHOLD 2048
+/* Define this to display information about file allocations */
+/* #define H5FD_ALLOC_DEBUG */
+
/* Static local variables */
/*
@@ -113,7 +116,7 @@ H5FD_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT(H5FD_init_interface)
- if (H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<H5I_FILE)
+ if(H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<H5I_FILE)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the file serial numbers */
@@ -151,8 +154,8 @@ H5FD_term_interface(void)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_term_interface)
- if (H5_interface_initialize_g) {
- if ((n=H5I_nmembers(H5I_VFL))!=0) {
+ if(H5_interface_initialize_g) {
+ if((n=H5I_nmembers(H5I_VFL))!=0) {
H5I_clear_type(H5I_VFL, FALSE);
/* Reset the VFL drivers, if they've been closed */
@@ -244,22 +247,22 @@ H5FDregister(const H5FD_class_t *cls)
H5TRACE1("i","x",cls);
/* Check arguments */
- if (!cls)
+ if(!cls)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed")
- if (!cls->open || !cls->close)
+ if(!cls->open || !cls->close)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined")
- if (!cls->get_eoa || !cls->set_eoa)
+ if(!cls->get_eoa || !cls->set_eoa)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined")
- if (!cls->get_eof)
+ if(!cls->get_eof)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined")
- if (!cls->read || !cls->write)
+ if(!cls->read || !cls->write)
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined")
for (type=H5FD_MEM_DEFAULT; type<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type))
- if (cls->fl_map[type]<H5FD_MEM_NOLIST || cls->fl_map[type]>=H5FD_MEM_NTYPES)
+ if(cls->fl_map[type]<H5FD_MEM_NOLIST || cls->fl_map[type]>=H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping")
/* Create the new class ID */
- if ((ret_value=H5FD_register(cls, sizeof(H5FD_class_t)))<0)
+ if((ret_value=H5FD_register(cls, sizeof(H5FD_class_t))) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID")
done:
@@ -314,12 +317,12 @@ H5FD_register(const void *_cls, size_t size)
assert(cls->fl_map[type]>=H5FD_MEM_NOLIST && cls->fl_map[type]<H5FD_MEM_NTYPES);
/* Copy the class structure so the caller can reuse or free it */
- if (NULL==(saved=H5MM_malloc(size)))
+ if(NULL==(saved=H5MM_malloc(size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct")
HDmemcpy(saved,cls,size);
/* Create the new class ID */
- if ((ret_value=H5I_register(H5I_VFL, saved))<0)
+ if((ret_value=H5I_register(H5I_VFL, saved)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID")
done:
@@ -359,11 +362,11 @@ H5FDunregister(hid_t driver_id)
H5TRACE1("e","i",driver_id);
/* Check arguments */
- if (NULL==H5I_object_verify(driver_id,H5I_VFL))
+ if(NULL==H5I_object_verify(driver_id,H5I_VFL))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver")
/* The H5FD_class_t struct will be freed by this function */
- if (H5I_dec_ref(driver_id)<0)
+ if(H5I_dec_ref(driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to unregister file driver")
done:
@@ -407,18 +410,18 @@ H5FD_get_class(hid_t id)
FUNC_ENTER_NOAPI(H5FD_get_class, NULL)
- if (H5I_VFL==H5I_get_type(id)) {
+ if(H5I_VFL==H5I_get_type(id)) {
ret_value = H5I_object(id);
} else {
/* Get the plist structure */
if(NULL == (plist = H5I_object(id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
- if (TRUE==H5P_isa_class(id,H5P_FILE_ACCESS)) {
+ if(TRUE==H5P_isa_class(id,H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
ret_value = H5FD_get_class(driver_id);
- } else if (TRUE==H5P_isa_class(id,H5P_DATASET_XFER)) {
+ } else if(TRUE==H5P_isa_class(id,H5P_DATASET_XFER)) {
if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
ret_value = H5FD_get_class(driver_id);
@@ -459,7 +462,7 @@ H5FD_sb_size(H5FD_t *file)
assert(file && file->cls);
- if (file->cls->sb_size)
+ if(file->cls->sb_size)
ret_value = (file->cls->sb_size)(file);
done:
@@ -496,8 +499,8 @@ H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf)
FUNC_ENTER_NOAPI(H5FD_sb_encode, FAIL)
assert(file && file->cls);
- if (file->cls->sb_encode &&
- (file->cls->sb_encode)(file, name/*out*/, buf/*out*/)<0)
+ if(file->cls->sb_encode &&
+ (file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed")
done:
@@ -529,8 +532,8 @@ H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf)
FUNC_ENTER_NOAPI(H5FD_sb_decode, FAIL)
assert(file && file->cls);
- if (file->cls->sb_decode &&
- (file->cls->sb_decode)(file, name, buf)<0)
+ if(file->cls->sb_decode &&
+ (file->cls->sb_decode)(file, name, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed")
done:
@@ -567,13 +570,13 @@ H5FD_pl_copy(void *(*copy_func)(const void *), size_t pl_size, const void *old_p
FUNC_ENTER_NOAPI_NOINIT(H5FD_pl_copy)
/* Copy old pl, if one exists */
- if (old_pl) {
+ if(old_pl) {
/* Allow the driver to copy or do it ourselves */
- if (copy_func) {
+ if(copy_func) {
new_pl = (copy_func)(old_pl);
if(new_pl==NULL)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "property list copy failed")
- } else if (pl_size>0) {
+ } else if(pl_size>0) {
if((new_pl = H5MM_malloc(pl_size))==NULL)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "property list allocation failed")
HDmemcpy(new_pl, old_pl, pl_size);
@@ -614,14 +617,14 @@ H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl)
FUNC_ENTER_NOAPI_NOINIT(H5FD_pl_close)
/* Allow driver to free or do it ourselves */
- if (pl && free_func) {
- if ((free_func)(pl)<0)
+ if(pl && free_func) {
+ if((free_func)(pl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed")
} else
H5MM_xfree(pl);
/* Decrement reference count for driver */
- if(H5I_dec_ref(driver_id)<0)
+ if(H5I_dec_ref(driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement reference count for driver")
done:
@@ -664,7 +667,7 @@ H5FD_fapl_get(H5FD_t *file)
assert(file);
- if (file->cls->fapl_get)
+ if(file->cls->fapl_get)
ret_value = (file->cls->fapl_get)(file);
done:
@@ -697,9 +700,9 @@ H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
FUNC_ENTER_NOAPI(H5FD_fapl_open, FAIL)
/* Increment the reference count on driver and copy driver info */
- if(H5I_inc_ref(driver_id)<0)
+ if(H5I_inc_ref(driver_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver")
- if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info)<0)
+ if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info) < 0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VFL driver info")
/* Set the driver properties for the list */
@@ -739,11 +742,11 @@ H5FD_fapl_copy(hid_t driver_id, const void *old_fapl, void **copied_fapl)
FUNC_ENTER_NOAPI(H5FD_fapl_copy, FAIL)
/* Check args */
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Copy the file access property list */
- if(H5FD_pl_copy(driver->fapl_copy,driver->fapl_size,old_fapl,copied_fapl)<0)
+ if(H5FD_pl_copy(driver->fapl_copy,driver->fapl_size,old_fapl,copied_fapl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver file access property list")
done:
@@ -776,11 +779,11 @@ H5FD_fapl_close(hid_t driver_id, void *fapl)
/* Check args */
if(driver_id>0) {
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Close the driver for the property list */
- if(H5FD_pl_close(driver_id,driver->fapl_free,fapl)<0)
+ if(H5FD_pl_close(driver_id,driver->fapl_free,fapl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed")
} /* end if */
@@ -814,15 +817,15 @@ H5FD_dxpl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
FUNC_ENTER_NOAPI(H5FD_dxpl_open, FAIL)
/* Increment the reference count on the driver and copy the driver info */
- if(H5I_inc_ref(driver_id)<0)
+ if(H5I_inc_ref(driver_id) < 0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, FAIL, "can't increment VFL driver ID")
- if(H5FD_dxpl_copy(driver_id, driver_info, &copied_driver_info)<0)
+ if(H5FD_dxpl_copy(driver_id, driver_info, &copied_driver_info) < 0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy VFL driver")
/* Set the driver information for the new property list */
- if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
+ if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver ID")
- if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info)<0)
+ if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info) < 0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver info")
done:
@@ -856,11 +859,11 @@ H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl, void **copied_dxpl)
FUNC_ENTER_NOAPI(H5FD_dxpl_copy, FAIL)
/* Check args */
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Copy the file access property list */
- if(H5FD_pl_copy(driver->dxpl_copy,driver->dxpl_size,old_dxpl,copied_dxpl)<0)
+ if(H5FD_pl_copy(driver->dxpl_copy,driver->dxpl_size,old_dxpl,copied_dxpl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver data transfer property list")
done:
@@ -893,11 +896,11 @@ H5FD_dxpl_close(hid_t driver_id, void *dxpl)
/* Check args */
if(driver_id>0) {
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Close the driver for the property list */
- if(H5FD_pl_close(driver_id,driver->dxpl_free,dxpl)<0)
+ if(H5FD_pl_close(driver_id,driver->dxpl_free,dxpl) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed")
} /* end if */
@@ -972,10 +975,10 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if(H5P_DEFAULT == fapl_id)
fapl_id = H5P_FILE_ACCESS_DEFAULT;
else
- if (TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS))
+ if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr)))
+ if(NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file")
done:
@@ -1021,22 +1024,22 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if(NULL == (plist = H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (0==maxaddr)
+ if(0==maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range")
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
/* Get driver info */
- if (NULL==(driver=H5I_object(driver_id)))
+ if(NULL==(driver=H5I_object(driver_id)))
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list")
- if (NULL==driver->open)
+ if(NULL==driver->open)
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method")
/* Dispatch to file driver */
- if (HADDR_UNDEF==maxaddr)
+ if(HADDR_UNDEF==maxaddr)
maxaddr = driver->maxaddr;
- if (NULL==(file=(driver->open)(name, flags, fapl_id, maxaddr)))
+ if(NULL==(file=(driver->open)(name, flags, fapl_id, maxaddr)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed")
/*
@@ -1044,7 +1047,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
* driver ID to prevent it from being freed while this file is open.
*/
file->driver_id = driver_id;
- if(H5I_inc_ref(file->driver_id)<0)
+ if(H5I_inc_ref(file->driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
file->cls = driver;
file->maxaddr = maxaddr;
@@ -1062,7 +1065,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment")
/* Retrieve the VFL driver feature flags */
- if (H5FD_query(file, &(file->feature_flags))<0)
+ if(H5FD_query(file, &(file->feature_flags)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver")
/* Increment the global serial number & assign it to this H5FD_t object */
@@ -1109,10 +1112,10 @@ H5FDclose(H5FD_t *file)
FUNC_ENTER_API(H5FDclose, FAIL)
H5TRACE1("e","x",file);
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (H5FD_close(file)<0)
+ if(H5FD_close(file) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to close file")
done:
@@ -1160,7 +1163,7 @@ H5FD_close(H5FD_t *file)
/* Prepare to close file by clearing all public fields */
driver = file->cls;
- if(H5I_dec_ref(file->driver_id)<0)
+ if(H5I_dec_ref(file->driver_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
/*
@@ -1169,7 +1172,7 @@ H5FD_close(H5FD_t *file)
*/
assert(driver->close);
- if ((driver->close)(file) < 0)
+ if((driver->close)(file) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "close failed")
done:
@@ -1224,16 +1227,16 @@ H5FD_free_freelist(H5FD_t *file)
}
#ifdef H5F_DEBUG
- if (nblocks && H5DEBUG(F))
+ if(nblocks && H5DEBUG(F))
HDfprintf(H5DEBUG(F),
"H5F: leaked %Hu bytes of file memory in %u blocks\n",
nbytes, nblocks);
#endif /* H5F_DEBUG */
/* Check if we need to reset the metadata accumulator information */
- if (file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
+ if(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
/* Free the buffer */
- if (file->meta_accum)
+ if(file->meta_accum)
file->meta_accum = H5FL_BLK_FREE(meta_accum, file->meta_accum);
/* Reset the buffer sizes & location */
@@ -1309,22 +1312,22 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2)
FUNC_ENTER_NOAPI(H5FD_cmp, -1) /*return value is arbitrary*/
- if ((!f1 || !f1->cls) && (!f2 || !f2->cls))
+ if((!f1 || !f1->cls) && (!f2 || !f2->cls))
HGOTO_DONE(0)
- if (!f1 || !f1->cls)
+ if(!f1 || !f1->cls)
HGOTO_DONE(-1)
- if (!f2 || !f2->cls)
+ if(!f2 || !f2->cls)
HGOTO_DONE(1)
- if (f1->cls < f2->cls)
+ if(f1->cls < f2->cls)
HGOTO_DONE(-1)
- if (f1->cls > f2->cls)
+ if(f1->cls > f2->cls)
HGOTO_DONE(1)
/* Files are same driver; no cmp callback */
- if (!f1->cls->cmp) {
- if (f1<f2)
+ if(!f1->cls->cmp) {
+ if(f1<f2)
HGOTO_DONE(-1)
- if (f1>f2)
+ if(f1>f2)
HGOTO_DONE(1)
HGOTO_DONE(0)
}
@@ -1397,7 +1400,7 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/)
assert(flags);
/* Check for query driver and call it */
- if (f->cls->query)
+ if(f->cls->query)
ret_value = (f->cls->query)(f, flags);
else
*flags=0;
@@ -1457,20 +1460,20 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
H5TRACE4("a","xMtih",file,type,dxpl_id,size);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
- if (type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES)
+ if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type")
- if (size==0)
+ if(size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list")
/* Do the real work */
- if (HADDR_UNDEF==(ret_value=H5FD_alloc(file, type, dxpl_id, size)))
+ if(HADDR_UNDEF == (ret_value = H5FD_alloc(file, type, dxpl_id, size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory")
done:
@@ -1507,6 +1510,9 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI(H5FD_alloc, HADDR_UNDEF)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* check args */
assert(file);
@@ -1515,33 +1521,36 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
assert(size > 0);
#ifdef H5F_DEBUG
- if (H5DEBUG(F))
+ if(H5DEBUG(F))
HDfprintf(H5DEBUG(F), "%s: alignment=%Hd, threshold=%Hd, size=%Hd\n",
FUNC, file->alignment, file->threshold, size);
#endif /* H5F_DEBUG */
/* Try to allocate from the free list first */
- if ((ret_value = H5FD_alloc_from_free_list(file, type, size)) != HADDR_UNDEF)
+ if((ret_value = H5FD_alloc_from_free_list(file, type, size)) != HADDR_UNDEF)
HGOTO_DONE(ret_value)
#ifdef H5F_DEBUG
- if (H5DEBUG(F))
+ if(H5DEBUG(F))
HDfprintf(H5DEBUG(F), "%s: Could not allocate from freelists\n", FUNC);
#endif /* H5F_DEBUG */
- if (type != H5FD_MEM_DRAW) {
+ if(type != H5FD_MEM_DRAW) {
/* Handle metadata differently from "raw" data */
- if ((ret_value = H5FD_alloc_metadata(file, type, dxpl_id, size)) == HADDR_UNDEF)
+ if((ret_value = H5FD_alloc_metadata(file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't allocate for metadata")
} else {
/* Allocate "raw" data */
- if ((ret_value = H5FD_alloc_raw(file, type, dxpl_id, size)) == HADDR_UNDEF)
+ if((ret_value = H5FD_alloc_raw(file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't allocate for raw data")
}
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_alloc() */
/*-------------------------------------------------------------------------
@@ -1564,13 +1573,16 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI(H5FD_alloc_from_free_list, HADDR_UNDEF)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
assert(file);
assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
assert(size > 0);
/* Map the allocation request to a free list */
- if (H5FD_MEM_DEFAULT == file->cls->fl_map[type])
+ if(H5FD_MEM_DEFAULT == file->cls->fl_map[type])
mapped_type = type;
else
mapped_type = file->cls->fl_map[type];
@@ -1594,26 +1606,26 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* 2. block address is aligned with smallest size > requested size;
* 3. block address is not aligned with smallest size >= requested size.
*/
- if (mapped_type >= H5FD_MEM_DEFAULT && (file->maxsize == 0 || size <= file->maxsize)) {
+ if(mapped_type >= H5FD_MEM_DEFAULT && (file->maxsize == 0 || size <= file->maxsize)) {
H5FD_free_t *prev = NULL, *best = NULL;
H5FD_free_t *cur = file->fl[mapped_type];
- int found_aligned = 0;
- int need_aligned;
+ hbool_t found_aligned = FALSE;
+ hbool_t need_aligned;
hsize_t head;
need_aligned = file->alignment > 1 && size >= file->threshold;
- while (cur) {
+ while(cur) {
if(cur->size > file->maxsize)
file->maxsize = cur->size;
- if (need_aligned) {
- if ((head = cur->addr % file->alignment) == 0) {
+ if(need_aligned) {
+ if((head = cur->addr % file->alignment) == 0) {
/*
* Aligned address
*/
- if (cur->size >= size) {
- if (cur->size == size) {
+ if(cur->size >= size) {
+ if(cur->size == size) {
/* exact match */
ret_value = cur->addr;
@@ -1622,29 +1634,31 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* from the free list which overlaps with the metadata
* aggregation buffer (if it's turned on)
*/
- if (type == H5FD_MEM_DRAW &&
+ if(type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
H5F_addr_overlap(ret_value, size,
file->accum_loc, file->accum_size)) {
ret_value = HADDR_UNDEF;
} else {
- if (prev)
+ if(prev)
prev->next = cur->next;
else
file->fl[mapped_type] = cur->next;
H5FL_FREE(H5FD_free_t, cur);
- if (size == file->maxsize)
+ if(size == file->maxsize)
file->maxsize = 0; /*unknown*/
HGOTO_DONE(ret_value)
}
}
else
- if (!best || !found_aligned || cur->size < best->size) {
+ /* Favor smallest block, that's closest to the beginning of the file */
+ if(!best || !found_aligned || cur->size < best->size ||
+ (cur->size == best->size && H5F_addr_lt(cur->addr, best->addr))) {
best = cur;
- found_aligned = 1;
+ found_aligned = TRUE;
}
} /* end if */
} else {
@@ -1653,22 +1667,25 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
*
* Check to see if this block is big enough to skip
* to the next aligned address and is still big
- * enough for the requested size. the extra
- * cur->size>head is for preventing unsigned
- * underflow. (this can be improved by checking for
- * an exact match after excluding the head. Such
+ * enough for the requested size. The extra
+ * (cur->size > head) is for preventing unsigned
+ * underflow. (This could be improved by checking for
+ * an exact match after excluding the head. Such
* match is as good as the found_aligned case above.)
*/
head = file->alignment - head; /* actual head size */
- if (!found_aligned && cur->size > head && cur->size-head >= size &&
- (!best || cur->size < best->size))
- best = cur;
- }
+ if(!found_aligned && cur->size > head && cur->size-head >= size) {
+ /* Favor smallest block, that's closest to the beginning of the file */
+ if(!best || cur->size < best->size ||
+ (cur->size == best->size && H5F_addr_lt(cur->addr, best->addr)))
+ best = cur;
+ } /* end if */
+ } /* end else */
} else {
/* !need_aligned */
- if (cur->size >= size) {
- if (cur->size == size) {
+ if(cur->size >= size) {
+ if(cur->size == size) {
/* exact match */
ret_value = cur->addr;
@@ -1677,42 +1694,44 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* from the free list which overlaps with the metadata
* aggregation buffer (if it's turned on)
*/
- if (type == H5FD_MEM_DRAW &&
+ if(type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
H5F_addr_overlap(ret_value, size, file->accum_loc,
file->accum_size)) {
ret_value = HADDR_UNDEF;
} else {
- if (prev)
+ if(prev)
prev->next = cur->next;
else
file->fl[mapped_type] = cur->next;
H5FL_FREE(H5FD_free_t, cur);
- if (size == file->maxsize)
+ if(size == file->maxsize)
file->maxsize = 0; /*unknown*/
HGOTO_DONE(ret_value)
}
- }
+ } /* end if */
else {
- if (!best || cur->size < best->size)
+ /* Favor smallest block, that's closest to the beginning of the file */
+ if(!best || cur->size < best->size ||
+ (cur->size == best->size && H5F_addr_lt(cur->addr, best->addr)))
best = cur;
- }
+ } /* end else */
} /* end if */
- }
+ } /* end else */
prev = cur;
cur = cur->next;
- }
+ } /* end while */
/* Couldn't find exact match, use best fitting piece found */
- if (best) {
- if (best->size == file->maxsize)
+ if(best) {
+ if(best->size == file->maxsize)
file->maxsize = 0; /*unknown*/
- if (!need_aligned || found_aligned) {
+ if(!need_aligned || found_aligned) {
/* free only tail */
ret_value = best->addr;
@@ -1721,7 +1740,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* from the free list which overlaps with the metadata
* aggregation buffer (if it's turned on)
*/
- if (type == H5FD_MEM_DRAW &&
+ if(type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
H5F_addr_overlap(ret_value, size, file->accum_loc,
file->accum_size)) {
@@ -1746,7 +1765,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
* from the free list which overlaps with the metadata
* aggregation buffer (if it's turned on)
*/
- if (type == H5FD_MEM_DRAW &&
+ if(type == H5FD_MEM_DRAW &&
(file->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) &&
H5F_addr_overlap(ret_value, size, file->accum_loc, file->accum_size)) {
ret_value = HADDR_UNDEF;
@@ -1755,7 +1774,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
if((tmp = H5FL_MALLOC(H5FD_free_t))==NULL)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "free block allocation failed")
- if ((tmp->size = (best->size - (head + size)))!=0) {
+ if((tmp->size = (best->size - (head + size)))!=0) {
tmp->addr = best->addr + (head + size);
tmp->next = best->next;
best->next = tmp;
@@ -1772,8 +1791,11 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, hsize_t size)
} /* end if */
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_alloc_from_free_list() */
/*-------------------------------------------------------------------------
@@ -1796,6 +1818,9 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI(H5FD_alloc_metadata, HADDR_UNDEF)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* check args */
assert(file);
@@ -1812,19 +1837,19 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/*
* Allocate all types of metadata out of the metadata block
*/
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
/*
* Check if the space requested is larger than the space left in
* the block
*/
- if (size > file->cur_meta_block_size) {
+ if(size > file->cur_meta_block_size) {
haddr_t new_meta; /* Address for new metadata */
/*
* Check if the block asked for is too large for a metadata
* block
*/
- if (size >= file->def_meta_block_size) {
+ if(size >= file->def_meta_block_size) {
/* Allocate more room for this new block the regular way */
new_meta = H5FD_real_alloc(file, type, dxpl_id, size);
@@ -1832,7 +1857,7 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Check if the new metadata is at the end of the current
* metadata block
*/
- if (file->eoma + file->cur_meta_block_size == new_meta) {
+ if(file->eoma + file->cur_meta_block_size == new_meta) {
/*
* Treat the allocation request as if the current
* metadata block grew by the amount allocated and
@@ -1855,15 +1880,15 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Check if the new metadata is at the end of the current
* metadata block
*/
- if (file->eoma + file->cur_meta_block_size == new_meta) {
+ if(file->eoma + file->cur_meta_block_size == new_meta) {
file->cur_meta_block_size += file->def_meta_block_size;
} else {
/*
* Return the unused portion of the metadata block to
* a free list
*/
- if (file->eoma != 0)
- if (H5FD_free(file, H5FD_MEM_DEFAULT, dxpl_id, file->eoma,
+ if(file->eoma != 0)
+ if(H5FD_free(file, H5FD_MEM_DEFAULT, dxpl_id, file->eoma,
file->cur_meta_block_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free metadata block")
@@ -1889,6 +1914,9 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
}
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_alloc_metadata() */
@@ -1911,6 +1939,9 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI(H5FD_alloc_raw, HADDR_UNDEF)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* check args */
assert(file);
@@ -1922,16 +1953,16 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* allocate "small data" space and sub-allocate out of that, if
* possible. Otherwise just allocate through H5FD_real_alloc()
*/
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
/*
* Check if the space requested is larger than the space left in
* the block
*/
- if (size > file->cur_sdata_block_size) {
+ if(size > file->cur_sdata_block_size) {
haddr_t new_data; /* Address for new raw data block */
/* Check if the block asked for is too large for the "small data" block */
- if (size >= file->def_sdata_block_size) {
+ if(size >= file->def_sdata_block_size) {
/* Allocate more room for this new block the regular way */
new_data = H5FD_real_alloc(file, type, dxpl_id, size);
@@ -1939,7 +1970,7 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Check if the new raw data is at the end of the current
* "small data" block
*/
- if (file->eosda + file->cur_sdata_block_size == new_data) {
+ if(file->eosda + file->cur_sdata_block_size == new_data) {
/*
* Treat the allocation request as if the current
* "small data" block grew by the amount allocated
@@ -1962,15 +1993,15 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Check if the new raw data is at the end of the current
* "small data" block
*/
- if (file->eosda + file->cur_sdata_block_size == new_data) {
+ if(file->eosda + file->cur_sdata_block_size == new_data) {
file->cur_sdata_block_size += file->def_sdata_block_size;
} else {
/*
* Return the unused portion of the "small data"
* block to a free list
*/
- if (file->eosda != 0)
- if (H5FD_free(file, H5FD_MEM_DRAW, dxpl_id, file->eosda,
+ if(file->eosda != 0)
+ if(H5FD_free(file, H5FD_MEM_DRAW, dxpl_id, file->eosda,
file->cur_sdata_block_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free 'small data' block")
@@ -1999,6 +2030,9 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
}
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_alloc_raw() */
@@ -2027,6 +2061,9 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_NOAPI_NOINIT(H5FD_real_alloc)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* check args */
assert(file);
@@ -2038,15 +2075,18 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* Dispatch to driver `alloc' callback or extend the end-of-address
* marker
*/
- if (file->cls->alloc) {
- if ((ret_value = (file->cls->alloc)(file, type, dxpl_id, size)) == HADDR_UNDEF)
+ if(file->cls->alloc) {
+ if((ret_value = (file->cls->alloc)(file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed")
} else {
- if ((ret_value = H5FD_update_eoa(file, type, dxpl_id, size)) == HADDR_UNDEF)
+ if((ret_value = H5FD_update_eoa(file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver eoa update request failed")
}
done:
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_real_alloc() */
@@ -2083,50 +2123,46 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
eoa = file->cls->get_eoa(file);
#ifdef H5F_DEBUG
- if (file->alignment * file->threshold != 1 && H5DEBUG(F))
+ if(file->alignment * file->threshold != 1 && H5DEBUG(F))
HDfprintf(H5DEBUG(F),
"%s: alignment=%Hd, threshold=%Hd, size=%Hd, Begin eoa=%a\n",
FUNC, file->alignment, file->threshold, size, eoa);
#endif /* H5F_DEBUG */
- /*
- * Wasted is 0 if not exceeding threshold or eoa happens to be
- * aligned
- */
+ /* Wasted is 0 if not exceeding threshold or eoa happens to be aligned */
wasted = (size >= file->threshold) ? (eoa % file->alignment) : 0;
-
- if (wasted) {
+ if(wasted) {
wasted = file->alignment - wasted; /* actual waste */
oldeoa = eoa; /* save it for later freeing */
- /* Advance eoa to the next alignment by allocating the wasted */
- if (H5F_addr_overflow(eoa, size) || eoa + wasted > file->maxaddr)
+ /* Advance eoa to the next alignment by allocating the wasted */
+ if(H5F_addr_overflow(eoa, size) || (eoa + wasted) > file->maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
eoa += wasted;
- if (file->cls->set_eoa(file, eoa) < 0)
+ if(file->cls->set_eoa(file, eoa) < 0)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
- }
+ } /* end if */
/* allocate the aligned memory */
- if (H5F_addr_overflow(eoa, size) || eoa + size > file->maxaddr)
+ if(H5F_addr_overflow(eoa, size) || eoa + size > file->maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
ret_value = eoa;
eoa += size;
- if (file->cls->set_eoa(file, eoa) < 0)
+ if(file->cls->set_eoa(file, eoa) < 0)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed")
/* Free the wasted memory */
- if (wasted) {
- if(H5FD_free(file, type, dxpl_id, oldeoa, wasted)<0)
+ if(wasted) {
+ if(H5FD_free(file, type, dxpl_id, oldeoa, wasted) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
} /* end if */
#ifdef H5F_DEBUG
- if (file->alignment * file->threshold != 1 && H5DEBUG(F))
+ if(file->alignment * file->threshold != 1 && H5DEBUG(F))
HDfprintf(H5DEBUG(F),
"%s: ret_value=%a, wasted=%Hd, Ended eoa=%a\n",
FUNC, ret_value, wasted, eoa);
@@ -2167,23 +2203,23 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz
H5TRACE5("e","xMtiah",file,type,dxpl_id,addr,size);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES)
+ if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type")
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
- if (H5FD_free(file, type, dxpl_id, addr, size)<0)
+ if(H5FD_free(file, type, dxpl_id, addr, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5FDfree() */
/*-------------------------------------------------------------------------
@@ -2210,50 +2246,52 @@ herr_t
H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size)
{
H5FD_mem_t mapped_type;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_free, FAIL)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type, addr, size);
+#endif /* H5FD_ALLOC_DEBUG */
/* Check args */
assert(file);
assert(file->cls);
assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES);
- if (!H5F_addr_defined(addr) || addr>file->maxaddr ||
- H5F_addr_overflow(addr, size) || addr+size>file->maxaddr)
+ if(!H5F_addr_defined(addr) || addr > file->maxaddr ||
+ H5F_addr_overflow(addr, size) || (addr + size) > file->maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid region")
/* Allow 0-sized free's to occur without penalty */
- if(0==size)
+ if(0 == size)
HGOTO_DONE(SUCCEED)
/* Map request type to free list */
- if (H5FD_MEM_DEFAULT==file->cls->fl_map[type]) {
+ if(H5FD_MEM_DEFAULT==file->cls->fl_map[type])
mapped_type = type;
- } else {
+ else
mapped_type = file->cls->fl_map[type];
- }
/*
* If the request maps to a free list then add memory to the free list
* without ever telling the driver that it was freed. Otherwise let the
* driver deallocate the memory.
*/
- if (mapped_type>=H5FD_MEM_DEFAULT) {
+ if(mapped_type >= H5FD_MEM_DEFAULT) {
H5FD_free_t *last; /* Last merged node */
- H5FD_free_t *last_prev=NULL;/* Pointer to node before merged node */
+ H5FD_free_t *last_prev = NULL;/* Pointer to node before merged node */
H5FD_free_t *curr; /* Current free block being inspected */
H5FD_free_t *prev; /* Previous free block being inspected */
/* Adjust the metadata accumulator to remove the freed block, if it overlaps */
if((file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA)
- && H5F_addr_overlap(addr,size,file->accum_loc,file->accum_size)) {
+ && H5F_addr_overlap(addr, size, file->accum_loc, file->accum_size)) {
size_t overlap_size; /* Size of overlap with accumulator */
/* Check for overlapping the beginning of the accumulator */
- if(H5F_addr_le(addr,file->accum_loc)) {
+ if(H5F_addr_le(addr, file->accum_loc)) {
/* Check for completely overlapping the accumulator */
- if(H5F_addr_ge(addr+size,file->accum_loc+file->accum_size)) {
+ if(H5F_addr_ge(addr + size, file->accum_loc + file->accum_size)) {
/* Reset the entire accumulator */
file->accum_loc=HADDR_UNDEF;
file->accum_size=FALSE;
@@ -2291,7 +2329,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
/* Write out the part of the accumulator after the block to free */
/* (Use the driver's write call directly - to avoid looping back and writing to metadata accumulator) */
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, tail_addr, tail_size, file->meta_accum+(tail_addr-file->accum_loc))<0)
+ if((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, tail_addr, tail_size, file->meta_accum+(tail_addr-file->accum_loc)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
} /* end if */
@@ -2388,7 +2426,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
} /* end if */
else {
/* Allocate a new node to hold the free block's information */
- if(NULL==(last = H5FL_MALLOC(H5FD_free_t)))
+ if(NULL == (last = H5FL_MALLOC(H5FD_free_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate node for free space info")
last->addr = addr;
@@ -2417,8 +2455,8 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
H5FL_FREE(H5FD_free_t, last);
}
}
- } else if (file->cls->free) {
- if ((file->cls->free)(file, type, dxpl_id, addr, size)<0)
+ } else if(file->cls->free) {
+ if((file->cls->free)(file, type, dxpl_id, addr, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed")
} else {
/* leak memory */
@@ -2460,13 +2498,13 @@ H5FDrealloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsiz
H5TRACE6("a","xMtiahh",file,type,dxpl_id,old_addr,old_size,new_size);
/* Check args */
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list")
- if (HADDR_UNDEF==(ret_value=H5FD_realloc(file, type, dxpl_id, old_addr, old_size, new_size)))
+ if(HADDR_UNDEF==(ret_value=H5FD_realloc(file, type, dxpl_id, old_addr, old_size, new_size)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file reallocation request failed")
done:
@@ -2502,24 +2540,24 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsi
FUNC_ENTER_NOAPI(H5FD_realloc, HADDR_UNDEF)
- if (new_size==old_size) {
+ if(new_size==old_size) {
/*nothing to do*/
- } else if (0==old_size) {
+ } else if(0==old_size) {
/* allocate memory */
assert(!H5F_addr_defined(old_addr));
- if (HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
+ if(HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed")
- } else if (0==new_size) {
+ } else if(0==new_size) {
/* free memory */
assert(H5F_addr_defined(old_addr));
- if(H5FD_free(file, type, dxpl_id, old_addr, old_size)<0)
+ if(H5FD_free(file, type, dxpl_id, old_addr, old_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
new_addr = HADDR_UNDEF;
- } else if (new_size<old_size) {
+ } else if(new_size<old_size) {
/* free the end of the block */
- if(H5FD_free(file, type, dxpl_id, old_addr+old_size, old_size-new_size)<0)
+ if(H5FD_free(file, type, dxpl_id, old_addr+old_size, old_size-new_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
} else {
/* move memory to new location */
@@ -2529,24 +2567,24 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsi
* to move pieces of the realloced data through a fixed size buffer, etc.
* -QAK, 6/20/01
*/
- if (HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
+ if(HADDR_UNDEF==(new_addr=H5FD_alloc(file, type, dxpl_id, new_size)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed")
H5_CHECK_OVERFLOW(old_size,hsize_t,size_t);
- if (old_size>sizeof(_buf) && NULL==(buf=H5MM_malloc((size_t)old_size))) {
+ if(old_size>sizeof(_buf) && NULL==(buf=H5MM_malloc((size_t)old_size))) {
(void)H5FD_free(file, type, dxpl_id, new_addr, new_size);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
}
- if (H5FD_read(file, type, dxpl_id, old_addr, (size_t)old_size, buf)<0 ||
- H5FD_write(file, type, dxpl_id, new_addr, (size_t)old_size, buf)<0) {
+ if(H5FD_read(file, type, dxpl_id, old_addr, (size_t)old_size, buf) < 0 ||
+ H5FD_write(file, type, dxpl_id, new_addr, (size_t)old_size, buf) < 0) {
(void)H5FD_free(file, type, dxpl_id, new_addr, new_size);
- if (buf!=_buf)
+ if(buf!=_buf)
H5MM_xfree(buf);
HGOTO_ERROR(H5E_FILE, H5E_READERROR, HADDR_UNDEF, "unable to move file block")
}
- if (buf!=_buf)
+ if(buf!=_buf)
H5MM_xfree(buf);
- if(H5FD_free(file, type, dxpl_id, old_addr, old_size)<0)
+ if(H5FD_free(file, type, dxpl_id, old_addr, old_size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "file deallocation request failed")
}
@@ -2583,7 +2621,7 @@ H5FD_can_extend(const H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size,
FUNC_ENTER_NOAPI(H5FD_can_extend, FAIL)
/* Retrieve the end of the address space */
- if (HADDR_UNDEF==(eoa=H5FD_get_eoa(file)))
+ if(HADDR_UNDEF==(eoa=H5FD_get_eoa(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
/* Check if the block is exactly at the end of the file */
@@ -2595,30 +2633,30 @@ H5FD_can_extend(const H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size,
haddr_t end; /* End of block in file */
/* Map request type to free list */
- if (H5FD_MEM_DEFAULT==file->cls->fl_map[type])
+ if(H5FD_MEM_DEFAULT==file->cls->fl_map[type])
mapped_type = type;
else
mapped_type = file->cls->fl_map[type];
/* Check if block is inside the metadata or small data accumulator */
if(mapped_type!=H5FD_MEM_DRAW) {
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
/* If the metadata block is at the end of the file, and
* the block to test adjoins the beginning of the metadata
* block, then it's extendable
*/
- if (file->eoma + file->cur_meta_block_size == eoa &&
+ if(file->eoma + file->cur_meta_block_size == eoa &&
(addr+size)==file->eoma)
HGOTO_DONE(TRUE)
} /* end if */
} /* end if */
else {
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
/* If the small data block is at the end of the file, and
* the block to test adjoins the beginning of the small data
* block, then it's extendable
*/
- if (file->eosda + file->cur_sdata_block_size == eoa &&
+ if(file->eosda + file->cur_sdata_block_size == eoa &&
(addr+size)==file->eosda)
HGOTO_DONE(TRUE)
} /* end if */
@@ -2673,13 +2711,16 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t e
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_extend, FAIL)
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n", FUNC, (unsigned)type, addr, size, extra_requested);
+#endif /* H5FD_ALLOC_DEBUG */
/* Retrieve the end of the address space */
- if (HADDR_UNDEF==(eoa=H5FD_get_eoa(file)))
+ if(HADDR_UNDEF==(eoa=H5FD_get_eoa(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
/* Map request type to free list */
- if (H5FD_MEM_DEFAULT==file->cls->fl_map[type])
+ if(H5FD_MEM_DEFAULT==file->cls->fl_map[type])
mapped_type = type;
else
mapped_type = file->cls->fl_map[type];
@@ -2693,22 +2734,22 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t e
else {
/* (Check if block is inside the metadata or small data accumulator) */
if(mapped_type!=H5FD_MEM_DRAW) {
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA)
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA)
/* If the metadata block is at the end of the file, and
* the block to test adjoins the beginning of the metadata
* block, then it's extendable
*/
- if ((file->eoma + file->cur_meta_block_size) == eoa &&
+ if((file->eoma + file->cur_meta_block_size) == eoa &&
end == file->eoma)
update_eoma=TRUE;
} /* end if */
else {
- if (file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)
/* If the small data block is at the end of the file, and
* the block to test adjoins the beginning of the small data
* block, then it's extendable
*/
- if ((file->eosda + file->cur_sdata_block_size) == eoa &&
+ if((file->eosda + file->cur_sdata_block_size) == eoa &&
end == file->eosda)
update_eosda=TRUE;
} /* end else */
@@ -2717,12 +2758,12 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t e
/* Block is at end of file, we are extending the eoma or eosda */
if(update_eoma || update_eosda || at_end) {
/* Check for overflowing the file */
- if (H5F_addr_overflow(eoa, extra_requested) || eoa + extra_requested > file->maxaddr)
+ if(H5F_addr_overflow(eoa, extra_requested) || eoa + extra_requested > file->maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "file allocation request failed")
/* Extend the file */
eoa += extra_requested;
- if (file->cls->set_eoa(file, eoa) < 0)
+ if(file->cls->set_eoa(file, eoa) < 0)
HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "file allocation request failed")
/* Update the metadata and/or small data block */
@@ -2809,11 +2850,11 @@ H5FDget_eoa(H5FD_t *file)
H5TRACE1("a","x",file);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
/* The real work */
- if (HADDR_UNDEF==(ret_value=H5FD_get_eoa(file)))
+ if(HADDR_UNDEF==(ret_value=H5FD_get_eoa(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed")
done:
@@ -2846,7 +2887,7 @@ H5FD_get_eoa(const H5FD_t *file)
assert(file && file->cls);
/* Dispatch to driver */
- if (HADDR_UNDEF==(ret_value=(file->cls->get_eoa)(file)))
+ if(HADDR_UNDEF==(ret_value=(file->cls->get_eoa)(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
done:
@@ -2890,14 +2931,14 @@ H5FDset_eoa(H5FD_t *file, haddr_t addr)
H5TRACE2("e","xa",file,addr);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (!H5F_addr_defined(addr) || addr>file->maxaddr)
+ if(!H5F_addr_defined(addr) || addr>file->maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value")
/* The real work */
- if (H5FD_set_eoa(file, addr)<0)
+ if(H5FD_set_eoa(file, addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed")
done:
@@ -2932,7 +2973,7 @@ H5FD_set_eoa(H5FD_t *file, haddr_t addr)
assert(H5F_addr_defined(addr) && addr<=file->maxaddr);
/* Dispatch to driver */
- if ((file->cls->set_eoa)(file, addr)<0)
+ if((file->cls->set_eoa)(file, addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed")
done:
@@ -2975,11 +3016,11 @@ H5FDget_eof(H5FD_t *file)
H5TRACE1("a","x",file);
/* Check arguments */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
/* The real work */
- if (HADDR_UNDEF==(ret_value=H5FD_get_eof(file)))
+ if(HADDR_UNDEF==(ret_value=H5FD_get_eof(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed")
done:
@@ -3013,8 +3054,8 @@ H5FD_get_eof(const H5FD_t *file)
assert(file && file->cls);
/* Dispatch to driver */
- if (file->cls->get_eof) {
- if (HADDR_UNDEF==(ret_value=(file->cls->get_eof)(file)))
+ if(file->cls->get_eof) {
+ if(HADDR_UNDEF==(ret_value=(file->cls->get_eof)(file)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eof request failed")
} else {
ret_value = file->maxaddr;
@@ -3056,20 +3097,20 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size
H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
/* Get the default dataset transfer property list if the user didn't provide one */
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
- if (!buf)
+ if(!buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer")
/* Do the real work */
- if (H5FD_read(file, type, dxpl_id, addr, size, buf)<0)
+ if(H5FD_read(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed")
done:
@@ -3114,7 +3155,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Do not return early for Parallel mode since the I/O could be a */
/* collective transfer. */
/* The no-op case */
- if (0==size)
+ if(0==size)
HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
@@ -3138,7 +3179,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
H5_ASSIGN_OVERFLOW(amount_read,file->accum_loc-addr,hsize_t,size_t);
/* Dispatch to driver */
- if ((file->cls->read)(file, type, dxpl_id, addr, amount_read, read_buf)<0)
+ if((file->cls->read)(file, type, dxpl_id, addr, amount_read, read_buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Adjust the buffer, address & size */
@@ -3173,7 +3214,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Read the part after the metadata accumulator */
if(size>0 && addr>=(file->accum_loc+file->accum_size)) {
/* Dispatch to driver */
- if ((file->cls->read)(file, type, dxpl_id, addr, size, read_buf)<0)
+ if((file->cls->read)(file, type, dxpl_id, addr, size, read_buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Adjust the buffer, address & size */
@@ -3194,7 +3235,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
if(file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA_READ || !file->accum_dirty) {
/* Flush current contents, if dirty */
if(file->accum_dirty) {
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
/* Reset accumulator dirty flag */
@@ -3205,7 +3246,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* Check if we need to resize the buffer */
if(size>file->accum_buf_size) {
/* Grow the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3218,7 +3259,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
size_t new_size=(file->accum_buf_size/H5FD_ACCUM_THROTTLE); /* New size of accumulator buffer */
/* Shrink the accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,new_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,new_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3232,7 +3273,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
file->accum_dirty=FALSE;
/* Read into accumulator */
- if ((file->cls->read)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if((file->cls->read)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
/* Copy into buffer */
@@ -3240,14 +3281,14 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
} /* end if */
else {
/* Dispatch to driver */
- if ((file->cls->read)(file, type, dxpl_id, addr, size, buf)<0)
+ if((file->cls->read)(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
} /* end else */
} /* end if */
else {
/* Dispatch to driver */
- if ((file->cls->read)(file, type, dxpl_id, addr, size, buf)<0)
+ if((file->cls->read)(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
@@ -3285,19 +3326,19 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
/* Get the default dataset transfer property list if the user didn't provide one */
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
- if (!buf)
+ if(!buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer")
/* The real work */
- if (H5FD_write(file, type, dxpl_id, addr, size, buf)<0)
+ if(H5FD_write(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed")
done:
@@ -3344,7 +3385,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Do not return early for Parallel mode since the I/O could be a */
/* collective transfer. */
/* The no-op case */
- if (0==size)
+ if(0==size)
HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
@@ -3365,7 +3406,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
file->accum_buf_size = MAX(file->accum_buf_size*2,size+file->accum_size);
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
#ifdef H5_USING_PURIFY
HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
@@ -3393,7 +3434,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
file->accum_buf_size = MAX(file->accum_buf_size*2,size+file->accum_size);
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
#ifdef H5_USING_PURIFY
HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
@@ -3428,7 +3469,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
file->accum_buf_size = MAX(file->accum_buf_size*2,new_size);
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
#ifdef H5_USING_PURIFY
HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
@@ -3462,7 +3503,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
file->accum_buf_size = MAX(file->accum_buf_size*2,new_size);
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
#ifdef H5_USING_PURIFY
HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
@@ -3486,7 +3527,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
else {
/* Write out the existing metadata accumulator, with dispatch to driver */
if(file->accum_dirty) {
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
/* Reset accumulator dirty flag */
file->accum_dirty=FALSE;
@@ -3496,7 +3537,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Check if we need to resize the buffer */
if(size>file->accum_buf_size) {
/* Grow the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3512,7 +3553,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
size_t tmp_size=(file->accum_buf_size/H5FD_ACCUM_THROTTLE); /* New size of accumulator buffer */
/* Shrink the accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,tmp_size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,tmp_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3534,7 +3575,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Check if we need to reallocate the buffer */
if(size>file->accum_buf_size) {
/* Reallocate the metadata accumulator buffer */
- if ((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
+ if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
/* Note the new buffer size */
@@ -3552,7 +3593,7 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
} /* end if */
else {
/* Dispatch to driver */
- if ((file->cls->write)(file, type, dxpl_id, addr, size, buf)<0)
+ if((file->cls->write)(file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed")
} /* end else */
@@ -3589,16 +3630,16 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing)
H5TRACE3("e","xiIu",file,dxpl_id,closing);
/* Check args */
- if (!file || !file->cls)
+ if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer")
- if (H5P_DEFAULT == dxpl_id)
+ if(H5P_DEFAULT == dxpl_id)
dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if (TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
- if (H5FD_flush(file,dxpl_id,closing)<0)
+ if(H5FD_flush(file,dxpl_id,closing) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file flush request failed")
done:
@@ -3637,14 +3678,14 @@ H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing)
if((file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA) && file->accum_dirty && file->accum_size>0) {
/* Flush the metadata contents */
/* Not certain if the type and dxpl should be the way they are... -QAK */
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if((file->cls->write)(file, H5FD_MEM_DEFAULT, dxpl_id, file->accum_loc, file->accum_size, file->meta_accum) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver write request failed")
/* Reset the dirty flag */
file->accum_dirty=FALSE;
} /* end if */
- if (file->cls->flush && (file->cls->flush)(file,dxpl_id,closing)<0)
+ if(file->cls->flush && (file->cls->flush)(file,dxpl_id,closing) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed")
done:
@@ -3757,8 +3798,6 @@ done:
* Programmer: Quincey Koziol
* Monday, October 6, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -3766,27 +3805,72 @@ H5FD_get_freespace(const H5FD_t *file)
{
H5FD_free_t *free_node; /* Pointer to node on free list */
H5FD_mem_t type; /* Type of memory */
- hssize_t ret_value; /* Return value */
+ haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */
+ hsize_t ma_size; /* Size of "metadata aggregator" */
+ haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */
+ hsize_t sda_size; /* Size of "small data aggregator" */
+ haddr_t eoa; /* End of allocated space in the file */
+ hssize_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI(H5FD_get_freespace, FAIL)
/* check args */
- assert(file);
- assert(file->cls);
+ HDassert(file);
+ HDassert(file->cls);
+
+ /* Retrieve the 'eoa' for the file */
+ eoa = file->cls->get_eoa(file);
+
+ /* Check for aggregating metadata allocations */
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) {
+ ma_addr = file->eoma;
+ ma_size = file->cur_meta_block_size;
+ } /* end if */
- /* Initialize return value */
- ret_value=0;
+ /* Check for aggregating small data allocations */
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA) {
+ sda_addr = file->eosda;
+ sda_size = file->cur_sdata_block_size;
+ } /* end if */
/* Iterate over all the types of memory, to retrieve amount of free space for each */
- for (type=H5FD_MEM_DEFAULT; type<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) {
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) {
/* Iterate through the free list, accumulating the amount of free space for this type */
free_node = file->fl[type];
while(free_node) {
- ret_value+=(hssize_t)free_node->size;
- free_node=free_node->next;
+ /* Check for current node adjoining the metadata & small data aggregators */
+ if(H5F_addr_eq(free_node->addr + free_node->size, ma_addr)) {
+ ma_addr -= free_node->size;
+ ma_size += free_node->size;
+ } else if(H5F_addr_eq(free_node->addr + free_node->size, sda_addr)) {
+ sda_addr -= free_node->size;
+ sda_size += free_node->size;
+ } else if(H5F_addr_eq(ma_addr + ma_size, free_node->addr))
+ ma_size += free_node->size;
+ else if(H5F_addr_eq(sda_addr + sda_size, free_node->addr))
+ sda_size += free_node->size;
+ else
+ ret_value += (hssize_t)free_node->size;
+ free_node = free_node->next;
} /* end while */
} /* end for */
+ /* Check for aggregating metadata allocations */
+ if(H5F_addr_defined(ma_addr)) {
+ /* Add in the reserved space for metadata to the available free space */
+ /* (if it's not at the tail of the file) */
+ if(H5F_addr_ne(ma_addr + ma_size, eoa))
+ ret_value += ma_size;
+ } /* end if */
+
+ /* Check for aggregating small data allocations */
+ if(H5F_addr_defined(sda_addr)) {
+ /* Add in the reserved space for metadata to the available free space */
+ /* (if it's not at the tail of the file) */
+ if(H5F_addr_ne(sda_addr + sda_size, eoa))
+ ret_value += sda_size;
+ } /* end if */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_get_freespace() */
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 16ec733..d780da4 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -228,17 +228,19 @@ struct H5FD_t {
* allocation region left */
haddr_t eoma; /* End of metadata
* allocated region */
+ /* (ie. beginning of space available) */
/* "Small data" aggregation fields */
- hsize_t def_sdata_block_size; /* "Small data"
- * allocation block size
- * (if aggregating "small
- * data") */
- hsize_t cur_sdata_block_size; /* Current size of "small
- * data" allocation
- * region left */
- haddr_t eosda; /* End of "small data"
- * allocated region */
+ hsize_t def_sdata_block_size; /* "Small data"
+ * allocation block size
+ * (if aggregating "small
+ * data") */
+ hsize_t cur_sdata_block_size; /* Current size of "small
+ * data" allocation
+ * region left */
+ haddr_t eosda; /* End of "small data"
+ * allocated region */
+ /* (ie. beginning of space available) */
/* Metadata accumulator fields */
unsigned char *meta_accum; /* Buffer to hold the accumulated metadata */
diff --git a/src/H5FS.c b/src/H5FS.c
index 673c6ed..94c5303 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -231,6 +231,7 @@ herr_t
H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr)
{
H5FS_t *fspace = NULL; /* Free space header loaded from file */
+ H5FS_prot_t fs_prot; /* Temporary information for protecting free space header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FS_delete, FAIL)
@@ -242,8 +243,14 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC);
HDassert(f);
HDassert(H5F_addr_defined(fs_addr));
+ /* Initialize user data for protecting the free space manager */
+ /* (no class information necessary for delete) */
+ fs_prot.nclasses = 0;
+ fs_prot.classes = NULL;
+ fs_prot.cls_init_udata = NULL;
+
/* Protect the free space header */
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header")
/* Delete serialized section storage, if there are any */
@@ -404,7 +411,7 @@ H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
FUNC_ENTER_NOAPI_NOINIT(H5FS_new)
/* Check arguments. */
- HDassert(nclasses || classes);
+ HDassert(nclasses == 0 || (nclasses > 0 && classes));
/*
* Allocate free space structure
diff --git a/src/H5FScache.c b/src/H5FScache.c
index e0ec79a..646cf3e 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -209,9 +209,10 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr);
H5F_DECODE_LENGTH(f, p, fspace->ghost_sect_count);
/* # of section classes */
+ /* (only check if we actually have some classes) */
UINT16DECODE(p, nclasses);
- if(fspace->nclasses != nclasses)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown section class count mismatch")
+ if(fspace->nclasses > 0 && fspace->nclasses != nclasses)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch")
/* Shrink percent */
UINT16DECODE(p, fspace->shrink_percent);
@@ -409,7 +410,8 @@ H5FS_cache_hdr_dest(H5F_t UNUSED *f, H5FS_t *fspace)
} /* end for */
/* Release the memory for the free space section classes */
- fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls);
+ if(fspace->sect_cls)
+ fspace->sect_cls = H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls);
/* Free free space info */
H5FL_FREE(H5FS_t, fspace);
diff --git a/src/H5G.c b/src/H5G.c
index db049dc..25525c9 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -48,13 +48,13 @@
* | | | file. |
* +--------------+------------+--------------------------------+
* | File ID | "foo/bar" | Find `foo' within `bar' within |
- * | | | the current working group of |
- * | | | the specified file. |
+ * | | | the root group of the specified|
+ * | | | file. |
* +--------------+------------+--------------------------------+
* | File ID | "/" | The root group of the specified|
* | | | file. |
* +--------------+------------+--------------------------------+
- * | File ID | "." | The current working group of |
+ * | File ID | "." | The root group of the specified|
* | | | the specified file. |
* +--------------+------------+--------------------------------+
* | Group ID | "/foo/bar" | Find `foo' within `bar' within |
@@ -93,7 +93,6 @@
#include "H5Pprivate.h" /* Property lists */
/* Local macros */
-#define H5G_INIT_HEAP 8192
#define H5G_RESERVED_ATOMS 0
/* Local typedefs */
@@ -201,7 +200,6 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
-#ifdef H5_GROUP_REVISION
/* Check if we need to create a non-standard GCPL */
if(size_hint > 0) {
H5P_genplist_t *gc_plist; /* Property list created */
@@ -229,7 +227,6 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
} /* end if */
else
-#endif /* H5_GROUP_REVISION */
tmp_gcpl = H5P_GROUP_CREATE_DEFAULT;
/* What file is the group being added to? This may not be the same file
@@ -246,16 +243,19 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
if(NULL == (grp = H5G_create(file, H5AC_dxpl_id, tmp_gcpl, H5P_DEFAULT)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
+ /* Get an ID for the newly created group */
if((grp_id = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ /* Get the new group's location */
if(H5G_loc(grp_id, &grp_loc) <0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get location for new group")
- /* Link the group */
- if( H5L_link(&loc, name, &grp_loc, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id) < 0)
+ /* Link the new group to its parent group */
+ if(H5L_link(&loc, name, &grp_loc, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link to group")
+ /* Set the return value */
ret_value = grp_id;
done:
@@ -277,7 +277,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Gcreate_expand
@@ -345,6 +344,7 @@ H5Gcreate_expand(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
+ /* Create the new group & get its ID */
if(NULL == (grp = H5G_create(loc.oloc->file, H5AC_dxpl_id, gcpl_id, gapl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
if((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
@@ -358,7 +358,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate_expand() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -581,8 +580,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Giterate(hid_t loc_id, const char *name, int *idx_p,
- H5G_iterate_t op, void *op_data)
+H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
+ void *op_data)
{
int last_obj; /* Index of last object looked at */
int idx; /* Internal location to hold index */
@@ -604,7 +603,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
last_obj = 0;
/* Call private function. */
- if((ret_value = H5G_obj_iterate(loc_id, name, idx, &last_obj, op, op_data, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = H5G_obj_iterate(loc_id, name, H5_ITER_INC, idx, &last_obj, op, op_data, H5AC_ind_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
/* Check for too high of a starting index (ex post facto :-) */
@@ -614,7 +613,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p,
/* Set the index we stopped at */
if(idx_p)
- *idx_p=last_obj;
+ *idx_p = last_obj;
done:
FUNC_LEAVE_API(ret_value)
@@ -868,7 +867,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_comment() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Gget_create_plist
@@ -937,7 +935,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_create_plist() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -1380,20 +1377,16 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc)
*/
if (loc == NULL) {
H5P_genplist_t *fc_plist; /* File creation property list */
-#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info parameters */
-#endif /* H5_GROUP_REVISION */
/* Get the file creation property list */
/* (Which is a sub-class of the group creation property class) */
if(NULL == (fc_plist = H5I_object(f->shared->fcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-#ifdef H5_GROUP_REVISION
/* Get the group info property */
if(H5P_get(fc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
-#endif /* H5_GROUP_REVISION */
/* Set up group location for root group */
new_root_loc.oloc = &new_root_oloc;
@@ -1401,11 +1394,7 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc)
H5G_loc_reset(&new_root_loc);
loc = &new_root_loc;
- if(H5G_obj_create(f, dxpl_id,
-#ifdef H5_GROUP_REVISION
- &ginfo,
-#endif /* H5_GROUP_REVISION */
- loc->oloc/*out*/) < 0)
+ if(H5G_obj_create(f, dxpl_id, &ginfo, loc->oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
if(1 != H5O_link(loc->oloc, 1, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)")
@@ -1470,9 +1459,7 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
{
H5G_t *grp = NULL; /*new group */
H5P_genplist_t *gc_plist; /* Property list created */
-#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info */
-#endif /* H5_GROUP_REVISION */
unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */
H5G_t *ret_value; /* Return value */
@@ -1495,18 +1482,12 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
if(NULL == (gc_plist = H5I_object(gcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
-#ifdef H5_GROUP_REVISION
/* Get the group info property */
if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get group info")
-#endif /* H5_GROUP_REVISION */
/* Create the group object header */
- if(H5G_obj_create(file, dxpl_id,
-#ifdef H5_GROUP_REVISION
- &ginfo,
-#endif /* H5_GROUP_REVISION */
- &(grp->oloc)/*out*/) < 0)
+ if(H5G_obj_create(file, dxpl_id, &ginfo, &(grp->oloc)/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header")
oloc_init = 1; /* Indicate that the object location information is valid */
@@ -1516,6 +1497,7 @@ H5G_create(H5F_t *file, hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
if(H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects")
+ /* Set the count of times the object is opened */
grp->shared->fo_count = 1;
/* Set return value */
@@ -1671,11 +1653,8 @@ H5G_open_oid(H5G_t *grp, hid_t dxpl_id)
obj_opened = TRUE;
/* Check if this object has the right message(s) to be treated as a group */
- if(H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id) <= 0
-#ifdef H5_GROUP_REVISION
- && H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, dxpl_id) <= 0
-#endif /* H5_GROUP_REVISION */
- )
+ if((H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id) <= 0)
+ && (H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, dxpl_id) <= 0))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group")
done:
@@ -1931,10 +1910,9 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
/* Info for soft and UD links is gotten by H5L_get_linkinfo. If we have
- * a hard link, follow it and get info on the object */
- if(udata->follow_link || !lnk ||
- (lnk->type == H5L_LINK_HARD)) {
-
+ * a hard link, follow it and get info on the object
+ */
+ if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) {
/* Get object type */
statbuf->type = H5O_obj_type(obj_loc->oloc, udata->dxpl_id);
if(statbuf->type == H5G_UNKNOWN)
@@ -2029,16 +2007,16 @@ H5G_get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
ret = H5L_get_linkinfo(loc, name, &linfo, H5P_DEFAULT, dxpl_id);
} H5E_END_TRY
- if(ret >=0 && linfo.linkclass != H5L_LINK_HARD)
+ if(ret >=0 && linfo.type != H5L_TYPE_HARD)
{
statbuf->linklen = linfo.u.link_size;
- if(linfo.linkclass == H5L_LINK_SOFT)
+ if(linfo.type == H5L_TYPE_SOFT)
{
statbuf->type = H5G_LINK;
}
else /* UD link. H5L_get_linkinfo checked for invalid link classes */
{
- HDassert(linfo.linkclass >= H5L_LINK_UD_MIN && linfo.linkclass <= H5L_LINK_MAX);
+ HDassert(linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX);
statbuf->type = H5G_UDLINK;
}
}
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
new file mode 100644
index 0000000..f53493c
--- /dev/null
+++ b/src/H5Gbtree2.c
@@ -0,0 +1,376 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Gbtree2.c
+ * Sep 9 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: v2 B-tree callbacks for indexing fields on links
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gpkg.h" /* Groups */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/*
+ * Data exchange structure for dense link storage. This structure is
+ * passed through the fractal heap layer to compare links.
+ */
+typedef struct H5G_fh_ud_cmp_t {
+ /* downward */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ const char *name; /* Name of link to compare */
+ H5B2_found_t found_op; /* Callback when correct link is found */
+ void *found_op_data; /* Callback data when correct link is found */
+
+ /* upward */
+ int cmp; /* Comparison of two link names */
+} H5G_fh_ud_cmp_t;
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* v2 B-tree function callbacks */
+
+/* v2 B-tree driver callbacks */
+static herr_t H5G_dense_btree2_name_store(void *native, const void *udata);
+static herr_t H5G_dense_btree2_name_retrieve(void *udata, const void *native);
+static herr_t H5G_dense_btree2_name_compare(const void *rec1, const void *rec2);
+static herr_t H5G_dense_btree2_name_encode(const H5F_t *f, uint8_t *raw,
+ const void *native);
+static herr_t H5G_dense_btree2_name_decode(const H5F_t *f, const uint8_t *raw,
+ void *native);
+static herr_t H5G_dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
+ int indent, int fwidth, const void *record, const void *_udata);
+
+/* Fractal heap function callbacks */
+static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
+
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+/* v2 B-tree class for indexing 'name' field of links */
+const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
+ H5B2_GRP_DENSE_NAME_ID, /* Type of B-tree */
+ sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */
+ H5G_dense_btree2_name_store, /* Record storage callback */
+ H5G_dense_btree2_name_retrieve, /* Record retrieval callback */
+ H5G_dense_btree2_name_compare, /* Record comparison callback */
+ H5G_dense_btree2_name_encode, /* Record encoding callback */
+ H5G_dense_btree2_name_decode, /* Record decoding callback */
+ H5G_dense_btree2_name_debug /* Record debugging callback */
+}};
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_fh_name_cmp
+ *
+ * Purpose: Compares the name of a link in a fractal heap to another
+ * name
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
+ H5O_link_t *lnk; /* Pointer to link created from heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_fh_name_cmp)
+
+ /* Decode link information */
+ if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
+
+ /* Compare the string values */
+ udata->cmp = HDstrcmp(udata->name, lnk->name);
+
+ /* Check for correct link & callback to make */
+ if(udata->cmp == 0 && udata->found_op) {
+ if((udata->found_op)(lnk, udata->found_op_data) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed")
+ } /* end if */
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, lnk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_fh_name_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_store
+ *
+ * Purpose: Store user information into native record for v2 B-tree
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, September 9, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_store(void *_nrecord, const void *_udata)
+{
+ const H5G_bt2_ud_ins_t *udata = (const H5G_bt2_ud_ins_t *)_udata;
+ H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_store)
+
+ /* Copy user information info native record */
+ nrecord->hash = udata->common.name_hash;
+ HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_store() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_retrieve
+ *
+ * Purpose: Retrieve native information from record for v2 B-tree
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_retrieve(void *udata, const void *nrecord)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_retrieve)
+
+ *(H5G_dense_bt2_name_rec_t *)udata = *(const H5G_dense_bt2_name_rec_t *)nrecord;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_retrieve() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_compare
+ *
+ * Purpose: Compare two native information records, according to some key
+ *
+ * Return: <0 if rec1 < rec2
+ * =0 if rec1 == rec2
+ * >0 if rec1 > rec2
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
+{
+ const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata;
+ const H5G_dense_bt2_name_rec_t *bt2_rec = (const H5G_dense_bt2_name_rec_t *)_bt2_rec;
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_compare)
+
+ /* Sanity check */
+ HDassert(bt2_udata);
+ HDassert(bt2_rec);
+
+#ifdef QAK
+{
+unsigned u;
+
+HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G_dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash);
+HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G_dense_btree2_name_compare", (unsigned)bt2_rec->hash);
+for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
+ HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n"));
+}
+#endif /* QAK */
+ /* Check hash value */
+ if(bt2_udata->name_hash < bt2_rec->hash)
+ HGOTO_DONE(-1)
+ else if(bt2_udata->name_hash > bt2_rec->hash)
+ HGOTO_DONE(1)
+ else {
+ H5G_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
+ herr_t status; /* Status from fractal heap 'op' routine */
+
+ /* Sanity check */
+ HDassert(bt2_udata->name_hash == bt2_rec->hash);
+
+ /* Prepare user data for callback */
+ /* down */
+ fh_udata.f = bt2_udata->f;
+ fh_udata.dxpl_id = bt2_udata->dxpl_id;
+ fh_udata.name = bt2_udata->name;
+ fh_udata.found_op = bt2_udata->found_op;
+ fh_udata.found_op_data = bt2_udata->found_op_data;
+
+ /* up */
+ fh_udata.cmp = 0;
+
+ /* Check if the user's link and the B-tree's link have the same name */
+ status = H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id,
+ H5G_dense_fh_name_cmp, &fh_udata);
+ HDassert(status >= 0);
+
+ /* Callback will set comparison value */
+ HGOTO_DONE(fh_udata.cmp)
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5G_dense_btree2_name_compare() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_encode
+ *
+ * Purpose: Encode native information into raw form for storing on disk
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_encode(const H5F_t UNUSED *f, uint8_t *raw, const void *_nrecord)
+{
+ const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_encode)
+
+ /* Encode the record's fields */
+ UINT32ENCODE(raw, nrecord->hash)
+ HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_decode
+ *
+ * Purpose: Decode raw disk form of record into native form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_decode(const H5F_t UNUSED *f, const uint8_t *raw, void *_nrecord)
+{
+ H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_decode)
+
+ /* Decode the record's fields */
+ UINT32DECODE(raw, nrecord->hash)
+ HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_btree2_name_debug
+ *
+ * Purpose: Debug native form of record
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
+ int indent, int fwidth, const void *_nrecord,
+ const void UNUSED *_udata)
+{
+ const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord;
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_debug)
+
+ HDfprintf(stream, "%*s%-*s {%lx, ", indent, "", fwidth, "Record:",
+ nrecord->hash);
+ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
+ HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n"));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5G_dense_btree2_name_debug() */
+
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
new file mode 100644
index 0000000..4c31adc
--- /dev/null
+++ b/src/H5Gdense.c
@@ -0,0 +1,1374 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Gdense.c
+ * Sep 9 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: Routines for operating on "dense" link storage for a
+ * group in a file.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Gpkg.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Fractal heap creation parameters for "dense" link storage */
+#define H5G_FHEAP_MAN_WIDTH 4
+#define H5G_FHEAP_MAN_START_BLOCK_SIZE 512
+#define H5G_FHEAP_MAN_MAX_DIRECT_SIZE (64 * 1024)
+#define H5G_FHEAP_MAN_MAX_INDEX 32
+#define H5G_FHEAP_MAN_START_ROOT_ROWS 1
+#define H5G_FHEAP_CHECKSUM_DBLOCKS TRUE
+#define H5G_FHEAP_MAX_MAN_SIZE (4 * 1024)
+
+/* v2 B-tree creation macros for 'name' field index */
+#define H5G_NAME_BT2_NODE_SIZE 512
+#define H5G_NAME_BT2_MERGE_PERC 40
+#define H5G_NAME_BT2_SPLIT_PERC 100
+
+/* v2 B-tree creation macros for 'corder' field index */
+#define H5G_CORDER_BT2_NODE_SIZE 512
+#define H5G_CORDER_BT2_MERGE_PERC 40
+#define H5G_CORDER_BT2_SPLIT_PERC 100
+
+/* Size of stack buffer for serialized link */
+#define H5G_LINK_BUF_SIZE 128
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Data exchange structure to use when building table of links in group */
+typedef struct {
+ H5G_link_table_t *ltable; /* Pointer to link table to build */
+ size_t curr_lnk; /* Current link to operate on */
+} H5G_dense_bt_ud1_t;
+
+/*
+ * Data exchange structure to pass through the v2 B-tree layer for the
+ * H5B2_iterate function when iterating over densely stored links.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5HF_t *fheap; /* Fractal heap handle */
+ hbool_t lib_internal; /* Callback is library internal */
+
+ /* downward (from application) */
+ hid_t gid; /* Group ID for application callback */
+ H5G_link_iterate_t op; /* Callback for each link */
+ void *op_data; /* Callback data for each link */
+ int skip; /* Number of links to skip */
+ int *last_lnk; /* Pointer to the last link operated on */
+
+ /* upward */
+ int op_ret; /* Return value from callback */
+} H5G_bt2_it_ud1_t;
+
+/*
+ * Data exchange structure to pass through the fractal heap layer for the
+ * H5HF_op function when iterating over densely stored links.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+
+ /* upward */
+ H5O_link_t *lnk; /* Copy of link */
+} H5G_fh_it_ud1_t;
+
+/*
+ * Data exchange structure for dense link storage. This structure is
+ * passed through the v2 B-tree layer when removing links.
+ */
+typedef struct {
+ /* downward */
+ H5G_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
+ hbool_t adj_link; /* Whether to adjust link count on object */
+ hbool_t rem_from_fheap; /* Whether to remove the link from the fractal heap */
+
+ /* upward (for application) */
+ H5G_obj_t *obj_type; /* Type of object being removed */
+} H5G_bt2_ud_rem_t;
+
+/*
+ * Data exchange structure to pass through the fractal heap layer for the
+ * H5HF_op function when removing a link from densely stored links.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ hbool_t adj_link; /* Whether to adjust link count on object */
+
+ /* upward (for application) */
+ H5G_obj_t *obj_type; /* Type of object being removed */
+} H5G_fh_rem_ud1_t;
+
+/*
+ * Data exchange structure to pass through the v2 B-tree layer for the
+ * H5B2_index function when retrieving the name of a link by index.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5HF_t *fheap; /* Fractal heap handle */
+
+ /* downward (from application) */
+ char *name; /* Name buffer to fill */
+ size_t name_size; /* Size of name buffer to fill */
+
+ /* upward */
+ ssize_t name_len; /* Full length of name */
+} H5G_bt2_gnbi_ud1_t;
+
+/*
+ * Data exchange structure to pass through the fractal heap layer for the
+ * H5HF_op function when retrieving the name of a link by index.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+
+ /* downward (from application) */
+ char *name; /* Name buffer to fill */
+ size_t name_size; /* Size of name buffer to fill */
+
+ /* upward */
+ ssize_t name_len; /* Full length of name */
+} H5G_fh_gnbi_ud1_t;
+
+/*
+ * Data exchange structure to pass through the v2 B-tree layer for the
+ * H5B2_index function when retrieving the type of a link by index.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5HF_t *fheap; /* Fractal heap handle */
+
+ /* upward */
+ H5G_obj_t type; /* Type of object */
+} H5G_bt2_gtbi_ud1_t;
+
+/*
+ * Data exchange structure to pass through the fractal heap layer for the
+ * H5HF_op function when retrieving the type of a link by index.
+ */
+typedef struct {
+ /* downward (internal) */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+
+ /* upward */
+ H5G_obj_t type; /* Type of object */
+} H5G_fh_gtbi_ud1_t;
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* The v2 B-tree class for indexing 'name' field on links */
+H5_DLLVAR const H5B2_class_t H5G_BT2_NAME[1];
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Declare a free list to manage the serialized link information */
+H5FL_BLK_DEFINE(ser_link);
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_create
+ *
+ * Purpose: Creates dense link storage structures for a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 9 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo)
+{
+ H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
+ H5HF_t *fheap; /* Fractal heap handle */
+ size_t fheap_id_len; /* Fractal heap ID length */
+ size_t bt2_rrec_size; /* v2 B-tree raw record size */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_create, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* Set fractal heap creation parameters */
+/* XXX: Give some control of these to applications? */
+ HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam));
+ fheap_cparam.managed.width = H5G_FHEAP_MAN_WIDTH;
+ fheap_cparam.managed.start_block_size = H5G_FHEAP_MAN_START_BLOCK_SIZE;
+ fheap_cparam.managed.max_direct_size = H5G_FHEAP_MAN_MAX_DIRECT_SIZE;
+ fheap_cparam.managed.max_index = H5G_FHEAP_MAN_MAX_INDEX;
+ fheap_cparam.managed.start_root_rows = H5G_FHEAP_MAN_START_ROOT_ROWS;
+ fheap_cparam.checksum_dblocks = H5G_FHEAP_CHECKSUM_DBLOCKS;
+ fheap_cparam.max_man_size = H5G_FHEAP_MAX_MAN_SIZE;
+
+ /* Create fractal heap for storing links */
+ if(NULL == (fheap = H5HF_create(f, dxpl_id, &fheap_cparam)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create fractal heap")
+
+ /* Retrieve the heap's address in the file */
+ if(H5HF_get_heap_addr(fheap, &(linfo->link_fheap_addr)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address")
+#ifdef QAK
+HDfprintf(stderr, "%s: linfo->link_fheap_addr = %a\n", FUNC, linfo->link_fheap_addr);
+#endif /* QAK */
+
+ /* Retrieve the heap's ID length in the file */
+ if(H5HF_get_id_len(fheap, &fheap_id_len) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length")
+ HDassert(fheap_id_len == H5G_DENSE_FHEAP_ID_LEN);
+#ifdef QAK
+HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len);
+#endif /* QAK */
+
+ /* Close the fractal heap */
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ /* Create the name index v2 B-tree */
+ bt2_rrec_size = 4 + /* Name's hash value */
+ fheap_id_len; /* Fractal heap ID */
+ if(H5B2_create(f, dxpl_id, H5G_BT2_NAME,
+ (size_t)H5G_NAME_BT2_NODE_SIZE, bt2_rrec_size,
+ H5G_NAME_BT2_SPLIT_PERC, H5G_NAME_BT2_MERGE_PERC,
+ &(linfo->name_bt2_addr)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
+#ifdef QAK
+HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr);
+#endif /* QAK */
+
+ /* XXX: Check if we should create a creation order index v2 B-tree */
+ /* XXX: Create the creation order index v2 B-tree */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_insert
+ *
+ * Purpose: Insert a link into the dense link storage structures for a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ const H5O_link_t *lnk)
+{
+ H5G_bt2_ud_ins_t udata; /* User data for v2 B-tree insertion */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ size_t link_size; /* Size of serialized link in the heap */
+ uint8_t link_buf[H5G_LINK_BUF_SIZE]; /* Buffer for serializing link */
+ void *link_ptr = NULL; /* Pointer to serialized link */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_insert, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(lnk);
+#ifdef QAK
+HDfprintf(stderr, "%s: linfo->link_fheap_addr = %a\n", FUNC, linfo->link_fheap_addr);
+HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr);
+#endif /* QAK */
+
+ /* Find out the size of buffer needed for serialized link */
+ if((link_size = H5O_raw_size(H5O_LINK_ID, f, lnk)) == 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size")
+#ifdef QAK
+HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDstrlen(lnk->name), link_size);
+#endif /* QAK */
+
+ /* Allocate space for serialized link, if necessary */
+ if(link_size > sizeof(link_buf)) {
+ if(NULL == (link_ptr = H5FL_BLK_MALLOC(ser_link, link_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "memory allocation failed")
+ } /* end if */
+ else
+ link_ptr = link_buf;
+
+ /* Create serialized form of link */
+ if(H5O_encode(f, link_ptr, lnk, H5O_LINK_ID) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Insert the serialized link into the fractal heap */
+ if(H5HF_insert(fheap, dxpl_id, link_size, link_ptr, udata.id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into fractal heap")
+
+ /* Create the callback information for v2 B-tree record insertion */
+ udata.common.f = f;
+ udata.common.dxpl_id = dxpl_id;
+ udata.common.fheap = fheap;
+ udata.common.name = lnk->name;
+ udata.common.name_hash = H5_checksum_lookup3(lnk->name, HDstrlen(lnk->name));
+ udata.common.found_op = NULL;
+ udata.common.found_op_data = NULL;
+ /* udata.id already set in H5HF_insert() call */
+
+ /* Insert link into 'name' tracking v2 B-tree */
+ if(H5B2_insert(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
+
+ /* XXX: Check if we should create a creation order index v2 B-tree record */
+ /* XXX: Insert the record into the creation order index v2 B-tree */
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(link_ptr && link_ptr != link_buf)
+ H5FL_BLK_FREE(ser_link, link_ptr);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_insert() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_lookup_cb
+ *
+ * Purpose: Callback when a link is located in the 'name' index
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_lookup_cb(const void *_lnk, void *_user_lnk)
+{
+ const H5O_link_t *lnk = (const H5O_link_t *)_lnk; /* Record from B-tree */
+ H5O_link_t *user_lnk = (H5O_link_t *)_user_lnk; /* User data from v2 B-tree link lookup */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_lookup_cb)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(lnk);
+ HDassert(user_lnk);
+
+ /* Check if we want the link information */
+ if(user_lnk) {
+ /* Copy link information */
+ if(H5O_copy(H5O_LINK_ID, lnk, user_lnk) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5O_ITER_ERROR, "can't copy link message")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_lookup_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_lookup
+ *
+ * Purpose: Look up a link within a group that uses dense link storage
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ const char *name, H5O_link_t *lnk)
+{
+ H5G_bt2_ud_common_t udata; /* User data for v2 B-tree link lookup */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_lookup, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(name && *name);
+ HDassert(lnk);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Construct the user data for v2 B-tree callback */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.fheap = fheap;
+ udata.name = name;
+ udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name));
+ udata.found_op = H5G_dense_lookup_cb; /* v2 B-tree comparison callback */
+ udata.found_op_data = lnk;
+
+ /* Find & copy the named link in the 'name' index */
+ if(H5B2_find(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in name index")
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_lookup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_build_table_cb
+ *
+ * Purpose: Callback routine for building table of links from dense
+ * link storage.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sept 25 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_build_table_cb(const H5O_link_t *lnk, void *_udata)
+{
+ H5G_dense_bt_ud1_t *udata = (H5G_dense_bt_ud1_t *)_udata; /* 'User data' passed in */
+ herr_t ret_value = H5B2_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_build_table_cb)
+
+ /* check arguments */
+ HDassert(lnk);
+ HDassert(udata);
+ HDassert(udata->curr_lnk < udata->ltable->nlinks);
+
+ /* Copy link information */
+ if(H5O_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5B2_ITER_ERROR, "can't copy link message")
+
+ /* Increment number of links stored */
+ udata->curr_lnk++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_build_table_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_build_table
+ *
+ * Purpose: Builds a table containing a sorted (alphabetically) list of
+ * links for a group
+ *
+ * Note: Used for building table of links in non-native iteration order
+ * for an index
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Sep 25, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, H5G_link_table_t *ltable)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_build_table)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(ltable);
+
+ /* Set size of table */
+ H5_CHECK_OVERFLOW(linfo->nlinks, /* From: */ hsize_t, /* To: */ size_t);
+ ltable->nlinks = (size_t)linfo->nlinks;
+
+ /* Allocate space for the table entries */
+ if(ltable->nlinks > 0) {
+ H5G_dense_bt_ud1_t udata; /* User data for iteration callback */
+ H5G_link_iterate_t lnk_op; /* Link operator */
+
+ /* Allocate the table to store the links */
+ if((ltable->lnks = H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Set up user data for iteration */
+ udata.ltable = ltable;
+ udata.curr_lnk = 0;
+
+ /* Build iterator operator */
+ lnk_op.lib_op = H5G_dense_build_table_cb;
+
+ /* Iterate over the links in the group, building a table of the link messages */
+ if(H5G_dense_iterate(f, dxpl_id, H5_ITER_NATIVE, 0, linfo, TRUE, 0, NULL, lnk_op, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+
+ /* Sort link table in correct iteration order */
+ /* (XXX: by name, currently) */
+ if(order == H5_ITER_INC)
+ HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_inc);
+ else if(order == H5_ITER_INC)
+ HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_dec);
+ else
+ HDassert(order == H5_ITER_NATIVE);
+ } /* end if */
+ else
+ ltable->lnks = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_build_table() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_iterate_fh_cb
+ *
+ * Purpose: Callback for fractal heap operator, to make user's callback
+ * when iterating over links
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_iterate_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_it_ud1_t *udata = (H5G_fh_it_ud1_t *)_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_iterate_fh_cb)
+
+ /* Decode link information & keep a copy */
+ /* (we make a copy instead of calling the user/library callback directly in
+ * this routine because this fractal heap 'op' callback routine is called
+ * with the direct block protected and if the callback routine invokes an
+ * HDF5 routine, it could attempt to re-protect that direct block for the
+ * heap, causing the HDF5 routine called to fail)
+ */
+ if(NULL == (udata->lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_iterate_fh_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_iterate_bt2_cb
+ *
+ * Purpose: v2 B-tree callback for dense link storage iterator
+ *
+ * Return: H5B2_ITER_ERROR/H5B2_ITER_CONT/H5B2_ITER_STOP
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
+{
+ const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record;
+ H5G_bt2_it_ud1_t *bt2_udata = (H5G_bt2_it_ud1_t *)_bt2_udata; /* User data for callback */
+ int ret_value = H5B2_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_iterate_bt2_cb)
+
+ /* Check for skipping links */
+ if(bt2_udata->skip > 0)
+ --bt2_udata->skip;
+ else {
+ H5G_fh_it_ud1_t fh_udata; /* User data for fractal heap 'op' callback */
+
+ /* Prepare user data for callback */
+ /* down */
+ fh_udata.f = bt2_udata->f;
+ fh_udata.dxpl_id = bt2_udata->dxpl_id;
+
+ /* Call fractal heap 'op' routine, to copy the link information */
+ if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, record->id,
+ H5G_dense_iterate_fh_cb, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5B2_ITER_ERROR, "link found callback failed")
+
+ /* Check for internal callback with link info */
+ if(bt2_udata->lib_internal)
+ /* Call the library's callback */
+ ret_value = (bt2_udata->op.lib_op)(fh_udata.lnk, bt2_udata->op_data);
+ else
+ /* Make the application's callback */
+ ret_value = (bt2_udata->op.app_op)(bt2_udata->gid, fh_udata.lnk->name, bt2_udata->op_data);
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, fh_udata.lnk);
+ } /* end else */
+
+ /* Increment the number of entries passed through */
+ /* (whether we skipped them or not) */
+ if(bt2_udata->last_lnk)
+ (*bt2_udata->last_lnk)++;
+
+ /* Check for callback failure and pass along return value */
+ if(ret_value < 0)
+ HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_iterate_bt2_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_iterate
+ *
+ * Purpose: Iterate over the objects in a group using dense link storage
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, H5_iter_order_t order, hid_t gid,
+ const H5O_linfo_t *linfo, hbool_t lib_internal, int skip, int *last_lnk,
+ H5G_link_iterate_t op, void *op_data)
+{
+ H5G_bt2_it_ud1_t udata; /* User data for iterator callback */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_iterate, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(op.lib_op);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Check on iteration order */
+ /* ("native" iteration order is unordered for this link storage mechanism) */
+ if(order == H5_ITER_NATIVE) {
+ /* Construct the user data for v2 B-tree iterator callback */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.fheap = fheap;
+ udata.lib_internal = lib_internal;
+ udata.gid = gid;
+ udata.skip = skip;
+ udata.last_lnk = last_lnk;
+ udata.op = op;
+ udata.op_data = op_data;
+
+ /* Iterate over the records in the v2 B-tree */
+ /* (XXX: by name, currently) */
+ if((ret_value = H5B2_iterate(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr,
+ H5G_dense_iterate_bt2_cb, &udata)) < 0)
+ HERROR(H5E_SYM, H5E_BADITER, "link iteration failed");
+ } /* end if */
+ else {
+ H5G_link_table_t ltable; /* Table of links */
+ size_t u; /* Local index variable */
+
+ /* Build the table of links for this group */
+ if(H5G_dense_build_table(f, dxpl_id, linfo, order, &ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+
+ /* Iterate over link messages */
+ for(u = 0, ret_value = H5B_ITER_CONT; u < ltable.nlinks && !ret_value; u++) {
+ if(skip > 0)
+ --skip;
+ else {
+ /* Check for internal callback with link info */
+ if(lib_internal)
+ ret_value = (op.lib_op)(&(ltable.lnks[u]), op_data);
+ else
+ ret_value = (op.app_op)(gid, ltable.lnks[u].name, op_data);
+ } /* end else */
+
+ /* Increment the number of entries passed through */
+ /* (whether we skipped them or not) */
+ if(last_lnk)
+ (*last_lnk)++;
+ } /* end for */
+
+ /* Check for callback failure and pass along return value */
+ if(ret_value < 0)
+ HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+
+ /* Free link table information */
+ if(H5G_obj_release_table(&ltable) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
+ } /* end else */
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_iterate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_name_by_idx_fh_cb
+ *
+ * Purpose: Callback for fractal heap operator, to retrieve name according
+ * to an index
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_gnbi_ud1_t *udata = (H5G_fh_gnbi_ud1_t *)_udata; /* User data for fractal heap 'op' callback */
+ H5O_link_t *lnk; /* Pointer to link created from heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_name_by_idx_fh_cb)
+
+ /* Decode link information */
+ if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
+
+ /* Get the length of the name */
+ udata->name_len = (ssize_t)HDstrlen(lnk->name);
+
+ /* Copy the name into the user's buffer, if given */
+ if(udata->name) {
+ HDstrncpy(udata->name, lnk->name, MIN((size_t)(udata->name_len + 1), udata->name_size));
+ if((size_t)udata->name_len >= udata->name_size)
+ udata->name[udata->name_size - 1] = '\0';
+ } /* end if */
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, lnk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_name_by_idx_fh_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_name_by_idx_bt2_cb
+ *
+ * Purpose: v2 B-tree callback for dense link storage 'get name by idx' call
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
+{
+ const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record;
+ H5G_bt2_gnbi_ud1_t *bt2_udata = (H5G_bt2_gnbi_ud1_t *)_bt2_udata; /* User data for callback */
+ H5G_fh_gnbi_ud1_t fh_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_name_by_idx_bt2_cb)
+
+ /* Prepare user data for callback */
+ /* down */
+ fh_udata.f = bt2_udata->f;
+ fh_udata.dxpl_id = bt2_udata->dxpl_id;
+ fh_udata.name = bt2_udata->name;
+ fh_udata.name_size = bt2_udata->name_size;
+
+ /* Call fractal heap 'op' routine, to perform user callback */
+ if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, record->id,
+ H5G_dense_get_name_by_idx_fh_cb, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed")
+
+ /* Set the name's full length to return */
+ bt2_udata->name_len = fh_udata.name_len;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_name_by_idx_bt2_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_name_by_idx
+ *
+ * Purpose: Returns the name of objects in the group by giving index.
+ *
+ * Return: Success: Non-negative, length of name
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
+ hsize_t idx, char* name, size_t size)
+{
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5G_bt2_gnbi_ud1_t udata; /* User data for v2 B-tree callback */
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_get_name_by_idx, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Set up the user data for the v2 B-tree 'record remove' callback */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.fheap = fheap;
+ udata.name = name;
+ udata.name_size = size;
+
+ /* Retrieve the name according to the v2 B-tree's index order */
+ /* (XXX: using name index currently) */
+ if(H5B2_index(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, idx,
+ H5G_dense_get_name_by_idx_bt2_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree")
+
+ /* Set return value */
+ ret_value = udata.name_len;
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_name_by_idx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_type_by_idx_fh_cb
+ *
+ * Purpose: Callback for fractal heap operator, to retrieve type according
+ * to an index
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_get_type_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_gtbi_ud1_t *udata = (H5G_fh_gtbi_ud1_t *)_udata; /* User data for fractal heap 'op' callback */
+ H5O_link_t *lnk; /* Pointer to link created from heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_type_by_idx_fh_cb)
+
+ /* Decode link information */
+ if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
+
+ /* Get the type of the link */
+ /* Determine type of object */
+ if(lnk->type == H5L_TYPE_SOFT)
+ udata->type = H5G_LINK;
+ else if(lnk->type >= H5L_TYPE_UD_MIN)
+ udata->type = H5G_UDLINK;
+ else if(lnk->type == H5L_TYPE_HARD) {
+ H5O_loc_t tmp_oloc; /* Temporary object location */
+
+ /* Build temporary object location */
+ tmp_oloc.file = udata->f;
+ tmp_oloc.addr = lnk->u.hard.addr;
+
+ /* Get the type of the object */
+ if((udata->type = H5O_obj_type(&tmp_oloc, udata->dxpl_id)) == H5G_UNKNOWN)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine object type")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown link type")
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, lnk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_type_by_idx_fh_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_type_by_idx_bt2_cb
+ *
+ * Purpose: v2 B-tree callback for dense link storage 'get type by idx' call
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_get_type_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
+{
+ const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record;
+ H5G_bt2_gtbi_ud1_t *bt2_udata = (H5G_bt2_gtbi_ud1_t *)_bt2_udata; /* User data for callback */
+ H5G_fh_gtbi_ud1_t fh_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_type_by_idx_bt2_cb)
+
+ /* Prepare user data for callback */
+ /* down */
+ fh_udata.f = bt2_udata->f;
+ fh_udata.dxpl_id = bt2_udata->dxpl_id;
+
+ /* Call fractal heap 'op' routine, to perform user callback */
+ if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, record->id,
+ H5G_dense_get_type_by_idx_fh_cb, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed")
+
+ /* Set the link's type to return */
+ bt2_udata->type = fh_udata.type;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_type_by_idx_bt2_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_get_type_by_idx
+ *
+ * Purpose: Returns the type of objects in the group by giving index.
+ *
+ * Return: Success: Non-negative, length of name
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 19 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+H5G_obj_t
+H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
+ hsize_t idx)
+{
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5G_bt2_gtbi_ud1_t udata; /* User data for v2 B-tree callback */
+ H5G_obj_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_get_type_by_idx, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Set up the user data for the v2 B-tree 'record remove' callback */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.fheap = fheap;
+
+ /* Retrieve the name according to the v2 B-tree's index order */
+ /* (XXX: using name index currently) */
+ if(H5B2_index(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, idx,
+ H5G_dense_get_type_by_idx_bt2_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree")
+
+ /* Set return value */
+ ret_value = udata.type;
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_get_type_by_idx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_remove_fh_cb
+ *
+ * Purpose: Callback for fractal heap operator when removing over links
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 12 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
+{
+ H5G_fh_rem_ud1_t *udata = (H5G_fh_rem_ud1_t *)_udata; /* User data for fractal heap 'op' callback */
+ H5O_link_t *lnk; /* Pointer to link created from heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_fh_cb)
+
+ /* Decode link information */
+ if(NULL == (lnk = H5O_decode(udata->f, udata->dxpl_id, obj, H5O_LINK_ID)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5B2_ITER_ERROR, "can't decode link")
+
+ /* Retrieve the link's object type & decr. the ref. count on hard links, if requested */
+ switch(lnk->type) {
+ case H5L_TYPE_HARD:
+ {
+ H5O_loc_t tmp_oloc; /* Temporary object location */
+
+ /* Build temporary object location */
+ tmp_oloc.file = udata->f;
+ tmp_oloc.addr = lnk->u.hard.addr;
+
+ /* Get the type of the object */
+ /* Note: no way to check for error :-( */
+ if(udata->obj_type)
+ *(udata->obj_type) = H5O_obj_type(&tmp_oloc, udata->dxpl_id);
+
+ /* Decrement the ref count for the object, if requested */
+ if(udata->adj_link)
+ if(H5O_link(&tmp_oloc, -1, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to decrement object link count")
+ }
+ break;
+
+ case H5L_TYPE_SOFT:
+ if(udata->obj_type)
+ *(udata->obj_type) = H5G_LINK;
+ break;
+
+ default: /* User-defined link */
+ if(lnk->type < H5L_TYPE_UD_MIN)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type")
+ if(udata->obj_type)
+ *(udata->obj_type) = H5G_UDLINK;
+ } /* end switch */
+
+ /* Release the space allocated for the link */
+ H5O_free(H5O_LINK_ID, lnk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_remove_fh_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_remove_cb
+ *
+ * Purpose: v2 B-tree callback for dense link storage record removal
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 12 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata)
+{
+ const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record;
+ H5G_bt2_ud_rem_t *bt2_udata = (H5G_bt2_ud_rem_t *)_bt2_udata; /* User data for callback */
+ H5G_fh_rem_ud1_t fh_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_bt2_cb)
+
+ /* Set up the user data for fractalheap 'op' callback */
+ fh_udata.f = bt2_udata->common.f;
+ fh_udata.dxpl_id = bt2_udata->common.dxpl_id;
+ fh_udata.adj_link = bt2_udata->adj_link;
+ fh_udata.obj_type = bt2_udata->obj_type;
+
+ /* Call fractal heap 'op' routine, to perform user callback */
+ if(H5HF_op(bt2_udata->common.fheap, bt2_udata->common.dxpl_id, record->id,
+ H5G_dense_remove_fh_cb, &fh_udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed")
+
+ /* Remove record from fractal heap, if requested */
+ if(bt2_udata->rem_from_fheap)
+ if(H5HF_remove(bt2_udata->common.fheap, bt2_udata->common.dxpl_id, record->id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from fractal heap")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_remove_bt2_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_remove
+ *
+ * Purpose: Remove a link from the dense storage of a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 12 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ const char *name, H5G_obj_t *obj_type)
+{
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5G_bt2_ud_rem_t udata; /* User data for v2 B-tree record removal */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_remove, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+ HDassert(name && *name);
+ HDassert(obj_type);
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Set up the user data for the v2 B-tree 'record remove' callback */
+ udata.common.f = f;
+ udata.common.dxpl_id = dxpl_id;
+ udata.common.fheap = fheap;
+ udata.common.name = name;
+ udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name));
+ udata.common.found_op = NULL;
+ udata.common.found_op_data = NULL;
+ udata.adj_link = TRUE;
+ udata.rem_from_fheap = TRUE;
+ udata.obj_type = obj_type;
+
+ /* Remove the record from the name index v2 B-tree */
+ if(H5B2_remove(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr,
+ &udata, H5G_dense_remove_bt2_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from name index v2 B-tree")
+
+/* XXX: Remove the link from the creation order index v2 B-tree */
+
+done:
+ /* Release resources */
+ if(fheap)
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_remove() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_dense_delete
+ *
+ * Purpose: Delete the dense storage for a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 12 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_dense_delete, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* Check if we are to adjust the ref. count for all the links */
+ if(adj_link) {
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5G_bt2_ud_rem_t udata; /* User data for v2 B-tree record removal */
+
+ /* Open the fractal heap */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->link_fheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Set up the user data for the v2 B-tree 'record remove' callback */
+ udata.common.f = f;
+ udata.common.dxpl_id = dxpl_id;
+ udata.common.fheap = fheap;
+ udata.common.name = NULL;
+ udata.common.name_hash = 0;
+ udata.common.found_op = NULL;
+ udata.common.found_op_data = NULL;
+ udata.adj_link = TRUE;
+ udata.rem_from_fheap = FALSE;
+ udata.obj_type = NULL;
+
+ /* Delete the name index, adjusting the ref. count on links removed */
+ if(H5B2_delete(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, H5G_dense_remove_bt2_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
+
+ /* Close the fractal heap */
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ } /* end if */
+ else {
+ /* Delete the name index, without adjusting the ref. count on the links */
+ if(H5B2_delete(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
+ } /* end else */
+ linfo->name_bt2_addr = HADDR_UNDEF;
+
+/* XXX: Check if we should delete the creation order index v2 B-tree */
+
+ /* Delete the fractal heap */
+ if(H5HF_delete(f, dxpl_id, linfo->link_fheap_addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete fractal heap")
+ linfo->link_fheap_addr = HADDR_UNDEF;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_dense_delete() */
+
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 31304b4..35fe13a 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -43,29 +43,29 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5Glink(hid_t cur_loc_id, H5L_link_t type, const char *cur_name, const char *new_name)
+H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name, const char *new_name)
{
herr_t ret_value;
FUNC_ENTER_API(H5Glink, FAIL)
H5TRACE4("e","iLlss",cur_loc_id,type,cur_name,new_name);
- if(type == H5L_LINK_HARD)
+ if(type == H5L_TYPE_HARD)
{
- if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
+ if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
- else if(type == H5L_LINK_SOFT)
+ else if(type == H5L_TYPE_SOFT)
{
- if((ret_value = H5Lcreate_soft(cur_name, cur_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
+ if((ret_value = H5Lcreate_soft(cur_name, cur_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Glink() */
/*-------------------------------------------------------------------------
@@ -77,7 +77,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_link_t type,
+H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_type_t type,
hid_t new_loc_id, const char *new_name)
{
herr_t ret_value;
@@ -85,11 +85,11 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_link_t type,
FUNC_ENTER_API(H5Glink2, FAIL)
H5TRACE5("e","isLlis",cur_loc_id,cur_name,type,new_loc_id,new_name);
- if(type == H5L_LINK_HARD) {
+ if(type == H5L_TYPE_HARD) {
if((ret_value = H5Lcreate_hard(cur_loc_id, cur_name, new_loc_id, new_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "Couldn't create link")
}
- else if(type == H5L_LINK_SOFT) {
+ else if(type == H5L_TYPE_SOFT) {
/* Soft links only need one location, the new_loc_id, but it's possible that
* new_loc_id is H5L_SAME_LOC */
if(new_loc_id == H5L_SAME_LOC)
diff --git a/src/H5Gent.c b/src/H5Gent.c
index f242bad..ad6a083 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -183,11 +183,6 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
UINT32DECODE (*pp, ent->cache.slink.lval_offset);
break;
- case H5G_CACHED_ULINK:
- UINT32DECODE (*pp, ent->cache.ulink.udata_size);
- UINT32DECODE (*pp, ent->cache.ulink.udata_offset);
- UINT32DECODE (*pp, ent->cache.ulink.link_type);
- break;
default:
/* Error or unknown type. Bail out. */
return -1;
@@ -302,12 +297,6 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
UINT32ENCODE (*pp, ent->cache.slink.lval_offset);
break;
- case H5G_CACHED_ULINK:
- UINT32ENCODE (*pp, ent->cache.ulink.udata_size);
- UINT32ENCODE (*pp, ent->cache.ulink.udata_offset);
- UINT32ENCODE (*pp, ent->cache.ulink.link_type);
- break;
-
default:
/* Unknown cached type. Bail out. */
return -1;
@@ -411,10 +400,8 @@ H5G_ent_reset(H5G_entry_t *ent)
*
* Purpose: Convert a link to a symbol table entry
*
- * Return: Success: Non-negative, with *pp pointing to the first byte
- * after the last symbol.
- *
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -450,12 +437,12 @@ H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name, const H5O_link_t
/* Build correct information for symbol table entry based on link type */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
ent->type = H5G_NOTHING_CACHED;
ent->header = lnk->u.hard.addr;
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
{
size_t lnk_offset; /* Offset to sym-link value */
@@ -470,24 +457,7 @@ H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name, const H5O_link_t
break;
default:
- if(lnk->type < H5L_LINK_UD_MIN)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
-
- {
- size_t udata_offset = (size_t) (-1); /* Offset to data buffer */
-
- if(lnk->u.ud.size > 0)
- {
- if((size_t)(-1) == (udata_offset = H5HL_insert(f, dxpl_id,
- heap_addr, lnk->u.ud.size, lnk->u.ud.udata)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write user data to local heap")
- }
-
- ent->type = H5G_CACHED_ULINK;
- ent->cache.ulink.udata_size = lnk->u.ud.size;
- ent->cache.ulink.udata_offset = udata_offset;
- ent->cache.ulink.link_type = lnk->type;
- }
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
} /* end switch */
/* Set the file for the entry */
@@ -536,7 +506,7 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
ent->dirty ? "Yes" : "No");
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth,
"Cache info type:");
- switch (ent->type) {
+ switch(ent->type) {
case H5G_NOTHING_CACHED:
HDfprintf(stream, "Nothing Cached\n");
break;
@@ -554,88 +524,30 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
break;
case H5G_CACHED_SLINK:
- HDfprintf (stream, "Symbolic Link\n");
+ HDfprintf(stream, "Symbolic Link\n");
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
"Cached information:");
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
+ HDfprintf(stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"Link value offset:",
(unsigned long)(ent->cache.slink.lval_offset));
- if (heap>0 && H5F_addr_defined(heap)) {
+ if(heap > 0 && H5F_addr_defined(heap)) {
const H5HL_t *heap_ptr;
heap_ptr = H5HL_protect(ent->file, dxpl_id, heap);
lval = H5HL_offset_into(ent->file, heap_ptr, ent->cache.slink.lval_offset);
- HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
"Link value:",
lval);
H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, H5AC__NO_FLAGS_SET);
- }
+ } /* end if */
else
HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given, name not displayed!");
break;
- case H5G_CACHED_ULINK:
- if(ent->cache.ulink.link_type == H5L_LINK_EXTERNAL)
- {
- HDfprintf (stream, "External Link\n");
- HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
- "Cached information:");
- if(ent->cache.ulink.udata_size > 0)
- {
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "User data offset:",
- (unsigned long)(ent->cache.ulink.udata_offset));
- }
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "User data size:",
- (unsigned long)(ent->cache.ulink.udata_size));
- if (heap>0 && H5F_addr_defined(heap)) {
- const H5HL_t *heap_ptr;
- char * filename;
- char * pathname;
-
- heap_ptr = H5HL_protect(ent->file, dxpl_id, heap);
- lval = H5HL_offset_into(ent->file, heap_ptr, ent->cache.ulink.udata_offset);
- if(H5Lunpack_elink_val(lval, &filename, &pathname) < 0) return FAIL;
-
- HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
- "External link file name:",
- lval);
- HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
- "External link object name:",
- pathname);
- H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, H5AC__NO_FLAGS_SET);
- } else {
- HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given!");
- }
- }
- else
- {
- HDfprintf (stream, "User-defined Link\n");
- HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
- "Cached information:");
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "Link class:",
- (unsigned long)(ent->cache.ulink.link_type));
- if(ent->cache.ulink.udata_size > 0)
- {
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "User data offset:",
- (unsigned long)(ent->cache.ulink.udata_offset));
- }
- HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
- "User data size:",
- (unsigned long)(ent->cache.ulink.udata_size));
- if (heap<=0 || !H5F_addr_defined(heap)) {
- HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given!");
- }
- }
- break;
-
default:
HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type);
break;
- }
+ } /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED);
}
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 018088e..ab9fdce 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -33,15 +33,8 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#ifdef H5_GROUP_REVISION
/* Private typedefs */
-/* Data structure to hold table of links for a group */
-typedef struct {
- size_t nlinks; /* # of links in table */
- H5O_link_t *lnks; /* Pointer to array of links */
-} H5G_link_table_t;
-
/* User data for link message iteration when building link table */
typedef struct {
H5G_link_table_t *ltable; /* Pointer to link table to build */
@@ -93,37 +86,9 @@ typedef struct {
/* Private macros */
/* PRIVATE PROTOTYPES */
-static int H5G_link_cmp_name(const void *lnk1, const void *lnk2);
static herr_t H5G_link_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
static herr_t H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id,
- H5G_link_table_t *ltable);
-static herr_t H5G_link_release_table(H5G_link_table_t *ltable);
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G_link_cmp_name
- *
- * Purpose: Callback routine for comparing two link messages.
- *
- * Return: An integer less than, equal to, or greater than zero if the
- * first argument is considered to be respectively less than,
- * equal to, or greater than the second. If two members compare
- * as equal, their order in the sorted array is undefined.
- * (i.e. same as strcmp())
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Sep 5 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5G_link_cmp_name(const void *lnk1, const void *lnk2)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_link_cmp_name)
-
- FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name))
-} /* end H5G_link_cmp_name() */
+ const H5O_linfo_t *linfo, H5_iter_order_t order, H5G_link_table_t *ltable);
/*-------------------------------------------------------------------------
@@ -181,23 +146,21 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, H5G_link_table_t *ltable)
+H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, H5G_link_table_t *ltable)
{
- H5O_linfo_t linfo; /* Link info message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_link_build_table)
/* Sanity check */
HDassert(oloc);
-
- /* Retrieve the link info */
- if(NULL == H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
+ HDassert(linfo);
+ HDassert(ltable);
/* Set size of table */
- H5_CHECK_OVERFLOW(linfo.nlinks, hsize_t, size_t);
- ltable->nlinks = (size_t)linfo.nlinks;
+ H5_CHECK_OVERFLOW(linfo->nlinks, hsize_t, size_t);
+ ltable->nlinks = (size_t)linfo->nlinks;
/* Allocate space for the table entries */
if(ltable->nlinks > 0) {
@@ -214,8 +177,14 @@ H5G_link_build_table(H5O_loc_t *oloc, hid_t dxpl_id, H5G_link_table_t *ltable)
if(H5O_iterate(oloc, H5O_LINK_ID, H5G_link_build_table_cb, &udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
- /* Sort link table (XXX: alphabetically, for now) */
- HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_name);
+ /* Sort link table in correct iteration order */
+ /* (XXX: by name, currently) */
+ if(order == H5_ITER_INC)
+ HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_inc);
+ else if(order == H5_ITER_INC)
+ HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_obj_cmp_name_dec);
+ else
+ HDassert(order == H5_ITER_NATIVE);
} /* end if */
else
ltable->lnks = NULL;
@@ -226,133 +195,186 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_link_release_table
+ * Function: H5G_link_convert
*
- * Purpose: Release table containing a list of links for a group
+ * Purpose: Convert a symbol table entry to a link
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * Sep 6, 2005
+ * koziol@hdfgroup.org
+ * Sep 16 2006
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5G_link_release_table(H5G_link_table_t *ltable)
+herr_t
+H5G_link_convert(H5F_t *f, hid_t dxpl_id, H5O_link_t *lnk, haddr_t lheap_addr,
+ const H5G_entry_t *ent, const char *name)
{
- size_t u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5G_link_release_table)
+ FUNC_ENTER_NOAPI(H5G_link_convert, FAIL)
- /* Sanity check */
- HDassert(ltable);
+ /* check arguments */
+ HDassert(f);
+ HDassert(lnk);
+ HDassert(ent);
- /* Release link info, if any */
- if(ltable->nlinks > 0) {
- /* Free link message information */
- for(u = 0; u < ltable->nlinks; u++)
- if(H5O_reset(H5O_LINK_ID, &(ltable->lnks[u])) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link message")
+ /* Set (default) common info for link */
+ lnk->cset = H5F_CRT_DEFAULT_CSET;
+ lnk->corder = 0;
+ lnk->corder_valid = FALSE; /* Creation order not valid for this link */
+ lnk->name = H5MM_xstrdup(name);
- /* Free table of links */
- H5MM_xfree(ltable->lnks);
- } /* end if */
- else
- HDassert(ltable->lnks == NULL);
+ /* Object is a symbolic or hard link */
+ switch(ent->type) {
+ case H5G_CACHED_SLINK:
+ {
+ const char *s; /* Pointer to link value */
+ const H5HL_t *heap; /* Pointer to local heap for group */
+
+ /* Lock the local heap */
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, lheap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
+
+ s = H5HL_offset_into(f, heap, ent->cache.slink.lval_offset);
+
+ /* Copy the link value */
+ lnk->u.soft.name = H5MM_xstrdup(s);
+
+ /* Release the local heap */
+ if(H5HL_unprotect(f, dxpl_id, heap, lheap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
+
+ /* Set link type */
+ lnk->type = H5L_TYPE_SOFT;
+ }
+ break;
+
+ default:
+ /* Set address of object */
+ lnk->u.hard.addr = ent->header;
+
+ /* Set link type */
+ lnk->type = H5L_TYPE_HARD;
+ break;
+ } /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_release_table() */
+} /* end H5G_link_convert() */
/*-------------------------------------------------------------------------
- * Function: H5G_link_convert
+ * Function: H5G_link_copy_file
*
- * Purpose: Converts a group entry into a link object.
+ * Purpose: Copy a link and the object it points to from one file to
+ * another.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Sep 5 2005
+ * koziol@hdfgroup.org
+ * Sep 29 2006
*
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_convert(H5O_link_t *lnk, const H5G_entry_t *ent, const H5HL_t *heap,
- const char *name)
+H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk,
+ const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info)
{
+ H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */
+ const H5O_link_t *src_lnk = _src_lnk; /* Source link */
+ hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_link_convert, FAIL)
+ FUNC_ENTER_NOAPI(H5G_link_copy_file, FAIL)
- /* Check arguments. */
- HDassert(lnk);
- HDassert(ent);
- HDassert(name);
+ /* check arguments */
+ HDassert(dst_file);
+ HDassert(src_lnk);
+ HDassert(dst_lnk);
+ HDassert(cpy_info);
+
+ /* Expand soft link */
+ if(H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) {
+ H5G_stat_t statbuf; /* Information about object pointed to by soft link */
+ H5G_loc_t grp_loc; /* Group location holding soft link */
+ H5G_name_t grp_path; /* Path for group holding soft link */
+
+ /* Make a temporary copy, so that it will not change the info in the cache */
+ if(NULL == H5O_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy message")
+
+ /* Set up group location for soft link to start in */
+ H5G_name_reset(&grp_path);
+ grp_loc.path = &grp_path;
+ grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
+
+ /* Check if the object pointed by the soft link exists in the source file */
+ /* (It would be more efficient to make a specialized traversal callback,
+ * but this is good enough for now... -QAK)
+ */
+ if(H5G_get_objinfo(&grp_loc, tmp_src_lnk.u.soft.name, TRUE, &statbuf, dxpl_id) >= 0) {
+ /* Convert soft link to hard link */
+ tmp_src_lnk.u.soft.name = H5MM_xfree(tmp_src_lnk.u.soft.name);
+ tmp_src_lnk.type = H5L_TYPE_HARD;
+#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
+ tmp_src_lnk.u.hard.addr = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
+#else
+ tmp_src_lnk.u.hard.addr = statbuf.objno[0];
+#endif
+ src_lnk = &tmp_src_lnk;
+ } /* end if */
+ else {
+ /* Discard any errors from a dangling soft link */
+ H5E_clear_stack(NULL);
- /* Create link message from object entry */
- HDassert(ent->type == H5G_NOTHING_CACHED || ent->type == H5G_CACHED_SLINK
- || ent->type == H5G_CACHED_ULINK);
-/* XXX: Set character set & creation time for real? */
- lnk->cset = H5F_CRT_DEFAULT_CSET;
- lnk->ctime = 0;
- lnk->name = H5MM_xstrdup(name); /* Casting away const OK -QAK */
- HDassert(lnk->name);
- switch(ent->type) {
- case H5G_NOTHING_CACHED:
- lnk->type = H5L_LINK_HARD;
- lnk->u.hard.addr = ent->header;
- break;
+ /* Release any information copied for temporary src link */
+ H5O_reset(H5O_LINK_ID, &tmp_src_lnk);
+ } /* end else */
+ } /* end if */
- case H5G_CACHED_SLINK:
- {
- const char *s; /* Pointer to link value in heap */
+ /* Copy src link information to dst link information */
+ if(NULL == H5O_copy(H5O_LINK_ID, src_lnk, dst_lnk))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy message")
+ dst_lnk_init = TRUE;
- lnk->type = H5L_LINK_SOFT;
+ /* Check if object in source group is a hard link & copy it */
+ if(H5L_TYPE_HARD == src_lnk->type) {
+ H5O_loc_t new_dst_oloc; /* Copied object location in destination */
+ H5O_loc_t tmp_src_oloc; /* Temporary object location for source object */
- s = H5HL_offset_into(ent->file, heap, ent->cache.slink.lval_offset);
- HDassert(s);
+ /* Set up copied object location to fill in */
+ H5O_loc_reset(&new_dst_oloc);
+ new_dst_oloc.file = dst_file;
- /* Copy to link */
- lnk->u.soft.name = H5MM_xstrdup(s);
- HDassert(lnk->u.soft.name);
- }
- break;
+ /* Build temporary object location for source */
+ H5O_loc_reset(&tmp_src_oloc);
+ tmp_src_oloc.file = src_oloc->file;
+ HDassert(H5F_addr_defined(src_lnk->u.hard.addr));
+ tmp_src_oloc.addr = src_lnk->u.hard.addr;
- case H5G_CACHED_ULINK:
- {
- const char *s; /* Pointer to link name in heap */
-
- /* Copy link type and udata size from entry info */
- lnk->type = ent->cache.ulink.link_type;
- lnk->u.ud.size = ent->cache.ulink.udata_size;
-
- /* Get pointer to udata in heap */
- s = H5HL_offset_into(ent->file, heap, ent->cache.ulink.udata_offset);
- HDassert(s);
-
- /* Read udata from heap if it exists */
- if(lnk->u.ud.size > 0)
- {
- if(NULL== (lnk->u.ud.udata = H5MM_malloc(lnk->u.ud.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for user link data")
- HDmemcpy(lnk->u.ud.udata, s, lnk->u.ud.size);
- }
- else
- lnk->u.ud.udata = NULL;
- }
- break;
+ /* Copy the shared object from source to destination */
+ if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy object")
- default:
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
- } /* end switch */
+ /* Copy new destination object's information for eventual insertion */
+ dst_lnk->u.hard.addr = new_dst_oloc.addr;
+ } /* end if */
done:
+ /* Check if we used a temporary src link */
+ if(src_lnk != _src_lnk) {
+ HDassert(src_lnk == &tmp_src_lnk);
+ H5O_reset(H5O_LINK_ID, &tmp_src_lnk);
+ } /* end if */
+ if(ret_value < 0)
+ if(dst_lnk_init)
+ H5O_reset(H5O_LINK_ID, dst_lnk);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_link_convert() */
+} /* end H5G_link_copy_file() */
/*-------------------------------------------------------------------------
@@ -396,7 +418,7 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative, length of name
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -405,8 +427,8 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
- size_t size, hid_t dxpl_id)
+H5G_link_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
ssize_t ret_value; /* Return value */
@@ -417,7 +439,7 @@ H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
HDassert(oloc);
/* Build table of all link messages */
- if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
+ if(H5G_link_build_table(oloc, dxpl_id, linfo, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
@@ -438,7 +460,7 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
- if(H5G_link_release_table(&ltable) < 0)
+ if(H5G_obj_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
} /* end if */
@@ -460,7 +482,8 @@ done:
*-------------------------------------------------------------------------
*/
H5G_obj_t
-H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
+H5G_link_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ hsize_t idx)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
H5G_obj_t ret_value; /* Return value */
@@ -471,7 +494,7 @@ H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HDassert(oloc);
/* Build table of all link messages */
- if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
+ if(H5G_link_build_table(oloc, dxpl_id, linfo, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table")
/* Check for going out of bounds */
@@ -479,11 +502,11 @@ H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound")
/* Determine type of object */
- if(ltable.lnks[idx].type == H5L_LINK_SOFT)
+ if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
ret_value = H5G_LINK;
- else if(ltable.lnks[idx].type >= H5L_LINK_UD_MIN)
+ else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
ret_value = H5G_UDLINK;
- else if(ltable.lnks[idx].type == H5L_LINK_HARD){
+ else if(ltable.lnks[idx].type == H5L_TYPE_HARD){
H5O_loc_t tmp_oloc; /* Temporary object location */
/* Build temporary object location */
@@ -501,7 +524,7 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
- if(H5G_link_release_table(&ltable) < 0)
+ if(H5G_obj_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
} /* end if */
@@ -540,7 +563,7 @@ H5G_link_remove_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
if(HDstrcmp(lnk->name, udata->name) == 0) {
switch(lnk->type)
{
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
{
H5O_loc_t tmp_oloc; /* Temporary object location */
@@ -554,13 +577,13 @@ H5G_link_remove_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
}
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
*(udata->obj_type) = H5G_LINK;
break;
default: /* User-defined link */
- if(lnk->type < H5L_LINK_UD_MIN)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type");
+ if(lnk->type < H5L_TYPE_UD_MIN)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type")
*(udata->obj_type) = H5G_UDLINK;
}
@@ -615,7 +638,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_link_iterate
*
- * Purpose: Iterate over the objects in a group
+ * Purpose: Iterate over the links in a group
*
* Return: Non-negative on success/Negative on failure
*
@@ -625,8 +648,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
- H5G_iterate_t op, void *op_data, hid_t dxpl_id)
+H5G_link_iterate(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, hid_t gid, hbool_t lib_internal, int skip,
+ int *last_obj, H5G_link_iterate_t op, void *op_data)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
size_t u; /* Local index variable */
@@ -636,24 +660,24 @@ H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
/* Sanity check */
HDassert(oloc);
- HDassert(H5I_GROUP == H5I_get_type(gid));
- HDassert(last_obj);
- HDassert(op);
+ HDassert(lib_internal || H5I_GROUP == H5I_get_type(gid));
+ HDassert(op.lib_op);
/* Build table of all link messages */
- if(H5G_link_build_table(oloc, dxpl_id, &ltable) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "can't create link message table")
-
- /* Check for going out of bounds */
- if(skip > 0 && (size_t)skip >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5B_ITER_ERROR, "index out of bound")
+ if(H5G_link_build_table(oloc, dxpl_id, linfo, order, &ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Iterate over link messages */
for(u = 0, ret_value = H5B_ITER_CONT; u < ltable.nlinks && !ret_value; u++) {
if(skip > 0)
--skip;
- else
- ret_value = (op)(gid, ltable.lnks[u].name, op_data);
+ else {
+ /* Check for internal callback with link info */
+ if(lib_internal)
+ ret_value = (op.lib_op)(&(ltable.lnks[u]), op_data);
+ else
+ ret_value = (op.app_op)(gid, ltable.lnks[u].name, op_data);
+ } /* end else */
/* Increment the number of entries passed through */
/* (whether we skipped them or not) */
@@ -668,8 +692,8 @@ done:
/* Release link table */
if(ltable.lnks) {
/* Free link table information */
- if(H5G_link_release_table(&ltable) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5B_ITER_ERROR, "unable to release link table")
+ if(H5G_obj_release_table(&ltable) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -765,5 +789,4 @@ H5G_link_lookup(H5O_loc_t *oloc, const char *name, H5O_link_t *lnk,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_lookup() */
-#endif /* H5_GROUP_REVISION */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 791c278..4e72774 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -364,7 +364,7 @@ done:
*/
herr_t
H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
- hbool_t inc_link, hid_t dxpl_id)
+ hid_t dxpl_id)
{
H5O_link_t lnk; /* Link for object to insert */
herr_t ret_value = SUCCEED; /* Return value */
@@ -376,25 +376,17 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
HDassert(name && *name);
HDassert(obj_loc);
- /* "Translate" object location into link object */
- lnk.type = H5L_LINK_HARD;
-#ifdef H5_HAVE_GETTIMEOFDAY
- {
- struct timeval now_tv;
-
- HDgettimeofday(&now_tv, NULL);
- lnk.ctime = now_tv.tv_sec;
- }
-#else /* H5_HAVE_GETTIMEOFDAY */
- lnk.ctime = HDtime(NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ /* Create link object for the object location */
+ lnk.type = H5L_TYPE_HARD;
lnk.cset = H5F_CRT_DEFAULT_CSET;
+ lnk.corder = 0; /* Will be reset if the group is tracking creation order */
+ lnk.corder_valid = FALSE; /* Indicate that the creation order isn't valid (yet) */
/* Casting away const OK -QAK */
lnk.name = (char *)name;
lnk.u.hard.addr = obj_loc->oloc->addr;
/* Insert new group into current group's symbol table */
- if(H5G_obj_insert(grp_loc->oloc, name, &lnk, inc_link, dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert object")
/* Set the name of the object location */
@@ -404,6 +396,7 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_loc_insert() */
+
/*-------------------------------------------------------------------------
* Function: H5G_loc_exists
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index c640a65..cbbfeae 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -382,18 +382,18 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
if ((buf=H5FL_BLK_MALLOC(symbol_node,size))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for symbol table node");
p=buf;
- if (NULL==(sym = H5FL_CALLOC(H5G_node_t)) ||
- NULL==(sym->entry=H5FL_SEQ_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f)))))
+ if(NULL == (sym = H5FL_CALLOC(H5G_node_t)) ||
+ NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read symbol table node");
/* magic */
- if (HDmemcmp(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node signature");
p += 4;
/* version */
- if (H5G_NODE_VERS != *p++)
+ if(H5G_NODE_VERS != *p++)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node version");
/* reserved */
p++;
@@ -402,16 +402,16 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
UINT16DECODE(p, sym->nsyms);
/* entries */
- if (H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0)
+ if(H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries");
/* Set return value */
ret_value = sym;
done:
- if (buf)
+ if(buf)
H5FL_BLK_FREE(symbol_node,buf);
- if (!ret_value) {
+ if(!ret_value) {
if (sym)
if(H5G_node_dest(f, sym)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node");
@@ -543,7 +543,7 @@ H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf)
p = buf;
/* magic number */
- HDmemcpy(p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC);
+ HDmemcpy(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC);
p += 4;
/* version number */
@@ -717,16 +717,16 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
assert(f);
assert(H5B_INS_FIRST == op);
- if (NULL==(sym = H5FL_CALLOC(H5G_node_t)))
+ if(NULL == (sym = H5FL_CALLOC(H5G_node_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
size = H5G_node_size(f);
- if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
+ if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space");
- sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f)));
- if (NULL==sym->entry)
+ sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)));
+ if(NULL==sym->entry)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- if (H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node");
/*
* The left and right symbols in an empty tree are both the
@@ -734,17 +734,17 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
* allows the comparison functions to work correctly without knowing
* that there are no symbols.
*/
- if (lt_key)
+ if(lt_key)
lt_key->offset = 0;
- if (rt_key)
+ if(rt_key)
rt_key->offset = 0;
done:
- if(ret_value<0) {
- if(sym!=NULL) {
- if(sym->entry!=NULL)
- H5FL_SEQ_FREE(H5G_entry_t,sym->entry);
- H5FL_FREE(H5G_node_t,sym);
+ if(ret_value < 0) {
+ if(sym != NULL) {
+ if(sym->entry != NULL)
+ H5FL_SEQ_FREE(H5G_entry_t, sym->entry);
+ H5FL_FREE(H5G_node_t, sym);
} /* end if */
} /* end if */
@@ -793,23 +793,23 @@ H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke
assert(rt_key);
/* Get base address of heap */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name");
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name")
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/* Get pointers to string names */
- s1=base+lt_key->offset;
- s2=base+rt_key->offset;
+ s1 = base + lt_key->offset;
+ s2 = base + rt_key->offset;
/* Set return value */
ret_value = HDstrcmp(s1, s2);
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
+ if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name")
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -854,10 +854,10 @@ H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke
FUNC_ENTER_NOAPI_NOINIT(H5G_node_cmp3);
/* Get base address of heap */
- if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name");
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/* left side */
s=base+lt_key->offset;
@@ -935,7 +935,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to protect symbol name")
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/*
* Binary search.
@@ -1048,7 +1048,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/*
* Where does the new symbol get inserted? We use a binary search.
@@ -1228,7 +1228,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
- base = H5HL_offset_into(f, heap, 0);
+ base = H5HL_offset_into(f, heap, (size_t)0);
/* Find the name with a binary search */
rt = sn->nsyms;
@@ -1251,84 +1251,51 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
switch(sn->entry[idx].type)
{
- case H5G_CACHED_SLINK:
- {
- /* Set the type of the link removed */
- *(udata->obj_type) = H5G_LINK;
-
- /* Remove the symbolic link value */
- if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
-
- s = H5HL_offset_into(f, heap, sn->entry[idx].cache.slink.lval_offset);
- if(s) {
- len = HDstrlen(s) + 1;
- found = 1;
- } /* end if */
- else
- found = 0;
-
- if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
- heap = NULL; s = NULL;
-
- if(found)
- H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.slink.lval_offset, len);
-
- H5E_clear_stack(NULL); /* no big deal */
- }
- break;
+ case H5G_CACHED_SLINK:
+ /* Set the type of the link removed */
+ *(udata->obj_type) = H5G_LINK;
+
+ /* Remove the symbolic link value */
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
+
+ s = H5HL_offset_into(f, heap, sn->entry[idx].cache.slink.lval_offset);
+ if(s) {
+ len = HDstrlen(s) + 1;
+ found = 1;
+ } /* end if */
+ else
+ found = 0;
- case H5G_CACHED_ULINK:
- {
- size_t ud_data_size = 0; /* User link data size */
- hbool_t ud_data_found; /* Indicate that the link user data was found */
+ if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
+ heap = NULL; s = NULL;
- /* Set the type of the link removed */
- *(udata->obj_type) = H5G_UDLINK;
+ if(found)
+ H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.slink.lval_offset, len);
- /* Remove the link user data from the heap */
- if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->common.heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "unable to protect symbol name")
+ H5E_clear_stack(NULL); /* no big deal */
+ break;
- s = H5HL_offset_into(f, heap, sn->entry[idx].cache.ulink.udata_offset);
- if(s)
+ default:
{
- ud_data_found = 1;
- ud_data_size = sn->entry[idx].cache.ulink.udata_size;
- }
- else
- ud_data_found = 0;
- if(H5HL_unprotect(f, dxpl_id, heap, udata->common.heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name")
- heap = NULL; s = NULL;
+ H5O_loc_t tmp_oloc; /* Temporary object location */
- if(ud_data_found)
- H5HL_remove(f, dxpl_id, udata->common.heap_addr, sn->entry[idx].cache.ulink.udata_offset, ud_data_size);
+ /* Build temporary object location */
+ tmp_oloc.file = f;
+ HDassert(H5F_addr_defined(sn->entry[idx].header));
+ tmp_oloc.addr = sn->entry[idx].header;
- H5E_clear_stack(NULL); /* no big deal */
- }
- break;
+ /* Get the type of the object */
+ if((*(udata->obj_type) = H5O_obj_type(&tmp_oloc, dxpl_id)) == H5G_UNKNOWN)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to determine object type")
- default:
- {
- H5O_loc_t tmp_oloc; /* Temporary object location */
-
- /* Build temporary object location */
- tmp_oloc.file = f;
- HDassert(H5F_addr_defined(sn->entry[idx].header));
- tmp_oloc.addr = sn->entry[idx].header;
-
- /* Get the type of the object */
- if((*(udata->obj_type) = H5O_obj_type(&tmp_oloc, dxpl_id)) == H5G_UNKNOWN)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to determine object type")
-
- /* Decrement the reference count, if requested */
- if(udata->adj_link) {
- if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count")
- } /* end if */
- }
+ /* Decrement the reference count, if requested */
+ if(udata->adj_link)
+ if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count")
+ break;
+ }
} /* end switch */
/* Remove the name from the local heap */
@@ -1418,8 +1385,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Reduce the link count for all entries in this node */
for(idx = 0; idx < sn->nsyms; idx++) {
- if(!(H5G_CACHED_SLINK == sn->entry[idx].type ||
- H5G_CACHED_ULINK == sn->entry[idx].type)) {
+ if(!(H5G_CACHED_SLINK == sn->entry[idx].type)) {
/* Decrement the reference count, if requested */
if(udata->adj_link) {
HDassert(H5F_addr_defined(sn->entry[idx].header));
@@ -1471,14 +1437,15 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
- const void UNUSED *_rt_key, void *_udata)
+H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
+ const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_it_ud1_t *udata = (H5G_bt_it_ud1_t *)_udata;
H5G_node_t *sn = NULL;
const H5HL_t *heap = NULL;
unsigned nsyms; /* # of symbols in node */
- size_t n, *name_off=NULL;
+ H5G_entry_t *ents = NULL; /* Copy of entries in this node */
+ size_t n;
const char *name;
char buf[1024], *s;
unsigned u; /* Local index variable */
@@ -1497,18 +1464,17 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
* Save information about the symbol table node since we can't lock it
* because we're about to call an application function.
*/
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node");
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node")
nsyms = sn->nsyms;
- if (NULL==(name_off = H5FL_SEQ_MALLOC(size_t, (size_t)nsyms)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
- for(u = 0; u < nsyms; u++)
- name_off[u] = sn->entry[u].name_off;
+ if(NULL == (ents = H5FL_SEQ_MALLOC(H5G_entry_t, (size_t)nsyms)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed")
+ HDmemcpy(ents, sn->entry, sizeof(H5G_entry_t) * nsyms);
- if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) {
+ if(H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) {
sn = NULL;
- HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
- }
+ HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
+ } /* end if */
sn=NULL; /* Make certain future references will be caught */
@@ -1516,49 +1482,72 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
* Iterate over the symbol table node entries.
*/
for(u = 0, ret_value = H5B_ITER_CONT; u < nsyms && !ret_value; u++) {
- if (udata->skip>0) {
+ if(udata->skip > 0)
--udata->skip;
- } else {
- if (NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name");
+ else {
+ if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name")
+
+ name = H5HL_offset_into(f, heap, ents[u].name_off);
+ HDassert(name);
+ n = HDstrlen(name);
+
+ /* Allocate space or point to existing buffer */
+ if((n + 1) > sizeof(buf)) {
+ if(NULL == (s = H5MM_malloc(n + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed")
+ } /* end if */
+ else
+ s = buf;
- name = H5HL_offset_into(f, heap, name_off[u]);
- assert (name);
- n = HDstrlen (name);
+ /* Make a copy of the name */
+ HDstrcpy(s, name);
- if (n+1>sizeof(buf)) {
- if (NULL==(s = H5MM_malloc (n+1)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed");
- } else {
- s = buf;
- }
- HDstrcpy (s, name);
+ if(H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
+ heap = NULL; name = NULL;
- if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
- heap=NULL; name=NULL;
+ /* Check for internal callback with link info */
+ if(udata->lib_internal) {
+ H5O_link_t lnk; /* Link for entry */
- ret_value = (udata->op)(udata->group_id, s, udata->op_data);
- if (s!=buf)
- H5MM_xfree (s);
- }
+ /* Convert the entry to a link */
+ if(H5G_link_convert(f, dxpl_id, &lnk, udata->heap_addr, &ents[u], s) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5B_ITER_ERROR, "unable to convert symbol table entry to link")
+
+ /* Call the library's callback */
+ ret_value = (udata->op.lib_op)(&lnk, udata->op_data);
+
+ /* Release memory for link object */
+ if(H5O_reset(H5O_LINK_ID, &lnk) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, H5B_ITER_ERROR, "unable to release link message")
+ } /* end if */
+ else
+ /* Make the application's callback */
+ ret_value = (udata->op.app_op)(udata->group_id, s, udata->op_data);
+
+ /* Free the memory for the name, if we used a dynamically allocated buffer */
+ if(s != buf)
+ H5MM_xfree(s);
+ } /* end else */
/* Increment the number of entries passed through */
/* (whether we skipped them or not) */
- (*udata->final_ent)++;
- }
- if (ret_value<0)
- HERROR (H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+ if(udata->final_ent)
+ (*udata->final_ent)++;
+ } /* end for */
+ if(ret_value < 0)
+ HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
+ if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
+ if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
+ HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
- if(name_off)
- H5FL_SEQ_FREE(size_t,name_off);
+ if(ents)
+ H5FL_SEQ_FREE(H5G_entry_t, ents);
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -1717,23 +1706,19 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
loc_idx = udata->idx - udata->num_objs;
/* Check for a soft link */
- switch(sn->entry[loc_idx].type)
- {
- case H5G_CACHED_SLINK:
- udata->type = H5G_LINK;
- break;
- case H5G_CACHED_ULINK:
- udata->type = H5G_UDLINK;
- break;
-
- default:
- /* Build temporary object location */
- tmp_oloc.file = f;
- HDassert(H5F_addr_defined(sn->entry[loc_idx].header));
- tmp_oloc.addr = sn->entry[loc_idx].header;
-
- udata->type = H5O_obj_type(&tmp_oloc, dxpl_id);
- break;
+ switch(sn->entry[loc_idx].type) {
+ case H5G_CACHED_SLINK:
+ udata->type = H5G_LINK;
+ break;
+
+ default:
+ /* Build temporary object location */
+ tmp_oloc.file = f;
+ HDassert(H5F_addr_defined(sn->entry[loc_idx].header));
+ tmp_oloc.addr = sn->entry[loc_idx].header;
+
+ udata->type = H5O_obj_type(&tmp_oloc, dxpl_id);
+ break;
}
ret_value = H5B_ITER_STOP;
} else {
@@ -1747,78 +1732,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5G_node_type() */
-#ifdef H5_GROUP_REVISION
-
-/*-------------------------------------------------------------------------
- * Function: H5G_node_stab_convert
- *
- * Purpose: This function gets called when the entries in a group are
- * converted from a symbol table to link messages.
- *
- * Return: 0 if object isn't found in this node; 1 if found;
- * Negative on failure
- *
- * Programmer: Quincey Koziol
- * Sep 5, 2005
- *
- *-------------------------------------------------------------------------
- */
-int
-H5G_node_stab_convert(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
- const void UNUSED *_rt_key, void *_udata)
-{
- H5G_bt_it_ud4_t *udata = (H5G_bt_it_ud4_t*)_udata;
- H5G_node_t *sn = NULL; /* Pointer to symbol table node to operate on */
- const H5HL_t *heap = NULL; /* Pointer to local heap for group */
- const char *name; /* Pointer to name of link */
- const H5G_entry_t *ent; /* Pointer to current entry */
- unsigned u; /* Local index variable */
- int ret_value = H5B_ITER_CONT;
-
- FUNC_ENTER_NOAPI(H5G_node_stab_convert, H5B_ITER_ERROR)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(udata);
-
- /* Lock the symbol table node */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node")
-
- /* Lock the local heap */
- if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name")
-
- /* Convert all the entries from this node into link messages */
- for(u = 0, ent = sn->entry; u < sn->nsyms; u++, ent++) {
- /* Get a pointer to the link's name in the local heap */
- name = H5HL_offset_into(f, heap, ent->name_off);
- HDassert(name);
-
- /* Check for too many links for link table */
- if(udata->nlinks >= udata->max_links)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "too many links for table")
-
- /* Convert entry into link message object */
- if(H5G_link_convert(&(udata->lnk_table[udata->nlinks]), ent, heap, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "can't convert entry to link message")
-
- /* Increment number of links stored */
- udata->nlinks++;
- } /* end for */
-
-done:
- if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
-
- if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
- HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_node_stab_convert() */
-#endif /* H5_GROUP_REVISION */
-
/*-------------------------------------------------------------------------
* Function: H5G_node_init
@@ -1961,7 +1874,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_it_ud5_t *udata = (H5G_bt_it_ud5_t *)_udata;
- H5O_loc_t *parent_src_oloc = udata->src_oloc;
+ const H5O_loc_t *src_oloc = udata->src_oloc;
H5O_copy_t *cpy_info = udata->cpy_info;
const H5HL_t *heap = NULL;
H5G_node_t *sn = NULL;
@@ -1993,87 +1906,73 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* expand soft link */
if(H5G_CACHED_SLINK == src_ent->type && cpy_info->expand_soft_link) {
H5G_stat_t statbuf; /* Information about object pointed to by soft link */
- H5G_loc_t grp_loc; /* Group location for parent of soft link */
- H5G_name_t grp_path; /* Path for parent of soft link */
+ H5G_loc_t grp_loc; /* Group location holding soft link */
+ H5G_name_t grp_path; /* Path for group holding soft link */
char *link_name; /* Pointer to value of soft link */
/* Make a temporary copy, so that it will not change the info in the cache */
HDmemcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t));
- src_ent = &tmp_src_ent;
/* Set up group location for soft link to start in */
H5G_name_reset(&grp_path);
grp_loc.path = &grp_path;
- grp_loc.oloc = parent_src_oloc;
+ grp_loc.oloc = (H5O_loc_t *)src_oloc;
/* Get pointer to link value in local heap */
- link_name = (char *)H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset);
+ link_name = (char *)H5HL_offset_into(f, heap, tmp_src_ent.cache.slink.lval_offset);
/* Check if the object pointed by the soft link exists in the source file */
/* (It would be more efficient to make a specialized traversal callback,
* but this is good enough for now... -QAK)
*/
- if(H5G_get_objinfo(&grp_loc, link_name, TRUE, &statbuf, H5AC_ind_dxpl_id) >= 0) {
+ if(H5G_get_objinfo(&grp_loc, link_name, TRUE, &statbuf, dxpl_id) >= 0) {
#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- src_ent->header = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
+ tmp_src_ent.header = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
#else
- src_ent->header = statbuf.objno[0];
+ tmp_src_ent.header = statbuf.objno[0];
#endif
+ src_ent = &tmp_src_ent;
} /* end if */
+ else
+ H5E_clear_stack(NULL); /* discard any errors from a dangling soft link */
} /* if ((H5G_CACHED_SLINK == src_ent->type)... */
/* Check if object in source group is a hard link */
if(H5F_addr_defined(src_ent->header)) {
- H5O_loc_t new_oloc; /* Copied object object location */
- H5O_loc_t src_oloc; /* Temporary object location for source object */
+ H5O_loc_t new_dst_oloc; /* Copied object location in destination */
+ H5O_loc_t tmp_src_oloc; /* Temporary object location for source object */
/* Set up copied object location to fill in */
- H5O_loc_reset(&new_oloc);
- new_oloc.file = udata->dst_file;
+ H5O_loc_reset(&new_dst_oloc);
+ new_dst_oloc.file = udata->dst_file;
/* Build temporary object location for source */
- src_oloc.file = f;
- HDassert(H5F_addr_defined(src_ent->header));
- src_oloc.addr = src_ent->header;
+ H5O_loc_reset(&tmp_src_oloc);
+ tmp_src_oloc.file = f;
+ tmp_src_oloc.addr = src_ent->header;
/* Copy the shared object from source to destination */
- if(H5O_copy_header_map(&src_oloc, &new_oloc, dxpl_id, cpy_info, TRUE) < 0)
+ if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B_ITER_ERROR, "unable to copy object")
/* Construct link information for eventual insertion */
- lnk.type = H5L_LINK_HARD;
- lnk.u.hard.addr = new_oloc.addr;
+ lnk.type = H5L_TYPE_HARD;
+ lnk.u.hard.addr = new_dst_oloc.addr;
} /* ( H5F_addr_defined(src_ent->header)) */
else if(H5G_CACHED_SLINK == src_ent->type) {
/* it is a soft link */
/* Construct link information for eventual insertion */
- lnk.type = H5L_LINK_SOFT;
+ lnk.type = H5L_TYPE_SOFT;
lnk.u.soft.name = H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset);
} /* else if */
- else if(H5G_CACHED_ULINK == src_ent->type) {
- /* user-defined link */
-
- /* Construct link information for eventual insertion */
- lnk.type = src_ent->cache.ulink.link_type;
- lnk.u.ud.size = src_ent->cache.ulink.udata_size;
- lnk.u.ud.udata = H5HL_offset_into(f, heap, src_ent->cache.ulink.udata_offset);
- } /* else if */
else
HDassert(0 && "Unknown entry type");
/* Set up common link data */
-#ifdef H5_HAVE_GETTIMEOFDAY
- {
- struct timeval now_tv;
-
- HDgettimeofday(&now_tv, NULL);
- lnk.ctime = now_tv.tv_sec;
- }
-#else /* H5_HAVE_GETTIMEOFDAY */
- lnk.ctime = HDtime(NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
lnk.cset = H5F_CRT_DEFAULT_CSET; /* XXX: Allow user to set this */
+ lnk.corder = 0; /* Creation order is not tracked for old-style links */
+ lnk.corder_valid = FALSE; /* Creation order is not valid */
/* lnk.name = name; */ /* This will be set in callback */
/* Determine name of source object */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 4cf99ef..960061f 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -22,11 +22,18 @@
*
*-------------------------------------------------------------------------
*/
+
+/****************/
+/* Module Setup */
+/****************/
+
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
-#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-/* Packages needed by this file... */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
@@ -37,29 +44,164 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property Lists */
-/* Private typedefs */
-/* User data for converting link messages to symbol table */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* User data for object header iterator when converting link messages to dense
+ * link storage
+ */
typedef struct {
H5F_t *f; /* Pointer to file for insertion */
- haddr_t btree_addr; /* Address of symbol table B-tree */
- haddr_t heap_addr; /* Address of symbol table local heap */
hid_t dxpl_id; /* DXPL during insertion */
-} H5G_obj_ud1_t;
+ H5O_linfo_t *linfo; /* Pointer to link info */
+} H5G_obj_oh_it_ud1_t;
-/* User data for looking up an object in a group */
+/* User data for link iterator when converting dense link storage to link
+ * messages
+ */
typedef struct {
- H5O_link_t *lnk; /* Link information to set for object */
- H5O_loc_t *oloc; /* Object location to set */
-} H5G_obj_ud2_t;
+ H5O_link_t *lnk_table; /* Array of links to convert */
+ size_t nlinks; /* Number of links converted */
+ size_t alloc_links; /* Size of link table */
+} H5G_obj_lnk_it_ud1_t;
-/* Private macros */
+/* User data for symbol table iterator when converting old-format group to
+ * a new-format group
+ */
+typedef struct {
+ H5O_loc_t *grp_oloc; /* Pointer to group for insertion */
+ hid_t dxpl_id; /* DXPL during insertion */
+} H5G_obj_stab_it_ud1_t;
-/* PRIVATE PROTOTYPES */
-#ifdef H5_GROUP_REVISION
-static herr_t
-H5G_obj_link_to_stab_cb(const void *_mesg, unsigned idx, void *_udata);
-#endif /* H5_GROUP_REVISION */
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5G_obj_link_to_dense_cb(const void *_mesg, unsigned idx,
+ void *_udata);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_cmp_name_inc
+ *
+ * Purpose: Callback routine for comparing two link names, in
+ * increasing alphabetic order
+ *
+ * Return: An integer less than, equal to, or greater than zero if the
+ * first argument is considered to be respectively less than,
+ * equal to, or greater than the second. If two members compare
+ * as equal, their order in the sorted array is undefined.
+ * (i.e. same as strcmp())
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Sep 5 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5G_obj_cmp_name_inc(const void *lnk1, const void *lnk2)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_obj_cmp_name_inc)
+
+ FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name))
+} /* end H5G_obj_cmp_name_inc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_cmp_name_dec
+ *
+ * Purpose: Callback routine for comparing two link names, in
+ * decreasing alphabetic order
+ *
+ * Return: An integer less than, equal to, or greater than zero if the
+ * second argument is considered to be respectively less than,
+ * equal to, or greater than the first. If two members compare
+ * as equal, their order in the sorted array is undefined.
+ * (i.e. opposite strcmp())
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Sep 25 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5G_obj_cmp_name_dec(const void *lnk1, const void *lnk2)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_obj_cmp_name_dec)
+
+ FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk2)->name, ((const H5O_link_t *)lnk1)->name))
+} /* end H5G_obj_cmp_name_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_release_table
+ *
+ * Purpose: Release table containing a list of links for a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Sep 6, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_obj_release_table(H5G_link_table_t *ltable)
+{
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_obj_release_table)
+
+ /* Sanity check */
+ HDassert(ltable);
+
+ /* Release link info, if any */
+ if(ltable->nlinks > 0) {
+ /* Free link message information */
+ for(u = 0; u < ltable->nlinks; u++)
+ if(H5O_reset(H5O_LINK_ID, &(ltable->lnks[u])) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link message")
+
+ /* Free table of links */
+ H5MM_xfree(ltable->lnks);
+ } /* end if */
+ else
+ HDassert(ltable->lnks == NULL);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_obj_release_table() */
/*-------------------------------------------------------------------------
@@ -76,21 +218,12 @@ H5G_obj_link_to_stab_cb(const void *_mesg, unsigned idx, void *_udata);
*-------------------------------------------------------------------------
*/
herr_t
-H5G_obj_create(H5F_t *f, hid_t dxpl_id,
-#ifdef H5_GROUP_REVISION
- H5O_ginfo_t *ginfo,
-#endif /* H5_GROUP_REVISION */
+H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
H5O_loc_t *oloc/*out*/)
{
-#ifdef H5_GROUP_REVISION
H5O_linfo_t linfo; /* Link information */
- H5O_link_t lnk; /* Temporary link message info for computing message size */
- char null_char = '\0'; /* Character for creating null string */
- size_t ginfo_size; /* Size of the group info message */
- size_t linfo_size; /* Size of the link info message */
- size_t link_size; /* Size of a link message */
-#endif /* H5_GROUP_REVISION */
size_t hdr_size; /* Size of object header to request */
+ hbool_t use_latest_format; /* Flag indicating the new group format should be used */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_create, FAIL)
@@ -99,34 +232,49 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id,
* Check arguments.
*/
HDassert(f);
-#ifdef H5_GROUP_REVISION
HDassert(ginfo);
-#endif /* H5_GROUP_REVISION */
HDassert(oloc);
-#ifdef H5_GROUP_REVISION
- /* Initialize message information */
- linfo.nlinks = 0;
-
- /* Calculate message size infomation, for creating group's object header */
- linfo_size = H5O_mesg_size(H5O_LINFO_ID, f, &linfo);
- HDassert(linfo_size);
-
- ginfo_size = H5O_mesg_size(H5O_GINFO_ID, f, ginfo);
- HDassert(ginfo_size);
-
- lnk.type = H5L_LINK_HARD;
- lnk.name = &null_char;
- link_size = H5O_mesg_size(H5O_LINK_ID, f, &lnk);
- HDassert(link_size);
-
- /* Compute size of header to use for creation */
- hdr_size = linfo_size +
- ginfo_size +
- (ginfo->est_num_entries * (link_size + ginfo->est_name_len));
-#else /* H5_GROUP_REVISION */
- hdr_size = 4 + 2 * H5F_SIZEOF_ADDR(f);
-#endif /* H5_GROUP_REVISION */
+ /* Check for using the latest version of the group format */
+/* XXX: add more checks for creating "new format" groups when needed */
+ if(f->shared->latest_format || ginfo->track_corder)
+ use_latest_format = TRUE;
+ else
+ use_latest_format = FALSE;
+
+ /* Check if we should be using the latest version of the group format */
+ if(use_latest_format) {
+ H5O_linfo_t def_linfo = H5G_CRT_LINK_INFO_DEF; /* Default link info */
+ H5O_link_t lnk; /* Temporary link message info for computing message size */
+ char null_char = '\0'; /* Character for creating null string */
+ size_t ginfo_size; /* Size of the group info message */
+ size_t linfo_size; /* Size of the link info message */
+ size_t link_size; /* Size of a link message */
+
+ /* Initialize message information */
+ HDmemcpy(&linfo, &def_linfo, sizeof(H5O_linfo_t));
+
+ /* Calculate message size infomation, for creating group's object header */
+ linfo_size = H5O_mesg_size(H5O_LINFO_ID, f, &linfo, (size_t)0);
+ HDassert(linfo_size);
+
+ ginfo_size = H5O_mesg_size(H5O_GINFO_ID, f, ginfo, (size_t)0);
+ HDassert(ginfo_size);
+
+ lnk.type = H5L_TYPE_HARD;
+ lnk.corder = 0;
+ lnk.corder_valid = ginfo->track_corder;
+ lnk.name = &null_char;
+ link_size = H5O_mesg_size(H5O_LINK_ID, f, &lnk, (size_t)ginfo->est_name_len);
+ HDassert(link_size);
+
+ /* Compute size of header to use for creation */
+ hdr_size = linfo_size +
+ ginfo_size +
+ (ginfo->est_num_entries * link_size);
+ } /* end if */
+ else
+ hdr_size = 4 + 2 * H5F_SIZEOF_ADDR(f);
/*
* Create symbol table object header. It has a zero link count
@@ -136,24 +284,23 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id,
if(H5O_create(f, dxpl_id, hdr_size, oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
-#ifdef H5_GROUP_REVISION
- /* Insert link info message */
- if(H5O_modify(oloc, H5O_LINFO_ID, H5O_NEW_MESG, 0, 0, &linfo, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+ /* Check for format of group to create */
+ if(use_latest_format) {
+ /* Insert link info message */
+ if(H5O_modify(oloc, H5O_LINFO_ID, H5O_NEW_MESG, 0, 0, &linfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
- /* Insert group info message */
- if(H5O_modify(oloc, H5O_GINFO_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, ginfo, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
-#else /* H5_GROUP_REVISION */
- {
+ /* Insert group info message */
+ if(H5O_modify(oloc, H5O_GINFO_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, ginfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+ } /* end if */
+ else {
H5O_stab_t stab; /* Symbol table message */
/* The group doesn't currently have a 'stab' message, go create one */
- if(H5G_stab_create(oloc, &stab, dxpl_id) < 0)
+ if(H5G_stab_create(oloc, dxpl_id, ginfo, &stab) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create symbol table")
-
- }
-#endif /* H5_GROUP_REVISION */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -250,13 +397,12 @@ H5G_obj_ent_encode(H5F_t *f, uint8_t **pp, const H5O_loc_t *oloc)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G_obj_ent_encode() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
- * Function: H5G_obj_link_to_stab_cb
+ * Function: H5G_obj_link_to_dense_cb
*
- * Purpose: Callback routine for converting 'link' messages to symbol table
- * form.
+ * Purpose: Callback routine for converting 'link' messages to "dense"
+ * link storage form.
*
* Return: Non-negative on success/Negative on failure
*
@@ -267,32 +413,61 @@ H5G_obj_ent_encode(H5F_t *f, uint8_t **pp, const H5O_loc_t *oloc)
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_obj_link_to_stab_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
+H5G_obj_link_to_dense_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
- H5G_obj_ud1_t *udata = (H5G_obj_ud1_t *)_udata; /* 'User data' passed in */
- H5G_bt_ud1_t bt_udata; /* Data to pass through B-tree */
+ H5G_obj_oh_it_ud1_t *udata = (H5G_obj_oh_it_ud1_t *)_udata; /* 'User data' passed in */
herr_t ret_value = H5O_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5G_obj_link_to_stab_cb)
+ FUNC_ENTER_NOAPI_NOINIT(H5G_obj_link_to_dense_cb)
/* check arguments */
HDassert(lnk);
HDassert(udata);
- /* Construct user data to pass through B-tree routines */
- bt_udata.common.name = lnk->name;
- bt_udata.common.heap_addr = udata->heap_addr;
- bt_udata.lnk = lnk;
+ /* Insert link into dense link storage */
+ if(H5G_dense_insert(udata->f, udata->dxpl_id, udata->linfo, lnk) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_obj_link_to_dense_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_stab_to_new_cb
+ *
+ * Purpose: Callback routine for converting "symbol table" link storage to
+ * "new format" storage (either link messages or "dense" storage).
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sept 16 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata)
+{
+ H5G_obj_stab_it_ud1_t *udata = (H5G_obj_stab_it_ud1_t *)_udata; /* 'User data' passed in */
+ herr_t ret_value = H5B_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5G_obj_stab_to_new_cb)
+
+ /* check arguments */
+ HDassert(lnk);
+ HDassert(udata);
- /* Insert entry into symbol table */
- if(H5B_insert(udata->f, udata->dxpl_id, H5B_SNODE, udata->btree_addr, &bt_udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry")
+ /* Insert link into group */
+ /* (Casting away const OK - QAK) */
+ if(H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_ITER_ERROR, "can't insert link into group")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_obj_link_to_stab_cb() */
-#endif /* H5_GROUP_REVISION */
+} /* end H5G_obj_stab_to_new_cb() */
/*-------------------------------------------------------------------------
@@ -300,8 +475,9 @@ done:
*
* Purpose: Insert a new symbol into the group described by GRP_OLOC.
* file F. The name of the new symbol is NAME and its symbol
- * table entry is OBJ_LNK. Optionally, increment the reference
- * count for the object the link points to with INC_LINK.
+ * table entry is OBJ_LNK. Increment the reference
+ * count for the object the link points if OBJ_LNK is a hard link
+ * and ADJ_LINK is true.
*
* Return: Non-negative on success/Negative on failure
*
@@ -313,13 +489,12 @@ done:
*/
herr_t
H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
- hbool_t inc_link, hid_t dxpl_id)
+ hbool_t adj_link, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
H5O_linfo_t linfo; /* Link info message */
- htri_t linfo_exists; /* Whether the link info is present */
- hbool_t use_stab; /* Whether to use symbol table for insertions or not */
-#endif /* H5_GROUP_REVISION */
+ H5O_ginfo_t ginfo; /* Group info message */
+ hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for insertions or not */
+ hbool_t use_new_dense = FALSE; /* Whether to use "dense" form of 'new format' group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_insert, FAIL)
@@ -329,99 +504,145 @@ H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
HDassert(name && *name);
HDassert(obj_lnk);
-#ifdef H5_GROUP_REVISION
/* Check if we have information about the number of objects in this group */
- if((linfo_exists = H5O_exists(grp_oloc, H5O_LINFO_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for link info")
- if(linfo_exists) {
- htri_t stab_exists; /* Whether the symbol table info is present */
-
- /* Get the number of objects in this group */
- if(NULL == H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
-
- /* Check if there is already a 'stab' message */
- if((stab_exists = H5O_exists(grp_oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
- if(stab_exists)
- use_stab = TRUE;
+ /* (by attempting to get the link info message for this group) */
+ if(H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ size_t link_msg_size; /* Size of new link message in the file */
+
+ /* Using the new format for groups */
+ use_old_format = FALSE;
+
+ /* Get the group info */
+ if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
+
+ /* Check for tracking creation order on this group's links */
+ if(ginfo.track_corder) {
+ /* Set the creation order for the new link & indicate that it's valid */
+ obj_lnk->corder = linfo.max_corder;
+ obj_lnk->corder_valid = TRUE;
+
+ /* Increment the max. creation order used in the group */
+ linfo.max_corder++;
+ } /* end if */
+
+ /* Get the link's message size */
+ if((link_msg_size = H5O_raw_size(H5O_LINK_ID, grp_oloc->file, obj_lnk)) == 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size")
+
+ /* If there's still a small enough number of links, use the 'link' message */
+ /* (If the encoded form of the link is too large to fit into an object
+ * header message, convert to using dense link storage instead of link messages)
+ */
+ if(H5F_addr_defined(linfo.link_fheap_addr))
+ use_new_dense = TRUE;
+ else if(linfo.nlinks < ginfo.max_compact && link_msg_size < H5O_MAX_SIZE)
+ use_new_dense = FALSE;
else {
- H5O_ginfo_t ginfo; /* Group info message */
- size_t link_msg_size; /* Size of link message in the file */
+ H5G_obj_oh_it_ud1_t udata; /* User data for iteration */
- /* Get the link message size */
- if((link_msg_size = H5O_raw_size(H5O_LINK_ID, grp_oloc->file, obj_lnk)) == 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size")
+ /* The group doesn't currently have "dense" storage for links */
+ if(H5G_dense_create(grp_oloc->file, dxpl_id, &linfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create 'dense' form of new format group")
- /* Get the group info */
- if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
+ /* Set up user data for object header message iteration */
+ udata.f = grp_oloc->file;
+ udata.dxpl_id = dxpl_id;
+ udata.linfo = &linfo;
- /* If there's still a small enough number of links, use the 'link' message */
- /* (If the encoded form of the link is too large to fit into an object
- * header message, convert to using symbol table instead of link messages)
- */
- if(linfo.nlinks < ginfo.max_compact && link_msg_size < H5O_MAX_SIZE)
- use_stab = FALSE;
- else {
- H5G_obj_ud1_t udata; /* User data for iteration */
- H5O_stab_t stab; /* Symbol table message */
-
- /* The group doesn't currently have a 'stab' message, go create one */
- if(H5G_stab_create(grp_oloc, &stab, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create symbol table")
-
- /* Set up user data for object header message iteration */
- udata.f = grp_oloc->file;
- udata.btree_addr = stab.btree_addr;
- udata.heap_addr = stab.heap_addr;
- udata.dxpl_id = dxpl_id;
-
- /* Iterate over the 'link' messages, inserting them into the symbol table */
- if(H5O_iterate(grp_oloc, H5O_LINK_ID, H5G_obj_link_to_stab_cb, &udata, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links")
-
- /* Remove all the 'link' messages */
- if(H5O_remove(grp_oloc, H5O_LINK_ID, H5O_ALL, FALSE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link messages")
-
- use_stab = TRUE;
- } /* end else */
+ /* Iterate over the 'link' messages, inserting them into the dense link storage */
+ if(H5O_iterate(grp_oloc, H5O_LINK_ID, H5G_obj_link_to_dense_cb, &udata, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links")
+
+ /* Remove all the 'link' messages */
+ if(H5O_remove(grp_oloc, H5O_LINK_ID, H5O_ALL, FALSE, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link messages")
+
+ use_new_dense = TRUE;
} /* end else */
} /* end if */
- else
- use_stab = TRUE;
-#endif /* H5_GROUP_REVISION */
+ else {
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
+ /* Check for new-style link information */
+ if(obj_lnk->cset != H5T_CSET_ASCII || obj_lnk->type > H5L_TYPE_BUILTIN_MAX) {
+ H5O_linfo_t new_linfo = H5G_CRT_LINK_INFO_DEF; /* Link information */
+ H5O_ginfo_t new_ginfo = H5G_CRT_GROUP_INFO_DEF; /* Group information */
+ H5G_obj_stab_it_ud1_t udata; /* User data for iteration */
+ H5G_link_iterate_t lnk_op; /* Link operator */
+
+ /* Convert group to "new format" group, in order to hold the information */
+
+ /* Insert link info message */
+ if(H5O_modify(grp_oloc, H5O_LINFO_ID, H5O_NEW_MESG, 0, 0, &new_linfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+
+ /* Insert group info message */
+ if(H5O_modify(grp_oloc, H5O_GINFO_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 0, &new_ginfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+
+ /* Set up user data for iteration */
+ udata.grp_oloc = grp_oloc;
+ udata.dxpl_id = dxpl_id;
+
+ /* Build iterator operator */
+ lnk_op.lib_op = H5G_obj_stab_to_new_cb;
+
+ /* Iterate through all links in "old format" group and insert them into new format */
+ if(H5G_stab_iterate(grp_oloc, H5_ITER_NATIVE, 0, TRUE, 0, NULL, lnk_op, &udata, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over old format links")
+
+ /* Remove the symbol table message from the group */
+ if(H5O_remove(grp_oloc, H5O_STAB_ID, 0, FALSE, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete old format link storage")
+
+ /* Recursively call this routine to insert the new link, since the
+ * group is in the "new format" now and the link info should be
+ * set up, etc.
+ */
+ if(H5G_obj_insert(grp_oloc, name, obj_lnk, adj_link, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into group")
+
+ /* Done with insertion now */
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
+ else
+ use_old_format = TRUE;
+ } /* end if */
- /* Insert into symbol table or create link object */
-#ifdef H5_GROUP_REVISION
- if(use_stab) {
-#endif /* H5_GROUP_REVISION */
+ /* Insert into symbol table or "dense" storage */
+ if(use_old_format) {
/* Insert into symbol table */
if(H5G_stab_insert(grp_oloc, name, obj_lnk, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry")
-#ifdef H5_GROUP_REVISION
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry into symbol table")
} /* end if */
else {
- /* Insert with link message */
- if(H5G_link_insert(grp_oloc, obj_lnk, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry")
+ if(use_new_dense) {
+ /* Insert into dense link storage */
+ if(H5G_dense_insert(grp_oloc->file, dxpl_id, &linfo, obj_lnk) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage")
+ } /* end if */
+ else {
+ /* Insert with link message */
+ if(H5G_link_insert(grp_oloc, obj_lnk, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link as link message")
+ } /* end else */
} /* end else */
/* Increment the number of objects in this group */
- if(linfo_exists) {
+ if(!use_old_format) {
linfo.nlinks++;
if(H5O_modify(grp_oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message")
} /* end if */
-#endif /* H5_GROUP_REVISION */
- /* Increment link count on object, if appropriate */
- if(inc_link) {
+ /* Increment link count on object, if requested and it's a hard link */
+ if(adj_link && obj_lnk->type == H5L_TYPE_HARD) {
H5O_loc_t obj_oloc; /* Object location */
H5O_loc_reset(&obj_oloc);
- /* Convert to object location */
+ /* Create temporary object location */
obj_oloc.file = grp_oloc->file;
obj_oloc.addr = obj_lnk->u.hard.addr;
@@ -451,51 +672,59 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_obj_iterate(hid_t loc_id, const char *name, int skip, int *last_obj,
- H5G_iterate_t op, void *op_data, hid_t dxpl_id)
+H5G_obj_iterate(hid_t loc_id, const char *name, H5_iter_order_t order,
+ int skip, int *last_lnk, H5G_iterate_t op, void *op_data, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t stab_exists; /* Whether the symbol table info is present */
-#endif /* H5_GROUP_REVISION */
- hid_t gid = -1; /* ID of group to iterate over */
- H5G_t *grp; /* Pointer to group data structure to iterate over */
- herr_t ret_value; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ H5G_link_iterate_t lnk_op; /* Link operator */
+ hid_t gid = -1; /* ID of group to iterate over */
+ H5G_t *grp; /* Pointer to group data structure to iterate over */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_iterate, FAIL)
/* Sanity check */
HDassert(name);
- HDassert(last_obj);
+ HDassert(last_lnk);
HDassert(op);
/*
* Open the group on which to operate. We also create a group ID which
* we can pass to the application-defined operator.
*/
- if((gid = H5Gopen (loc_id, name)) < 0)
+ if((gid = H5Gopen(loc_id, name)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if((grp = H5I_object(gid)) == NULL)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "bad group ID")
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
-
- /* If the symbol table doesn't exist, iterate over link messages */
- if(!stab_exists) {
- /* Get the object's name from the link messages */
- if((ret_value = H5G_link_iterate(&(grp->oloc), gid, skip, last_obj, op, op_data, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over links")
+ /* Set up link operator */
+ lnk_op.app_op = op;
+
+ /* Attempt to get the link info for this group */
+ if(H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ /* Check for going out of bounds */
+ if(skip > 0 && (size_t)skip >= linfo.nlinks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
+
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* Iterate over the links in the group, building a table of the link messages */
+ if((ret_value = H5G_dense_iterate(grp->oloc.file, dxpl_id, order, gid, &linfo, FALSE, skip, last_lnk, lnk_op, op_data)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+ } /* end if */
+ else {
+ /* Get the object's name from the link messages */
+ if((ret_value = H5G_link_iterate(&(grp->oloc), dxpl_id, &linfo, order, gid, FALSE, skip, last_lnk, lnk_op, op_data)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over links")
+ } /* end else */
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Iterate over symbol table */
- if((ret_value = H5G_stab_iterate(&(grp->oloc), gid, skip, last_obj, op, op_data, dxpl_id)) < 0)
+ if((ret_value = H5G_stab_iterate(&(grp->oloc), order, gid, FALSE, skip, last_lnk, lnk_op, op_data, dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over symbol table")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
if(gid > 0)
@@ -521,9 +750,7 @@ done:
herr_t
H5G_obj_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t linfo_exists; /* Whether the link info is present */
-#endif /* H5_GROUP_REVISION */
+ H5O_linfo_t linfo; /* Link info message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_count, FAIL)
@@ -532,30 +759,19 @@ H5G_obj_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id)
HDassert(oloc);
HDassert(num_objs);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((linfo_exists = H5O_exists(oloc, H5O_LINFO_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for link info")
-
- /* If the link info exists, then it has the number of objects in the group */
- if(linfo_exists > 0) {
- H5O_linfo_t linfo; /* Link info message */
-
- /* Get the link info for this group */
- if(NULL == H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
-
+ /* Attempt to get the link info for this group */
+ if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Set the number of objects */
*num_objs = linfo.nlinks;
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Get the number of objects in this group by iterating over symbol table */
if(H5G_stab_count(oloc, num_objs, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't count objects")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -568,8 +784,7 @@ done:
* Purpose: Private function for H5Gget_objname_by_idx.
* Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative
- *
+ * Return: Success: Non-negative, length of name
* Failure: Negative
*
* Programmer: Raymond Lu
@@ -578,37 +793,38 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5G_obj_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name, size_t size, hid_t dxpl_id)
+H5G_obj_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name, size_t size,
+ hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t stab_exists; /* Whether the symbol table info is present */
-#endif /* H5_GROUP_REVISION */
- ssize_t ret_value; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_get_name_by_idx, FAIL)
/* Sanity check */
HDassert(oloc);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
-
- /* If the symbol table doesn't exist, search link messages */
- if(!stab_exists) {
- /* Get the object's name from the link messages */
- if((ret_value = H5G_link_get_name_by_idx(oloc, idx, name, size, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
+ /* Attempt to get the link info for this group */
+ if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* Get the object's name from the dense link storage */
+ if((ret_value = H5G_dense_get_name_by_idx(oloc->file, dxpl_id, &linfo, idx, name, size)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
+ } /* end if */
+ else {
+ /* Get the object's name from the link messages */
+ if((ret_value = H5G_link_get_name_by_idx(oloc, dxpl_id, &linfo, idx, name, size)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
+ } /* end else */
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Get the object's name from the symbol table */
if((ret_value = H5G_stab_get_name_by_idx(oloc, idx, name, size, dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -633,35 +849,35 @@ done:
H5G_obj_t
H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t stab_exists; /* Whether the symbol table info is present */
-#endif /* H5_GROUP_REVISION */
- H5G_obj_t ret_value; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_get_type_by_idx, H5G_UNKNOWN)
/* Sanity check */
HDassert(oloc);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to check for symbol table")
-
- /* If the symbol table doesn't exist, search link messages */
- if(!stab_exists) {
- /* Get the object's type from the link messages */
- if((ret_value = H5G_link_get_type_by_idx(oloc, idx, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
+ /* Attempt to get the link info for this group */
+ if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* Get the object's name from the dense link storage */
+ if((ret_value = H5G_dense_get_type_by_idx(oloc->file, dxpl_id, &linfo, idx)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
+ } /* end if */
+ else {
+ /* Get the object's type from the link messages */
+ if((ret_value = H5G_link_get_type_by_idx(oloc, dxpl_id, &linfo, idx)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
+ } /* end else */
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Get the object's type from the symbol table */
if((ret_value = H5G_stab_get_type_by_idx(oloc, idx, dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -672,10 +888,10 @@ done:
* Function: H5G_obj_remove
*
* Purpose: Remove an object from a group.
- * (Needs to hand up the type of the object removed)
*
- * Return: Success: Non-negative
+ * Note: Needs to hand up the type of the object removed
*
+ * Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -686,151 +902,116 @@ done:
herr_t
H5G_obj_remove(H5O_loc_t *oloc, const char *name, H5G_obj_t *obj_type, hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t linfo_exists; /* Whether the link info is present */
- H5O_linfo_t linfo; /* Link info message */
- htri_t stab_exists; /* Whether the symbol table info is present */
- hbool_t use_stab; /* Whether to use symbol table for deletions or not */
-#endif /* H5_GROUP_REVISION */
- H5G_obj_t ret_value; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for deletion or not */
+ hbool_t use_new_dense = FALSE; /* Whether to use "dense" form of 'new format' group */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_remove, FAIL)
/* Sanity check */
HDassert(oloc);
+ HDassert(name && *name);
HDassert(obj_type);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
-
- /* Check if we have information about the number of objects in this group */
- if((linfo_exists = H5O_exists(oloc, H5O_LINFO_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for link info message")
- if(linfo_exists) {
- H5O_ginfo_t ginfo; /* Group info message */
-
- /* Get the number of objects in this group */
- if(NULL == H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
+ /* Attempt to get the link info for this group */
+ if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ /* Using the new format for groups */
+ use_old_format = FALSE;
/* Check for deleting enough links from group to go back to link messages */
- if(stab_exists) {
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ H5O_ginfo_t ginfo; /* Group info message */
+
/* Get the group info */
if(NULL == H5O_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
- /* Switch from symbol table back to link messages */
+ /* Check if we should switch from dense storage back to link messages */
if(linfo.nlinks <= ginfo.min_dense) {
- H5G_bt_it_ud4_t udata;
- H5O_stab_t stab; /* Info about local heap & B-tree */
- H5O_link_t *lnk_table; /* Array of links to convert */
+ H5G_link_table_t ltable; /* Table of links */
hbool_t can_convert = TRUE; /* Whether converting to link messages is possible */
size_t u; /* Local index */
- /* Get the B-tree & local heap info */
- if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
-
- /* Allocate space for the link table */
- H5_CHECK_OVERFLOW(linfo.nlinks, /* From: */ hsize_t, /* To: */size_t);
- if(NULL == (lnk_table = H5MM_malloc(sizeof(H5O_link_t) * (size_t)linfo.nlinks)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for link table")
-
- /* Build udata to pass through H5B_iterate() */
- udata.heap_addr = stab.heap_addr;
- udata.lnk_table = lnk_table;
- udata.nlinks = 0;
- H5_CHECK_OVERFLOW(linfo.nlinks, hsize_t, size_t);
- udata.max_links = (size_t)linfo.nlinks;
-
- /* Iterate over the group members, building a table of equivalent link messages */
- if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE,
- H5G_node_stab_convert, stab.btree_addr, &udata)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over entries")
+ /* Build the table of links for this group */
+ if(H5G_dense_build_table(oloc->file, dxpl_id, &linfo, H5_ITER_NATIVE, &ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
/* Inspect links in table for ones that can't be converted back
* into link message form (currently only links which can't fit
* into an object header message)
*/
for(u = 0; u < linfo.nlinks; u++)
- if(H5O_mesg_size(H5O_LINK_ID, oloc->file, &(lnk_table[u])) >= H5O_MAX_SIZE) {
+ if(H5O_mesg_size(H5O_LINK_ID, oloc->file, &(ltable.lnks[u]), (size_t)0) >= H5O_MAX_SIZE) {
can_convert = FALSE;
break;
} /* end if */
/* If ok, insert links as link messages */
if(can_convert) {
- for(u = 0; u < linfo.nlinks; u++) {
- /* Insert link message into group */
- if(H5O_modify(oloc, H5O_LINK_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &(lnk_table[u]), dxpl_id) < 0)
+ /* Insert link messages into group */
+ for(u = 0; u < linfo.nlinks; u++)
+ if(H5O_modify(oloc, H5O_LINK_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &(ltable.lnks[u]), dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
- } /* end for */
- /* Remove the 'stab' message */
- if(H5O_remove(oloc, H5O_STAB_ID, H5O_ALL, FALSE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table message")
+ /* Remove the dense storage */
+ if(H5G_dense_delete(oloc->file, dxpl_id, &linfo, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage")
- use_stab = FALSE;
+ use_new_dense = FALSE;
} /* end if */
else
- use_stab = TRUE;
-
- /* Release memory for link names (and memory for soft link values) */
- for(u = 0; u < linfo.nlinks; u++) {
- H5MM_xfree(lnk_table[u].name);
- if(lnk_table[u].type == H5L_LINK_SOFT)
- H5MM_xfree(lnk_table[u].u.soft.name);
- else if(lnk_table[u].type >= H5L_LINK_UD_MIN) {
- if(lnk_table[u].u.ud.size > 0)
- H5MM_xfree(lnk_table[u].u.ud.udata);
- } /* end if */
- } /* end for */
+ use_new_dense = TRUE;
- /* Release memory for link table */
- H5MM_xfree(lnk_table);
+ /* Free link table information */
+ if(H5G_obj_release_table(&ltable) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
} /* end if */
else
- use_stab = TRUE;
+ use_new_dense = TRUE;
} /* end if */
else
- use_stab = FALSE;
+ use_new_dense = FALSE;
} /* end if */
- else
- use_stab = TRUE;
-#endif /* H5_GROUP_REVISION */
+ else {
+ H5E_clear_stack(NULL); /* Clear error stack from not finding the link info message */
+ use_old_format = TRUE;
+ } /* end else */
/* If the symbol table doesn't exist, search link messages */
-#ifdef H5_GROUP_REVISION
- if(!use_stab) {
- /* Remove object from the link messages */
- if((ret_value = H5G_link_remove(oloc, name, obj_type, dxpl_id)) < 0)
+ if(use_old_format) {
+ /* Remove object from the symbol table */
+ if(H5G_stab_remove(oloc, name, obj_type, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
- /* Remove object from the symbol table */
- if((ret_value = H5G_stab_remove(oloc, name, obj_type, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
-#ifdef H5_GROUP_REVISION
+ if(use_new_dense) {
+ /* Remove object from the dense link storage */
+ if(H5G_dense_remove(oloc->file, dxpl_id, &linfo, name, obj_type) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
+ } /* end if */
+ else {
+ /* Remove object from the link messages */
+ if(H5G_link_remove(oloc, name, obj_type, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object")
+ } /* end else */
} /* end else */
-#endif /* H5_GROUP_REVISION */
-#ifdef H5_GROUP_REVISION
- /* Decrement the number of objects in this group */
- if(linfo_exists) {
+ /* Update link info for a new-style group */
+ if(!use_old_format) {
+ /* Decrement # of links in group */
linfo.nlinks--;
- if(H5O_modify(oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message")
- /* Remove the symbol table, if we are using one and the number of links drops to zero */
- if(linfo.nlinks == 0 && use_stab) {
- if(H5O_remove(oloc, H5O_STAB_ID, H5O_ALL, FALSE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table message")
+ /* Remove the dense link storage, if we are using it and the number of links drops to zero */
+ if(linfo.nlinks == 0 && use_new_dense) {
+ if(H5G_dense_delete(oloc->file, dxpl_id, &linfo, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage")
} /* end if */
+
+ /* Update link info in the object header */
+ if(H5O_modify(oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message")
} /* end if */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -854,9 +1035,7 @@ herr_t
H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
hid_t dxpl_id)
{
-#ifdef H5_GROUP_REVISION
- htri_t stab_exists; /* Whether the symbol table info is present */
-#endif /* H5_GROUP_REVISION */
+ H5O_linfo_t linfo; /* Link info message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_lookup, FAIL)
@@ -865,29 +1044,30 @@ H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
HDassert(grp_oloc && grp_oloc->file);
HDassert(name && *name);
-#ifdef H5_GROUP_REVISION
- /* Check if we have information about the number of objects in this group */
- if((stab_exists = H5O_exists(grp_oloc, H5O_STAB_ID, 0, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for symbol table")
-
- /* If the symbol table doesn't exist, search link messages */
- if(!stab_exists) {
- /* Get the object's info from the link messages */
- if(H5G_link_lookup(grp_oloc, name, lnk, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object")
+ /* Attempt to get the link info message for this group */
+ if(H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ /* Check for dense link storage */
+ if(H5F_addr_defined(linfo.link_fheap_addr)) {
+ /* Get the object's info from the dense link storage */
+ if(H5G_dense_lookup(grp_oloc->file, dxpl_id, &linfo, name, lnk) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object")
+ } /* end if */
+ else {
+ /* Get the object's info from the link messages */
+ if(H5G_link_lookup(grp_oloc, name, lnk, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object")
+ } /* end else */
} /* end if */
else {
-#endif /* H5_GROUP_REVISION */
+ /* Clear error stack from not finding the link info message */
+ H5E_clear_stack(NULL);
+
/* Get the object's info from the symbol table */
if(H5G_stab_lookup(grp_oloc, name, lnk, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object")
-#ifdef H5_GROUP_REVISION
} /* end else */
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_obj_lookup() */
-
-
diff --git a/src/H5Goh.c b/src/H5Goh.c
index 08d1b25..c51a493 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -81,9 +81,7 @@ htri_t
H5O_group_isa(struct H5O_t *oh)
{
htri_t stab_exists; /* Whether the 'stab' message is in the object header */
-#ifdef H5_GROUP_REVISION
htri_t linfo_exists; /* Whether the 'linfo' message is in the object header */
-#endif /* H5_GROUP_REVISION */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_group_isa)
@@ -93,16 +91,10 @@ H5O_group_isa(struct H5O_t *oh)
/* Check for any of the messages that indicate a group */
if((stab_exists = H5O_exists_oh(oh, H5O_STAB_ID, 0)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
-#ifdef H5_GROUP_REVISION
if((linfo_exists = H5O_exists_oh(oh, H5O_LINFO_ID, 0)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
-#endif /* H5_GROUP_REVISION */
-#ifdef H5_GROUP_REVISION
ret_value = (stab_exists > 0 || linfo_exists > 0);
-#else /* H5_GROUP_REVISION */
- ret_value = stab_exists > 0;
-#endif /* H5_GROUP_REVISION */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 164cf31..d3ed14e 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -32,13 +32,13 @@
/* Other private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
+#include "H5B2private.h" /* v2 B-trees */
+#include "H5HFprivate.h" /* Fractal heaps */
#include "H5Oprivate.h" /* Object headers */
#include "H5SLprivate.h" /* Skip lists */
-#define H5G_SIZE_HINT 256 /* default root grp size hint */
-
-/* H5G_NLINKS is deprecated */
-#define H5G_NLINKS H5L_NLINKS_DEF
+/* Standard length of fractal heap ID for link */
+#define H5G_DENSE_FHEAP_ID_LEN 7
/*
* Various types of object header information can be cached in a symbol
@@ -51,9 +51,8 @@ typedef enum H5G_type_t {
H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */
H5G_CACHED_STAB = 1, /*symbol table, `stab' */
H5G_CACHED_SLINK = 2, /*symbolic link */
- H5G_CACHED_ULINK = 3, /*user-defined link */
- H5G_NCACHED = 4 /*THIS MUST BE LAST */
+ H5G_NCACHED /*THIS MUST BE LAST */
} H5G_type_t;
/*
@@ -72,12 +71,6 @@ typedef union H5G_cache_t {
struct {
size_t lval_offset; /*link value offset */
} slink;
-
- struct {
- size_t udata_size; /*size of user data buffer */
- size_t udata_offset; /*link's user data buffer */
- H5L_link_t link_type; /*link type ID */
- } ulink;
} H5G_cache_t;
/*
@@ -113,6 +106,15 @@ struct H5G_t {
H5G_name_t path; /* Group hierarchy path */
};
+/* Link iteration operator for internal library callbacks */
+typedef herr_t (*H5G_lib_iterate_t)(const H5O_link_t *lnk, void *op_data);
+
+/* Some syntactic sugar to make the compiler happy with two different kinds of iterator callbacks */
+typedef union {
+ H5G_iterate_t app_op; /* Application callback for each link */
+ H5G_lib_iterate_t lib_op; /* Library internal callback for each link */
+} H5G_link_iterate_t;
+
/*
* Common data exchange structure for symbol table nodes. This structure is
* passed through the B-link tree layer to the methods for the objects
@@ -182,9 +184,10 @@ typedef struct H5G_bt_it_ud1_t {
/* downward */
hid_t group_id; /*group id to pass to iteration operator */
haddr_t heap_addr; /*symbol table heap address */
- H5G_iterate_t op; /*iteration operator */
+ H5G_link_iterate_t op; /*iteration operator */
void *op_data; /*user-defined operator data */
int skip; /*initial entries to skip */
+ hbool_t lib_internal; /* Callback is library internal */
/* upward */
int *final_ent; /*final entry looked at */
@@ -233,13 +236,48 @@ typedef struct H5G_bt_it_ud4_t {
/* Data passed to B-tree iteration for copying copy symblol table content */
typedef struct H5G_bt_it_ud5_t {
- H5O_loc_t *src_oloc; /* source object location */
- haddr_t src_heap_addr; /* heap address of the source symbol table */
+ const H5O_loc_t *src_oloc; /* Source object location */
+ haddr_t src_heap_addr; /* Heap address of the source symbol table */
H5F_t *dst_file; /* File of destination group */
- H5O_stab_t *dst_stab; /* symbol table info for destination group */
+ H5O_stab_t *dst_stab; /* Symbol table message for destination group */
H5O_copy_t *cpy_info; /* Information for copy operation */
} H5G_bt_it_ud5_t;
+/* Typedefs for "new format" groups */
+/* (fractal heap & v2 B-tree info) */
+
+/* Typedef for native 'name' field index records in the v2 B-tree */
+typedef struct H5G_dense_bt2_name_rec_t {
+ uint32_t hash; /* Hash of 'name' field value */
+ uint8_t id[H5G_DENSE_FHEAP_ID_LEN]; /* Heap ID for link */
+} H5G_dense_bt2_name_rec_t;
+
+/*
+ * Common data exchange structure for dense link storage. This structure is
+ * passed through the v2 B-tree layer to the methods for the objects
+ * to which the v2 B-tree points.
+ */
+typedef struct H5G_bt2_ud_common_t {
+ /* downward */
+ H5F_t *f; /* Pointer to file that fractal heap is in */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5HF_t *fheap; /* Fractal heap handle */
+ const char *name; /* Name of link to compare */
+ uint32_t name_hash; /* Hash of name of link to compare */
+ H5B2_found_t found_op; /* Callback when correct link is found */
+ void *found_op_data; /* Callback data when correct link is found */
+} H5G_bt2_ud_common_t;
+
+/*
+ * Data exchange structure for dense link storage. This structure is
+ * passed through the v2 B-tree layer when inserting links.
+ */
+typedef struct H5G_bt2_ud_ins_t {
+ /* downward */
+ H5G_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
+ uint8_t id[H5G_DENSE_FHEAP_ID_LEN]; /* Heap ID of link to insert */
+} H5G_bt2_ud_ins_t;
+
/* Typedef for path traversal operations */
/* grp_loc is the location of the group in which the targeted object is located.
* name is the last component of the object's name
@@ -265,6 +303,12 @@ typedef herr_t (*H5G_traverse_t)(H5G_loc_t *grp_loc/*in*/, const char *name,
#define H5G_TARGET_UDLINK 0x0004
#define H5G_CRT_INTMD_GROUP 0x0008
+/* Data structure to hold table of links for a group */
+typedef struct {
+ size_t nlinks; /* # of links in table */
+ H5O_link_t *lnks; /* Pointer to array of links */
+} H5G_link_table_t;
+
/*
* This is the class identifier to give to the B-tree functions.
*/
@@ -288,15 +332,17 @@ H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name,
* functions that understand names are exported to the rest of
* the library and appear in H5Gprivate.h.
*/
-H5_DLL herr_t H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id);
+H5_DLL herr_t H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id,
+ const H5O_ginfo_t *ginfo, H5O_stab_t *stab);
H5_DLL herr_t H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *obj_lnk, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
H5O_link_t *obj_lnk, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_link);
-H5_DLL herr_t H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip,
- int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
+H5_DLL herr_t H5G_stab_iterate(H5O_loc_t *oloc, H5_iter_order_t order,
+ hid_t gid, hbool_t lib_internal, int skip, int *last_obj,
+ H5G_link_iterate_t op, void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_count(struct H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id);
H5_DLL ssize_t H5G_stab_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
size_t size, hid_t dxpl_id);
@@ -323,11 +369,9 @@ H5_DLL herr_t H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name,
H5_DLL herr_t H5G_ent_debug(H5F_t *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * stream,
int indent, int fwidth, haddr_t heap);
-struct H5HL_t; /* defined in H5HLprivate.h */
-
/* Functions that understand symbol table nodes */
H5_DLL herr_t H5G_node_init(H5F_t *f);
-H5_DLL int H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
+H5_DLL int H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
@@ -337,41 +381,60 @@ H5_DLL int H5G_node_type(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t a
const void *_rt_key, void *_udata);
H5_DLL int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
const void *_rt_key, void *_udata);
-#ifdef H5_GROUP_REVISION
-H5_DLL int H5G_node_stab_convert(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
- const void *_rt_key, void *_udata);
-#endif /* H5_GROUP_REVISION */
/* Functions that understand link messages */
-/* forward reference for later use */
-struct H5HL_t; /* defined in H5HLprivate.h */
-H5_DLL herr_t H5G_link_convert(H5O_link_t *lnk, const H5G_entry_t *ent,
- const struct H5HL_t *_heap, const char *name);
+H5_DLL herr_t H5G_link_convert(H5F_t *f, hid_t dxpl_id, H5O_link_t *lnk,
+ haddr_t lheap_addr, const H5G_entry_t *ent, const char *name);
+H5_DLL herr_t H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id,
+ const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk,
+ H5O_copy_t *cpy_info);
H5_DLL herr_t H5G_link_insert(H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk,
hid_t dxpl_id);
-H5_DLL ssize_t H5G_link_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
- size_t size, hid_t dxpl_id);
-H5_DLL H5G_obj_t H5G_link_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx,
- hid_t dxpl_id);
+H5_DLL ssize_t H5G_link_get_name_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size);
+H5_DLL H5G_obj_t H5G_link_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, hsize_t idx);
H5_DLL herr_t H5G_link_remove(const H5O_loc_t *oloc, const char *name,
H5G_obj_t *obj_type, hid_t dxpl_id);
-H5_DLL herr_t H5G_link_iterate(H5O_loc_t *oloc, hid_t gid, int skip,
- int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
+H5_DLL herr_t H5G_link_iterate(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, hid_t gid, hbool_t lib_internal, int skip,
+ int *last_obj, H5G_link_iterate_t op, void *op_data);
H5_DLL herr_t H5G_link_lookup(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *lnk, hid_t dxpl_id);
+/* Functions that understand "dense" link storage */
+H5_DLL herr_t H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_iter_order_t order, H5G_link_table_t *ltable);
+H5_DLL herr_t H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo);
+H5_DLL herr_t H5G_dense_insert(H5F_t *f, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, const H5O_link_t *lnk);
+H5_DLL herr_t H5G_dense_lookup(H5F_t *f, hid_t dxpl_id,
+ const H5O_linfo_t *linfo, const char *name, H5O_link_t *lnk);
+H5_DLL herr_t H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, H5_iter_order_t order,
+ hid_t gid, const H5O_linfo_t *linfo, hbool_t lib_internal, int skip,
+ int *last_lnk, H5G_link_iterate_t op, void *op_data);
+H5_DLL ssize_t H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id,
+ H5O_linfo_t *linfo, hsize_t idx, char* name, size_t size);
+H5_DLL H5G_obj_t H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id,
+ H5O_linfo_t *linfo, hsize_t idx);
+H5_DLL herr_t H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ const char *name, H5G_obj_t *obj_type);
+H5_DLL herr_t H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
+ hbool_t adj_link);
+
/* Functions that understand objects */
-H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id,
-#ifdef H5_GROUP_REVISION
- H5O_ginfo_t *ginfo,
-#endif /* H5_GROUP_REVISION */
+H5_DLL int H5G_obj_cmp_name_inc(const void *lnk1, const void *lnk2);
+H5_DLL int H5G_obj_cmp_name_dec(const void *lnk1, const void *lnk2);
+H5_DLL herr_t H5G_obj_release_table(H5G_link_table_t *ltable);
+H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
H5O_loc_t *oloc/*out*/);
H5_DLL herr_t H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name,
- H5O_link_t *obj_lnk, hbool_t inc_link, hid_t dxpl_id);
+ H5O_link_t *obj_lnk, hbool_t adj_link, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name,
H5O_link_t *lnk, hid_t dxpl_id);
-H5_DLL herr_t H5G_obj_iterate(hid_t loc_id, const char *name, int skip,
- int *last_obj, H5G_iterate_t op, void *op_data, hid_t dxpl_id);
+H5_DLL herr_t H5G_obj_iterate(hid_t loc_id, const char *name,
+ H5_iter_order_t order, int skip, int *last_obj, H5G_iterate_t op,
+ void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_count(struct H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id);
H5_DLL ssize_t H5G_obj_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx,
char* name, size_t size, hid_t dxpl_id);
@@ -394,7 +457,7 @@ H5_DLL herr_t H5G_name_set(H5G_name_t *loc, H5G_name_t *obj, const char *name);
*/
H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, H5G_loc_t *src, H5_copy_depth_t depth);
H5_DLL herr_t H5G_loc_insert(H5G_loc_t *grp_loc, const char *name,
- H5G_loc_t *obj_loc, hbool_t inc_link, hid_t dxpl_id);
+ H5G_loc_t *obj_loc, hid_t dxpl_id);
H5_DLL herr_t H5G_loc_exists(const H5G_loc_t *loc, const char *name, hid_t dxpl_id);
H5_DLL herr_t H5G_loc_remove(H5G_loc_t *grp_loc, const char *name,
H5G_loc_t *obj_loc, hid_t dxpl_id);
@@ -404,6 +467,7 @@ H5_DLL herr_t H5G_loc_remove(H5G_loc_t *grp_loc, const char *name,
H5_DLL htri_t H5G_is_empty_test(hid_t gid);
H5_DLL htri_t H5G_has_links_test(hid_t gid, unsigned *nmsgs);
H5_DLL htri_t H5G_has_stab_test(hid_t gid);
+H5_DLL htri_t H5G_is_new_dense_test(hid_t gid);
H5_DLL herr_t H5G_lheap_size_test(hid_t gid, size_t *lheap_size);
H5_DLL herr_t H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *user_path_hidden);
#endif /* H5G_TESTING */
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index d03f400..e1379c5 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -58,8 +58,24 @@
/* ========= Group Creation properties ============ */
+/* Defaults for link info values */
+#define H5G_CRT_LINFO_NLINKS 0
+#define H5G_CRT_LINFO_MIN_CORDER 0
+#define H5G_CRT_LINFO_MAX_CORDER 0
+#define H5G_CRT_LINFO_LINK_FHEAP_ADDR HADDR_UNDEF
+#define H5G_CRT_LINFO_NAME_BT2_ADDR HADDR_UNDEF
+#define H5G_CRT_LINFO_CORDER_BT2_ADDR HADDR_UNDEF
+#define H5G_CRT_LINK_INFO_DEF {H5G_CRT_LINFO_NLINKS, \
+ H5G_CRT_LINFO_MIN_CORDER, \
+ H5G_CRT_LINFO_MAX_CORDER, \
+ H5G_CRT_LINFO_LINK_FHEAP_ADDR, \
+ H5G_CRT_LINFO_NAME_BT2_ADDR, \
+ H5G_CRT_LINFO_CORDER_BT2_ADDR}
+
/* Defaults for group info values */
#define H5G_CRT_GINFO_LHEAP_SIZE_HINT 0
+#define H5G_CRT_GINFO_TRACK_CORDER FALSE
+#define H5G_CRT_GINFO_INDEX_CORDER FALSE
#define H5G_CRT_GINFO_MAX_COMPACT 8
#define H5G_CRT_GINFO_MIN_DENSE 6
#define H5G_CRT_GINFO_EST_NUM_ENTRIES 4
@@ -69,6 +85,8 @@
#define H5G_CRT_GROUP_INFO_NAME "group info"
#define H5G_CRT_GROUP_INFO_SIZE sizeof(H5O_ginfo_t)
#define H5G_CRT_GROUP_INFO_DEF {H5G_CRT_GINFO_LHEAP_SIZE_HINT, \
+ H5G_CRT_GINFO_TRACK_CORDER, \
+ H5G_CRT_GINFO_INDEX_CORDER, \
H5G_CRT_GINFO_MAX_COMPACT, \
H5G_CRT_GINFO_MIN_DENSE, \
H5G_CRT_GINFO_EST_NUM_ENTRIES, \
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 45e6f64..e6851f4 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -100,11 +100,9 @@ H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name,
const char *comment);
H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize,
char *buf);
-#ifdef H5_GROUP_REVISION
H5_DLL hid_t H5Gcreate_expand(hid_t loc_id, hid_t gcpl_id,
hid_t gapl_id);
H5_DLL hid_t H5Gget_create_plist(hid_t group_id);
-#endif /* H5_GROUP_REVISION */
H5_DLL herr_t H5Gcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
@@ -112,22 +110,22 @@ H5_DLL herr_t H5Gcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
* of the HDF5 API.
* Use of these functions and variables is depreciated.
*/
-H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_link_t type,
+H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_type_t type,
const char *cur_name, const char *new_name);
H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name,
const char *dst_name);
H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name,
- H5L_link_t type, hid_t new_loc_id, const char *new_name);
+ H5L_type_t type, hid_t new_loc_id, const char *new_name);
H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name,
hid_t dst_loc_id, const char *dst_name);
H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name,
size_t size, char *buf/*out*/);
-#define H5G_LINK_ERROR H5L_LINK_ERROR
-#define H5G_LINK_HARD H5L_LINK_HARD
-#define H5G_LINK_SOFT H5L_LINK_SOFT
-#define H5G_link_t H5L_link_t
+#define H5G_LINK_ERROR H5L_TYPE_ERROR
+#define H5G_LINK_HARD H5L_TYPE_HARD
+#define H5G_LINK_SOFT H5L_TYPE_SOFT
+#define H5G_link_t H5L_type_t
#define H5G_SAME_LOC H5L_SAME_LOC
@@ -136,4 +134,3 @@ H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name,
#endif
#endif
-
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index c4dc677..81b9916 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -155,12 +155,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id)
+H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
+ H5O_stab_t *stab)
{
-#ifdef H5_GROUP_REVISION
- H5O_ginfo_t ginfo; /* Group info message */
size_t heap_hint; /* Local heap size hint */
-#endif /* H5_GROUP_REVISION */
size_t size_hint; /* Local heap size hint */
herr_t ret_value = SUCCEED; /* Return value */
@@ -172,21 +170,16 @@ H5G_stab_create(H5O_loc_t *grp_oloc, H5O_stab_t *stab, hid_t dxpl_id)
HDassert(grp_oloc);
HDassert(stab);
-#ifdef H5_GROUP_REVISION
- /* Get the group info */
- if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
-
/* Adjust the size hint, if necessary */
- if(ginfo.lheap_size_hint == 0)
- heap_hint = ginfo.est_num_entries * (ginfo.est_name_len + 1);
+ if(ginfo->lheap_size_hint == 0)
+ heap_hint = 8 + /* "null" name inserted for B-tree */
+ (ginfo->est_num_entries * H5HL_ALIGN(ginfo->est_name_len + 1)) + /* estimated size of names for links, aligned for inserting into local heap */
+ H5HL_SIZEOF_FREE(grp_oloc->file); /* Free list entry in local heap */
else
- heap_hint = ginfo.lheap_size_hint;
+ heap_hint = ginfo->lheap_size_hint;
size_hint = MAX(heap_hint, H5HL_SIZEOF_FREE(grp_oloc->file) + 2);
-#else /* H5_GROUP_REVISION */
- size_hint = 4 * (H5HL_SIZEOF_FREE(grp_oloc->file) + 2);
-#endif /* H5_GROUP_REVISION */
+ /* Go create the B-tree & local heap */
if(H5G_stab_create_components(grp_oloc->file, stab, size_hint, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components")
@@ -363,11 +356,11 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_lin
udata.adj_link = adj_link;
/* Delete entire B-tree */
- if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata)<0)
+ if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree");
/* Delete local heap for names */
- if(H5HL_delete(f, dxpl_id, stab->heap_addr)<0)
+ if(H5HL_delete(f, dxpl_id, stab->heap_addr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table heap");
done:
@@ -388,8 +381,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
- H5G_iterate_t op, void *op_data, hid_t dxpl_id)
+H5G_stab_iterate(H5O_loc_t *oloc, H5_iter_order_t order, hid_t gid,
+ hbool_t lib_internal, int skip, int *last_lnk, H5G_link_iterate_t op,
+ void *op_data, hid_t dxpl_id)
{
H5G_bt_it_ud1_t udata; /* User data to pass to B-tree callback */
H5O_stab_t stab; /* Info about symbol table */
@@ -399,26 +393,34 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t gid, int skip, int *last_obj,
/* Sanity check */
HDassert(oloc);
- HDassert(H5I_GROUP == H5I_get_type(gid));
- HDassert(last_obj);
- HDassert(op);
+ HDassert(lib_internal || H5I_GROUP == H5I_get_type(gid));
+ HDassert(op.lib_op);
/* Get the B-tree info */
if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
- /* Build udata to pass through H5B_iterate() to H5G_node_iterate() */
- udata.group_id = gid;
- udata.skip = skip;
- udata.heap_addr = stab.heap_addr;
- udata.op = op;
- udata.op_data = op_data;
- udata.final_ent = last_obj;
-
- /* Iterate over the group members */
- if((ret_value = H5B_iterate(oloc->file, H5AC_dxpl_id, H5B_SNODE,
- H5G_node_iterate, stab.btree_addr, &udata))<0)
- HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+ /* Check on iteration order */
+ /* ("native" iteration order is increasing for this link storage mechanism) */
+ if(order != H5_ITER_DEC) {
+ /* Build udata to pass through H5B_iterate() to H5G_node_iterate() */
+ udata.group_id = gid;
+ udata.skip = skip;
+ udata.heap_addr = stab.heap_addr;
+ udata.lib_internal = lib_internal;
+ udata.op = op;
+ udata.op_data = op_data;
+ udata.final_ent = last_lnk;
+
+ /* Iterate over the group members */
+ if((ret_value = H5B_iterate(oloc->file, H5AC_dxpl_id, H5B_SNODE,
+ H5G_node_iterate, stab.btree_addr, &udata)) < 0)
+ HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+ } /* end if */
+ else {
+HDfprintf(stderr, "%s: Decreasing iteration order for symbol table storage not supported yet!\n", FUNC);
+HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "decreasing iteration order for symbol table storage not supported yet")
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -428,7 +430,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5G_stab_count
*
- * Purpose: Count the # of objects in a group
+ * Purpose: Count the # of links in a group
*
* Return: Non-negative on success/Negative on failure
*
@@ -470,7 +472,7 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative, length of name
* Failure: Negative
*
* Programmer: Raymond Lu
@@ -502,7 +504,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, hsize_t idx, char* name,
udata.name = NULL;
/* Iterate over the group members */
- if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, H5G_node_name, stab.btree_addr, &udata))<0)
+ if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE, H5G_node_name, stab.btree_addr, &udata)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed")
/* If we don't know the name now, we almost certainly went out of bounds */
@@ -603,80 +605,10 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata)
/* Set link info */
if(udata->lnk) {
- /* Set (default) common info for link */
- udata->lnk->cset = H5F_CRT_DEFAULT_CSET;
- udata->lnk->ctime = 0;
- udata->lnk->name = H5MM_xstrdup(udata->name);
-
- /* Object is a symbolic or user-defined link */
- switch(ent->type)
- {
- case H5G_CACHED_SLINK:
- {
- const char *s; /* Pointer to link value */
- const H5HL_t *heap; /* Pointer to local heap for group */
-
- /* Lock the local heap */
- if(NULL == (heap = H5HL_protect(udata->file, udata->dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
-
- s = H5HL_offset_into(udata->file, heap, ent->cache.slink.lval_offset);
-
- /* Copy the link value */
- udata->lnk->u.soft.name = H5MM_xstrdup(s);
-
- /* Release the local heap */
- if(H5HL_unprotect(udata->file, udata->dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
-
- /* Set link type */
- udata->lnk->type = H5L_LINK_SOFT;
- }
- break;
-
- case H5G_CACHED_ULINK:
- {
- void * s; /* Pointer to heap value */
- const H5HL_t *heap; /* Pointer to local heap for group */
- size_t data_size; /* Size of user link data */
-
- /* Lock the local heap */
- if(NULL == (heap = H5HL_protect(udata->file, udata->dxpl_id, udata->heap_addr)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
-
- data_size =ent->cache.ulink.udata_size;
-
- /* If there is user data, allocate space for it and copy it from the heap */
- if(data_size > 0)
- {
- s = H5HL_offset_into(udata->file, heap, ent->cache.ulink.udata_offset);
-
- udata->lnk->u.ud.udata = H5MM_malloc(data_size);
- HDmemcpy(udata->lnk->u.ud.udata, s, data_size);
- } /* end if */
- else
- udata->lnk->u.ud.udata = NULL;
-
- /* Release the local heap */
- if(H5HL_unprotect(udata->file, udata->dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
- {
- /* Release allocated memory before exiting */
- H5MM_free(udata->lnk->u.ud.udata);
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
- }
- /* Set link size and type */
- udata->lnk->u.ud.size = data_size;
- udata->lnk->type = ent->cache.ulink.link_type;
- }
- break;
-
- default:
- /* Set address of object */
- udata->lnk->u.hard.addr = ent->header;
-
- /* Set link type */
- udata->lnk->type = H5L_LINK_HARD;
- } /* end switch */
+ /* Convert the entry to a link */
+ if(H5G_link_convert(udata->file, udata->dxpl_id, udata->lnk, udata->heap_addr,
+ ent, udata->name) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link")
} /* end if */
done:
@@ -738,4 +670,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_stab_lookup() */
-
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 262a925..a142dfd 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -29,7 +29,6 @@
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
-#ifdef H5_GROUP_REVISION
/*--------------------------------------------------------------------------
NAME
@@ -43,7 +42,7 @@
Non-negative TRUE/FALSE on success, negative on failure
DESCRIPTION
Checks to see if the group has no link messages and no symbol table message
- dimensionality and shape.
+ and no "dense" link storage
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
@@ -54,7 +53,8 @@ htri_t
H5G_is_empty_test(hid_t gid)
{
H5G_t *grp = NULL; /* Pointer to group */
- htri_t msg_exists = 0; /* Indicate that a header message is present */
+ htri_t msg_exists = FALSE; /* Indicate that a header message is present */
+ htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5G_is_empty_test, FAIL)
@@ -63,17 +63,79 @@ H5G_is_empty_test(hid_t gid)
if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ /* "New format" checks */
+
/* Check if the group has any link messages */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
- if(msg_exists > 0)
+ if(msg_exists > 0) {
+ /* Sanity check that new group format shouldn't have old messages */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found")
+
HGOTO_DONE(FALSE)
+ } /* end if */
+
+ /* Check for a link info message */
+ if((linfo_exists = H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(linfo_exists > 0) {
+ H5O_linfo_t linfo; /* Link info message */
+
+ /* Sanity check that new group format shouldn't have old messages */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
+
+ /* Get the link info */
+ if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
+
+ /* Check for 'dense' link storage file addresses being defined */
+ if(H5F_addr_defined(linfo.link_fheap_addr))
+ HGOTO_DONE(FALSE)
+ if(H5F_addr_defined(linfo.name_bt2_addr))
+ HGOTO_DONE(FALSE)
+ if(H5F_addr_defined(linfo.corder_bt2_addr))
+ HGOTO_DONE(FALSE)
+
+ /* Check for link count */
+ if(linfo.nlinks > 0)
+ HGOTO_DONE(FALSE)
+ } /* end if */
+
+ /* "Old format" checks */
/* Check if the group has a symbol table message */
if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
- if(msg_exists > 0)
- HGOTO_DONE(FALSE)
+ if(msg_exists > 0) {
+ H5O_stab_t stab; /* Info about local heap & B-tree */
+ hsize_t nlinks; /* Number of links in the group */
+
+ /* Sanity check that old group format shouldn't have new messages */
+ if(linfo_exists > 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_GINFO_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found")
+
+ /* Get the B-tree & local heap info */
+ if(NULL == H5O_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message")
+
+ /* Get the count of links in the group */
+ if(H5G_stab_count(&(grp->oloc), &nlinks, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to count links")
+
+ /* Check for link count */
+ if(nlinks > 0)
+ HGOTO_DONE(FALSE)
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -185,7 +247,73 @@ H5G_has_stab_test(hid_t gid)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5G_has_stab_test() */
-#endif /* H5_GROUP_REVISION */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5G_is_new_dense_test
+ PURPOSE
+ Determine whether a group is in the "new" format and dense
+ USAGE
+ htri_t H5G_is_new_dense_test(gid)
+ hid_t gid; IN: group to check
+ RETURNS
+ Non-negative TRUE/FALSE on success, negative on failure
+ DESCRIPTION
+ Checks to see if the group is in the "new" format for groups (link messages/
+ fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has
+ a name B-tree index).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5G_is_new_dense_test(hid_t gid)
+{
+ H5G_t *grp = NULL; /* Pointer to group */
+ htri_t msg_exists = 0; /* Indicate that a header message is present */
+ htri_t ret_value = TRUE; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_is_new_dense_test, FAIL)
+
+ /* Get group structure */
+ if(NULL == (grp = H5I_object_verify(gid, H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+
+ /* Check if the group has a symbol table message */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_DONE(FALSE)
+
+ /* Check if the group has any link messages */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0)
+ HGOTO_DONE(FALSE)
+
+ /* Check if the group has link info message */
+ if((msg_exists = H5O_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header")
+ if(msg_exists > 0) {
+ H5O_linfo_t linfo; /* Link info message */
+
+ /* Get the link info */
+ if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
+
+ /* Check for 'dense' link storage file addresses being defined */
+ if(!H5F_addr_defined(linfo.link_fheap_addr))
+ HGOTO_DONE(FALSE)
+ if(!H5F_addr_defined(linfo.name_bt2_addr))
+ HGOTO_DONE(FALSE)
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5G_is_new_dense_test() */
/*--------------------------------------------------------------------------
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 5a58e2b..0bdc0f4 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -150,7 +150,7 @@ static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
H5G_loc_t *obj_loc/*in,out*/, size_t *nlinks/*in,out*/, hid_t lapl_id,
hid_t dxpl_id)
{
- const H5L_link_class_t *link_class; /* User-defined link class */
+ const H5L_class_t *link_class; /* User-defined link class */
hid_t cb_return = -1; /* The ID the user-defined callback returned */
H5G_loc_t grp_loc_copy;
H5G_name_t grp_path_copy;
@@ -168,7 +168,7 @@ static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
/* Sanity check */
HDassert(grp_loc);
HDassert(lnk);
- HDassert(lnk->type >= H5L_LINK_UD_MIN);
+ HDassert(lnk->type >= H5L_TYPE_UD_MIN);
HDassert(obj_loc);
HDassert(nlinks);
@@ -310,7 +310,7 @@ H5G_traverse_slink(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk,
/* Sanity check */
HDassert(grp_loc);
HDassert(lnk);
- HDassert(lnk->type == H5L_LINK_SOFT);
+ HDassert(lnk->type == H5L_TYPE_SOFT);
HDassert(nlinks);
/* Set up temporary location */
@@ -545,16 +545,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* If there's valid information in the link, reset it */
if(link_valid) {
-#ifdef H5_GROUP_REVISION
H5O_reset(H5O_LINK_ID, &lnk);
-#else /* H5_GROUP_REVISION */
- /* Free information for link (but don't free link pointer) */
- if(lnk.type == H5L_LINK_SOFT)
- lnk.u.soft.name = H5MM_xfree(lnk.u.soft.name);
- else if(lnk.type >= H5L_LINK_UD_MIN && lnk.u.ud.size > 0)
- lnk.u.ud.udata = H5MM_xfree(lnk.u.ud.udata);
- lnk.name = H5MM_xfree(lnk.name);
-#endif /* H5_GROUP_REVISION */
link_valid = FALSE;
} /* end if */
@@ -565,8 +556,8 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* If the lookup was OK, try traversing soft links and mount points, if allowed */
if(lookup_status >= 0) {
/* Indicate that the link info is valid */
- HDassert(lnk.type >= H5L_LINK_HARD);
- if(lnk.type >H5L_LINK_BUILTIN_MAX && lnk.type < H5L_LINK_UD_MIN)
+ HDassert(lnk.type >= H5L_TYPE_HARD);
+ if(lnk.type >H5L_TYPE_BUILTIN_MAX && lnk.type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "unknown link type")
link_valid = TRUE;
@@ -577,7 +568,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Set the object location, if it's a hard link set the address also */
obj_loc.oloc->file = grp_loc.oloc->file;
obj_loc.oloc->holding_file = FALSE;
- if(lnk.type == H5L_LINK_HARD)
+ if(lnk.type == H5L_TYPE_HARD)
obj_loc.oloc->addr = lnk.u.hard.addr;
obj_loc_valid = TRUE;
@@ -586,7 +577,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* is the last component of the name and the H5G_TARGET_SLINK bit of
* TARGET is set then we don't follow it.
*/
- if(H5L_LINK_SOFT == lnk.type &&
+ if(H5L_TYPE_SOFT == lnk.type &&
(0 == (target & H5G_TARGET_SLINK) || !last_comp)) {
if((*nlinks)-- <= 0)
HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links")
@@ -599,7 +590,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
* is the last component of the name and the H5G_TARGET_UDLINK bit of
* TARGET is set then we don't follow it.
*/
- if( lnk.type >= H5L_LINK_UD_MIN && ((0 == (target & H5G_TARGET_UDLINK)) || !last_comp) ) {
+ if( lnk.type >= H5L_TYPE_UD_MIN && ((0 == (target & H5G_TARGET_UDLINK)) || !last_comp) ) {
if((*nlinks)-- <= 0)
HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links")
if(H5G_traverse_ud(&grp_loc/*in,out*/, &lnk/*in*/, &obj_loc, nlinks, lapl_id, dxpl_id) < 0)
@@ -660,26 +651,29 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
if(lookup_status < 0) {
/* If an intermediate group doesn't exist & flag is set, create the group */
if(target & H5G_CRT_INTMD_GROUP) {
-#ifdef H5_GROUP_REVISION
H5O_ginfo_t ginfo; /* Group info message for parent group */
/* Get the group info for parent group */
- if(NULL == H5O_read(grp_loc.oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
-#endif /* H5_GROUP_REVISION */
+ /* (OK if not found) */
+ if(NULL == H5O_read(grp_loc.oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id)) {
+ H5O_ginfo_t def_ginfo = H5G_CRT_GROUP_INFO_DEF;
+
+ /* Clear error stack from not finding the group info message */
+ H5E_clear_stack(NULL);
+
+ /* Use default group info settings */
+ HDmemcpy(&ginfo, &def_ginfo, sizeof(H5O_ginfo_t));
+ } /* end if */
/* Create the intermediate group */
/* XXX: Should we allow user to control the group creation params here? -QAK */
- if(H5G_obj_create(grp_oloc.file, dxpl_id,
-#ifdef H5_GROUP_REVISION
- &ginfo,
-#endif /* H5_GROUP_REVISION */
- obj_loc.oloc/*out*/) < 0)
+ if(H5G_obj_create(grp_oloc.file, dxpl_id, &ginfo, obj_loc.oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
/* Insert new group into current group's symbol table */
- if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, TRUE, dxpl_id) < 0)
+ if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group")
+
/* Close new group */
if(H5O_close(obj_loc.oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close")
@@ -742,18 +736,8 @@ done:
H5G_loc_free(&grp_loc);
/* If there's valid information in the link, reset it */
- if(link_valid) {
-#ifdef H5_GROUP_REVISION
+ if(link_valid)
H5O_reset(H5O_LINK_ID, &lnk);
-#else /* H5_GROUP_REVISION */
- /* Free information for link (but don't free link pointer) */
- if(lnk.type == H5L_LINK_SOFT)
- lnk.u.soft.name = H5MM_xfree(lnk.u.soft.name);
- else if(lnk.type >= H5L_LINK_UD_MIN && lnk.u.ud.size > 0)
- lnk.u.ud.udata = H5MM_xfree(lnk.u.ud.udata);
- lnk.name = H5MM_xfree(lnk.name);
-#endif /* H5_GROUP_REVISION */
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_traverse_real() */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 4908d4b..ae4185d 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -373,7 +373,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
UINT32DECODE(p, hdr->pline_root_direct_filter_mask);
/* Decode I/O filter information */
- if(NULL == (pline = H5O_decode(hdr->f, p, H5O_PLINE_ID)))
+ if(NULL == (pline = H5O_decode(hdr->f, dxpl_id, p, H5O_PLINE_ID)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters")
p += hdr->filter_len;
diff --git a/src/H5HL.c b/src/H5HL.c
index cdfe49b..d1bf94f 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -42,7 +42,7 @@
/* Private macros */
#define H5HL_FREE_NULL 1 /*end of free list on disk */
-#define H5HL_MIN_HEAP 256 /* Minimum size to reduce heap buffer to */
+#define H5HL_MIN_HEAP 128 /* Minimum size to reduce heap buffer to */
/*
* Local heap collection version.
@@ -343,8 +343,8 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
FUNC_ENTER_NOAPI(H5HL_minimize_heap_space, FAIL)
/* check args */
- HDassert( f );
- HDassert( heap );
+ HDassert(f);
+ HDassert(heap);
sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */
@@ -358,12 +358,12 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
H5HL_free_t *last_fl = NULL;
/* Search for a free block at the end of the buffer */
- for (tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next)
+ for(tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next)
/* Check if the end of this free block is at the end of the buffer */
- if (tmp_fl->offset + tmp_fl->size == heap->heap_alloc) {
+ if(tmp_fl->offset + tmp_fl->size == heap->heap_alloc) {
last_fl = tmp_fl;
break;
- }
+ } /* end if */
/*
* Found free block at the end of the buffer, decide what to do
@@ -980,16 +980,16 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void *
HDassert(buf_size > 0);
HDassert(buf);
- if (0==(f->intent & H5F_ACC_RDWR))
- HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, (size_t)(-1), "no write intent on file");
+ if(0 == (f->intent & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, (size_t)(-1), "no write intent on file")
- if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap");
+ if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap")
heap_flags |= H5AC__DIRTIED_FLAG;
/* Cache this for later */
- sizeof_hdr= H5HL_SIZEOF_HDR(f);
+ sizeof_hdr = H5HL_SIZEOF_HDR(f);
/*
* In order to keep the free list descriptors aligned on word boundaries,
@@ -1280,21 +1280,21 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
FUNC_ENTER_NOAPI(H5HL_remove, FAIL);
/* check arguments */
- HDassert( f );
- HDassert( H5F_addr_defined(addr) );
- HDassert( size > 0 );
- HDassert( offset == H5HL_ALIGN(offset) );
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(size > 0);
+ HDassert(offset == H5HL_ALIGN(offset));
- if (0==(f->intent & H5F_ACC_RDWR))
- HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file");
+ if(0 == (f->intent & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
size = H5HL_ALIGN (size);
- if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to load heap");
+ if(NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to load heap")
- HDassert( offset < heap->heap_alloc );
- HDassert( offset + size <= heap->heap_alloc );
+ HDassert(offset < heap->heap_alloc);
+ HDassert(offset + size <= heap->heap_alloc);
fl = heap->freelist;
heap_flags |= H5AC__DIRTIED_FLAG;
@@ -1304,106 +1304,105 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
* free chunk. It might also fall between two chunks in such a way
* that all three chunks can be combined into one.
*/
- while (fl) {
- if (offset + size == fl->offset) {
+ while(fl) {
+ if((offset + size) == fl->offset) {
fl->offset = offset;
fl->size += size;
- assert (fl->offset==H5HL_ALIGN (fl->offset));
- assert (fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->offset==H5HL_ALIGN (fl->offset));
+ HDassert(fl->size==H5HL_ALIGN (fl->size));
fl2 = fl->next;
- while (fl2) {
- if (fl2->offset + fl2->size == fl->offset) {
+ while(fl2) {
+ if((fl2->offset + fl2->size) == fl->offset) {
fl->offset = fl2->offset;
fl->size += fl2->size;
- assert (fl->offset==H5HL_ALIGN (fl->offset));
- assert (fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->offset == H5HL_ALIGN (fl->offset));
+ HDassert(fl->size == H5HL_ALIGN (fl->size));
fl2 = H5HL_remove_free(heap, fl2);
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
+ if(((fl->offset + fl->size) == heap->heap_alloc ) &&
+ ((2 * fl->size) > heap->heap_alloc )) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl2 = fl2->next;
}
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0 )
+ if(((fl->offset + fl->size) == heap->heap_alloc) &&
+ ((2 * fl->size) > heap->heap_alloc)) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
-
- } else if (fl->offset + fl->size == offset) {
+ } else if(fl->offset + fl->size == offset) {
fl->size += size;
fl2 = fl->next;
- assert (fl->size==H5HL_ALIGN (fl->size));
- while (fl2) {
- if (fl->offset + fl->size == fl2->offset) {
+ HDassert(fl->size==H5HL_ALIGN (fl->size));
+ while(fl2) {
+ if(fl->offset + fl->size == fl2->offset) {
fl->size += fl2->size;
- assert (fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->size==H5HL_ALIGN (fl->size));
fl2 = H5HL_remove_free(heap, fl2);
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
+ if(((fl->offset + fl->size) == heap->heap_alloc) &&
+ ((2 * fl->size) > heap->heap_alloc)) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl2 = fl2->next;
}
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
+ if(((fl->offset + fl->size) == heap->heap_alloc) &&
+ ((2 * fl->size) > heap->heap_alloc)) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl = fl->next;
- }
+ } /* end while */
/*
* The amount which is being removed must be large enough to
* hold the free list data. If not, the freed chunk is forever
* lost.
*/
- if (size < H5HL_SIZEOF_FREE(f)) {
+ if(size < H5HL_SIZEOF_FREE(f)) {
#ifdef H5HL_DEBUG
- if (H5DEBUG(HL)) {
+ if(H5DEBUG(HL)) {
fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n",
(unsigned long) size);
}
#endif
HGOTO_DONE(SUCCEED);
- }
+ } /* end if */
/*
* Add an entry to the free list.
*/
- if (NULL==(fl = H5FL_MALLOC(H5HL_free_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ if(NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
fl->offset = offset;
fl->size = size;
- assert (fl->offset==H5HL_ALIGN (fl->offset));
- assert (fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->offset == H5HL_ALIGN(fl->offset));
+ HDassert(fl->size == H5HL_ALIGN(fl->size));
fl->prev = NULL;
fl->next = heap->freelist;
- if (heap->freelist)
+ if(heap->freelist)
heap->freelist->prev = fl;
heap->freelist = fl;
- if ( ( (fl->offset + fl->size) == heap->heap_alloc ) &&
- ( (2 * fl->size) > heap->heap_alloc ) ) {
- if ( H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
+ if(((fl->offset + fl->size) == heap->heap_alloc) &&
+ ((2 * fl->size) > heap->heap_alloc)) {
+ if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
- }
+ } /* end if */
done:
- if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED)
- HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
+ if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED)
+ HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5HL_remove() */
/*-------------------------------------------------------------------------
diff --git a/src/H5L.c b/src/H5L.c
index 538ceb9..3cc46c7 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -121,13 +121,13 @@ static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/,
static herr_t H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
const H5O_link_t *lnk, H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static int H5L_find_class_idx(H5L_link_t id);
+static int H5L_find_class_idx(H5L_type_t id);
/* Information about user-defined links */
-static size_t H5L_table_alloc_g = 0;
-static size_t H5L_table_used_g = 0;
-static H5L_link_class_t *H5L_table_g = NULL;
+static size_t H5L_table_alloc_g = 0;
+static size_t H5L_table_used_g = 0;
+static H5L_class_t *H5L_table_g = NULL;
@@ -172,7 +172,7 @@ done:
*
* The link class passed in will override any existing link
* class for the specified link class ID. It must at least
- * include a H5L_link_class_t version (which should be
+ * include a H5L_class_t version (which should be
* H5L_LINK_CLASS_T_VERS), a link class ID, and a traversal
* function.
*
@@ -184,7 +184,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lregister(const H5L_link_class_t *cls)
+H5Lregister(const H5L_class_t *cls)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -195,13 +195,13 @@ H5Lregister(const H5L_link_class_t *cls)
if (cls==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class")
- /* Check H5L_link_class_t version number; this is where a function to convert
+ /* Check H5L_class_t version number; this is where a function to convert
* from an outdated version should be called.
*/
if(cls->version != H5L_LINK_CLASS_T_VERS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_link_class_t version number");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number");
- if (cls->id<H5L_LINK_UD_MIN || cls->id>H5L_LINK_MAX)
+ if (cls->id<H5L_TYPE_UD_MIN || cls->id>H5L_TYPE_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number")
if (cls->trav_func==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no traversal function specified")
@@ -231,7 +231,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5L_find_class_idx(H5L_link_t id)
+H5L_find_class_idx(H5L_type_t id)
{
size_t i; /* Local index variable */
int ret_value=FAIL; /* Return value */
@@ -261,11 +261,11 @@ done:
*
*-------------------------------------------------------------------------
*/
-const H5L_link_class_t *
-H5L_find_class(H5L_link_t id)
+const H5L_class_t *
+H5L_find_class(H5L_type_t id)
{
int idx; /* Filter index in global table */
- H5L_link_class_t *ret_value=NULL; /* Return value */
+ H5L_class_t *ret_value=NULL; /* Return value */
FUNC_ENTER_NOAPI(H5L_find_class, NULL)
@@ -541,6 +541,8 @@ H5Llink(hid_t new_loc_id, const char *new_name, hid_t obj_id, hid_t lcpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!new_name || !*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(HDstrlen(new_name) > H5L_MAX_LINK_NAME_LEN)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long")
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
@@ -691,7 +693,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_link_t link_type,
+H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t link_loc;
@@ -856,7 +858,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lunregister(H5L_link_t id)
+H5Lunregister(H5L_type_t id)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -864,7 +866,7 @@ H5Lunregister(H5L_link_t id)
H5TRACE1("e","Ll",id);
/* Check args */
- if (id<0 || id>H5L_LINK_MAX)
+ if (id<0 || id>H5L_TYPE_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type")
/* Do it */
@@ -891,7 +893,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-htri_t H5Lis_registered(H5L_link_t id)
+htri_t H5Lis_registered(H5L_type_t id)
{
size_t i; /* Local index variable */
htri_t ret_value=FALSE; /* Return value */
@@ -899,7 +901,7 @@ htri_t H5Lis_registered(H5L_link_t id)
FUNC_ENTER_API(H5Lis_registered, FAIL)
/* Check args */
- if(id<0 || id>H5L_LINK_MAX)
+ if(id<0 || id>H5L_TYPE_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type id number")
/* Is the link class already registered? */
@@ -938,7 +940,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5L_register (const H5L_link_class_t *cls)
+H5L_register (const H5L_class_t *cls)
{
size_t i;
herr_t ret_value=SUCCEED; /* Return value */
@@ -946,7 +948,7 @@ H5L_register (const H5L_link_class_t *cls)
FUNC_ENTER_NOAPI(H5L_register, FAIL)
assert (cls);
- assert (cls->id>=0 && cls->id<=H5L_LINK_MAX);
+ assert (cls->id>=0 && cls->id<=H5L_TYPE_MAX);
/* Is the link type already registered? */
for (i=0; i<H5L_table_used_g; i++)
@@ -957,8 +959,8 @@ H5L_register (const H5L_link_class_t *cls)
if (i>=H5L_table_used_g) {
if (H5L_table_used_g>=H5L_table_alloc_g) {
size_t n = MAX(H5L_MIN_TABLE_SIZE, 2*H5L_table_alloc_g);
- H5L_link_class_t *table = H5MM_realloc(H5L_table_g,
- n*sizeof(H5L_link_class_t));
+ H5L_class_t *table = H5MM_realloc(H5L_table_g,
+ n*sizeof(H5L_class_t));
if (!table)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table")
H5L_table_g = table;
@@ -967,12 +969,12 @@ H5L_register (const H5L_link_class_t *cls)
/* Initialize */
i = H5L_table_used_g++;
- HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_link_class_t));
+ HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_class_t));
} /* end if */
/* Filter already registered */
else {
/* Replace old contents */
- HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_link_class_t));
+ HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_class_t));
} /* end else */
done:
@@ -995,14 +997,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5L_unregister (H5L_link_t id)
+H5L_unregister (H5L_type_t id)
{
size_t i; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5L_unregister,FAIL)
- assert (id>=0 && id<=H5L_LINK_MAX);
+ assert (id>=0 && id<=H5L_TYPE_MAX);
/* Is the filter already registered? */
for (i=0; i<H5L_table_used_g; i++)
@@ -1015,7 +1017,7 @@ H5L_unregister (H5L_link_t id)
/* Remove filter from table */
/* Don't worry about shrinking table size (for now) */
- HDmemmove(&H5L_table_g[i],&H5L_table_g[i+1],sizeof(H5L_link_class_t)*((H5L_table_used_g-1)-i));
+ HDmemmove(&H5L_table_g[i],&H5L_table_g[i+1],sizeof(H5L_class_t)*((H5L_table_used_g-1)-i));
H5L_table_used_g--;
done:
@@ -1056,7 +1058,7 @@ H5L_link(H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc,
*/
/* Construct link information for eventual insertion */
- lnk.type = H5L_LINK_HARD;
+ lnk.type = H5L_TYPE_HARD;
lnk.u.hard.addr = obj_loc->oloc->addr;
/* Create the link */
@@ -1099,7 +1101,7 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name already exists")
/* Check for crossing file boundaries with a new hard link */
- if(udata->lnk->type == H5L_LINK_HARD) {
+ if(udata->lnk->type == H5L_TYPE_HARD) {
/* Check that both objects are in same file */
if(grp_loc->oloc->file->shared != udata->file->shared)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "interfile hard links are not allowed")
@@ -1110,22 +1112,18 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
udata->lnk->name = (char *)name;
/* Insert link into group */
- if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, (hbool_t)(udata->lnk->type == H5L_LINK_HARD ? TRUE : FALSE), udata->dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object")
/* Set object's path if it has been passed in and is not set */
if(udata->path != NULL && udata->path->user_path_r == NULL)
- {
- if(H5G_name_set(grp_loc->path, udata->path, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name")
- }
+ if(H5G_name_set(grp_loc->path, udata->path, name) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name")
/* If link is a user-defined link, trigger its creation callback if it has one*/
- if(udata->lnk->type >= H5L_LINK_UD_MIN)
+ if(udata->lnk->type >= H5L_TYPE_UD_MIN)
{
- const H5L_link_class_t *link_class; /* User-defined link class */
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
+ const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(udata->lnk->type)))
@@ -1133,6 +1131,9 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
if(link_class->create_func != NULL)
{
+ H5O_loc_t temp_oloc;
+ H5G_name_t temp_path;
+
/* Create a temporary location (or else H5G_open will do a shallow
* copy and wipe out grp_loc)
*/
@@ -1184,8 +1185,7 @@ done:
* Purpose: Creates a link at a path location
*
* lnk should have linkclass-specific information already
- * set, but this function will take care of setting
- * creation time and name.
+ * set, but this function will take care of setting name.
*
* obj_path can be NULL if the object's path doesn't need to
* be set, and obj_file can be NULL if the object is not a
@@ -1215,7 +1215,7 @@ H5L_create_real(H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path
HDassert(lnk);
HDassert(link_loc);
HDassert(link_name && *link_name);
- HDassert(lnk->type >= H5L_LINK_HARD && lnk->type <= H5L_LINK_MAX);
+ HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX);
/* Get normalized link name */
if((norm_link_name = H5G_normalize(link_name)) == NULL)
@@ -1246,16 +1246,8 @@ H5L_create_real(H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path
/* Fill in common data for the link struct */
lnk->cset = char_encoding;
-#ifdef H5_HAVE_GETTIMEOFDAY
- {
- struct timeval now_tv;
-
- HDgettimeofday(&now_tv, NULL);
- lnk->ctime = now_tv.tv_sec;
- }
-#else /* H5_HAVE_GETTIMEOFDAY */
- lnk->ctime = HDtime(NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ lnk->corder = 0; /* Will be re-written during group insertion, if the group is tracking creation order */
+ lnk->corder_valid = FALSE; /* Creation order not valid (yet) */
/* Set up user data
* file is used to make sure that hard links don't cross files, and
@@ -1325,7 +1317,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name")
/* Set up link data specific to hard links */
- lnk.type = H5L_LINK_HARD;
+ lnk.type = H5L_TYPE_HARD;
/* Get object location for object pointed to */
obj_loc.path = &path;
@@ -1394,7 +1386,7 @@ H5L_create_soft( const char *target_path, H5G_loc_t *link_loc,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name")
/* Set up link data specific to soft links */
- lnk.type = H5L_LINK_SOFT;
+ lnk.type = H5L_TYPE_SOFT;
lnk.u.soft.name = norm_target;
/* Create actual link to the object */
@@ -1426,7 +1418,7 @@ done:
*/
herr_t
H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, const void * ud_data,
- size_t ud_data_size, H5L_link_t type, hid_t lcpl_id, hid_t lapl_id,
+ size_t ud_data_size, H5L_type_t type, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id)
{
H5O_link_t lnk; /* Link to insert */
@@ -1435,7 +1427,7 @@ H5L_create_ud(H5G_loc_t *link_loc, const char *link_name, const void * ud_data,
FUNC_ENTER_NOAPI_NOINIT(H5L_create_ud)
/* Check args */
- HDassert(type >= H5L_LINK_UD_MIN && type <= H5L_LINK_MAX);
+ HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX);
HDassert(link_loc);
HDassert(link_name && *link_name);
HDassert(ud_data_size == 0 || ud_data);
@@ -1489,7 +1481,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5L_trav_ud5_t *udata = (H5L_trav_ud5_t *)_udata; /* User data passed in */
- const H5L_link_class_t *link_class; /* User-defined link class */
+ const H5L_class_t *link_class; /* User-defined link class */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5L_linkval_cb)
@@ -1498,7 +1490,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
if(lnk == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
- if(H5L_LINK_SOFT == lnk->type)
+ if(H5L_TYPE_SOFT == lnk->type)
{
/* Copy to output buffer */
if(udata->size > 0 && udata->buf) {
@@ -1507,7 +1499,7 @@ H5L_linkval_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
udata->buf[udata->size - 1] = '\0';
} /* end if */
}
- else if(lnk->type >= H5L_LINK_UD_MIN)
+ else if(lnk->type >= H5L_TYPE_UD_MIN)
{
/* Get the link class for this type of link. It's okay if the class isn't registered, though--we
* just can't give any more information about it */
@@ -1607,11 +1599,9 @@ H5L_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "can't delete self")
/* If there is a user-defined callback, call it before deleting the link */
- if(lnk->type >= H5L_LINK_UD_MIN)
+ if(lnk->type >= H5L_TYPE_UD_MIN)
{
- const H5L_link_class_t *link_class; /* User-defined link class */
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
+ const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(lnk->type)))
@@ -1619,6 +1609,9 @@ H5L_unlink_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
if(link_class->del_func != NULL)
{
+ H5O_loc_t temp_oloc;
+ H5G_name_t temp_path;
+
H5G_name_reset(&temp_path);
if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
@@ -1738,7 +1731,7 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "an object with that name already exists")
/* Check for crossing file boundaries with a new hard link */
- if(udata->lnk->type == H5L_LINK_HARD) {
+ if(udata->lnk->type == H5L_TYPE_HARD) {
/* Check that both objects are in same file */
if(grp_loc->oloc->file->shared != udata->file->shared)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "moving a link across files is not allowed")
@@ -1747,19 +1740,16 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
/* Give the object its new name */
/* Casting away const okay -JML */
HDassert(udata->lnk->name == NULL);
-/* JAMES udata->lnk->name = H5MM_xfree(udata->lnk->name); */
- udata->lnk->name= (char *)name;
+ udata->lnk->name = (char *)name;
/* Insert the link into the group */
- if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, (hbool_t)(udata->lnk->type == H5L_LINK_HARD ? TRUE : FALSE), udata->dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
/* If the link was a user-defined link, call its move callback if it has one */
- if(udata->lnk->type >= H5L_LINK_UD_MIN)
+ if(udata->lnk->type >= H5L_TYPE_UD_MIN)
{
- const H5L_link_class_t *link_class; /* User-defined link class */
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
+ const H5L_class_t *link_class; /* User-defined link class */
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(udata->lnk->type)))
@@ -1767,6 +1757,9 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
if((!udata->copy && link_class->move_func != NULL) || (udata->copy && link_class->move_func))
{
+ H5O_loc_t temp_oloc;
+ H5G_name_t temp_path;
+
/* Create a temporary location (or else H5G_open will do a shallow
* copy and wipe out grp_loc)
*/
@@ -1860,23 +1853,23 @@ H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
/* Get object type */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
if(H5G_UNKNOWN == (type = H5O_obj_type(obj_loc->oloc, udata->dxpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object type to move")
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
type = H5G_LINK;
break;
default:
- if(lnk->type < H5L_LINK_UD_MIN)
+ if(lnk->type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unrecognized link type")
type = H5G_UDLINK;
} /* end switch */
/* Set up user data for move_dest_cb */
- if((udata_out.lnk = H5O_link_copy(lnk, NULL, 0)) == NULL)
+ if((udata_out.lnk = H5O_copy(H5O_LINK_ID, lnk, NULL)) == NULL)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved");
/* In this special case, the link's name is going to be replaced at its
* destination, so we should free it here.
@@ -1922,9 +1915,9 @@ done:
*/
if(link_copied)
{
- if(udata_out.lnk->type == H5L_LINK_SOFT)
+ if(udata_out.lnk->type == H5L_TYPE_SOFT)
udata_out.lnk->u.soft.name = H5MM_xfree(udata_out.lnk->u.soft.name);
- else if(udata_out.lnk->type >= H5L_LINK_UD_MIN && udata_out.lnk->u.ud.size > 0)
+ else if(udata_out.lnk->type >= H5L_TYPE_UD_MIN && udata_out.lnk->u.ud.size > 0)
udata_out.lnk->u.ud.udata = H5MM_xfree(udata_out.lnk->u.ud.udata);
/* JAMES: the dest_cb already frees the link name. Hmm. */
H5MM_xfree(udata_out.lnk);
@@ -2048,7 +2041,7 @@ H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const
{
H5L_trav_ud1_t *udata = (H5L_trav_ud1_t *)_udata; /* User data passed in */
H5L_linkinfo_t *linfo = udata->linfo;
- const H5L_link_class_t *link_class; /* User-defined link class */
+ const H5L_class_t *link_class; /* User-defined link class */
ssize_t cb_ret; /* Return value from UD callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2062,21 +2055,22 @@ H5L_get_linfo_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const
if(linfo)
{
linfo->cset = lnk->cset;
- linfo->ctime = lnk->ctime;
- linfo->linkclass = lnk->type;
+ linfo->corder = lnk->corder;
+ linfo->corder_valid = lnk->corder_valid;
+ linfo->type = lnk->type;
switch(lnk->type)
{
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
linfo->u.address = lnk->u.hard.addr;
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
linfo->u.link_size = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/
break;
default:
- if(lnk->type < H5L_LINK_UD_MIN || lnk->type > H5L_LINK_MAX)
+ if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unknown link class")
/* User-defined link; call its query function to get the link udata size. */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index a967d59..44ce345 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -32,9 +32,9 @@ static ssize_t H5L_extern_query(const char UNUSED * link_name, void * udata,
size_t udata_size, void * buf /*out*/, size_t buf_size);
/* Default External Link link class */
-const H5L_link_class_t H5L_EXTERN_LINK_CLASS[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
- H5L_LINK_EXTERNAL, /* Link type id number */
+const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ H5L_TYPE_EXTERNAL, /* Link type id number */
"external_link", /* Link name for debugging */
NULL, /* Creation callback */
NULL, /* Move callback */
@@ -243,7 +243,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HDstrcpy(temp_name + (HDstrlen(file_name) + 1), obj_name);
/* Create an external link */
- if(H5L_create_ud(&link_loc, link_name, temp_name, buf_size, H5L_LINK_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
+ if(H5L_create_ud(&link_loc, link_name, temp_name, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h
index f5e719e..6811049 100644
--- a/src/H5Lpkg.h
+++ b/src/H5Lpkg.h
@@ -35,7 +35,7 @@
/******************************/
H5_DLL herr_t H5L_create_ud(H5G_loc_t *link_loc, const char *link_name,
- const void * ud_data, size_t ud_data_size, H5L_link_t type,
+ const void * ud_data, size_t ud_data_size, H5L_type_t type,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id);
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index bfe3949..0d1c81d 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -53,9 +53,9 @@ H5_DLL herr_t H5L_init(void);
H5_DLL herr_t H5L_register_external(void);
/* User-defined link functions */
-H5_DLL herr_t H5L_register (const H5L_link_class_t *cls);
-H5_DLL herr_t H5L_unregister (H5L_link_t id);
-H5_DLL const H5L_link_class_t *H5L_find_class(H5L_link_t id);
+H5_DLL herr_t H5L_register(const H5L_class_t *cls);
+H5_DLL herr_t H5L_unregister(H5L_type_t id);
+H5_DLL const H5L_class_t *H5L_find_class(H5L_type_t id);
#endif /* _H5Lprivate_H */
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index 2f0bf28..a351ab6 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -34,28 +34,34 @@
extern "C" {
#endif
-/* Link classes.
+/* Maximum length of a link's name */
+/* (encoded in a 32-bit unsigned integer) */
+#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */
+
+/* Link class types.
* Values less than 64 are reserved for the HDF5 library's internal use.
- * Values 64 to 255 are for "user-defined" link types; these types are
+ * Values 64 to 255 are for "user-defined" link class types; these types are
* defined by HDF5 but their behavior can be overridden by users.
* Users who want to create new classes of links should contact the HDF5
* development team at hdfhelp@ncsa.uiuc.edu .
* These values can never change because they appear in HDF5 files.
*/
-typedef int H5L_link_t;
-#define H5L_LINK_ERROR (-1)
-#define H5L_LINK_HARD 0
-#define H5L_LINK_SOFT 1
-#define H5L_LINK_BUILTIN_MAX H5L_LINK_SOFT /* Maximum value link value for "built-in" link types */
-#define H5L_LINK_UD_MIN 64 /*link ids at or above this value are "user-defined" link types. */
-#define H5L_LINK_EXTERNAL 64
-#define H5L_LINK_MAX 255 /*maximum link id */
+typedef enum {
+ H5L_TYPE_ERROR = (-1), /* Invalid link type id */
+ H5L_TYPE_HARD = 0, /* Hard link id */
+ H5L_TYPE_SOFT = 1, /* Soft link id */
+ H5L_TYPE_EXTERNAL = 64, /* External link id */
+ H5L_TYPE_MAX = 255 /* Maximum link type id */
+} H5L_type_t;
+#define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT /* Maximum value link value for "built-in" link types */
+#define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL /* Link ids at or above this value are "user-defined" link types. */
/* Metadata buffer for user query function */
-typedef struct H5L_linkinfo_t {
+typedef struct {
H5T_cset_t cset; /* Character set of link name */
- time_t ctime; /* Creation time */
- H5L_link_t linkclass; /* Type of link */
+ int64_t corder; /* Creation order */
+ hbool_t corder_valid; /* Indicate if creation order is valid */
+ H5L_type_t type; /* Type of link */
union {
haddr_t address; /* Address hard link points to */
size_t link_size; /* Size of a soft link or UD link */
@@ -64,11 +70,11 @@ typedef struct H5L_linkinfo_t {
#define H5L_SAME_LOC 0
-/* The H5L_link_class_t struct can be used to override the behavior of a
+/* The H5L_class_t struct can be used to override the behavior of a
* "user-defined" link class. Users should populate the struct with callback
* functions defined below.
*/
-/* Current version of the H5L_link_class_t struct */
+/* Current version of the H5L_class_t struct */
#define H5L_LINK_CLASS_T_VERS (0)
/* Callback prototypes for user-defined links */
@@ -78,11 +84,11 @@ typedef herr_t (*H5L_create_func_t)(const char * link_name, hid_t loc_group, voi
/* Callback for when the link is moved */
typedef herr_t (*H5L_move_func_t)(const char * new_name, hid_t new_loc, void * udata, size_t udata_size);
-/* Callback for when the link is moved */
+/* Callback for when the link is copied */
typedef herr_t (*H5L_copy_func_t)(const char * new_name, hid_t new_loc, void * udata, size_t udata_size);
-/* The actual link function, called during traversal */
-typedef herr_t (*H5L_func_t)(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id);
+/* Callback during link traversal */
+typedef herr_t (*H5L_traverse_func_t)(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id);
/* Callback for when the link is deleted */
typedef herr_t (*H5L_delete_func_t)(const char * link_name, hid_t loc_group, void * udata, size_t udata_size);
@@ -92,17 +98,17 @@ typedef herr_t (*H5L_delete_func_t)(const char * link_name, hid_t loc_group, voi
typedef ssize_t (*H5L_query_func_t)(const char * link_name, void * udata, size_t udata_size, void * buf /*out*/, size_t buf_size);
/* User-defined link types */
-typedef struct H5L_link_class_t {
+typedef struct {
int version; /* Version number of this struct */
- H5L_link_t id; /* Link type ID */
+ H5L_type_t id; /* Link type ID */
const char *comment; /* Comment for debugging */
H5L_create_func_t create_func; /* Callback during link creation */
H5L_move_func_t move_func; /* Callback after moving link */
H5L_copy_func_t copy_func; /* Callback after copying link */
- H5L_func_t trav_func; /* The main traversal function */
+ H5L_traverse_func_t trav_func; /* Callback during link traversal */
H5L_delete_func_t del_func; /* Callback for link deletion */
H5L_query_func_t query_func; /* Callback for queries */
-} H5L_link_class_t;
+} H5L_class_t;
#define H5L_ELINK_PREFIX_PROP "elink_prefix"
@@ -127,11 +133,11 @@ H5_DLL herr_t H5Lget_linkinfo(hid_t loc_id, const char *name,
/* UD link functions */
H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name,
- H5L_link_t link_type, const void * udata, size_t udata_size,
+ H5L_type_t link_type, const void * udata, size_t udata_size,
hid_t lcpl_id, hid_t lapl_id);
-H5_DLL herr_t H5Lregister(const H5L_link_class_t *cls);
-H5_DLL herr_t H5Lunregister(H5L_link_t id);
-H5_DLL htri_t H5Lis_registered(H5L_link_t id);
+H5_DLL herr_t H5Lregister(const H5L_class_t *cls);
+H5_DLL herr_t H5Lunregister(H5L_type_t id);
+H5_DLL htri_t H5Lis_registered(H5L_type_t id);
/* External link functions */
H5_DLL herr_t H5Lunpack_elink_val(char * ext_linkval/*in*/,
diff --git a/src/H5O.c b/src/H5O.c
index d049777..6657a79 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -111,19 +111,11 @@ typedef struct H5O_addr_map_t {
const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_NULL, /*0x0000 Null */
H5O_MSG_SDSPACE, /*0x0001 Simple Dimensionality */
-#ifdef H5_GROUP_REVISION
H5O_MSG_LINFO, /*0x0002 Link information */
-#else /* H5_GROUP_REVISION */
- NULL,
-#endif /* H5_GROUP_REVISION */
H5O_MSG_DTYPE, /*0x0003 Data Type */
H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
H5O_MSG_FILL_NEW, /*0x0005 New Data storage -- fill value */
-#ifdef H5_GROUP_REVISION
H5O_MSG_LINK, /*0x0006 Link */
-#else /* H5_GROUP_REVISION */
- NULL,
-#endif /* H5_GROUP_REVISION */
H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
H5O_MSG_LAYOUT, /*0x0008 Data Layout */
#ifdef H5O_ENABLE_BOGUS
@@ -131,11 +123,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
#else /* H5O_ENABLE_BOGUS */
NULL, /*0x0009 "Bogus" */
#endif /* H5O_ENABLE_BOGUS */
-#ifdef H5_GROUP_REVISION
H5O_MSG_GINFO, /*0x000A Group Information */
-#else /* H5_GROUP_REVISION */
- NULL,
-#endif /* H5_GROUP_REVISION */
H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
H5O_MSG_ATTR, /*0x000C Attribute list */
H5O_MSG_NAME, /*0x000D Object name */
@@ -458,7 +446,7 @@ H5Oincr_refcount(hid_t object_id)
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Oincr_refcount, FAIL)
- H5TRACE1("Is","i",object_id);
+ H5TRACE1("e","i",object_id);
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_oloc(object_id)) == NULL)
@@ -499,7 +487,7 @@ H5Odecr_refcount(hid_t object_id)
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Odecr_refcount, FAIL)
- H5TRACE1("Is","i",object_id);
+ H5TRACE1("e","i",object_id);
/* Get the object's oloc so we can adjust its link count */
if((oloc = H5O_get_oloc(object_id)) == NULL)
@@ -896,22 +884,22 @@ done:
herr_t
H5O_reset(unsigned type_id, void *native)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- herr_t ret_value; /* Return value */
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_reset,FAIL);
+ FUNC_ENTER_NOAPI(H5O_reset, FAIL)
/* check args */
- assert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- assert(type);
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
/* Call the "real" reset routine */
- if((ret_value=H5O_reset_real(type, native)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to reset object header");
+ if(H5O_reset_real(type, native) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_reset() */
@@ -933,24 +921,23 @@ done:
static herr_t
H5O_reset_real(const H5O_msg_class_t *type, void *native)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_reset_real);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_reset_real)
/* check args */
- assert(type);
+ HDassert(type);
- if (native) {
- if (type->reset) {
- if ((type->reset) (native) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "reset method failed");
- } else {
+ if(native) {
+ if(type->reset) {
+ if((type->reset)(native) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
+ } else
HDmemset(native, 0, type->native_size);
- }
- }
+ } /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_reset_real() */
@@ -972,7 +959,7 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5O_free (unsigned type_id, void *mesg)
+H5O_free(unsigned type_id, void *mesg)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
void * ret_value; /* Return value */
@@ -2011,11 +1998,11 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_msg_class_t *orig_t
} /* end else */
/* Compute the size needed to store the message on disk */
- if ((size = ((*new_type)->raw_size) (f, *new_mesg)) >=H5O_MAX_SIZE)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large");
+ if((size = ((*new_type)->raw_size)(f, *new_mesg)) >=H5O_MAX_SIZE)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large")
/* Allocate space in the object headed for the message */
- if ((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
+ if((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message");
/* Increment any links in message */
@@ -2124,18 +2111,18 @@ H5O_touch_oh(H5F_t *f,
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Create a new message */
- if (idx==oh->nmesgs) {
- if (!force)
+ if(idx == oh->nmesgs) {
+ if(!force)
HGOTO_DONE(SUCCEED); /*nothing to do*/
size = (H5O_MSG_MTIME_NEW->raw_size)(f, &now);
- if ((idx=H5O_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, size, oh_flags_ptr))==UFAIL)
+ if((idx = H5O_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, size, oh_flags_ptr)) == UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message");
- }
+ } /* end if */
/* Update the native part */
- if (NULL==oh->mesg[idx].native) {
- if (NULL==(oh->mesg[idx].native = H5FL_MALLOC(time_t)))
+ if(NULL==oh->mesg[idx].native) {
+ if(NULL==(oh->mesg[idx].native = H5FL_MALLOC(time_t)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for modification time message");
}
*((time_t*)(oh->mesg[idx].native)) = now;
@@ -3324,13 +3311,11 @@ H5O_alloc_new_chunk(H5F_t *f,
(found_attr < 0 ||
oh->mesg[u].raw_size < oh->mesg[found_attr].raw_size))
found_attr = u;
-#ifdef H5_GROUP_REVISION
} else if(H5O_LINK_ID == msg_id) {
if(oh->mesg[u].raw_size >= cont_size &&
(found_link < 0 ||
oh->mesg[u].raw_size < oh->mesg[found_link].raw_size))
found_link = u;
-#endif /* H5_GROUP_REVISION */
} else {
if(oh->mesg[u].raw_size >= cont_size &&
(found_other < 0 ||
@@ -3671,18 +3656,18 @@ H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg)
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
size_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5O_raw_size,0)
+ FUNC_ENTER_NOAPI(H5O_raw_size, 0)
/* Check args */
HDassert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
HDassert(type->raw_size);
HDassert(f);
HDassert(mesg);
/* Compute the raw data size for the mesg */
- if ((ret_value = (type->raw_size)(f, mesg))==0)
+ if((ret_value = (type->raw_size)(f, mesg)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
done:
@@ -3705,16 +3690,16 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg)
+H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg, size_t extra_raw)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
size_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5O_mesg_size,0)
+ FUNC_ENTER_NOAPI(H5O_mesg_size, 0)
/* Check args */
HDassert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
HDassert(type->raw_size);
HDassert(f);
@@ -3724,6 +3709,9 @@ H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg)
if((ret_value = (type->raw_size)(f, mesg)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
+ /* Add in "extra" raw space */
+ ret_value += extra_raw;
+
/* Adjust size for alignment, if necessary */
ret_value = H5O_ALIGN(ret_value);
@@ -3999,37 +3987,38 @@ done:
* slu@ncsa.uiuc.edu
* July 13, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id)
+H5O_encode(H5F_t *f, unsigned char *buf, const void *obj, unsigned type_id)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_encode,FAIL);
+ FUNC_ENTER_NOAPI(H5O_encode,FAIL)
/* check args */
- assert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- assert(type);
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
/* Encode */
- if ((type->encode)(f, buf, obj) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
+ if((type->encode)(f, buf, obj) < 0)
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_encode() */
/*-------------------------------------------------------------------------
* Function: H5O_decode
*
- * Purpose: Decode a binary object(data type and data space only)
- * description and return a new object handle.
+ * Purpose: Decode a binary object description and return a new
+ * object handle.
+ *
+ * Note: This routine is not guaranteed to work with all possible
+ * header messages, use with care.
*
* Return: Success: Pointer to object(data type or space)
*
@@ -4039,30 +4028,28 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-void*
-H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id)
+void *
+H5O_decode(H5F_t *f, hid_t dxpl_id, const unsigned char *buf, unsigned type_id)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- void *ret_value=NULL; /* Return value */
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5O_decode,NULL);
+ FUNC_ENTER_NOAPI(H5O_decode, NULL)
/* check args */
- assert(type_id < NELMTS(H5O_msg_class_g));
- type=H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- assert(type);
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
/* decode */
- if((ret_value = (type->decode)(f, 0, buf))==NULL)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message");
+ if((ret_value = (type->decode)(f, dxpl_id, buf)) == NULL)
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_decode() */
/*-------------------------------------------------------------------------
@@ -4431,7 +4418,6 @@ H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth)
*/
if(src->holding_file)
dst->file->nopen_objs++;
- ;
} else if(depth == H5_COPY_SHALLOW) {
/* Discarding 'const' qualifier OK - QAK */
H5O_loc_reset((H5O_loc_t *)src);
@@ -4772,13 +4758,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message")
} /* end else */
- /*
- * Encode the message. If the message is shared then we
- * encode a Shared Object message instead of the object
- * which is being shared.
- */
- if((copy_type->encode)(oloc_dst->file, mesg_dst->raw, mesg_dst->native) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
+ /* Mark the message in the destination as dirty, so it'll get encoded when the object header is flushed */
+ mesg_dst->dirty = TRUE;
} /* end if (mesg_src->type->copy_file) */
} /* end of mesgno loop */
@@ -4820,22 +4801,14 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HDassert(copy_type);
if(copy_type->post_copy_file && mesg_src->native) {
- hbool_t modified = FALSE;
-
- /* Get destination message */
+ /* Sanity check destination message */
HDassert(mesg_dst->type == mesg_src->type);
-
- /* Make certain the destination's native info is available */
- LOAD_NATIVE(oloc_dst->file, dxpl_id, mesg_dst, FAIL)
+ HDassert(mesg_dst->native);
/* Perform "post copy" operation on messge */
if((copy_type->post_copy_file)(oloc_src, mesg_src->native, oloc_dst,
- mesg_dst->native, &modified, dxpl_id, cpy_info) < 0)
+ mesg_dst->native, dxpl_id, cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to perform 'post copy' operation on message")
-
- /* Mark message and header as dirty if the destination message was modified */
- if(modified)
- mesg_dst->dirty = TRUE;
} /* end if */
} /* end for */
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index 63e8b39..f4e7064 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -33,7 +33,6 @@
#include "H5Opkg.h" /* Object headers */
-#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_ginfo_encode(H5F_t *f, uint8_t *p, const void *_mesg);
@@ -67,6 +66,10 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{
/* Current version of group info information */
#define H5O_GINFO_VERSION 1
+/* Flags for group flag encoding */
+#define H5O_GINFO_FLAG_TRACK_CORDER 0x01
+#define H5O_GINFO_FLAG_INDEX_CORDER 0x02
+
/* Declare a free list to manage the H5O_ginfo_t struct */
H5FL_DEFINE_STATIC(H5O_ginfo_t);
@@ -90,9 +93,10 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t);
*-------------------------------------------------------------------------
*/
static void *
-H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
+H5O_ginfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */
+ unsigned char flags; /* Flags for encoding group info */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_ginfo_decode)
@@ -101,7 +105,7 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
HDassert(f);
HDassert(p);
- /* decode */
+ /* Version of message */
if(*p++ != H5O_GINFO_VERSION)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
@@ -109,8 +113,10 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Get the local heap size hint */
- UINT32DECODE(p, ginfo->lheap_size_hint)
+ /* Get the flags for the group */
+ flags = *p++;
+ ginfo->track_corder = (flags & H5O_GINFO_FLAG_TRACK_CORDER) ? TRUE : FALSE;
+ ginfo->index_corder = (flags & H5O_GINFO_FLAG_INDEX_CORDER) ? TRUE : FALSE;
/* Get the max. # of links to store compactly & the min. # of links to store densely */
UINT32DECODE(p, ginfo->max_compact)
@@ -148,9 +154,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
+H5O_ginfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
- const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
+ const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
+ unsigned char flags; /* Flags for encoding group info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_ginfo_encode)
@@ -162,14 +169,16 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_GINFO_VERSION;
- /* Store the local heap size hint for the group */
- UINT32ENCODE(p, ginfo->lheap_size_hint)
+ /* The flags for the group */
+ flags = ginfo->track_corder ? H5O_GINFO_FLAG_TRACK_CORDER : 0;
+ flags |= ginfo->index_corder ? H5O_GINFO_FLAG_INDEX_CORDER : 0;
+ *p++ = flags;
/* Store the max. # of links to store compactly & the min. # of links to store densely */
UINT32ENCODE(p, ginfo->max_compact)
UINT32ENCODE(p, ginfo->min_dense)
- /* Store the estimated # of entries & name lengths */
+ /* Estimated # of entries & name lengths */
UINT32ENCODE(p, ginfo->est_num_entries)
UINT32ENCODE(p, ginfo->est_name_len)
@@ -240,7 +249,7 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_ginfo_size(const H5F_t UNUSED *f, const void UNUSED *_mesg)
+H5O_ginfo_size(const H5F_t *f, const void UNUSED *_mesg)
{
size_t ret_value; /* Return value */
@@ -248,7 +257,7 @@ H5O_ginfo_size(const H5F_t UNUSED *f, const void UNUSED *_mesg)
/* Set return value */
ret_value = 1 + /* Version */
- 4 + /* Local heap size hint */
+ 1 + /* Flags */
4 + /* "Max compact" links */
4 + /* "Min dense" links */
4 + /* Estimated # of entries in group */
@@ -315,22 +324,19 @@ H5O_ginfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Local heap size hint:", ginfo->lheap_size_hint);
-
+ HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
+ "Track creation order of links:", ginfo->track_corder);
+ HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
+ "Index creation order of links:", ginfo->index_corder);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Max. compact links:", ginfo->max_compact);
-
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Min. dense links:", ginfo->min_dense);
-
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Estimated # of objects in group:", ginfo->est_num_entries);
-
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Estimated length of object in group's name:", ginfo->est_name_len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_ginfo_debug() */
-#endif /* H5_GROUP_REVISION */
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 8017002..57a230f 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -25,23 +25,27 @@
*-------------------------------------------------------------------------
*/
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
+#include "H5Gpkg.h" /* Groups */
#include "H5Opkg.h" /* Object headers */
-#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_linfo_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_linfo_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_linfo_free(void *_mesg);
+static herr_t H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
static void *H5O_linfo_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
+static herr_t H5O_linfo_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
+ void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_linfo_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -56,19 +60,28 @@ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{
H5O_linfo_size, /*size of symbol table entry */
NULL, /*default reset method */
H5O_linfo_free, /* free method */
- NULL, /* file delete method */
+ H5O_linfo_delete, /* file delete method */
NULL, /* link method */
NULL, /*get share method */
NULL, /*set share method */
NULL, /* pre copy native value to file */
H5O_linfo_copy_file, /* copy native value to file */
- NULL, /* post copy native value to file */
+ H5O_linfo_post_copy_file, /* post copy native value to file */
H5O_linfo_debug /*debug the message */
}};
/* Current version of link info information */
#define H5O_LINFO_VERSION 1
+/* Data exchange structure to use when copying links from src to dst */
+typedef struct {
+ const H5O_loc_t *src_oloc; /* Source object location */
+ H5O_loc_t *dst_oloc; /* Destination object location */
+ H5O_linfo_t *dst_linfo; /* Destination object's link info message */
+ hid_t dxpl_id; /* DXPL for operation */
+ H5O_copy_t *cpy_info; /* Information for copy operation */
+} H5O_linfo_postcopy_ud_t;
+
/* Declare a free list to manage the hsize_t struct */
H5FL_DEFINE_STATIC(H5O_linfo_t);
@@ -111,9 +124,22 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if (NULL == (linfo = H5FL_MALLOC(H5O_linfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Get the number of links in the group */
+ /* Number of links in the group */
H5F_DECODE_LENGTH(f, p, linfo->nlinks)
+ /* Min. & max creation order value for the group */
+ INT64DECODE(p, linfo->min_corder)
+ INT64DECODE(p, linfo->max_corder)
+
+ /* Address of fractal heap to store "dense" links */
+ H5F_addr_decode(f, &p, &(linfo->link_fheap_addr));
+
+ /* Address of v2 B-tree to index names of links */
+ H5F_addr_decode(f, &p, &(linfo->name_bt2_addr));
+
+ /* Address of v2 B-tree to index creation order of links */
+ H5F_addr_decode(f, &p, &(linfo->corder_bt2_addr));
+
/* Set return value */
ret_value = linfo;
@@ -156,9 +182,22 @@ H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_LINFO_VERSION;
- /* Store the number of links in the group */
+ /* Number of links in the group */
H5F_ENCODE_LENGTH(f, p, linfo->nlinks)
+ /* Min. & max creation order value for the group */
+ INT64ENCODE(p, linfo->min_corder)
+ INT64ENCODE(p, linfo->max_corder)
+
+ /* Address of fractal heap to store "dense" links */
+ H5F_addr_encode(f, &p, linfo->link_fheap_addr);
+
+ /* Address of v2 B-tree to index names of links */
+ H5F_addr_encode(f, &p, linfo->name_bt2_addr);
+
+ /* Address of v2 B-tree to index creation order of links */
+ H5F_addr_encode(f, &p, linfo->corder_bt2_addr);
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_encode() */
@@ -199,7 +238,7 @@ H5O_linfo_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
*dest = *linfo;
/* Set return value */
- ret_value=dest;
+ ret_value = dest;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -233,8 +272,13 @@ H5O_linfo_size(const H5F_t *f, const void UNUSED *_mesg)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_linfo_size)
/* Set return value */
- ret_value = 1 + /* Version */
- H5F_SIZEOF_SIZE(f); /* Number of links */
+ ret_value = 1 /* Version */
+ + H5F_SIZEOF_SIZE(f) /* Number of links */
+ + 8 /* Min. creation order value */
+ + 8 /* Max. creation order value */
+ + H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" links */
+ + H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of links */
+ + H5F_SIZEOF_ADDR(f); /* Address of v2 B-tree for indexing creation order values of links */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_linfo_size() */
@@ -268,6 +312,40 @@ H5O_linfo_free(void *mesg)
/*-------------------------------------------------------------------------
+ * Function: H5O_linfo_delete
+ *
+ * Purpose: Free file space referenced by message
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, September 16, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
+{
+ const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_delete)
+
+ /* check args */
+ HDassert(f);
+ HDassert(linfo);
+
+ /* If the group is using "dense" link storage, delete it */
+ if(H5F_addr_defined(linfo->link_fheap_addr))
+ if(H5G_dense_delete(f, dxpl_id, (H5O_linfo_t *)linfo, adj_link) < 0) /* Casting away const OK - QAK */
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense link storage")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_linfo_delete() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_linfo_copy_file
*
* Purpose: Copies a message from _MESG to _DEST in file
@@ -282,8 +360,8 @@ H5O_linfo_free(void *mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_dst,
- hid_t UNUSED dxpl_id, H5O_copy_t *cpy_info, void UNUSED *udata)
+H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst,
+ hid_t dxpl_id, H5O_copy_t *cpy_info, void UNUSED *udata)
{
H5O_linfo_t *linfo_src = (H5O_linfo_t *) native_src;
H5O_linfo_t *linfo_dst = NULL;
@@ -300,11 +378,26 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "memory allocation failed")
/* If we are performing a 'shallow hierarchy' copy, and the links in this
- * group won't be included in the destination, reset the link count for
+ * group won't be included in the destination, reset the link info for
* this group.
*/
- if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth)
+ if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth) {
linfo_dst->nlinks = 0;
+ linfo_dst->min_corder = linfo_dst->max_corder = 0;
+ linfo_dst->link_fheap_addr = HADDR_UNDEF;
+ linfo_dst->name_bt2_addr = HADDR_UNDEF;
+ linfo_dst->corder_bt2_addr = HADDR_UNDEF;
+ } /* end if */
+ else {
+ /* Create the components of the dense link storage for the destination group */
+ /* (XXX: should probably get the "creation" parameters for the source group's
+ * dense link storage components and use those - QAK)
+ */
+ if(H5F_addr_defined(linfo_src->link_fheap_addr)) {
+ if(H5G_dense_create(file_dst, dxpl_id, linfo_dst) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create 'dense' form of new format group")
+ } /* end if */
+ } /* end else */
/* Set return value */
ret_value = linfo_dst;
@@ -319,6 +412,114 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_linfo_post_copy_file_cb
+ *
+ * Purpose: Callback routine for copying links from src to dst file
+ * during "post copy" routine
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sept 26 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata)
+{
+ H5O_linfo_postcopy_ud_t *udata = (H5O_linfo_postcopy_ud_t *)_udata; /* 'User data' passed in */
+ H5O_link_t dst_lnk; /* Destination link to insert */
+ hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
+ herr_t ret_value = H5B2_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_post_copy_file_cb)
+
+ /* Check arguments */
+ HDassert(src_lnk);
+ HDassert(udata);
+
+ /* Copy the link (and the object it points to) */
+ if(H5G_link_copy_file(udata->dst_oloc->file, udata->dxpl_id, src_lnk,
+ udata->src_oloc, &dst_lnk, udata->cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B2_ITER_ERROR, "unable to copy link")
+ dst_lnk_init = TRUE;
+
+ /* Insert the new object in the destination file's group */
+ /* (Doesn't increment the link count - that's already been taken care of for hard links) */
+ if(H5G_dense_insert(udata->dst_oloc->file, udata->dxpl_id, udata->dst_linfo, &dst_lnk) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5B2_ITER_ERROR, "unable to insert destination link")
+
+done:
+ /* Check if the destination link has been initialized */
+ if(dst_lnk_init)
+ H5O_reset(H5O_LINK_ID, &dst_lnk);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_linfo_post_copy_file_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_linfo_post_copy_file
+ *
+ * Purpose: Finish copying a message from between files
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * September 26, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_linfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
+ H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
+{
+ const H5O_linfo_t *linfo_src = (const H5O_linfo_t *)mesg_src;
+ H5O_linfo_t *linfo_dst = (H5O_linfo_t *)mesg_dst;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_post_copy_file)
+
+ /* check args */
+ HDassert(src_oloc && src_oloc->file);
+ HDassert(linfo_src);
+ HDassert(dst_oloc && dst_oloc->file);
+ HDassert(H5F_addr_defined(dst_oloc->addr));
+ HDassert(linfo_dst);
+ HDassert(cpy_info);
+
+ /* If we are performing a 'shallow hierarchy' copy, get out now */
+ if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth)
+ HGOTO_DONE(SUCCEED)
+
+ /* Check for copying dense link storage */
+ if(H5F_addr_defined(linfo_src->link_fheap_addr)) {
+ H5O_linfo_postcopy_ud_t udata; /* User data for iteration callback */
+ H5G_link_iterate_t lnk_op; /* Link operator */
+
+ /* Set up dense link iteration user data */
+ udata.src_oloc = src_oloc;
+ udata.dst_oloc = dst_oloc;
+ udata.dst_linfo = linfo_dst;
+ udata.dxpl_id = dxpl_id;
+ udata.cpy_info = cpy_info;
+
+ /* Build iterator operator */
+ lnk_op.lib_op = H5O_linfo_post_copy_file_cb;
+
+ /* Iterate over the links in the group, building a table of the link messages */
+ if(H5G_dense_iterate(src_oloc->file, dxpl_id, H5_ITER_NATIVE, 0, linfo_src, TRUE, 0, NULL, lnk_op, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5O_linfo_post_copy_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_linfo_debug
*
* Purpose: Prints debugging info for a message.
@@ -350,8 +551,18 @@ H5O_linfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Number of links:", linfo->nlinks);
+ HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth,
+ "Min. creation order value:", linfo->min_corder);
+ HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth,
+ "Max. creation order value:", linfo->max_corder);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "'Dense' link storage fractal heap address:", linfo->link_fheap_addr);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "'Dense' link storage name index v2 B-tree address:", linfo->name_bt2_addr);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "'Dense' link storage creation order index v2 B-tree address:", linfo->corder_bt2_addr);
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_debug() */
-#endif /* H5_GROUP_REVISION */
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 039184d..7d2b694 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -20,24 +20,24 @@
*
* Purpose: Link messages.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
+#include "H5Gpkg.h" /* Groups */
#include "H5MMprivate.h" /* Memory management */
#include "H5Opkg.h" /* Object headers */
-#ifdef H5_GROUP_REVISION
/* PRIVATE PROTOTYPES */
static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p);
static herr_t H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg);
+static void *H5O_link_copy(const void *_mesg, void *_dest, unsigned update_flags);
static size_t H5O_link_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_link_reset(void *_mesg);
static herr_t H5O_link_free(void *_mesg);
@@ -46,8 +46,8 @@ static herr_t H5O_link_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *typ
void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static void *H5O_link_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
-static herr_t H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
- void *mesg_dst, hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info);
+static herr_t H5O_link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
+ void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_link_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -75,12 +75,12 @@ const H5O_msg_class_t H5O_MSG_LINK[1] = {{
/* Current version of link information */
#define H5O_LINK_VERSION 1
-#endif /* H5_GROUP_REVISION */
+/* Flags for link flag encoding */
+#define H5O_LINK_FLAG_HAS_CORDER 0x01
/* Declare a free list to manage the H5O_link_t struct */
H5FL_DEFINE_STATIC(H5O_link_t);
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5O_link_decode
@@ -96,16 +96,14 @@ H5FL_DEFINE_STATIC(H5O_link_t);
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
H5O_link_t *lnk = NULL; /* Pointer to link message */
- uint16_t len; /* Length of a string in the message */
- uint32_t tmp_time; /* Temporary copy of the time */
+ size_t len; /* Length of a string in the message */
+ unsigned char link_flags; /* Flags for encoding link info */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_decode)
@@ -122,14 +120,23 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
if(NULL == (lnk = H5FL_CALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ /* Get the encoding flags for the link */
+ link_flags = *p++;
+
/* Get the type of the link */
lnk->type = *p++;
- if(lnk->type < H5L_LINK_HARD || lnk->type > H5L_LINK_MAX)
+ if(lnk->type < H5L_TYPE_HARD || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad link type")
/* Get the link creation time from the file */
- UINT32DECODE(p, tmp_time)
- lnk->ctime = (time_t)tmp_time;
+ if(link_flags & H5O_LINK_FLAG_HAS_CORDER) {
+ INT64DECODE(p, lnk->corder)
+ lnk->corder_valid = TRUE;
+ } /* end if */
+ else {
+ lnk->corder = 0;
+ lnk->corder_valid = FALSE;
+ } /* end else */
/* Get the link name's character set */
lnk->cset = (H5T_cset_t)*p++;
@@ -137,10 +144,10 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad cset type")
/* Get the link's name */
- UINT16DECODE(p, len)
+ UINT32DECODE(p, len)
if(len == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid name length")
- if(NULL == (lnk->name = H5MM_malloc((size_t)len + 1)))
+ if(NULL == (lnk->name = H5MM_malloc(len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(lnk->name, p, len);
lnk->name[len] = '\0';
@@ -148,12 +155,12 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* Get the appropriate information for each type of link */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
/* Get the address of the object the link points to */
H5F_addr_decode(f, &p, &(lnk->u.hard.addr));
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
/* Get the link value */
UINT16DECODE(p, len)
if(len == 0)
@@ -167,7 +174,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* User-defined links */
default:
- if(lnk->type < H5L_LINK_UD_MIN || lnk->type > H5L_LINK_MAX)
+ if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown link type")
/* A UD link. Get the user-supplied data */
@@ -185,16 +192,16 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
} /* end switch */
/* Set return value */
- ret_value=lnk;
+ ret_value = lnk;
done:
if(ret_value == NULL)
if(lnk != NULL) {
if(lnk->name != NULL)
H5MM_xfree(lnk->name);
- if(lnk->type == H5L_LINK_SOFT && lnk->u.soft.name != NULL)
+ if(lnk->type == H5L_TYPE_SOFT && lnk->u.soft.name != NULL)
H5MM_xfree(lnk->u.soft.name);
- if(lnk->type >= H5L_LINK_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL)
+ if(lnk->type >= H5L_TYPE_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL)
H5MM_xfree(lnk->u.ud.udata);
H5FL_FREE(H5O_link_t, lnk);
} /* end if */
@@ -214,16 +221,14 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
- uint16_t len; /* Length of a string in the message */
- uint32_t tmp_time; /* Temporary copy of the time */
+ size_t len; /* Length of a string in the message */
+ unsigned char link_flags; /* Flags for encoding link info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_link_encode)
@@ -235,31 +240,35 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* encode */
*p++ = H5O_LINK_VERSION;
+ /* The encoding flags for the link */
+ link_flags = lnk->corder_valid ? H5O_LINK_FLAG_HAS_CORDER : 0;
+ *p++ = link_flags;
+
/* Store the type of the link */
*p++ = lnk->type;
- /* Store the link creation time from the file */
- tmp_time = lnk->ctime;
- UINT32ENCODE(p, tmp_time)
+ /* Store the link creation order in the file, if its valid */
+ if(lnk->corder_valid)
+ INT64ENCODE(p, lnk->corder)
/* Store the link name's character set */
*p++ = (uint8_t)lnk->cset;
/* Store the link's name */
- len = (uint16_t)HDstrlen(lnk->name);
+ len = HDstrlen(lnk->name);
HDassert(len > 0);
- UINT16ENCODE(p, len)
+ UINT32ENCODE(p, (uint32_t)len)
HDmemcpy(p, lnk->name, len);
p += len;
/* Store the appropriate information for each type of link */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
/* Store the address of the object the link points to */
H5F_addr_encode(f, &p, lnk->u.hard.addr);
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
/* Store the link value */
len = (uint16_t)HDstrlen(lnk->u.soft.name);
HDassert(len > 0);
@@ -270,7 +279,7 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* User-defined links */
default:
- HDassert(lnk->type >= H5L_LINK_UD_MIN && lnk->type <= H5L_LINK_MAX);
+ HDassert(lnk->type >= H5L_TYPE_UD_MIN && lnk->type <= H5L_TYPE_MAX);
/* Store the user-supplied data, however long it is */
len = (uint16_t)lnk->u.ud.size;
@@ -285,7 +294,6 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_link_encode() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -302,11 +310,9 @@ H5O_link_encode(H5F_t *f, uint8_t *p, const void *_mesg)
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-void *
+static void *
H5O_link_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
@@ -315,35 +321,40 @@ H5O_link_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy)
- /* check args */
+ /* Check args */
HDassert(lnk);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* copy */
+ /* Copy static information */
*dest = *lnk;
+
+ /* Duplicate the link's name */
HDassert(lnk->name);
- dest->name = H5MM_xstrdup(lnk->name);
- if(lnk->type == H5L_LINK_SOFT)
- dest->u.soft.name = H5MM_xstrdup(lnk->u.soft.name);
- else if(lnk->type >= H5L_LINK_UD_MIN) {
- if(lnk->u.ud.size > 0)
- {
+ if(NULL == (dest->name = H5MM_xstrdup(lnk->name)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate link name")
+
+ /* Copy other information needed for different link types */
+ if(lnk->type == H5L_TYPE_SOFT) {
+ if(NULL == (dest->u.soft.name = H5MM_xstrdup(lnk->u.soft.name)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate soft link value")
+ } /* end if */
+ else if(lnk->type >= H5L_TYPE_UD_MIN) {
+ if(lnk->u.ud.size > 0) {
if(NULL == (dest->u.ud.udata = H5MM_malloc(lnk->u.ud.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size);
- }
- }/* end if */
+ } /* end if */
+ } /* end if */
/* Set return value */
- ret_value=dest;
+ ret_value = dest;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link_copy() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5O_link_size
*
@@ -371,25 +382,26 @@ H5O_link_size(const H5F_t *f, const void *_mesg)
/* Set return value */
ret_value = 1 + /* Version */
+ 1 + /* Link encoding flags */
1 + /* Link type */
- 4 + /* Creation time */
+ (lnk->corder_valid ? 8 : 0) + /* Creation order */
1 + /* Character set */
- 2 + /* Name length */
+ 4 + /* Name length */
HDstrlen(lnk->name); /* Name */
/* Add the appropriate length for each type of link */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
ret_value += H5F_SIZEOF_ADDR(f);
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
ret_value += 2 + /* Link value length */
HDstrlen(lnk->u.soft.name); /* Link value */
break;
default: /* Default is user-defined link type */
- HDassert(lnk->type >= H5L_LINK_UD_MIN);
+ HDassert(lnk->type >= H5L_TYPE_UD_MIN);
ret_value += 2 + /* User-defined data size */
lnk->u.ud.size; /* User-defined data */
break;
@@ -421,13 +433,11 @@ H5O_link_reset(void *_mesg)
if(lnk) {
/* Free information for link (but don't free link pointer) */
- if(lnk->type == H5L_LINK_SOFT)
+ if(lnk->type == H5L_TYPE_SOFT)
lnk->u.soft.name = H5MM_xfree(lnk->u.soft.name);
- else if (lnk->type >= H5L_LINK_UD_MIN) {
+ else if (lnk->type >= H5L_TYPE_UD_MIN) {
if(lnk->u.ud.size > 0)
- {
- lnk->u.ud.udata = H5MM_xfree(lnk->u.ud.udata);
- }
+ lnk->u.ud.udata = H5MM_xfree(lnk->u.ud.udata);
} /* end if */
lnk->name = H5MM_xfree(lnk->name);
} /* end if */
@@ -489,8 +499,8 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
HDassert(f);
HDassert(lnk);
- /* Decrement reference count to the object, for hard links */
- if(lnk->type == H5L_LINK_HARD) {
+ /* Decrement reference count to the object (if requested), for hard links */
+ if(lnk->type == H5L_TYPE_HARD && adj_link) {
H5O_loc_t oloc;
/* Construct object location for object, in order to decrement it's ref count */
@@ -499,10 +509,9 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
HDassert(H5F_addr_defined(lnk->u.hard.addr));
oloc.addr = lnk->u.hard.addr;
- /* Decrement the ref count for the object, if requested */
- if(adj_link)
- if(H5O_link(&oloc, -1, dxpl_id)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count")
+ /* Decrement the ref count for the object */
+ if(H5O_link(&oloc, -1, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count")
} /* end if */
done:
@@ -566,56 +575,25 @@ static void *
H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_dst,
hid_t UNUSED dxpl_id, H5O_copy_t UNUSED *cpy_info, void UNUSED *udata)
{
- H5O_link_t *link_src = (H5O_link_t *) native_src;
- H5O_link_t *link_dst = NULL;
- void *ret_value; /* Return value */
+ H5O_link_t *link_src = (H5O_link_t *)native_src;
+ H5O_link_t *link_dst = NULL;
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy_file)
/* check args */
HDassert(link_src);
- HDassert(file_dst);
HDassert(cpy_info);
HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth);
- /* Allocate space for the destination stab */
- if(NULL == (link_dst = H5FL_MALLOC(H5O_link_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* Copy top-level information */
- *link_dst = *link_src;
-
- /* Deep copy the link's name */
- if(NULL == (link_dst->name = H5MM_xstrdup(link_src->name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* "Deep copy" other information for each kind of link */
- switch(link_src->type) {
- case H5L_LINK_HARD:
- /* Set link's address undefined here, will be fixed up in "post copy" callback */
- link_dst->u.hard.addr = HADDR_UNDEF;
- break;
-
- case H5L_LINK_SOFT:
- /* Copy the soft link's value */
- if(NULL == (link_dst->u.soft.name = H5MM_xstrdup(link_src->u.soft.name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- break;
+ /* Sanity check source link type */
+ if(link_src->type > H5L_TYPE_SOFT && link_src->type < H5L_TYPE_UD_MIN)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "unrecognized built-in link type")
- default:
- if(link_src->type >= H5L_LINK_UD_MIN)
- {
- /* Copy the user-defined link's user data if it exists */
- if(link_src->u.ud.size > 0)
- {
- if(NULL == (link_dst->u.ud.udata = H5MM_malloc(link_src->u.ud.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(link_dst->u.ud.udata, link_src->u.ud.udata, link_src->u.ud.size);
- }
- }
- else
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "unrecognized link type")
- } /* end switch */
+ /* Allocate "blank" link for destination */
+ /* (values will be filled in during 'post copy' operation) */
+ if(NULL == (link_dst = H5FL_CALLOC(H5O_link_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set return value */
ret_value = link_dst;
@@ -623,7 +601,7 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_
done:
if(!ret_value)
if(link_dst)
- H5FL_FREE(H5O_link_t, link_dst);
+ H5O_link_free(link_dst);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_link_copy_file() */
@@ -642,13 +620,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst,
- hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info)
+H5O_link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
+ H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
- H5O_link_t *link_src = (H5O_link_t *)mesg_src; /* Casting away const OK... -QAK */
- H5O_link_t tmp_link_src;
- H5O_link_t *link_dst = (H5O_link_t *)mesg_dst;
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_link_t *link_src = (const H5O_link_t *)mesg_src;
+ H5O_link_t *link_dst = (H5O_link_t *)mesg_dst;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_post_copy_file)
@@ -658,82 +635,13 @@ H5O_link_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src,
HDassert(H5F_addr_defined(dst_oloc->addr));
HDassert(dst_oloc->file);
HDassert(link_dst);
- HDassert(modified && *modified == FALSE);
HDassert(cpy_info);
HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth);
- /* Expand soft link */
- if(H5L_LINK_SOFT == link_src->type && cpy_info->expand_soft_link) {
- H5G_stat_t statbuf; /* Information about object pointed to by soft link */
- H5G_loc_t grp_loc; /* Group location for parent of soft link */
- H5G_name_t grp_path; /* Path for parent of soft link */
-
- /* Make a temporary copy, so that it will not change the info in the cache */
- HDmemcpy(&tmp_link_src, link_src, sizeof(H5O_link_t));
- link_src = &tmp_link_src;
-
- /* Set up group location for soft link to start in */
- H5G_name_reset(&grp_path);
- grp_loc.path = &grp_path;
- grp_loc.oloc = (H5O_loc_t *)parent_src_oloc; /* Casting away const OK... -QAK */
-
- /* Check if the object pointed by the soft link exists in the source file */
- /* (It would be more efficient to make a specialized traversal callback,
- * but this is good enough for now... -QAK)
- */
- if(H5G_get_objinfo(&grp_loc, link_src->u.soft.name, TRUE, &statbuf, H5AC_ind_dxpl_id) >= 0) {
- /* Convert temp. copy of source soft link to hard link */
-#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- link_src->u.hard.addr = (((haddr_t)statbuf.objno[1]) << (8 * sizeof(long))) | (haddr_t)statbuf.objno[0];
-#else
- link_src->u.hard.addr = statbuf.objno[0];
-#endif
- link_src->type = H5L_LINK_HARD;
-
- /* Convert destination link to hard link */
- link_dst->type = H5L_LINK_HARD;
- link_dst->u.soft.name = H5MM_xfree(link_dst->u.soft.name);
- } /* end if */
- } /* if ((H5G_CACHED_SLINK == src_ent->type)... */
-
- /* Additional "deep copy" for each kind of link */
- switch(link_src->type) {
- case H5L_LINK_HARD:
- /* Copy the object pointed to */
- {
- H5O_loc_t src_oloc; /* Temporary object location for source object */
- H5O_loc_t new_oloc; /* Temporary object location for source object */
-
- /* Build temporary object location for source */
- H5O_loc_reset(&src_oloc);
- src_oloc.file = parent_src_oloc->file;
- HDassert(H5F_addr_defined(link_src->u.hard.addr));
- src_oloc.addr = link_src->u.hard.addr;
-
- /* Build temporary object location for destination */
- H5O_loc_reset(&new_oloc);
- new_oloc.file = dst_oloc->file;
-
- /* Copy the shared object from source to destination */
- if(H5O_copy_header_map(&src_oloc, &new_oloc, dxpl_id, cpy_info, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
-
- /* Update link information with new destination object's address */
- link_dst->u.hard.addr = new_oloc.addr;
-
- /* Indicate that the destination message was modified */
- *modified = TRUE;
- } /* end case */
- break;
-
- case H5L_LINK_SOFT:
- case H5L_LINK_EXTERNAL:
- HGOTO_DONE(SUCCEED)
- break;
-
- default:
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
- } /* end switch */
+ /* Copy the link (and the object it points to) */
+ if(H5G_link_copy_file(dst_oloc->file, dxpl_id, link_src, src_oloc, link_dst,
+ cpy_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy link")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -751,19 +659,16 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 29 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * stream,
int indent, int fwidth)
{
- const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
- struct tm *tm;
- char buf[128];
+ const H5O_link_t *lnk = (const H5O_link_t *) _mesg;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_link_debug)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_link_debug)
/* check args */
HDassert(f);
@@ -773,15 +678,14 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Link Type:", (lnk->type == H5L_LINK_HARD ? "Hard" :
- (lnk->type == H5L_LINK_SOFT ? "Soft" :
- (lnk->type == H5L_LINK_EXTERNAL ? "External" :
- (lnk->type >= H5L_LINK_UD_MIN ? "User-defined" : "Unknown")))));
+ "Link Type:", (lnk->type == H5L_TYPE_HARD ? "Hard" :
+ (lnk->type == H5L_TYPE_SOFT ? "Soft" :
+ (lnk->type == H5L_TYPE_EXTERNAL ? "External" :
+ (lnk->type >= H5L_TYPE_UD_MIN ? "User-defined" : "Unknown")))));
- tm = HDlocaltime(&(lnk->ctime));
- HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Creation Time:", buf);
+ if(lnk->corder_valid)
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Creation Order:", lnk->corder);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Name Character Set:", (lnk->cset == H5T_CSET_ASCII ?
@@ -789,31 +693,39 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Name:", lnk->name);
+ /* Display link-specific information */
switch(lnk->type) {
- case H5L_LINK_HARD:
+ case H5L_TYPE_HARD:
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Object address:", lnk->u.hard.addr);
break;
- case H5L_LINK_SOFT:
+ case H5L_TYPE_SOFT:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Value:", lnk->u.soft.name);
break;
- case H5L_LINK_EXTERNAL:
- {
- char * objname = (char *) lnk->u.ud.udata + (HDstrlen(lnk->u.ud.udata) + 1);
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Link File Name:", lnk->u.ud.udata);
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Link Object Name:", objname);
- }
-
default:
+ if(lnk->type >= H5L_TYPE_UD_MIN) {
+ if(lnk->type == H5L_TYPE_EXTERNAL) {
+ const char * objname = (const char *)lnk->u.ud.udata + (HDstrlen(lnk->u.ud.udata) + 1);
+
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "External File Name:", lnk->u.ud.udata);
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "External Object Name:", objname);
+ } /* end if */
+ else {
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ "User-Defined Link Size:", lnk->u.ud.size);
+ } /* end else */
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
break;
} /* end switch */
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link_debug() */
-#endif /* H5_GROUP_REVISION */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 092de03..35fc5f9 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -74,7 +74,7 @@ struct H5O_msg_class_t {
herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*); /* Set shared information */
herr_t (*pre_copy_file)(H5F_t *, const H5O_msg_class_t *, void *, hbool_t *, const H5O_copy_t *, void *); /*"pre copy" action when copying native value to file */
void *(*copy_file)(H5F_t *, void *, H5F_t *, hid_t, H5O_copy_t *, void *); /*copy native value to file */
- herr_t (*post_copy_file)(const H5O_loc_t *, const void *, H5O_loc_t *, void *, hbool_t *, hid_t, H5O_copy_t *); /*"post copy" action when copying native value to file */
+ herr_t (*post_copy_file)(const H5O_loc_t *, const void *, H5O_loc_t *, void *, hid_t, H5O_copy_t *); /*"post copy" action when copying native value to file */
herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int);
};
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 10b6c31..ead851e 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -84,21 +84,15 @@ typedef struct H5O_copy_t {
/* Header message IDs */
#define H5O_NULL_ID 0x0000 /* Null Message. */
#define H5O_SDSPACE_ID 0x0001 /* Simple Dataspace Message. */
-#ifdef H5_GROUP_REVISION
#define H5O_LINFO_ID 0x0002 /* Link Info Message. */
-#endif /* H5_GROUP_REVISION */
#define H5O_DTYPE_ID 0x0003 /* Datatype Message. */
#define H5O_FILL_ID 0x0004 /* Fill Value Message. (Old) */
#define H5O_FILL_NEW_ID 0x0005 /* Fill Value Message. (New) */
-#ifdef H5_GROUP_REVISION
#define H5O_LINK_ID 0x0006 /* Link Message. */
-#endif /* H5_GROUP_REVISION */
#define H5O_EFL_ID 0x0007 /* External File List Message */
#define H5O_LAYOUT_ID 0x0008 /* Data Storage Layout Message. */
#define H5O_BOGUS_ID 0x0009 /* "Bogus" Message. */
-#ifdef H5_GROUP_REVISION
#define H5O_GINFO_ID 0x000a /* Group Info Message. */
-#endif /* H5_GROUP_REVISION */
#define H5O_PLINE_ID 0x000b /* Filter pipeline message. */
#define H5O_ATTR_ID 0x000c /* Attribute Message. */
#define H5O_NAME_ID 0x000d /* Object name message. */
@@ -108,15 +102,19 @@ typedef struct H5O_copy_t {
#define H5O_STAB_ID 0x0011 /* Symbol table message. */
#define H5O_MTIME_NEW_ID 0x0012 /* Modification time message. (New) */
-#ifdef H5_GROUP_REVISION
/*
* Link Info Message.
+ * (Contains dynamic information about links in a group)
* (Data structure in memory)
*/
typedef struct H5O_linfo_t {
- hsize_t nlinks; /* Number of links in the group */
+ hsize_t nlinks; /* Number of links in the group */
+ int64_t min_corder; /* Min. creation order value for group */
+ int64_t max_corder; /* Max. creation order value for group */
+ haddr_t link_fheap_addr; /* Address of fractal heap for storing "dense" links */
+ haddr_t name_bt2_addr; /* Address of v2 B-tree for indexing names of links */
+ haddr_t corder_bt2_addr; /* Address of v2 B-tree for indexing creation order values of links */
} H5O_linfo_t;
-#endif /* H5_GROUP_REVISION */
/*
* Fill Value Message. (Old)
@@ -161,8 +159,9 @@ typedef struct H5O_link_ud_t {
} H5O_link_ud_t;
typedef struct H5O_link_t {
- H5L_link_t type; /* Type of link */
- time_t ctime; /* Time link was createed */
+ H5L_type_t type; /* Type of link */
+ hbool_t corder_valid; /* Creation order for link is valid (not stored) */
+ int64_t corder; /* Creation order for link (stored if it's valid) */
H5T_cset_t cset; /* Character set of link name */
char *name; /* Link name */
union {
@@ -244,14 +243,20 @@ typedef struct H5O_bogus_t {
/*
* Group info message.
+ * (Contains static information about a group)
* (Data structure in memory)
*/
typedef struct H5O_ginfo_t {
- size_t lheap_size_hint; /* Local heap size hint */
- unsigned max_compact; /* Maximum # of compact links */
- unsigned min_dense; /* Minimum # of "dense" links */
- unsigned est_num_entries; /* Estimated # of entries in group */
- unsigned est_name_len; /* Estimated length of entry name */
+ /* "Old" format group info (not stored) */
+ uint32_t lheap_size_hint; /* Local heap size hint */
+
+ /* "New" format group info (stored) */
+ hbool_t track_corder; /* Are creation order values tracked on links? */
+ hbool_t index_corder; /* Are creation order values indexed on links? */
+ uint32_t max_compact; /* Maximum # of compact links */
+ uint32_t min_dense; /* Minimum # of "dense" links */
+ uint32_t est_num_entries; /* Estimated # of entries in group */
+ uint32_t est_name_len; /* Estimated length of entry name */
} H5O_ginfo_t;
/*
@@ -355,11 +360,13 @@ H5_DLL herr_t H5O_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence
H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id);
H5_DLL herr_t H5O_reset(unsigned type_id, void *native);
H5_DLL void *H5O_free(unsigned type_id, void *mesg);
-H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id);
-H5_DLL void* H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id);
+H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, const void *obj, unsigned type_id);
+H5_DLL void* H5O_decode(H5F_t *f, hid_t dxpl_id, const unsigned char *buf,
+ unsigned type_id);
H5_DLL void *H5O_copy(unsigned type_id, const void *mesg, void *dst);
H5_DLL size_t H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg);
-H5_DLL size_t H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg);
+H5_DLL size_t H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg,
+ size_t extra_raw);
H5_DLL herr_t H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share);
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5O_get_info(H5O_loc_t *loc, H5O_stat_t *ostat, hid_t dxpl_id);
@@ -378,12 +385,6 @@ H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, in
int fwidth);
/*
- * These functions operate on links
- */
-H5_DLL void *H5O_link_copy(const void *_mesg, void *_dest, unsigned update_flags);
-
-
-/*
* These functions operate on object locations
*/
H5_DLL herr_t H5O_loc_reset(H5O_loc_t *loc);
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index d641bc5..c15d676 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -45,8 +45,8 @@ static herr_t H5O_stab_free(void *_mesg);
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
static void *H5O_stab_copy_file(H5F_t *file_src, void *native_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
-static herr_t H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
- void *mesg_dst, hbool_t *modified, hid_t dxpl_id, H5O_copy_t *cpy_info);
+static herr_t H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
+ void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -272,23 +272,21 @@ H5O_stab_free (void *mesg)
* Programmer: Quincey Koziol
* Thursday, March 20, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *mesg, hbool_t adj_link)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_delete)
/* check args */
- assert(f);
- assert(mesg);
+ HDassert(f);
+ HDassert(mesg);
/* Free the file space for the symbol table */
- if (H5G_stab_delete(f, dxpl_id, mesg, adj_link)<0)
+ if(H5G_stab_delete(f, dxpl_id, mesg, adj_link) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table")
done:
@@ -362,19 +360,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
- void *mesg_dst, hbool_t UNUSED *modified, hid_t dxpl_id, H5O_copy_t *cpy_info)
+H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
+ void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
- H5G_bt_it_ud5_t udata; /* B-tree user data */
const H5O_stab_t *stab_src = (const H5O_stab_t *)mesg_src;
H5O_stab_t *stab_dst = (H5O_stab_t *)mesg_dst;
- H5F_t *file_src = parent_src_oloc->file;
+ H5G_bt_it_ud5_t udata; /* B-tree user data */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_post_copy_file)
/* check args */
- HDassert(file_src);
HDassert(stab_src);
HDassert(H5F_addr_defined(dst_oloc->addr));
HDassert(dst_oloc->file);
@@ -386,14 +382,14 @@ H5O_stab_post_copy_file(const H5O_loc_t *parent_src_oloc, const void *mesg_src,
HGOTO_DONE(SUCCEED)
/* Set up B-tree iteration user data */
- udata.src_oloc = (H5O_loc_t *)parent_src_oloc; /* Casting away const OK - QAK */
+ udata.src_oloc = src_oloc;
udata.src_heap_addr = stab_src->heap_addr;
udata.dst_file = dst_oloc->file;
udata.dst_stab = stab_dst;
udata.cpy_info = cpy_info;
/* Iterate over objects in group, copying them */
- if((H5B_iterate(file_src, dxpl_id, H5B_SNODE, H5G_node_copy, stab_src->btree_addr, &udata)) < 0)
+ if((H5B_iterate(src_oloc->file, dxpl_id, H5B_SNODE, H5G_node_copy, stab_src->btree_addr, &udata)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed")
done:
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index b78bc2b..a97fe42 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -24,7 +24,6 @@
/* Static function prototypes */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_local_heap_size_hint
@@ -292,7 +291,87 @@ H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_est_link_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_creation_order_tracking
+ *
+ * Purpose: Set the flag to track creation order of links in a group
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * September 12, 2006
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_creation_order_tracking(hid_t plist_id, hbool_t track_corder)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_ginfo_t ginfo; /* Group information structure */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_creation_order_tracking, FAIL)
+ H5TRACE2("e","ib",plist_id,track_corder);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get group info */
+ if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Update fields */
+ ginfo.track_corder = track_corder;
+
+ /* Set group info */
+ if(H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_creation_order_tracking() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_creation_order_tracking
+ *
+ * Purpose: Returns the flag indicating that creation order is tracked
+ * for links in a group.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * September 12, 2006
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_creation_order_tracking(hid_t plist_id, hbool_t *track_corder /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* return value */
-#endif /* H5_GROUP_REVISION */
+ FUNC_ENTER_API(H5Pget_creation_order_tracking, FAIL)
+ H5TRACE2("e","ix",plist_id,track_corder);
+
+ /* Get values */
+ if(track_corder) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_ginfo_t ginfo; /* Group information structure */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get group info */
+ if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
+
+ if(track_corder)
+ *track_corder = ginfo.track_corder;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_creation_order_tracking() */
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 55c3c58..c4a85a9 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -24,7 +24,6 @@
/* Static function prototypes */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_create_intermediate_group
@@ -97,5 +96,3 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_create_intermediate_group() */
-#endif /* H5_GROUP_REVISION */
-
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 3a749b7..c24b9d9 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -25,10 +25,10 @@
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Cpublic.h"
-#include "H5Ipublic.h"
#include "H5Dpublic.h"
#include "H5Fpublic.h"
#include "H5FDpublic.h"
+#include "H5Ipublic.h"
#include "H5MMpublic.h"
#include "H5Tpublic.h"
#include "H5Zpublic.h"
@@ -357,7 +357,6 @@ H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size/*out*/);
H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void* operate_data);
H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void** operate_data);
-#ifdef H5_GROUP_REVISION
/* Link creation property list (LCPL) routines */
H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd);
H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd /*out*/);
@@ -369,13 +368,13 @@ H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, uns
H5_DLL herr_t H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned *min_dense /*out*/);
H5_DLL herr_t H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len);
H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */, unsigned *est_name_len /* out */);
+H5_DLL herr_t H5Pset_creation_order_tracking(hid_t plist_id, hbool_t track_corder);
+H5_DLL herr_t H5Pget_creation_order_tracking(hid_t plist_id, hbool_t *track_corder /* out */);
/* String creation property list (SCPL) routines */
H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding);
H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/);
-#endif /* H5_GROUP_REVISION */
-
/* Link access property list (LAPL) routines */
H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks);
H5_DLL herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks);
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index ac13539..6a307c0 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -23,7 +23,6 @@
/* Static function prototypes */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Pset_char_encoding
*
@@ -97,5 +96,3 @@ done:
FUNC_LEAVE_API(ret_value);
} /* end H5Pget_char_encoding() */
-#endif /* H5_GROUP_REVISION */
-
diff --git a/src/H5S.c b/src/H5S.c
index b3060ef..77468ce 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1717,32 +1717,33 @@ done:
static herr_t
H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
{
- size_t extent_size;
- hssize_t sselect_size;
- size_t select_size;
- H5F_t f; /* fake file structure*/
+ size_t extent_size; /* Size of serialized dataspace extent */
+ hssize_t sselect_size; /* Signed size of serialized dataspace selection */
+ size_t select_size; /* Size of serialized dataspace selection */
+ H5F_t f; /* Fake file structure*/
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5S_encode, FAIL);
/* Fake file structure, used only for header message operation */
f.shared = (H5F_file_t*)H5MM_calloc(sizeof(H5F_file_t));
+ HDassert(f.shared);
f.shared->sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF;
/* Find out the size of buffer needed for extent */
- if((extent_size=H5O_raw_size(H5O_SDSPACE_ID, &f, obj))==0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size");
+ if((extent_size = H5O_raw_size(H5O_SDSPACE_ID, &f, obj)) == 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size")
- if((sselect_size=H5S_SELECT_SERIAL_SIZE(obj))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size");
- H5_ASSIGN_OVERFLOW(select_size,sselect_size,hssize_t,size_t);
+ if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size")
+ H5_ASSIGN_OVERFLOW(select_size, sselect_size, hssize_t, size_t);
/* Verify the size of buffer. If it's not big enough, simply return the
* right size without filling the buffer. */
- if(!buf || *nalloc<(extent_size+select_size+1+1+1+4)) {
- *nalloc = extent_size+select_size+1+1+1+4;
- HGOTO_DONE(ret_value);
- }
+ if(!buf || *nalloc<(extent_size + select_size + 1 + 1 + 1 + 4)) {
+ *nalloc = extent_size + select_size + 1 + 1 + 1 + 4;
+ HGOTO_DONE(ret_value)
+ } /* end if */
/* Encode the type of the information */
*buf++ = H5O_SDSPACE_ID;
@@ -1757,26 +1758,26 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
UINT32ENCODE(buf, extent_size);
/* Encode the extent part of dataspace */
- if(H5O_encode(&f, buf, obj, H5O_SDSPACE_ID)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space");
- buf +=extent_size;
+ if(H5O_encode(&f, buf, obj, H5O_SDSPACE_ID) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space")
+ buf += extent_size;
/* Encode the selection part of dataspace. */
- if(H5S_SELECT_SERIALIZE(obj, buf) <0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space");
+ if(H5S_SELECT_SERIALIZE(obj, buf) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space")
done:
if(f.shared)
H5MM_free(f.shared);
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_encode() */
/*-------------------------------------------------------------------------
* Function: H5Sdecode
*
- * Purpose: Decode a binary object description of data space and
+ * Purpose: Decode a binary object description of dataspace and
* return a new object handle.
*
* Return: Success: dataspace ID(non-negative)
@@ -1787,8 +1788,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -1797,22 +1796,22 @@ H5Sdecode(const void *buf)
H5S_t *ds;
hid_t ret_value;
- FUNC_ENTER_API (H5Sdecode, FAIL);
+ FUNC_ENTER_API (H5Sdecode, FAIL)
H5TRACE1("i","x",buf);
- if (buf==NULL)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
- if((ds = H5S_decode(buf))==NULL)
+ if((ds = H5S_decode(buf)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object");
/* Register the type and return the ID */
- if ((ret_value=H5I_register (H5I_DATASPACE, ds))<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace");
+ if((ret_value = H5I_register(H5I_DATASPACE, ds)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Sdecode() */
/*-------------------------------------------------------------------------
@@ -1829,23 +1828,21 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5S_t*
H5S_decode(const unsigned char *buf)
{
H5S_t *ds;
- H5S_extent_t *extent;
+ H5S_extent_t *extent;
size_t extent_size; /* size of the extent message*/
H5F_t f; /* fake file structure*/
H5S_t *ret_value;
- FUNC_ENTER_NOAPI(H5S_decode, NULL);
+ FUNC_ENTER_NOAPI(H5S_decode, NULL)
/* Initialize this before anything goes bad... */
- f.shared=NULL;
+ f.shared = NULL;
/* Decode the type of the information */
if(*buf++ != H5O_SDSPACE_ID)
@@ -1865,35 +1862,36 @@ H5S_decode(const unsigned char *buf)
UINT32DECODE(buf, extent_size);
/* Decode the extent part of dataspace */
- if((extent = H5O_decode(&f, buf, H5O_SDSPACE_ID))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object");
+ /* (pass mostly bogus file pointer and bogus DXPL) */
+ if((extent = H5O_decode(&f, H5P_DEFAULT, buf, H5O_SDSPACE_ID))==NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
buf += extent_size;
/* Copy the extent into dataspace structure */
if((ds = H5FL_CALLOC(H5S_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for data space conversion path table");
- if(H5O_copy(H5O_SDSPACE_ID, extent, &(ds->extent))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object");
- if(H5S_extent_release(extent)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace");
- H5FL_FREE(H5S_extent_t,extent);
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for data space conversion path table")
+ if(H5O_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object")
+ if(H5S_extent_release(extent) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace")
+ H5FL_FREE(H5S_extent_t, extent);
/* Initialize to "all" selection. Deserialization relies on valid existing selection. */
- if(H5S_select_all(ds,0)<0)
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection");
+ if(H5S_select_all(ds, 0) < 0)
+ HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
/* Decode the select part of dataspace. I believe this part always exists. */
- if(H5S_SELECT_DESERIALIZE(ds, buf)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection");
+ if(H5S_SELECT_DESERIALIZE(ds, buf) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection")
/* Set return value */
- ret_value=ds;
+ ret_value = ds;
done:
H5MM_xfree(f.shared);
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_decode() */
/*-------------------------------------------------------------------------
@@ -1908,22 +1906,15 @@ done:
* koziol@ncsa.uiuc.edu
* October 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
size_t
H5S_raw_size(const H5F_t *f, const H5S_t *space)
{
- size_t ret_value;
-
- FUNC_ENTER_NOAPI(H5S_raw_size, 0);
-
- /* Find out the size of buffer needed for extent */
- ret_value=H5O_raw_size(H5O_SDSPACE_ID, f, &(space->extent));
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_raw_size)
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ /* Return the size of buffer needed for extent */
+ FUNC_LEAVE_NOAPI(H5O_raw_size(H5O_SDSPACE_ID, f, &(space->extent)))
} /* end H5S_raw_size() */
diff --git a/src/H5T.c b/src/H5T.c
index 44ac21f..f5e786a 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2797,8 +2797,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -2810,19 +2808,19 @@ H5Tdecode(const void *buf)
FUNC_ENTER_API (H5Tdecode, FAIL);
H5TRACE1("i","x",buf);
- if (buf==NULL)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
+ if(buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
- if((dt = H5T_decode(buf))==NULL)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object");
+ if((dt = H5T_decode(buf)) == NULL)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object")
/* Register the type and return the ID */
- if ((ret_value=H5I_register (H5I_DATATYPE, dt))<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type");
+ if((ret_value = H5I_register (H5I_DATATYPE, dt)) < 0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type")
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Tdecode() */
/*-------------------------------------------------------------------------
* API functions are above; library-private functions are below...
@@ -2895,8 +2893,6 @@ done:
* slu@ncsa.uiuc.edu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5T_t *
@@ -2904,22 +2900,24 @@ H5T_decode(const unsigned char *buf)
{
H5T_t *ret_value;
- FUNC_ENTER_NOAPI(H5T_decode, NULL);
+ FUNC_ENTER_NOAPI(H5T_decode, NULL)
/* Decode the type of the information */
if(*buf++ != H5O_DTYPE_ID)
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADMESG, NULL, "not an encoded datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADMESG, NULL, "not an encoded datatype")
/* Decode the version of the datatype information */
if(*buf++ != H5T_ENCODE_VERSION)
- HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype")
- if((ret_value = H5O_decode(NULL, buf, H5O_DTYPE_ID))==NULL)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object");
+ /* Decode the serialized datatype message */
+ /* (pass bogus file pointer and DXPL) */
+ if((ret_value = H5O_decode(NULL, H5P_DEFAULT, buf, H5O_DTYPE_ID)) == NULL)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_decode() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 8527c96..4b64dcc 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -154,7 +154,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: H5Tcommit_expand
@@ -209,7 +208,6 @@ H5Tcommit_expand(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit_expand() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h
index 96b87dd..79c6aa1 100644
--- a/src/H5api_adpt.h
+++ b/src/H5api_adpt.h
@@ -123,3 +123,4 @@
#endif
#endif /* H5API_ADPT_H */
+
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 6addc39..99b49c2 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -39,9 +39,6 @@
/* Define if gettimeofday() populates the tz pointer passed in */
#undef GETTIMEOFDAY_GIVES_TZ
-/* Define if the group revision code is to be compiled in */
-#undef GROUP_REVISION
-
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
diff --git a/src/H5err.txt b/src/H5err.txt
index 3345251..cb399dd 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -188,6 +188,7 @@ MINOR, OHDR, H5E_BADMESG, Unrecognized message
MINOR, OHDR, H5E_CANTDELETE, Can't delete message
MINOR, OHDR, H5E_BADITER, Iteration failed
MINOR, OHDR, H5E_CANTPACK, Can't pack messages
+MINOR, OHDR, H5E_CANTRESET, Can't reset object
# Group related errors
MINOR, GROUP, H5E_CANTOPENOBJ, Can't open object
diff --git a/src/H5public.h b/src/H5public.h
index cc29c78..724539b 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -57,6 +57,7 @@
#endif
+/* Include the Windows API adapter header early */
#include "H5api_adpt.h"
#ifdef __cplusplus
@@ -206,6 +207,13 @@ typedef ssize_t hssize_t;
#endif
#define HADDR_MAX (HADDR_UNDEF-1)
+/* Common iteration orders */
+typedef enum {
+ H5_ITER_INC, /* Increasing order */
+ H5_ITER_DEC, /* Decreasing order */
+ H5_ITER_NATIVE /* No particular order, whatever is fastest */
+} H5_iter_order_t;
+
/* Functions in H5.c */
H5_DLL herr_t H5open(void);
H5_DLL herr_t H5close(void);
diff --git a/src/H5trace.c b/src/H5trace.c
index f53c2eb..1d2e8c2 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -546,147 +546,147 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
break;
case 'F':
- switch (type[1]) {
- case 'd':
- if (ptr) {
- if (vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */
- switch (degree) {
- case H5F_CLOSE_DEFAULT:
- fprintf(out, "H5F_CLOSE_DEFAULT");
- break;
- case H5F_CLOSE_WEAK:
- fprintf(out, "H5F_CLOSE_WEAK");
- break;
- case H5F_CLOSE_SEMI:
- fprintf(out, "H5F_CLOSE_SEMI");
- break;
- case H5F_CLOSE_STRONG:
- fprintf(out, "H5F_CLOSE_STRONG");
- break;
- }
- }
- break;
+ switch(type[1]) {
+ case 'd':
+ if(ptr) {
+ if(vp)
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */
- case 's':
- if (ptr) {
- if (vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */
- switch (scope) {
- case H5F_SCOPE_LOCAL:
- fprintf(out, "H5F_SCOPE_LOCAL");
- break;
- case H5F_SCOPE_GLOBAL:
- fprintf(out, "H5F_SCOPE_GLOBAL");
- break;
- case H5F_SCOPE_DOWN:
- fprintf(out, "H5F_SCOPE_DOWN "
- "/*FOR INTERNAL USE ONLY!*/");
- break;
- }
- }
- break;
+ switch(degree) {
+ case H5F_CLOSE_DEFAULT:
+ fprintf(out, "H5F_CLOSE_DEFAULT");
+ break;
+ case H5F_CLOSE_WEAK:
+ fprintf(out, "H5F_CLOSE_WEAK");
+ break;
+ case H5F_CLOSE_SEMI:
+ fprintf(out, "H5F_CLOSE_SEMI");
+ break;
+ case H5F_CLOSE_STRONG:
+ fprintf(out, "H5F_CLOSE_STRONG");
+ break;
+ }
+ }
+ break;
- default:
- fprintf(out, "BADTYPE(F%c)", type[1]);
- goto error;
+ case 's':
+ if(ptr) {
+ if(vp)
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */
+
+ switch(scope) {
+ case H5F_SCOPE_LOCAL:
+ fprintf(out, "H5F_SCOPE_LOCAL");
+ break;
+ case H5F_SCOPE_GLOBAL:
+ fprintf(out, "H5F_SCOPE_GLOBAL");
+ break;
+ case H5F_SCOPE_DOWN:
+ fprintf(out, "H5F_SCOPE_DOWN "
+ "/*FOR INTERNAL USE ONLY!*/");
+ break;
+ }
+ }
+ break;
+
+ default:
+ fprintf(out, "BADTYPE(F%c)", type[1]);
+ goto error;
}
break;
case 'G':
- switch (type[1]) {
- case 'l':
- if (ptr) {
- if (vp) {
- fprintf (out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5L_link_t link_type = va_arg (ap, H5L_link_t); /*lint !e64 Type mismatch not really occuring */
- switch (link_type) {
- case H5L_LINK_ERROR:
- fprintf (out, "H5L_LINK_ERROR");
- break;
- case H5L_LINK_HARD:
- fprintf (out, "H5L_LINK_HARD");
- break;
- case H5L_LINK_SOFT:
- fprintf (out, "H5L_LINK_SOFT");
- break;
- default:
- fprintf (out, "%ld", (long)link_type);
- break;
- }
- }
- break;
+ switch(type[1]) {
+ case 'l':
+ if(ptr) {
+ if(vp)
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5L_type_t link_type = va_arg(ap, H5L_type_t); /*lint !e64 Type mismatch not really occuring */
- case 'o':
- if (ptr) {
- if (vp) {
- fprintf (out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5G_obj_t obj_type = va_arg (ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */
- switch (obj_type) {
- case H5G_UNKNOWN:
- fprintf (out, "H5G_UNKNOWN");
- break;
- case H5G_LINK:
- fprintf (out, "H5G_LINK");
- break;
- case H5G_UDLINK:
- fprintf (out, "H5G_UDLINK");
- break;
- case H5G_GROUP:
- fprintf (out, "H5G_GROUP");
- break;
- case H5G_DATASET:
- fprintf (out, "H5G_DATASET");
- break;
- case H5G_TYPE:
- fprintf (out, "H5G_TYPE");
- break;
- case H5G_RESERVED_5:
- case H5G_RESERVED_6:
- case H5G_RESERVED_7:
- fprintf (out, "H5G_RESERVED(%ld)",(long)obj_type);
- break;
- default:
- fprintf (out, "%ld", (long)obj_type);
- break;
- }
- }
- break;
+ switch(link_type) {
+ case H5L_TYPE_ERROR:
+ fprintf(out, "H5L_TYPE_ERROR");
+ break;
+ case H5L_TYPE_HARD:
+ fprintf(out, "H5L_TYPE_HARD");
+ break;
+ case H5L_TYPE_SOFT:
+ fprintf(out, "H5L_TYPE_SOFT");
+ break;
+ default:
+ fprintf(out, "%ld", (long)link_type);
+ break;
+ }
+ }
+ break;
- case 's':
- if (ptr) {
- if (vp) {
- fprintf (out, "0x%lx", (unsigned long)vp);
- } else {
- fprintf(out, "NULL");
- }
- } else {
- H5G_stat_t *statbuf = va_arg (ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */
- fprintf (out, "0x%lx", (unsigned long)statbuf);
- }
- break;
+ case 'o':
+ if(ptr) {
+ if(vp)
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5G_obj_t obj_type = va_arg(ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */
- default:
- fprintf (out, "BADTYPE(G%c)", type[1]);
- goto error;
+ switch(obj_type) {
+ case H5G_UNKNOWN:
+ fprintf(out, "H5G_UNKNOWN");
+ break;
+ case H5G_LINK:
+ fprintf(out, "H5G_LINK");
+ break;
+ case H5G_UDLINK:
+ fprintf(out, "H5G_UDLINK");
+ break;
+ case H5G_GROUP:
+ fprintf(out, "H5G_GROUP");
+ break;
+ case H5G_DATASET:
+ fprintf(out, "H5G_DATASET");
+ break;
+ case H5G_TYPE:
+ fprintf(out, "H5G_TYPE");
+ break;
+ case H5G_RESERVED_5:
+ case H5G_RESERVED_6:
+ case H5G_RESERVED_7:
+ fprintf(out, "H5G_RESERVED(%ld)",(long)obj_type);
+ break;
+ default:
+ fprintf(out, "%ld", (long)obj_type);
+ break;
+ }
+ }
+ break;
+
+ case 's':
+ if(ptr) {
+ if(vp)
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } else {
+ H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */
+
+ fprintf(out, "0x%lx", (unsigned long)statbuf);
+ }
+ break;
+
+ default:
+ fprintf(out, "BADTYPE(G%c)", type[1]);
+ goto error;
}
break;
diff --git a/src/Makefile.am b/src/Makefile.am
index b11a52e..e8c28da 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,8 +50,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5FDfamily.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \
- H5G.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
- H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
+ H5G.c H5Gbtree2.c H5Gdense.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c \
+ H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 66940ad..99a16a2 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -91,29 +91,30 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5Fsfile.lo H5Fsuper.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
H5FDlog.lo H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo \
H5FDsec2.lo H5FDstdio.lo H5FDstream.lo H5FL.lo H5FO.lo H5FS.lo \
- H5FScache.lo H5FSdbg.lo H5FSsection.lo H5G.lo H5Gdeprec.lo \
- H5Gent.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \
- H5Goh.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo \
- H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \
- H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
- H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
- H5HFtiny.lo H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo \
- H5I.lo H5MF.lo H5MM.lo H5MP.lo H5MPtest.lo H5L.lo \
- H5Lexternal.lo H5O.lo H5Oattr.lo H5Obogus.lo H5Ocache.lo \
- H5Ocont.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oginfo.lo \
- H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omtime.lo H5Oname.lo \
- H5Onull.lo H5Opline.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo \
- H5P.lo H5Pacpl.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo \
- H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pstrcpl.lo \
- H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo \
- H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo \
- H5SL.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo \
- H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tenum.lo H5Tfields.lo \
- H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo \
- H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo \
- H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo \
- H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo H5Zszip.lo \
- H5Zscaleoffset.lo H5Ztrans.lo
+ H5FScache.lo H5FSdbg.lo H5FSsection.lo H5G.lo H5Gbtree2.lo \
+ H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Glink.lo H5Gloc.lo \
+ H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Gstab.lo H5Gtest.lo \
+ H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo \
+ H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \
+ H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \
+ H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \
+ H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo H5MF.lo H5MM.lo \
+ H5MP.lo H5MPtest.lo H5L.lo H5Lexternal.lo H5O.lo H5Oattr.lo \
+ H5Obogus.lo H5Ocache.lo H5Ocont.lo H5Odtype.lo H5Oefl.lo \
+ H5Ofill.lo H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo \
+ H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Osdspace.lo \
+ H5Oshared.lo H5Ostab.lo H5P.lo H5Pacpl.lo H5Pdcpl.lo \
+ H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pgcpl.lo H5Plapl.lo \
+ H5Plcpl.lo H5Pocpl.lo H5Pstrcpl.lo H5Ptest.lo H5R.lo H5RC.lo \
+ H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \
+ H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5ST.lo H5T.lo \
+ H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo \
+ H5Tcset.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo \
+ H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo H5Topaque.lo \
+ H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo \
+ H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \
+ H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Zscaleoffset.lo \
+ H5Ztrans.lo
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
PROGRAMS = $(noinst_PROGRAMS)
H5detect_SOURCES = H5detect.c
@@ -399,8 +400,8 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5FDfamily.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \
- H5G.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
- H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
+ H5G.c H5Gbtree2.c H5Gdense.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c \
+ H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
@@ -599,6 +600,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsfile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsuper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5G.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gbtree2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gdense.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gdeprec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Glink.Plo@am__quote@
diff --git a/test/Makefile.am b/test/Makefile.am
index bf2297d..b41d999 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -98,7 +98,7 @@ flush2.chkexe_: flush1.chkexe_
# prefix or low-level driver with environment variables will influence
# the temporary file name in ways that the makefile is not aware of.
CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5\
- tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab[1-2].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[1-3].h5 big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 tselect.h5 mtime.h5 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 1b4992d..40cb0c8 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -593,9 +593,9 @@ TRACE = perl $(top_srcdir)/bin/trace
# the temporary file name in ways that the makefile is not aware of.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
compact_dataset.h5 dataset.h5 extend.h5 istore.h5 \
- tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 \
- stab[1-2].h5 extern_[1-3].h5 extern_[1-4][ab].raw \
- gheap[0-4].h5 dt_arith[1-2] links.h5 links[1-3].h5 big.data \
+ 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[1-3].h5 big.data \
big[0-9][0-9][0-9][0-9][0-9].h5 dtypes[1-8].h5 \
dt_arith[1-2].h5 tattr.h5 tselect.h5 mtime.h5 unlink.h5 \
unicode.h5 fillval_[0-9].h5 fillval.raw mount_[0-9].h5 \
diff --git a/test/be_extlink1.h5 b/test/be_extlink1.h5
index dedd0a5..0ef71fa 100644
--- a/test/be_extlink1.h5
+++ b/test/be_extlink1.h5
Binary files differ
diff --git a/test/be_extlink2.h5 b/test/be_extlink2.h5
index d6f9921..296fef0 100644
--- a/test/be_extlink2.h5
+++ b/test/be_extlink2.h5
Binary files differ
diff --git a/test/cache_common.c b/test/cache_common.c
index e7bc87c..3e9b596 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -2196,7 +2196,7 @@ unprotect_entry(H5C_t * cache_ptr,
result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[type]),
entry_ptr->addr, (void *)entry_ptr,
- flags, 0);
+ flags, (size_t)0);
if ( ( result < 0 ) ||
( entry_ptr->header.is_protected ) ||
diff --git a/test/gen_new_group.c b/test/gen_new_group.c
index bff23ed..7e54c90 100644
--- a/test/gen_new_group.c
+++ b/test/gen_new_group.c
@@ -32,8 +32,8 @@
int main(void)
{
-#ifdef H5_GROUP_REVISION
hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
hid_t fcpl = -1; /* File creation property list ID */
hid_t gid = -1; /* Group creation property list ID */
hid_t sid = -1; /* Dataspace ID */
@@ -43,11 +43,20 @@ int main(void)
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error;
/* Adjust group creation parameters for root group */
- /* (So that it is created in symbol-table form) */
+ /* (So that it is created in "dense storage" form) */
if(H5Pset_link_phase_change(fcpl, 0, 0) < 0) goto error;
+ /* Copy the file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl, TRUE) < 0) TEST_ERROR
+
/* Create file for test groups */
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) <0) goto error;
+ if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) <0) goto error;
+
+ /* Close file access property list */
+ if(H5Pclose(fapl) < 0) goto error;
/* Close file creation property list */
if(H5Pclose(fcpl) < 0) goto error;
@@ -78,20 +87,18 @@ int main(void)
/* Close file */
if(H5Fclose(fid) < 0) goto error;
-#endif /* H5_GROUP_REVISION */
return 0;
-#ifdef H5_GROUP_REVISION
error:
H5E_BEGIN_TRY {
- H5Pclose(did);
+ H5Dclose(did);
H5Sclose(sid);
- H5Dclose(gid);
- H5Dclose(fcpl);
+ H5Gclose(gid);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
H5Fclose(fid);
} H5E_END_TRY;
return 1;
-#endif /* H5_GROUP_REVISION */
}
diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c
index 1230ffe..d479797 100644
--- a/test/gen_udlinks.c
+++ b/test/gen_udlinks.c
@@ -69,6 +69,9 @@ main (void)
/* Create an external link in the first file pointing to the group in the second file */
if(H5Lcreate_external(filename2, "group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) goto error;
+ if((H5Fclose(fid1)) < 0) goto error;
+ if((H5Fclose(fid2)) < 0) goto error;
+
return 0;
error:
diff --git a/test/h5test.c b/test/h5test.c
index be843f3..acc7630 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -224,7 +224,7 @@ h5_reset(void)
H5E_BEGIN_TRY {
hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT);
- hid_t grp = H5Gcreate(file, "emit", 0);
+ hid_t grp = H5Gcreate(file, "emit", (size_t)0);
H5Gclose(grp);
H5Fclose(file);
HDunlink(filename);
@@ -466,10 +466,10 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
*
*-------------------------------------------------------------------------
*/
-char *
+const char *
h5_rmprefix(const char *filename)
{
- char *ret_ptr;
+ const char *ret_ptr;
if ((ret_ptr = HDstrstr(filename, ":")) == NULL)
ret_ptr = filename;
@@ -527,7 +527,7 @@ h5_fileaccess(void)
if (H5Pset_fapl_stdio(fapl)<0) return -1;
} else if (!HDstrcmp(name, "core")) {
/* In-core temporary file with 1MB increment */
- if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1;
+ if (H5Pset_fapl_core(fapl, (size_t)1024*1024, FALSE)<0) return -1;
} else if (!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
if (H5Pset_fapl_split(fapl,
@@ -575,7 +575,7 @@ h5_fileaccess(void)
if ((val = HDstrtok(NULL, " \t\n\r")))
log_flags = (unsigned)HDstrtol(val, NULL, 0);
- if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0)
+ if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
return -1;
} else {
/* Unknown driver */
@@ -675,9 +675,8 @@ h5_show_hostname(void)
#endif
#ifdef H5_HAVE_GETHOSTNAME
- if (gethostname(hostname, 80) < 0){
+ if (gethostname(hostname, (size_t)80) < 0)
printf(" gethostname failed\n");
- }
else
printf(" hostname=%s\n", hostname);
#else
diff --git a/test/h5test.h b/test/h5test.h
index d8af200..640a882 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -106,6 +106,7 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define STACK_ERROR {H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
#define FAIL_STACK_ERROR {H5_FAILED(); AT(); \
H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
+#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); puts(s); goto error;}
/*
* Alarm definitions to wait up (terminate) a test that runs too long.
@@ -126,7 +127,7 @@ H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname,
size_t size);
H5TEST_DLL hid_t h5_fileaccess(void);
H5TEST_DLL void h5_no_hwconv(void);
-H5TEST_DLL char *h5_rmprefix(const char *filename);
+H5TEST_DLL const char *h5_rmprefix(const char *filename);
H5TEST_DLL void h5_reset(void);
H5TEST_DLL void h5_show_hostname(void);
H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename);
diff --git a/test/le_extlink1.h5 b/test/le_extlink1.h5
index 877ba37..eea65d8 100644
--- a/test/le_extlink1.h5
+++ b/test/le_extlink1.h5
Binary files differ
diff --git a/test/le_extlink2.h5 b/test/le_extlink2.h5
index d6f9921..296fef0 100644
--- a/test/le_extlink2.h5
+++ b/test/le_extlink2.h5
Binary files differ
diff --git a/test/links.c b/test/links.c
index 1825214..1d6b329 100644
--- a/test/links.c
+++ b/test/links.c
@@ -50,12 +50,12 @@ const char *FILENAME[] = {
/* Link type IDs */
#define UD_HARD_TYPE 201
-#define UD_CB_TYPE H5L_LINK_MAX
+#define UD_CB_TYPE H5L_TYPE_MAX
#define UD_PLIST_TYPE 128
#define UD_CBFAIL_TYPE UD_PLIST_TYPE
#define UD_ERROR_TYPE 189
#define UD_BAD_TYPE1 H5G_LINK_HARD
-#define UD_BAD_TYPE2 (H5L_LINK_UD_MIN - 5)
+#define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5)
#define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1)
#define DEST_PROP_NAME "destination_group"
@@ -90,42 +90,45 @@ const char *FILENAME[] = {
*-------------------------------------------------------------------------
*/
static int
-mklinks(hid_t fapl)
+mklinks(hid_t fapl, hbool_t new_format)
{
hid_t file, scalar, grp, d1;
hsize_t size[1] = {1};
char filename[NAME_BUF_SIZE];
- TESTING("link creation");
+ if(new_format)
+ TESTING("link creation (w/new group format)")
+ else
+ TESTING("link creation")
/* Create a file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
- if ((scalar=H5Screate_simple (1, size, size))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if ((scalar=H5Screate_simple (1, size, size)) < 0) TEST_ERROR
/* Create a group */
- if ((grp=H5Gcreate (file, "grp1", (size_t)0))<0) TEST_ERROR;
- if (H5Gclose (grp)<0) TEST_ERROR;
+ if ((grp=H5Gcreate (file, "grp1", (size_t)0)) < 0) TEST_ERROR
+ if (H5Gclose (grp) < 0) TEST_ERROR
/* Create a dataset */
- if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT))<0) TEST_ERROR;
- if (H5Dclose (d1)<0) TEST_ERROR;
+ if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR
+ if (H5Dclose (d1) < 0) TEST_ERROR
/* Create a hard link */
- if (H5Lcreate_hard (file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
+ if (H5Lcreate_hard (file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create a symbolic link */
- if (H5Lcreate_soft ("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
+ if (H5Lcreate_soft ("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create a symbolic link to something that doesn't exist */
- if (H5Lcreate_soft ("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
+ if (H5Lcreate_soft ("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create a recursive symbolic link */
- if (H5Lcreate_soft ("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
+ if (H5Lcreate_soft ("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close */
- if (H5Sclose (scalar)<0) TEST_ERROR;
- if (H5Fclose (file)<0) TEST_ERROR;
+ if (H5Sclose (scalar) < 0) TEST_ERROR
+ if (H5Fclose (file) < 0) TEST_ERROR
PASSED();
return 0;
@@ -152,7 +155,7 @@ mklinks(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-new_links(hid_t fapl)
+new_links(hid_t fapl, hbool_t new_format)
{
hid_t file_a, file_b=(-1);
hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1);
@@ -161,57 +164,60 @@ new_links(hid_t fapl)
char filename[NAME_BUF_SIZE];
hsize_t size[1] = {1};
- TESTING("H5Lcreate functions");
+ if(new_format)
+ TESTING("H5Lcreate functions (w/new group format)")
+ else
+ TESTING("H5Lcreate functions")
/* Create two files */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if ((scalar=H5Screate_simple (1, size, size))<0) TEST_ERROR;
+ if ((scalar=H5Screate_simple (1, size, size)) < 0) TEST_ERROR
/* Create two groups in each file */
- if ((grp1_a=H5Gcreate (file_a, "grp1", (size_t)0))<0) TEST_ERROR;
- if ((grp2_a=H5Gcreate (file_a, "grp2", (size_t)0))<0) TEST_ERROR;
- if ((grp1_b=H5Gcreate (file_b, "grp1", (size_t)0))<0) TEST_ERROR;
- if ((grp2_b=H5Gcreate (file_b, "grp2", (size_t)0))<0) TEST_ERROR;
+ if ((grp1_a=H5Gcreate (file_a, "grp1", (size_t)0)) < 0) TEST_ERROR
+ if ((grp2_a=H5Gcreate (file_a, "grp2", (size_t)0)) < 0) TEST_ERROR
+ if ((grp1_b=H5Gcreate (file_b, "grp1", (size_t)0)) < 0) TEST_ERROR
+ if ((grp2_b=H5Gcreate (file_b, "grp2", (size_t)0)) < 0) TEST_ERROR
/* Create datasets */
- if((dset1=H5Dcreate(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT))<0) TEST_ERROR;
- if((dset2=H5Dcreate(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT))<0) TEST_ERROR;
+ if((dset1=H5Dcreate(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset2=H5Dcreate(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create links within a file. Both of source and destination use
* H5L_SAME_LOC. Both hard and soft links should fail. */
H5E_BEGIN_TRY {
- if(H5Lcreate_hard(H5L_SAME_LOC, "dataset1", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR;
+ if(H5Lcreate_hard(H5L_SAME_LOC, "dataset1", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR
} H5E_END_TRY;
H5E_BEGIN_TRY {
- if(H5Lcreate_soft("dataset1", H5L_SAME_LOC, "soft", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR;
+ if(H5Lcreate_soft("dataset1", H5L_SAME_LOC, "soft", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Create links across files with hard link. Should fail. */
H5E_BEGIN_TRY {
- if(H5Lcreate_hard(file_a, "dataset1", file_b, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR;
+ if(H5Lcreate_hard(file_a, "dataset1", file_b, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Create hard link to test H5L_SAME_LOC */
- if(H5Lcreate_hard(grp1_a, "dataset2", H5L_SAME_LOC, "hard1", H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
+ if(H5Lcreate_hard(grp1_a, "dataset2", H5L_SAME_LOC, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create links to test hard links across different locations */
- if(H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
+ if(H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close dataspace and files */
- if (H5Sclose (scalar)<0) TEST_ERROR;
- if (H5Dclose(dset1)<0) TEST_ERROR;
- if (H5Dclose(dset2)<0) TEST_ERROR;
- if (H5Gclose (grp1_a)<0) TEST_ERROR;
- if (H5Gclose (grp2_a)<0) TEST_ERROR;
- if (H5Gclose (grp1_b)<0) TEST_ERROR;
- if (H5Gclose (grp2_b)<0) TEST_ERROR;
- if (H5Fclose (file_a)<0) TEST_ERROR;
- if (H5Fclose (file_b)<0) TEST_ERROR;
+ if (H5Sclose (scalar) < 0) TEST_ERROR
+ if (H5Dclose(dset1) < 0) TEST_ERROR
+ if (H5Dclose(dset2) < 0) TEST_ERROR
+ if (H5Gclose (grp1_a) < 0) TEST_ERROR
+ if (H5Gclose (grp2_a) < 0) TEST_ERROR
+ if (H5Gclose (grp1_b) < 0) TEST_ERROR
+ if (H5Gclose (grp2_b) < 0) TEST_ERROR
+ if (H5Fclose (file_a) < 0) TEST_ERROR
+ if (H5Fclose (file_b) < 0) TEST_ERROR
PASSED();
return 0;
@@ -250,7 +256,7 @@ new_links(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-cklinks(hid_t fapl)
+cklinks(hid_t fapl, hbool_t new_format)
{
hid_t file;
H5G_stat_t sb1, sb2;
@@ -258,45 +264,48 @@ cklinks(hid_t fapl)
char filename[NAME_BUF_SIZE];
herr_t status;
- TESTING("link queries");
+ if(new_format)
+ TESTING("link queries (w/new group format)")
+ else
+ TESTING("link queries")
/* Open the file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) TEST_ERROR;
+ if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Hard link */
- if (H5Gget_objinfo(file, "d1", TRUE, &sb1)<0) TEST_ERROR;
- if (H5Gget_objinfo(file, "grp1/hard", TRUE, &sb2)<0) TEST_ERROR;
+ if (H5Gget_objinfo(file, "d1", TRUE, &sb1) < 0) TEST_ERROR
+ if (H5Gget_objinfo(file, "grp1/hard", TRUE, &sb2) < 0) TEST_ERROR
if (H5G_DATASET!=sb2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
- TEST_ERROR;
+ TEST_ERROR
}
if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) {
H5_FAILED();
puts(" Hard link test failed. Link seems not to point to the ");
puts(" expected file location.");
- TEST_ERROR;
+ TEST_ERROR
}
/* Symbolic link */
- if (H5Gget_objinfo(file, "grp1/soft", TRUE, &sb2)<0) TEST_ERROR;
+ if (H5Gget_objinfo(file, "grp1/soft", TRUE, &sb2) < 0) TEST_ERROR
if (H5G_DATASET!=sb2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
- TEST_ERROR;
+ TEST_ERROR
}
if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) {
H5_FAILED();
puts(" Soft link test failed. Link seems not to point to the ");
puts(" expected file location.");
- TEST_ERROR;
+ TEST_ERROR
}
- if (H5Lget_linkval(file, "grp1/soft", sizeof linkval, linkval, H5P_DEFAULT)<0) TEST_ERROR;
+ if (H5Lget_linkval(file, "grp1/soft", sizeof linkval, linkval, H5P_DEFAULT) < 0) TEST_ERROR
if (HDstrcmp(linkval, "/d1")) {
H5_FAILED();
puts(" Soft link test failed. Wrong link value");
- TEST_ERROR;
+ TEST_ERROR
}
/* Dangling link */
@@ -306,23 +315,23 @@ cklinks(hid_t fapl)
if (status>=0) {
H5_FAILED();
puts(" H5Gget_objinfo() should have failed for a dangling link.");
- TEST_ERROR;
+ TEST_ERROR
}
- if (H5Gget_objinfo(file, "grp1/dangle", FALSE, &sb2)<0) TEST_ERROR;
+ if (H5Gget_objinfo(file, "grp1/dangle", FALSE, &sb2) < 0) TEST_ERROR
if (H5G_LINK!=sb2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
- TEST_ERROR;
+ TEST_ERROR
}
- if (H5Gget_linkval(file, "grp1/dangle", sizeof linkval, linkval)<0) {
+ if (H5Gget_linkval(file, "grp1/dangle", sizeof linkval, linkval) < 0) {
H5_FAILED();
printf(" %d: Can't retrieve link value\n", __LINE__);
- TEST_ERROR;
+ TEST_ERROR
}
if (HDstrcmp(linkval, "foobar")) {
H5_FAILED();
puts(" Dangling link test failed. Wrong link value");
- TEST_ERROR;
+ TEST_ERROR
}
/* Recursive link */
@@ -332,27 +341,27 @@ cklinks(hid_t fapl)
if (status>=0) {
H5_FAILED();
puts(" H5Gget_objinfo() should have failed for a recursive link.");
- TEST_ERROR;
+ TEST_ERROR
}
- if (H5Gget_objinfo(file, "grp1/recursive", FALSE, &sb2)<0) TEST_ERROR;
+ if (H5Gget_objinfo(file, "grp1/recursive", FALSE, &sb2) < 0) TEST_ERROR
if (H5G_LINK!=sb2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
- TEST_ERROR;
+ TEST_ERROR
}
- if (H5Gget_linkval(file, "grp1/recursive", sizeof linkval, linkval)<0) {
+ if (H5Gget_linkval(file, "grp1/recursive", sizeof linkval, linkval) < 0) {
H5_FAILED();
printf(" %d: Can't retrieve link value\n", __LINE__);
- TEST_ERROR;
+ TEST_ERROR
}
if (HDstrcmp(linkval, "/grp1/recursive")) {
H5_FAILED();
puts(" Recursive link test failed. Wrong link value");
- TEST_ERROR;
+ TEST_ERROR
}
/* Cleanup */
- if (H5Fclose(file)<0) TEST_ERROR;
+ if (H5Fclose(file) < 0) TEST_ERROR
PASSED();
return 0;
@@ -377,41 +386,44 @@ cklinks(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-ck_new_links(hid_t fapl)
+ck_new_links(hid_t fapl, hbool_t new_format)
{
hid_t file;
H5G_stat_t sb_dset, sb_hard1, sb_hard2;
char filename[NAME_BUF_SIZE];
- TESTING("new link queries");
+ if(new_format)
+ TESTING("new link queries (w/new group format)")
+ else
+ TESTING("new link queries")
/* Open the file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) TEST_ERROR;
+ if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Get hard link info */
- if(H5Gget_objinfo(file, "/grp1/dataset2", TRUE, &sb_dset)<0)
- TEST_ERROR;
- if(H5Gget_objinfo(file, "/grp1/hard1", TRUE, &sb_hard1)<0)
- TEST_ERROR;
- if(H5Gget_objinfo(file, "/grp2/hard2", TRUE, &sb_hard2)<0)
- TEST_ERROR;
+ if(H5Gget_objinfo(file, "/grp1/dataset2", TRUE, &sb_dset) < 0)
+ TEST_ERROR
+ if(H5Gget_objinfo(file, "/grp1/hard1", TRUE, &sb_hard1) < 0)
+ TEST_ERROR
+ if(H5Gget_objinfo(file, "/grp2/hard2", TRUE, &sb_hard2) < 0)
+ TEST_ERROR
/* Check hard links */
if(H5G_DATASET!=sb_hard1.type || H5G_DATASET!=sb_hard2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
- TEST_ERROR;
+ TEST_ERROR
}
if(HDmemcmp(&sb_dset.objno, &sb_hard1.objno, sizeof(sb_dset.objno)) || HDmemcmp(&sb_dset.objno, &sb_hard2.objno, sizeof(sb_dset.objno))) {
H5_FAILED();
puts(" Hard link test failed. Link seems not to point to the ");
puts(" expected file location.");
- TEST_ERROR;
+ TEST_ERROR
}
/* Cleanup */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
return 0;
@@ -437,7 +449,7 @@ ck_new_links(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-long_links(hid_t fapl)
+long_links(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */
@@ -446,35 +458,38 @@ long_links(hid_t fapl)
size_t u; /* Local index variable */
char filename[NAME_BUF_SIZE];
- TESTING("long names for objects & links");
+ if(new_format)
+ TESTING("long names for objects & links (w/new group format)")
+ else
+ TESTING("long names for objects & links")
/* Create files */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group with short name in file (used as target for hard links) */
- if((gid=H5Gcreate (fid, "grp1", (size_t)0))<0) TEST_ERROR;
+ if((gid=H5Gcreate (fid, "grp1", (size_t)0)) < 0) TEST_ERROR
/* Construct very long file name */
- if((objname = HDmalloc((size_t)(MAX_NAME_LEN + 1))) == NULL) TEST_ERROR;
+ if((objname = HDmalloc((size_t)(MAX_NAME_LEN + 1))) == NULL) TEST_ERROR
for(u = 0; u < MAX_NAME_LEN; u++)
objname[u] = 'a';
objname[MAX_NAME_LEN] = '\0';
/* Create hard link to existing object */
- if(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create soft link to existing object */
objname[0] = 'b';
- if(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create group with long name in existing group */
- if((gid2=H5Gcreate(gid, objname, (size_t)0))<0) TEST_ERROR;
+ if((gid2=H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
/* Close objects */
- if(H5Gclose(gid2)<0) TEST_ERROR;
- if(H5Gclose(gid)<0) TEST_ERROR;
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Release memory */
HDfree(objname);
@@ -510,7 +525,7 @@ long_links(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-toomany(hid_t fapl)
+toomany(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -518,7 +533,10 @@ toomany(hid_t fapl)
ssize_t name_len; /* Length of object name */
char filename[NAME_BUF_SIZE];
- TESTING("too many links");
+ if(new_format)
+ TESTING("too many links (w/new group format)")
+ else
+ TESTING("too many links")
/* Make certain test is valid */
/* XXX: should probably make a "generic" test that creates the proper
@@ -528,62 +546,62 @@ toomany(hid_t fapl)
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group with short name in file (used as target for hard links) */
- if((gid=H5Gcreate (fid, "final", (size_t)0))<0) TEST_ERROR;
+ if((gid=H5Gcreate (fid, "final", (size_t)0)) < 0) TEST_ERROR
/* Create chain of hard links to existing object (no limit on #) */
- if(H5Lcreate_hard(fid, "final", fid, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard1", fid, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard2", fid, "hard3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard3", fid, "hard4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard4", fid, "hard5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard5", fid, "hard6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard6", fid, "hard7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard7", fid, "hard8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard8", fid, "hard9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard9", fid, "hard10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard10", fid, "hard11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard11", fid, "hard12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard12", fid, "hard13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard13", fid, "hard14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard14", fid, "hard15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard15", fid, "hard16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard16", fid, "hard17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard17", fid, "hard18", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard18", fid, "hard19", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard19", fid, "hard20", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_hard(fid, "hard20", fid, "hard21", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_hard(fid, "final", fid, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard1", fid, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard2", fid, "hard3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard3", fid, "hard4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard4", fid, "hard5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard5", fid, "hard6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard6", fid, "hard7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard7", fid, "hard8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard8", fid, "hard9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard9", fid, "hard10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard10", fid, "hard11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard11", fid, "hard12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard12", fid, "hard13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard13", fid, "hard14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard14", fid, "hard15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard15", fid, "hard16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard16", fid, "hard17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard17", fid, "hard18", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard18", fid, "hard19", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard19", fid, "hard20", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_hard(fid, "hard20", fid, "hard21", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create chain of soft links to existing object (limited) */
- if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close objects */
- if(H5Gclose(gid)<0) TEST_ERROR;
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open file */
- if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0) TEST_ERROR;
+ if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Open object through last hard link */
- if((gid = H5Gopen(fid, "hard21")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "hard21")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -596,7 +614,7 @@ toomany(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close hard-linked object */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Open object through too deep soft link */
H5E_BEGIN_TRY {
@@ -605,11 +623,11 @@ toomany(hid_t fapl)
if (gid >= 0) {
H5_FAILED();
puts(" Should have failed for sequence of too many nested links.");
- TEST_ERROR;
+ TEST_ERROR
}
/* Open object through lesser soft link */
- if((gid = H5Gopen(fid, "soft16")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "soft16")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -623,7 +641,7 @@ toomany(hid_t fapl)
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -638,7 +656,6 @@ toomany(hid_t fapl)
} /* end toomany() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: test_h5l_create
*
@@ -655,7 +672,7 @@ toomany(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-test_h5l_create(hid_t fapl)
+test_h5l_create(hid_t fapl, hbool_t new_format)
{
hid_t file_id=-1;
hid_t group_id=-1;
@@ -668,24 +685,28 @@ test_h5l_create(hid_t fapl)
int i, n, j;
int wdata[H5L_DIM1][H5L_DIM2];
int rdata[H5L_DIM1][H5L_DIM2];
- TESTING("H5Llink");
+
+ if(new_format)
+ TESTING("H5Llink (w/new group format)")
+ else
+ TESTING("H5Llink")
/* Create file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create and commit a datatype with no name */
- if((type_id =H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if(H5Tcommit_expand(file_id, type_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(! H5Tcommitted(type_id)) TEST_ERROR;
+ if((type_id =H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit_expand(file_id, type_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(! H5Tcommitted(type_id)) TEST_ERROR
/* Create the dataspace */
dims[0] = H5L_DIM1;
dims[1] = H5L_DIM2;
- if((space_id=H5Screate_simple(2 ,dims, NULL))<0) TEST_ERROR;
+ if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR
/* Create a dataset with no name using the committed datatype*/
- if ((dset_id = H5Dcreate_expand(file_id, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) <0) TEST_ERROR;
+ if ((dset_id = H5Dcreate_expand(file_id, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Verify that we can write to and read from the dataset */
/* Initialize the dataset */
@@ -694,74 +715,69 @@ test_h5l_create(hid_t fapl)
wdata[i][j] = n++;
/* Write the data to the dataset */
- if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata)<0) TEST_ERROR;
+ if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0) TEST_ERROR
/* Read the data back */
- if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata)<0) TEST_ERROR;
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR
/* Verify the data */
- for (i = 0; i < H5L_DIM1; i++) {
- for (j = 0; j < H5L_DIM2; j++) {
+ for (i = 0; i < H5L_DIM1; i++)
+ for (j = 0; j < H5L_DIM2; j++)
if (wdata[i][j] != rdata[i][j])
- {
- TEST_ERROR;
- }
- }}
+ TEST_ERROR
/* Create a group with no name*/
- if((group_id = H5Gcreate_expand(file_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if((group_id = H5Gcreate_expand(file_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Link nameless datatype into nameless group */
- if(H5Llink(group_id, "datatype", type_id, H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
+ if(H5Llink(group_id, "datatype", type_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create LCPL with intermediate group creation flag set */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) <0) TEST_ERROR;
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) <0) TEST_ERROR;
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
/* Link nameless dataset into nameless group with intermediate group */
- if(H5Llink(group_id, "inter_group/dataset", dset_id, lcpl_id, H5P_DEFAULT)<0) TEST_ERROR;
+ if(H5Llink(group_id, "inter_group/dataset", dset_id, lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
/* Close IDs for dataset and datatype */
- if(H5Dclose(dset_id)<0) TEST_ERROR;
- if(H5Tclose(type_id)<0) TEST_ERROR;
+ if(H5Dclose(dset_id) < 0) TEST_ERROR
+ if(H5Tclose(type_id) < 0) TEST_ERROR
/* Re-open datatype using new link */
- if((type_id = H5Topen(group_id, "datatype"))<0) TEST_ERROR;
+ if((type_id = H5Topen(group_id, "datatype")) < 0) TEST_ERROR
/* Link nameless group to root group and close the group ID*/
- if(H5Llink(file_id, "/group", group_id, H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
- if(H5Gclose(group_id)<0) TEST_ERROR;
+ if(H5Llink(file_id, "/group", group_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(group_id) < 0) TEST_ERROR
/* Open dataset through root group and verify its data */
- if((dset_id = H5Dopen(file_id, "/group/inter_group/dataset"))<0) TEST_ERROR;
+ if((dset_id = H5Dopen(file_id, "/group/inter_group/dataset")) < 0) TEST_ERROR
/* Read data from dataset */
- if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata)<0) TEST_ERROR;
- for (i = 0; i < H5L_DIM1; i++) {
- for (j = 0; j < H5L_DIM2; j++) {
- if (wdata[i][j] != rdata[i][j])
- {
- TEST_ERROR;
- }
- }}
+ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR
+ for (i = 0; i < H5L_DIM1; i++)
+ for (j = 0; j < H5L_DIM2; j++)
+ if (wdata[i][j] != rdata[i][j])
+ TEST_ERROR
/* Close open IDs */
- if(H5Dclose(dset_id)<0) TEST_ERROR;
- if(H5Tclose(type_id)<0) TEST_ERROR;
- if(H5Pclose(lcpl_id)<0) TEST_ERROR;
- if(H5Sclose(space_id)<0) TEST_ERROR;
- if(H5Fclose(file_id)<0) TEST_ERROR;
+ if(H5Dclose(dset_id) < 0) TEST_ERROR
+ if(H5Tclose(type_id) < 0) TEST_ERROR
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if(H5Sclose(space_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Gclose(group_id);
- H5Dclose(dset_id);
- H5Tclose(type_id);
- H5Pclose(lcpl_id);
- H5Sclose(space_id);
- H5Fclose(file_id);
+ H5Gclose(group_id);
+ H5Dclose(dset_id);
+ H5Tclose(type_id);
+ H5Pclose(lcpl_id);
+ H5Sclose(space_id);
+ H5Fclose(file_id);
} H5E_END_TRY;
return 1;
} /* end test_h5l_create() */
@@ -783,7 +799,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_lcpl(hid_t fapl)
+test_lcpl(hid_t fapl, hbool_t new_format)
{
hid_t file_id=-1;
hid_t group_id=-1;
@@ -795,101 +811,99 @@ test_lcpl(hid_t fapl)
char filename[1024];
hsize_t dims[2];
- TESTING("link creation property lists");
+ if(new_format)
+ TESTING("link creation property lists (w/new group format)")
+ else
+ TESTING("link creation property lists")
+
/* Actually, intermediate group creation is tested elsewhere (tmisc).
* Here we only need to test the character encoding property */
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create and link a group with the default LCPL */
- if((group_id = H5Gcreate_expand(file_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Llink(file_id, "/group", group_id, H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
- if(H5Gclose(group_id)<0) TEST_ERROR;
+ if((group_id = H5Gcreate_expand(file_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Llink(file_id, "/group", group_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(group_id) < 0) TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_linkinfo(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5F_CRT_DEFAULT_CSET) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5F_CRT_DEFAULT_CSET) TEST_ERROR
/* Create and commit a datatype with the default LCPL */
- if((type_id =H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if(H5Tcommit_expand(file_id, type_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Llink(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
- if(H5Tclose(type_id)<0) TEST_ERROR;
+ if((type_id =H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit_expand(file_id, type_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Llink(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tclose(type_id) < 0) TEST_ERROR;
/* Check that its character encoding is the default */
- if(H5Lget_linkinfo(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5F_CRT_DEFAULT_CSET) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5F_CRT_DEFAULT_CSET) TEST_ERROR
/* Create a dataspace */
dims[0] = H5L_DIM1;
dims[1] = H5L_DIM2;
- if((space_id=H5Screate_simple(2 ,dims, NULL))<0) TEST_ERROR;
+ if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR
/* Create a dataset using the default LCPL */
- if ((dset_id = H5Dcreate_expand(file_id, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) <0) TEST_ERROR;
- if(H5Llink(file_id, "/dataset", dset_id, H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR;
- if(H5Dclose(dset_id)<0) TEST_ERROR;
+ if ((dset_id = H5Dcreate_expand(file_id, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Llink(file_id, "/dataset", dset_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_linkinfo(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5F_CRT_DEFAULT_CSET) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5F_CRT_DEFAULT_CSET) TEST_ERROR
/* Create a link creation property list with the UTF-8 character encoding */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) <0) TEST_ERROR;
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR;
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
/* Create and link a group with the new LCPL */
- if((group_id = H5Gcreate_expand(file_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Llink(file_id, "/group2", group_id, lcpl_id, H5P_DEFAULT)<0) TEST_ERROR;
- if(H5Gclose(group_id)<0) TEST_ERROR;
+ if((group_id = H5Gcreate_expand(file_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Llink(file_id, "/group2", group_id, lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(group_id) < 0) TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_linkinfo(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Create and commit a datatype with the new LCPL */
- if((type_id =H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if(H5Tcommit_expand(file_id, type_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Llink(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT)<0) TEST_ERROR;
- if(H5Tclose(type_id)<0) TEST_ERROR;
+ if((type_id =H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit_expand(file_id, type_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Llink(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Tclose(type_id) < 0) TEST_ERROR;
/* Check that its character encoding is UTF-8 */
- if(H5Lget_linkinfo(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Create a dataset using the new LCPL */
- if ((dset_id = H5Dcreate_expand(file_id, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) <0) TEST_ERROR;
- if(H5Llink(file_id, "/dataset2", dset_id, lcpl_id, H5P_DEFAULT)<0) TEST_ERROR;
- if(H5Dclose(dset_id)<0) TEST_ERROR;
+ if ((dset_id = H5Dcreate_expand(file_id, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Llink(file_id, "/dataset2", dset_id, lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_linkinfo(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Create a new link to the dataset with a different character encoding. */
- if(H5Pclose(lcpl_id)<0) TEST_ERROR;
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) <0) TEST_ERROR;
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR;
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
- if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
/* Check that its character encoding is ASCII */
- if(H5Lget_linkinfo(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
/* Check that the first link's encoding hasn't changed */
- if(H5Lget_linkinfo(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
-
+ if(H5Lget_linkinfo(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
-/* JAMES: these tests don't work because the character set encoding is
- * not stored in the symbol table.
- * Quincey says this will be fixed someday.
- */
-#ifdef NOTYET
/* Make sure that LCPLs work properly for other API calls: */
/* H5Lcreate_soft */
if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
@@ -900,25 +914,24 @@ test_lcpl(hid_t fapl)
/* H5Lmove */
if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_linkinfo(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
/* H5Lcopy */
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR;
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_linkinfo(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
+ if(H5Lget_linkinfo(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* H5Lcreate_external */
if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_linkinfo(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
-#endif /* NOTYET */
+ if(H5Lget_linkinfo(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Close open IDs */
- if(H5Pclose(lcpl_id)<0) TEST_ERROR;
- if(H5Sclose(space_id)<0) TEST_ERROR;
- if(H5Fclose(file_id)<0) TEST_ERROR;
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if(H5Sclose(space_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
return 0;
@@ -934,7 +947,6 @@ error:
} H5E_END_TRY;
return 1;
} /* end test_lcpl() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -954,103 +966,106 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_move(hid_t fapl)
+test_move(hid_t fapl, hbool_t new_format)
{
hid_t file_a, file_b=(-1);
hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1);
char filename[1024];
- TESTING("H5Lmove");
+ if(new_format)
+ TESTING("H5Lmove (w/new group format)")
+ else
+ TESTING("H5Lmove")
/* Create two new files */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- TEST_ERROR;
+ if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- TEST_ERROR;
+ if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create groups in first file */
- if((grp_1=H5Gcreate(file_a, "group1", 0))<0) TEST_ERROR;
- if((grp_2=H5Gcreate(file_a, "group2", 0))<0) TEST_ERROR;
- if((grp_move=H5Gcreate(grp_1, "group_move", 0))<0) TEST_ERROR;
+ if((grp_1=H5Gcreate(file_a, "group1", (size_t)0)) < 0) TEST_ERROR
+ if((grp_2=H5Gcreate(file_a, "group2", (size_t)0)) < 0) TEST_ERROR
+ if((grp_move=H5Gcreate(grp_1, "group_move", (size_t)0)) < 0) TEST_ERROR
/* Create hard and soft links. */
- if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
- if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Move a group within the file. Both of source and destination use
* H5L_SAME_LOC. Should fail. */
H5E_BEGIN_TRY {
if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)
- !=FAIL) TEST_ERROR;
+ !=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Move a group across files. Should fail. */
H5E_BEGIN_TRY {
if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)
- !=FAIL) TEST_ERROR;
+ !=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Move a group across groups in the same file while renaming it. */
- if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen(grp_2, "group_new_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Verify that the group is no longer in the original location */
H5E_BEGIN_TRY {
if((moved_grp = H5Gopen(grp_1, "group_move"))>=0)
- TEST_ERROR;
+ TEST_ERROR
} H5E_END_TRY;
/* Use H5Lmove to rename a group without moving it. */
- if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group. */
- if((moved_grp = H5Gopen(grp_2, "group_newer_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_2, "group_newer_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Use H5Lmove to move a group without renaming it. */
- if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group . */
- if((moved_grp = H5Gopen(grp_1, "group_newer_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_1, "group_newer_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Move the group while giving long paths. */
- if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen(grp_2, "group_newest_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_2, "group_newest_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Verify that the group is in no previous locations */
H5E_BEGIN_TRY {
if((moved_grp = H5Gopen(grp_1, "group_newer_name"))>=0)
- TEST_ERROR;
+ TEST_ERROR
if((moved_grp = H5Gopen(grp_2, "group_newer_name"))>=0)
- TEST_ERROR;
+ TEST_ERROR
if((moved_grp = H5Gopen(grp_2, "group_new_name"))>=0)
- TEST_ERROR;
+ TEST_ERROR
if((moved_grp = H5Gopen(grp_1, "group_copy"))>=0)
- TEST_ERROR;
+ TEST_ERROR
} H5E_END_TRY;
H5Gclose(grp_1);
@@ -1093,119 +1108,122 @@ test_move(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-test_copy(hid_t fapl)
+test_copy(hid_t fapl, hbool_t new_format)
{
hid_t file_a, file_b=(-1);
hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1);
char filename[1024];
- TESTING("H5Lcopy");
+ if(new_format)
+ TESTING("H5Lcopy (w/new group format)")
+ else
+ TESTING("H5Lcopy")
/* Create two new files */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- TEST_ERROR;
+ if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- TEST_ERROR;
+ if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
/* Create groups in first file */
- if((grp_1=H5Gcreate(file_a, "group1", 0))<0) TEST_ERROR;
- if((grp_2=H5Gcreate(file_a, "group2", 0))<0) TEST_ERROR;
- if((grp_move=H5Gcreate(grp_1, "group_copy", 0))<0) TEST_ERROR;
+ if((grp_1=H5Gcreate(file_a, "group1", (size_t)0)) < 0) TEST_ERROR
+ if((grp_2=H5Gcreate(file_a, "group2", (size_t)0)) < 0) TEST_ERROR
+ if((grp_move=H5Gcreate(grp_1, "group_copy", (size_t)0)) < 0) TEST_ERROR
/* Create hard and soft links. */
- if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
- if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Copy a group within the file. Both of source and destination use
* H5L_SAME_LOC. Should fail. */
H5E_BEGIN_TRY {
if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)
- !=FAIL) TEST_ERROR;
+ !=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Copy a group across files. Should fail. */
H5E_BEGIN_TRY {
if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)
- !=FAIL) TEST_ERROR;
+ !=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Move a group across groups in the same file while renaming it. */
- if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen(grp_2, "group_new_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Verify that the group is also in the original location */
- if((moved_grp = H5Gopen(grp_1, "group_copy"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_1, "group_copy")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Use H5Lcopy to create a group in the same location with a different name. */
- if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group. */
- if((moved_grp = H5Gopen(grp_2, "group_newer_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_2, "group_newer_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Verify that the group is also in the original location */
- if((moved_grp = H5Gopen(grp_2, "group_new_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Use H5Lcopy to copy to a different location with the same name. */
- if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group . */
- if((moved_grp = H5Gopen(grp_1, "group_newer_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_1, "group_newer_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Verify that the group is still in the previous location */
- if((moved_grp = H5Gopen(grp_2, "group_new_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Copy the group while giving long paths. */
- if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT)<0)
- TEST_ERROR;
+ if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen(grp_2, "group_newest_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_2, "group_newest_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Verify that the group is still in all previous original locations */
- if((moved_grp = H5Gopen(grp_1, "group_newer_name"))<0)
- TEST_ERROR;
+ if((moved_grp = H5Gopen(grp_1, "group_newer_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
- if((moved_grp = H5Gopen(grp_2, "group_newer_name"))<0)
- TEST_ERROR;
+ TEST_ERROR
+ if((moved_grp = H5Gopen(grp_2, "group_newer_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
- if((moved_grp = H5Gopen(grp_2, "group_new_name"))<0)
- TEST_ERROR;
+ TEST_ERROR
+ if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
- if((moved_grp = H5Gopen(grp_1, "group_copy"))<0)
- TEST_ERROR;
+ TEST_ERROR
+ if((moved_grp = H5Gopen(grp_1, "group_copy")) < 0)
+ TEST_ERROR
if( H5Gclose(moved_grp) < 0)
- TEST_ERROR;
+ TEST_ERROR
H5Gclose(grp_1);
H5Gclose(grp_2);
@@ -1228,8 +1246,8 @@ test_copy(hid_t fapl)
} H5E_END_TRY;
return 1;
}
+
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: test_move_preserves
*
@@ -1247,117 +1265,156 @@ test_copy(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-test_move_preserves(hid_t fapl_id)
+test_move_preserves(hid_t fapl_id, hbool_t new_format)
{
hid_t file_id=-1;
hid_t group_id=-1;
+ hid_t fcpl_id=-1; /* Group creation property list ID */
hid_t lcpl_id=-1;
hid_t lcpl2_id=-1;
H5G_stat_t statbuf;
H5L_linkinfo_t linfo;
- time_t old_create_time;
+ H5T_cset_t old_cset;
+ int64_t old_corder; /* Creation order value of link */
time_t old_modification_time;
time_t curr_time;
+ hbool_t track_corder; /* Status of creation order tracking for GCPL */
char filename[1024];
- TESTING("moving and copying links preserves their properties");
+ if(new_format)
+ TESTING("moving and copying links preserves their properties (w/new group format)")
+ else
+ TESTING("moving and copying links preserves their properties")
+
+ /* Create a file creation property list with creation order stored for links
+ * in the root group
+ */
+ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
+ if(H5Pget_creation_order_tracking(fcpl_id, &track_corder) < 0) TEST_ERROR
+ if(track_corder != FALSE) TEST_ERROR
+ if(H5Pset_creation_order_tracking(fcpl_id, TRUE) < 0) TEST_ERROR
+ if(H5Pget_creation_order_tracking(fcpl_id, &track_corder) < 0) TEST_ERROR
+ if(track_corder != TRUE) TEST_ERROR
/* Create file */
+ /* (with creation order tracking for the root group) */
h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
-
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id))<0) TEST_ERROR;
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR
/* Create a link creation property list with the UTF-8 character encoding */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) <0) TEST_ERROR;
- if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR;
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+
/* Create a group with that lcpl */
- if((group_id = H5Gcreate_expand(file_id, H5P_DEFAULT, H5P_DEFAULT)) <0) TEST_ERROR;
- if(H5Llink(file_id, "group", group_id, lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Gclose(group_id) < 0) TEST_ERROR;
-
- /* Get the group's link's creation time */
- if(H5Lget_linkinfo(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) <0) TEST_ERROR;
- old_create_time = linfo.ctime;
+ if((group_id = H5Gcreate_expand(file_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Llink(file_id, "group", group_id, lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Get the group's link's information */
+ if(H5Lget_linkinfo(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) < 0) TEST_ERROR
+ old_cset = linfo.cset;
+ if(old_cset != H5T_CSET_UTF8) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ old_corder = linfo.corder;
+ if(old_corder != 0) TEST_ERROR
old_modification_time = statbuf.mtime;
- /* If this test happens too quickly, the creation times will all be the same. Make sure the time changes. */
- curr_time=time(NULL);
- while(time(NULL) <= curr_time );
+ /* If this test happens too quickly, the times will all be the same. Make sure the time changes. */
+ curr_time = HDtime(NULL);
+ while(HDtime(NULL) <= curr_time)
+ ;
/* Close the file and reopen it */
- if(H5Fclose(file_id)<0) TEST_ERROR;
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) <0) TEST_ERROR;
-
- /* Get the group's link's creation time. The times should be unchanged */
- if(H5Lget_linkinfo(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) <0) TEST_ERROR;
- if(old_modification_time != statbuf.mtime) TEST_ERROR;
- if(old_create_time != linfo.ctime) TEST_ERROR;
-
- /* Create a new link to the group. It should have a different creation time but the same modification time */
- if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "group2", TRUE, &statbuf) <0) TEST_ERROR;
- if(old_modification_time != statbuf.mtime) TEST_ERROR;
- if(H5Lget_linkinfo(file_id, "group2", &linfo, H5P_DEFAULT) <0) TEST_ERROR;
- if(old_create_time == linfo.ctime) TEST_ERROR;
-
- /* Copy the first link to a UTF-8 name. Its creation time and modification time should not change. */
- if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) <0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "group_copied", TRUE, &statbuf) <0) TEST_ERROR;
- if(old_modification_time != statbuf.mtime) TEST_ERROR;
- if(H5Lget_linkinfo(file_id, "group_copied", &linfo, H5P_DEFAULT) <0) TEST_ERROR;
- if(old_create_time != linfo.ctime) TEST_ERROR;
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
+
+ /* Get the link's character set & modification time . They should be unchanged */
+ if(H5Lget_linkinfo(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) < 0) TEST_ERROR
+ if(old_modification_time != statbuf.mtime) TEST_ERROR
+ if(old_cset != linfo.cset) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(old_corder != linfo.corder) TEST_ERROR
+
+ /* Create a new link to the group. It should have a different creation order value but the same modification time */
+ if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "group2", TRUE, &statbuf) < 0) TEST_ERROR
+ if(old_modification_time != statbuf.mtime) TEST_ERROR
+ if(H5Lget_linkinfo(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_corder == linfo.corder) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 1) TEST_ERROR
+ if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+
+ /* Copy the first link to a UTF-8 name.
+ * Its creation order value should be different, but modification time
+ * should not change.
+ */
+ if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "group_copied", TRUE, &statbuf) < 0) TEST_ERROR
+ if(old_modification_time != statbuf.mtime) TEST_ERROR
+ if(H5Lget_linkinfo(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 2) TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Move the link with the default property list. */
- if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) <0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "group_copied2", TRUE, &statbuf) <0) TEST_ERROR;
- if(old_modification_time != statbuf.mtime) TEST_ERROR;
- if(H5Lget_linkinfo(file_id, "group_copied2", &linfo, H5P_DEFAULT) <0) TEST_ERROR;
- if(old_create_time != linfo.ctime) TEST_ERROR;
+ if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "group_copied2", TRUE, &statbuf) < 0) TEST_ERROR
+ if(old_modification_time != statbuf.mtime) TEST_ERROR
+ if(H5Lget_linkinfo(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 3) TEST_ERROR
/* Check that its character encoding is not UTF-8 */
- if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR;
+ if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
/* Check that the original link is unchanged */
- if(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) <0) TEST_ERROR;
- if(old_modification_time != statbuf.mtime) TEST_ERROR;
- if(H5Lget_linkinfo(file_id, "group", &linfo, H5P_DEFAULT) <0) TEST_ERROR;
- if(old_create_time != linfo.ctime) TEST_ERROR;
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
-
- /* Move the first link to a UTF-8 name. Its creation time and modification time should not change. */
- if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) <0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "group_moved", TRUE, &statbuf) <0) TEST_ERROR;
- if(old_modification_time != statbuf.mtime) TEST_ERROR;
- if(H5Lget_linkinfo(file_id, "group_moved", &linfo, H5P_DEFAULT) <0) TEST_ERROR;
- if(old_create_time != linfo.ctime) TEST_ERROR;
+ if(H5Gget_objinfo(file_id, "group", TRUE, &statbuf) < 0) TEST_ERROR
+ if(old_modification_time != statbuf.mtime) TEST_ERROR
+ if(H5Lget_linkinfo(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(old_corder != linfo.corder) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Move the first link to a UTF-8 name.
+ * Its creation order value will change, but modification time should not
+ * change. */
+ if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "group_moved", TRUE, &statbuf) < 0) TEST_ERROR
+ if(old_modification_time != statbuf.mtime) TEST_ERROR
+ if(H5Lget_linkinfo(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 4) TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR;
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Move the link again using the default property list. */
- if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) <0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "group_moved_again", TRUE, &statbuf) <0) TEST_ERROR;
- if(old_modification_time != statbuf.mtime) TEST_ERROR;
- if(H5Lget_linkinfo(file_id, "group_moved_again", &linfo, H5P_DEFAULT) <0) TEST_ERROR;
- if(old_create_time != linfo.ctime) TEST_ERROR;
+ if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "group_moved_again", TRUE, &statbuf) < 0) TEST_ERROR
+ if(old_modification_time != statbuf.mtime) TEST_ERROR
+ if(H5Lget_linkinfo(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 5) TEST_ERROR
/* Check that its character encoding is not UTF-8 */
- if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR;
+ if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
/* Close open IDs */
- if(H5Pclose(lcpl_id) < 0) TEST_ERROR;
- if(H5Fclose(file_id)<0) TEST_ERROR;
+ if(H5Pclose(fcpl_id) < 0) TEST_ERROR
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
+ H5Pclose(fcpl_id);
H5Pclose(lcpl_id);
H5Pclose(lcpl2_id);
H5Gclose(group_id);
@@ -1365,7 +1422,6 @@ error:
} H5E_END_TRY;
return 1;
} /* end test_move_preserves() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -1384,7 +1440,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_compat(hid_t fapl)
+test_compat(hid_t fapl, hbool_t new_format)
{
hid_t file_id=-1;
hid_t group1_id=-1;
@@ -1393,76 +1449,79 @@ test_compat(hid_t fapl)
char filename[1024];
char linkval[1024];
- TESTING("backwards compatibility");
+ if(new_format)
+ TESTING("backwards compatibility (w/new group format)")
+ else
+ TESTING("backwards compatibility")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create two groups in the file */
- if((group1_id = H5Gcreate(file_id, "group1", 1)) < 0) TEST_ERROR;
- if((group2_id = H5Gcreate(file_id, "group2", 1)) < 0) TEST_ERROR;
+ if((group1_id = H5Gcreate(file_id, "group1", (size_t)1)) < 0) TEST_ERROR
+ if((group2_id = H5Gcreate(file_id, "group2", (size_t)1)) < 0) TEST_ERROR
/* Create links using H5Glink and H5Glink2 */
- if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) TEST_ERROR;
- if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) TEST_ERROR;
- if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) TEST_ERROR;
+ if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) TEST_ERROR
+ if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) TEST_ERROR
+ if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) TEST_ERROR
/* Test that H5Glink created hard links properly */
- if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1)<0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2)<0) TEST_ERROR;
+ if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) TEST_ERROR
if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) {
H5_FAILED();
puts(" Hard link test failed. Link seems not to point to the ");
puts(" expected file location.");
- TEST_ERROR;
+ TEST_ERROR
}
/* Test for the other hard link created */
- if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1)<0) TEST_ERROR;
- if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2)<0) TEST_ERROR;
+ if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) TEST_ERROR
if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) {
H5_FAILED();
puts(" Hard link test failed. Link seems not to point to the ");
puts(" expected file location.");
- TEST_ERROR;
+ TEST_ERROR
}
/* Test the soft link */
- if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1)<0) TEST_ERROR;
- if(sb_soft1.type != H5G_LINK) TEST_ERROR;
- if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR;
+ if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) TEST_ERROR
+ if(sb_soft1.type != H5G_LINK) TEST_ERROR
+ if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR
- if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, linkval) < 0) TEST_ERROR;
- if(HDstrcmp("link_to_group1", linkval)) TEST_ERROR;
+ if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, linkval) < 0) TEST_ERROR
+ if(HDstrcmp("link_to_group1", linkval)) TEST_ERROR
/* Test H5Gmove and H5Gmove2 */
- if(H5Gmove(file_id, "group1", "moved_group1") < 0) TEST_ERROR;
- if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) TEST_ERROR;
+ if(H5Gmove(file_id, "group1", "moved_group1") < 0) TEST_ERROR
+ if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) TEST_ERROR
/* Ensure that both groups can be opened */
- if(H5Gclose(group2_id)<0) TEST_ERROR;
- if(H5Gclose(group1_id)<0) TEST_ERROR;
+ if(H5Gclose(group2_id) < 0) TEST_ERROR
+ if(H5Gclose(group1_id) < 0) TEST_ERROR
- if((group1_id = H5Gopen(file_id, "moved_group1")) < 0) TEST_ERROR;
- if((group2_id = H5Gopen(file_id, "moved_group1/moved_group2")) < 0) TEST_ERROR;
+ if((group1_id = H5Gopen(file_id, "moved_group1")) < 0) TEST_ERROR
+ if((group2_id = H5Gopen(file_id, "moved_group1/moved_group2")) < 0) TEST_ERROR
/* Close open IDs */
- if(H5Gclose(group2_id)<0) TEST_ERROR;
- if(H5Gclose(group1_id)<0) TEST_ERROR;
+ if(H5Gclose(group2_id) < 0) TEST_ERROR
+ if(H5Gclose(group1_id) < 0) TEST_ERROR
/* Test H5Gunlink */
- if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) TEST_ERROR;
+ if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) TEST_ERROR
H5E_BEGIN_TRY {
- if(H5Gopen(file_id, "moved_group1/moved_group2") >=0) TEST_ERROR;
+ if(H5Gopen(file_id, "moved_group1/moved_group2") >=0) TEST_ERROR
} H5E_END_TRY;
- if(H5Fclose(file_id)<0) TEST_ERROR;
+ if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1494,7 +1553,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-external_link_root(hid_t fapl)
+external_link_root(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -1506,29 +1565,32 @@ external_link_root(hid_t fapl)
char *file; /* File from external link */
char *path; /* Path from external link */
- TESTING("external link to root");
+ if(new_format)
+ TESTING("external link to root (w/new group format)")
+ else
+ TESTING("external link to root")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create file to point to */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Check that external links are registered with the library */
- if(H5Lis_registered(H5L_LINK_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
/* Create file with link to first file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Check information for external link */
- if (H5Gget_objinfo(fid, "ext_link", FALSE, &sb)<0) goto error;
+ if (H5Gget_objinfo(fid, "ext_link", FALSE, &sb) < 0) goto error;
if (H5G_UDLINK!=sb.type) {
H5_FAILED();
puts(" Unexpected object type - should have been an external link");
@@ -1550,12 +1612,12 @@ external_link_root(hid_t fapl)
}
/* Close and re-open file to ensure that data is written to disk */
- if(H5Fclose(fid) < 0) TEST_ERROR;
- if((fid = H5Fopen(filename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -1568,7 +1630,7 @@ external_link_root(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Create a new object using H5Gcreate through the external link
* directly
@@ -1576,15 +1638,15 @@ external_link_root(hid_t fapl)
if((gid = H5Gcreate(fid, "ext_link/newer_group", (size_t)0)) < 0) TEST_ERROR
/* Close file and group */
- if(H5Gclose(gid) < 0) TEST_ERROR;
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file again with read-only access and check on objects created */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open objects created through external link */
- if((gid = H5Gopen(fid, "new_group")) < 0) TEST_ERROR;
- if((gid2 = H5Gopen(fid, "newer_group")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "new_group")) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid, "newer_group")) < 0) TEST_ERROR
/* Check names */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -1597,7 +1659,7 @@ external_link_root(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Verify that new objects can't be created through a read-only external
* link.
@@ -1610,7 +1672,7 @@ external_link_root(hid_t fapl)
if(gid >= 0) TEST_ERROR
/* Close second file again */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1643,7 +1705,7 @@ external_link_root(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-external_link_path(hid_t fapl)
+external_link_path(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -1652,14 +1714,17 @@ external_link_path(hid_t fapl)
char filename1[NAME_BUF_SIZE];
char filename2[NAME_BUF_SIZE];
- TESTING("external link to object on path");
+ if(new_format)
+ TESTING("external link to object on path (w/new group format)")
+ else
+ TESTING("external link to object on path")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create file to point to */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create object down a path */
if((gid = H5Gcreate(fid, "A", (size_t)0)) < 0) TEST_ERROR
@@ -1672,17 +1737,17 @@ external_link_path(hid_t fapl)
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Create file with link to first file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -1695,27 +1760,27 @@ external_link_path(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Close second file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file again and check on object created */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open object created through external link */
- if((gid = H5Gopen(fid, "/A/B/C/new_group")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "/A/B/C/new_group")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
@@ -1749,7 +1814,7 @@ external_link_path(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-external_link_mult(hid_t fapl)
+external_link_mult(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1), fid2 = (-1); /* File IDs */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -1760,7 +1825,10 @@ external_link_mult(hid_t fapl)
filename3[NAME_BUF_SIZE],
filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */
- TESTING("external links across multiple files");
+ if(new_format)
+ TESTING("external links across multiple files (w/new group format)")
+ else
+ TESTING("external links across multiple files")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
@@ -1769,7 +1837,7 @@ external_link_mult(hid_t fapl)
h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4);
/* Create first file to point to */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create object down a path */
if((gid = H5Gcreate(fid, "A", (size_t)0)) < 0) TEST_ERROR
@@ -1782,10 +1850,10 @@ external_link_mult(hid_t fapl)
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file to point to */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link down a path */
if((gid = H5Gcreate(fid, "D", (size_t)0)) < 0) TEST_ERROR
@@ -1794,15 +1862,15 @@ external_link_mult(hid_t fapl)
if((gid = H5Gcreate(fid, "D/E", (size_t)0)) < 0) TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename1, "/A/B/C", gid, "F", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename1, "/A/B/C", gid, "F", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Create third file to point to */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link down a path */
if((gid = H5Gcreate(fid, "G", (size_t)0)) < 0) TEST_ERROR
@@ -1811,22 +1879,22 @@ external_link_mult(hid_t fapl)
if((gid = H5Gcreate(fid, "G/H", (size_t)0)) < 0) TEST_ERROR
/* Create external link to object in second file */
- if(H5Lcreate_external(filename2, "/D/E/F", gid, "I", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename2, "/D/E/F", gid, "I", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Create file with link to third file */
- if((fid=H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to object in first file */
- if(H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -1839,17 +1907,17 @@ external_link_mult(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Close second file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file again and check on object created */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open object created through external link */
- if((gid = H5Gopen(fid, "/A/B/C/new_group")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "/A/B/C/new_group")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -1859,26 +1927,26 @@ external_link_mult(hid_t fapl)
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open an object through external links */
- if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) <0) TEST_ERROR
+ if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR
/* The intermediate files should not stay open. Replace one of them with a new file. */
- if((fid2=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
- if(H5Fclose(fid2)<0) TEST_ERROR
+ if((fid2=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
/* Open the other with write access and delete the external link in it */
- if((fid2=H5Fopen(filename3, H5F_ACC_RDWR, fapl))<0) TEST_ERROR
+ if((fid2=H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
if(H5Lunlink(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Fclose(fid2)<0) TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
/* Cleanup */
if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid)<0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1909,9 +1977,8 @@ external_link_mult(hid_t fapl)
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_GROUP_REVISION
static int
-external_link_self(hid_t fapl)
+external_link_self(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -1922,7 +1989,10 @@ external_link_self(hid_t fapl)
char filename2[NAME_BUF_SIZE];
char filename3[NAME_BUF_SIZE];
- TESTING("external link to self");
+ if(new_format)
+ TESTING("external link to self (w/new group format)")
+ else
+ TESTING("external link to self")
/* Set up filename */
h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
@@ -1930,10 +2000,10 @@ external_link_self(hid_t fapl)
h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1);
/* Create file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an lcpl with intermediate group creation set */
- if((lcpl_id=H5Pcreate(H5P_LINK_CREATE))<0) TEST_ERROR
+ if((lcpl_id=H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
/* Create a series of groups within the file: /A/B and /X/Y/Z */
@@ -1944,13 +2014,13 @@ external_link_self(hid_t fapl)
if(H5Llink(fid, "X/Y", gid, lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Pclose (lcpl_id) <0) TEST_ERROR
+ if(H5Pclose (lcpl_id) < 0) TEST_ERROR
/* Create external link to own root group*/
- if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen(fid, "A/B/C/")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "A/B/C/")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -1963,20 +2033,20 @@ external_link_self(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close object opened through external link */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Check on object created */
- if((gid = H5Gopen(fid, "X/new_group")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "X/new_group")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Complicate things. Use this file as an intermediate file in a chain
@@ -1984,7 +2054,7 @@ external_link_self(hid_t fapl)
*/
/* Create file2 with an external link to file1 */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -1992,8 +2062,8 @@ external_link_self(hid_t fapl)
if(H5Fclose(fid) < 0) TEST_ERROR
/* Create file3 as a target */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR
- if((gid=H5Gcreate(fid, "end", 0)) < 0) TEST_ERROR
+ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid=H5Gcreate(fid, "end", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -2012,7 +2082,7 @@ external_link_self(hid_t fapl)
if((gid=H5Gopen(fid, "ext_link/B/C/Y/Z/end")) < 0) TEST_ERROR
/* Create object through external link */
- if((gid2 = H5Gcreate(gid, "newer_group", 0)) < 0) TEST_ERROR
+ if((gid2 = H5Gcreate(gid, "newer_group", (size_t)0)) < 0) TEST_ERROR
/* Cleanup */
if(H5Gclose(gid2) < 0) TEST_ERROR
@@ -2040,7 +2110,6 @@ external_link_self(hid_t fapl)
} H5E_END_TRY;
return -1;
} /* end external_link_self() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -2068,7 +2137,7 @@ external_link_self(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-external_link_pingpong(hid_t fapl)
+external_link_pingpong(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -2077,44 +2146,47 @@ external_link_pingpong(hid_t fapl)
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- TESTING("external links back and forth");
+ if(new_format)
+ TESTING("external links back and forth (w/new group format)")
+ else
+ TESTING("external links back and forth")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external links for chain */
- if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create final object */
if((gid = H5Gcreate(fid, "final", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external links for chain */
- if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0) TEST_ERROR;
+ if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Open object through external link */
- if((gid = H5Gopen(fid, "link1")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "link1")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -2127,27 +2199,27 @@ external_link_pingpong(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file again and check on object created */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open object created through external link */
- if((gid = H5Gopen(fid, "/final/new_group")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "/final/new_group")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
@@ -2167,7 +2239,7 @@ external_link_pingpong(hid_t fapl)
* Function: external_link_toomany
*
* Purpose: Build a file with too many external links to objects (i.e.
- * more than H5G_NLINKS. Use a "back & forth" style of
+ * more than H5L_NLINKS_DEF. Use a "back & forth" style of
* linking (like the "ping pong" test above) to minimize the
* number of files involved:
*
@@ -2201,7 +2273,7 @@ external_link_pingpong(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-external_link_toomany(hid_t fapl)
+external_link_toomany(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -2210,7 +2282,10 @@ external_link_toomany(hid_t fapl)
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- TESTING("too many external links");
+ if(new_format)
+ TESTING("too many external links (w/new group format)")
+ else
+ TESTING("too many external links")
/* Make certain test is valid */
/* XXX: should probably make a "generic" test that creates the proper
@@ -2223,45 +2298,45 @@ external_link_toomany(hid_t fapl)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external links for chain */
- if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link8", fid, "link7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link10", fid, "link9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link12", fid, "link11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link14", fid, "link13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/link16", fid, "link15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/final", fid, "link17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link8", fid, "link7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link10", fid, "link9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link12", fid, "link11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link14", fid, "link13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link16", fid, "link15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/final", fid, "link17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external links for chain */
- if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/link7", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/link9", fid, "link8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/link11", fid, "link10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/link13", fid, "link12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/link15", fid, "link14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename1, "/link17", fid, "link16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link7", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link9", fid, "link8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link11", fid, "link10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link13", fid, "link12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link15", fid, "link14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link17", fid, "link16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create final object */
if((gid = H5Gcreate(fid, "final", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0) TEST_ERROR;
+ if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Open object through external link */
H5E_BEGIN_TRY {
@@ -2274,7 +2349,7 @@ external_link_toomany(hid_t fapl)
}
/* Open object through external link */
- if((gid = H5Gopen(fid, "link3")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "link3")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -2287,10 +2362,10 @@ external_link_toomany(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close external object */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
@@ -2324,38 +2399,41 @@ external_link_toomany(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-external_link_dangling(hid_t fapl)
+external_link_dangling(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group IDs */
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- TESTING("dangling external links");
+ if(new_format)
+ TESTING("dangling external links (w/new group format)")
+ else
+ TESTING("dangling external links")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create dangling external links */
- if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external(filename2, "/missing", fid, "no_object", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/missing", fid, "no_object", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file (for dangling object test) */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0) TEST_ERROR;
+ if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Open object through dangling file external link */
H5E_BEGIN_TRY {
@@ -2378,7 +2456,7 @@ external_link_dangling(hid_t fapl)
}
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
@@ -2409,29 +2487,32 @@ external_link_dangling(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-external_link_recursive(hid_t fapl)
+external_link_recursive(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group IDs */
char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */
- TESTING("recursive external links");
+ if(new_format)
+ TESTING("recursive external links (w/new group format)")
+ else
+ TESTING("recursive external links")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
/* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create recursive external links */
- if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0) TEST_ERROR;
+ if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Open object through dangling file external link */
H5E_BEGIN_TRY {
@@ -2444,7 +2525,7 @@ external_link_recursive(hid_t fapl)
}
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
@@ -2476,7 +2557,7 @@ external_link_recursive(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-external_link_query(hid_t fapl)
+external_link_query(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group IDs */
@@ -2488,15 +2569,17 @@ external_link_query(hid_t fapl)
filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
-
- TESTING("query aspects of external link");
+ if(new_format)
+ TESTING("query aspects of external link (w/new group format)")
+ else
+ TESTING("query aspects of external link")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file, with external link to object in second file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link */
if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2504,50 +2587,50 @@ external_link_query(hid_t fapl)
/* Get size of buffer for external link */
if(H5Lget_linkinfo(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.link_size != (HDstrlen(filename2) + HDstrlen("/dst") + 2)) TEST_ERROR
- if (H5L_LINK_EXTERNAL != li.linkclass) {
+ if (H5L_TYPE_EXTERNAL != li.type) {
H5_FAILED();
puts(" Unexpected link class - should have been an external link");
goto error;
}
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file to point to */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create object to link to */
if((gid = H5Gcreate(fid, "dst", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0) TEST_ERROR
+ if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Get size of buffer for external link */
if(H5Lget_linkinfo(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.link_size != (HDstrlen(filename2) + HDstrlen("/dst") + 2)) TEST_ERROR
- if (H5L_LINK_EXTERNAL != li.linkclass) {
+ if (H5L_TYPE_EXTERNAL != li.type) {
H5_FAILED();
puts(" Unexpected link class - should have been an external link");
goto error;
}
/* Get information for external link. It should be two strings right after each other */
- if(H5Lget_linkval(fid, "src", NAME_BUF_SIZE, query_buf, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lget_linkval(fid, "src", (size_t)NAME_BUF_SIZE, query_buf, H5P_DEFAULT) < 0) TEST_ERROR
/* Extract the file and object names from the buffer */
if(H5Lunpack_elink_val(query_buf, &file_name, &object_name) < 0) TEST_ERROR
/* Compare the file and object names */
- if(strcmp(file_name, filename2)) TEST_ERROR;
+ if(strcmp(file_name, filename2)) TEST_ERROR
if(strcmp(object_name, "/dst")) TEST_ERROR
/* Query information about object that external link points to */
- if (H5Gget_objinfo(fid, "src", TRUE, &sb)<0) goto error;
+ if (H5Gget_objinfo(fid, "src", TRUE, &sb) < 0) goto error;
if (H5G_GROUP != sb.type) {
H5_FAILED();
puts(" Unexpected object type - should have been a group");
@@ -2555,7 +2638,7 @@ external_link_query(hid_t fapl)
}
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Make sure that passing in NULLs to H5Lunpack_elink_val works */
if(H5Lunpack_elink_val(query_buf, NULL, NULL) < 0) TEST_ERROR
@@ -2591,14 +2674,17 @@ external_link_query(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-external_link_unlink_compact(hid_t fapl)
+external_link_unlink_compact(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- TESTING("unlinking external link in compact group");
+ if(new_format)
+ TESTING("unlinking external link in compact group (w/new group format)")
+ else
+ TESTING("unlinking external link in compact group")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
@@ -2673,9 +2759,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-#ifdef H5_GROUP_REVISION
static int
-external_link_unlink_dense(hid_t fapl)
+external_link_unlink_dense(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gcpl = (-1); /* Group creation property list ID */
@@ -2688,7 +2773,10 @@ external_link_unlink_dense(hid_t fapl)
unsigned min_dense; /* Minimum # of links to store in group "densely" */
unsigned u; /* Local index variable */
- TESTING("unlinking external link in dense group");
+ if(new_format)
+ TESTING("unlinking external link in dense group (w/new group format)")
+ else
+ TESTING("unlinking external link in dense group")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
@@ -2712,10 +2800,10 @@ external_link_unlink_dense(hid_t fapl)
if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Check on root group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR;
- if(nmsgs != 1) TEST_ERROR;
- if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
+ if(nmsgs != 1) TEST_ERROR
+ if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR
/* Create enough objects in the root group to change it into a "dense" group */
for(u = 0; u < max_compact; u++) {
@@ -2725,9 +2813,9 @@ external_link_unlink_dense(hid_t fapl)
} /* end for */
/* Check on root group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR;
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Close group creation property list */
if(H5Pclose(gcpl) < 0) TEST_ERROR
@@ -2767,10 +2855,11 @@ external_link_unlink_dense(hid_t fapl)
} /* end for */
/* Check on root group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR;
- if(nmsgs != (min_dense - 1)) TEST_ERROR;
- if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
+ if(nmsgs != (min_dense - 1)) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR
/* Close root group */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -2801,7 +2890,6 @@ error:
} H5E_END_TRY;
return -1;
} /* end external_link_unlink_dense() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -2818,7 +2906,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-external_link_move(hid_t fapl)
+external_link_move(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -2827,7 +2915,10 @@ external_link_move(hid_t fapl)
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- TESTING("move external link");
+ if(new_format)
+ TESTING("move external link (w/new group format)")
+ else
+ TESTING("move external link")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
@@ -2993,7 +3084,6 @@ error:
} /* end external_link_move() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: external_link_ride
*
@@ -3009,7 +3099,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-external_link_ride(hid_t fapl)
+external_link_ride(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gcpl = (-1); /* Group creation property list ID */
@@ -3023,7 +3113,10 @@ external_link_ride(hid_t fapl)
unsigned min_dense; /* Minimum # of links to store in group "densely" */
unsigned u; /* Local index variable */
- TESTING("external link along for the ride");
+ if(new_format)
+ TESTING("external link along for the ride (w/new group format)")
+ else
+ TESTING("external link along for the ride")
/* Set up filenames */
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
@@ -3050,18 +3143,23 @@ external_link_ride(hid_t fapl)
} /* end for */
/* Check on root group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR;
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
+ if(new_format) {
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR
+ } /* end else */
/* Create external link */
/* (This also covers the case of adding an external link to a dense group) */
if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Check on root group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR;
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Close group creation property list */
if(H5Pclose(gcpl) < 0) TEST_ERROR
@@ -3113,10 +3211,11 @@ external_link_ride(hid_t fapl)
} /* end for */
/* Check on root group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR;
- if(nmsgs != (min_dense - 1)) TEST_ERROR;
- if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
+ if(nmsgs != (min_dense - 1)) TEST_ERROR
+ if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) == TRUE) TEST_ERROR
/* Close root group */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3170,7 +3269,6 @@ error:
} H5E_END_TRY;
return -1;
} /* end external_link_ride() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -3188,7 +3286,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-external_link_closing(hid_t fapl)
+external_link_closing(hid_t fapl, hbool_t new_format)
{
hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1);
hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1);
@@ -3203,7 +3301,10 @@ external_link_closing(hid_t fapl)
H5G_stat_t sb;
hobj_ref_t obj_ref;
- TESTING("that external files are closed during traversal");
+ if(new_format)
+ TESTING("that external files are closed during traversal (w/new group format)")
+ else
+ TESTING("that external files are closed during traversal")
/* In this test, external links will go from file1 to file2 and from
* file2 to file3.
@@ -3243,7 +3344,7 @@ external_link_closing(hid_t fapl)
if(H5Fclose(fid2) < 0) TEST_ERROR
/* Test creating each kind of object */
- if((gid = H5Gcreate(fid1, "elink/elink/elink/group1", 0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid1, "elink/elink/elink/group1", (size_t)0)) < 0) TEST_ERROR
if(H5Tcommit(fid1, "elink/elink/elink/type1", tid) < 0) TEST_ERROR
if((did = H5Dcreate(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close objects */
@@ -3303,7 +3404,7 @@ external_link_closing(hid_t fapl)
if(H5Dclose(did) < 0) TEST_ERROR
/* Test H5Fmount */
- if((gid = H5Gcreate(fid1, "elink/elink/elink/mnt", 0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid1, "elink/elink/elink/mnt", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
H5E_BEGIN_TRY {
if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR
@@ -3330,19 +3431,18 @@ external_link_closing(hid_t fapl)
if(H5Fclose(fid2) < 0) TEST_ERROR
/* Do an external link traversal that recursively calls another external link. */
- if((gid = H5Gcreate(fid1, "elink/elink2/group2", 0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid1, "elink/elink2/group2", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
/* Create two more groups so that the last three elements in the path are
* all within the same external file
*/
- if((gid = H5Gcreate(fid1, "elink/elink2/group2/group3", 0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid1, "elink/elink2/group2/group3", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
- if((gid = H5Gcreate(fid1, "elink/elink2/group2/group3/group4", 0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid1, "elink/elink2/group2/group3/group4", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Gget_objinfo(fid1, "elink/elink2/group2/group3/group4", TRUE, &sb) < 0) TEST_ERROR
-#ifdef H5_GROUP_REVISION
/* Add a few regular groups and a soft link in file2 using intermediate group creation */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
@@ -3353,17 +3453,16 @@ external_link_closing(hid_t fapl)
* slink points to (file2)/elink2, which points to (file3)/elink, which
* points to file 4.
*/
- if((gid = H5Gcreate(fid1, "elink/file2group1/file2group2/slink/group3", 0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid1, "elink/file2group1/file2group2/slink/group3", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Lget_linkinfo(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
/* Some simpler tests */
- if((gid = H5Gcreate(fid1, "elink/file2group3", 0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid1, "elink/file2group3", (size_t)0)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Lget_linkinfo(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Lget_linkinfo(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
-#endif /* H5_GROUP_REVISION */
/* Close file1, the only file that should still be open */
if(H5Fclose(fid1) < 0) TEST_ERROR
@@ -3417,7 +3516,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-external_link_endian(hid_t fapl)
+external_link_endian(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -3426,7 +3525,10 @@ external_link_endian(hid_t fapl)
char pathbuf[NAME_BUF_SIZE]; /* Path to the files */
char namebuf[NAME_BUF_SIZE];
- TESTING("endianness of external links");
+ if(new_format)
+ TESTING("endianness of external links (w/new group format)")
+ else
+ TESTING("endianness of external links")
/*
* Create the name of the file to open (in case we are using the --srcdir
@@ -3441,40 +3543,40 @@ external_link_endian(hid_t fapl)
HDstrcpy(pathbuf, "");
/* Create a link access property list with the path to the srcdir */
- if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR;
- if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR;
+ if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
+ if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR
- if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR;
+ if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR
HDstrcpy(namebuf, pathbuf);
HDstrcat(namebuf, LE_FILENAME);
/* Test LE file; try to open a group through the external link */
- if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
- if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR;
+ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR
/* Open a group in the external file using that group ID */
- if((gid2 = H5Gopen(gid, "subgroup")) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(gid, "subgroup")) < 0) TEST_ERROR
/* Close the IDs */
- if(H5Gclose(gid2) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
- if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR;
+ if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR
HDstrcpy(namebuf, pathbuf);
HDstrcat(namebuf, BE_FILENAME);
/* Test BE file; try to open a group through the external link */
- if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
- if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR;
+ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR
/* Open a group in the external file using that group ID */
- if((gid2 = H5Gopen(gid, "subgroup")) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(gid, "subgroup")) < 0) TEST_ERROR
/* Close the IDs */
- if(H5Gclose(gid2) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3504,7 +3606,8 @@ error:
*/
/* Callback functions for UD hard links. */
/* UD_hard_create increments the object's reference count */
-static herr_t UD_hard_create(const char UNUSED * link_name, hid_t loc_group, void * udata, size_t udata_size, hid_t UNUSED lcpl_id)
+static herr_t
+UD_hard_create(const char UNUSED * link_name, hid_t loc_group, void * udata, size_t udata_size, hid_t UNUSED lcpl_id)
{
haddr_t addr;
hid_t target_obj = -1;
@@ -3540,15 +3643,15 @@ done:
switch(H5Iget_type(target_obj))
{
case H5I_GROUP:
- if(H5Gclose(target_obj) <0)
+ if(H5Gclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATASET:
- if(H5Dclose(target_obj) <0)
+ if(H5Dclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATATYPE:
- if(H5Tclose(target_obj) <0)
+ if(H5Tclose(target_obj) < 0)
ret_value = -1;
break;
default:
@@ -3560,7 +3663,8 @@ done:
}
/* UD_hard_delete decrements the object's reference count */
-static herr_t UD_hard_delete(const char UNUSED * link_name, hid_t loc_group, void * udata, size_t udata_size)
+static herr_t
+UD_hard_delete(const char UNUSED * link_name, hid_t loc_group, void * udata, size_t udata_size)
{
haddr_t addr;
hid_t target_obj = -1;
@@ -3596,15 +3700,15 @@ done:
switch(H5Iget_type(target_obj))
{
case H5I_GROUP:
- if(H5Gclose(target_obj) <0)
+ if(H5Gclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATASET:
- if(H5Dclose(target_obj) <0)
+ if(H5Dclose(target_obj) < 0)
ret_value = -1;
break;
case H5I_DATATYPE:
- if(H5Tclose(target_obj) <0)
+ if(H5Tclose(target_obj) < 0)
ret_value = -1;
break;
default:
@@ -3615,7 +3719,8 @@ done:
return ret_value;
}
-static hid_t UD_hard_traverse(const char UNUSED *link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t UNUSED lapl_id)
+static hid_t
+UD_hard_traverse(const char UNUSED *link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t UNUSED lapl_id)
{
haddr_t addr;
hid_t ret_value = -1;
@@ -3630,8 +3735,8 @@ static hid_t UD_hard_traverse(const char UNUSED *link_name, hid_t cur_group, voi
return ret_value;
}
-const H5L_link_class_t UD_hard_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_hard_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_HARD_TYPE, /* Link type id number */
"UD_hard_link", /* Link class name for debugging */
UD_hard_create, /* Creation callback */
@@ -3653,49 +3758,49 @@ ud_hard_links(hid_t fapl)
h5_stat_size_t empty_size; /* Size of an empty file */
char filename[NAME_BUF_SIZE];
- TESTING("user-defined hard link");
+ TESTING("user-defined hard link (w/new group format)")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Get the size of the empty file for reference */
- if(H5Fclose(fid) < 0) TEST_ERROR;
- if((empty_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if((empty_size = h5_get_file_size(filename))==0) TEST_ERROR
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Check that external links are registered and UD hard links are not */
- if(H5Lis_registered(H5L_LINK_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered(UD_HARD_TYPE) != 0) TEST_ERROR
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered(UD_HARD_TYPE) != FALSE) TEST_ERROR
/* Register "user-defined hard links" with the library */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
/* Check that UD hard links are now registered */
- if(H5Lis_registered(H5L_LINK_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
if(H5Lis_registered(UD_HARD_TYPE) != TRUE) TEST_ERROR
/* Create a group for the UD hard link to point to */
- if((gid = H5Gcreate(fid, "group", 0)) <0) TEST_ERROR;
+ if((gid = H5Gcreate(fid, "group", (size_t)0)) < 0) TEST_ERROR
/* Get address for the group to give to the hard link */
- if (H5Lget_linkinfo(fid, "group", &li, H5P_DEFAULT)<0) TEST_ERROR;
+ if(H5Lget_linkinfo(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Create a user-defined "hard link" to the group using the address we got
* from H5Lget_linkinfo */
- if(H5Lcreate_ud(fid, "ud_link", UD_HARD_TYPE, &(li.u.address), sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_ud(fid, "ud_link", UD_HARD_TYPE, &(li.u.address), sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close and re-open file to ensure that data is written to disk */
- if(H5Fclose(fid) < 0) TEST_ERROR;
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open group through UD link */
- if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -3706,23 +3811,23 @@ ud_hard_links(hid_t fapl)
/* Close groups*/
if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Re-open group without using ud link to check that it was created properly */
- if((gid = H5Gopen(fid, "group/new_group")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "group/new_group")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
- /* Check that H5Gget_objinfo works on the hard link */
+ /* Check that H5Lget_objinfo works on the hard link */
if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
/* UD hard links have no query function, thus return a "link length" of 0 */
if(li.u.link_size != 0) TEST_ERROR
- if (UD_HARD_TYPE != li.linkclass) {
+ if(UD_HARD_TYPE != li.type) {
H5_FAILED();
puts(" Unexpected link class - should have been a UD hard link");
goto error;
@@ -3730,24 +3835,24 @@ ud_hard_links(hid_t fapl)
/* Unlink the group pointed to by the UD link. It shouldn't be
* deleted because of the UD link. */
- if(H5Gunlink(fid, "/group") < 0) TEST_ERROR;
+ if(H5Gunlink(fid, "/group") < 0) TEST_ERROR
/* Ensure we can open the group through the UD link */
- if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR
/* Unlink the group contained within it. */
- if(H5Gunlink(gid, "new_group") < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gunlink(gid, "new_group") < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Now delete the UD link. This should cause the group to be
* deleted, too. */
- if(H5Gunlink(fid, "ud_link")<0) TEST_ERROR;
+ if(H5Gunlink(fid, "ud_link") < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* The file should be empty again. */
- if(empty_size!=h5_get_file_size(filename)) TEST_ERROR;
+ if(empty_size != h5_get_file_size(filename)) TEST_ERROR
if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR
@@ -3756,16 +3861,16 @@ ud_hard_links(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
return -1;
} /* end ud_hard_links() */
/*-------------------------------------------------------------------------
- * Function: ext_link_endian
+ * Function: UD_rereg_traverse
*
* Purpose: Check that user defined link types can be unregistered and
* reregistered properly.
@@ -3781,11 +3886,12 @@ ud_hard_links(hid_t fapl)
/* A traversal function that ignores any udata and simply opens an object
* in the current group named REREG_TARGET_NAME
*/
-static hid_t UD_rereg_traverse(const char UNUSED * link_name, hid_t cur_group, void UNUSED * udata, size_t UNUSED udata_size, hid_t lapl_id)
+static hid_t
+UD_rereg_traverse(const char UNUSED * link_name, hid_t cur_group, void UNUSED * udata, size_t UNUSED udata_size, hid_t lapl_id)
{
hid_t ret_value;
- if((ret_value = H5Oopen(cur_group, REREG_TARGET_NAME, lapl_id)) < 0) TEST_ERROR;
+ if((ret_value = H5Oopen(cur_group, REREG_TARGET_NAME, lapl_id)) < 0) TEST_ERROR
return ret_value;
@@ -3795,8 +3901,8 @@ error:
/* This link class has the same ID number as the UD hard links but
* has a very different traversal function */
-const H5L_link_class_t UD_rereg_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_rereg_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_HARD_TYPE, /* Link type id number */
"UD_reregistered_type", /* Link class name for debugging */
NULL, /* Creation callback */
@@ -3818,61 +3924,61 @@ ud_link_reregister(hid_t fapl)
char filename[NAME_BUF_SIZE];
h5_stat_size_t empty_size; /* Size of an empty file */
- TESTING("registering a new class for existing UD links");
+ TESTING("registering a new class for existing UD links (w/new group format)")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Get the size of the empty file for reference */
- if(H5Fclose(fid) < 0) TEST_ERROR;
- if((empty_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if((empty_size=h5_get_file_size(filename))==0) TEST_ERROR
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Check that UD hard links are not registered */
- if(H5Lis_registered(UD_HARD_TYPE) != 0) TEST_ERROR
+ if(H5Lis_registered(UD_HARD_TYPE) != FALSE) TEST_ERROR
/* Register "user-defined hard links" with the library */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
/* Check that UD hard links are registered */
if(H5Lis_registered(UD_HARD_TYPE) != TRUE) TEST_ERROR
/* Point a UD defined hard link to a group in the same way as the previous test */
- if((gid = H5Gcreate(fid, "group", 0)) <0) TEST_ERROR;
- if (H5Lget_linkinfo(fid, "group", &li, H5P_DEFAULT)<0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gcreate(fid, "group", (size_t)0)) < 0) TEST_ERROR
+ if (H5Lget_linkinfo(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Lcreate_ud(fid, "ud_link", UD_HARD_TYPE, &(li.u.address),
sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR;
+ TEST_ERROR
/* Create a group named REREG_TARGET_NAME in the same group as the ud link */
- if((gid = H5Gcreate(fid, REREG_TARGET_NAME, 0)) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gcreate(fid, REREG_TARGET_NAME, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Now unregister UD hard links */
- if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR;
+ if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR
/* Check that UD hard links are no longer registered */
- if(H5Lis_registered(UD_HARD_TYPE) != 0) TEST_ERROR
+ if(H5Lis_registered(UD_HARD_TYPE) != FALSE) TEST_ERROR
/* Verify that we can't traverse the ud link anymore */
H5E_BEGIN_TRY {
- if((gid = H5Gopen(fid, "ud_link")) >= 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ud_link")) >= 0) TEST_ERROR
} H5E_END_TRY
/* Verify that we can't create any new links of this type */
H5E_BEGIN_TRY {
if(H5Lcreate_ud(fid, "ud_link2", UD_HARD_TYPE, &(li.u.address),
sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0)
- TEST_ERROR;
+ TEST_ERROR
} H5E_END_TRY
/* Register a new kind of link with the same ID number */
- if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
/* Check that UD hard links are registered again */
if(H5Lis_registered(UD_HARD_TYPE) != TRUE) TEST_ERROR
@@ -3880,7 +3986,7 @@ ud_link_reregister(hid_t fapl)
/* Open a group through the ud link (now a different class of link).
* It should be a different group
* than the UD hard link pointed to */
- if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -3891,58 +3997,58 @@ ud_link_reregister(hid_t fapl)
/* Close groups*/
if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Re-open group without using ud link to check that it was created properly */
- if((gid = H5Gopen(fid, "rereg_target/new_group")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "rereg_target/new_group")) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR
/* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Unlink the group pointed to by the UD hard link. It shouldn't be
* deleted because the UD link incremented its reference count. */
- if(H5Gunlink(fid, "/group") < 0) TEST_ERROR;
+ if(H5Gunlink(fid, "/group") < 0) TEST_ERROR
/* What a mess! Re-register user-defined links to clean up the
* reference counts. We shouldn't actually need to unregister the
* other link type */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
if(H5Lis_registered(UD_HARD_TYPE) != TRUE) TEST_ERROR
/* Ensure we can open the group through the UD link (now that UD hard
* links have been registered) */
- if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Delete the UD hard link. This should cause the group to be
* deleted, too. */
- if(H5Gunlink(fid, "ud_link")<0) TEST_ERROR;
+ if(H5Gunlink(fid, "ud_link") < 0) TEST_ERROR
/* Unlink the other two groups so that we can make sure the file is empty */
- if(H5Gunlink(fid, "/rereg_target/new_group")<0) TEST_ERROR;
- if(H5Gunlink(fid, REREG_TARGET_NAME)<0) TEST_ERROR;
+ if(H5Gunlink(fid, "/rereg_target/new_group") < 0) TEST_ERROR
+ if(H5Gunlink(fid, REREG_TARGET_NAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* The file should be empty again. */
- if(empty_size!=h5_get_file_size(filename)) TEST_ERROR;
+ if(empty_size!=h5_get_file_size(filename)) TEST_ERROR
if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR
- if(H5Lis_registered(UD_HARD_TYPE) != 0) TEST_ERROR
+ if(H5Lis_registered(UD_HARD_TYPE) != FALSE) TEST_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
return -1;
} /* end ud_link_reregister() */
@@ -3967,14 +4073,14 @@ ud_link_reregister(hid_t fapl)
static herr_t
UD_cb_create(const char * link_name, hid_t loc_group, void * udata, size_t udata_size, hid_t lcpl_id)
{
- if(!link_name) TEST_ERROR;
- if(loc_group < 0) TEST_ERROR;
- if(udata_size > 0 && !udata) TEST_ERROR;
- if(lcpl_id < 0) TEST_ERROR;
+ if(!link_name) TEST_ERROR
+ if(loc_group < 0) TEST_ERROR
+ if(udata_size > 0 && !udata) TEST_ERROR
+ if(lcpl_id < 0) TEST_ERROR
- if(strcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR;
- if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR;
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR;
+ if(strcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR
+ if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR
+ if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
return 0;
@@ -3988,16 +4094,16 @@ UD_cb_traverse(const char * link_name, hid_t cur_group, void * udata, size_t uda
const char *target = (char *) udata;
hid_t ret_value;
- if(!link_name) TEST_ERROR;
- if(cur_group < 0) TEST_ERROR;
- if(udata_size > 0 && !udata) TEST_ERROR;
+ if(!link_name) TEST_ERROR
+ if(cur_group < 0) TEST_ERROR
+ if(udata_size > 0 && !udata) TEST_ERROR
- if(strcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR;
- if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR;
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR;
+ if(strcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR
+ if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR
+ if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0)
- TEST_ERROR;
+ TEST_ERROR
return ret_value;
@@ -4009,13 +4115,13 @@ error:
static herr_t
UD_cb_move(const char * new_name, hid_t new_loc, void * udata, size_t udata_size)
{
- if(!new_name) TEST_ERROR;
- if(new_loc < 0) TEST_ERROR;
- if(udata_size > 0 && !udata) TEST_ERROR;
+ if(!new_name) TEST_ERROR
+ if(new_loc < 0) TEST_ERROR
+ if(udata_size > 0 && !udata) TEST_ERROR
- if(strcmp(new_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR;
- if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR;
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR;
+ if(strcmp(new_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR
+ if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR
+ if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
return 0;
@@ -4027,33 +4133,34 @@ error:
static herr_t
UD_cb_delete(const char * link_name, hid_t loc_group, void * udata, size_t udata_size)
{
- if(!link_name) TEST_ERROR;
- if(loc_group < 0) TEST_ERROR;
- if(udata_size > 0 && !udata) TEST_ERROR;
+ if(!link_name) TEST_ERROR
+ if(loc_group < 0) TEST_ERROR
+ if(udata_size > 0 && !udata) TEST_ERROR
- if(strcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR;
- if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR;
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR;
+ if(strcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR
+ if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR
+ if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
return 0;
error:
return -1;
}
+
/* Callback for when the link is queried */
static ssize_t
UD_cb_query(const char * link_name, void * udata, size_t udata_size, void* buf, size_t buf_size)
{
- if(!link_name) TEST_ERROR;
- if(udata_size > 0 && !udata) TEST_ERROR;
+ if(!link_name) TEST_ERROR
+ if(udata_size > 0 && !udata) TEST_ERROR
- if(strcmp(link_name, UD_CB_LINK_NAME)) TEST_ERROR;
- if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR;
- if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR;
+ if(strcmp(link_name, UD_CB_LINK_NAME)) TEST_ERROR
+ if(strcmp(udata, UD_CB_TARGET)) TEST_ERROR
+ if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
if(buf)
{
- if(buf_size < 16) TEST_ERROR;
+ if(buf_size < 16) TEST_ERROR
strcpy(buf, "query succeeded");
}
@@ -4064,8 +4171,8 @@ error:
return -1;
}
-const H5L_link_class_t UD_cb_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_cb_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_CB_TYPE, /* Link type id number */
NULL, /* NULL name (to make sure this doesn't break anything */
UD_cb_create, /* Creation callback */
@@ -4077,7 +4184,7 @@ const H5L_link_class_t UD_cb_class[1] = {{
}};
static int
-ud_callbacks(hid_t fapl)
+ud_callbacks(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */
@@ -4088,65 +4195,68 @@ ud_callbacks(hid_t fapl)
char filename[NAME_BUF_SIZE];
char query_buf[NAME_BUF_SIZE];
- TESTING("user-defined link callbacks");
+ if(new_format)
+ TESTING("user-defined link callbacks (w/new group format)")
+ else
+ TESTING("user-defined link callbacks")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Check that registered link classes are, and unregistered ones aren't */
- if(H5Lis_registered(H5L_LINK_EXTERNAL) != TRUE) TEST_ERROR
- if(H5Lis_registered(UD_HARD_TYPE) != 0) TEST_ERROR
- if(H5Lis_registered(UD_CB_TYPE) != 0) TEST_ERROR
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered(UD_HARD_TYPE) != FALSE) TEST_ERROR
+ if(H5Lis_registered(UD_CB_TYPE) != FALSE) TEST_ERROR
/* Hit two birds with one stone: register UD hard links from previous
* test to check that having two UD links registered at once presents
* no problems. */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
/* Register user-defined link class. This is the one we'll actually
* be using. */
- if(H5Lregister(UD_cb_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_cb_class) < 0) TEST_ERROR
/* Check that registered link classes are, and unregistered ones aren't */
- if(H5Lis_registered(H5L_LINK_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
if(H5Lis_registered(UD_HARD_TYPE) != TRUE) TEST_ERROR
if(H5Lis_registered(UD_CB_TYPE) != TRUE) TEST_ERROR
/* Create a group for the UD link to point to */
- if((gid = H5Gcreate(fid, UD_CB_TARGET, 0)) <0) TEST_ERROR;
+ if((gid = H5Gcreate(fid, UD_CB_TARGET, (size_t)0)) < 0) TEST_ERROR
/* Create a user-defined link to the group. These UD links behave like soft links. */
- if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, UD_CB_TYPE, ud_target_name, UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Try opening group through UD link */
- if((gid = H5Gopen(fid, UD_CB_LINK_NAME)) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, UD_CB_LINK_NAME)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Query the link to test its query callback */
- if (H5Lget_linkinfo(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT)<0) TEST_ERROR;
- if(li.u.link_size != 16) TEST_ERROR;
- if (UD_CB_TYPE != li.linkclass) {
+ if (H5Lget_linkinfo(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.u.link_size != 16) TEST_ERROR
+ if (UD_CB_TYPE != li.type) {
H5_FAILED();
puts(" Unexpected link class - should have been a UD hard link");
goto error;
}
/* Fill the query buffer */
- if(H5Gget_linkval(fid, UD_CB_LINK_NAME, NAME_BUF_SIZE, query_buf) < 0) TEST_ERROR;
- if(strcmp(query_buf, "query succeeded") != 0) TEST_ERROR;
+ if(H5Gget_linkval(fid, UD_CB_LINK_NAME, (size_t)NAME_BUF_SIZE, query_buf) < 0) TEST_ERROR
+ if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR
/* Move the link */
- if(H5Gmove(fid, UD_CB_LINK_NAME, NEW_UD_CB_LINK_NAME) < 0) TEST_ERROR;
+ if(H5Gmove(fid, UD_CB_LINK_NAME, NEW_UD_CB_LINK_NAME) < 0) TEST_ERROR
/* Re-open group to ensure that move worked */
- if((gid = H5Gopen(fid, NEW_UD_CB_LINK_NAME)) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, NEW_UD_CB_LINK_NAME)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Remove UD link */
- if(H5Gunlink(fid, NEW_UD_CB_LINK_NAME) < 0) TEST_ERROR;
+ if(H5Gunlink(fid, NEW_UD_CB_LINK_NAME) < 0) TEST_ERROR
/* Test that the callbacks don't work if the link class is not registered */
@@ -4154,39 +4264,38 @@ ud_callbacks(hid_t fapl)
/* Create a new link. Just for fun, give it a non-default character
* encoding (to test that LAPLs work) */
if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
-#ifdef H5_GROUP_REVISION
if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) TEST_ERROR
-#endif /* H5_GROUP_REVISION */
- if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, UD_CB_TYPE, ud_target_name, UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Pclose(lcpl)<0) TEST_ERROR
+ if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Pclose(lcpl) < 0) TEST_ERROR
/* Check its character encoding */
-#ifdef H5_GROUP_REVISION
- if(H5Lget_linkinfo(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR;
- if(li.cset != H5T_CSET_UTF8) TEST_ERROR;
-#endif /* H5_GROUP_REVISION */
+ if(H5Lget_linkinfo(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.cset != H5T_CSET_UTF8) TEST_ERROR
/* Unregister the link class so the library forgets what its callbacks do */
- if(H5Lunregister(UD_CB_TYPE) < 0) TEST_ERROR;
+ if(H5Lunregister(UD_CB_TYPE) < 0) TEST_ERROR
/* Now test that each of the callbacks fails */
H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, UD_CB_TYPE, ud_target_name, UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR;
- if(H5Gmove(fid, UD_CB_LINK_NAME, NEW_UD_CB_LINK_NAME) >= 0) TEST_ERROR;
- if(H5Gunlink(fid, UD_CB_LINK_NAME) >= 0) TEST_ERROR;
- if((gid = H5Gopen(gid, UD_CB_LINK_NAME)) >= 0) TEST_ERROR;
- if(H5Gunlink(fid, UD_CB_LINK_NAME) >= 0) TEST_ERROR;
+ if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
+ if(H5Gmove(fid, UD_CB_LINK_NAME, NEW_UD_CB_LINK_NAME) >= 0) TEST_ERROR
+ if(H5Gunlink(fid, UD_CB_LINK_NAME) >= 0) TEST_ERROR
+ if((gid = H5Gopen(gid, UD_CB_LINK_NAME)) >= 0) TEST_ERROR
+ if(H5Gunlink(fid, UD_CB_LINK_NAME) >= 0) TEST_ERROR
} H5E_END_TRY
/* The query callback should NOT fail, but should be unable to give a linklen */
- if(H5Lget_linkinfo(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) <0) TEST_ERROR;
- if(li.u.link_size != 0) TEST_ERROR;
- if(li.linkclass != UD_CB_TYPE) TEST_ERROR;
- if(H5Gget_objinfo(fid, UD_CB_LINK_NAME, FALSE, &sb) <0) TEST_ERROR;
- if(sb.type != H5G_UDLINK) TEST_ERROR;
+ if(H5Lget_linkinfo(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.u.link_size != 0) TEST_ERROR
+ if(li.type != UD_CB_TYPE) TEST_ERROR
+ if(H5Gget_objinfo(fid, UD_CB_LINK_NAME, FALSE, &sb) < 0) TEST_ERROR
+ if(sb.type != H5G_UDLINK) TEST_ERROR
+
+ /* Unregister the UD hard links */
+ if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4221,21 +4330,21 @@ UD_plist_traverse(const char UNUSED * link_name, hid_t cur_group, void UNUSED *
char target[NAME_BUF_SIZE];
hid_t ret_value;
- if(udata_size != 0) TEST_ERROR;
+ if(udata_size != 0) TEST_ERROR
/* Get the name of the target from the property list. */
- if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR;
+ if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR
if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0)
- TEST_ERROR;
+ TEST_ERROR
return ret_value;
error:
return -1;
}
-const H5L_link_class_t UD_plist_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_plist_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_PLIST_TYPE, /* Link type id number */
"UD_plist_link", /* Link class name for debugging */
NULL, /* Creation callback */
@@ -4247,7 +4356,7 @@ const H5L_link_class_t UD_plist_class[1] = {{
}};
static int
-lapl_udata(hid_t fapl)
+lapl_udata(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -4256,70 +4365,77 @@ lapl_udata(hid_t fapl)
char group_b_name[NAME_BUF_SIZE];
char filename[NAME_BUF_SIZE];
- TESTING("user data passed through lapl");
+ if(new_format)
+ TESTING("user data passed through lapl (w/new group format)")
+ else
+ TESTING("user data passed through lapl")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Register UD link types from previous tests to check that having
* multiple types registered at once presents no problems. */
- if(H5Lregister(UD_cb_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_cb_class) < 0) TEST_ERROR
/* Register the link class. We'll actually be using for this test. */
- if(H5Lregister(UD_plist_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_plist_class) < 0) TEST_ERROR
/* Another link class from a previous test */
- if(H5Lregister(UD_hard_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
/* Unregister the first link type registered to make sure this doesn't
* break anything. */
- if(H5Lunregister(UD_CB_TYPE) < 0) TEST_ERROR;
+ if(H5Lunregister(UD_CB_TYPE) < 0) TEST_ERROR
/* Create two groups for the UD link to point to */
- if((gid = H5Gcreate(fid, "group_a", 0)) <0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
- if((gid = H5Gcreate(fid, "group_b", 0)) <0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gcreate(fid, "group_a", (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid, "group_b", (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Create a user-defined link to the group. These UD links have no udata. */
- if(H5Lcreate_ud(fid, "ud_link", UD_PLIST_TYPE, NULL, 0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_ud(fid, "ud_link", UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create a non-default lapl with a new property pointing to group a*/
- if((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR;
- strcpy(group_a_name, "group_a");
- if(H5Pinsert(plist_id, DEST_PROP_NAME, NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR;
+ if((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
+ HDstrcpy(group_a_name, "group_a");
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ if(H5Pinsert(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+#else /* H5_WANT_H5_V1_6_COMPAT */
+ if(H5Pinsert(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+#endif /* H5_WANT_H5_V1_6_COMPAT */
/* Try opening group through UD link */
- if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR;
- if((gid2 = H5Gcreate(gid, "subgroup_a", 0)) < 0) TEST_ERROR;
- if(H5Gclose(gid2) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR
+ if((gid2 = H5Gcreate(gid, "subgroup_a", (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Verify that we can open the new group without using the ud link */
- if((gid2 = H5Gopen(fid, "/group_a/subgroup_a")) < 0) TEST_ERROR;
- if(H5Gclose(gid2) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(fid, "/group_a/subgroup_a")) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* Now use the same ud link to access group_b */
strcpy(group_b_name, "group_b");
- if(H5Pset(plist_id, DEST_PROP_NAME, group_b_name)<0) TEST_ERROR;
+ if(H5Pset(plist_id, DEST_PROP_NAME, group_b_name) < 0) TEST_ERROR
/* Create a subgroup */
- if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR;
- if((gid2 = H5Gcreate(gid, "subgroup_b", 0)) < 0) TEST_ERROR;
- if(H5Gclose(gid2) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR
+ if((gid2 = H5Gcreate(gid, "subgroup_b", (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Verify that we can open the new group without using the ud link */
- if((gid2 = H5Gopen(fid, "/group_b/subgroup_b")) < 0) TEST_ERROR;
- if(H5Gclose(gid2) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(fid, "/group_b/subgroup_b")) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close property list */
- if(H5Pclose(plist_id) < 0) TEST_ERROR;
+ if(H5Pclose(plist_id) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4455,8 +4571,8 @@ UD_cbsucc_query(const char UNUSED * link_name, void UNUSED * udata, size_t UNUSE
}
/* This class is full of failing callbacks */
-const H5L_link_class_t UD_cbfail_class1[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_cbfail_class1[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_CBFAIL_TYPE, /* Link type id number */
"UD_cbfail_link1", /* Link class name for debugging */
UD_cbsucc_create, /* Creation callback */
@@ -4468,8 +4584,8 @@ const H5L_link_class_t UD_cbfail_class1[1] = {{
}};
/* This class is has two failing callbacks, move and query */
-const H5L_link_class_t UD_cbfail_class2[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_cbfail_class2[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_CBFAIL_TYPE, /* Link type id number */
"UD_cbfail_link2", /* Link class name for debugging */
UD_cbsucc_create, /* Creation callback */
@@ -4481,8 +4597,8 @@ const H5L_link_class_t UD_cbfail_class2[1] = {{
}};
/* All of these callbacks will succeed */
-const H5L_link_class_t UD_cbfail_class3[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_cbfail_class3[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_CBFAIL_TYPE, /* Link type id number */
"UD_cbfail_link3", /* Link class name for debugging */
UD_cbsucc_create, /* Creation callback */
@@ -4494,8 +4610,8 @@ const H5L_link_class_t UD_cbfail_class3[1] = {{
}};
/* Link classes that are invalid for various reasons */
-const H5L_link_class_t UD_error1_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_error1_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_ERROR_TYPE, /* Link type id number */
"UD_error_link", /* Link class name for debugging */
NULL, /* Creation callback */
@@ -4505,8 +4621,8 @@ const H5L_link_class_t UD_error1_class[1] = {{
NULL, /* Deletion callback */
NULL /* Query callback */
}};
-const H5L_link_class_t UD_error2_class[1] = {{
- UD_BAD_VERS, /* Invalid H5L_link_class_t version */
+const H5L_class_t UD_error2_class[1] = {{
+ UD_BAD_VERS, /* Invalid H5L_class_t version */
UD_ERROR_TYPE, /* Link type id number */
"UD_error_link", /* Link class name for debugging */
NULL, /* Creation callback */
@@ -4516,8 +4632,8 @@ const H5L_link_class_t UD_error2_class[1] = {{
NULL, /* Deletion callback */
NULL /* Query callback */
}};
-const H5L_link_class_t UD_error3_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_error3_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_BAD_TYPE1, /* Invalid Link type id number */
"UD_error_link", /* Link class name for debugging */
NULL, /* Creation callback */
@@ -4527,8 +4643,8 @@ const H5L_link_class_t UD_error3_class[1] = {{
NULL, /* Deletion callback */
NULL /* Query callback */
}};
-const H5L_link_class_t UD_error4_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_error4_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
UD_BAD_TYPE2, /* Invalid Link type id number */
"UD_error_link", /* Link class name for debugging */
NULL, /* Creation callback */
@@ -4540,7 +4656,7 @@ const H5L_link_class_t UD_error4_class[1] = {{
}};
static int
-ud_link_errors(hid_t fapl)
+ud_link_errors(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group IDs */
@@ -4549,56 +4665,59 @@ ud_link_errors(hid_t fapl)
char query_buf[NAME_BUF_SIZE];
H5L_linkinfo_t li; /* Link information */
- TESTING("user-defined link error conditions");
+ if(new_format)
+ TESTING("user-defined link error conditions (w/new group format)")
+ else
+ TESTING("user-defined link error conditions")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Try to register some invalid link classes */
H5E_BEGIN_TRY {
- if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR;
- if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR;
- if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR;
- if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR;
+ if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR
+ if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR
+ if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR
+ if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR
} H5E_END_TRY
/* Register the UD plist class. */
- if(H5Lregister(UD_plist_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_plist_class) < 0) TEST_ERROR
/* Now register the first class we'll be using.
* It has the same ID as the plist class, and should replace it. */
- if(H5Lregister(UD_cbfail_class1) < 0) TEST_ERROR;
+ if(H5Lregister(UD_cbfail_class1) < 0) TEST_ERROR
/* Create a group for the UD link to point to */
- if((gid = H5Gcreate(fid, "group", 0)) <0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gcreate(fid, "group", (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Create a user-defined link to the group. */
strcpy(group_name, "/group");
- if(H5Lcreate_ud(fid, "/ud_link", UD_CBFAIL_TYPE, &group_name, strlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_ud(fid, "/ud_link", UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group through the ud link */
- if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Now test that each of the callbacks will cause a failure if it returns -1 */
H5E_BEGIN_TRY {
/* The create callback will fail if we pass in no udata */
- if(H5Lcreate_ud(fid, "fail", UD_CBFAIL_TYPE, NULL, 0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR;
+ if(H5Lcreate_ud(fid, "fail", UD_CBFAIL_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
/* The move and copy callbacks will fail */
- if(H5Gmove(fid, "ud_link", "move_fail") >= 0) TEST_ERROR;
- if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR;
+ if(H5Gmove(fid, "ud_link", "move_fail") >= 0) TEST_ERROR
+ if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
/* The traversal callback will fail if we remove its target */
- if(H5Gunlink(fid, "group") < 0) TEST_ERROR;
- if((gid = H5Gopen(gid, "ud_link")) >= 0) TEST_ERROR;
+ if(H5Gunlink(fid, "group") < 0) TEST_ERROR
+ if((gid = H5Gopen(gid, "ud_link")) >= 0) TEST_ERROR
/* The deletion callback will always fail */
- if(H5Gunlink(fid, "ud_link") >= 0) TEST_ERROR;
+ if(H5Gunlink(fid, "ud_link") >= 0) TEST_ERROR
/* The query callback will fail */
- if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR;
+ if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR
} H5E_END_TRY
/* Now use a class with different callback functions */
- if(H5Lregister(UD_cbfail_class2) < 0) TEST_ERROR;
+ if(H5Lregister(UD_cbfail_class2) < 0) TEST_ERROR
/* Moving should still fail, but copying will succeed */
H5E_BEGIN_TRY {
@@ -4607,31 +4726,31 @@ ud_link_errors(hid_t fapl)
if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* The query callback will succeed when we only want to get the size of the buffer... */
- if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) <0) TEST_ERROR;
- if(li.u.link_size != 0) TEST_ERROR;
+ if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.u.link_size != 0) TEST_ERROR
/* ...but fail when we try to write data to the buffer itself*/
H5E_BEGIN_TRY {
- if(H5Lget_linkval(fid, "ud_link", NAME_BUF_SIZE, query_buf, H5P_DEFAULT) >=0) TEST_ERROR;
+ if(H5Lget_linkval(fid, "ud_link", (size_t)NAME_BUF_SIZE, query_buf, H5P_DEFAULT) >=0) TEST_ERROR
} H5E_END_TRY
/* Register a new class */
- if(H5Lregister(UD_cbfail_class3) < 0) TEST_ERROR;
+ if(H5Lregister(UD_cbfail_class3) < 0) TEST_ERROR
/* Now querying should succeed */
- if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) <0) TEST_ERROR;
- if(li.u.link_size != 8) TEST_ERROR;
- if(H5Lget_linkval(fid, "ud_link", NAME_BUF_SIZE, query_buf, H5P_DEFAULT) <0) TEST_ERROR;
- if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR;
+ if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.u.link_size != 8) TEST_ERROR
+ if(H5Lget_linkval(fid, "ud_link", (size_t)NAME_BUF_SIZE, query_buf, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR
/* Moving and copying should both succeed */
if(H5Gmove(fid, "copy_succ", "move_succ") < 0) TEST_ERROR
if(H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Delete link (this callback should work now) */
- if(H5Gunlink(fid, "ud_link") <0) TEST_ERROR;
+ if(H5Gunlink(fid, "ud_link") < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4645,7 +4764,6 @@ ud_link_errors(hid_t fapl)
}
-
/*-------------------------------------------------------------------------
* Function: lapl_nlinks
*
@@ -4664,7 +4782,7 @@ ud_link_errors(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-lapl_nlinks(hid_t fapl)
+lapl_nlinks(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -4677,61 +4795,64 @@ lapl_nlinks(hid_t fapl)
size_t nlinks; /* nlinks for H5Pset_nlinks */
hsize_t dims[2];
- TESTING("adjusting nlinks with LAPL");
+ if(new_format)
+ TESTING("adjusting nlinks with LAPL (w/new group format)")
+ else
+ TESTING("adjusting nlinks with LAPL")
/* Make certain test is valid */
/* XXX: should probably make a "generic" test that creates the proper
* # of links based on this value - QAK
*/
- HDassert(H5G_NLINKS == 16);
+ HDassert(H5L_NLINKS_DEF == 16);
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group with short name in file (used as target for links) */
- if((gid=H5Gcreate (fid, "final", (size_t)0))<0) TEST_ERROR;
+ if((gid=H5Gcreate (fid, "final", (size_t)0)) < 0) TEST_ERROR
/* Create chain of soft links to existing object (limited) */
- if(H5Glink2(fid, "final", H5G_LINK_SOFT, fid, "soft1") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft1", H5G_LINK_SOFT, fid, "soft2") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft2", H5G_LINK_SOFT, fid, "soft3") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft3", H5G_LINK_SOFT, fid, "soft4") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft4", H5G_LINK_SOFT, fid, "soft5") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft5", H5G_LINK_SOFT, fid, "soft6") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft6", H5G_LINK_SOFT, fid, "soft7") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft7", H5G_LINK_SOFT, fid, "soft8") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft8", H5G_LINK_SOFT, fid, "soft9") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft9", H5G_LINK_SOFT, fid, "soft10") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft10", H5G_LINK_SOFT, fid, "soft11") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft11", H5G_LINK_SOFT, fid, "soft12") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft12", H5G_LINK_SOFT, fid, "soft13") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft13", H5G_LINK_SOFT, fid, "soft14") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft14", H5G_LINK_SOFT, fid, "soft15") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft15", H5G_LINK_SOFT, fid, "soft16") < 0) TEST_ERROR;
- if(H5Glink2(fid, "soft16", H5G_LINK_SOFT, fid, "soft17") < 0) TEST_ERROR;
+ if(H5Glink2(fid, "final", H5G_LINK_SOFT, fid, "soft1") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft1", H5G_LINK_SOFT, fid, "soft2") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft2", H5G_LINK_SOFT, fid, "soft3") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft3", H5G_LINK_SOFT, fid, "soft4") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft4", H5G_LINK_SOFT, fid, "soft5") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft5", H5G_LINK_SOFT, fid, "soft6") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft6", H5G_LINK_SOFT, fid, "soft7") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft7", H5G_LINK_SOFT, fid, "soft8") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft8", H5G_LINK_SOFT, fid, "soft9") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft9", H5G_LINK_SOFT, fid, "soft10") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft10", H5G_LINK_SOFT, fid, "soft11") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft11", H5G_LINK_SOFT, fid, "soft12") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft12", H5G_LINK_SOFT, fid, "soft13") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft13", H5G_LINK_SOFT, fid, "soft14") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft14", H5G_LINK_SOFT, fid, "soft15") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft15", H5G_LINK_SOFT, fid, "soft16") < 0) TEST_ERROR
+ if(H5Glink2(fid, "soft16", H5G_LINK_SOFT, fid, "soft17") < 0) TEST_ERROR
/* Close objects */
- if(H5Gclose(gid)<0) TEST_ERROR;
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Open file */
- if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0) TEST_ERROR;
+ if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Create LAPL with higher-than-usual nlinks value */
/* Create a non-default lapl with udata set to point to the first group */
- if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR;
+ if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
nlinks = 20;
- if(H5Pset_nlinks(plist, nlinks)<0) TEST_ERROR;
+ if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
/* Ensure that nlinks was set successfully */
nlinks = 0;
- if(H5Pget_nlinks(plist, &nlinks)<0) TEST_ERROR
+ if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR
if(nlinks != 20) TEST_ERROR
/* Open object through what is normally too many soft links using
* new property list */
- if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR;
+ if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -4742,16 +4863,16 @@ lapl_nlinks(hid_t fapl)
/* Close groups */
if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Set nlinks to a smaller number */
nlinks = 4;
- if(H5Pset_nlinks(plist, nlinks)<0) TEST_ERROR;
+ if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
/* Ensure that nlinks was set successfully */
nlinks = 0;
- if(H5Pget_nlinks(plist, &nlinks)<0) TEST_ERROR;
- if(nlinks != 4) TEST_ERROR;
+ if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR
+ if(nlinks != 4) TEST_ERROR
/* Try opening through what is now too many soft links */
H5E_BEGIN_TRY {
@@ -4764,7 +4885,7 @@ lapl_nlinks(hid_t fapl)
}
/* Open object through lesser soft link */
- if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR;
+ if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR
/* Check name */
if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
@@ -4773,9 +4894,9 @@ lapl_nlinks(hid_t fapl)
/* Test other functions that should use a LAPL */
nlinks = 20;
- if(H5Pset_nlinks(plist, nlinks)<0) TEST_ERROR;
+ if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
- /* Try copying and moving when both src and dst cotain many soft links
+ /* Try copying and moving when both src and dst contain many soft links
* using a non-default LAPL
*/
if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR
@@ -4792,16 +4913,16 @@ lapl_nlinks(hid_t fapl)
if(H5Lunlink(fid, "soft17/soft_link", plist) < 0) TEST_ERROR
/* H5Lget_linkval and H5Lget_linkinfo */
- if(H5Lget_linkval(fid, "soft17", 0, NULL, plist) < 0) TEST_ERROR
+ if(H5Lget_linkval(fid, "soft17", (size_t)0, NULL, plist) < 0) TEST_ERROR
if(H5Lget_linkinfo(fid, "soft17", NULL, plist) < 0) TEST_ERROR
/* H5Lcreate_external and H5Lcreate_ud */
- if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) <0) TEST_ERROR
+ if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR
if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
- if(H5Lcreate_ud(fid, "soft17/udlink", UD_HARD_TYPE, NULL, 0, H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if(H5Lcreate_ud(fid, "soft17/udlink", UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR
/* Close plist */
- if(H5Pclose(plist) < 0) TEST_ERROR;
+ if(H5Pclose(plist) < 0) TEST_ERROR
/* Create a datatype and dataset as targets inside the group */
@@ -4813,27 +4934,27 @@ lapl_nlinks(hid_t fapl)
dims[1] = 2;
if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
if((did = H5Dcreate(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR;
+ if(H5Dclose(did) < 0) TEST_ERROR
/* Close group */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Try to open the objects using too many symlinks with default *APLs */
H5E_BEGIN_TRY {
if((gid = H5Gopen_expand(fid, "soft17", H5P_DEFAULT)) >=0) {
H5_FAILED();
puts(" Should have failed for too many nested links.");
- TEST_ERROR;
+ TEST_ERROR
}
if((tid = H5Topen_expand(fid, "soft17/datatype", H5P_DEFAULT)) >=0) {
H5_FAILED();
puts(" Should have failed for too many nested links.");
- TEST_ERROR;
+ TEST_ERROR
}
if((did = H5Dopen_expand(fid, "soft17/dataset", H5P_DEFAULT)) >=0) {
H5_FAILED();
puts(" Should have failed for too many nested links.");
- TEST_ERROR;
+ TEST_ERROR
}
} H5E_END_TRY
@@ -4850,9 +4971,9 @@ lapl_nlinks(hid_t fapl)
/* We should now be able to use these property lists to open each kind
* of object.
*/
- if((gid = H5Gopen_expand(fid, "soft17", gapl)) <0) TEST_ERROR
- if((tid = H5Topen_expand(fid, "soft17/datatype", tapl)) <0) TEST_ERROR
- if((did = H5Dopen_expand(fid, "soft17/dataset", dapl)) <0) TEST_ERROR
+ if((gid = H5Gopen_expand(fid, "soft17", gapl)) < 0) TEST_ERROR
+ if((tid = H5Topen_expand(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR
+ if((did = H5Dopen_expand(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR
/* Close objects */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4860,12 +4981,15 @@ lapl_nlinks(hid_t fapl)
if(H5Dclose(did) < 0) TEST_ERROR
/* Close plists */
- if(H5Pclose(gapl) < 0) TEST_ERROR;
- if(H5Pclose(tapl) < 0) TEST_ERROR;
- if(H5Pclose(dapl) < 0) TEST_ERROR;
+ if(H5Pclose(gapl) < 0) TEST_ERROR
+ if(H5Pclose(tapl) < 0) TEST_ERROR
+ if(H5Pclose(dapl) < 0) TEST_ERROR
+
+ /* Unregister UD hard link class */
+ if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4885,9 +5009,10 @@ lapl_nlinks(hid_t fapl)
} H5E_END_TRY;
return -1;
} /* end lapl_nlinks() */
+
/*-------------------------------------------------------------------------
- * Function: objinfo_linkclass
+ * Function: linkinfo
*
* Purpose: Check that the link class is returned correctly when queried.
*
@@ -4900,7 +5025,7 @@ lapl_nlinks(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-linkinfo(hid_t fapl)
+linkinfo(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */
@@ -4909,52 +5034,55 @@ linkinfo(hid_t fapl)
H5L_linkinfo_t li; /* Link information */
char filename[NAME_BUF_SIZE];
- TESTING("linkclass field in H5Gget_objinfo");
+ if(new_format)
+ TESTING("link type field in H5Gget_objinfo (w/new group format)")
+ else
+ TESTING("link type field in H5Gget_objinfo")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Register a couple of user-defined link classes with the library */
- if(H5Lregister(UD_plist_class) < 0) TEST_ERROR;
+ if(H5Lregister(UD_plist_class) < 0) TEST_ERROR
/* Create an object of each type */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR;
- if(H5Tcommit(fid, "datatype", tid) < 0) TEST_ERROR;
- if((gid = H5Gcreate(fid, "group", 0)) < 0) TEST_ERROR;
- if(H5Glink(fid, H5G_LINK_SOFT, "group", "softlink") < 0) TEST_ERROR;
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit(fid, "datatype", tid) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid, "group", (size_t)0)) < 0) TEST_ERROR
+ if(H5Glink(fid, H5G_LINK_SOFT, "group", "softlink") < 0) TEST_ERROR
- if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR;
- if((did = H5Dcreate(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lcreate_ud(fid, "ud_link", UD_PLIST_TYPE, NULL, 0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
- if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lcreate_ud(fid, "ud_link", UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close all objects */
- if(H5Tclose(tid) < 0) TEST_ERROR;
- if(H5Gclose(gid) < 0) TEST_ERROR;
- if(H5Dclose(did) < 0) TEST_ERROR;
-
- /* Make sure that linkclass is correct when objects are queried */
- if(H5Lget_linkinfo(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR;
- if(li.linkclass != H5L_LINK_HARD) TEST_ERROR;
- if(H5Lget_linkinfo(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR;
- if(li.linkclass != H5L_LINK_HARD) TEST_ERROR;
- if(H5Lget_linkinfo(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR;
- if(li.linkclass != H5L_LINK_HARD) TEST_ERROR;
-
- if(H5Lget_linkinfo(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR;
- if(li.linkclass != H5L_LINK_EXTERNAL) TEST_ERROR;
- if(H5Lget_linkinfo(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR;
- if(li.linkclass != H5G_LINK_SOFT) TEST_ERROR;
- if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR;
- if(li.linkclass != UD_PLIST_TYPE) TEST_ERROR;
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* Make sure that link type is correct when objects are queried */
+ if(H5Lget_linkinfo(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_HARD) TEST_ERROR
+ if(H5Lget_linkinfo(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_HARD) TEST_ERROR
+ if(H5Lget_linkinfo(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_HARD) TEST_ERROR
+
+ if(H5Lget_linkinfo(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR
+ if(H5Lget_linkinfo(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5G_LINK_SOFT) TEST_ERROR
+ if(H5Lget_linkinfo(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != UD_PLIST_TYPE) TEST_ERROR
/* Ensure that passing a NULL pointer doesn't cause an error */
- if(H5Lget_linkinfo(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Lget_linkinfo(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4989,13 +5117,16 @@ linkinfo(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-check_all_closed(hid_t fapl)
+check_all_closed(hid_t fapl, hbool_t new_format)
{
hid_t fid=-1;
char filename[NAME_BUF_SIZE];
int x;
- TESTING("that all files were closed correctly")
+ if(new_format)
+ TESTING("that all files were closed correctly (w/new group format)")
+ else
+ TESTING("that all files were closed correctly")
/* Some of the external or UD link tests may have failed to close
* an external file properly.
@@ -5034,86 +5165,91 @@ check_all_closed(hid_t fapl)
* Programmer: Robb Matzke
* Friday, August 14, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
main(void)
{
- int nerrors = 0;
- hid_t fapl;
const char *envval = NULL;
envval = HDgetenv("HDF5_DRIVER");
- if (envval == NULL)
+ if(envval == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family") && HDstrcmp(envval, "stdio")) {
+ if(HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family") && HDstrcmp(envval, "stdio")) {
+ hid_t fapl, fapl2; /* File access property lists */
+ int nerrors = 0;
+ hbool_t new_format; /* Whether to use the new format or not */
+
h5_reset();
fapl = h5_fileaccess();
- /* The tests... */
- nerrors += mklinks(fapl) < 0 ? 1 : 0;
- nerrors += cklinks(fapl) < 0 ? 1 : 0;
- nerrors += new_links(fapl) < 0 ? 1 : 0;
- nerrors += ck_new_links(fapl) < 0 ? 1 : 0;
- nerrors += long_links(fapl) < 0 ? 1 : 0;
- nerrors += toomany(fapl) < 0 ? 1 : 0;
-
- /* Test new H5L link creation routine */
-#ifdef H5_GROUP_REVISION
- nerrors += test_h5l_create(fapl);
- nerrors += test_lcpl(fapl);
-#endif
- nerrors += test_move(fapl);
- nerrors += test_copy(fapl);
-#ifdef H5_GROUP_REVISION
- nerrors += test_move_preserves(fapl);
-#endif
- nerrors += test_compat(fapl);
+
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
+ /* Loop over using new group format */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ /* General tests... (on both old & new format groups */
+ nerrors += mklinks((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += cklinks((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += new_links((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += ck_new_links((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += long_links((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += toomany((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+
+ /* Test new H5L link creation routine */
+ nerrors += test_h5l_create((new_format ? fapl2 : fapl), new_format);
+ nerrors += test_lcpl((new_format ? fapl2 : fapl), new_format);
+ nerrors += test_move((new_format ? fapl2 : fapl), new_format);
+ nerrors += test_copy((new_format ? fapl2 : fapl), new_format);
+ nerrors += test_move_preserves((new_format ? fapl2 : fapl), new_format);
+ nerrors += test_compat((new_format ? fapl2 : fapl), new_format);
#ifndef H5_CANNOT_OPEN_TWICE
- nerrors += external_link_root(fapl) < 0 ? 1 : 0;
+ nerrors += external_link_root((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
#endif /* H5_CANNOT_OPEN_TWICE */
- nerrors += external_link_path(fapl) < 0 ? 1 : 0;
- nerrors += external_link_mult(fapl) < 0 ? 1 : 0;
-#ifdef H5_GROUP_REVISION
- nerrors += external_link_self(fapl) < 0 ? 1 : 0;
-#endif
+ nerrors += external_link_path((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_mult((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_self((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
#ifndef H5_CANNOT_OPEN_TWICE
- nerrors += external_link_pingpong(fapl) < 0 ? 1 : 0;
- nerrors += external_link_toomany(fapl) < 0 ? 1 : 0;
+ nerrors += external_link_pingpong((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_toomany((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
#endif /* H5_CANNOT_OPEN_TWICE */
- nerrors += external_link_dangling(fapl) < 0 ? 1 : 0;
- nerrors += external_link_recursive(fapl) < 0 ? 1 : 0;
- nerrors += external_link_query(fapl) < 0 ? 1 : 0;
- nerrors += external_link_unlink_compact(fapl) < 0 ? 1 : 0;
-#ifdef H5_GROUP_REVISION
- nerrors += external_link_unlink_dense(fapl) < 0 ? 1 : 0;
-#endif /* H5_GROUP_REVISION */
- nerrors += external_link_move(fapl) < 0 ? 1 : 0;
-#ifdef H5_GROUP_REVISION
- nerrors += external_link_ride(fapl) < 0 ? 1 : 0;
-#endif /* H5_GROUP_REVISION */
+ nerrors += external_link_dangling((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_recursive((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_query((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_unlink_compact((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_unlink_dense((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_move((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += external_link_ride((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
#ifndef H5_CANNOT_OPEN_TWICE
- nerrors += external_link_closing(fapl) < 0 ? 1 : 0;
+ nerrors += external_link_closing((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
#endif /* H5_CANNOT_OPEN_TWICE */
- nerrors += external_link_endian(fapl) < 0 ? 1 : 0;
-
- /* These tests assume that external links are a form of UD links,
- * so assume that everything that passed for external links
- * above has already been tested for UD links.
- */
- nerrors += ud_hard_links(fapl) < 0 ? 1 : 0;
- nerrors += ud_link_reregister(fapl) < 0 ? 1 : 0;
- nerrors += ud_callbacks(fapl) < 0 ? 1 : 0;
- nerrors += ud_link_errors(fapl) < 0 ? 1 : 0;
- nerrors += lapl_udata(fapl) < 0 ? 1 : 0;
- nerrors += lapl_nlinks(fapl) < 0 ? 1 : 0;
- nerrors += linkinfo(fapl) < 0 ? 1 : 0;
-
- nerrors += check_all_closed(fapl) < 0 ? 1 : 0;
+ nerrors += external_link_endian((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+
+ /* These tests assume that external links are a form of UD links,
+ * so assume that everything that passed for external links
+ * above has already been tested for UD links.
+ */
+ if(new_format == TRUE) {
+ nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ } /* end if */
+ nerrors += ud_callbacks((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += ud_link_errors((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += lapl_udata((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += lapl_nlinks((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ nerrors += linkinfo((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+
+ nerrors += check_all_closed((new_format ? fapl2 : fapl), new_format) < 0 ? 1 : 0;
+ } /* end for */
+
+ /* Close 2nd FAPL */
+ H5Pclose(fapl2);
/* Results */
- if (nerrors) {
+ if(nerrors) {
printf("***** %d LINK TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
exit(1);
@@ -5122,11 +5258,12 @@ main(void)
h5_cleanup(FILENAME, fapl);
}
else
- {
puts("All link tests skipped - Incompatible with current Virtual File Driver");
- }
return 0;
+error:
+ puts("*** TESTS FAILED ***");
+ return 1;
}
diff --git a/test/mount.c b/test/mount.c
index cfd99dc..af59240 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -71,8 +71,8 @@ setup(hid_t fapl)
if (H5Gclose(H5Gcreate(file, "/mnt1/file1", (size_t)0))<0) goto error;
if (H5Gclose(H5Gcreate(file, "/mnt_unlink", (size_t)0))<0) goto error;
if (H5Gclose(H5Gcreate(file, "/mnt_move_a", (size_t)0))<0) goto error;
- if (H5Glink(file, H5L_LINK_HARD, "/mnt1/file1", "/file1")<0) goto error;
- if (H5Glink(file, H5L_LINK_HARD, "/mnt1", "/mnt1_link")<0) goto error;
+ if (H5Glink(file, H5L_TYPE_HARD, "/mnt1/file1", "/file1")<0) goto error;
+ if (H5Glink(file, H5L_TYPE_HARD, "/mnt1", "/mnt1_link")<0) goto error;
if (H5Fclose(file)<0) goto error;
/* file 2 */
@@ -854,7 +854,7 @@ test_interlink(hid_t fapl)
/* Try an interfile hard link directly */
H5E_BEGIN_TRY {
- status = H5Glink(file1, H5L_LINK_HARD, "/mnt1/file2", "/file2");
+ status = H5Glink(file1, H5L_TYPE_HARD, "/mnt1/file2", "/file2");
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@@ -1108,9 +1108,9 @@ test_mount_after_close(hid_t fapl)
TEST_ERROR
if((gidABM = H5Gcreate(gidAB , "M", (size_t)0)) < 0) /* Mount point */
TEST_ERROR
- if(H5Glink(gidAB, H5L_LINK_SOFT, "./M/X/Y", "C") < 0) /* Soft link */
+ if(H5Glink(gidAB, H5L_TYPE_SOFT, "./M/X/Y", "C") < 0) /* Soft link */
TEST_ERROR
- if(H5Glink(gidAB, H5L_LINK_SOFT, "/A", "T") < 0) /* Soft link */
+ if(H5Glink(gidAB, H5L_TYPE_SOFT, "/A", "T") < 0) /* Soft link */
TEST_ERROR
/* Close groups and file */
@@ -1144,7 +1144,7 @@ test_mount_after_close(hid_t fapl)
TEST_ERROR
if((did = H5Dcreate(gidXY, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Glink(gidX, H5L_LINK_SOFT, "./Y", "T") < 0) /* Soft link */
+ if(H5Glink(gidX, H5L_TYPE_SOFT, "./Y", "T") < 0) /* Soft link */
TEST_ERROR
/* Write data to the dataset. */
@@ -3686,7 +3686,7 @@ test_symlink(hid_t fapl)
TEST_ERROR
/* Create soft link to mounted object */
- if(H5Glink(fid1, H5L_LINK_SOFT, "./A/D/H", "L") < 0) /* Soft link */
+ if(H5Glink(fid1, H5L_TYPE_SOFT, "./A/D/H", "L") < 0) /* Soft link */
TEST_ERROR
if(H5Fclose(fid1) < 0)
diff --git a/test/objcopy.c b/test/objcopy.c
index be6a80f..6745c91 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -137,7 +137,11 @@ addr_insert(H5G_stat_t *sb)
/* Insert the entry */
n = idtab_g.nobjs++;
+#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
idtab_g.obj[n] = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long)));
+#else
+ idtab_g.obj[n] = (haddr_t)sb->objno[0];
+#endif
} /* end addr_insert() */
@@ -161,9 +165,13 @@ addr_lookup(H5G_stat_t *sb)
haddr_t obj_addr; /* Object's address in the file */
size_t n;
- if (sb->nlink<2) return FALSE; /*only one link possible*/
+ if(sb->nlink<2) return FALSE; /*only one link possible*/
+#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
obj_addr = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long)));
+#else
+ obj_addr = (haddr_t)sb->objno[0];
+#endif
for(n = 0; n < idtab_g.nobjs; n++)
if(idtab_g.obj[n] == obj_addr)
return TRUE;
@@ -371,10 +379,10 @@ test_copy_attach_attribute_vl(hid_t loc_id)
unsigned int i, j;
int ret_value = -1;
- if ( (sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
goto done;
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
goto done;
for(i = 0; i < 4; i++) {
@@ -384,22 +392,22 @@ test_copy_attach_attribute_vl(hid_t loc_id)
((int *)buf[i].p)[j] = j+1;
} /* end for */
- if ( (aid = H5Acreate(loc_id, "vlen attribute", tid, sid, H5P_DEFAULT)) < 0)
+ if((aid = H5Acreate(loc_id, "vlen attribute", tid, sid, H5P_DEFAULT)) < 0)
goto done;
- if ( H5Awrite(aid, tid, buf) < 0)
+ if(H5Awrite(aid, tid, buf) < 0)
goto done;
ret_value = 0;
done:
- if (tid >0 && sid > 0)
+ if(tid >0 && sid > 0)
H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
- if (sid > 0)
+ if(sid > 0)
H5Sclose(sid);
- if (tid > 0)
+ if(tid > 0)
H5Tclose(tid);
- if (aid > 0)
+ if(aid > 0)
H5Aclose(aid);
return ret_value;
} /* end of attach_attribute_vl */
@@ -438,13 +446,13 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
attr_data[0] = 100 * i;
attr_data[1] = 200 * i;
- if ( (aid = H5Acreate(loc_id, attr_name, type_id, sid, H5P_DEFAULT)) < 0)
+ if((aid = H5Acreate(loc_id, attr_name, type_id, sid, H5P_DEFAULT)) < 0)
goto done;
- if ( H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
+ if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
goto done;
- if (aid > 0)
+ if(aid > 0)
H5Aclose(aid);
aid = -1;
@@ -453,9 +461,9 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
ret_value = 0;
done:
- if (sid > 0)
+ if(sid > 0)
H5Sclose(sid);
- if (aid > 0)
+ if(aid > 0)
H5Aclose(aid);
return ret_value;
@@ -482,7 +490,7 @@ test_copy_attach_paired_attributes(hid_t loc_id, hid_t loc_id2, hid_t type_id)
int attr_data[2], i;
hsize_t dim1 = 2;
- if ( (sid = H5Screate_simple(1, &dim1, NULL)) < 0 ) goto done;
+ if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 ) goto done;
for (i=0; i<NUM_ATTRIBUTES; i++) {
sprintf(attr_name, "%d attr", i);
@@ -492,24 +500,24 @@ test_copy_attach_paired_attributes(hid_t loc_id, hid_t loc_id2, hid_t type_id)
attr_data[1] = 200 * i;
/* Add attribute to first object */
- if ( (aid = H5Acreate(loc_id, attr_name, type_id, sid, H5P_DEFAULT)) < 0) goto done;
- if ( H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0) goto done;
- if ( H5Aclose(aid) < 0) goto done;
+ if((aid = H5Acreate(loc_id, attr_name, type_id, sid, H5P_DEFAULT)) < 0) goto done;
+ if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0) goto done;
+ if(H5Aclose(aid) < 0) goto done;
/* Add attribute to second object */
- if ( (aid = H5Acreate(loc_id2, attr_name, type_id, sid, H5P_DEFAULT)) < 0) goto done;
- if ( H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0) goto done;
- if ( H5Aclose(aid) < 0) goto done;
+ if((aid = H5Acreate(loc_id2, attr_name, type_id, sid, H5P_DEFAULT)) < 0) goto done;
+ if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0) goto done;
+ if(H5Aclose(aid) < 0) goto done;
}
- if ( H5Sclose(sid) < 0) goto done;
+ if(H5Sclose(sid) < 0) goto done;
return 0;
done:
- if (sid > 0)
+ if(sid > 0)
H5Sclose(sid);
- if (aid > 0)
+ if(aid > 0)
H5Aclose(aid);
return -1;
@@ -543,41 +551,41 @@ compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf)
/* Check the datatypes are equal */
/* Open the datatype for the source attribute */
- if ( (tid = H5Aget_type(aid)) < 0) TEST_ERROR
+ if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
/* Open the datatype for the destination attribute */
- if ( (tid2 = H5Aget_type(aid2)) < 0) TEST_ERROR
+ if((tid2 = H5Aget_type(aid2)) < 0) TEST_ERROR
/* Check that both datatypes are committed/not committed */
- if ( (is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
- if ( (is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
- if ( is_committed != is_committed2) TEST_ERROR
+ if((is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
+ if((is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
+ if(is_committed != is_committed2) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* Determine the size of datatype (for later) */
- if ( (elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+ if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
/* Check the dataspaces are equal */
/* Open the dataspace for the source attribute */
- if ( (sid = H5Aget_space(aid)) < 0) TEST_ERROR
+ if((sid = H5Aget_space(aid)) < 0) TEST_ERROR
/* Open the dataspace for the destination attribute */
- if ( (sid2 = H5Aget_space(aid2)) < 0) TEST_ERROR
+ if((sid2 = H5Aget_space(aid2)) < 0) TEST_ERROR
/* Compare the dataspaces */
- if ( H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
+ if(H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
/* Determine the number of elements in dataspace (for later) */
- if ( (nelmts = H5Sget_simple_extent_npoints(sid2)) < 0) TEST_ERROR
+ if((nelmts = H5Sget_simple_extent_npoints(sid2)) < 0) TEST_ERROR
/* Check the raw data is equal */
/* Allocate & initialize space for the raw data buffers */
- if ( (rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
- if ( (rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if((rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if((rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
/* Read data from the source attribute */
if(H5Aread(aid, tid, rbuf) < 0) TEST_ERROR
@@ -605,16 +613,16 @@ compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf)
HDfree(rbuf2);
/* close the source dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close the destination dataspace */
- if ( H5Sclose(sid2) < 0) TEST_ERROR
+ if(H5Sclose(sid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
return TRUE;
@@ -908,57 +916,57 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
/* Check the datatypes are equal */
/* Open the datatype for the source dataset */
- if ( (tid = H5Dget_type(did)) < 0) TEST_ERROR
+ if((tid = H5Dget_type(did)) < 0) TEST_ERROR
/* Open the datatype for the destination dataset */
- if ( (tid2 = H5Dget_type(did2)) < 0) TEST_ERROR
+ if((tid2 = H5Dget_type(did2)) < 0) TEST_ERROR
/* Check that both datatypes are committed/not committed */
- if ( (is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
- if ( (is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
- if ( is_committed != is_committed2) TEST_ERROR
+ if((is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
+ if((is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
+ if(is_committed != is_committed2) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* Determine the size of datatype (for later) */
- if ( (elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+ if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
/* Check the dataspaces are equal */
/* Open the dataspace for the source dataset */
- if ( (sid = H5Dget_space(did)) < 0) TEST_ERROR
+ if((sid = H5Dget_space(did)) < 0) TEST_ERROR
/* Open the dataspace for the destination dataset */
- if ( (sid2 = H5Dget_space(did2)) < 0) TEST_ERROR
+ if((sid2 = H5Dget_space(did2)) < 0) TEST_ERROR
/* Compare the dataspaces */
- if ( H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
+ if(H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
/* Determine the number of elements in dataspace (for later) */
- if ( (nelmts = H5Sget_simple_extent_npoints(sid)) < 0) TEST_ERROR
+ if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) TEST_ERROR
/* Check the dataset creation property lists are equal */
/* Open the dataset creation property list for the source dataset */
- if ( (dcpl = H5Dget_create_plist(did)) < 0) TEST_ERROR
+ if((dcpl = H5Dget_create_plist(did)) < 0) TEST_ERROR
/* Open the dataset creation property list for the destination dataset */
- if ( (dcpl2 = H5Dget_create_plist(did2)) < 0) TEST_ERROR
+ if((dcpl2 = H5Dget_create_plist(did2)) < 0) TEST_ERROR
/* Compare the dataset creation property lists */
- if ( H5Pequal(dcpl, dcpl2) != TRUE) TEST_ERROR
+ if(H5Pequal(dcpl, dcpl2) != TRUE) TEST_ERROR
/* Get the number of filters on dataset */
- if ( (nfilters = H5Pget_nfilters(dcpl)) < 0) TEST_ERROR
+ if((nfilters = H5Pget_nfilters(dcpl)) < 0) TEST_ERROR
/* close the source dataset creation property list */
- if ( H5Pclose(dcpl) < 0) TEST_ERROR
+ if(H5Pclose(dcpl) < 0) TEST_ERROR
/* close the destination dataset creation property list */
- if ( H5Pclose(dcpl2) < 0) TEST_ERROR
+ if(H5Pclose(dcpl2) < 0) TEST_ERROR
/* Check the allocated storage is the same */
@@ -974,7 +982,7 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
* data in each dataset will (probably) be different and the storage
* size will thus vary)
*/
- if (!(nfilters > 0 && H5Tdetect_class(tid, H5T_VLEN))) {
+ if(!(nfilters > 0 && H5Tdetect_class(tid, H5T_VLEN))) {
hsize_t storage_size = H5Dget_storage_size(did); /* Dataset's raw data storage size */
hsize_t storage_size2 = H5Dget_storage_size(did2); /* 2nd Dataset's raw data storage size */
@@ -1011,20 +1019,20 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
HDfree(rbuf2);
/* close the source dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close the destination dataspace */
- if ( H5Sclose(sid2) < 0) TEST_ERROR
+ if(H5Sclose(sid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* Check if the attributes are equal */
- if ( compare_std_attributes(did, did2, pid) != TRUE) TEST_ERROR
+ if(compare_std_attributes(did, did2, pid) != TRUE) TEST_ERROR
/* Datasets should be the same. :-) */
@@ -1099,8 +1107,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
/* Loop over contents of groups */
for(idx = 0; idx < num_objs; idx++) {
/* Check name of objects */
- if(H5Gget_objname_by_idx(gid, idx, objname, NAME_BUF_SIZE) < 0) TEST_ERROR
- if(H5Gget_objname_by_idx(gid2, idx, objname2, NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(H5Gget_objname_by_idx(gid, idx, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(H5Gget_objname_by_idx(gid2, idx, objname2, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
if(HDstrcmp(objname, objname2)) TEST_ERROR
/* Check type of objects */
@@ -1136,8 +1144,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
char linkname2[NAME_BUF_SIZE]; /* Link value */
/* Check link values */
- if(H5Lget_linkval(gid, objname, NAME_BUF_SIZE, linkname, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_linkval(gid2, objname2, NAME_BUF_SIZE, linkname2, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_linkval(gid, objname, (size_t)NAME_BUF_SIZE, linkname, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_linkval(gid2, objname2, (size_t)NAME_BUF_SIZE, linkname2, H5P_DEFAULT) < 0) TEST_ERROR
if(HDstrcmp(linkname, linkname2)) TEST_ERROR
}
break;
@@ -1187,12 +1195,12 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth)
char linkval2[NAME_BUF_SIZE]; /* Link value */
/* Check that both links are the same type and the same size */
- if(linfo.linkclass != linfo2.linkclass) TEST_ERROR
+ if(linfo.type != linfo2.type) TEST_ERROR
if(linfo.u.link_size != linfo2.u.link_size) TEST_ERROR
/* Get link udata */
- if(H5Lget_linkval(gid, objname, NAME_BUF_SIZE, linkval, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_linkval(gid2, objname2, NAME_BUF_SIZE, linkval2, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_linkval(gid, objname, (size_t)NAME_BUF_SIZE, linkval, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_linkval(gid2, objname2, (size_t)NAME_BUF_SIZE, linkval2, H5P_DEFAULT) < 0) TEST_ERROR
/* Compare link udata */
if(HDmemcmp(linkval, linkval2, objstat.linklen)) TEST_ERROR
@@ -1254,53 +1262,53 @@ test_copy_named_datatype(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create named datatype */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATATYPE_SIMPLE, fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATATYPE_SIMPLE, fid_dst, NAME_DATATYPE_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the datatype for copy */
- if ( (tid = H5Topen(fid_src, NAME_DATATYPE_SIMPLE)) < 0) TEST_ERROR
+ if((tid = H5Topen(fid_src, NAME_DATATYPE_SIMPLE)) < 0) TEST_ERROR
/* open the copied datatype */
- if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_SIMPLE)) < 0) TEST_ERROR
+ if((tid2 = H5Topen(fid_dst, NAME_DATATYPE_SIMPLE)) < 0) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1347,53 +1355,53 @@ test_copy_named_datatype_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create named datatype */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATATYPE_VL, fid_dst, NAME_DATATYPE_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATATYPE_VL, fid_dst, NAME_DATATYPE_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the datatype for copy */
- if ( (tid = H5Topen(fid_src, NAME_DATATYPE_VL)) < 0) TEST_ERROR
+ if((tid = H5Topen(fid_src, NAME_DATATYPE_VL)) < 0) TEST_ERROR
/* open the copied datatype */
- if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_VL)) < 0) TEST_ERROR
+ if((tid2 = H5Topen(fid_dst, NAME_DATATYPE_VL)) < 0) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1440,59 +1448,59 @@ test_copy_named_datatype_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create first vlen datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create second (nested) vlen datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create named datatype */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL_VL, tid2)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_VL_VL, tid2)) < 0) TEST_ERROR
/* close the first datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the second datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATATYPE_VL_VL, fid_dst, NAME_DATATYPE_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATATYPE_VL_VL, fid_dst, NAME_DATATYPE_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the datatype for copy */
- if ( (tid = H5Topen(fid_src, NAME_DATATYPE_VL_VL)) < 0) TEST_ERROR
+ if((tid = H5Topen(fid_src, NAME_DATATYPE_VL_VL)) < 0) TEST_ERROR
/* open the copied datatype */
- if ( (tid2 = H5Topen(fid_dst, NAME_DATATYPE_VL_VL)) < 0) TEST_ERROR
+ if((tid2 = H5Topen(fid_dst, NAME_DATATYPE_VL_VL)) < 0) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1550,66 +1558,66 @@ test_copy_dataset_simple(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1660,63 +1668,63 @@ test_copy_dataset_simple_empty(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1780,73 +1788,73 @@ test_copy_dataset_compound(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0] = DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
- if (H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
- if (H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+ if((tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_COMPOUND, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_COMPOUND, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_COMPOUND, fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_COMPOUND, fid_dst, NAME_DATASET_COMPOUND, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_COMPOUND)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1908,73 +1916,73 @@ test_copy_dataset_chunked(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2028,70 +2036,70 @@ test_copy_dataset_chunked_empty(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2154,7 +2162,7 @@ test_copy_dataset_chunked_sparse(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
@@ -2163,73 +2171,73 @@ test_copy_dataset_chunked_sparse(hid_t fapl)
max_dim2d[1]=H5S_UNLIMITED;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, max_dim2d)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, max_dim2d)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* Set extended dataset dimensions */
new_dim2d[0] = DIM_SIZE_1 * 2;
new_dim2d[1] = DIM_SIZE_2 * 2;
/* Extend dataset's dimensions */
- if ( H5Dextend(did, new_dim2d) < 0) TEST_ERROR
+ if(H5Dextend(did, new_dim2d) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2295,74 +2303,74 @@ test_copy_dataset_compressed(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create and set comp & chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
- if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -2424,73 +2432,73 @@ test_copy_dataset_compact(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_COMPACT, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_COMPACT, H5T_NATIVE_FLOAT, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_COMPACT, fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_COMPACT, fid_dst, NAME_DATASET_COMPACT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_COMPACT)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_COMPACT)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_COMPACT)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_COMPACT)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2554,43 +2562,43 @@ test_copy_dataset_external(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* set dataset creation plist */
size = DIM_SIZE_1 * sizeof (int);
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_external(pid, FILE_EXT, (off_t)0, size) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_external(pid, FILE_EXT, (off_t)0, size) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_EXTERNAL, H5T_NATIVE_INT, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_EXTERNAL, H5T_NATIVE_INT, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close external plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Don't change the address in the destination file for this test, it causes the
* external file list's heap to be at a different location and generates a false
@@ -2599,32 +2607,32 @@ test_copy_dataset_external(hid_t fapl)
*/
#if 0
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
#endif /* 0 */
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_EXTERNAL, fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_EXTERNAL, fid_dst, NAME_DATASET_EXTERNAL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_EXTERNAL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2683,69 +2691,69 @@ test_copy_dataset_named_dtype(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create named datatype */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_NAMED_DTYPE, fid_dst, NAME_DATASET_NAMED_DTYPE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_NAMED_DTYPE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2805,84 +2813,84 @@ test_copy_dataset_named_dtype_hier(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to place all objects in */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create named datatype _inside_ hierarchy to copy */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if ( (H5Tcommit(gid, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((H5Tcommit(gid, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* create first dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* create second dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2944,84 +2952,84 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to place all objects in */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create named datatype _outside_ hierarchy to copy */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* create first dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* create second dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(gid, NAME_DATASET_NAMED_DTYPE2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3082,80 +3090,80 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to place all objects in */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create first dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* create second dataset at SRC file */
- if ( (did2 = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR2, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did2 = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR2, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* Add attributes to datasets in a way that creates lots of chunks */
- if ( test_copy_attach_paired_attributes(did, did2, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_paired_attributes(did, did2, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the first dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the second dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3216,87 +3224,87 @@ test_copy_dataset_attr_named_dtype(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to place all objects in */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create named datatype _outside_ hierarchy to copy */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* create first dataset at SRC file */
- if ( (did = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* create second dataset at SRC file */
- if ( (did2 = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did2 = H5Dcreate(gid, NAME_DATASET_MULTI_OHDR2, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* Add attributes to datasets in a way that creates lots of chunks */
- if ( test_copy_attach_paired_attributes(did, did2, tid) < 0) TEST_ERROR
+ if(test_copy_attach_paired_attributes(did, did2, tid) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the first dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the second dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3361,72 +3369,72 @@ test_copy_dataset_contig_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3492,79 +3500,79 @@ test_copy_dataset_chunked_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3629,79 +3637,79 @@ test_copy_dataset_compact_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3755,68 +3763,68 @@ test_copy_attribute_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach VL attribute to the dataset */
- if ( test_copy_attach_attribute_vl(did) < 0) TEST_ERROR
+ if(test_copy_attach_attribute_vl(did) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the attributes are equal */
- if ( (aid = H5Aopen_idx(did, 0)) < 0) TEST_ERROR
- if ( (aid2 = H5Aopen_idx(did2, 0)) < 0) TEST_ERROR
- if ( compare_attribute(aid, aid2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
- if ( H5Aclose(aid) < 0) TEST_ERROR
- if ( H5Aclose(aid2) < 0) TEST_ERROR
+ if((aid = H5Aopen_idx(did, 0)) < 0) TEST_ERROR
+ if((aid2 = H5Aopen_idx(did2, 0)) < 0) TEST_ERROR
+ if(compare_attribute(aid, aid2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if(H5Aclose(aid) < 0) TEST_ERROR
+ if(H5Aclose(aid2) < 0) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -3890,80 +3898,80 @@ test_copy_dataset_compressed_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create and set comp & chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
- if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 2, chunk_dim2d) < 0) TEST_ERROR
+ if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
/* create dataset */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, tid, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_CHUNKED, tid, sid, pid)) < 0) TEST_ERROR
/* close chunk plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_CHUNKED)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -4019,53 +4027,53 @@ test_copy_group_empty(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_EMPTY, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_EMPTY, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_EMPTY)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_EMPTY)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_EMPTY)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_EMPTY)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4125,78 +4133,78 @@ test_copy_group(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the group */
- if ( (did = H5Dcreate(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_GROUP_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* create a sub-group */
- if ( (gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
+ if((gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
if( H5Gclose(gid_sub) < 0) TEST_ERROR
/* create another sub-group */
- if ( (gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB_2, (size_t)0)) < 0) TEST_ERROR
+ if((gid_sub = H5Gcreate(fid_src, NAME_GROUP_SUB_2, (size_t)0)) < 0) TEST_ERROR
if( H5Gclose(gid_sub) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4391,87 +4399,87 @@ test_copy_group_deep(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create nested sub-groups & datasets */
for(i = 0; i < NUM_SUB_GROUPS; i++) {
sprintf(objname, "Group #%d", i);
- if ( (gid_sub = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
+ if((gid_sub = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
for(j = 0; j < NUM_SUB_GROUPS; j++) {
sprintf(objname, "Group #%d", j);
- if ( (gid_sub2 = H5Gcreate(gid_sub, objname, (size_t)0)) < 0) TEST_ERROR
+ if((gid_sub2 = H5Gcreate(gid_sub, objname, (size_t)0)) < 0) TEST_ERROR
for(k = 0; k < NUM_DATASETS; k++) {
sprintf(objname, "Dataset #%d", k);
/* add a dataset to the group */
- if ( (did = H5Dcreate(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if((did = H5Dcreate(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
} /* end for */
- if( H5Gclose(gid_sub2) < 0) TEST_ERROR
+ if(H5Gclose(gid_sub2) < 0) TEST_ERROR
} /* end for */
- if( H5Gclose(gid_sub) < 0) TEST_ERROR
+ if(H5Gclose(gid_sub) < 0) TEST_ERROR
} /* end for */
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4522,21 +4530,21 @@ test_copy_group_loop(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* create sub-groups */
- if ( (gid_sub = H5Gcreate(gid, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
+ if((gid_sub = H5Gcreate(gid, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
- if ( (gid_sub2 = H5Gcreate(gid, NAME_GROUP_SUB_SUB, (size_t)0)) < 0) TEST_ERROR
+ if((gid_sub2 = H5Gcreate(gid, NAME_GROUP_SUB_SUB, (size_t)0)) < 0) TEST_ERROR
/* Create link to top group */
- if ( H5Glink2(gid, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR
+ if(H5Glink2(gid, ".", H5L_TYPE_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR
/* close sub sub group */
if( H5Gclose(gid_sub2) < 0) TEST_ERROR
@@ -4545,44 +4553,44 @@ test_copy_group_loop(hid_t fapl)
if( H5Gclose(gid_sub) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4639,31 +4647,31 @@ test_copy_group_wide_loop(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* create wide sub-group hierarchy, with multiple links to higher groups */
for(u = 0; u < NUM_WIDE_LOOP_GROUPS; u++) {
sprintf(objname, "%s-%u", NAME_GROUP_SUB, u);
- if ( (gid_sub = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
+ if((gid_sub = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
for(v = 0; v < NUM_WIDE_LOOP_GROUPS; v++) {
sprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v);
- if ( (gid_sub2 = H5Gcreate(gid_sub, objname, (size_t)0)) < 0) TEST_ERROR
+ if((gid_sub2 = H5Gcreate(gid_sub, objname, (size_t)0)) < 0) TEST_ERROR
/* Create link to top group */
- if ( H5Glink2(gid, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR
+ if(H5Glink2(gid, ".", H5L_TYPE_HARD, gid_sub2, NAME_GROUP_LOOP) < 0) TEST_ERROR
/* Create link to sub-group */
- if ( H5Glink2(gid_sub, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP2) < 0) TEST_ERROR
+ if(H5Glink2(gid_sub, ".", H5L_TYPE_HARD, gid_sub2, NAME_GROUP_LOOP2) < 0) TEST_ERROR
/* Create link to self :-) */
- if ( H5Glink2(gid_sub2, ".", H5L_LINK_HARD, gid_sub2, NAME_GROUP_LOOP3) < 0) TEST_ERROR
+ if(H5Glink2(gid_sub2, ".", H5L_TYPE_HARD, gid_sub2, NAME_GROUP_LOOP3) < 0) TEST_ERROR
/* close sub sub group */
if( H5Gclose(gid_sub2) < 0) TEST_ERROR
@@ -4674,44 +4682,44 @@ test_copy_group_wide_loop(hid_t fapl)
} /* end for */
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4772,82 +4780,82 @@ test_copy_group_links(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the group */
- if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* make a hard link to the dataset */
- if (H5Glink(fid_src, H5L_LINK_HARD, NAME_LINK_DATASET, NAME_LINK_HARD) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_TYPE_HARD, NAME_LINK_DATASET, NAME_LINK_HARD) < 0) TEST_ERROR
/* make a soft link to the dataset */
- if (H5Glink(fid_src, H5L_LINK_SOFT, NAME_LINK_DATASET, NAME_LINK_SOFT) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_TYPE_SOFT, NAME_LINK_DATASET, NAME_LINK_SOFT) < 0) TEST_ERROR
/* make a soft link to nowhere */
- if (H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_TYPE_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR
/* make a dangling external link */
- if (H5Lcreate_external("filename", "obj_name", fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external("filename", "obj_name", fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the group for copy */
- if ( (gid = H5Gopen(fid_src, NAME_GROUP_LINK)) < 0) TEST_ERROR
+ if((gid = H5Gopen(fid_src, NAME_GROUP_LINK)) < 0) TEST_ERROR
/* open the destination group */
- if ( (gid2 = H5Gopen(fid_dst, NAME_GROUP_LINK)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen(fid_dst, NAME_GROUP_LINK)) < 0) TEST_ERROR
/* Check if the groups are equal */
- if ( compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1) != TRUE) TEST_ERROR
/* close the destination group */
- if ( H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* close the source group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -4907,73 +4915,73 @@ test_copy_soft_link(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the group */
- if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* make a soft link to the dataset */
- if (H5Glink(fid_src, H5L_LINK_SOFT, NAME_LINK_DATASET, NAME_LINK_SOFT) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_TYPE_SOFT, NAME_LINK_DATASET, NAME_LINK_SOFT) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_LINK_SOFT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_LINK_SOFT, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset through the soft link for copy */
- if ( (did = H5Dopen(fid_src, NAME_LINK_SOFT)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_LINK_SOFT)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5034,80 +5042,80 @@ test_copy_ext_link(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group at the SRC file */
- if ( (gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
/* attach attributes to the group */
- if ( test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
/* create dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* add a dataset to the group */
- if ( (did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_LINK_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT) ) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* close the dataset */
- if (H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the group */
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* create file to hold external links to the src file */
- if ( (fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create group in the file that will hold the external link */
- if ( (gid = H5Gcreate(fid_ext, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_ext, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
/* Create an external link to the dataset in the source file */
- if ( H5Lcreate_external(src_filename, NAME_LINK_DATASET, fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(src_filename, NAME_LINK_DATASET, fid_ext, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* close the group and file */
- if ( H5Gclose(gid) < 0) TEST_ERROR
- if (H5Fclose(fid_ext) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid_ext) < 0) TEST_ERROR
/* open the "extern" file with read-only */
- if ( (fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_ext, NAME_LINK_EXTERN, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset through the external link */
- if ( (did = H5Dopen(fid_ext, NAME_LINK_EXTERN)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_ext, NAME_LINK_EXTERN)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the EXT file */
- if ( H5Fclose(fid_ext) < 0) TEST_ERROR
+ if(H5Fclose(fid_ext) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5167,45 +5175,45 @@ test_copy_exist(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE,fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_SIMPLE,fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* try to copy the dataset from SRC to DST again (should fail) */
H5E_BEGIN_TRY {
@@ -5214,10 +5222,10 @@ test_copy_exist(hid_t fapl)
if( ret >= 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5276,42 +5284,42 @@ test_copy_path(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0] = DIM_SIZE_1;
dim2d[1] = DIM_SIZE_2;
/* create 2D dataspace */
- if ( (sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
/* create 2D int dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
/* attach attributes to the dataset */
- if ( test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(did, H5T_NATIVE_INT) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST (should fail - intermediate groups not there) */
H5E_BEGIN_TRY {
@@ -5320,38 +5328,38 @@ test_copy_path(hid_t fapl)
if( ret >= 0) TEST_ERROR
/* Create the intermediate groups in destination file */
- if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_dst, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
- if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_dst, NAME_GROUP_SUB, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
- if ( (gid = H5Gcreate(fid_dst, NAME_GROUP_SUB_SUB, (size_t)0)) < 0) TEST_ERROR
- if ( H5Gclose(gid) < 0) TEST_ERROR
+ if((gid = H5Gcreate(fid_dst, NAME_GROUP_SUB_SUB, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* copy the dataset from SRC to DST, using full path */
- if ( H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SUB_SUB, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_SIMPLE)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_SUB_SUB)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_SUB_SUB)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5398,32 +5406,32 @@ test_copy_same_file_named_datatype(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create named datatype */
- if ( (H5Tcommit(fid, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
+ if((H5Tcommit(fid, NAME_DATATYPE_SIMPLE, tid)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
- if ( H5Gcopy(fid, NAME_DATATYPE_SIMPLE, fid, NAME_DATATYPE_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid, NAME_DATATYPE_SIMPLE, fid, NAME_DATATYPE_SIMPLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the copied datatype */
- if ( (tid2 = H5Topen(fid, NAME_DATATYPE_SIMPLE2)) < 0) TEST_ERROR
+ if((tid2 = H5Topen(fid, NAME_DATATYPE_SIMPLE2)) < 0) TEST_ERROR
/* Compare the datatypes */
- if ( H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+ if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
/* close the destination datatype */
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close the source datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the file */
- if ( H5Fclose(fid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5508,88 +5516,88 @@ test_copy_dataset_compact_named_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* make a copy of the datatype for later use */
- if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
+ if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
/* named data type */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid_copy) < 0) TEST_ERROR
+ if(H5Tclose(tid_copy) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5655,81 +5663,81 @@ test_copy_dataset_contig_named_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* make a copy of the datatype for later use */
- if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
+ if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
/* named data type */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid_copy) < 0) TEST_ERROR
+ if(H5Tclose(tid_copy) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5796,88 +5804,88 @@ test_copy_dataset_chunked_named_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* make a copy of the datatype for later use */
- if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
+ if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
/* named data type */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid_copy) < 0) TEST_ERROR
+ if(H5Tclose(tid_copy) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5945,89 +5953,89 @@ test_copy_dataset_compressed_named_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* make a copy of the datatype for later use */
- if ( (tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
+ if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR
/* named data type */
- if ( (H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
+ if((H5Tcommit(fid_src, NAME_DATATYPE_VL, tid)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
- if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL, tid, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL, fid_dst, NAME_DATASET_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid_copy) < 0) TEST_ERROR
+ if(H5Tclose(tid_copy) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -6108,82 +6116,82 @@ test_copy_dataset_compact_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create nested VL datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -6263,81 +6271,81 @@ test_copy_dataset_contig_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create nested VL datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create and set compact plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -6417,82 +6425,82 @@ test_copy_dataset_chunked_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create nested VL datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -6573,83 +6581,83 @@ test_copy_dataset_compressed_vl_vl(hid_t fapl)
addr_reset();
/* create source file */
- if ( (fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim1d[0]=DIM_SIZE_1;
/* create dataspace */
- if ( (sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if ( (tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
/* create nested VL datatype */
- if ( (tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
+ if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
/* create and set chunk plist */
- if ( (pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if ( H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
- if ( H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+ if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
/* create dataset at SRC file */
- if ( (did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
+ if((did = H5Dcreate(fid_src, NAME_DATASET_VL_VL, tid2, sid, pid)) < 0) TEST_ERROR
/* write data into file */
- if ( H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close compact plist */
- if ( H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
/* close the dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* open the source file with read-only */
- if ( (fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
- if ( H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gcopy(fid_src, NAME_DATASET_VL_VL, fid_dst, NAME_DATASET_VL_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* open the dataset for copy */
- if ( (did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
+ if((did = H5Dopen(fid_src, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* open the destination dataset */
- if ( (did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
+ if((did2 = H5Dopen(fid_dst, NAME_DATASET_VL_VL)) < 0) TEST_ERROR
/* Check if the datasets are equal */
- if ( compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
/* close the destination dataset */
- if ( H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
/* close the source dataset */
- if ( H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
/* close the SRC file */
- if ( H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
/* close the DST file */
- if ( H5Fclose(fid_dst) < 0) TEST_ERROR
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if ( H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
/* close datatype */
- if ( H5Tclose(tid) < 0) TEST_ERROR
- if ( H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
/* close dataspace */
- if ( H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -6768,14 +6776,14 @@ test_copy_option(hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const
if((flag & H5G_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
/* Create group to copy */
if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR
- if(H5Glink(fid_src, H5L_LINK_SOFT, NAME_DATASET_SUB_SUB, NAME_LINK_SOFT) < 0) TEST_ERROR
- if(H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_TYPE_SOFT, NAME_DATASET_SUB_SUB, NAME_LINK_SOFT) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_TYPE_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
/* Create group to compare with */
if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK2, (size_t)0)) < 0) TEST_ERROR
- if(H5Glink(fid_src, H5L_LINK_HARD, NAME_DATASET_SUB_SUB, NAME_LINK_SOFT2) < 0) TEST_ERROR
- if(H5Glink(fid_src, H5L_LINK_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE2) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_TYPE_HARD, NAME_DATASET_SUB_SUB, NAME_LINK_SOFT2) < 0) TEST_ERROR
+ if(H5Glink(fid_src, H5L_TYPE_SOFT, "nowhere", NAME_LINK_SOFT_DANGLE2) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
} /* end if */
@@ -6804,29 +6812,27 @@ test_copy_option(hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const
if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* create destination file */
- if ( (fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create an uncopied object in destination file so that addresses in source and destination
files aren't the same */
- if ( H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR
/* create property to pass copy options */
- if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
+ if((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
/* set options for object copy */
- if ( H5Pset_copy_object(pid, flag) < 0) TEST_ERROR
+ if(H5Pset_copy_object(pid, flag) < 0) TEST_ERROR
/* Verify object copy flags */
- if ( H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
- if ( cpy_flags != flag) TEST_ERROR
+ if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ if(cpy_flags != flag) TEST_ERROR
/* copy the group from SRC to DST */
if(crt_intermediate_grp) {
/* Create link creation plist to pass in intermediate group creation */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
-#ifdef H5_GROUP_REVISION
if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
-#endif /* H5_GROUP_REVISION */
if(H5Gcopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0) TEST_ERROR
@@ -6942,71 +6948,90 @@ main(void)
envval = "nomatch";
if(HDstrcmp(envval, "stdio") && HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) {
- int nerrors = 0;
- hid_t fapl;
+ int nerrors = 0;
+ hid_t fapl, fapl2;
+ hbool_t new_format;
/* Setup */
h5_reset();
fapl = h5_fileaccess();
- /* The tests... */
- nerrors += test_copy_named_datatype(fapl);
- nerrors += test_copy_named_datatype_vl(fapl);
- nerrors += test_copy_named_datatype_vl_vl(fapl);
- nerrors += test_copy_dataset_simple(fapl);
- nerrors += test_copy_dataset_simple_empty(fapl);
- nerrors += test_copy_dataset_compound(fapl);
- nerrors += test_copy_dataset_chunked(fapl);
- nerrors += test_copy_dataset_chunked_empty(fapl);
- nerrors += test_copy_dataset_chunked_sparse(fapl);
- nerrors += test_copy_dataset_compressed(fapl);
- nerrors += test_copy_dataset_compact(fapl);
- nerrors += test_copy_dataset_external(fapl);
- nerrors += test_copy_dataset_named_dtype(fapl);
- nerrors += test_copy_dataset_named_dtype_hier(fapl);
- nerrors += test_copy_dataset_named_dtype_hier_outside(fapl);
- nerrors += test_copy_dataset_multi_ohdr_chunks(fapl);
- nerrors += test_copy_dataset_attr_named_dtype(fapl);
- nerrors += test_copy_dataset_contig_vl(fapl);
- nerrors += test_copy_dataset_chunked_vl(fapl);
- nerrors += test_copy_dataset_compact_vl(fapl);
- nerrors += test_copy_dataset_compressed_vl(fapl);
- nerrors += test_copy_attribute_vl(fapl);
- nerrors += test_copy_dataset_compact_named_vl(fapl);
- nerrors += test_copy_dataset_contig_named_vl(fapl);
- nerrors += test_copy_dataset_chunked_named_vl(fapl);
- nerrors += test_copy_dataset_compressed_named_vl(fapl);
- nerrors += test_copy_dataset_compact_vl_vl(fapl);
- nerrors += test_copy_dataset_contig_vl_vl(fapl);
- nerrors += test_copy_dataset_chunked_vl_vl(fapl);
- nerrors += test_copy_dataset_compressed_vl_vl(fapl);
- nerrors += test_copy_group_empty(fapl);
- nerrors += test_copy_root_group(fapl);
- nerrors += test_copy_group(fapl);
- nerrors += test_copy_group_deep(fapl);
- nerrors += test_copy_group_loop(fapl);
- nerrors += test_copy_group_wide_loop(fapl);
- nerrors += test_copy_group_links(fapl);
- nerrors += test_copy_soft_link(fapl);
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ puts("\nTesting with new group format:");
+ my_fapl = fapl2;
+ } /* end if */
+ else {
+ puts("Testing with old group format:");
+ my_fapl = fapl;
+ } /* end else */
+
+ /* The tests... */
+ nerrors += test_copy_named_datatype(my_fapl);
+ nerrors += test_copy_named_datatype_vl(my_fapl);
+ nerrors += test_copy_named_datatype_vl_vl(my_fapl);
+ nerrors += test_copy_dataset_simple(my_fapl);
+ nerrors += test_copy_dataset_simple_empty(my_fapl);
+ nerrors += test_copy_dataset_compound(my_fapl);
+ nerrors += test_copy_dataset_chunked(my_fapl);
+ nerrors += test_copy_dataset_chunked_empty(my_fapl);
+ nerrors += test_copy_dataset_chunked_sparse(my_fapl);
+ nerrors += test_copy_dataset_compressed(my_fapl);
+ nerrors += test_copy_dataset_compact(my_fapl);
+ nerrors += test_copy_dataset_external(my_fapl);
+ nerrors += test_copy_dataset_named_dtype(my_fapl);
+ nerrors += test_copy_dataset_named_dtype_hier(my_fapl);
+ nerrors += test_copy_dataset_named_dtype_hier_outside(my_fapl);
+ nerrors += test_copy_dataset_multi_ohdr_chunks(my_fapl);
+ nerrors += test_copy_dataset_attr_named_dtype(my_fapl);
+ nerrors += test_copy_dataset_contig_vl(my_fapl);
+ nerrors += test_copy_dataset_chunked_vl(my_fapl);
+ nerrors += test_copy_dataset_compact_vl(my_fapl);
+ nerrors += test_copy_dataset_compressed_vl(my_fapl);
+ nerrors += test_copy_attribute_vl(my_fapl);
+ nerrors += test_copy_dataset_compact_named_vl(my_fapl);
+ nerrors += test_copy_dataset_contig_named_vl(my_fapl);
+ nerrors += test_copy_dataset_chunked_named_vl(my_fapl);
+ nerrors += test_copy_dataset_compressed_named_vl(my_fapl);
+ nerrors += test_copy_dataset_compact_vl_vl(my_fapl);
+ nerrors += test_copy_dataset_contig_vl_vl(my_fapl);
+ nerrors += test_copy_dataset_chunked_vl_vl(my_fapl);
+ nerrors += test_copy_dataset_compressed_vl_vl(my_fapl);
+ nerrors += test_copy_group_empty(my_fapl);
+ nerrors += test_copy_root_group(my_fapl);
+ nerrors += test_copy_group(my_fapl);
+ nerrors += test_copy_group_deep(my_fapl);
+ nerrors += test_copy_group_loop(my_fapl);
+ nerrors += test_copy_group_wide_loop(my_fapl);
+ nerrors += test_copy_group_links(my_fapl);
+ nerrors += test_copy_soft_link(my_fapl);
#ifndef H5_CANNOT_OPEN_TWICE
- nerrors += test_copy_ext_link(fapl);
+ nerrors += test_copy_ext_link(my_fapl);
#endif /* H5_CANNOT_OPEN_TWICE */
- nerrors += test_copy_exist(fapl);
- nerrors += test_copy_path(fapl);
- nerrors += test_copy_same_file_named_datatype(fapl);
- nerrors += test_copy_option(fapl, H5G_COPY_WITHOUT_ATTR_FLAG, FALSE, "H5Gcopy(): without attributes");
-#ifdef H5_GROUP_REVISION
- nerrors += test_copy_option(fapl, 0, TRUE, "H5Gcopy(): with missing groups");
-#endif
- nerrors += test_copy_option(fapl, H5G_COPY_EXPAND_SOFT_LINK_FLAG, FALSE, "H5Gcopy(): expand soft link");
- nerrors += test_copy_option(fapl, H5G_COPY_SHALLOW_HIERARCHY_FLAG, FALSE, "H5Gcopy(): shallow group copy");
- nerrors += test_copy_option(fapl, H5G_COPY_EXPAND_REFERENCE_FLAG, FALSE, "H5Gcopy(): expand object reference");
-
+ nerrors += test_copy_exist(my_fapl);
+ nerrors += test_copy_path(my_fapl);
+ nerrors += test_copy_same_file_named_datatype(my_fapl);
+ nerrors += test_copy_option(my_fapl, H5G_COPY_WITHOUT_ATTR_FLAG, FALSE, "H5Gcopy(): without attributes");
+ nerrors += test_copy_option(my_fapl, 0, TRUE, "H5Gcopy(): with missing groups");
+ nerrors += test_copy_option(my_fapl, H5G_COPY_EXPAND_SOFT_LINK_FLAG, FALSE, "H5Gcopy(): expand soft link");
+ nerrors += test_copy_option(my_fapl, H5G_COPY_SHALLOW_HIERARCHY_FLAG, FALSE, "H5Gcopy(): shallow group copy");
+ nerrors += test_copy_option(my_fapl, H5G_COPY_EXPAND_REFERENCE_FLAG, FALSE, "H5Gcopy(): expand object reference");
/* TODO: not implemented
- nerrors += test_copy_option(fapl, H5G_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Gcopy: expand external link");
- nerrors += test_copy_mount(fapl);
+ nerrors += test_copy_option(my_fapl, H5G_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Gcopy: expand external link");
+ nerrors += test_copy_mount(my_fapl);
*/
+ } /* end for */
/* Reset file address checking info */
addr_reset();
@@ -7026,5 +7051,8 @@ main(void)
puts("All object copying tests skipped - Incompatible with current Virtual File Driver");
return 0;
+
+error:
+ return 1;
} /* main */
diff --git a/test/stab.c b/test/stab.c
index b684f9e..59e2436 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -27,13 +27,18 @@
#include "H5HLprivate.h" /* Local Heaps */
const char *FILENAME[] = {
- "stab1",
- "stab2",
+ "stab",
NULL
};
#define NAME_BUF_SIZE 1024
+/* Definitions for 'long' test */
+#define LONG_NAME_LEN 40960
+
+/* Definitions for 'large' test */
+#define LARGE_NOBJS 5000
+
/* Definitions for 'lifecycle' test */
#define LIFECYCLE_TOP_GROUP "top"
#define LIFECYCLE_BOTTOM_GROUP "bottom %u"
@@ -80,54 +85,62 @@ const char *FILENAME[] = {
* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
- * Modifications:
- * Robb Matzke, 2002-03-28
- * File is opened by parent instead of here.
*-------------------------------------------------------------------------
*/
static int
-test_misc(hid_t file)
+test_misc(hid_t fapl, hbool_t new_format)
{
- hid_t g1=-1, g2=-1, g3=-1;
+ hid_t fid = (-1); /* File ID */
+ hid_t g1 = (-1), g2 = (-1), g3 = (-1);
+ char filename[NAME_BUF_SIZE];
char comment[64];
- /* Test current working groups */
- TESTING("miscellaneous group tests");
+ if(new_format)
+ TESTING("miscellaneous group tests (w/new group format)")
+ else
+ TESTING("miscellaneous group tests")
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create initial groups for testing, then close */
- if ((g1=H5Gcreate(file, "test_1a", 0))<0) goto error;
- if ((g2=H5Gcreate(g1, "sub_1", 0))<0) goto error;
- if ((g3=H5Gcreate(file, "test_1b", 0))<0) goto error;
- if (H5Gset_comment(g3, ".", "hello world")<0) goto error;
- if (H5Gclose(g1)<0) goto error;
- if (H5Gclose(g2)<0) goto error;
- if (H5Gclose(g3)<0) goto error;
+ if((g1 = H5Gcreate(fid, "test_1a", (size_t)0)) < 0) TEST_ERROR
+ if((g2 = H5Gcreate(g1, "sub_1", (size_t)0)) < 0) TEST_ERROR
+ if((g3 = H5Gcreate(fid, "test_1b", (size_t)0)) < 0) TEST_ERROR
+ if(H5Gset_comment(g3, ".", "hello world") < 0) TEST_ERROR
+ if(H5Gclose(g1) < 0) TEST_ERROR
+ if(H5Gclose(g2) < 0) TEST_ERROR
+ if(H5Gclose(g3) < 0) TEST_ERROR
/* Open all groups with absolute names to check for exsistence */
- if ((g1=H5Gopen(file, "/test_1a"))<0) goto error;
- if ((g2=H5Gopen(file, "/test_1a/sub_1"))<0) goto error;
- if ((g3=H5Gopen(file, "/test_1b"))<0) goto error;
- if (H5Gget_comment(g3, "././.", sizeof comment, comment)<0) goto error;
- if (strcmp(comment, "hello world")) {
+ if((g1 = H5Gopen(fid, "/test_1a")) < 0) TEST_ERROR
+ if((g2 = H5Gopen(fid, "/test_1a/sub_1")) < 0) TEST_ERROR
+ if((g3 = H5Gopen(fid, "/test_1b")) < 0) TEST_ERROR
+ if(H5Gget_comment(g3, "././.", sizeof comment, comment) < 0) TEST_ERROR
+ if(HDstrcmp(comment, "hello world")) {
H5_FAILED();
puts(" Read the wrong comment string from the group.");
printf(" got: \"%s\"\n ans: \"hello world\"\n", comment);
- goto error;
+ TEST_ERROR
}
- if (H5Gclose(g1)<0) goto error;
- if (H5Gclose(g2)<0) goto error;
- if (H5Gclose(g3)<0) goto error;
+ if(H5Gclose(g1) < 0) TEST_ERROR
+ if(H5Gclose(g2) < 0) TEST_ERROR
+ if(H5Gclose(g3) < 0) TEST_ERROR
/* Check that creating groups with no-op names isn't allowed */
H5E_BEGIN_TRY {
- g1=H5Gcreate(file, "/", 0);
+ g1 = H5Gcreate(fid, "/", (size_t)0);
} H5E_END_TRY
- if(g1 >= 0) goto error;
+ if(g1 >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- g1=H5Gcreate(file, "./././", 0);
+ g1 = H5Gcreate(fid, "./././", (size_t)0);
} H5E_END_TRY
- if(g1 >= 0) goto error;
+ if(g1 >= 0) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -137,6 +150,7 @@ test_misc(hid_t file)
H5Gclose(g1);
H5Gclose(g2);
H5Gclose(g3);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
}
@@ -155,33 +169,45 @@ test_misc(hid_t file)
*-------------------------------------------------------------------------
*/
static int
-test_long(hid_t file)
+test_long(hid_t fapl, hbool_t new_format)
{
- hid_t g1=-1, g2=-1;
- char *name1=NULL, *name2=NULL;
- size_t namesize=40960, i;
+ hid_t fid = (-1); /* File ID */
+ hid_t g1 = (-1), g2 = (-1);
+ char *name1 = NULL, *name2 = NULL;
+ char filename[NAME_BUF_SIZE];
+ size_t i;
- TESTING("long names");
+ if(new_format)
+ TESTING("long names (w/new group format)")
+ else
+ TESTING("long names")
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Group names */
- name1 = HDmalloc(namesize);
- for (i=0; i<namesize; i++)
+ name1 = HDmalloc(LONG_NAME_LEN);
+ for(i = 0; i < LONG_NAME_LEN; i++)
name1[i] = (char)('A' + i%26);
- name1[namesize-1] = '\0';
- name2 = HDmalloc(2*namesize + 2);
+ name1[LONG_NAME_LEN - 1] = '\0';
+ name2 = HDmalloc((2 * LONG_NAME_LEN) + 2);
sprintf(name2, "%s/%s", name1, name1);
/* Create groups */
- if ((g1=H5Gcreate(file, name1, 0))<0) goto error;
- if ((g2=H5Gcreate(g1, name1, 0))<0) goto error;
- H5Gclose(g1);
- H5Gclose(g2);
+ if((g1 = H5Gcreate(fid, name1, (size_t)0)) < 0) TEST_ERROR
+ if((g2 = H5Gcreate(g1, name1, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(g1) < 0) TEST_ERROR
+ if(H5Gclose(g2) < 0) TEST_ERROR
/* Open groups */
- if ((g1=H5Gopen(file, name1))<0) goto error;
- if ((g2=H5Gopen(file, name2))<0) goto error;
- H5Gclose(g1);
- H5Gclose(g2);
+ if((g1 = H5Gopen(fid, name1)) < 0) TEST_ERROR
+ if((g2 = H5Gopen(fid, name2)) < 0) TEST_ERROR
+ if(H5Gclose(g1) < 0) TEST_ERROR
+ if(H5Gclose(g2) < 0) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Release name buffers */
HDfree(name2);
@@ -190,17 +216,16 @@ test_long(hid_t file)
PASSED();
return 0;
- error:
+error:
H5E_BEGIN_TRY {
H5Gclose(g1);
H5Gclose(g2);
- if(name2)
- free(name2);
- if(name1)
- free(name1);
+ H5Fclose(fid);
+ H5MM_xfree(name2);
+ H5MM_xfree(name1);
} H5E_END_TRY;
return 1;
-}
+} /* end test_long() */
/*-------------------------------------------------------------------------
@@ -222,29 +247,41 @@ test_long(hid_t file)
*-------------------------------------------------------------------------
*/
static int
-test_large(hid_t file)
+test_large(hid_t fapl, hbool_t new_format)
{
- hid_t cwg=-1, dir=-1;
- int i;
- char name[1024];
- int nsyms = 5000;
+ hid_t fid = (-1); /* File ID */
+ hid_t cwg = (-1), dir = (-1); /* Group IDs */
+ char filename[NAME_BUF_SIZE];
+ char name[NAME_BUF_SIZE];
+ int i;
- TESTING("large directories");
+ if(new_format)
+ TESTING("large directories (w/new group format)")
+ else
+ TESTING("large directories")
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/*
* Create a directory that has so many entries that the root
* of the B-tree ends up splitting.
*/
- if ((cwg=H5Gcreate(file, "/big", (size_t)nsyms*16+2))<0) goto error;
- for (i=0; i<nsyms; i++) {
- sprintf(name, "%05d%05d", rand()%100000, i);
-#if 0
- fprintf(stderr, "%s\n", name);
-#endif
- if ((dir=H5Gcreate(cwg, name, 0))<0) goto error;
- if (H5Gclose(dir)<0) goto error;
+ if((cwg = H5Gcreate(fid, "/big", (size_t)(LARGE_NOBJS * 16 + 2))) < 0) TEST_ERROR
+ if(new_format)
+ if(H5G_has_stab_test(cwg) != FALSE) TEST_ERROR
+ for(i = 0; i < LARGE_NOBJS; i++) {
+ sprintf(name, "%05d%05d", (HDrandom() % 100000), i);
+ if((dir = H5Gcreate(cwg, name, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(dir) < 0) TEST_ERROR
}
- if (H5Gclose(cwg)<0) goto error;
+ if(new_format)
+ if(H5G_is_new_dense_test(cwg) != TRUE) TEST_ERROR
+ if(H5Gclose(cwg) < 0) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -253,11 +290,11 @@ test_large(hid_t file)
H5E_BEGIN_TRY {
H5Gclose(dir);
H5Gclose(cwg);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
-}
+} /* end test_large() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: lifecycle
@@ -282,6 +319,7 @@ lifecycle(hid_t fapl)
hid_t gid = (-1); /* Group ID */
hid_t gid2 = (-1); /* Datatype ID */
hid_t gcpl = (-1); /* Group creation property list ID */
+ hid_t fapl2 = (-1); /* File access property list ID */
size_t lheap_size_hint; /* Local heap size hint */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
@@ -297,68 +335,74 @@ lifecycle(hid_t fapl)
TESTING("group lifecycle");
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
/* Create file */
- h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Get size of file as empty */
- if((empty_size = h5_get_file_size(filename)) == 0) TEST_ERROR;
+ if((empty_size = h5_get_file_size(filename)) == 0) TEST_ERROR
/* Re-open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR;
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0) TEST_ERROR
/* Set up group creation property list */
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR;
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
/* Query default group creation property settings */
- if(H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0) TEST_ERROR;
- if(lheap_size_hint != H5G_CRT_GINFO_LHEAP_SIZE_HINT) TEST_ERROR;
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR;
- if(max_compact != H5G_CRT_GINFO_MAX_COMPACT) TEST_ERROR;
- if(min_dense != H5G_CRT_GINFO_MIN_DENSE) TEST_ERROR;
- if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR;
- if(est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES) TEST_ERROR;
- if(est_name_len != H5G_CRT_GINFO_EST_NAME_LEN) TEST_ERROR;
+ if(H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0) TEST_ERROR
+ if(lheap_size_hint != H5G_CRT_GINFO_LHEAP_SIZE_HINT) TEST_ERROR
+ if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if(max_compact != H5G_CRT_GINFO_MAX_COMPACT) TEST_ERROR
+ if(min_dense != H5G_CRT_GINFO_MIN_DENSE) TEST_ERROR
+ if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR
+ if(est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES) TEST_ERROR
+ if(est_name_len != H5G_CRT_GINFO_EST_NAME_LEN) TEST_ERROR
/* Set GCPL parameters */
- if(H5Pset_local_heap_size_hint(gcpl, LIFECYCLE_LOCAL_HEAP_SIZE_HINT) < 0) TEST_ERROR;
- if(H5Pset_link_phase_change(gcpl, LIFECYCLE_MAX_COMPACT, LIFECYCLE_MIN_DENSE) < 0) TEST_ERROR;
- if(H5Pset_est_link_info(gcpl, LIFECYCLE_EST_NUM_ENTRIES, LIFECYCLE_EST_NAME_LEN) < 0) TEST_ERROR;
+ if(H5Pset_local_heap_size_hint(gcpl, (size_t)LIFECYCLE_LOCAL_HEAP_SIZE_HINT) < 0) TEST_ERROR
+ if(H5Pset_link_phase_change(gcpl, LIFECYCLE_MAX_COMPACT, LIFECYCLE_MIN_DENSE) < 0) TEST_ERROR
+ if(H5Pset_est_link_info(gcpl, LIFECYCLE_EST_NUM_ENTRIES, LIFECYCLE_EST_NAME_LEN) < 0) TEST_ERROR
/* Create group for testing lifecycle */
if((gid = H5Gcreate_expand(fid, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR
if((H5Llink(fid, LIFECYCLE_TOP_GROUP, gid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Query group creation property settings */
- if(H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0) TEST_ERROR;
- if(lheap_size_hint != LIFECYCLE_LOCAL_HEAP_SIZE_HINT) TEST_ERROR;
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR;
- if(max_compact != LIFECYCLE_MAX_COMPACT) TEST_ERROR;
- if(min_dense != LIFECYCLE_MIN_DENSE) TEST_ERROR;
- if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR;
- if(est_num_entries != LIFECYCLE_EST_NUM_ENTRIES) TEST_ERROR;
- if(est_name_len != LIFECYCLE_EST_NAME_LEN) TEST_ERROR;
+ if(H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0) TEST_ERROR
+ if(lheap_size_hint != LIFECYCLE_LOCAL_HEAP_SIZE_HINT) TEST_ERROR
+ if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if(max_compact != LIFECYCLE_MAX_COMPACT) TEST_ERROR
+ if(min_dense != LIFECYCLE_MIN_DENSE) TEST_ERROR
+ if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR
+ if(est_num_entries != LIFECYCLE_EST_NUM_ENTRIES) TEST_ERROR
+ if(est_name_len != LIFECYCLE_EST_NAME_LEN) TEST_ERROR
/* Use internal testing routine to check that the group has no links or symbol table */
- if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR
/* Create first "bottom" group */
sprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0);
if((gid2 = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
/* Check on bottom group's status */
- if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR
/* Close bottom group */
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Check on top group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR;
- if(nmsgs != 1) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
+ if(nmsgs != 1) TEST_ERROR
/* Create several more bottom groups, to push the top group almost to a symbol table */
/* (Start counting at '1', since we've already created one bottom group */
@@ -367,55 +411,54 @@ lifecycle(hid_t fapl)
if((gid2 = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
/* Check on bottom group's status */
- if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR
/* Close bottom group */
if(H5Gclose(gid2) < 0) TEST_ERROR
} /* end for */
/* Check on top group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR;
- if(nmsgs != LIFECYCLE_MAX_COMPACT) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
+ if(nmsgs != LIFECYCLE_MAX_COMPACT) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != FALSE) TEST_ERROR
/* Check that the object header is only one chunk and the space has been allocated correctly */
- if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR;
+ if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR
#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_stat.ohdr.size != 232) TEST_ERROR;
+ if(obj_stat.ohdr.size != 240) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.size != 224) TEST_ERROR;
+ if(obj_stat.ohdr.size != 232) TEST_ERROR
#endif /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.free != 0) TEST_ERROR;
- if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR;
- if(obj_stat.ohdr.nchunks != 1) TEST_ERROR;
+ if(obj_stat.ohdr.free != 0) TEST_ERROR
+ if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR
+ if(obj_stat.ohdr.nchunks != 1) TEST_ERROR
/* Create one more "bottom" group, which should push top group into using a symbol table */
sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
if((gid2 = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
/* Check on bottom group's status */
- if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR
/* Close bottom group */
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Check on top group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR;
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR;
- if(H5G_lheap_size_test(gid, &lheap_size_hint) < 0) TEST_ERROR;
- if(lheap_size_hint != LIFECYCLE_LOCAL_HEAP_SIZE_HINT) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Check that the object header is still one chunk and the space has been allocated correctly */
- if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR;
+ if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR
#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_stat.ohdr.size != 232) TEST_ERROR;
+ if(obj_stat.ohdr.size != 240) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.size != 224) TEST_ERROR;
+ if(obj_stat.ohdr.size != 232) TEST_ERROR
#endif /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.free != 136) TEST_ERROR;
- if(obj_stat.ohdr.nmesgs != 4) TEST_ERROR;
- if(obj_stat.ohdr.nchunks != 1) TEST_ERROR;
+ if(obj_stat.ohdr.free != 128) TEST_ERROR
+ if(obj_stat.ohdr.nmesgs != 3) TEST_ERROR
+ if(obj_stat.ohdr.nchunks != 1) TEST_ERROR
/* Unlink objects from top group */
while(u >= LIFECYCLE_MIN_DENSE) {
@@ -427,9 +470,9 @@ lifecycle(hid_t fapl)
} /* end while */
/* Check on top group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR;
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Unlink one more object from the group, which should transform back to using links */
sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
@@ -437,9 +480,9 @@ lifecycle(hid_t fapl)
u--;
/* Check on top group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR;
- if(nmsgs != (LIFECYCLE_MIN_DENSE - 1)) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
+ if(nmsgs != (LIFECYCLE_MIN_DENSE - 1)) TEST_ERROR
/* Unlink last two objects from top group */
sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
@@ -449,25 +492,28 @@ lifecycle(hid_t fapl)
if(H5Gunlink(gid, objname) < 0) TEST_ERROR
/* Check on top group's status */
- if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR
/* Close top group */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Unlink top group */
if(H5Gunlink(fid, LIFECYCLE_TOP_GROUP) < 0) TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR;
+ if(H5Pclose(gcpl) < 0) TEST_ERROR
+
+ /* Close FAPL copy */
+ if(H5Pclose(fapl2) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Get size of file as empty */
- if((file_size = h5_get_file_size(filename)) == 0) TEST_ERROR;
+ if((file_size = h5_get_file_size(filename)) == 0) TEST_ERROR
/* Verify that file is correct size */
- if(file_size != empty_size) TEST_ERROR;
+ if(file_size != empty_size) TEST_ERROR
PASSED();
@@ -475,6 +521,7 @@ lifecycle(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl2);
H5Gclose(gcpl);
H5Gclose(gid2);
H5Gclose(gid);
@@ -505,6 +552,7 @@ long_compact(hid_t fapl)
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */
hid_t gid2 = (-1); /* Group ID */
+ hid_t fapl2 = (-1); /* File access property list ID */
char *objname; /* Object name */
char filename[NAME_BUF_SIZE];
off_t empty_size; /* Size of an empty file */
@@ -512,9 +560,15 @@ long_compact(hid_t fapl)
TESTING("long link names in compact groups");
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
/* Create file */
- h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) TEST_ERROR
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -523,17 +577,17 @@ long_compact(hid_t fapl)
if((empty_size = h5_get_file_size(filename)) == 0) TEST_ERROR
/* Construct very long object name template */
- if((objname = HDmalloc(LONG_COMPACT_LENGTH+1)) == NULL) TEST_ERROR
- HDmemset(objname, 'a', LONG_COMPACT_LENGTH);
+ if((objname = HDmalloc((size_t)(LONG_COMPACT_LENGTH + 1))) == NULL) TEST_ERROR
+ HDmemset(objname, 'a', (size_t)LONG_COMPACT_LENGTH);
objname[LONG_COMPACT_LENGTH] = '\0';
/* Re-open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0) TEST_ERROR
/* Create top group */
if((gid = H5Gcreate(fid, "top", (size_t)0)) < 0) TEST_ERROR
- /* Use internal testing routine to check that the group has no links or symbol table */
+ /* Use internal testing routine to check that the group has no links or dense storage */
if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR
/* Create first group with "long" name */
@@ -546,43 +600,43 @@ long_compact(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Check on top group's status */
- /* (Should have symbol table to hold links, since name is too long for object header message) */
+ /* (Should have dense storage to hold links, since name is too long for object header message) */
if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Create second group with "long" name */
objname[0] = 'b';
if((gid2 = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
/* Check on bottom group's status */
- if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR
/* Close bottom group */
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Check on top group's status */
- /* (Should have symbol table to hold links, since name is too long for object header message) */
+ /* (Should have dense storage to hold links, since name is too long for object header message) */
if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Unlink second object from top group */
if(H5Gunlink(gid, objname) < 0) TEST_ERROR
/* Check on top group's status */
- /* (Should still be symbol table to hold links, since name is too long for object header message) */
+ /* (Should still be dense storage to hold links, since name is too long for object header message) */
if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Unlink first object from top group */
objname[0] = 'a';
if(H5Gunlink(gid, objname) < 0) TEST_ERROR
/* Check on top group's status */
- /* (Should have deleted the symbol table now) */
- if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR;
+ /* (Should have deleted the dense storage now) */
+ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR
/* Free object name */
HDfree(objname);
@@ -593,20 +647,24 @@ long_compact(hid_t fapl)
/* Unlink top group */
if(H5Gunlink(fid, "top") < 0) TEST_ERROR
+ /* Close FAPL copy */
+ if(H5Pclose(fapl2) < 0) TEST_ERROR
+
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
/* Get size of file as empty */
- if((file_size = h5_get_file_size(filename)) == 0) TEST_ERROR;
+ if((file_size = h5_get_file_size(filename)) == 0) TEST_ERROR
/* Verify that file is correct size */
- if(file_size != empty_size) TEST_ERROR;
+ if(file_size != empty_size) TEST_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl2);
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(fid);
@@ -641,7 +699,7 @@ read_old(hid_t fapl)
char objname[NAME_BUF_SIZE]; /* Object name */
unsigned u; /* Local index variable */
char *srcdir = HDgetenv("srcdir"); /* where the src code is located */
- char filename[512]=""; /* old test file name */
+ char filename[512] = ""; /* old test file name */
char filename2[NAME_BUF_SIZE]; /* copy of old test file */
TESTING("reading old groups");
@@ -654,7 +712,7 @@ read_old(hid_t fapl)
HDstrcat(filename, FILE_OLD_GROUPS);
/* Create filename */
- h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2));
+ h5_fixname(FILENAME[0], fapl, filename2, sizeof(filename2));
/* Copy old file into temporary file */
if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) TEST_ERROR
@@ -676,7 +734,7 @@ read_old(hid_t fapl)
if((gid = H5Gopen(fid, "old")) < 0) TEST_ERROR
/* Check on old group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_is_empty_test(gid) == FALSE) TEST_ERROR
if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR
@@ -705,16 +763,16 @@ read_old(hid_t fapl)
} /* end for */
/* Check on old group's status */
- /* (Should stay in old "symbol table" form) */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ /* (Should stay in old "symbol table" form, but have no links) */
+ if(H5G_is_empty_test(gid) == FALSE) TEST_ERROR
if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR
/* Close old group */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Close first file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid)<0) TEST_ERROR
PASSED();
return 0;
@@ -750,93 +808,95 @@ no_compact(hid_t fapl)
hid_t gid = (-1); /* Group ID */
hid_t gid2 = (-1); /* Datatype ID */
hid_t gcpl = (-1); /* Group creation property list ID */
+ hid_t fapl2 = (-1); /* File access property list ID */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename[NAME_BUF_SIZE];
off_t empty_size; /* Size of an empty file */
off_t file_size; /* Size of each file created */
- size_t lheap_size_hint; /* Local heap size */
- size_t def_lheap_size; /* Default local heap size */
unsigned est_num_entries; /* Estimated # of entries in group */
unsigned est_name_len; /* Estimated length of entry name */
TESTING("group without compact form");
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
/* Create file */
- h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
+ h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Get size of file as empty */
- if((empty_size = h5_get_file_size(filename)) == 0) TEST_ERROR;
+ if((empty_size = h5_get_file_size(filename)) == 0) TEST_ERROR
/* Re-open file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR;
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0) TEST_ERROR
/* Set up group creation property list */
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR;
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
/* Set GCPL parameters */
- if(H5Pset_link_phase_change(gcpl, NO_COMPACT_MAX_COMPACT, NO_COMPACT_MIN_DENSE) < 0) TEST_ERROR;
+ if(H5Pset_link_phase_change(gcpl, NO_COMPACT_MAX_COMPACT, NO_COMPACT_MIN_DENSE) < 0) TEST_ERROR
- /* Check information for default local heap creation */
- if(H5Pget_local_heap_size_hint(gcpl, &lheap_size_hint) < 0) TEST_ERROR;
- if(lheap_size_hint != H5G_CRT_GINFO_LHEAP_SIZE_HINT) TEST_ERROR;
- if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR;
- if(est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES) TEST_ERROR;
- if(est_name_len != H5G_CRT_GINFO_EST_NAME_LEN) TEST_ERROR;
+ /* Check information for default group creation */
+ if(H5Pget_est_link_info(gcpl, &est_num_entries, &est_name_len) < 0) TEST_ERROR
+ if(est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES) TEST_ERROR
+ if(est_name_len != H5G_CRT_GINFO_EST_NAME_LEN) TEST_ERROR
- /* Create group for testing lifecycle */
+ /* Create group for testing no compact form */
if((gid = H5Gcreate_expand(fid, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR
if((H5Llink(fid, NO_COMPACT_TOP_GROUP, gid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR;
+ if(H5Pclose(gcpl) < 0) TEST_ERROR
- /* Use internal testing routine to check that the group has no links or symbol table */
- if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR;
+ /* Use internal testing routine to check that the group has no links or dense storage */
+ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR
/* Create first "bottom" group */
sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0);
if((gid2 = H5Gcreate(gid, objname, (size_t)0)) < 0) TEST_ERROR
/* Check on bottom group's status */
- if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR
/* Close bottom group */
if(H5Gclose(gid2) < 0) TEST_ERROR
/* Check on top group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR;
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR;
- if(H5G_lheap_size_test(gid, &lheap_size_hint) < 0) TEST_ERROR;
- def_lheap_size = est_num_entries * (est_name_len + 1);
- def_lheap_size = H5HL_ALIGN(def_lheap_size);
- if(lheap_size_hint != def_lheap_size) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Unlink object from top group */
sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0);
if(H5Gunlink(gid, objname) < 0) TEST_ERROR
/* Check on top group's status */
- if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR
/* Close top group */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Unlink top group */
if(H5Gunlink(fid, NO_COMPACT_TOP_GROUP) < 0) TEST_ERROR
+ /* Close FAPL copy */
+ if(H5Pclose(fapl2) < 0) TEST_ERROR
+
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
/* Get size of file as empty */
- if((file_size = h5_get_file_size(filename)) == 0) TEST_ERROR;
+ if((file_size = h5_get_file_size(filename)) == 0) TEST_ERROR
/* Verify that file is correct size */
- if(file_size != empty_size) TEST_ERROR;
+ if(file_size != empty_size) TEST_ERROR
PASSED();
@@ -844,6 +904,7 @@ no_compact(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl2);
H5Gclose(gcpl);
H5Gclose(gid2);
H5Gclose(gid);
@@ -874,6 +935,7 @@ gcpl_on_root(hid_t fapl)
hid_t gid = (-1); /* Group ID */
hid_t gid2 = (-1); /* Datatype ID */
hid_t fcpl = (-1); /* File creation property list ID */
+ hid_t fapl2 = (-1); /* File access property list ID */
hid_t gcpl = (-1); /* Group creation property list ID */
hid_t lcpl = (-1); /* Link creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
@@ -882,40 +944,46 @@ gcpl_on_root(hid_t fapl)
TESTING("setting root group creation properties");
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
/* Create file */
- h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
+ h5_fixname(FILENAME[0], fapl2, filename, sizeof(filename));
/* Set up file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
/* Set GCPL parameters */
- if(H5Pset_link_phase_change(fcpl, GCPL_ON_ROOT_MAX_COMPACT, GCPL_ON_ROOT_MIN_DENSE) < 0) TEST_ERROR;
+ if(H5Pset_link_phase_change(fcpl, GCPL_ON_ROOT_MAX_COMPACT, GCPL_ON_ROOT_MIN_DENSE) < 0) TEST_ERROR
/* Query the group creation properties from the FCPL */
- if(H5Pget_link_phase_change(fcpl, &max_compact, &min_dense) < 0) TEST_ERROR;
- if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR;
- if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR;
+ if(H5Pget_link_phase_change(fcpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR
+ if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR
/* Create file with modified root group creation properties */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR;
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) TEST_ERROR
/* Close FCPL */
- if(H5Pclose(fcpl) < 0) TEST_ERROR;
+ if(H5Pclose(fcpl) < 0) TEST_ERROR
/* Open the root group */
- if((gid = H5Gopen(fid, "/")) < 0) TEST_ERROR;
+ if((gid = H5Gopen(fid, "/")) < 0) TEST_ERROR
/* Query the group creation properties */
- if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR;
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR;
- if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR;
- if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR;
+ if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR
+ if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR
+ if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR;
+ if(H5Pclose(gcpl) < 0) TEST_ERROR
/* Create a link creation property list, with intermediate group creation set */
- if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR;
+ if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
if(H5Pset_create_intermediate_group(lcpl, TRUE) < 0) TEST_ERROR
/* Create a group and intermediate groups, to check if root group settings are inherited */
@@ -923,40 +991,43 @@ gcpl_on_root(hid_t fapl)
if((H5Llink(fid, GCPL_ON_ROOT_BOTTOM_GROUP, gid2, lcpl, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close LCPL */
- if(H5Pclose(lcpl) < 0) TEST_ERROR;
+ if(H5Pclose(lcpl) < 0) TEST_ERROR
/* Query the group creation properties */
- if((gcpl = H5Gget_create_plist(gid2)) < 0) TEST_ERROR;
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR;
- if(max_compact != H5G_CRT_GINFO_MAX_COMPACT) TEST_ERROR;
- if(min_dense != H5G_CRT_GINFO_MIN_DENSE) TEST_ERROR;
+ if((gcpl = H5Gget_create_plist(gid2)) < 0) TEST_ERROR
+ if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if(max_compact != H5G_CRT_GINFO_MAX_COMPACT) TEST_ERROR
+ if(min_dense != H5G_CRT_GINFO_MIN_DENSE) TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR;
+ if(H5Pclose(gcpl) < 0) TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR;
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* Open the middle group */
- if((gid2 = H5Gopen(fid, GCPL_ON_ROOT_MIDDLE_GROUP)) < 0) TEST_ERROR;
+ if((gid2 = H5Gopen(fid, GCPL_ON_ROOT_MIDDLE_GROUP)) < 0) TEST_ERROR
/* Query the group creation properties */
- if((gcpl = H5Gget_create_plist(gid2)) < 0) TEST_ERROR;
- if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR;
- if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR;
- if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR;
+ if((gcpl = H5Gget_create_plist(gid2)) < 0) TEST_ERROR
+ if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if(max_compact != GCPL_ON_ROOT_MAX_COMPACT) TEST_ERROR
+ if(min_dense != GCPL_ON_ROOT_MIN_DENSE) TEST_ERROR
/* Close GCPL */
- if(H5Pclose(gcpl) < 0) TEST_ERROR;
+ if(H5Pclose(gcpl) < 0) TEST_ERROR
/* Close bottom group */
- if(H5Gclose(gid2) < 0) TEST_ERROR;
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* Close root group */
- if(H5Gclose(gid) < 0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Close FAPL copy */
+ if(H5Pclose(fapl2) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
@@ -968,12 +1039,12 @@ error:
H5Gclose(gcpl);
H5Gclose(gid2);
H5Gclose(gid);
+ H5Pclose(fapl2);
H5Gclose(fcpl);
H5Fclose(fid);
} H5E_END_TRY;
return 1;
} /* end gcpl_on_root() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -995,60 +1066,58 @@ error:
int
main(void)
{
- hid_t fapl, fcpl, file;
- int nerrors=0;
- char filename[1024];
const char *envval = NULL;
/* Don't run this test using the split file driver */
envval = HDgetenv("HDF5_DRIVER");
- if (envval == NULL)
+ if(envval == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, "split")) {
+ if(HDstrcmp(envval, "split")) {
+ hid_t fapl, fapl2; /* File access property list IDs */
+ int nerrors = 0;
+
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
- /*
- * Use larger symbol table data structures to be more efficient, use
- * defaults to bang harder on the library for testing.
- */
- fcpl = H5Pcreate(H5P_FILE_CREATE);
-#if 0
- H5Pset_sym_k(fcpl, 16, 16);
-#endif
-
- /* Open the file */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl))<0)
- goto error;
-
- /* Perform tests */
- nerrors += test_misc(file);
- nerrors += test_long(file);
- nerrors += test_large(file);
-#ifdef H5_GROUP_REVISION
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
+ /* Perform basic tests, with old & new style groups */
+ nerrors += test_misc(fapl, FALSE); /* with old-style group */
+ nerrors += test_misc(fapl2, TRUE); /* with new-style group */
+ nerrors += test_long(fapl, FALSE); /* with old-style group */
+ nerrors += test_long(fapl2, TRUE); /* with new-style group */
+ nerrors += test_large(fapl, FALSE); /* with old-style group */
+ nerrors += test_large(fapl2, TRUE); /* with new-style group */
+
+ /* New format group specific tests (require new format features) */
nerrors += lifecycle(fapl);
nerrors += long_compact(fapl);
nerrors += read_old(fapl);
nerrors += no_compact(fapl);
nerrors += gcpl_on_root(fapl);
-#endif /* H5_GROUP_REVISION */
- if (nerrors) goto error;
+
+ /* Close 2nd FAPL */
+ H5Pclose(fapl2);
+
+ /* Check for test errors */
+ if(nerrors)
+ goto error;
/* Cleanup */
- H5Fclose(file);
puts("All symbol table tests passed.");
h5_cleanup(FILENAME, fapl);
- }
+ } /* end if */
else
- {
puts("All symbol table tests skipped - Incompatible with current Virtual File Driver");
- }
return 0;
- error:
- puts("*** TESTS FAILED ***");
- return 1;
+error:
+ puts("*** TESTS FAILED ***");
+ return 1;
}
diff --git a/test/tattr.c b/test/tattr.c
index 5bb9947..b6514b7 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -459,7 +459,6 @@ test_attr_flush(void)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_flush() */
-#ifdef H5_GROUP_REVISION
/****************************************************************
**
** test_attr_plist(): Test Attribute Creation Property Lists
@@ -571,7 +570,6 @@ test_attr_plist(void)
ret=H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_plist() */
-#endif /* H5_GROUP_REVISION */
/****************************************************************
**
@@ -1686,9 +1684,7 @@ test_attr(void)
test_attr_flush(); /* Test H5A I/O in the presence of H5Fflush calls */
/* This next test uses the same file information */
-#ifdef H5_GROUP_REVISION
test_attr_plist(); /* Test attribute property lists */
-#endif /* H5_GROUP_REVISION */
/* These next two tests use the same file information */
test_attr_compound_write(); /* Test complex datatype H5A writing code */
diff --git a/test/tfile.c b/test/tfile.c
index 4c6e845..ebc666d 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1221,12 +1221,12 @@ test_file_freespace(void)
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set the space allocation time to early */
- ret = H5Pset_alloc_time(dcpl,H5D_ALLOC_TIME_EARLY);
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
CHECK(ret, FAIL, "H5Pset_alloc_time");
/* Create datasets in file */
- for(u=0; u<10; u++) {
- sprintf(name,"Dataset %u",u);
+ for(u = 0; u < 10; u++) {
+ sprintf(name, "Dataset %u", u);
dset = H5Dcreate(file, name, H5T_STD_U32LE, dspace, dcpl);
CHECK(dset, FAIL, "H5Dcreate");
@@ -1239,22 +1239,21 @@ test_file_freespace(void)
CHECK(ret, FAIL, "H5Sclose");
/* Close dataset creation property list */
- ret=H5Pclose(dcpl);
+ ret = H5Pclose(dcpl);
CHECK(ret, FAIL, "H5Pclose");
-#ifdef H5_GROUP_REVISION
/* Check that there is the right amount of free space in the file */
free_space = H5Fget_freespace(file);
CHECK(free_space, FAIL, "H5Fget_freespace");
#ifdef H5_HAVE_LARGE_HSIZET
- VERIFY(free_space, 420, "H5Fget_freespace");
+ VERIFY(free_space, 2368, "H5Fget_freespace");
#else /* H5_HAVE_LARGE_HSIZET */
- VERIFY(free_space, 588, "H5Fget_freespace");
+ VERIFY(free_space, 588, "H5Fget_freespace"); /* XXX: fix me */
#endif /* H5_HAVE_LARGE_HSIZET */
/* Delete datasets in file */
- for(u=0; u<10; u++) {
- sprintf(name,"Dataset %u",u);
+ for(u = 0; u < 10; u++) {
+ sprintf(name, "Dataset %u", u);
ret = H5Gunlink(file, name);
CHECK(ret, FAIL, "H5Gunlink");
} /* end for */
@@ -1263,16 +1262,14 @@ test_file_freespace(void)
free_space = H5Fget_freespace(file);
CHECK(free_space, FAIL, "H5Fget_freespace");
#ifdef H5_HAVE_LARGE_HSIZET
- VERIFY(free_space, 4628, "H5Fget_freespace");
+ VERIFY(free_space, 5512, "H5Fget_freespace");
#else /* H5_HAVE_LARGE_HSIZET */
- VERIFY(free_space, 4592, "H5Fget_freespace");
+ VERIFY(free_space, 4592, "H5Fget_freespace"); /* XXX: fix me */
#endif /* H5_HAVE_LARGE_HSIZET */
-#endif /* H5_GROUP_REVISION */
/* Close file */
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
-
} /* end test_file_freespace() */
/****************************************************************
diff --git a/test/titerate.c b/test/titerate.c
index 4850db0..3241901 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -46,7 +46,8 @@
typedef enum {
RET_ZERO,
RET_TWO,
- RET_CHANGE
+ RET_CHANGE,
+ RET_CHANGE2
} iter_enum;
/* Custom group iteration callback data */
@@ -70,7 +71,7 @@ herr_t aiter_cb(hid_t loc_id, const char *name, void *op_data);
****************************************************************/
int iter_strcmp(const void *s1, const void *s2)
{
- return(strcmp(*(const char * const *)s1,*(const char * const *)s2));
+ return(HDstrcmp(*(const char * const *)s1,*(const char * const *)s2));
}
/****************************************************************
@@ -80,10 +81,11 @@ int iter_strcmp(const void *s1, const void *s2)
****************************************************************/
herr_t giter_cb(hid_t UNUSED group, const char *name, void *op_data)
{
- iter_info *info=(iter_info *)op_data;
- static int count=0;
+ iter_info *info = (iter_info *)op_data;
+ static int count = 0;
+ static int count2 = 0;
- strcpy(info->name,name);
+ HDstrcpy(info->name, name);
switch(info->command) {
case RET_ZERO:
@@ -94,20 +96,24 @@ herr_t giter_cb(hid_t UNUSED group, const char *name, void *op_data)
case RET_CHANGE:
count++;
- return(count>10 ? 1: 0);
+ return(count > 10 ? 1 : 0);
+
+ case RET_CHANGE2:
+ count2++;
+ return(count2 > 10 ? 1 : 0);
default:
printf("invalid iteration command");
return(-1);
} /* end switch */
-}
+} /* end giter_cb() */
/****************************************************************
**
** test_iter_group(): Test group iteration functionality
**
****************************************************************/
-static void test_iter_group(void)
+static void test_iter_group(hid_t fapl, hbool_t new_format)
{
hid_t file; /* File ID */
hid_t dataset; /* Dataset ID */
@@ -117,7 +123,7 @@ static void test_iter_group(void)
int i; /* counting variable */
int idx; /* Index in the group */
char name[NAMELEN]; /* temporary name buffer */
- char *dnames[NDATASETS];/* Names of the datasets created */
+ char *lnames[NDATASETS + 2];/* Names of the links created */
char dataset_name[NAMELEN]; /* dataset name */
iter_info info; /* Custom iteration information */
hsize_t num_membs; /* Number of group members */
@@ -127,7 +133,7 @@ static void test_iter_group(void)
MESSAGE(5, ("Testing Group Iteration Functionality\n"));
/* Create the test file with the datasets */
- file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
/* Test iterating over empty group */
@@ -148,12 +154,12 @@ static void test_iter_group(void)
CHECK(dataset, FAIL, "H5Dcreate");
/* Keep a copy of the dataset names around for later */
- dnames[i]=HDstrdup(name);
- CHECK(dnames[i], NULL, "strdup");
+ lnames[i] = HDstrdup(name);
+ CHECK(lnames[i], NULL, "strdup");
- ret=H5Dclose(dataset);
+ ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
- }
+ } /* end for */
/* Create a group and named datatype under root group for testing
* H5Gget_objtype_by_idx.
@@ -161,9 +167,15 @@ static void test_iter_group(void)
grp = H5Gcreate(file, "grp", 0);
CHECK(ret, FAIL, "H5Gcreate");
+ lnames[NDATASETS] = HDstrdup("grp");
+ CHECK(lnames[NDATASETS], NULL, "strdup");
+
ret = H5Tcommit(file, "dtype", datatype);
CHECK(ret, FAIL, "H5Tcommit");
+ lnames[NDATASETS + 1] = HDstrdup("dtype");
+ CHECK(lnames[NDATASETS], NULL, "strdup");
+
/* Close everything up */
ret=H5Tclose(datatype);
CHECK(ret, FAIL, "H5Tclose");
@@ -178,11 +190,11 @@ static void test_iter_group(void)
CHECK(ret, FAIL, "H5Fclose");
/* Sort the dataset names */
- HDqsort(dnames,NDATASETS,sizeof(char *),iter_strcmp);
+ HDqsort(lnames, NDATASETS + 2, sizeof(char *), iter_strcmp);
/* Iterate through the datasets in the root group in various ways */
- file=H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
CHECK(file, FAIL, "H5Fopen");
/* These two functions, H5Gget_num_objs and H5Gget_objname_by_idx, actually
@@ -194,9 +206,9 @@ static void test_iter_group(void)
ret = H5Gget_num_objs(root_group, &num_membs);
CHECK(ret, FAIL, "H5Gget_num_objs");
- VERIFY(num_membs,NDATASETS+2,"H5Gget_num_objs");
+ VERIFY(num_membs, (NDATASETS + 2), "H5Gget_num_objs");
- for(i=0; i< (int)num_membs; i++) {
+ for(i = 0; i< (int)num_membs; i++) {
H5G_obj_t obj_type; /* Type of object in file */
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, NAMELEN);
@@ -204,7 +216,7 @@ static void test_iter_group(void)
obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i);
CHECK(obj_type, H5G_UNKNOWN, "H5Gget_objtype_by_idx");
- }
+ } /* end for */
H5E_BEGIN_TRY {
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, NAMELEN);
@@ -222,9 +234,9 @@ static void test_iter_group(void)
{
ret = H5Gget_num_objs(file, &num_membs);
CHECK(ret, FAIL, "H5Gget_num_objs");
- VERIFY(num_membs,NDATASETS+2,"H5Gget_num_objs");
+ VERIFY(num_membs, NDATASETS + 2, "H5Gget_num_objs");
- for(i=0; i< (int)num_membs; i++) {
+ for(i = 0; i< (int)num_membs; i++) {
H5G_obj_t obj_type; /* Type of object in file */
ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)i, dataset_name, NAMELEN);
@@ -235,116 +247,95 @@ static void test_iter_group(void)
}
H5E_BEGIN_TRY {
- ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)(NDATASETS+3), dataset_name, NAMELEN);
+ ret = (herr_t)H5Gget_objname_by_idx(file, (hsize_t)(NDATASETS + 3), dataset_name, NAMELEN);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Gget_objname_by_idx");
}
/* Test invalid indices for starting iteration */
- info.command=RET_ZERO;
- idx=-1;
+ info.command = RET_ZERO;
+ idx = -1;
H5E_BEGIN_TRY {
- ret=H5Giterate(file,"/",&idx,giter_cb,&info);
+ ret = H5Giterate(file, "/", &idx, giter_cb, &info);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Giterate");
/* Test skipping exactly as many entries as in the group */
- idx=NDATASETS+2;
+ idx = NDATASETS + 2;
H5E_BEGIN_TRY {
- ret=H5Giterate(file,"/",&idx,giter_cb,&info);
+ ret = H5Giterate(file, "/", &idx, giter_cb, &info);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Giterate");
/* Test skipping more entries than are in the group */
- idx=NDATASETS+3;
+ idx = NDATASETS + 3;
H5E_BEGIN_TRY {
- ret=H5Giterate(file,"/",&idx,giter_cb,&info);
+ ret = H5Giterate(file, "/", &idx, giter_cb, &info);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Giterate");
/* Test all objects in group, when callback always returns 0 */
- info.command=RET_ZERO;
- idx=0;
- if((ret=H5Giterate(file,"/",&idx,giter_cb,&info))>0)
+ info.command = RET_ZERO;
+ idx = 0;
+ if((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) > 0)
TestErrPrintf("Group iteration function didn't return zero correctly!\n");
/* Test all objects in group, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
- info.command=RET_TWO;
- idx=i=0;
- while((ret=H5Giterate(file,"/",&idx,giter_cb,&info))>0) {
+ info.command = RET_TWO;
+ idx = i = 0;
+ while((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
- VERIFY(ret,2,"H5Giterate");
+ VERIFY(ret, 2, "H5Giterate");
- /* Increment the number of times "1" is returned */
+ /* Increment the number of times "2" is returned */
i++;
/* Verify that the index is the correct value */
- VERIFY(idx,i,"H5Giterate");
+ VERIFY(idx, i, "H5Giterate");
+ if(idx > (NDATASETS + 2))
+ TestErrPrintf("Group iteration function walked too far!\n");
/* Verify that the correct name is retrieved */
- if(idx<=NDATASETS) {
- if(HDstrcmp(info.name,dnames[idx-1])!=0)
- TestErrPrintf("Group iteration function didn't return one correctly for dataset #%d!\n",idx);
- } /* end if */
- else if(idx==(NDATASETS+1)) {
- if(HDstrcmp(info.name,"dtype")!=0)
- TestErrPrintf("Group iteration function didn't return one correctly for group!\n");
- } /* end if */
- else if(idx==(NDATASETS+2)) {
- if(HDstrcmp(info.name,"grp")!=0)
- TestErrPrintf("Group iteration function didn't return one correctly for group!\n");
- } /* end if */
- else
- TestErrPrintf("Group iteration function walked too far!\n");
- }
- VERIFY(ret,-1,"H5Giterate");
+ if(HDstrcmp(info.name, lnames[idx - 1]) != 0)
+ TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (idx - 1), lnames[idx - 1]);
+ } /* end while */
+ VERIFY(ret, -1, "H5Giterate");
- if(i!=(NDATASETS+2))
+ if(i != (NDATASETS + 2))
TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n");
/* Test all objects in group, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
- info.command=RET_CHANGE;
- idx=i=0;
- while((ret=H5Giterate(file,"/",&idx,giter_cb,&info))>=0) {
+ info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
+ idx = i = 0;
+ while((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) >= 0) {
/* Verify return value from iterator gets propagated correctly */
- VERIFY(ret,1,"H5Giterate");
+ VERIFY(ret, 1, "H5Giterate");
/* Increment the number of times "1" is returned */
i++;
/* Verify that the index is the correct value */
- VERIFY(idx,i+10,"H5Giterate");
+ VERIFY(idx, (i + 10), "H5Giterate");
+ if(idx > (NDATASETS + 2))
+ TestErrPrintf("Group iteration function walked too far!\n");
/* Verify that the correct name is retrieved */
- if(idx<=NDATASETS) {
- if(HDstrcmp(info.name,dnames[idx-1])!=0)
- TestErrPrintf("Group iteration function didn't return one correctly for dataset #%d!\n",idx);
- } /* end if */
- else if(idx==(NDATASETS+1)) {
- if(HDstrcmp(info.name,"dtype")!=0)
- TestErrPrintf("Group iteration function didn't return one correctly for group!\n");
- } /* end if */
- else if(idx==(NDATASETS+2)) {
- if(HDstrcmp(info.name,"grp")!=0)
- TestErrPrintf("Group iteration function didn't return one correctly for group!\n");
- } /* end if */
- else
- TestErrPrintf("Group iteration function walked too far!\n");
- }
- VERIFY(ret,-1,"H5Giterate");
+ if(HDstrcmp(info.name, lnames[idx - 1]) != 0)
+ TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (idx - 1), lnames[idx - 1]);
+ } /* end while */
+ VERIFY(ret, -1, "H5Giterate");
- if(i!=42 || idx!=52)
+ if(i != 42 || idx != 52)
TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n");
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Free the dataset names */
- for(i=0; i< NDATASETS; i++)
- HDfree(dnames[i]);
-
+ for(i = 0; i< (NDATASETS + 2); i++)
+ HDfree(lnames[i]);
} /* test_iter_group() */
/****************************************************************
@@ -352,12 +343,14 @@ static void test_iter_group(void)
** aiter_cb(): Custom group iteration callback routine.
**
****************************************************************/
-herr_t aiter_cb(hid_t UNUSED group, const char *name, void *op_data)
+herr_t
+aiter_cb(hid_t UNUSED group, const char *name, void *op_data)
{
- iter_info *info=(iter_info *)op_data;
- static int count=0;
+ iter_info *info = (iter_info *)op_data;
+ static int count = 0;
+ static int count2 = 0;
- strcpy(info->name,name);
+ HDstrcpy(info->name, name);
switch(info->command) {
case RET_ZERO:
@@ -368,20 +361,24 @@ herr_t aiter_cb(hid_t UNUSED group, const char *name, void *op_data)
case RET_CHANGE:
count++;
- return(count>10 ? 1: 0);
+ return(count > 10 ? 1: 0);
+
+ case RET_CHANGE2:
+ count2++;
+ return(count2 > 10 ? 1: 0);
default:
printf("invalid iteration command");
return(-1);
} /* end switch */
-}
+} /* end aiter_cb() */
/****************************************************************
**
** test_iter_attr(): Test attribute iteration functionality
**
****************************************************************/
-static void test_iter_attr(void)
+static void test_iter_attr(hid_t fapl, hbool_t new_format)
{
hid_t file; /* File ID */
hid_t dataset; /* Common Dataset ID */
@@ -398,7 +395,7 @@ static void test_iter_attr(void)
MESSAGE(5, ("Testing Attribute Iteration Functionality\n"));
/* Create the test file with the datasets */
- file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
filespace=H5Screate(H5S_SCALAR);
@@ -432,7 +429,7 @@ static void test_iter_attr(void)
/* Iterate through the attributes on the dataset in various ways */
- file=H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file=H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
CHECK(file, FAIL, "H5Fopen");
dataset=H5Dopen(file, "Dataset");
@@ -486,7 +483,7 @@ static void test_iter_attr(void)
/* Test all attributes on dataset, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
- info.command=RET_CHANGE;
+ info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
idx=i=0;
while((ret=H5Aiterate(dataset,&idx,aiter_cb,&info))>0) {
/* Verify return value from iterator gets propagated correctly */
@@ -525,8 +522,8 @@ static void test_iter_attr(void)
****************************************************************/
int iter_strcmp2(const void *s1, const void *s2)
{
- return(strcmp((const char *)s1,(const char *)s2));
-}
+ return(HDstrcmp((const char *)s1,(const char *)s2));
+} /* end iter_strcmp2() */
/****************************************************************
**
@@ -535,23 +532,23 @@ int iter_strcmp2(const void *s1, const void *s2)
****************************************************************/
herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata)
{
- const iter_info *test_info=(const iter_info *)opdata;
- herr_t ret; /* Generic return value */
+ const iter_info *test_info = (const iter_info *)opdata;
H5G_stat_t statbuf;
+ herr_t ret; /* Generic return value */
- if(HDstrcmp(name,test_info->name)) {
- TestErrPrintf("name=%s, test_info=%s\n",name,test_info->name);
+ if(HDstrcmp(name, test_info->name)) {
+ TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name);
return(-1);
} /* end if */
/*
* Get type of the object and check it.
*/
- ret=H5Gget_objinfo(loc_id, name, FALSE, &statbuf);
+ ret = H5Gget_objinfo(loc_id, name, FALSE, &statbuf);
CHECK(ret, FAIL, "H5Gget_objinfo");
- if(test_info->type!=statbuf.type) {
- TestErrPrintf("test_info->type=%d, statbuf.type=%d\n",test_info->type,statbuf.type);
+ if(test_info->type != statbuf.type) {
+ TestErrPrintf("test_info->type = %d, statbuf.type = %d\n", test_info->type, statbuf.type);
return(-1);
} /* end if */
@@ -564,7 +561,7 @@ herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata)
** for groups with large #'s of objects
**
****************************************************************/
-static void test_iter_group_large(void)
+static void test_iter_group_large(hid_t fapl)
{
hid_t file; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -585,13 +582,13 @@ static void test_iter_group_large(void)
float c;
} s1_t;
- memset(names, 0, sizeof names);
+ HDmemset(names, 0, sizeof names);
/* Output message about test being performed */
MESSAGE(5, ("Testing Large Group Iteration Functionality\n"));
/* Create file */
- file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
/* Create dataspace for datasets */
@@ -599,29 +596,29 @@ static void test_iter_group_large(void)
CHECK(sid, FAIL, "H5Screate_simple");
/* Create a bunch of groups */
- for (i=0; i<ITER_NGROUPS; i++) {
+ for(i = 0; i < ITER_NGROUPS; i++) {
sprintf(gname, "Group_%d", i);
/* Add the name to the list of objects in the root group */
- strcpy(names[i].name,gname);
- names[i].type=H5G_GROUP;
+ HDstrcpy(names[i].name, gname);
+ names[i].type = H5G_GROUP;
/* Create a group */
- group=H5Gcreate(file,gname,0);
+ group = H5Gcreate(file, gname, 0);
CHECK(group, FAIL, "H5Gcreate");
/* Close a group */
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
- }
+ } /* end for */
/* Create a dataset */
- dataset=H5Dcreate(file,"Dataset1",H5T_STD_U32LE,sid,H5P_DEFAULT);
+ dataset = H5Dcreate(file, "Dataset1", H5T_STD_U32LE, sid, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Add the name to the list of objects in the root group */
- strcpy(names[ITER_NGROUPS].name,"Dataset1");
- names[ITER_NGROUPS].type=H5G_DATASET;
+ HDstrcpy(names[ITER_NGROUPS].name, "Dataset1");
+ names[ITER_NGROUPS].type = H5G_DATASET;
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -632,40 +629,42 @@ static void test_iter_group_large(void)
CHECK(ret, FAIL, "H5Sclose");
/* Create a datatype */
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
CHECK(tid, FAIL, "H5Tcreate");
/* Insert fields */
- ret=H5Tinsert (tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert (tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert (tid, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Save datatype for later */
- ret=H5Tcommit (file, "Datatype1", tid);
+ ret = H5Tcommit(file, "Datatype1", tid);
CHECK(ret, FAIL, "H5Tcommit");
/* Add the name to the list of objects in the root group */
- strcpy(names[ITER_NGROUPS+1].name,"Datatype1");
- names[ITER_NGROUPS+1].type=H5G_TYPE;
+ HDstrcpy(names[ITER_NGROUPS + 1].name, "Datatype1");
+ names[ITER_NGROUPS + 1].type = H5G_TYPE;
/* Close datatype */
ret = H5Tclose(tid);
CHECK(ret, FAIL, "H5Tclose");
/* Need to sort the names in the root group, cause that's what the library does */
- qsort(names,ITER_NGROUPS+2,sizeof(iter_info),iter_strcmp2);
+ HDqsort(names, (ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2);
/* Iterate through the file to see members of the root group */
- curr_name=&names[0];
- H5Giterate(file, "/", NULL, giter_cb2, curr_name);
- for (i=1; i<100; ) {
- curr_name=&names[i];
- H5Giterate(file, "/", &i, giter_cb2, curr_name);
+ curr_name = &names[0];
+ ret = H5Giterate(file, "/", NULL, giter_cb2, curr_name);
+ CHECK(ret, FAIL, "H5Giterate");
+ for(i = 1; i < 100; ) {
+ curr_name = &names[i];
+ ret = H5Giterate(file, "/", &i, giter_cb2, curr_name);
+ CHECK(ret, FAIL, "H5Giterate");
} /* end for */
/* Close file */
@@ -679,7 +678,7 @@ static void test_iter_group_large(void)
** functionality
**
****************************************************************/
-static void test_grp_memb_funcs(void)
+static void test_grp_memb_funcs(hid_t fapl)
{
hid_t file; /* File ID */
hid_t dataset; /* Dataset ID */
@@ -699,7 +698,7 @@ static void test_grp_memb_funcs(void)
MESSAGE(5, ("Testing Group Member Information Functionality\n"));
/* Create the test file with the datasets */
- file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
datatype = H5Tcopy(H5T_NATIVE_INT);
@@ -708,18 +707,18 @@ static void test_grp_memb_funcs(void)
filespace=H5Screate(H5S_SCALAR);
CHECK(filespace, FAIL, "H5Screate");
- for(i=0; i< NDATASETS; i++) {
+ for(i = 0; i< NDATASETS; i++) {
sprintf(name,"Dataset %d",i);
dataset = H5Dcreate(file, name, datatype, filespace, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Keep a copy of the dataset names around for later */
- dnames[i]=HDstrdup(name);
+ dnames[i] = HDstrdup(name);
CHECK(dnames[i], NULL, "strdup");
- ret=H5Dclose(dataset);
+ ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
- }
+ } /* end for */
/* Create a group and named datatype under root group for testing
* H5Gget_objtype_by_idx.
@@ -727,33 +726,33 @@ static void test_grp_memb_funcs(void)
grp = H5Gcreate(file, "grp", 0);
CHECK(ret, FAIL, "H5Gcreate");
- dnames[NDATASETS]=HDstrdup("grp");
+ dnames[NDATASETS] = HDstrdup("grp");
CHECK(dnames[NDATASETS], NULL, "strdup");
ret = H5Tcommit(file, "dtype", datatype);
CHECK(ret, FAIL, "H5Tcommit");
- dnames[NDATASETS+1]=HDstrdup("dtype");
+ dnames[NDATASETS + 1] = HDstrdup("dtype");
CHECK(dnames[NDATASETS], NULL, "strdup");
/* Close everything up */
- ret=H5Tclose(datatype);
+ ret = H5Tclose(datatype);
CHECK(ret, FAIL, "H5Tclose");
- ret=H5Gclose(grp);
+ ret = H5Gclose(grp);
CHECK(ret, FAIL, "H5Gclose");
- ret=H5Sclose(filespace);
+ ret = H5Sclose(filespace);
CHECK(ret, FAIL, "H5Sclose");
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Sort the dataset names */
- HDqsort(dnames,NDATASETS+2,sizeof(char *),iter_strcmp);
+ HDqsort(dnames, (NDATASETS + 2), sizeof(char *), iter_strcmp);
/* Iterate through the datasets in the root group in various ways */
- file=H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl);
CHECK(file, FAIL, "H5Fopen");
/* These two functions, H5Gget_num_objs and H5Gget_objname_by_idx, actually
@@ -773,14 +772,14 @@ static void test_grp_memb_funcs(void)
name_len = H5Gget_objname_by_idx(root_group, (hsize_t)i, NULL, NAMELEN);
CHECK(name_len, FAIL, "H5Gget_objname_by_idx");
- ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)(name_len+1));
+ ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)i, dataset_name, (size_t)(name_len + 1));
CHECK(ret, FAIL, "H5Gget_objname_by_idx");
/* Double-check that the length is the same */
VERIFY(ret, name_len, "H5Gget_objname_by_idx");
/* Keep a copy of the dataset names around for later */
- obj_names[i]=HDstrdup(dataset_name);
+ obj_names[i] = HDstrdup(dataset_name);
CHECK(obj_names[i], NULL, "strdup");
obj_type = H5Gget_objtype_by_idx(root_group, (hsize_t)i);
@@ -792,7 +791,7 @@ static void test_grp_memb_funcs(void)
VERIFY(obj_type, H5G_TYPE, "H5Gget_objname_by_idx");
if(!HDstrncmp(dataset_name, "Dataset", 7))
VERIFY(obj_type, H5G_DATASET, "H5Gget_objname_by_idx");
- }
+ } /* end for */
H5E_BEGIN_TRY {
ret = (herr_t)H5Gget_objname_by_idx(root_group, (hsize_t)(NDATASETS+3), dataset_name, NAMELEN);
@@ -800,27 +799,26 @@ static void test_grp_memb_funcs(void)
VERIFY(ret, FAIL, "H5Gget_objname_by_idx");
/* Sort the dataset names */
- qsort(obj_names,NDATASETS+2,sizeof(char *),iter_strcmp);
+ HDqsort(obj_names, (NDATASETS + 2), sizeof(char *), iter_strcmp);
/* Compare object names */
- for(i=0; i< (int)num_membs; i++) {
+ for(i = 0; i< (int)num_membs; i++) {
ret = HDstrcmp(dnames[i], obj_names[i]);
VERIFY(ret, 0, "HDstrcmp");
- }
+ } /* end for */
ret = H5Gclose(root_group);
CHECK(ret, FAIL, "H5Gclose");
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
/* Free the dataset names */
- for(i=0; i< NDATASETS+2; i++) {
- free(dnames[i]);
- free(obj_names[i]);
- }
-
+ for(i = 0; i< (NDATASETS + 2); i++) {
+ HDfree(dnames[i]);
+ HDfree(obj_names[i]);
+ } /* end for */
} /* test_grp_memb_funcs() */
/****************************************************************
@@ -828,7 +826,7 @@ static void test_grp_memb_funcs(void)
** test_links(): Test soft and hard link iteration
**
****************************************************************/
-static void test_links(void)
+static void test_links(hid_t fapl)
{
hid_t file; /* File ID */
char obj_name[NAMELEN]; /* Names of the object in group */
@@ -843,7 +841,7 @@ static void test_links(void)
MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality\n"));
/* Create the test file with the datasets */
- file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
/* create groups */
@@ -854,10 +852,10 @@ static void test_links(void)
CHECK(gid1, FAIL, "H5Gcreate");
/* create soft and hard links to the group "/g1". */
- ret = H5Glink (gid, H5L_LINK_SOFT, "something", "softlink");
+ ret = H5Glink (gid, H5L_TYPE_SOFT, "something", "softlink");
CHECK(ret, FAIL, "H5Glink");
- ret = H5Glink (gid, H5L_LINK_HARD, "/g1", "hardlink");
+ ret = H5Glink (gid, H5L_TYPE_HARD, "/g1", "hardlink");
CHECK(ret, FAIL, "H5Glink");
ret = H5Gget_num_objs(gid, &nobjs);
@@ -865,7 +863,7 @@ static void test_links(void)
VERIFY(nobjs,3,"H5Gget_num_objs");
/* Test these two functions, H5Gget_num_objs and H5Gget_objname_by_idx */
- for(i=0; i<nobjs; i++) {
+ for(i = 0; i < nobjs; i++) {
/* Get object name */
name_len = H5Gget_objname_by_idx(gid, i, obj_name, NAMELEN);
CHECK(name_len, FAIL, "H5Gget_objname_by_idx");
@@ -883,13 +881,13 @@ static void test_links(void)
CHECK(0, 0, "unknown object name");
}
- ret=H5Gclose(gid);
+ ret = H5Gclose(gid);
CHECK(ret, FAIL, "H5Gclose");
- ret=H5Gclose(gid1);
+ ret = H5Gclose(gid1);
CHECK(ret, FAIL, "H5Gclose");
- ret=H5Fclose(file);
+ ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
} /* test_links() */
@@ -901,15 +899,39 @@ static void test_links(void)
void
test_iterate(void)
{
+ hid_t fapl, fapl2; /* File access property lists */
+ hbool_t new_format; /* Whether to use the new format or not */
+ herr_t ret; /* Generic return value */
+
/* Output message about test being performed */
MESSAGE(5, ("Testing Iteration Operations\n"));
+ /* Get the default FAPL */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Copy the file access property list */
+ fapl2 = H5Pcopy(fapl);
+ CHECK(fapl2, FAIL, "H5Pcopy");
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ ret = H5Pset_latest_format(fapl2, TRUE);
+ CHECK(ret, FAIL, "H5Pset_latest_format");
+
/* These next tests use the same file */
- test_iter_group(); /* Test group iteration */
- test_iter_group_large(); /* Test group iteration for large # of objects */
- test_iter_attr(); /* Test attribute iteration */
- test_grp_memb_funcs(); /* Test group member information functions */
- test_links(); /* Test soft and hard link iteration */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ test_iter_group(new_format ? fapl2 : fapl, new_format); /* Test group iteration */
+ test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
+ test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */
+ test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
+ test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
+ } /* end for */
+
+ /* Close FAPLs */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl2);
+ CHECK(ret, FAIL, "H5Pclose");
} /* test_iterate() */
diff --git a/test/tmisc.c b/test/tmisc.c
index b89a9a6..db1605e 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -3768,7 +3768,6 @@ test_misc22(void)
} /* end test_misc22() */
#endif /* H5_HAVE_FILTER_SZIP */
-#ifdef H5_GROUP_REVISION
/****************************************************************
**
** test_misc23(): Test intermediate group creation.
@@ -4075,7 +4074,6 @@ test_misc23(void)
CHECK(status, FAIL, "H5Fclose");
} /* end test_misc23() */
-#endif /* H5_GROUP_REVISION */
/****************************************************************
**
@@ -4114,13 +4112,13 @@ test_misc24(void)
CHECK(ret, FAIL, "H5Tcommit");
/* Create soft links to the objects created */
- ret = H5Glink2(file_id, MISC24_GROUP_NAME, H5L_LINK_SOFT, file_id, MISC24_GROUP_LINK);
+ ret = H5Glink2(file_id, MISC24_GROUP_NAME, H5L_TYPE_SOFT, file_id, MISC24_GROUP_LINK);
CHECK(ret, FAIL, "H5Glink2");
- ret = H5Glink2(file_id, MISC24_DATASET_NAME, H5L_LINK_SOFT, file_id, MISC24_DATASET_LINK);
+ ret = H5Glink2(file_id, MISC24_DATASET_NAME, H5L_TYPE_SOFT, file_id, MISC24_DATASET_LINK);
CHECK(ret, FAIL, "H5Glink2");
- ret = H5Glink2(file_id, MISC24_DATATYPE_NAME, H5L_LINK_SOFT, file_id, MISC24_DATATYPE_LINK);
+ ret = H5Glink2(file_id, MISC24_DATATYPE_NAME, H5L_TYPE_SOFT, file_id, MISC24_DATATYPE_LINK);
CHECK(ret, FAIL, "H5Glink2");
/* Close IDs for objects */
@@ -4668,9 +4666,7 @@ test_misc(void)
test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked datasets w/a filters */
test_misc22(); /* check szip bits per pixel */
#endif /* H5_HAVE_FILTER_SZIP */
-#ifdef H5_GROUP_REVISION
test_misc23(); /* Test intermediate group creation */
-#endif /* H5_GROUP_REVISION */
test_misc24(); /* Test inappropriate API opens of objects */
test_misc25a(); /* Exercise null object header message merge bug */
test_misc25b(); /* Exercise null object header message merge bug on existing file */
diff --git a/test/unlink.c b/test/unlink.c
index 1ad3790..908ea1d 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -77,7 +77,9 @@ const char *FILENAME[] = {
#define SLASHES_ROOTLINK_NAME "Root///"
#define FULL_GROUP_NUM_KEEP 2
#define FULL_GROUP_NUM_DELETE_COMPACT 2
-#define FULL_GROUP_NUM_DELETE_DENSE 16
+#define FULL_GROUP_NUM_DELETE_DENSE 16
+#define FULL_GROUP_EST_NUM_ENTRIES 8
+#define FULL_GROUP_EST_ENTRY_LEN 9
/*-------------------------------------------------------------------------
@@ -104,38 +106,35 @@ test_one(hid_t file)
herr_t status;
/* Create a test group */
- if ((work=H5Gcreate(file, "/test_one", 0))<0) goto error;
+ if((work=H5Gcreate(file, "/test_one", (size_t)0)) < 0) goto error;
/* Delete by absolute name */
TESTING("unlink by absolute name");
- if ((grp=H5Gcreate(work, "foo", 0))<0) goto error;
- if (H5Gclose(grp)<0) goto error;
- if (H5Gunlink(file, "/test_one/foo")<0) goto error;
+ if((grp=H5Gcreate(work, "foo", (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(grp) < 0) TEST_ERROR
+ if(H5Gunlink(file, "/test_one/foo") < 0) TEST_ERROR
PASSED();
/* Delete by local name */
TESTING("unlink by local name");
- if ((grp=H5Gcreate(work, "foo", 0))<0) goto error;
- if (H5Gclose(grp)<0) goto error;
- if (H5Gunlink(work, "foo")<0) goto error;
+ if((grp=H5Gcreate(work, "foo", (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose(grp) < 0) TEST_ERROR
+ if(H5Gunlink(work, "foo") < 0) TEST_ERROR
PASSED();
/* Delete directly - should fail */
TESTING("unlink without a name");
- if ((grp=H5Gcreate(work, "foo", 0))<0) goto error;
+ if((grp=H5Gcreate(work, "foo", (size_t)0)) < 0) TEST_ERROR
H5E_BEGIN_TRY {
status = H5Gunlink(grp, ".");
} H5E_END_TRY;
- if (status>=0) {
- H5_FAILED();
- puts(" Unlinking object w/o a name should have failed.");
- goto error;
- }
- if (H5Gclose(grp)<0) goto error;
+ if(status>=0)
+ FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.")
+ if(H5Gclose(grp) < 0) TEST_ERROR
PASSED();
/* Cleanup */
- if (H5Gclose(work)<0) goto error;
+ if(H5Gclose(work) < 0) goto error;
return 0;
error:
@@ -172,19 +171,19 @@ test_many(hid_t file)
char name[32];
/* Create a test group */
- if ((work=H5Gcreate(file, "/test_many", 0))<0) goto error;
- if ((grp = H5Gcreate(work, "/test_many_foo", 0))<0) goto error;
- if (H5Gclose(grp)<0) goto error;
+ if((work=H5Gcreate(file, "/test_many", (size_t)0)) < 0) goto error;
+ if((grp = H5Gcreate(work, "/test_many_foo", (size_t)0)) < 0) goto error;
+ if(H5Gclose(grp) < 0) goto error;
/* Create a bunch of names and unlink them in order */
TESTING("forward unlink");
for (i=0; i<how_many; i++) {
sprintf(name, "obj_%05d", i);
- if (H5Glink(work, H5L_LINK_HARD, "/test_many_foo", name)<0) goto error;
+ if (H5Glink(work, H5L_TYPE_HARD, "/test_many_foo", name) < 0) TEST_ERROR
}
for (i=0; i<how_many; i++) {
sprintf(name, "obj_%05d", i);
- if (H5Gunlink(work, name)<0) goto error;
+ if (H5Gunlink(work, name) < 0) TEST_ERROR
}
PASSED();
@@ -192,11 +191,11 @@ test_many(hid_t file)
TESTING("backward unlink");
for (i=0; i<how_many; i++) {
sprintf(name, "obj_%05d", i);
- if (H5Glink(work, H5L_LINK_HARD, "/test_many_foo", name)<0) goto error;
+ if (H5Glink(work, H5L_TYPE_HARD, "/test_many_foo", name) < 0) TEST_ERROR
}
for (i=how_many-1; i>=0; --i) {
sprintf(name, "obj_%05d", i);
- if (H5Gunlink(work, name)<0) goto error;
+ if (H5Gunlink(work, name) < 0) TEST_ERROR
}
PASSED();
@@ -204,7 +203,7 @@ test_many(hid_t file)
TESTING("inward unlink");
for (i=0; i<how_many; i++) {
sprintf(name, "obj_%05d", i);
- if (H5Glink(work, H5L_LINK_HARD, "/test_many_foo", name)<0) goto error;
+ if (H5Glink(work, H5L_TYPE_HARD, "/test_many_foo", name) < 0) TEST_ERROR
}
for (i=0; i<how_many; i++) {
if (i%2) {
@@ -212,7 +211,7 @@ test_many(hid_t file)
} else {
sprintf(name, "obj_%05d", i/2);
}
- if (H5Gunlink(work, name)<0) goto error;
+ if (H5Gunlink(work, name) < 0) TEST_ERROR
}
PASSED();
@@ -220,7 +219,7 @@ test_many(hid_t file)
TESTING("outward unlink");
for (i=0; i<how_many; i++) {
sprintf(name, "obj_%05d", i);
- if (H5Glink(work, H5L_LINK_HARD, "/test_many_foo", name)<0) goto error;
+ if (H5Glink(work, H5L_TYPE_HARD, "/test_many_foo", name) < 0) TEST_ERROR
}
for (i=how_many-1; i>=0; --i) {
if (i%2) {
@@ -228,13 +227,13 @@ test_many(hid_t file)
} else {
sprintf(name, "obj_%05d", i/2);
}
- if (H5Gunlink(work, name)<0) goto error;
+ if (H5Gunlink(work, name) < 0) TEST_ERROR
}
PASSED();
/* Cleanup */
- if (H5Gclose(work)<0) goto error;
+ if (H5Gclose(work) < 0) goto error;
return 0;
error:
@@ -268,12 +267,12 @@ test_symlink(hid_t file)
TESTING("symlink removal");
/* Create a test group and symlink */
- if ((work=H5Gcreate(file, "/test_symlink", 0))<0) TEST_ERROR;
- if (H5Glink(work, H5L_LINK_SOFT, "link_value", "link")<0) TEST_ERROR;
- if (H5Gunlink(work, "link")<0) TEST_ERROR;
+ if ((work=H5Gcreate(file, "/test_symlink", (size_t)0)) < 0) TEST_ERROR
+ if (H5Glink(work, H5L_TYPE_SOFT, "link_value", "link") < 0) TEST_ERROR
+ if (H5Gunlink(work, "link") < 0) TEST_ERROR
/* Cleanup */
- if (H5Gclose(work)<0) TEST_ERROR;
+ if (H5Gclose(work) < 0) TEST_ERROR
PASSED();
return 0;
@@ -308,24 +307,24 @@ test_rename(hid_t file)
/* Create a test group and rename something */
TESTING("object renaming");
- if ((work=H5Gcreate(file, "/test_rename", 0))<0) goto error;
- if ((foo=H5Gcreate(work, "foo", 0))<0) goto error;
- if (H5Gmove(work, "foo", "bar")<0) goto error;
- if ((inner=H5Gcreate(foo, "inner", 0))<0) goto error;
- if (H5Gclose(inner)<0) goto error;
- if (H5Gclose(foo)<0) goto error;
- if ((inner=H5Gopen(work, "bar/inner"))<0) goto error;
- if (H5Gclose(inner)<0) goto error;
+ if ((work=H5Gcreate(file, "/test_rename", (size_t)0)) < 0) TEST_ERROR
+ if ((foo=H5Gcreate(work, "foo", (size_t)0)) < 0) TEST_ERROR
+ if (H5Gmove(work, "foo", "bar") < 0) TEST_ERROR
+ if ((inner=H5Gcreate(foo, "inner", (size_t)0)) < 0) TEST_ERROR
+ if (H5Gclose(inner) < 0) TEST_ERROR
+ if (H5Gclose(foo) < 0) TEST_ERROR
+ if ((inner=H5Gopen(work, "bar/inner")) < 0) TEST_ERROR
+ if (H5Gclose(inner) < 0) TEST_ERROR
PASSED();
/* Try renaming a symlink */
TESTING("symlink renaming");
- if (H5Glink(work, H5L_LINK_SOFT, "link_value", "link_one")<0) goto error;
- if (H5Gmove(work, "link_one", "link_two")<0) goto error;
+ if (H5Glink(work, H5L_TYPE_SOFT, "link_value", "link_one") < 0) TEST_ERROR
+ if (H5Gmove(work, "link_one", "link_two") < 0) TEST_ERROR
PASSED();
/* Cleanup */
- if (H5Gclose(work)<0) goto error;
+ if (H5Gclose(work) < 0) goto error;
return 0;
error:
@@ -355,61 +354,52 @@ test_rename(hid_t file)
*-------------------------------------------------------------------------
*/
static int
-test_new_move(void)
+test_new_move(hid_t fapl)
{
- hid_t fapl, file_a, file_b=(-1);
+ hid_t file_a, file_b=(-1);
hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1);
char filename[1024];
TESTING("new move");
/* Create a second file */
- fapl = h5_fileaccess();
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- goto error;
+ if((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- goto error;
+ if((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create groups in first file */
- if((grp_1=H5Gcreate(file_a, "group1", 0))<0) goto error;
- if((grp_2=H5Gcreate(file_a, "group2", 0))<0) goto error;
- if((grp_move=H5Gcreate(grp_1, "group_move", 0))<0) goto error;
+ if((grp_1 = H5Gcreate(file_a, "group1", (size_t)0)) < 0) TEST_ERROR
+ if((grp_2 = H5Gcreate(file_a, "group2", (size_t)0)) < 0) TEST_ERROR
+ if((grp_move = H5Gcreate(grp_1, "group_move", (size_t)0)) < 0) TEST_ERROR
/* Create hard and soft links. */
- if(H5Glink2(grp_1, "group_move", H5L_LINK_HARD, H5G_SAME_LOC, "hard")<0)
- goto error;
- if(H5Glink2(grp_1, "/group1/group_move", H5L_LINK_SOFT, grp_2, "soft")<0)
- goto error;
+ if(H5Glink2(grp_1, "group_move", H5L_TYPE_HARD, H5G_SAME_LOC, "hard") < 0) TEST_ERROR
+ if(H5Glink2(grp_1, "/group1/group_move", H5L_TYPE_SOFT, grp_2, "soft") < 0) TEST_ERROR
/* Move a group within the file. Both of source and destination use
* H5G_SAME_LOC. Should fail. */
H5E_BEGIN_TRY {
- if(H5Gmove2(H5G_SAME_LOC, "group_move", H5G_SAME_LOC, "group_new_name")
- !=FAIL) goto error;
+ if(H5Gmove2(H5G_SAME_LOC, "group_move", H5G_SAME_LOC, "group_new_name") !=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Move a group across files. Should fail. */
H5E_BEGIN_TRY {
- if(H5Gmove2(grp_1, "group_move", file_b, "group_new_name")!=FAIL)
- goto error;
+ if(H5Gmove2(grp_1, "group_move", file_b, "group_new_name")!=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Move a group across groups in the same file. */
- if(H5Gmove2(grp_1, "group_move", grp_2, "group_new_name")<0)
- goto error;
+ if(H5Gmove2(grp_1, "group_move", grp_2, "group_new_name") < 0) TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen(grp_2, "group_new_name"))<0)
- goto error;
+ if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0) TEST_ERROR
- H5Gclose(grp_1);
- H5Gclose(grp_2);
- H5Gclose(grp_move);
- H5Gclose(moved_grp);
- H5Fclose(file_a);
- H5Fclose(file_b);
+ if(H5Gclose(grp_1) < 0) TEST_ERROR
+ if(H5Gclose(grp_2) < 0) TEST_ERROR
+ if(H5Gclose(grp_move) < 0) TEST_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if(H5Fclose(file_a) < 0) TEST_ERROR
+ if(H5Fclose(file_b) < 0) TEST_ERROR
PASSED();
return 0;
@@ -444,9 +434,9 @@ test_new_move(void)
*-------------------------------------------------------------------------
*/
static int
-check_new_move(void)
+check_new_move(hid_t fapl)
{
- hid_t fapl, file;
+ hid_t file;
H5G_stat_t sb_hard1, sb_hard2;
char filename[1024];
char linkval[1024];
@@ -454,43 +444,27 @@ check_new_move(void)
TESTING("check new move function");
/* Open file */
- fapl = h5_fileaccess();
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) {
- goto error;
- }
+ if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Get hard link info */
- if(H5Gget_objinfo(file, "/group2/group_new_name", TRUE, &sb_hard1)<0)
- goto error;
- if(H5Gget_objinfo(file, "/group1/hard", TRUE, &sb_hard2)<0)
- goto error;
+ if(H5Gget_objinfo(file, "/group2/group_new_name", TRUE, &sb_hard1) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file, "/group1/hard", TRUE, &sb_hard2) < 0) TEST_ERROR
/* Check hard links */
- if(H5G_GROUP!=sb_hard1.type || H5G_GROUP!=sb_hard2.type) {
- H5_FAILED();
- puts(" Unexpected object type, should have been a group");
- goto error;
- }
- if (HDmemcmp(&sb_hard1.objno, &sb_hard2.objno, sizeof(sb_hard1.objno))) {
- H5_FAILED();
- puts(" Hard link test failed. Link seems not to point to the ");
- puts(" expected file location.");
- goto error;
- }
+ if(H5G_GROUP!=sb_hard1.type || H5G_GROUP!=sb_hard2.type)
+ FAIL_PUTS_ERROR(" Unexpected object type, should have been a group")
+ if(HDmemcmp(&sb_hard1.objno, &sb_hard2.objno, sizeof(sb_hard1.objno)))
+ FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.")
/* Check soft links */
- if (H5Gget_linkval(file, "group2/soft", sizeof linkval, linkval)<0) {
- goto error;
- }
- if (strcmp(linkval, "/group1/group_move")) {
- H5_FAILED();
- puts(" Soft link test failed. Wrong link value");
- goto error;
- }
+ if(H5Gget_linkval(file, "group2/soft", sizeof linkval, linkval) < 0) TEST_ERROR
+ if(HDstrcmp(linkval, "/group1/group_move"))
+ FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value")
/* Cleanup */
- if(H5Fclose(file)<0) goto error;
+ if(H5Fclose(file) < 0) TEST_ERROR
+
PASSED();
return 0;
@@ -515,9 +489,8 @@ check_new_move(void)
*-------------------------------------------------------------------------
*/
static int
-test_filespace(void)
+test_filespace(hid_t fapl)
{
- hid_t fapl; /* File access property list */
hid_t fapl_nocache; /* File access property list with raw data cache turned off */
hid_t contig_dcpl; /* Dataset creation property list for contiguous dataset */
hid_t early_chunk_dcpl; /* Dataset creation property list for chunked dataset & early allocation */
@@ -553,91 +526,90 @@ test_filespace(void)
puts("Testing file space gets reused:");
/* Open file */
- fapl = h5_fileaccess();
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
/* Create FAPL with raw data cache disabled */
/* Create file access property list with raw data cache disabled */
- if ((fapl_nocache=H5Pcopy(fapl))<0) TEST_ERROR;
+ if ((fapl_nocache=H5Pcopy(fapl)) < 0) TEST_ERROR
/* Get the cache settings */
- if(H5Pget_cache(fapl_nocache,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0)<0) TEST_ERROR;
+ if(H5Pget_cache(fapl_nocache,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0) < 0) TEST_ERROR
/* Disable the raw data cache */
rdcc_nelmts=0;
rdcc_nbytes=0;
- if(H5Pset_cache(fapl_nocache,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0)<0) TEST_ERROR;
+ if(H5Pset_cache(fapl_nocache,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0) < 0) TEST_ERROR
/* Create empty file for size comparisons later */
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of an empty file */
- if((empty_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((empty_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Create common objects for datasets */
/* Create dataset creation property list for contigous storage */
- if ((contig_dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR;
+ if ((contig_dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
/* Make certain that space is allocated early */
- if(H5Pset_alloc_time(contig_dcpl, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR;
+ if(H5Pset_alloc_time(contig_dcpl, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
/* Create dataset creation property list for chunked storage & early allocation */
- if ((early_chunk_dcpl=H5Pcopy(contig_dcpl))<0) TEST_ERROR;
+ if ((early_chunk_dcpl=H5Pcopy(contig_dcpl)) < 0) TEST_ERROR
/* Set chunk dimensions */
- if(H5Pset_chunk(early_chunk_dcpl, FILESPACE_NDIMS, chunk_dims) < 0) TEST_ERROR;
+ if(H5Pset_chunk(early_chunk_dcpl, FILESPACE_NDIMS, chunk_dims) < 0) TEST_ERROR
/* Create dataset creation property list for chunked storage & late allocation */
- if ((late_chunk_dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR;
+ if ((late_chunk_dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
/* Set chunk dimensions */
- if(H5Pset_chunk(late_chunk_dcpl, FILESPACE_NDIMS, chunk_dims) < 0) TEST_ERROR;
+ if(H5Pset_chunk(late_chunk_dcpl, FILESPACE_NDIMS, chunk_dims) < 0) TEST_ERROR
/* Create dataset creation property list for compressed, chunked storage & early allocation */
- if ((comp_dcpl=H5Pcopy(early_chunk_dcpl))<0) TEST_ERROR;
+ if ((comp_dcpl=H5Pcopy(early_chunk_dcpl)) < 0) TEST_ERROR
/* Enable compression & set level */
- if(H5Pset_deflate(comp_dcpl, FILESPACE_DEFLATE_LEVEL) < 0) TEST_ERROR;
+ if(H5Pset_deflate(comp_dcpl, FILESPACE_DEFLATE_LEVEL) < 0) TEST_ERROR
/* Create dataset creation property list for compact storage */
- if ((compact_dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR;
+ if ((compact_dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
/* Set to compact storage */
- if(H5Pset_layout(compact_dcpl, H5D_COMPACT) < 0) TEST_ERROR;
+ if(H5Pset_layout(compact_dcpl, H5D_COMPACT) < 0) TEST_ERROR
/* Create dataspace for datasets */
- if((space = H5Screate_simple(FILESPACE_NDIMS, dims, NULL))<0) TEST_ERROR;
+ if((space = H5Screate_simple(FILESPACE_NDIMS, dims, NULL)) < 0) TEST_ERROR
/* Create buffer for writing dataset */
- if((data = HDmalloc(sizeof(int)*FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2))==NULL) TEST_ERROR;
+ if((data = HDmalloc(sizeof(int)*FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2))==NULL) TEST_ERROR
/* Create single dataset (with contiguous storage & late allocation), remove it & verify file size */
TESTING(" contiguous dataset with late allocation");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT))<0) TEST_ERROR;
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -645,23 +617,23 @@ test_filespace(void)
TESTING(" contiguous dataset with early allocation");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl))<0) TEST_ERROR;
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -669,23 +641,23 @@ test_filespace(void)
TESTING(" chunked dataset with late allocation");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, late_chunk_dcpl))<0) TEST_ERROR;
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, late_chunk_dcpl)) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -693,23 +665,23 @@ test_filespace(void)
TESTING(" chunked dataset with early allocation");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, early_chunk_dcpl))<0) TEST_ERROR;
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, early_chunk_dcpl)) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -717,23 +689,23 @@ test_filespace(void)
TESTING(" compressed, chunked dataset");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl))<0) TEST_ERROR;
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -744,10 +716,10 @@ test_filespace(void)
TESTING(" re-writing compressed, chunked dataset");
/* Create file (using FAPL with disabled raw data cache) */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_nocache))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_nocache)) < 0) TEST_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl))<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) TEST_ERROR
/* Alternate re-writing dataset with compressible & random data */
for(u=0; u<FILESPACE_REWRITE; u++) {
@@ -756,30 +728,30 @@ test_filespace(void)
*tmp_data++ = v*u;
/* Write the buffer to the dataset */
- if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data)<0) TEST_ERROR;
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR
/* Set buffer to different random numbers each time */
for (v=0, tmp_data=data; v<(FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2); v++)
*tmp_data++ = (int)HDrandom();
/* Write the buffer to the dataset */
- if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data)<0) TEST_ERROR;
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR
} /* end for */
/* Close dataset */
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -787,23 +759,23 @@ test_filespace(void)
TESTING(" compact dataset");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, compact_dcpl))<0) TEST_ERROR;
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, compact_dcpl)) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -814,59 +786,59 @@ test_filespace(void)
TESTING(" object header continuations");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create datasets to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl))<0) TEST_ERROR;
- if((dataset2 = H5Dcreate (file, DATASET2NAME, H5T_NATIVE_INT, space, contig_dcpl))<0) TEST_ERROR;
+ if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR
+ if((dataset2 = H5Dcreate(file, DATASET2NAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR
/* Create a dataspace for the attributes */
- if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL))<0) TEST_ERROR;
+ if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) TEST_ERROR
/* Alternate adding attributes to each one */
- for(u=0; u<FILESPACE_NATTR; u++) {
+ for(u = 0; u < FILESPACE_NATTR; u++) {
/* Set the name of the attribute to create */
sprintf(objname,"%s %u",ATTRNAME,u);
/* Create an attribute on the first dataset */
- if((attr = H5Acreate (dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT))<0) TEST_ERROR;
+ if((attr = H5Acreate(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) TEST_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
/* Close the attribute on the first dataset */
- if(H5Aclose (attr)<0) TEST_ERROR;
+ if(H5Aclose(attr) < 0) TEST_ERROR
/* Create an attribute on the second dataset */
- if((attr = H5Acreate (dataset2, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT))<0) TEST_ERROR;
+ if((attr = H5Acreate(dataset2, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) TEST_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
/* Close the attribute on the second dataset */
- if(H5Aclose (attr)<0) TEST_ERROR;
+ if(H5Aclose(attr) < 0) TEST_ERROR
/* Flush the file (to fix the sizes of object header buffers, etc) */
- if(H5Fflush(file,H5F_SCOPE_GLOBAL)<0) TEST_ERROR;
+ if(H5Fflush(file,H5F_SCOPE_GLOBAL) < 0) TEST_ERROR
} /* end for */
/* Close the dataspace for the attributes */
- if(H5Sclose (attr_space)<0) TEST_ERROR;
+ if(H5Sclose(attr_space) < 0) TEST_ERROR
/* Close datasets */
- if(H5Dclose (dataset)<0) TEST_ERROR;
- if(H5Dclose (dataset2)<0) TEST_ERROR;
+ if(H5Dclose(dataset) < 0) TEST_ERROR
+ if(H5Dclose(dataset2) < 0) TEST_ERROR
/* Remove the datasets */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
- if(H5Gunlink (file, DATASET2NAME)<0) TEST_ERROR;
+ if(H5Gunlink(file, DATASETNAME) < 0) TEST_ERROR
+ if(H5Gunlink(file, DATASET2NAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size = h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -874,26 +846,26 @@ test_filespace(void)
TESTING(" named datatype");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create datatype to commit */
- if((type = H5Tcopy (H5T_NATIVE_INT))<0) TEST_ERROR;
+ if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR
/* Create a single named datatype to remove */
- if(H5Tcommit (file, TYPENAME, type)<0) TEST_ERROR;
- if(H5Tclose (type)<0) TEST_ERROR;
+ if(H5Tcommit (file, TYPENAME, type) < 0) TEST_ERROR
+ if(H5Tclose (type) < 0) TEST_ERROR
/* Remove the named datatype */
- if(H5Gunlink (file, TYPENAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, TYPENAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -901,23 +873,23 @@ test_filespace(void)
TESTING(" single group");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single group to remove */
- if((group = H5Gcreate (file, GROUPNAME, 0))<0) TEST_ERROR;
- if(H5Gclose (group)<0) TEST_ERROR;
+ if((group = H5Gcreate (file, GROUPNAME, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose (group) < 0) TEST_ERROR
/* Remove the group */
- if(H5Gunlink (file, GROUPNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, GROUPNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -925,32 +897,30 @@ test_filespace(void)
TESTING(" multiple groups");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a many groups to remove */
- for(u=0; u<UNLINK_NGROUPS; u++) {
- sprintf(objname,"%s %u",GROUPNAME,u);
- if((group = H5Gcreate (file, objname, 0))<0) TEST_ERROR;
- if(H5Gclose (group)<0) TEST_ERROR;
+ for(u = 0; u < UNLINK_NGROUPS; u++) {
+ sprintf(objname, "%s %u", GROUPNAME, u);
+ if((group = H5Gcreate(file, objname, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose (group) < 0) TEST_ERROR
} /* end for */
/* Remove the all the groups */
/* (Remove them in reverse order just to make file size calculation easier -QAK) */
- for(u=UNLINK_NGROUPS; u>0; u--) {
- sprintf(objname,"%s %u",GROUPNAME,(u-1));
- if(H5Gunlink (file, objname)<0) TEST_ERROR;
+ for(u = UNLINK_NGROUPS; u > 0; u--) {
+ sprintf(objname, "%s %u", GROUPNAME, (u - 1));
+ if(H5Gunlink(file, objname) < 0) TEST_ERROR
} /* end for */
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
-#ifdef H5_GROUP_REVISION
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size = h5_get_file_size(filename)) == 0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
-#endif /* H5_GROUP_REVISION */
+ if(file_size != empty_size) TEST_ERROR
PASSED();
@@ -958,28 +928,28 @@ test_filespace(void)
TESTING(" simple group hierarchy");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a small group hierarchy to remove */
- if((group = H5Gcreate (file, GROUPNAME, 0))<0) TEST_ERROR;
- if((group2 = H5Gcreate (group, GROUP2NAME, 0))<0) TEST_ERROR;
- if(H5Gclose (group2)<0) TEST_ERROR;
- if(H5Gclose (group)<0) TEST_ERROR;
+ if((group = H5Gcreate(file, GROUPNAME, (size_t)0)) < 0) TEST_ERROR
+ if((group2 = H5Gcreate (group, GROUP2NAME, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose (group2) < 0) TEST_ERROR
+ if(H5Gclose (group) < 0) TEST_ERROR
/* Remove the second group */
- if(H5Gunlink (file, GROUPNAME "/" GROUP2NAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, GROUPNAME "/" GROUP2NAME) < 0) TEST_ERROR
/* Remove the first group */
- if(H5Gunlink (file, GROUPNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, GROUPNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -987,34 +957,34 @@ test_filespace(void)
TESTING(" complex group hierarchy");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a complex group hierarchy to remove */
for(u=0; u<FILESPACE_TOP_GROUPS; u++) {
/* Create group */
sprintf(objname,"%s %u",GROUPNAME,u);
- if((group = H5Gcreate (file, objname, 0))<0) TEST_ERROR;
+ if((group = H5Gcreate (file, objname, (size_t)0)) < 0) TEST_ERROR
/* Create nested groups inside top groups */
for(v=0; v<FILESPACE_NESTED_GROUPS; v++) {
/* Create group */
sprintf(objname,"%s %u",GROUP2NAME,v);
- if((group2 = H5Gcreate (group, objname, 0))<0) TEST_ERROR;
+ if((group2 = H5Gcreate (group, objname, (size_t)0)) < 0) TEST_ERROR
/* Create datasets inside nested groups */
for(w=0; w<FILESPACE_NDATASETS; w++) {
/* Create & close a dataset */
sprintf(objname,"%s %u",DATASETNAME,w);
- if((dataset = H5Dcreate (group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT))<0) TEST_ERROR;
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if((dataset = H5Dcreate (group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
} /* end for */
/* Close nested group */
- if(H5Gclose (group2)<0) TEST_ERROR;
+ if(H5Gclose (group2) < 0) TEST_ERROR
} /* end for */
/* Close top group */
- if(H5Gclose (group)<0) TEST_ERROR;
+ if(H5Gclose (group) < 0) TEST_ERROR
} /* end for */
/* Remove complex group hierarchy */
@@ -1022,47 +992,45 @@ test_filespace(void)
for(u=FILESPACE_TOP_GROUPS; u>0; u--) {
/* Open group */
sprintf(objname,"%s %u",GROUPNAME,(u-1));
- if((group = H5Gopen (file, objname))<0) TEST_ERROR;
+ if((group = H5Gopen (file, objname)) < 0) TEST_ERROR
/* Open nested groups inside top groups */
for(v=0; v<FILESPACE_NESTED_GROUPS; v++) {
/* Create group */
sprintf(objname,"%s %u",GROUP2NAME,v);
- if((group2 = H5Gopen (group, objname))<0) TEST_ERROR;
+ if((group2 = H5Gopen (group, objname)) < 0) TEST_ERROR
/* Remove datasets inside nested groups */
for(w=0; w<FILESPACE_NDATASETS; w++) {
/* Remove dataset */
sprintf(objname,"%s %u",DATASETNAME,w);
- if(H5Gunlink (group2, objname)<0) TEST_ERROR;
+ if(H5Gunlink (group2, objname) < 0) TEST_ERROR
} /* end for */
/* Close nested group */
- if(H5Gclose (group2)<0) TEST_ERROR;
+ if(H5Gclose (group2) < 0) TEST_ERROR
/* Remove nested group */
sprintf(objname,"%s %u",GROUP2NAME,v);
- if(H5Gunlink (group, objname)<0) TEST_ERROR;
+ if(H5Gunlink (group, objname) < 0) TEST_ERROR
} /* end for */
/* Close top group */
- if(H5Gclose (group)<0) TEST_ERROR;
+ if(H5Gclose (group) < 0) TEST_ERROR
/* Remove top group */
sprintf(objname,"%s %u",GROUPNAME,(u-1));
- if(H5Gunlink (file, objname)<0) TEST_ERROR;
+ if(H5Gunlink (file, objname) < 0) TEST_ERROR
} /* end for */
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
-#ifdef H5_GROUP_REVISION
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
-#endif /* H5_GROUP_REVISION */
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -1070,11 +1038,11 @@ test_filespace(void)
TESTING(" duplicate dataset");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single dataset to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT))<0) TEST_ERROR;
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Create another dataset with same name */
H5E_BEGIN_TRY {
@@ -1082,20 +1050,20 @@ test_filespace(void)
} H5E_END_TRY;
if (dataset>=0) {
H5Dclose(dataset);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -1103,32 +1071,32 @@ test_filespace(void)
TESTING(" duplicate group");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a single group to remove */
- if((group = H5Gcreate (file, GROUPNAME, 0))<0) TEST_ERROR;
- if(H5Gclose (group)<0) TEST_ERROR;
+ if((group = H5Gcreate (file, GROUPNAME, (size_t)0)) < 0) TEST_ERROR
+ if(H5Gclose (group) < 0) TEST_ERROR
/* Create another group with same name */
H5E_BEGIN_TRY {
- group = H5Gcreate (file, GROUPNAME, 0);
+ group = H5Gcreate (file, GROUPNAME, (size_t)0);
} H5E_END_TRY;
if (group>=0) {
H5Gclose(group);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
/* Remove the group */
- if(H5Gunlink (file, GROUPNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, GROUPNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -1136,36 +1104,36 @@ test_filespace(void)
TESTING(" duplicate named datatype");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create datatype to commit */
- if((type = H5Tcopy (H5T_NATIVE_INT))<0) TEST_ERROR;
+ if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR
/* Create a single named datatype to remove */
- if(H5Tcommit (file, TYPENAME, type)<0) TEST_ERROR;
- if(H5Tclose (type)<0) TEST_ERROR;
+ if(H5Tcommit (file, TYPENAME, type) < 0) TEST_ERROR
+ if(H5Tclose (type) < 0) TEST_ERROR
/* Create datatype to commit */
- if((type = H5Tcopy (H5T_NATIVE_INT))<0) TEST_ERROR;
+ if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR
/* Create another named datatype with same name */
H5E_BEGIN_TRY {
status = H5Tcommit (file, TYPENAME, type);
} H5E_END_TRY;
- if (status>=0) TEST_ERROR;
- if(H5Tclose (type)<0) TEST_ERROR;
+ if (status>=0) TEST_ERROR
+ if(H5Tclose (type) < 0) TEST_ERROR
/* Remove the named datatype */
- if(H5Gunlink (file, TYPENAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, TYPENAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -1173,21 +1141,21 @@ test_filespace(void)
TESTING(" duplicate attribute");
/* Create file */
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create datasets to remove */
- if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl))<0) TEST_ERROR;
+ if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR
/* Create a dataspace for the attributes */
- if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL))<0) TEST_ERROR;
+ if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) TEST_ERROR
/* Create an attribute on the dataset */
- if((attr = H5Acreate (dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT))<0) TEST_ERROR;
+ if((attr = H5Acreate (dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) TEST_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
/* Close the attribute on the dataset */
- if(H5Aclose (attr)<0) TEST_ERROR;
+ if(H5Aclose (attr) < 0) TEST_ERROR
/* Create another attribute with same name */
H5E_BEGIN_TRY {
@@ -1195,26 +1163,26 @@ test_filespace(void)
} H5E_END_TRY;
if (attr>=0) {
H5Aclose(attr);
- TEST_ERROR;
+ TEST_ERROR
} /* end if */
/* Close the dataspace for the attributes */
- if(H5Sclose (attr_space)<0) TEST_ERROR;
+ if(H5Sclose (attr_space) < 0) TEST_ERROR
/* Close dataset */
- if(H5Dclose (dataset)<0) TEST_ERROR;
+ if(H5Dclose (dataset) < 0) TEST_ERROR
/* Remove the dataset */
- if(H5Gunlink (file, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR
/* Close file */
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Get the size of the file */
- if((file_size=h5_get_file_size(filename))==0) TEST_ERROR;
+ if((file_size=h5_get_file_size(filename))==0) TEST_ERROR
/* Verify the file is correct size */
- if(file_size!=empty_size) TEST_ERROR;
+ if(file_size!=empty_size) TEST_ERROR
PASSED();
@@ -1224,16 +1192,15 @@ test_filespace(void)
HDfree(data);
/* Close property lists */
- if(H5Pclose(fapl)<0) TEST_ERROR;
- if(H5Pclose(fapl_nocache)<0) TEST_ERROR;
- if(H5Pclose(contig_dcpl)<0) TEST_ERROR;
- if(H5Pclose(early_chunk_dcpl)<0) TEST_ERROR;
- if(H5Pclose(late_chunk_dcpl)<0) TEST_ERROR;
- if(H5Pclose(comp_dcpl)<0) TEST_ERROR;
- if(H5Pclose(compact_dcpl)<0) TEST_ERROR;
+ if(H5Pclose(fapl_nocache) < 0) TEST_ERROR
+ if(H5Pclose(contig_dcpl) < 0) TEST_ERROR
+ if(H5Pclose(early_chunk_dcpl) < 0) TEST_ERROR
+ if(H5Pclose(late_chunk_dcpl) < 0) TEST_ERROR
+ if(H5Pclose(comp_dcpl) < 0) TEST_ERROR
+ if(H5Pclose(compact_dcpl) < 0) TEST_ERROR
/* Close dataspace */
- if(H5Sclose(space)<0) TEST_ERROR;
+ if(H5Sclose(space) < 0) TEST_ERROR
/* Indicate success */
/* Don't print final "PASSED", since we aren't on the correct line anymore */
@@ -1274,48 +1241,37 @@ static int test_create_unlink(const char *msg, hid_t fapl)
/* Create file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- {
- H5_FAILED();
- puts(" Creating file failed");
- goto error;
- }
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_PUTS_ERROR(" Creating file failed")
/* Create a many groups to remove */
for(u=0; u<UNLINK_NGROUPS; u++) {
sprintf(groupname,"%s %u",GROUPNAME,u);
- if((group = H5Gcreate (file, groupname, 0))<0)
- {
+ if((group = H5Gcreate (file, groupname, (size_t)0)) < 0) {
H5_FAILED();
- printf("group %s creation failed\n",groupname);
+ printf("group %s creation failed\n", groupname);
goto error;
- }
- if(H5Gclose (group)<0)
- {
+ } /* end if */
+ if(H5Gclose (group) < 0) {
H5_FAILED();
- printf("closing group %s failed\n",groupname);
+ printf("closing group %s failed\n", groupname);
goto error;
- }
+ } /* end if */
} /* end for */
/* Remove the all the groups */
for(u=0; u<UNLINK_NGROUPS; u++) {
sprintf(groupname,"%s %u",GROUPNAME,u);
- if(H5Gunlink (file, groupname)<0)
- {
+ if(H5Gunlink(file, groupname) < 0) {
H5_FAILED();
- printf("Unlinking group %s failed\n",groupname);
+ printf("Unlinking group %s failed\n", groupname);
goto error;
- }
+ } /* end if */
} /* end for */
/* Close file */
- if(H5Fclose(file)<0)
- {
- H5_FAILED();
- printf("Closing file failed\n");
- goto error;
- }
+ if(H5Fclose(file) < 0)
+ FAIL_PUTS_ERROR("Closing file failed")
PASSED();
return 0;
@@ -1341,9 +1297,8 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_link_slashes(void)
+test_link_slashes(hid_t fapl)
{
- hid_t fapl; /* File access property list */
hid_t fid; /* File ID */
hid_t gid,gid2; /* Group ID */
char filename[1024];
@@ -1351,41 +1306,40 @@ test_link_slashes(void)
TESTING("creating links with multiple slashes");
/* Create file */
- fapl = h5_fileaccess();
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
/* Create a file */
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) TEST_ERROR;
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create a group in the root group */
- if((gid = H5Gcreate(fid, SLASHES_GROUP_NAME, 0))<0) TEST_ERROR;
+ if((gid = H5Gcreate(fid, SLASHES_GROUP_NAME, (size_t)0)) < 0) TEST_ERROR
/* Create a nested group in the root group */
- if((gid2 = H5Gcreate(gid, SLASHES_GROUP_NAME, 0))<0) TEST_ERROR;
+ if((gid2 = H5Gcreate(gid, SLASHES_GROUP_NAME, (size_t)0)) < 0) TEST_ERROR
/* Close the nested group */
- if(H5Gclose(gid2)<0) TEST_ERROR;
+ if(H5Gclose(gid2) < 0) TEST_ERROR
/* Create a hard link to the nested group */
- if(H5Glink2(gid, SLASHES_GROUP_NAME, H5L_LINK_HARD, H5G_SAME_LOC, SLASHES_HARDLINK_NAME)<0) TEST_ERROR;
+ if(H5Glink2(gid, SLASHES_GROUP_NAME, H5L_TYPE_HARD, H5G_SAME_LOC, SLASHES_HARDLINK_NAME) < 0) TEST_ERROR
/* Create a soft link with a relative path to the nested group */
- if(H5Glink2(gid, SLASHES_GROUP_NAME, H5L_LINK_SOFT, H5G_SAME_LOC, SLASHES_SOFTLINK_NAME)<0) TEST_ERROR;
+ if(H5Glink2(gid, SLASHES_GROUP_NAME, H5L_TYPE_SOFT, H5G_SAME_LOC, SLASHES_SOFTLINK_NAME) < 0) TEST_ERROR
/* Create a soft link with the full path to the nested group */
- if(H5Glink2(gid, "////"SLASHES_GROUP_NAME""SLASHES_GROUP_NAME, H5L_LINK_SOFT, H5G_SAME_LOC, SLASHES_SOFTLINK2_NAME)<0) TEST_ERROR;
+ if(H5Glink2(gid, "////"SLASHES_GROUP_NAME""SLASHES_GROUP_NAME, H5L_TYPE_SOFT, H5G_SAME_LOC, SLASHES_SOFTLINK2_NAME) < 0) TEST_ERROR
/* Create a soft link to the root group */
- if(H5Glink2(gid, "////", H5L_LINK_SOFT, H5G_SAME_LOC, SLASHES_ROOTLINK_NAME)<0) TEST_ERROR;
+ if(H5Glink2(gid, "////", H5L_TYPE_SOFT, H5G_SAME_LOC, SLASHES_ROOTLINK_NAME) < 0) TEST_ERROR
/* Close the group */
- if(H5Gclose(gid)<0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Create a hard link to the existing group */
- if(H5Glink2(fid, SLASHES_GROUP_NAME, H5L_LINK_HARD, H5G_SAME_LOC, SLASHES_HARDLINK_NAME)<0) TEST_ERROR;
+ if(H5Glink2(fid, SLASHES_GROUP_NAME, H5L_TYPE_HARD, H5G_SAME_LOC, SLASHES_HARDLINK_NAME) < 0) TEST_ERROR
/* Close the file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1411,9 +1365,8 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_unlink_slashes(void)
+test_unlink_slashes(hid_t fapl)
{
- hid_t fapl; /* File access property list */
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
char filename[1024];
@@ -1421,41 +1374,40 @@ test_unlink_slashes(void)
TESTING("deleting links with multiple slashes");
/* Create file */
- fapl = h5_fileaccess();
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
/* Open the file */
- if((fid=H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT))<0) TEST_ERROR;
+ if((fid=H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open the top level group */
- if((gid = H5Gopen(fid, SLASHES_GROUP_NAME))<0) TEST_ERROR;
+ if((gid = H5Gopen(fid, SLASHES_GROUP_NAME)) < 0) TEST_ERROR
/* Delete the root link */
- if(H5Gunlink(gid,SLASHES_ROOTLINK_NAME)<0) TEST_ERROR;
+ if(H5Gunlink(gid,SLASHES_ROOTLINK_NAME) < 0) TEST_ERROR
/* Delete the soft link with the full path */
- if(H5Gunlink(gid,SLASHES_SOFTLINK2_NAME)<0) TEST_ERROR;
+ if(H5Gunlink(gid,SLASHES_SOFTLINK2_NAME) < 0) TEST_ERROR
/* Delete the soft link with the relative path */
- if(H5Gunlink(gid,SLASHES_SOFTLINK_NAME)<0) TEST_ERROR;
+ if(H5Gunlink(gid,SLASHES_SOFTLINK_NAME) < 0) TEST_ERROR
/* Delete the hard link */
- if(H5Gunlink(gid,SLASHES_HARDLINK_NAME)<0) TEST_ERROR;
+ if(H5Gunlink(gid,SLASHES_HARDLINK_NAME) < 0) TEST_ERROR
/* Delete the group itself */
- if(H5Gunlink(gid,SLASHES_GROUP_NAME)<0) TEST_ERROR;
+ if(H5Gunlink(gid,SLASHES_GROUP_NAME) < 0) TEST_ERROR
/* Close the group */
- if(H5Gclose(gid)<0) TEST_ERROR;
+ if(H5Gclose(gid) < 0) TEST_ERROR
/* Delete the hard link */
- if(H5Gunlink(fid,SLASHES_HARDLINK_NAME)<0) TEST_ERROR;
+ if(H5Gunlink(fid,SLASHES_HARDLINK_NAME) < 0) TEST_ERROR
/* Delete the group itself */
- if(H5Gunlink(fid,SLASHES_GROUP_NAME)<0) TEST_ERROR;
+ if(H5Gunlink(fid,SLASHES_GROUP_NAME) < 0) TEST_ERROR
/* Close the file */
- if(H5Fclose(fid)<0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1472,20 +1424,20 @@ static int delete_node (hid_t pid, hid_t id)
char name[256]; /* Name of object to close */
/* Get the name of the object to delete */
- if(H5Iget_name(id, name, sizeof(name))<0) return (-1);
+ if(H5Iget_name(id, name, sizeof(name)) < 0) return (-1);
/* Close the object */
- if(H5Gclose (id)<0) return(-1);
+ if(H5Gclose (id) < 0) return(-1);
/* Unlink the object */
- if(H5Gunlink (pid, name)<0) return(-1);
+ if(H5Gunlink (pid, name) < 0) return(-1);
/* If this object is the right-most child, try opening the previous object */
if(HDstrcmp(name,"/Zone81")==0) {
hid_t gid;
- if((gid = H5Gopen (pid, "/Zone80"))<0) return(-1);
- if(H5Gclose(gid)<0) return(-1);
+ if((gid = H5Gopen (pid, "/Zone80")) < 0) return(-1);
+ if(H5Gclose(gid) < 0) return(-1);
} /* end if */
/* Indicate success */
@@ -1522,29 +1474,29 @@ test_unlink_rightleaf(hid_t fid)
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
- if(gids==NULL) TEST_ERROR;
+ if(gids==NULL) TEST_ERROR
- if((rootid = H5Gopen (fid, "/"))<0) TEST_ERROR;
+ if((rootid = H5Gopen (fid, "/")) < 0) TEST_ERROR
/* Create all the groups */
for (n = 0; n < ngroups; n++) {
sprintf(name, "Zone%d", n + 1);
- if((gids[n] = H5Gcreate (rootid, name, 0))<0) TEST_ERROR;
+ if((gids[n] = H5Gcreate (rootid, name, (size_t)0)) < 0) TEST_ERROR
} /* end for */
/* Unlink & re-create each group */
for (n = 0; n < ngroups; n++) {
- if(delete_node (rootid, gids[n])<0) TEST_ERROR;
+ if(delete_node (rootid, gids[n]) < 0) TEST_ERROR
sprintf(name, "Zone%d", n + 1);
- if((gids[n] = H5Gcreate (rootid, name, 0))<0) TEST_ERROR;
+ if((gids[n] = H5Gcreate (rootid, name, (size_t)0)) < 0) TEST_ERROR
} /* end for */
/* Close all the groups */
for (n = 0; n < ngroups; n++)
- if(H5Gclose(gids[n])<0) TEST_ERROR;
+ if(H5Gclose(gids[n]) < 0) TEST_ERROR
/* Close root group ID */
- if(H5Gclose(rootid)<0) TEST_ERROR;
+ if(H5Gclose(rootid) < 0) TEST_ERROR
/* Free memory */
HDfree(gids);
@@ -1586,29 +1538,29 @@ test_unlink_rightnode(hid_t fid)
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
- if(gids==NULL) TEST_ERROR;
+ if(gids==NULL) TEST_ERROR
- if((rootid = H5Gopen (fid, "/"))<0) TEST_ERROR;
+ if((rootid = H5Gopen (fid, "/")) < 0) TEST_ERROR
/* Create all the groups */
for (n = 0; n < ngroups; n++) {
sprintf(name, "ZoneB%d", n + 1);
- if((gids[n] = H5Gcreate (rootid, name, 0))<0) TEST_ERROR;
+ if((gids[n] = H5Gcreate (rootid, name, (size_t)0)) < 0) TEST_ERROR
} /* end for */
/* Close all the groups */
for (n = 0; n < ngroups; n++)
- if(H5Gclose(gids[n])<0) TEST_ERROR;
+ if(H5Gclose(gids[n]) < 0) TEST_ERROR
/* Unlink specific objects to trigger deletion of right leaf in non-leaf node */
- if(H5Gunlink(fid,"/ZoneB77")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneB78")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneB79")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneB8")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneB80")<0) TEST_ERROR;
+ if(H5Gunlink(fid,"/ZoneB77") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneB78") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneB79") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneB8") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneB80") < 0) TEST_ERROR
/* Close root group ID */
- if(H5Gclose(rootid)<0) TEST_ERROR;
+ if(H5Gclose(rootid) < 0) TEST_ERROR
/* Free memory */
HDfree(gids);
@@ -1650,172 +1602,172 @@ test_unlink_middlenode(hid_t fid)
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
- if(gids==NULL) TEST_ERROR;
+ if(gids==NULL) TEST_ERROR
- if((rootid = H5Gopen (fid, "/"))<0) TEST_ERROR;
+ if((rootid = H5Gopen (fid, "/")) < 0) TEST_ERROR
/* Create all the groups */
for (n = 0; n < ngroups; n++) {
sprintf(name, "ZoneC%d", n + 1);
- if((gids[n] = H5Gcreate (rootid, name, 0))<0) TEST_ERROR;
+ if((gids[n] = H5Gcreate (rootid, name, (size_t)0)) < 0) TEST_ERROR
} /* end for */
/* Close all the groups */
for (n = 0; n < ngroups; n++)
- if(H5Gclose(gids[n])<0) TEST_ERROR;
+ if(H5Gclose(gids[n]) < 0) TEST_ERROR
/* Unlink specific objects to trigger deletion of all leafs in "interior" non-leaf node */
- if(H5Gunlink(fid,"/ZoneC11")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC110")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC111")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC112")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC113")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC114")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC115")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC116")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC117")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC118")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC119")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC12")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC120")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC121")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC122")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC123")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC124")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC125")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC126")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC127")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC128")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC129")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC13")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC130")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC131")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC132")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC133")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC134")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC135")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC136")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC137")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC138")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC139")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC14")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC140")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC141")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC142")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC143")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC144")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC145")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC146")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC147")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC148")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC149")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC15")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC150")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC151")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC152")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC153")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC154")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC155")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC156")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC157")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC158")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC159")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC16")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC160")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC161")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC162")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC163")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC164")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC165")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC166")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC167")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC168")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC169")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC17")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC170")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC171")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC172")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC173")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC174")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC175")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC176")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC177")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC178")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC179")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC18")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC180")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC19")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC2")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC20")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC21")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC22")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC23")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC24")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC25")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC26")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC27")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC28")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC29")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC3")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC30")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC31")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC32")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC33")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC34")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC35")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC36")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC37")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC38")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC39")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC4")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC40")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC41")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC42")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC43")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC44")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC45")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC46")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC47")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC48")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC49")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC5")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC50")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC51")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC52")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC53")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC54")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC55")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC56")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC57")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC58")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC59")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC6")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC60")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC61")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC62")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC63")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC64")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC65")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC66")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC67")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC68")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC69")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC7")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC70")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC71")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC72")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC73")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC74")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC75")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC76")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC77")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC78")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC79")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC8")<0) TEST_ERROR;
- if(H5Gunlink(fid,"/ZoneC80")<0) TEST_ERROR;
+ if(H5Gunlink(fid,"/ZoneC11") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC110") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC111") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC112") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC113") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC114") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC115") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC116") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC117") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC118") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC119") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC12") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC120") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC121") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC122") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC123") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC124") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC125") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC126") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC127") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC128") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC129") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC13") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC130") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC131") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC132") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC133") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC134") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC135") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC136") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC137") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC138") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC139") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC14") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC140") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC141") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC142") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC143") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC144") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC145") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC146") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC147") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC148") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC149") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC15") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC150") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC151") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC152") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC153") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC154") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC155") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC156") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC157") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC158") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC159") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC16") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC160") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC161") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC162") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC163") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC164") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC165") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC166") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC167") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC168") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC169") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC17") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC170") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC171") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC172") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC173") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC174") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC175") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC176") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC177") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC178") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC179") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC18") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC180") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC19") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC2") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC20") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC21") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC22") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC23") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC24") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC25") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC26") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC27") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC28") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC29") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC3") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC30") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC31") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC32") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC33") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC34") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC35") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC36") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC37") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC38") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC39") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC4") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC40") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC41") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC42") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC43") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC44") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC45") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC46") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC47") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC48") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC49") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC5") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC50") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC51") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC52") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC53") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC54") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC55") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC56") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC57") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC58") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC59") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC6") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC60") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC61") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC62") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC63") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC64") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC65") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC66") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC67") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC68") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC69") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC7") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC70") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC71") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC72") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC73") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC74") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC75") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC76") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC77") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC78") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC79") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC8") < 0) TEST_ERROR
+ if(H5Gunlink(fid,"/ZoneC80") < 0) TEST_ERROR
/* Close root group ID */
- if(H5Gclose(rootid)<0) TEST_ERROR;
+ if(H5Gclose(rootid) < 0) TEST_ERROR
/* Free memory */
HDfree(gids);
@@ -1845,48 +1797,46 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_resurrect_dataset(void)
+test_resurrect_dataset(hid_t fapl)
{
- hid_t f=-1, s=-1, d=-1, fapl=-1;
+ hid_t f=-1, s=-1, d=-1;
char filename[1024];
TESTING("resurrecting dataset after deletion");
/* Create file */
- fapl = h5_fileaccess();
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
/* Create the file */
- if((f = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((f = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a dataset in the file */
- if((s = H5Screate(H5S_SCALAR))<0) TEST_ERROR;
- if((d = H5Dcreate(f, DATASETNAME, H5T_NATIVE_INT, s, H5P_DEFAULT))<0) TEST_ERROR;
- if(H5Sclose(s)<0) TEST_ERROR;
+ if((s = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+ if((d = H5Dcreate(f, DATASETNAME, H5T_NATIVE_INT, s, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Sclose(s) < 0) TEST_ERROR
/* Unlink the dataset while it's open (will mark it for deletion when closed) */
- if(H5Gunlink(f, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink(f, DATASETNAME) < 0) TEST_ERROR
/* Check that dataset name is NULL */
- if(H5Iget_name(d, NULL, 0) != 0) TEST_ERROR;
+ if(H5Iget_name(d, NULL, (size_t)0) != 0) TEST_ERROR
/* Re-link the dataset to the group hierarchy (shouldn't get deleted now) */
- if(H5Glink2(d, ".", H5L_LINK_HARD, f, DATASET2NAME)<0) TEST_ERROR;
+ if(H5Glink2(d, ".", H5L_TYPE_HARD, f, DATASET2NAME) < 0) TEST_ERROR
/* Close things */
- if(H5Dclose(d)<0) TEST_ERROR;
- if(H5Fclose(f)<0) TEST_ERROR;
+ if(H5Dclose(d) < 0) TEST_ERROR
+ if(H5Fclose(f) < 0) TEST_ERROR
/* Re-open the file */
- if((f=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) TEST_ERROR;
+ if((f=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Attempt to open the dataset under the new name */
- if((d=H5Dopen(f,DATASET2NAME))<0) TEST_ERROR;
+ if((d=H5Dopen(f,DATASET2NAME)) < 0) TEST_ERROR
/* Close things */
- if(H5Dclose(d)<0) TEST_ERROR;
- if(H5Fclose(f)<0) TEST_ERROR;
- if(H5Pclose(fapl)<0) TEST_ERROR;
+ if(H5Dclose(d) < 0) TEST_ERROR
+ if(H5Fclose(f) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1896,7 +1846,6 @@ error:
H5Sclose(s);
H5Dclose(d);
H5Fclose(f);
- H5Pclose(fapl);
} H5E_END_TRY;
return 1;
} /* end test_resurrect_dataset() */
@@ -1919,46 +1868,45 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_resurrect_datatype(void)
+test_resurrect_datatype(hid_t fapl)
{
- hid_t file=-1, type=-1, fapl=-1;
+ hid_t file=-1, type=-1;
char filename[1024];
TESTING("resurrecting datatype after deletion");
/* Create file */
- fapl = h5_fileaccess();
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
/* Create the file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a named datatype in the file */
- if((type = H5Tcopy (H5T_NATIVE_INT))<0) TEST_ERROR;
- if(H5Tcommit (file, TYPENAME, type)<0) TEST_ERROR;
+ if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit (file, TYPENAME, type) < 0) TEST_ERROR
/* Unlink the datatype while it's open (will mark it for deletion when closed) */
- if(H5Gunlink(file, TYPENAME)<0) TEST_ERROR;
+ if(H5Gunlink(file, TYPENAME) < 0) TEST_ERROR
/* Check that datatype name is NULL */
- if(H5Iget_name(type, NULL, 0) != 0) TEST_ERROR;
+ if(H5Iget_name(type, NULL, (size_t)0) != 0) TEST_ERROR
/* Re-link the datatype to the group hierarchy (shouldn't get deleted now) */
- if(H5Glink2(type, ".", H5L_LINK_HARD, file, TYPE2NAME) < 0) TEST_ERROR;
+ if(H5Glink2(type, ".", H5L_TYPE_HARD, file, TYPE2NAME) < 0) TEST_ERROR
/* Close things */
- if(H5Tclose(type)<0) TEST_ERROR;
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Tclose(type) < 0) TEST_ERROR
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Re-open the file */
- if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) TEST_ERROR;
+ if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Attempt to open the datatype under the new name */
- if((type=H5Topen(file,TYPE2NAME))<0) TEST_ERROR;
+ if((type=H5Topen(file,TYPE2NAME)) < 0) TEST_ERROR
/* Close things */
- if(H5Tclose(type)<0) TEST_ERROR;
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Tclose(type) < 0) TEST_ERROR
+ if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
return 0;
@@ -1989,45 +1937,44 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_resurrect_group(void)
+test_resurrect_group(hid_t fapl)
{
- hid_t file=-1, group=-1, fapl=-1;
+ hid_t file=-1, group=-1;
char filename[1024];
TESTING("resurrecting group after deletion");
/* Create file */
- fapl = h5_fileaccess();
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
/* Create the file */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create a group in the file */
- if((group = H5Gcreate (file, GROUPNAME, 0))<0) TEST_ERROR;
+ if((group = H5Gcreate (file, GROUPNAME, (size_t)0)) < 0) TEST_ERROR
/* Unlink the group while it's open (will mark it for deletion when closed) */
- if(H5Gunlink(file, GROUPNAME)<0) TEST_ERROR;
+ if(H5Gunlink(file, GROUPNAME) < 0) TEST_ERROR
/* Check that group's name is NULL */
- if(H5Iget_name(group, NULL, 0) != 0) TEST_ERROR;
+ if(H5Iget_name(group, NULL, (size_t)0) != 0) TEST_ERROR
/* Re-link the group into the group hierarchy (shouldn't get deleted now) */
- if(H5Glink2(group, ".", H5L_LINK_HARD, file, GROUP2NAME)<0) TEST_ERROR;
+ if(H5Glink2(group, ".", H5L_TYPE_HARD, file, GROUP2NAME) < 0) TEST_ERROR
/* Close things */
- if(H5Gclose(group)<0) TEST_ERROR;
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Gclose(group) < 0) TEST_ERROR
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Re-open the file */
- if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) TEST_ERROR;
+ if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Attempt to open the datatype under the new name */
- if((group=H5Gopen(file,GROUP2NAME))<0) TEST_ERROR;
+ if((group=H5Gopen(file,GROUP2NAME)) < 0) TEST_ERROR
/* Close things */
- if(H5Gclose(group)<0) TEST_ERROR;
- if(H5Fclose(file)<0) TEST_ERROR;
+ if(H5Gclose(group) < 0) TEST_ERROR
+ if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2057,9 +2004,8 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_unlink_chunked_dataset(void)
+test_unlink_chunked_dataset(hid_t fapl)
{
- hid_t fapl_id=-1;
hid_t file_id=-1;
hid_t dset_id=-1;
hid_t space_id=-1;
@@ -2072,50 +2018,46 @@ test_unlink_chunked_dataset(void)
TESTING("unlinking chunked dataset");
/* Create file */
- fapl_id = h5_fileaccess();
- h5_fixname(FILENAME[9], fapl_id, filename, sizeof filename);
+ h5_fixname(FILENAME[9], fapl, filename, sizeof filename);
/* Create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id))<0) TEST_ERROR;
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create the dataspace */
- if((space_id=H5Screate_simple(FILESPACE_NDIMS,dims,max_dims))<0) TEST_ERROR;
+ if((space_id=H5Screate_simple(FILESPACE_NDIMS,dims,max_dims)) < 0) TEST_ERROR
/* Create the dataset creation filter */
- if((dcpl_id=H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR;
+ if((dcpl_id=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
/* Set to chunked storage */
- if(H5Pset_chunk(dcpl_id,FILESPACE_NDIMS,chunk_dims)<0) TEST_ERROR;
+ if(H5Pset_chunk(dcpl_id,FILESPACE_NDIMS,chunk_dims) < 0) TEST_ERROR
/* Set to early space allocation */
- if(H5Pset_alloc_time(dcpl_id,H5D_ALLOC_TIME_EARLY)<0) TEST_ERROR;
+ if(H5Pset_alloc_time(dcpl_id,H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR
/* Create the dataset */
- if((dset_id = H5Dcreate(file_id,DATASETNAME,H5T_NATIVE_INT,space_id,dcpl_id))<0) TEST_ERROR;
+ if((dset_id = H5Dcreate(file_id,DATASETNAME,H5T_NATIVE_INT,space_id,dcpl_id)) < 0) TEST_ERROR
/* Close the dataspace */
- if(H5Sclose(space_id)<0) TEST_ERROR;
+ if(H5Sclose(space_id) < 0) TEST_ERROR
/* Close the dataset creation property list */
- if(H5Pclose(dcpl_id)<0) TEST_ERROR;
+ if(H5Pclose(dcpl_id) < 0) TEST_ERROR
/* Close the dataset */
- if(H5Dclose(dset_id)<0) TEST_ERROR;
+ if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id)<0) TEST_ERROR;
+ if(H5Fclose(file_id) < 0) TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id))<0) TEST_ERROR;
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Delete the dataset */
- if(H5Gunlink(file_id, DATASETNAME)<0) TEST_ERROR;
+ if(H5Gunlink(file_id, DATASETNAME) < 0) TEST_ERROR
/* Close the file */
- if(H5Fclose(file_id)<0) TEST_ERROR;
-
- /* Close the file access property list */
- if(H5Pclose(fapl_id)<0) TEST_ERROR;
+ if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
return 0;
@@ -2126,12 +2068,10 @@ error:
H5Sclose(space_id);
H5Dclose(dset_id);
H5Fclose(file_id);
- H5Pclose(fapl_id);
} H5E_END_TRY;
return 1;
} /* end test_unlink_chunked_dataset() */
-#ifdef H5_GROUP_REVISION
/*-------------------------------------------------------------------------
* Function: test_full_group_compact
@@ -2147,9 +2087,8 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_full_group_compact(void)
+test_full_group_compact(hid_t fapl)
{
- hid_t fapl_id = -1;
hid_t file_id = -1;
hid_t gid = -1, gid2 = -1; /* Group IDs */
H5G_stat_t sb; /* Stat buffer for object */
@@ -2162,12 +2101,11 @@ test_full_group_compact(void)
TESTING("unlinking non-empty compact group");
- /* Create file */
- fapl_id = h5_fileaccess();
- h5_fixname(FILENAME[10], fapl_id, filename, sizeof filename);
+ /* Create filename */
+ h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id))<0) TEST_ERROR
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to link objects to */
if((gid = H5Gcreate(file_id, "/keep", (size_t)0)) < 0) TEST_ERROR
@@ -2189,22 +2127,22 @@ test_full_group_compact(void)
if((keep_size = h5_get_file_size(filename)) == 0) TEST_ERROR
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Create group to delete */
- if((gid = H5Gcreate(file_id, "/delete", (size_t)0)) < 0) goto error;
+ if((gid = H5Gcreate(file_id, "/delete", (size_t)0)) < 0) TEST_ERROR
/* Create external link (doesn't matter if it dangles) */
if(H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create soft link (doesn't matter if it dangles) */
- if(H5Glink2(file_id, "/foo", H5L_LINK_SOFT, gid, "soft") < 0) TEST_ERROR
+ if(H5Glink2(file_id, "/foo", H5L_TYPE_SOFT, gid, "soft") < 0) TEST_ERROR
/* Create hard links to objects in group to keep */
for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
sprintf(objname, "/keep/keep %u\n", u);
sprintf(objname2, "keep %u\n", u);
- if(H5Glink2(file_id, objname, H5L_LINK_HARD, gid, objname2) < 0) TEST_ERROR
+ if(H5Glink2(file_id, objname, H5L_TYPE_HARD, gid, objname2) < 0) TEST_ERROR
} /* end for */
/* Create several objects to delete */
@@ -2215,9 +2153,9 @@ test_full_group_compact(void)
} /* end for */
/* Check on group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, NULL) != TRUE) TEST_ERROR;
- if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, NULL) != TRUE) TEST_ERROR
+ if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR
/* Close group with objects to delete */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -2234,7 +2172,7 @@ test_full_group_compact(void)
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Delete the full group */
if(H5Gunlink(file_id, "/delete") < 0) TEST_ERROR
@@ -2255,9 +2193,6 @@ test_full_group_compact(void)
/* Verify the file is correct size */
if(file_size != keep_size) TEST_ERROR
- /* Close the file access property list */
- if(H5Pclose(fapl_id) < 0) TEST_ERROR
-
PASSED();
return 0;
@@ -2266,7 +2201,6 @@ error:
H5Gclose(gid2);
H5Gclose(gid);
H5Fclose(file_id);
- H5Pclose(fapl_id);
} H5E_END_TRY;
return 1;
} /* end test_full_group_compact() */
@@ -2286,25 +2220,26 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_full_group_dense(void)
+test_full_group_dense(hid_t fapl)
{
- hid_t fapl_id = -1;
hid_t file_id = -1;
+ hid_t gcpl = (-1); /* Group creation property list ID */
hid_t gid = -1, gid2 = -1; /* Group IDs */
H5G_stat_t sb; /* Stat buffer for object */
char objname[128]; /* Buffer for name of objects to create */
char objname2[128]; /* Buffer for name of objects to create */
char filename[1024]; /* Buffer for filename */
+ off_t keep_size; /* Size of the file with objects to keep */
+ off_t file_size; /* Size of each file created */
unsigned u; /* Local index variable */
TESTING("unlinking non-empty dense group");
- /* Create file */
- fapl_id = h5_fileaccess();
- h5_fixname(FILENAME[10], fapl_id, filename, sizeof filename);
+ /* Create filename */
+ h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Create the file */
- if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id))<0) TEST_ERROR
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group to link objects to */
if((gid = H5Gcreate(file_id, "/keep", (size_t)0)) < 0) TEST_ERROR
@@ -2319,20 +2254,42 @@ test_full_group_dense(void)
/* Close group with objects to keep */
if(H5Gclose(gid) < 0) TEST_ERROR
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ /* Get the size of the file with only the objects to keep */
+ if((keep_size = h5_get_file_size(filename)) == 0) TEST_ERROR
+
+ /* Re-open the file */
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+
+ /* Set group creation "est. link info" closer to what will actually occur */
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_est_link_info(gcpl, FULL_GROUP_EST_NUM_ENTRIES, FULL_GROUP_EST_ENTRY_LEN) < 0) TEST_ERROR
+
/* Create group to delete */
- if((gid = H5Gcreate(file_id, "/delete", (size_t)0)) < 0) goto error;
+ /* (use non-default GCPL, in order to make certain that the group's object
+ * header is large enough to hold the links inserted without allocating
+ * another object header message chunk - in order to make the file size
+ * computation below easier/correct - QAK)
+ */
+ if((gid = H5Gcreate_expand(file_id, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Llink(file_id, "/delete", gid, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close GCPL */
+ if(H5Pclose(gcpl) < 0) TEST_ERROR
/* Create external link (doesn't matter if it dangles) */
if(H5Lcreate_external("foo.h5", "/dst", gid, "external", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create soft link (doesn't matter if it dangles) */
- if(H5Glink2(file_id, "/foo", H5L_LINK_SOFT, gid, "soft") < 0) TEST_ERROR
+ if(H5Glink2(file_id, "/foo", H5L_TYPE_SOFT, gid, "soft") < 0) TEST_ERROR
/* Create hard links to objects in group to keep */
for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
sprintf(objname, "/keep/keep %u\n", u);
sprintf(objname2, "keep %u\n", u);
- if(H5Glink2(file_id, objname, H5L_LINK_HARD, gid, objname2) < 0) TEST_ERROR
+ if(H5Glink2(file_id, objname, H5L_TYPE_HARD, gid, objname2) < 0) TEST_ERROR
} /* end for */
/* Create several objects to delete */
@@ -2343,9 +2300,9 @@ test_full_group_dense(void)
} /* end for */
/* Check on group's status */
- if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR;
- if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR;
- if(H5G_has_stab_test(gid) != TRUE) TEST_ERROR;
+ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
+ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
+ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Close group with objects to delete */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -2362,7 +2319,7 @@ test_full_group_dense(void)
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Delete the full group */
if(H5Gunlink(file_id, "/delete") < 0) TEST_ERROR
@@ -2377,8 +2334,11 @@ test_full_group_dense(void)
/* Close the file */
if(H5Fclose(file_id) < 0) TEST_ERROR
- /* Close the file access property list */
- if(H5Pclose(fapl_id) < 0) TEST_ERROR
+ /* Get the size of the file */
+ if((file_size = h5_get_file_size(filename)) == 0) TEST_ERROR
+
+ /* Verify the file is correct size */
+ if(file_size != keep_size) TEST_ERROR
PASSED();
return 0;
@@ -2387,12 +2347,11 @@ error:
H5E_BEGIN_TRY {
H5Gclose(gid2);
H5Gclose(gid);
+ H5Pclose(gcpl);
H5Fclose(file_id);
- H5Pclose(fapl_id);
} H5E_END_TRY;
return 1;
} /* end test_full_group_dense() */
-#endif /* H5_GROUP_REVISION */
/*-------------------------------------------------------------------------
@@ -2414,16 +2373,18 @@ error:
int
main(void)
{
- hid_t fapl, fapl2, file;
- int nerrors = 0;
- char filename[1024];
const char *envval = NULL;
/* Don't run this test using the wrong file drivers */
envval = HDgetenv("HDF5_DRIVER");
- if (envval == NULL)
+ if(envval == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) {
+ if(HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) {
+ hid_t fapl, fapl2, file;
+ int nerrors = 0;
+ char filename[1024];
+ hbool_t new_format;
+
/* Metadata cache parameters */
int mdc_nelmts;
size_t rdcc_nelmts;
@@ -2436,61 +2397,95 @@ main(void)
/* Open */
h5_reset();
fapl = h5_fileaccess();
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
-
- /* Make copy of regular fapl, to turn down the elements in the metadata cache */
- if((fapl2=H5Pcopy(fapl))<0)
- goto error;
-
- /* Get FAPL cache settings */
- if(H5Pget_cache(fapl2,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0)<0)
- printf("H5Pget_cache failed\n");
-
- /* Change FAPL cache settings */
- mdc_nelmts=1;
- if(H5Pset_cache(fapl2,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0)<0)
- printf("H5Pset_cache failed\n");
-
- /* Tests */
- nerrors += test_one(file);
- nerrors += test_many(file);
- nerrors += test_symlink(file);
- nerrors += test_rename(file);
- nerrors += test_new_move();
- nerrors += check_new_move();
- nerrors += test_filespace();
-
- /* Test creating & unlinking lots of objects with default FAPL */
- nerrors += test_create_unlink("create and unlink large number of objects",fapl);
- /* Test creating & unlinking lots of objects with a 1-element metadata cache FAPL */
- nerrors += test_create_unlink("create and unlink large number of objects with small cache",fapl2);
-
- nerrors += test_link_slashes();
- nerrors += test_unlink_slashes();
-
- /* Test specific B-tree removal issues */
- nerrors += test_unlink_rightleaf(file);
- nerrors += test_unlink_rightnode(file);
- nerrors += test_unlink_middlenode(file);
-
- /* Test "resurrecting" objects */
- nerrors += test_resurrect_dataset();
- nerrors += test_resurrect_datatype();
- nerrors += test_resurrect_group();
-
- /* Test unlinking chunked datasets */
- nerrors += test_unlink_chunked_dataset();
-
-#ifdef H5_GROUP_REVISION
- /* Test unlinked groups which still have objects in them */
- nerrors += test_full_group_compact();
- nerrors += test_full_group_dense();
-#endif /* H5_GROUP_REVISION */
-
- /* Close */
- if (H5Pclose(fapl2)<0) TEST_ERROR;
- if (H5Fclose(file)<0) TEST_ERROR;
+
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ puts("\nTesting with new group format:");
+ my_fapl = fapl2;
+ } /* end if */
+ else {
+ puts("Testing with old group format:");
+ my_fapl = fapl;
+ } /* end else */
+
+ h5_fixname(FILENAME[0], my_fapl, filename, sizeof filename);
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+
+ /* Tests */
+ nerrors += test_one(file);
+ nerrors += test_many(file);
+ nerrors += test_symlink(file);
+ nerrors += test_rename(file);
+
+ nerrors += test_new_move(my_fapl);
+ nerrors += check_new_move(my_fapl);
+ nerrors += test_filespace(my_fapl);
+
+ /* Test creating & unlinking lots of objects with default FAPL */
+ nerrors += test_create_unlink("create and unlink large number of objects", my_fapl);
+
+ {
+ hid_t fapl_small_mdc;
+
+ /* Make copy of regular fapl, to turn down the elements in the metadata cache */
+ if((fapl_small_mdc = H5Pcopy(my_fapl)) < 0)
+ goto error;
+
+ /* Get FAPL cache settings */
+ if(H5Pget_cache(fapl_small_mdc, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
+ printf("H5Pget_cache failed\n");
+
+ /* Change FAPL cache settings */
+ mdc_nelmts=1;
+ if(H5Pset_cache(fapl_small_mdc, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
+ printf("H5Pset_cache failed\n");
+
+ /* Test creating & unlinking lots of objects with a 1-element metadata cache FAPL */
+ nerrors += test_create_unlink("create and unlink large number of objects with small cache", fapl_small_mdc);
+
+ if(H5Pclose(fapl_small_mdc) < 0) TEST_ERROR
+ } /* end block */
+
+ nerrors += test_link_slashes(my_fapl);
+ nerrors += test_unlink_slashes(my_fapl);
+
+ /* Test specific B-tree removal issues */
+ /* (only for old format groups) */
+ if(!new_format) {
+ nerrors += test_unlink_rightleaf(file);
+ nerrors += test_unlink_rightnode(file);
+ nerrors += test_unlink_middlenode(file);
+ } /* end if */
+
+ /* Test "resurrecting" objects */
+ nerrors += test_resurrect_dataset(my_fapl);
+ nerrors += test_resurrect_datatype(my_fapl);
+ nerrors += test_resurrect_group(my_fapl);
+
+ /* Test unlinking chunked datasets */
+ nerrors += test_unlink_chunked_dataset(my_fapl);
+
+ /* Test unlinked groups which still have objects in them */
+ /* (only for new format groups) */
+ if(new_format) {
+ nerrors += test_full_group_compact(my_fapl);
+ nerrors += test_full_group_dense(my_fapl);
+ } /* end if */
+
+ /* Close */
+ if(H5Fclose(file) < 0) TEST_ERROR
+ } /* end for */
+
if (nerrors) {
printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S");
exit(1);
@@ -2500,11 +2495,11 @@ main(void)
h5_cleanup(FILENAME, fapl);
}
else
- {
puts("All unlink tests skipped - Incompatible with current Virtual File Driver");
- }
+
return 0;
- error:
- return 1;
+error:
+ return 1;
}
+
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 1811b9d..ac2fb65 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -49,8 +49,8 @@ static hid_t UD_traverse(UNUSED const char * link_name, UNUSED hid_t cur_group,
{
return -1;
}
-const H5L_link_class_t UD_link_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_link_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
MY_LINKCLASS, /* Link type id number */
"UD link class", /* name for debugging */
NULL, /* Creation callback */
@@ -2242,8 +2242,8 @@ int test_types(const char *file1,
*-------------------------------------------------------------------------
*/
- status = H5Glink(fid1, H5L_LINK_SOFT, "g1", "l1");
- status = H5Glink(fid1, H5L_LINK_SOFT, "g2", "l2");
+ status = H5Glink(fid1, H5L_TYPE_SOFT, "g1", "l1");
+ status = H5Glink(fid1, H5L_TYPE_SOFT, "g2", "l2");
/*-------------------------------------------------------------------------
* H5G_UDLINK
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 3d1d2cd..979ddc9 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1544,9 +1544,9 @@ dump_all(hid_t group, const char *name, void * op_data)
case H5G_UDLINK:
{
indentation(indent);
- switch(linfo.linkclass)
+ switch(linfo.type)
{
- case H5L_LINK_EXTERNAL:
+ case H5L_TYPE_EXTERNAL:
{
char *targbuf;
char *filename;
@@ -1569,7 +1569,7 @@ dump_all(hid_t group, const char *name, void * op_data)
} else {
if (!doxml) {
indentation(indent + COL);
- printf("LINKCLASS %d\n", linfo.linkclass);
+ printf("LINKCLASS %d\n", linfo.type);
indentation(indent + COL);
printf("TARGETFILE \"%s\"\n", filename);
indentation(indent + COL);
@@ -1625,7 +1625,7 @@ dump_all(hid_t group, const char *name, void * op_data)
indentation(indent + COL);
}
if (!doxml) {
- printf("LINKCLASS %d\n", linfo.linkclass);
+ printf("LINKCLASS %d\n", linfo.type);
}
else /* XML */
{
@@ -1648,7 +1648,7 @@ dump_all(hid_t group, const char *name, void * op_data)
t_name, /* LinkName */
linkxid, /* OBJ-XID */
t_obj_path, /* H5SourcePath */
- linfo.linkclass, /* LinkClass */
+ linfo.type, /* LinkClass */
parentxid, /* Parents */
t_prefix); /* H5ParentPaths */
HDfree(t_prefix);
@@ -3237,14 +3237,14 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
begin_obj(dump_header_format->udlinkbegin, links,
dump_header_format->udlinkblockbegin);
indentation(COL);
- switch(linfo.linkclass) {
- case H5L_LINK_EXTERNAL:
+ switch(linfo.type) {
+ case H5L_TYPE_EXTERNAL:
begin_obj(dump_header_format->extlinkbegin, links,
dump_header_format->extlinkblockbegin);
if (H5Lget_linkval(fid, links, statbuf.linklen, buf, H5P_DEFAULT) >= 0) {
if(H5Lunpack_elink_val(buf, &elink_file, &elink_path)>=0) {
indentation(COL);
- printf("LINKCLASS %d\n", linfo.linkclass);
+ printf("LINKCLASS %d\n", linfo.type);
indentation(COL);
printf("TARGETFILE \"%s\"\n", elink_file);
indentation(COL);
@@ -3266,7 +3266,7 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
begin_obj(dump_header_format->udlinkbegin, links,
dump_header_format->udlinkblockbegin);
indentation(COL);
- printf("LINKCLASS %d\n", linfo.linkclass);
+ printf("LINKCLASS %d\n", linfo.type);
end_obj(dump_header_format->udlinkend,
dump_header_format->udlinkblockend);
}
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 572558f..70372da 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -131,8 +131,8 @@ return -1;
#define MY_LINKCLASS 187
-const H5L_link_class_t UD_link_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_link_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
MY_LINKCLASS, /* Link type id number */
"UD link class", /* name for debugging */
NULL, /* Creation callback */
@@ -426,8 +426,8 @@ static void gent_softlink(void)
fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen (fid, "/");
- H5Glink (root, H5L_LINK_SOFT, "somevalue", "slink1");
- H5Glink (root, H5L_LINK_SOFT, "linkvalue", "slink2");
+ H5Glink (root, H5L_TYPE_SOFT, "somevalue", "slink1");
+ H5Glink (root, H5L_TYPE_SOFT, "linkvalue", "slink2");
H5Gclose(root);
H5Fclose(fid);
@@ -464,15 +464,15 @@ static void gent_hardlink(void)
H5Dclose(dataset);
group = H5Gcreate (fid, "/g1", 0);
- H5Glink (group, H5L_LINK_HARD, "/dset1", "dset2");
+ H5Glink (group, H5L_TYPE_HARD, "/dset1", "dset2");
H5Gclose(group);
group = H5Gcreate (fid, "/g2", 0);
- H5Glink (group, H5L_LINK_HARD, "/dset1", "dset3");
+ H5Glink (group, H5L_TYPE_HARD, "/dset1", "dset3");
H5Gclose(group);
group = H5Gopen(fid, "/g1");
- H5Glink (group, H5L_LINK_HARD, "/g2", "g1.1");
+ H5Glink (group, H5L_TYPE_HARD, "/g2", "g1.1");
H5Gclose(group);
H5Fclose(fid);
}
@@ -888,13 +888,14 @@ g2 : dset2.1 dset2.2 udlink
*/
-static void gent_all(void) {
-hid_t fid, group, attr, dataset, space;
-hsize_t dims[2];
-int data[2][2], dset1[10][10], dset2[20];
-char buf[60];
-int i, j;
-float dset2_1[10], dset2_2[3][5];
+static void gent_all(void)
+{
+ hid_t fid, group, attr, dataset, space;
+ hsize_t dims[2];
+ int data[2][2], dset1[10][10], dset2[20];
+ char buf[60];
+ int i, j;
+ float dset2_1[10], dset2_2[3][5];
fid = H5Fcreate(FILE7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -983,7 +984,7 @@ float dset2_1[10], dset2_2[3][5];
/* soft link */
group = H5Gopen (fid, "/g1/g1.2/g1.2.1");
- H5Glink (group, H5L_LINK_SOFT, "somevalue", "slink");
+ H5Glink (group, H5L_TYPE_SOFT, "somevalue", "slink");
H5Gclose(group);
group = H5Gopen (fid, "/g2");
@@ -1040,8 +1041,8 @@ hid_t fid, group;
group = H5Gcreate (fid, "/g2", 0);
H5Gclose(group);
- H5Glink(fid, H5L_LINK_HARD, "/g2", "/g1/g1.1");
- H5Glink(fid, H5L_LINK_HARD, "/g1", "/g2/g2.1");
+ H5Glink(fid, H5L_TYPE_HARD, "/g2", "/g1/g1.1");
+ H5Glink(fid, H5L_TYPE_HARD, "/g1", "/g2/g2.1");
H5Fclose(fid);
}
@@ -1060,10 +1061,10 @@ hid_t fid, group;
H5Gclose(group);
/* create path from object at /g1 to object at /g2 and name it g1.1 */
- H5Glink (fid, H5L_LINK_HARD, "/g2", "/g1/g1.1");
+ H5Glink (fid, H5L_TYPE_HARD, "/g2", "/g1/g1.1");
/* create path from object at /g2 to object at /g1 and name it g2.1 */
- H5Glink (fid, H5L_LINK_SOFT, "/g1", "/g2/g2.1");
+ H5Glink (fid, H5L_TYPE_SOFT, "/g1", "/g2/g2.1");
H5Fclose(fid);
@@ -1080,7 +1081,8 @@ hid_t fid, group;
(dset1) (udlink)
*/
-static void gent_many(void) {
+static void gent_many(void)
+{
hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
hid_t array_dt;
hsize_t dims[2];
@@ -1210,11 +1212,11 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gcreate (fid, "/g1/g1.2", 0);
- H5Glink (group, H5L_LINK_HARD, "/g1/g1.1/dset1", "link1");
+ H5Glink (group, H5L_TYPE_HARD, "/g1/g1.1/dset1", "link1");
H5Gclose(group);
group = H5Gcreate (fid, "/g2", 0);
- H5Glink (group, H5L_LINK_SOFT, "/g1", "slink2");
+ H5Glink (group, H5L_TYPE_SOFT, "/g1", "slink2");
H5Gclose(group);
group = H5Gcreate (fid, "/g3", 0);
@@ -1238,7 +1240,7 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gopen(fid, "/g3");
- H5Glink (group, H5L_LINK_HARD, "/g4/dset2", "link3");
+ H5Glink (group, H5L_TYPE_HARD, "/g4/dset2", "link3");
H5Gclose(group);
group = H5Gcreate (fid, "/g5", 0);
@@ -1261,7 +1263,7 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gopen(fid, "/g5");
- H5Glink (group, H5L_LINK_SOFT, "/g6/dset3", "slink4");
+ H5Glink (group, H5L_TYPE_SOFT, "/g6/dset3", "slink4");
H5Gclose(group);
H5Pclose(create_plist);
@@ -1276,14 +1278,15 @@ static void gent_many(void) {
H5Lcreate_ud(fid, "/g8/udlink", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
/* Create links to external and UD links */
- ret= H5Glink (fid, H5L_LINK_SOFT, "/g8/elink", "/g7/slink5");
+ ret= H5Glink (fid, H5L_TYPE_SOFT, "/g8/elink", "/g7/slink5");
HDassert(ret >= 0);
- ret= H5Glink (fid, H5L_LINK_SOFT, "/g8/udlink", "/g7/slink6");
+ ret= H5Glink (fid, H5L_TYPE_SOFT, "/g8/udlink", "/g7/slink6");
HDassert(ret >= 0);
H5Fclose(fid);
}
+
static hid_t mkstr(int size, H5T_str_t pad) {
hid_t type;
@@ -5003,39 +5006,39 @@ static void gent_fcontents(void)
/* hard link to "dset" */
gid1 = H5Gcreate (fid, "/g1", 0);
- H5Glink (gid1, H5L_LINK_HARD, "/dset", "dset1");
+ H5Glink (gid1, H5L_TYPE_HARD, "/dset", "dset1");
H5Gclose(gid1);
/* hard link to "dset" */
gid1 = H5Gcreate (fid, "/g2", 0);
- H5Glink (gid1, H5L_LINK_HARD, "/dset", "dset2");
+ H5Glink (gid1, H5L_TYPE_HARD, "/dset", "dset2");
H5Gclose(gid1);
/* hard link to "g2" */
gid1 = H5Gopen(fid, "/g1");
- H5Glink (gid1, H5L_LINK_HARD, "/g2", "g1.1");
+ H5Glink (gid1, H5L_TYPE_HARD, "/g2", "g1.1");
H5Gclose(gid1);
/* hard link to "dset" */
- ret=H5Glink (fid, H5L_LINK_HARD, "/dset", "dset3");
+ ret=H5Glink (fid, H5L_TYPE_HARD, "/dset", "dset3");
assert(ret>=0);
/* hard link to "dset" */
- ret=H5Glink (fid, H5L_LINK_HARD, "/dset", "dset4");
+ ret=H5Glink (fid, H5L_TYPE_HARD, "/dset", "dset4");
assert(ret>=0);
/* soft link to itself */
- ret=H5Glink (fid, H5L_LINK_SOFT, "mylink", "mylink");
+ ret=H5Glink (fid, H5L_TYPE_SOFT, "mylink", "mylink");
assert(ret>=0);
/* soft link to "dset" */
- ret=H5Glink (fid, H5L_LINK_SOFT, "/dset", "softlink");
+ ret=H5Glink (fid, H5L_TYPE_SOFT, "/dset", "softlink");
assert(ret>=0);
/* dangling external link */
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c
index dd80c29..1f47bea 100644
--- a/tools/h5jam/h5jamgentest.c
+++ b/tools/h5jam/h5jamgentest.c
@@ -121,17 +121,18 @@ typedef struct s1_t {
#define VLSTR_TYPE "vl_string_type"
/* A UD link traversal function. Shouldn't actually be called. */
-static hid_t UD_traverse(const char * link_name, hid_t cur_group, void * udata, size_t udata_size, hid_t lapl_id)
+static hid_t UD_traverse(const char UNUSED * link_name, hid_t UNUSED cur_group, void UNUSED * udata, size_t UNUSED udata_size, hid_t UNUSED lapl_id)
{
return -1;
}
#define MY_LINKCLASS 187
-const H5L_link_class_t UD_link_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+const H5L_class_t UD_link_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
MY_LINKCLASS, /* Link type id number */
"UD link class", /* name for debugging */
NULL, /* Creation callback */
NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
UD_traverse, /* The actual traversal function */
NULL, /* Deletion callback */
NULL /* Query callback */
@@ -156,21 +157,24 @@ g2 : dset2.1 dset2.2 udlink
*/
-static void gent_ub(const char * filename, int ub_size, int ub_fill) {
-hid_t fid, group, attr, dataset, space;
-hid_t create_plist;
-hsize_t dims[2];
-int data[2][2], dset1[10][10], dset2[20];
-char buf[BUF_SIZE];
-int i, j;
-float dset2_1[10], dset2_2[3][5];
-int fd;
-char *bp;
+static void
+gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
+{
+ hid_t fid, group, attr, dataset, space;
+ hid_t create_plist;
+ hsize_t dims[2];
+ int data[2][2], dset1[10][10], dset2[20];
+ char buf[BUF_SIZE];
+ int i, j;
+ size_t u;
+ float dset2_1[10], dset2_2[3][5];
+ int fd;
+ char *bp;
if(ub_size > 0)
{
create_plist = H5Pcreate(H5P_FILE_CREATE);
- H5Pset_userblock(create_plist,(hsize_t)ub_size);
+ H5Pset_userblock(create_plist, (hsize_t)ub_size);
fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT);
}
else
@@ -179,23 +183,23 @@ char *bp;
}
/* create groups */
- group = H5Gcreate (fid, "/g1", 0);
+ group = H5Gcreate(fid, "/g1", (size_t)0);
H5Gclose(group);
- group = H5Gcreate (fid, "/g2", 0);
+ group = H5Gcreate(fid, "/g2", (size_t)0);
H5Gclose(group);
- group = H5Gcreate (fid, "/g1/g1.1", 0);
+ group = H5Gcreate(fid, "/g1/g1.1", (size_t)0);
H5Gclose(group);
- group = H5Gcreate (fid, "/g1/g1.2", 0);
+ group = H5Gcreate(fid, "/g1/g1.2", (size_t)0);
H5Gclose(group);
- group = H5Gcreate (fid, "/g1/g1.2/g1.2.1", 0);
+ group = H5Gcreate(fid, "/g1/g1.2/g1.2.1", (size_t)0);
H5Gclose(group);
/* root attributes */
- group = H5Gopen (fid, "/");
+ group = H5Gopen(fid, "/");
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
@@ -263,7 +267,7 @@ char *bp;
/* soft link */
group = H5Gopen (fid, "/g1/g1.2/g1.2.1");
- H5Glink (group, H5L_LINK_SOFT, "somevalue", "slink");
+ H5Glink (group, H5L_TYPE_SOFT, "somevalue", "slink");
H5Gclose(group);
group = H5Gopen (fid, "/g2");
@@ -293,38 +297,37 @@ char *bp;
/* user-defined link */
H5Lregister(UD_link_class);
- H5Lcreate_ud(fid, "/g2/udlink", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_ud(fid, "/g2/udlink", MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
H5Fclose(fid);
/* If a user block is being used, write to it here */
if(ub_size > 0)
{
- HDassert(ub_size < BUF_SIZE);
+ HDassert(ub_size <= BUF_SIZE);
+
+ fd = HDopen(filename, O_RDWR, 0);
+ HDassert(fd >= 0);
- fd = HDopen(filename,O_RDWR, 0);
- if (fd < 0) {
- /* panic */
- }
/* fill buf with pattern */
- memset(buf,'\0',ub_size);
+ HDmemset(buf, '\0', ub_size);
bp = buf;
- for (i = 0; i < ub_fill; i++) {
- *bp++ = pattern[i%10];
- }
+ for (u = 0; u < ub_fill; u++)
+ *bp++ = pattern[u % 10];
- HDwrite(fd,buf,ub_size);
+ HDwrite(fd, buf, ub_size);
close(fd);
}
}
static void
-create_textfile(const char *name, size_t size) {
-char *buf;
-int fd;
-size_t i;
-char *bp;
+create_textfile(const char *name, size_t size)
+{
+ char *buf;
+ int fd;
+ size_t i;
+ char *bp;
#ifdef WIN32
fd = _creat(name, _S_IREAD | _S_IWRITE);
@@ -334,7 +337,7 @@ char *bp;
if (fd < 0) {
/* panic */
}
- buf = calloc(size,1);
+ buf = calloc(size, (size_t)1);
if (buf == NULL) {
/* panic */
}
@@ -353,29 +356,27 @@ char *bp;
#ifdef notdef
/* not used yet */
void
-create_binfile(char *name, off_t size) {
-char *buf;
-int fd;
-int i;
-char *bp;
+create_binfile(char *name, off_t size)
+{
+ char *buf;
+ int fd;
+ int i;
+ char *bp;
- fd = creat(name,0777);
- if (fd < 0) {
- /* panic */
- }
- buf = calloc(size,1);
- if (buf == NULL) {
- /* panic */
- }
- /* fill buf with pattern */
- bp = buf;
- for (i = 0; i < size; i++) {
- *bp++ = (char) i & 0xff;
- }
+ fd = creat(name,0777);
+ HDassert(fd >= 0);
- HDwrite(fd,buf,size);
+ buf = calloc(size,1);
+ HDassert(buf);
- close(fd);
+ /* fill buf with pattern */
+ bp = buf;
+ for (i = 0; i < size; i++)
+ *bp++ = (char) i & 0xff;
+
+ HDwrite(fd,buf,size);
+
+ close(fd);
}
#endif
@@ -390,30 +391,30 @@ int main(void)
{
/*
-create_textfile(UBTXT1,0);
+create_textfile(UBTXT1, (size_t)0);
*/
-create_textfile(UBTXT2,10);
-create_textfile(UBTXT3,511);
-create_textfile(UBTXT4,512);
-create_textfile(UBTXT5,513);
+create_textfile(UBTXT2, (size_t)10);
+create_textfile(UBTXT3, (size_t)511);
+create_textfile(UBTXT4, (size_t)512);
+create_textfile(UBTXT5, (size_t)513);
/*
-create_textfile(UBTXT6,1023);
-create_textfile(UBTXT7,1024);
-create_textfile(UBTXT8,1025);
-create_textfile(UBTXT9,2047);
-create_textfile(UBTXT10,2048);
-create_textfile(UBTXT11,2049);
-
-create_binfile(UBBIN1,0);
-create_binfile(UBBIN2,10);
-create_binfile(UBBIN3,511);
-create_binfile(UBBIN4,512);
-create_binfile(UBBIN5,513);
+create_textfile(UBTXT6, (size_t)1023);
+create_textfile(UBTXT7, (size_t)1024);
+create_textfile(UBTXT8, (size_t)1025);
+create_textfile(UBTXT9, (size_t)2047);
+create_textfile(UBTXT10, (size_t)2048);
+create_textfile(UBTXT11, (size_t)2049);
+
+create_binfile(UBBIN1, (off_t)0);
+create_binfile(UBBIN2, (off_t)10);
+create_binfile(UBBIN3, (off_t)511);
+create_binfile(UBBIN4, (off_t)512);
+create_binfile(UBBIN5, (off_t)513);
*/
- gent_ub(FILE7, 0, 0);
- gent_ub(FILE8, 512, strlen(pattern));
- gent_ub(FILE9, 1024, 513);
+ gent_ub(FILE7, (size_t)0, (size_t)0);
+ gent_ub(FILE8, (size_t)512, HDstrlen(pattern));
+ gent_ub(FILE9, (size_t)1024, (size_t)513);
return 0;
}
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index b568bc9..978baf2 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1770,10 +1770,10 @@ udlink_open(hid_t location, const char *name)
if(H5Lget_linkinfo(location, name, &linfo, H5P_DEFAULT) < 0) return -1;
- switch(linfo.linkclass)
+ switch(linfo.type)
{
/* For external links, try to display info for the object it points to */
- case H5L_LINK_EXTERNAL:
+ case H5L_TYPE_EXTERNAL:
if ((buf = HDmalloc(linfo.u.link_size))==NULL) goto error;
if (H5Lget_linkval (location, name, sizeof(buf), buf, H5P_DEFAULT)<0) goto error;
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 4884e04..73fb2fc 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -93,7 +93,7 @@ int do_copy_refobjs(hid_t fidin,
for ( j=0; j<travt->objs[i].nlinks; j++)
{
H5Glink(fidout,
- H5L_LINK_HARD,
+ H5L_TYPE_HARD,
travt->objs[i].name,
travt->objs[i].links[j].new_name);
}
@@ -339,7 +339,7 @@ int do_copy_refobjs(hid_t fidin,
{
for ( j=0; j<travt->objs[i].nlinks; j++){
H5Glink(fidout,
- H5L_LINK_HARD,
+ H5L_TYPE_HARD,
travt->objs[i].name,
travt->objs[i].links[j].new_name);
}
diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c
index ca0f0ca..244aaae 100644
--- a/tools/h5repack/testh5repack_dset.c
+++ b/tools/h5repack/testh5repack_dset.c
@@ -128,7 +128,7 @@ void write_dset_in(hid_t loc_id,
/* create hard link */
- status = H5Glink(loc_id, H5L_LINK_HARD, "string", "string_link");
+ status = H5Glink(loc_id, H5L_TYPE_HARD, "string", "string_link");
/*-------------------------------------------------------------------------
* H5T_BITFIELD
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c
index 5299cd4..e219497 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -36,7 +36,7 @@
const char *progname = "h5repacktst";
int d_status = EXIT_SUCCESS;
-int main (int argc, char **argv)
+int main (int argc, const char *argv[])
{
pack_opt_t pack_options;
diff_opt_t diff_options;
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index a74d466..e7a2948 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -259,7 +259,7 @@ int make_all_objects(hid_t loc_id)
*-------------------------------------------------------------------------
*/
- H5Glink(loc_id, H5L_LINK_SOFT, "dset", "link");
+ H5Glink(loc_id, H5L_TYPE_SOFT, "dset", "link");
/*-------------------------------------------------------------------------
* H5G_UDLINK
@@ -357,11 +357,11 @@ int make_hlinks(hid_t loc_id)
if (write_dset(loc_id,2,dims,"dset",H5T_NATIVE_INT,buf)<0)
return -1;
- if (H5Glink(loc_id, H5L_LINK_HARD, "dset", "link1 to dset")<0)
+ if (H5Glink(loc_id, H5L_TYPE_HARD, "dset", "link1 to dset")<0)
return -1;
- if (H5Glink(loc_id, H5L_LINK_HARD, "dset", "link2 to dset")<0)
+ if (H5Glink(loc_id, H5L_TYPE_HARD, "dset", "link2 to dset")<0)
return -1;
- if (H5Glink(loc_id, H5L_LINK_HARD, "dset", "link3 to dset")<0)
+ if (H5Glink(loc_id, H5L_TYPE_HARD, "dset", "link3 to dset")<0)
return -1;
@@ -377,9 +377,9 @@ int make_hlinks(hid_t loc_id)
if ((group3_id = H5Gcreate(group2_id,"g3",0))<0)
return -1;
- if (H5Glink2(loc_id, "g1", H5L_LINK_HARD, group2_id, "link1 to g1")<0)
+ if (H5Glink2(loc_id, "g1", H5L_TYPE_HARD, group2_id, "link1 to g1")<0)
return -1;
- if (H5Glink2(group1_id, "g2", H5L_LINK_HARD, group3_id, "link1 to g2")<0)
+ if (H5Glink2(group1_id, "g2", H5L_TYPE_HARD, group3_id, "link1 to g2")<0)
return -1;
H5Gclose(group1_id);
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 4fed814..c7f9265 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1085,7 +1085,7 @@ hsize_t diff (hid_t file1_id,
goto out;
/* Only external links will have a query function registered */
- if(li1.linkclass == H5L_LINK_EXTERNAL && li2.linkclass == H5L_LINK_EXTERNAL)
+ if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL)
{
buf1 = HDmalloc (li1.u.link_size);
buf2 = HDmalloc (li2.u.link_size);
@@ -1134,7 +1134,7 @@ hsize_t diff (hid_t file1_id,
/* If the link classes or the buffer length are not the
* same, the links are "different"
*/
- if((li1.linkclass != li2.linkclass) || (li1.u.link_size != li2.u.link_size))
+ if((li1.type != li2.type) || (li1.u.link_size != li2.u.link_size))
nfound = 1;
else
nfound = 0;
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 44553ee..8a6173c 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -511,7 +511,7 @@ static int traverse( hid_t loc_id,
H5Lget_linkinfo( loc_id, path, &linkbuf, H5P_DEFAULT);
} H5E_END_TRY;
- if(linkbuf.linkclass == H5L_LINK_EXTERNAL)
+ if(linkbuf.type == H5L_TYPE_EXTERNAL)
{
if (statbuf.linklen>0)
{
diff --git a/tools/misc/h5stat.c b/tools/misc/h5stat.c
index 15ab968..7d4045e 100644
--- a/tools/misc/h5stat.c
+++ b/tools/misc/h5stat.c
@@ -587,7 +587,11 @@ dataset_stats (hid_t group, const char *name, H5G_stat_t * _sb, iter_t *_iter)
if (nfltr == 0) iter->dset_comptype[0]++;
for (u=0; u < (unsigned) nfltr; u++) {
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0);
+#else /* H5_WANT_H5_V1_6_COMPAT */
fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0, NULL);
+#endif /* H5_WANT_H5_V1_6_COMPAT */
if (fltr < (H5_NFILTERS_IMPL-1))
iter->dset_comptype[fltr]++;
else
diff --git a/tools/testfiles/file3.h5 b/tools/testfiles/file3.h5
index a9eff83..99dee41 100644
--- a/tools/testfiles/file3.h5
+++ b/tools/testfiles/file3.h5
Binary files differ
diff --git a/tools/testfiles/tall-2A.h5.xml b/tools/testfiles/tall-2A.h5.xml
index 586afb5..b357397 100644
--- a/tools/testfiles/tall-2A.h5.xml
+++ b/tools/testfiles/tall-2A.h5.xml
@@ -40,9 +40,9 @@ Expected output for 'h5dump --xml -A tall.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Attribute>
- <hdf5:Group Name="g1" OBJ-XID="xid_792" H5Path="/g1" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:Group Name="g1.1" OBJ-XID="xid_2512" H5Path="/g1/g1.1" Parents="xid_792" H5ParentPaths="/g1" >
- <hdf5:Dataset Name="dset1.1.1" OBJ-XID="xid_5432" H5Path= "/g1/g1.1/dset1.1.1" Parents="xid_2512" H5ParentPaths="/g1/g1.1">
+ <hdf5:Group Name="g1" OBJ-XID="xid_808" H5Path="/g1" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:Group Name="g1.1" OBJ-XID="xid_2560" H5Path="/g1/g1.1" Parents="xid_808" H5ParentPaths="/g1" >
+ <hdf5:Dataset Name="dset1.1.1" OBJ-XID="xid_5528" H5Path= "/g1/g1.1/dset1.1.1" Parents="xid_2560" H5ParentPaths="/g1/g1.1">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -102,7 +102,7 @@ Expected output for 'h5dump --xml -A tall.h5'
<hdf5:NoData/>
</hdf5:Data>
</hdf5:Dataset>
- <hdf5:Dataset Name="dset1.1.2" OBJ-XID="xid_8272" H5Path= "/g1/g1.1/dset1.1.2" Parents="xid_2512" H5ParentPaths="/g1/g1.1">
+ <hdf5:Dataset Name="dset1.1.2" OBJ-XID="xid_8272" H5Path= "/g1/g1.1/dset1.1.2" Parents="xid_2560" H5ParentPaths="/g1/g1.1">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -126,15 +126,15 @@ Expected output for 'h5dump --xml -A tall.h5'
</hdf5:Data>
</hdf5:Dataset>
</hdf5:Group>
- <hdf5:Group Name="g1.2" OBJ-XID="xid_3536" H5Path="/g1/g1.2" Parents="xid_792" H5ParentPaths="/g1" >
- <hdf5:Group Name="g1.2.1" OBJ-XID="xid_4232" H5Path="/g1/g1.2/g1.2.1" Parents="xid_3536" H5ParentPaths="/g1/g1.2" >
- <hdf5:SoftLink LinkName="slink" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g1/g1.2/g1.2.1/slink" TargetPath="somevalue" Parents="xid_4232" H5ParentPaths="/g1/g1.2/g1.2.1" />
+ <hdf5:Group Name="g1.2" OBJ-XID="xid_3600" H5Path="/g1/g1.2" Parents="xid_808" H5ParentPaths="/g1" >
+ <hdf5:Group Name="g1.2.1" OBJ-XID="xid_4312" H5Path="/g1/g1.2/g1.2.1" Parents="xid_3600" H5ParentPaths="/g1/g1.2" >
+ <hdf5:SoftLink LinkName="slink" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g1/g1.2/g1.2.1/slink" TargetPath="somevalue" Parents="xid_4312" H5ParentPaths="/g1/g1.2/g1.2.1" />
</hdf5:Group>
- <hdf5:ExternalLink LinkName="extlink" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g1/g1.2/extlink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_3536" H5ParentPaths="/g1/g1.2" />
+ <hdf5:ExternalLink LinkName="extlink" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g1/g1.2/extlink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_3600" H5ParentPaths="/g1/g1.2" />
</hdf5:Group>
</hdf5:Group>
- <hdf5:Group Name="g2" OBJ-XID="xid_1816" H5Path="/g2" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:Dataset Name="dset2.1" OBJ-XID="xid_8872" H5Path= "/g2/dset2.1" Parents="xid_1816" H5ParentPaths="/g2">
+ <hdf5:Group Name="g2" OBJ-XID="xid_1848" H5Path="/g2" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:Dataset Name="dset2.1" OBJ-XID="xid_3688" H5Path= "/g2/dset2.1" Parents="xid_1848" H5ParentPaths="/g2">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -157,7 +157,7 @@ Expected output for 'h5dump --xml -A tall.h5'
<hdf5:NoData/>
</hdf5:Data>
</hdf5:Dataset>
- <hdf5:Dataset Name="dset2.2" OBJ-XID="xid_9472" H5Path= "/g2/dset2.2" Parents="xid_1816" H5ParentPaths="/g2">
+ <hdf5:Dataset Name="dset2.2" OBJ-XID="xid_8696" H5Path= "/g2/dset2.2" Parents="xid_1848" H5ParentPaths="/g2">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -181,7 +181,7 @@ Expected output for 'h5dump --xml -A tall.h5'
<hdf5:NoData/>
</hdf5:Data>
</hdf5:Dataset>
- <hdf5:UserDefined LinkName="udlink" OBJ-XID="xid_18446744073709551612" H5SourcePath="/g2/udlink" LinkClass="187" Parents="xid_1816" H5ParentPaths="/g2" />
+ <hdf5:UserDefined LinkName="udlink" OBJ-XID="xid_18446744073709551612" H5SourcePath="/g2/udlink" LinkClass="187" Parents="xid_1848" H5ParentPaths="/g2" />
</hdf5:Group>
</hdf5:RootGroup>
</hdf5:HDF5-File>
diff --git a/tools/testfiles/tall.h5 b/tools/testfiles/tall.h5
index 0ed5ed2..6d827af 100644
--- a/tools/testfiles/tall.h5
+++ b/tools/testfiles/tall.h5
Binary files differ
diff --git a/tools/testfiles/tall.h5.xml b/tools/testfiles/tall.h5.xml
index ce740fe..45497e6 100644
--- a/tools/testfiles/tall.h5.xml
+++ b/tools/testfiles/tall.h5.xml
@@ -40,9 +40,9 @@ Expected output for 'h5dump --xml tall.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Attribute>
- <hdf5:Group Name="g1" OBJ-XID="xid_792" H5Path="/g1" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:Group Name="g1.1" OBJ-XID="xid_2512" H5Path="/g1/g1.1" Parents="xid_792" H5ParentPaths="/g1" >
- <hdf5:Dataset Name="dset1.1.1" OBJ-XID="xid_5432" H5Path= "/g1/g1.1/dset1.1.1" Parents="xid_2512" H5ParentPaths="/g1/g1.1">
+ <hdf5:Group Name="g1" OBJ-XID="xid_808" H5Path="/g1" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:Group Name="g1.1" OBJ-XID="xid_2560" H5Path="/g1/g1.1" Parents="xid_808" H5ParentPaths="/g1" >
+ <hdf5:Dataset Name="dset1.1.1" OBJ-XID="xid_5528" H5Path= "/g1/g1.1/dset1.1.1" Parents="xid_2560" H5ParentPaths="/g1/g1.1">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -113,7 +113,7 @@ Expected output for 'h5dump --xml tall.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
- <hdf5:Dataset Name="dset1.1.2" OBJ-XID="xid_8272" H5Path= "/g1/g1.1/dset1.1.2" Parents="xid_2512" H5ParentPaths="/g1/g1.1">
+ <hdf5:Dataset Name="dset1.1.2" OBJ-XID="xid_8272" H5Path= "/g1/g1.1/dset1.1.2" Parents="xid_2560" H5ParentPaths="/g1/g1.1">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -139,15 +139,15 @@ Expected output for 'h5dump --xml tall.h5'
</hdf5:Data>
</hdf5:Dataset>
</hdf5:Group>
- <hdf5:Group Name="g1.2" OBJ-XID="xid_3536" H5Path="/g1/g1.2" Parents="xid_792" H5ParentPaths="/g1" >
- <hdf5:Group Name="g1.2.1" OBJ-XID="xid_4232" H5Path="/g1/g1.2/g1.2.1" Parents="xid_3536" H5ParentPaths="/g1/g1.2" >
- <hdf5:SoftLink LinkName="slink" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g1/g1.2/g1.2.1/slink" TargetPath="somevalue" Parents="xid_4232" H5ParentPaths="/g1/g1.2/g1.2.1" />
+ <hdf5:Group Name="g1.2" OBJ-XID="xid_3600" H5Path="/g1/g1.2" Parents="xid_808" H5ParentPaths="/g1" >
+ <hdf5:Group Name="g1.2.1" OBJ-XID="xid_4312" H5Path="/g1/g1.2/g1.2.1" Parents="xid_3600" H5ParentPaths="/g1/g1.2" >
+ <hdf5:SoftLink LinkName="slink" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g1/g1.2/g1.2.1/slink" TargetPath="somevalue" Parents="xid_4312" H5ParentPaths="/g1/g1.2/g1.2.1" />
</hdf5:Group>
- <hdf5:ExternalLink LinkName="extlink" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g1/g1.2/extlink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_3536" H5ParentPaths="/g1/g1.2" />
+ <hdf5:ExternalLink LinkName="extlink" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g1/g1.2/extlink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_3600" H5ParentPaths="/g1/g1.2" />
</hdf5:Group>
</hdf5:Group>
- <hdf5:Group Name="g2" OBJ-XID="xid_1816" H5Path="/g2" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:Dataset Name="dset2.1" OBJ-XID="xid_8872" H5Path= "/g2/dset2.1" Parents="xid_1816" H5ParentPaths="/g2">
+ <hdf5:Group Name="g2" OBJ-XID="xid_1848" H5Path="/g2" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:Dataset Name="dset2.1" OBJ-XID="xid_3688" H5Path= "/g2/dset2.1" Parents="xid_1848" H5ParentPaths="/g2">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -172,7 +172,7 @@ Expected output for 'h5dump --xml tall.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
- <hdf5:Dataset Name="dset2.2" OBJ-XID="xid_9472" H5Path= "/g2/dset2.2" Parents="xid_1816" H5ParentPaths="/g2">
+ <hdf5:Dataset Name="dset2.2" OBJ-XID="xid_8696" H5Path= "/g2/dset2.2" Parents="xid_1848" H5ParentPaths="/g2">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -200,7 +200,7 @@ Expected output for 'h5dump --xml tall.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
- <hdf5:UserDefined LinkName="udlink" OBJ-XID="xid_18446744073709551612" H5SourcePath="/g2/udlink" LinkClass="187" Parents="xid_1816" H5ParentPaths="/g2" />
+ <hdf5:UserDefined LinkName="udlink" OBJ-XID="xid_18446744073709551612" H5SourcePath="/g2/udlink" LinkClass="187" Parents="xid_1848" H5ParentPaths="/g2" />
</hdf5:Group>
</hdf5:RootGroup>
</hdf5:HDF5-File>
diff --git a/tools/testfiles/tboot1.ddl b/tools/testfiles/tboot1.ddl
index 30e700a..4098607 100644
--- a/tools/testfiles/tboot1.ddl
+++ b/tools/testfiles/tboot1.ddl
@@ -18,7 +18,7 @@ USER_BLOCK {
USERBLOCK_SIZE 0
}
DATASET "dset" {
- DATATYPE H5T_STD_I32LE
+ DATATYPE H5T_STD_I32BE
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
}
}
diff --git a/tools/testfiles/tcontents.ddl b/tools/testfiles/tcontents.ddl
index 935ff8c..f66835a 100644
--- a/tools/testfiles/tcontents.ddl
+++ b/tools/testfiles/tcontents.ddl
@@ -3,7 +3,7 @@ Expected output for 'h5dump -n tfcontents1.h5'
#############################
HDF5 "tfcontents1.h5" {
FILE_CONTENTS {
- datatype /#6056
+ datatype /#6392
dataset /dset
dataset /dset3 -> /dset
dataset /dset4 -> /dset
diff --git a/tools/testfiles/textlink.h5 b/tools/testfiles/textlink.h5
index a851011..db4aae4 100644
--- a/tools/testfiles/textlink.h5
+++ b/tools/testfiles/textlink.h5
Binary files differ
diff --git a/tools/testfiles/tfcontents1.h5 b/tools/testfiles/tfcontents1.h5
index 8b043fb..acaede4 100644
--- a/tools/testfiles/tfcontents1.h5
+++ b/tools/testfiles/tfcontents1.h5
Binary files differ
diff --git a/tools/testfiles/tmany.h5 b/tools/testfiles/tmany.h5
index 0422f93..e197565 100644
--- a/tools/testfiles/tmany.h5
+++ b/tools/testfiles/tmany.h5
Binary files differ
diff --git a/tools/testfiles/tmany.h5.xml b/tools/testfiles/tmany.h5.xml
index 1f7fa70..3bf1021 100644
--- a/tools/testfiles/tmany.h5.xml
+++ b/tools/testfiles/tmany.h5.xml
@@ -4,9 +4,9 @@ Expected output for 'h5dump --xml tmany.h5'
<?xml version="1.0" encoding="UTF-8"?>
<hdf5:HDF5-File xmlns:hdf5="http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdf.ncsa.uiuc.edu/DTDs/HDF5File http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File.xsd">
<hdf5:RootGroup OBJ-XID="xid_96" H5Path="/">
- <hdf5:Group Name="g1" OBJ-XID="xid_792" H5Path="/g1" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:Group Name="g1.1" OBJ-XID="xid_1816" H5Path="/g1/g1.1" Parents="xid_792" H5ParentPaths="/g1" >
- <hdf5:Dataset Name="dset1" OBJ-XID="xid_2840" H5Path= "/g1/g1.1/dset1" Parents="xid_1816" H5ParentPaths="/g1/g1.1">
+ <hdf5:Group Name="g1" OBJ-XID="xid_808" H5Path="/g1" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:Group Name="g1.1" OBJ-XID="xid_1848" H5Path="/g1/g1.1" Parents="xid_808" H5ParentPaths="/g1" >
+ <hdf5:Dataset Name="dset1" OBJ-XID="xid_2888" H5Path= "/g1/g1.1/dset1" Parents="xid_1848" H5ParentPaths="/g1/g1.1">
<hdf5:StorageLayout>
<hdf5:ChunkedLayout Ndims="1">
<hdf5:ChunkDimension DimSize="2" />
@@ -265,17 +265,17 @@ Expected output for 'h5dump --xml tmany.h5'
</hdf5:Data>
</hdf5:Dataset>
</hdf5:Group>
- <hdf5:Group Name="g1.2" OBJ-XID="xid_6040" H5Path="/g1/g1.2" Parents="xid_792" H5ParentPaths="/g1" >
- <hdf5:Dataset Name="link1" OBJ-XID="xid_2840-1" H5Path="/g1/g1.2/link1" Parents="xid_6040" H5ParentPaths="/g1/g1.2">
- <hdf5:DatasetPtr OBJ-XID="xid_2840" H5Path="/g1/g1.2/link1"/>
+ <hdf5:Group Name="g1.2" OBJ-XID="xid_6088" H5Path="/g1/g1.2" Parents="xid_808" H5ParentPaths="/g1" >
+ <hdf5:Dataset Name="link1" OBJ-XID="xid_2888-1" H5Path="/g1/g1.2/link1" Parents="xid_6088" H5ParentPaths="/g1/g1.2">
+ <hdf5:DatasetPtr OBJ-XID="xid_2888" H5Path="/g1/g1.2/link1"/>
</hdf5:Dataset>
</hdf5:Group>
</hdf5:Group>
- <hdf5:Group Name="g2" OBJ-XID="xid_6520" H5Path="/g2" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:SoftLink LinkName="slink2" OBJ-XID="xid_792" H5SourcePath="/g2/slink2" TargetPath="/g1" TargetObj="xid_792" Parents="xid_6520" H5ParentPaths="/g2" />
+ <hdf5:Group Name="g2" OBJ-XID="xid_9184" H5Path="/g2" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:SoftLink LinkName="slink2" OBJ-XID="xid_808" H5SourcePath="/g2/slink2" TargetPath="/g1" TargetObj="xid_808" Parents="xid_9184" H5ParentPaths="/g2" />
</hdf5:Group>
- <hdf5:Group Name="g3" OBJ-XID="xid_10160" H5Path="/g3" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:Dataset Name="link3" OBJ-XID="xid_11552" H5Path= "/g3/link3" Parents="xid_10160" H5ParentPaths="/g3">
+ <hdf5:Group Name="g3" OBJ-XID="xid_10224" H5Path="/g3" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:Dataset Name="link3" OBJ-XID="xid_11648" H5Path= "/g3/link3" Parents="xid_10224" H5ParentPaths="/g3">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -311,16 +311,16 @@ Expected output for 'h5dump --xml tmany.h5'
</hdf5:Data>
</hdf5:Dataset>
</hdf5:Group>
- <hdf5:Group Name="g4" OBJ-XID="xid_10856" H5Path="/g4" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:Dataset Name="dset2" OBJ-XID="xid_11552-2" H5Path="/g4/dset2" Parents="xid_10856" H5ParentPaths="/g4">
- <hdf5:DatasetPtr OBJ-XID="xid_11552" H5Path="/g4/dset2"/>
+ <hdf5:Group Name="g4" OBJ-XID="xid_10936" H5Path="/g4" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:Dataset Name="dset2" OBJ-XID="xid_11648-2" H5Path="/g4/dset2" Parents="xid_10936" H5ParentPaths="/g4">
+ <hdf5:DatasetPtr OBJ-XID="xid_11648" H5Path="/g4/dset2"/>
</hdf5:Dataset>
</hdf5:Group>
<hdf5:Group Name="g5" OBJ-XID="xid_8512" H5Path="/g5" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:SoftLink LinkName="slink4" OBJ-XID="xid_15872" H5SourcePath="/g5/slink4" TargetPath="/g6/dset3" TargetObj="xid_15872" Parents="xid_8512" H5ParentPaths="/g5" />
+ <hdf5:SoftLink LinkName="slink4" OBJ-XID="xid_15992" H5SourcePath="/g5/slink4" TargetPath="/g6/dset3" TargetObj="xid_15992" Parents="xid_8512" H5ParentPaths="/g5" />
</hdf5:Group>
<hdf5:Group Name="g6" OBJ-XID="xid_8560" H5Path="/g6" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:Dataset Name="dset3" OBJ-XID="xid_15872" H5Path= "/g6/dset3" Parents="xid_8560" H5ParentPaths="/g6">
+ <hdf5:Dataset Name="dset3" OBJ-XID="xid_15992" H5Path= "/g6/dset3" Parents="xid_8560" H5ParentPaths="/g6">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>
@@ -356,13 +356,13 @@ Expected output for 'h5dump --xml tmany.h5'
</hdf5:Data>
</hdf5:Dataset>
</hdf5:Group>
- <hdf5:Group Name="g7" OBJ-XID="xid_12688" H5Path="/g7" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:SoftLink LinkName="slink5" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g7/slink5" TargetPath="/g8/elink" Parents="xid_12688" H5ParentPaths="/g7" />
- <hdf5:SoftLink LinkName="slink6" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g7/slink6" TargetPath="/g8/udlink" Parents="xid_12688" H5ParentPaths="/g7" />
+ <hdf5:Group Name="g7" OBJ-XID="xid_16920" H5Path="/g7" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:SoftLink LinkName="slink5" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g7/slink5" TargetPath="/g8/elink" Parents="xid_16920" H5ParentPaths="/g7" />
+ <hdf5:SoftLink LinkName="slink6" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g7/slink6" TargetPath="/g8/udlink" Parents="xid_16920" H5ParentPaths="/g7" />
</hdf5:Group>
- <hdf5:Group Name="g8" OBJ-XID="xid_720" H5Path="/g8" Parents="xid_96" H5ParentPaths="/" >
- <hdf5:ExternalLink LinkName="elink" OBJ-XID="xid_18446744073709551612" H5SourcePath="/g8/elink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_720" H5ParentPaths="/g8" />
- <hdf5:UserDefined LinkName="udlink" OBJ-XID="xid_18446744073709551611" H5SourcePath="/g8/udlink" LinkClass="187" Parents="xid_720" H5ParentPaths="/g8" />
+ <hdf5:Group Name="g8" OBJ-XID="xid_17632" H5Path="/g8" Parents="xid_96" H5ParentPaths="/" >
+ <hdf5:ExternalLink LinkName="elink" OBJ-XID="xid_18446744073709551612" H5SourcePath="/g8/elink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_17632" H5ParentPaths="/g8" />
+ <hdf5:UserDefined LinkName="udlink" OBJ-XID="xid_18446744073709551611" H5SourcePath="/g8/udlink" LinkClass="187" Parents="xid_17632" H5ParentPaths="/g8" />
</hdf5:Group>
</hdf5:RootGroup>
</hdf5:HDF5-File>
diff --git a/tools/testfiles/tudlink.h5 b/tools/testfiles/tudlink.h5
index 3b10447..d2f5802 100644
--- a/tools/testfiles/tudlink.h5
+++ b/tools/testfiles/tudlink.h5
Binary files differ
diff --git a/tools/testfiles/twithub.h5 b/tools/testfiles/twithub.h5
index 2176034..4d975f2 100644
--- a/tools/testfiles/twithub.h5
+++ b/tools/testfiles/twithub.h5
Binary files differ
diff --git a/tools/testfiles/twithub513.h5 b/tools/testfiles/twithub513.h5
index fbb872a..525d7b5 100644
--- a/tools/testfiles/twithub513.h5
+++ b/tools/testfiles/twithub513.h5
Binary files differ