summaryrefslogtreecommitdiffstats
path: root/test/tvltypes.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-02-08 16:56:16 (GMT)
committerGitHub <noreply@github.com>2021-02-08 16:56:16 (GMT)
commit22c67ff6570f16050f0a5654cf1c84df917bb598 (patch)
tree38fb63aa498b250c2543fe7e22a511706de96a42 /test/tvltypes.c
parent551f15f8ae02ca9c995619b216121081eb07633e (diff)
downloadhdf5-22c67ff6570f16050f0a5654cf1c84df917bb598.zip
hdf5-22c67ff6570f16050f0a5654cf1c84df917bb598.tar.gz
hdf5-22c67ff6570f16050f0a5654cf1c84df917bb598.tar.bz2
1.8/master (#317)hdf5-1_8_22
* Revert incorrect bool type * Correct grep text for filter test * Check sizeof type to use correct ref_type * h5dump reg ref chnages has no error file * Fix comment * Remove unneeded files * Verify the decoded version for "all" and "none" selection. * Remove double entry * Add missing include * Snapshot version 1.8 release 22 (snap4) Update version to 1.8-snap5 * Fixes for test failures with --disable-tests --disable-tools options. Don't test ph5diff if tests are disabled. * Correct conditions for parallel builds with and without tests. * Snapshot version 1.8 release 22 (snap5) Update version to 1.8.22-snap6 * TRILAB-192 merging warnings changes from develop * Autotools reconfigure update * Restore page ejects. * Restore page eject chars * Fix orphaned token * Update LT files * Correct extra flags and merge TRILAB-24 * Update release note for CMake warnings * H5repack bug fixes from develop * TRILAB-192 - merge changes from develop Single source, config files, for warnings for both autotools and CMake. Update CMake libraries, tools, tests to use correct flags. * Add missing m4 file * Remove 128bit config check fo 1.8 * TRILAB-192 update LTparse files * A fix in the cleaning up code for datatype when datatype initialization via H5D__init_type() fails. The code to fix the problem is the same as what is done in H5D__open_oid(). * Add missing " and update function calls incorrectly named load_gcc_arguments. Commit changes to gnu-cxxflags to remove unmatched " and to gnu-fflags to not add C warnings flags to H5_FCFLAGS. * TRILAB-192 - cleanup edits and match CMake CXX to autotools * Fix shadowed type * TRILAB-192 correct fortran commands * TRILAB-192 version of std=f2008 special check * Fix shadow variable * Add prefix_relto_examplesdir function to set relative path to h5c++. * TRILAB-192 - parser files cannot handle this warning * Parallel Fortran tests now use the MPI module instead of including mpif.h. * Don't add general warnings flags for unsupported old versions of gcc and g++ (older than gcc/g++ 4.2). Correct gnu-cxxflags to determine warnings flags to be added based on C++ compiler version instead of C compiler version. * Snapshot version 1.8 release 22 (snap6) Update version to 1.8.22-snap7 * TRILAB-244 separate CXX warnings and errors from C * Fix NoFilter build * Move ADD_H5_FLAGS macro from *CompilerFlags.cmake files to config/cmake_ext_mod/HDFMacros.cmake for common use. * Restrict errors to gcc 4.8 and above. * OESS-65 replace szip with aec szip * Correct CMake version * Correct -Werror=unused-variable * Add -Werror= flags to lists displayed in libhdf5.settings. * Fix -Werror=unused-variable * More fixes for unused variable * Resolve warning errors from -Werror= flags: -Werror=bad-function-cast -Werror=bad-function-cast -Werror=implicit-function-declaration -Werror=nested-externs * Remove verbose assignments in smoke_check 3 and 5 functions. * Update to use optimization flags, C++ error flags, and correct libhdf5.settings.in to remove unworkable changes. * Update config/gnu-cxxflags. * Add missing headers * Fix ifort warning flag. Restore AC_DEFUN([PAC_PROG_FC_DEFAULT_REALisDBLE] in m4/aclocal_fc.m4. Add --enable-symbols, --enable-profiling, and --enable-optimization options to autotools configure; all configure flags for --enable-production and --disable-production should match HDF5 1.10 and 1.12 production and debug default flags. * Add github actions file * Correct path * OESS-65 Fix packaging * Update reference name * Correct filename * disable pr action and enable fail fast * Snapshot 1.8.22-snap7 Update version to 1.8.22-snap8. * Correct mingw path * Correct mingw paths * Revise gnu-*flags and cmake/HDF*CompilerFlags.cmake files to add warning flags for GCC compilers version 4.8 and above. Removed files from gnu-warnings that only apply to versions < 4.8. Consolidated warnings from versions < 4.8 that apply to versions >= 4.8 into the 4.8 warnings files. * Update MANIFEST for removal of older warnings files. * Yanked all MPI-1 calls Added batch scripts in bin/batch. * Snapshot 1.8.22-snap8. Update version to 1.8.22-snap9. * Squashed commit of the following: commit 45b0cbc71929930a874e1c09e0770aa64d0ae697 Author: Larry Knox <lrknox@hdfgroup.org> Date: Thu Apr 23 13:14:56 2020 -0500 Add C++ warnings treated as error for autotools builds. commit 6debcddcc766601799d5bd661bd60946f951a07e Author: Larry Knox <lrknox@hdfgroup.org> Date: Fri Jun 19 16:50:03 2020 -0500 Remove tests for develop branch from testh5cc.sh.in. Add @H5_ECXXFLAGS@ to AM_CXXFLAGS. commit fed497e7f207313b2a133d3b68c942b7d7104b90 Author: Larry Knox <lrknox@hdfgroup.org> Date: Fri Jun 12 15:06:39 2020 -0500 Merge pull request #2646 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit '998c6470d78e14228695419c3b514c35ecf3d69e': Remove unnecessary version conditions for Clang compilers. commit 92e52ce5c211bd1d3991a3b8bb67287ac7b652aa Author: Larry Knox <lrknox@hdfgroup.org> Date: Wed Jun 10 18:53:45 2020 -0500 Merge pull request #2639 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit 'a33667faf226f5d8c9633bf537893e8fce1bf1f6': Add c++ to --enable-sanitize-checks option. commit 2e802534fb997b81fa98fdd1c7d97d4310898e0d Author: Larry Knox <lrknox@hdfgroup.org> Date: Wed Jun 10 15:18:36 2020 -0500 Merge pull request #2633 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit '20eab963899841c9a003baebead8e3bc07d9e127': Remove duplicate entries in MANIFEST. Make changes to CMake CompilerFlags.cmake files so extra flags are loaded for non-GNU compilers. Update new clang files to not pick up clang as vendor for pgCC. Add new files to MANIFEST Temporary demotion of 2 -Werror warning flags that fail on macos 10.12 Remove Production flag unknown to Apple clang. commit 96ef60a58a23847a7da89a891f2415055ec2ab60 Author: Larry Knox <lrknox@hdfgroup.org> Date: Mon Jun 8 16:24:49 2020 -0500 Merge pull request #2631 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit 'b942a4d8a3e27317cac50ce37ff5302d477664d8': Clean up code to get clang version in config/linux-gnulibc1 commit 8a7c687da568e8b50b38fa53da1ca63759be6ec4 Author: Larry Knox <lrknox@hdfgroup.org> Date: Mon Jun 8 11:42:37 2020 -0500 Merge pull request #2623 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit 'c7626f79fdee4eee13925e240ef41e61f3367eab': Add flags from config/clang-warnings/*general files to H5 C and CXX flags for all versions of Clang and Clang++ compilers. Switched from cut to awk in testcheck_version.sh.in to avoid dependence on tab vs. " " in version definitions in H5public.h. Add files for adding warning flags for clang compilers in autotools configure. commit db3ef7ff3c1ed79167cecef831501411cff8291f Merge: 5a0f8d7 f9f1310 Author: Larry Knox <lrknox@hdfgroup.org> Date: Fri Jun 19 14:46:22 2020 -0500 Merge branch 'hdf5_1_12' of https://bitbucket.hdfgroup.org/scm/~lrknox/hdf5_lrk into hdf5_1_12 commit 5a0f8d7940ae57b445f545a0abd7e303ce6924ee Author: Larry Knox <lrknox@hdfgroup.org> Date: Wed Jun 10 20:15:41 2020 -0500 Merge pull request #2636 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:HDFFV-11000-update-testh5cc.sh.in-for-version to develop * commit '5c0bd670d6e9919c463fbc05de99e2ba55b0761e': Add tests for all version to H5_NO_DEPRECATED_SYMBOLS section and to section for current version, with and without default API version flags. HDFFV-11000: update-testh5cc.sh.in to test sample versioned functions in HDF5 1.10, 1.12 and develop. * Update configure and Makefile.ins after bin/reconfigure. * Fix MANIFEST * Fix HDFFV-10591 Description: h52gif produced a segfault when a buffer overflow occurred because the data size was corrupted and became very large. This commit added a check on the data size against the buffer size to prevent the segfault. It also added error reporting to h52gif to display an error message instead of silently exiting when the failure occurred. Platforms tested: Linux/64 (jelly) * Snapshot 1.8.22-snap9. Update version to 1.8.22-snap10. * Merge pull request #2686 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit '800f93f7c994f88dfa716746153ded4b1e690e3a': Remove path to szip header file from AM_CPPFLAGS when configure check of libsz fails. Fix for HDFFV-10830. * Regenerate configure. * Merge from 1.10-1.12-dev - LT parse needs update * Incorporate pull request #2693 from develop for the fix to HDFFV-11080: (1) Patch up the file pointer when reading attribute of variable length datatype (2) Test to verify the fix when doing multiple threads (3) Update MANIFEST (4) Add new test to Cmake * Switch bison and flex update of LT files from bin/genltanalyse to bin/genparser, and from automatically updating the LT files whenever reconfigure is run to running only on man<F12>ual command. * Update hl/sr/H5LT files. Add bin/genparser to MANIFEST; remove bin/genltanalyze. * Fix to the merge of PR #2708 for HDFFV-11080 to the 1.8 branch. Need to checkin test/Makefile.in for the new file added. * Fix HDFFV-11120 and HDFFV-11121 (CVE-2018-13870 and CVE-2018-13869) Description: When a buffer overflow occurred because a name length was corrupted and became very large, h5dump produced a segfault on one file and a memcpy parameter overlap on another file. This commit added checks that detect a read pass the end of the buffer to prevent these error conditions. Platforms tested: Linux/64 (jelly) * Fixed typo * Check for header szlib.h only when libsz passes AC_CHECK_LIB, so that H5_HAVE_SALIB_H is not defined when szip is not enabled, to prevent compile failures for incompatible szlib. * HDFFV-11127 - force RTLD_LOCAL in dlopen * spelling * Remove extra parens * Remove unnecessary assignment freom configure.ac. * Add hypen to subrelease regex * Add special case when H5_VERS_SUBRELEASE is 0 * Revert H5_VERS_SUBRELEASE check * The version string has a second use for packaging * MinGW uses "MinGW Makefiles" * Snapshot 1.8.22-snap10. Update version to 1.8.22-snap11. * Merge clang-format changes from develop * remove stray file * Source formatted * Add options to github actions. * Add back file, remove py file * HDFFV-11096 Correct h5dump usage text * Update formating * remove autogen for 1.8 branch * Fix comment whitespace * Change '==' to 'eq' in test script * Merge from develop github updates bin scripts parser updates * Snapshot 1.8.22-snap11. Update version to 1.8.22-snap12. * Merge from 1.10 Comments, whitespace Simple init and if block brackets. Minimal code changes limited to return value and spelling * Update autotools files * Update FD source * More merges from 1.10 comments and inits * Comment fixes * Fix macro argument * Remove autogen file and cache dir * Revert autotools files to previous version * Correct boolean value and missing define * URL and options corrections * revert autoconf files * Fix compile issues with vfd drivers. * Fix HDFS test * Remove extra #endif * Move init above execution * Multiple changes to bring branch up-to-date (#87) Correct TARGET variable and CMake config file location. Add option to allow filter plugins to be built inline. Update CMake tools macros. * hdf5 1 8 release text (#113) * Multiple changes to bring branch up-to-date Correct TARGET variable and CMake config file location. Add option to allow filter plugins to be built inline. Update CMake tools macros. * release text updates - mostly whitespace * Fixed HDFFV-10480 and HDFFV-11159 (#145) * Fixed HDFFV-10480 and HDFFV-11159 Description Checked against buffer size to prevent segfault, in case of data corruption. + HDFFV-11159 CVE-2018-14033 Buffer over-read in H5O_layout_decode + HDFFV-10480 CVE-2018-11206 Buffer over-read in H5O_fill_new[/old]_decode and A user's patch was applied to this previously, but it is redone for a more correct fix, that is the check now accounted for the previous advance of the buffer pointer. Platforms tested: Linux/64 (jelly) * Fixed typo * Update HDF5 1.8 copyright headers with updated copyright URL (#148) * Update URL for COPYING file in copyright headers. * Make fortran copyright headers uniformly spaced. * Update url for Copyright file in c++/src/footer.html. * OESS-98 Update plugin build option (#171) * 1.8 has extra fortran CMake option (#176) * 1.8 has extra fortran CMake option * Update license URL * OESS-98 fix tools test for plugins (#180) * Hdf5 1 8 (#169) * Fixed HDFFV-10480 and HDFFV-11159 Description Checked against buffer size to prevent segfault, in case of data corruption. + HDFFV-11159 CVE-2018-14033 Buffer over-read in H5O_layout_decode + HDFFV-10480 CVE-2018-11206 Buffer over-read in H5O_fill_new[/old]_decode and A user's patch was applied to this previously, but it is redone for a more correct fix, that is the check now accounted for the previous advance of the buffer pointer. Platforms tested: Linux/64 (jelly) * Fixed typo * Fixed HDFFV-11150 Description Replaced an HDassert with a check for null pointer in H5O_dec_rc() to catch null pointer in corrupted data situation. Reversed the fix in svn-r24463 in which a check for null pointer prior to calling H5O_dec_rc() Platforms tested: Linux/64 (jelly) * HDF5 1 8 fix fortran build on macs (#186) * Correct fortran and shared libs option * Fix for no shared fortran build * OESS-98 fix hdf5 link target (#191) * Partial changes to RELEASE.txt for release. (#185) * Partial changes to RELEASE.txt for release. * Update supported and tested platforms. * Update version to 1.8.22-12. * close #195. (#196) * Update HDF5PluginMacros.cmake * Update HDF5PluginMacros.cmake * Update directory for SZ filter in HDF5PluginMacros.cmake. Updates for release: Switch configure default to production mode. Set HDF5_GENERATE_HEADERS to OFF. * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Restores maintainer mode in the autotools (#200) (#203) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> * Hdf5 1 8 22 (#212) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Brings ttsafe_attr_vlen.c changes from develop (#214) Fixes exposed pthread problem on Windows. * Update SO numbers for Hdf5 1 8 22 (#215) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Hdf5 1 8 22 (#224) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> * Update CMake/HDF5Examples version in bin/release * Update CMake/HDF5Examples version number in bin/release (#225) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> * Fixed typo in an error message. (#228) * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * Bring 3 small changes from Hdf5 1.8 to 1.8.22 (#241) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Stat st blocks fix 1822 (#251) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * Fixes Autotools detection of the st_blocks field in stat (#246) * Fixes Autotools detection of the st_blocks field in stat The Autotools and CMake will now both correctly determine if the stat struct has the st_blocks field and set H5_HAVE_STAT_ST_BLOCKS appropriately. * Fixes a typo in configure.ac * Restore lines in RELEASE.txt. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Stat st blocks fix 1822 (#256) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * Fixes Autotools detection of the st_blocks field in stat (#246) * Fixes Autotools detection of the st_blocks field in stat The Autotools and CMake will now both correctly determine if the stat struct has the st_blocks field and set H5_HAVE_STAT_ST_BLOCKS appropriately. * Fixes a typo in configure.ac * Restore lines in RELEASE.txt. * Updated configure with reconfigure. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * RELEASE.txt cleanup. * Hdf5 1 8 22 (#261) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Hdf5 1 8 22 (#266) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. * Hdf5 1 8 22 - Reverts lock/unlock callback signature to 1.8.21 version (#267) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Update version in H5public.h * Hdf5 1 8 22 (#269) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. * Update version in H5public.h Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Set version 1.8.22 for release. * dd RELEASE.txt entry for HDFFV-10741. * Hdf5 1 8 22 (#279) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. * Update version in H5public.h * Set version 1.8.22 for release. * dd RELEASE.txt entry for HDFFV-10741. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Improve performance of multiple calls to H5Sget_select_elem_pointlist (#270) (#277) * Cache the pointer to the next point to process after the last call to H5S__get_select_elem_pointlist. This allows the normal process of iterating over the points in batches to be much more efficient, as the library does not need to traverse the entirety of the preceding points every time the funciton is re-entered. * Update RELEASE.txt for point selection iteration performance fix. * Hdf5 1 8 22 (#281) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. * Update version in H5public.h * Set version 1.8.22 for release. * dd RELEASE.txt entry for HDFFV-10741. * Improve performance of multiple calls to H5Sget_select_elem_pointlist (#270) (#277) * Cache the pointer to the next point to process after the last call to H5S__get_select_elem_pointlist. This allows the normal process of iterating over the points in batches to be much more efficient, as the library does not need to traverse the entirety of the preceding points every time the funciton is re-entered. * Update RELEASE.txt for point selection iteration performance fix. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org> * Hdf5 1 8 22 (#284) * Fixed typo in an error message. * Updated for HDFFV-11150, HDFFV-10480, and HDFFV-11159 * Update "Support for New Platforms and Compilers" section in RELEASE.txt; add check_version workaround for binary compatibility to "Known Problems". * Add SUSE Linux to tested platforms. * Update numbers in config/lt_vers.am and run bin/reconfigure for so numbers. * Update version in 3 files missed by merge. Co-authored-by: Allen Byrne <byrn@hdfgroup.org> Co-authored-by: Vailin Choi <vchoi@hdfgroup.org> Co-authored-by: vchoi <vchoi@jelly.ad.hdfgroup.org> Co-authored-by: hdftest <hdftest@hdfgroup.org> Co-authored-by: Jordan Henderson <jhenderson@hdfgroup.org> Co-authored-by: Dana Robinson <derobins@hdfgroup.org> Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
Diffstat (limited to 'test/tvltypes.c')
-rw-r--r--test/tvltypes.c1870
1 files changed, 957 insertions, 913 deletions
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 2147ac7..b3bfbf3 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -6,44 +6,43 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tvltypes
-*
-* Test the Variable-Length Datatype functionality
-*
-*************************************************************/
+ *
+ * Test program: tvltypes
+ *
+ * Test the Variable-Length Datatype functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
-#include "hdf5.h"
#include "H5Dprivate.h"
-#define FILENAME "tvltypes.h5"
+#define FILENAME "tvltypes.h5"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
/* 1-D dataset with fixed dimensions */
-#define SPACE3_RANK 1
-#define SPACE3_DIM1 128
-#define L1_INCM 16
-#define L2_INCM 8
-#define L3_INCM 3
+#define SPACE3_RANK 1
+#define SPACE3_DIM1 128
+#define L1_INCM 16
+#define L2_INCM 8
+#define L3_INCM 3
/* 1-D dataset with fixed dimensions */
-#define SPACE4_RANK 1
-#define SPACE4_DIM_SMALL 128
-#define SPACE4_DIM_LARGE (H5D_TEMP_BUF_SIZE / 64)
+#define SPACE4_RANK 1
+#define SPACE4_DIM_SMALL 128
+#define SPACE4_DIM_LARGE (H5D_TEMP_BUF_SIZE / 64)
void *test_vltypes_alloc_custom(size_t size, void *info);
-void test_vltypes_free_custom(void *mem, void *info);
+void test_vltypes_free_custom(void *mem, void *info);
/****************************************************************
**
@@ -53,22 +52,23 @@ void test_vltypes_free_custom(void *mem, void *info);
** allocated.
**
****************************************************************/
-void *test_vltypes_alloc_custom(size_t size, void *mem_used)
+void *
+test_vltypes_alloc_custom(size_t size, void *mem_used)
{
- void *ret_value; /* Pointer to return */
+ void * ret_value; /* Pointer to return */
const size_t extra = MAX(sizeof(void *), sizeof(size_t)); /* Extra space needed */
- /* (This weird contortion is required on the
- * DEC Alpha to keep the alignment correct - QAK)
- */
+ /* (This weird contortion is required on the
+ * DEC Alpha to keep the alignment correct - QAK)
+ */
- if((ret_value = HDmalloc(extra + size)) != NULL) {
+ if ((ret_value = HDmalloc(extra + size)) != NULL) {
*(size_t *)ret_value = size;
*(size_t *)mem_used += size;
} /* end if */
ret_value = ((unsigned char *)ret_value) + extra;
- return(ret_value);
+ return (ret_value);
}
/****************************************************************
@@ -79,17 +79,18 @@ void *test_vltypes_alloc_custom(size_t size, void *mem_used)
** allocated.
**
****************************************************************/
-void test_vltypes_free_custom(void *_mem, void *mem_used)
+void
+test_vltypes_free_custom(void *_mem, void *mem_used)
{
- if(_mem) {
- const size_t extra = MAX(sizeof(void *), sizeof(size_t)); /* Extra space needed */
- /* (This weird contortion is required
- * on the DEC Alpha to keep the
- * alignment correct - QAK)
- */
- unsigned char *mem = ((unsigned char *)_mem) - extra; /* Pointer to actual block allocated */
-
- *(size_t *)mem_used -= *(size_t *)mem;
+ if (_mem) {
+ const size_t extra = MAX(sizeof(void *), sizeof(size_t)); /* Extra space needed */
+ /* (This weird contortion is required
+ * on the DEC Alpha to keep the
+ * alignment correct - QAK)
+ */
+ unsigned char *mem = ((unsigned char *)_mem) - extra; /* Pointer to actual block allocated */
+
+ *(size_t *)mem_used -= *(size_t *)((void *)mem);
HDfree(mem);
} /* end if */
}
@@ -103,13 +104,13 @@ void test_vltypes_free_custom(void *_mem, void *mem_used)
static void
test_vltypes_dataset_create(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dcpl; /* Dataset Property list */
- hid_t dataset; /* Dataset ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dcpl; /* Dataset Property list */
+ hid_t dataset; /* Dataset ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataset of VL Datatype Functionality\n"));
@@ -135,9 +136,8 @@ test_vltypes_dataset_create(void)
CHECK(ret, FAIL, "H5Pset_fill_time");
/* Create a dataset, supposed to fail */
- H5E_BEGIN_TRY {
- dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT); }
+ H5E_END_TRY;
VERIFY(dataset, FAIL, "H5Dcreate2");
/* Close datatype */
@@ -166,31 +166,31 @@ test_vltypes_dataset_create(void)
static void
test_vltypes_funcs(void)
{
- hid_t type; /* Datatype ID */
- int size;
- H5T_pad_t inpad;
- H5T_norm_t norm;
- H5T_cset_t cset;
- H5T_str_t strpad;
- herr_t ret; /* Generic return value */
+ hid_t type; /* Datatype ID */
+ size_t size;
+ H5T_pad_t inpad;
+ H5T_norm_t norm;
+ H5T_cset_t cset;
+ H5T_str_t strpad;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing some type functions for VL\n"));
/* Create a datatype to refer to */
- type = H5Tvlen_create (H5T_IEEE_F32BE);
+ type = H5Tvlen_create(H5T_IEEE_F32BE);
CHECK(type, FAIL, "H5Tvlen_create");
- size=H5Tget_precision(type);
- CHECK(size, FAIL, "H5Tget_precision");
+ size = H5Tget_precision(type);
+ CHECK(size, 0, "H5Tget_precision");
- size=H5Tget_size(type);
- CHECK(size, FAIL, "H5Tget_size");
+ size = H5Tget_size(type);
+ CHECK(size, 0, "H5Tget_size");
- size=H5Tget_ebias(type);
- CHECK(size, FAIL, "H5Tget_ebias");
+ size = H5Tget_ebias(type);
+ CHECK(size, 0, "H5Tget_ebias");
- ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
+ ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
CHECK(ret, FAIL, "H5Tset_pad");
inpad = H5Tget_inpad(type);
@@ -202,14 +202,12 @@ test_vltypes_funcs(void)
ret = H5Tset_offset(type, (size_t)16);
CHECK(ret, FAIL, "H5Tset_offset");
- H5E_BEGIN_TRY {
- cset = H5Tget_cset(type);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { cset = H5Tget_cset(type); }
+ H5E_END_TRY;
VERIFY(cset, FAIL, "H5Tget_cset");
- H5E_BEGIN_TRY {
- strpad=H5Tget_strpad(type);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { strpad = H5Tget_strpad(type); }
+ H5E_END_TRY;
VERIFY(strpad, FAIL, "H5Tget_strpad");
/* Close datatype */
@@ -226,35 +224,35 @@ test_vltypes_funcs(void)
static void
test_vltypes_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t wdata2[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t fill; /* Fill value */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t sid2; /* ID of bad dataspace (no extent set) */
- hid_t tid1; /* Datatype ID */
- hid_t dcpl_pid; /* Dataset creation property list ID */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t wdata2[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t fill; /* Fill value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t sid2; /* ID of bad dataspace (no extent set) */
+ hid_t tid1; /* Datatype ID */
+ hid_t dcpl_pid; /* Dataset creation property list ID */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Atomic VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+1)*sizeof(unsigned int));
- wdata[i].len=i+1;
- for(j=0; j<(i+1); j++)
- ((unsigned int *)wdata[i].p)[j]=i*10+j;
-
- wdata2[i].p=NULL;
- wdata2[i].len=0;
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(unsigned int));
+ wdata[i].len = i + 1;
+ for (j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].p)[j] = i * 10 + j;
+
+ wdata2[i].p = NULL;
+ wdata2[i].len = 0;
} /* end for */
/* Create file */
@@ -266,7 +264,7 @@ test_vltypes_vlen_atomic(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a datatype to refer to */
- tid1 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create a dataset */
@@ -278,9 +276,10 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].len != 0 || rdata[i].p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].len != 0 || rdata[i].p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n", (int)i,
+ (unsigned)rdata[i].len, (int)i, rdata[i].p);
/* Write "nil" data to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
@@ -291,9 +290,10 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].len != 0 || rdata[i].p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].len != 0 || rdata[i].p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n", (int)i,
+ (unsigned)rdata[i].len, (int)i, rdata[i].p);
/* Write dataset to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -308,8 +308,9 @@ test_vltypes_vlen_atomic(void)
CHECK(dcpl_pid, FAIL, "H5Pcreate");
/* Set the fill value for the second dataset */
- fill.p = NULL; fill.len = 0;
- ret = H5Pset_fill_value(dcpl_pid, tid1, &fill);
+ fill.p = NULL;
+ fill.len = 0;
+ ret = H5Pset_fill_value(dcpl_pid, tid1, &fill);
CHECK(ret, FAIL, "H5Pset_fill_value");
/* Create a second dataset */
@@ -325,9 +326,10 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].len != 0 || rdata[i].p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].len != 0 || rdata[i].p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n", (int)i,
+ (unsigned)rdata[i].len, (int)i, rdata[i].p);
/* Write "nil" data to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2);
@@ -338,9 +340,10 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++)
- if(rdata[i].len != 0 || rdata[i].p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].len != 0 || rdata[i].p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n", (int)i,
+ (unsigned)rdata[i].len, (int)i, rdata[i].p);
/* Write data to disk */
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -362,7 +365,6 @@ test_vltypes_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file for data checking */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -383,7 +385,8 @@ test_vltypes_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -391,7 +394,7 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(size,((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
@@ -399,21 +402,24 @@ test_vltypes_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n", (int)i,
+ (int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
@@ -438,7 +444,6 @@ test_vltypes_vlen_atomic(void)
ret = H5Pclose(xfer_pid);
CHECK(ret, FAIL, "H5Pclose");
-
/* Open second dataset */
dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dopen2");
@@ -459,7 +464,8 @@ test_vltypes_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -467,56 +473,57 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* Try to call H5Dvlen_get_buf with bad dataspace */
- H5E_BEGIN_TRY {
- ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dvlen_get_buf_size");
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+ VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n", (int)i,
+ (int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Try to reclaim read data using "bad" dataspace with no extent
* Should fail */
- H5E_BEGIN_TRY {
- ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata);
- } H5E_END_TRY
+ H5E_BEGIN_TRY { ret = H5Dvlen_reclaim(tid1, sid2, xfer_pid, rdata); }
+ H5E_END_TRY
VERIFY(ret, FAIL, "H5Dvlen_reclaim");
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close datatype */
@@ -546,27 +553,27 @@ test_vltypes_vlen_atomic(void)
static void
rewrite_vltypes_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 4;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Check Memory Leak for Basic Atomic VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].p = HDmalloc((i + increment) * sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + increment) * sizeof(unsigned int));
wdata[i].len = i + increment;
- for(j = 0; j < (i + increment); j++)
+ for (j = 0; j < (i + increment); j++)
((unsigned int *)wdata[i].p)[j] = i * 20 + j;
} /* end for */
@@ -606,7 +613,6 @@ rewrite_vltypes_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file for data checking */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -627,7 +633,8 @@ rewrite_vltypes_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -646,28 +653,31 @@ rewrite_vltypes_vlen_atomic(void)
VERIFY(mem_used, 22 * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n", (int)i,
+ (int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -692,8 +702,6 @@ rewrite_vltypes_vlen_atomic(void)
} /* end rewrite_vltypes_vlen_atomic() */
-
-
/****************************************************************
**
** test_vltypes_vlen_compound(): Test basic VL datatype code.
@@ -703,35 +711,35 @@ rewrite_vltypes_vlen_atomic(void)
static void
test_vltypes_vlen_compound(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
} s1;
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Compound VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+1)*sizeof(s1));
- wdata[i].len=i+1;
- for(j=0; j<(i+1); j++) {
- ((s1 *)wdata[i].p)[j].i=i*10+j;
- ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F);
- } /* end for */
- } /* end for */
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(s1));
+ wdata[i].len = i + 1;
+ for (j = 0; j < (i + 1); j++) {
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 20 + j) / 3.0F;
+ } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -767,7 +775,8 @@ test_vltypes_vlen_compound(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -783,35 +792,40 @@ test_vltypes_vlen_compound(void)
/* Make certain the correct amount of memory has been used */
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(s1),"H5Dread");
+ VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(s1), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if(((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",
+ (int)i, (int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i, (int)j,
+ (int)((s1 *)rdata[i].p)[j].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f);
+ if (!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f, ((s1 *)rdata[i].p)[j].f)) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",
+ (int)i, (int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i, (int)j,
+ (double)((s1 *)rdata[i].p)[j].f);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -849,35 +863,35 @@ test_vltypes_vlen_compound(void)
static void
rewrite_vltypes_vlen_compound(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
} s1;
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 4;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Check Memory Leak for Basic Compound VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].p = HDmalloc((i + increment) * sizeof(s1));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + increment) * sizeof(s1));
wdata[i].len = i + increment;
- for(j = 0; j < (i + increment); j++) {
- ((s1 *)wdata[i].p)[j].i = i * 40 + j;
- ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0F);
- } /* end for */
- } /* end for */
+ for (j = 0; j < (i + increment); j++) {
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 40 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 60 + j) / 3.0F;
+ } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -893,7 +907,7 @@ rewrite_vltypes_vlen_compound(void)
CHECK(ret, FAIL, "H5Tinsert");
/* Create a datatype to refer to */
- tid1 = H5Tvlen_create (tid2);
+ tid1 = H5Tvlen_create(tid2);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create a dataset */
@@ -912,7 +926,8 @@ rewrite_vltypes_vlen_compound(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -923,40 +938,45 @@ rewrite_vltypes_vlen_compound(void)
VERIFY(size, 22 * sizeof(s1), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 22 elements allocated = 4 + 5 + 6 + 7 elements for each array position */
- VERIFY(mem_used,22*sizeof(s1),"H5Dread");
+ VERIFY(mem_used, 22 * sizeof(s1), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(j=0; j<rdata[i].len; j++) {
- if( ((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i);
+ for (j = 0; j < rdata[i].len; j++) {
+ if (((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",
+ (int)i, (int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i, (int)j,
+ (int)((s1 *)rdata[i].p)[j].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) {
- TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f);
+ if (!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f, ((s1 *)rdata[i].p)[j].f)) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",
+ (int)i, (int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i, (int)j,
+ (double)((s1 *)rdata[i].p)[j].f);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -994,38 +1014,42 @@ rewrite_vltypes_vlen_compound(void)
static void
test_vltypes_compound_vlen_vlen(void)
{
- typedef struct { /* Struct that the compound type are composed of */
- int i;
+ typedef struct { /* Struct that the compound type are composed of */
+ int i;
float f;
hvl_t v;
} s1;
- s1 wdata[SPACE3_DIM1]; /* data to write */
- s1 rdata[SPACE3_DIM1]; /* data to read */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2, tid3; /* Datatype IDs */
- hsize_t dims1[] = {SPACE3_DIM1};
- unsigned i,j,k; /* counting variables */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- herr_t ret; /* Generic return value */
+ s1 * wdata; /* data to write */
+ s1 * rdata; /* data to read */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2, tid3; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE3_DIM1};
+ unsigned i, j, k; /* counting variables */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE3_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t));
- wdata[i].v.len=i+L1_INCM;
- for(t1=(wdata[i].v).p,j=0; j<(i+L1_INCM); j++, t1++) {
- t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int));
- t1->len=j+L2_INCM;
- for(k=0; k<j+L2_INCM; k++)
- ((unsigned int*)t1->p)[k] = i*100 + j*10 + k;
- }
- } /* end for */
+ wdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1);
+ CHECK_PTR(wdata, "HDmalloc");
+ rdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1);
+ CHECK_PTR(rdata, "HDmalloc");
+ for (i = 0; i < SPACE3_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t));
+ wdata[i].v.len = i + L1_INCM;
+ for (t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) {
+ t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int));
+ t1->len = j + L2_INCM;
+ for (k = 0; k < j + L2_INCM; k++)
+ ((unsigned int *)t1->p)[k] = i * 100 + j * 10 + k;
+ } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1036,11 +1060,11 @@ test_vltypes_compound_vlen_vlen(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL datatype to refer to */
- tid3 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid3 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid3, FAIL, "H5Tvlen_create");
/* Create a VL datatype to refer to */
- tid1 = H5Tvlen_create (tid3);
+ tid1 = H5Tvlen_create(tid3);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create the base compound type */
@@ -1071,7 +1095,6 @@ test_vltypes_compound_vlen_vlen(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1085,41 +1108,47 @@ test_vltypes_compound_vlen_vlen(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE3_DIM1; i++) {
- if(wdata[i].i != rdata[i].i) {
- TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
+ for (i = 0; i < SPACE3_DIM1; i++) {
+ if (wdata[i].i != rdata[i].i) {
+ TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n", (int)i,
+ (int)wdata[i].i, (int)i, (int)rdata[i].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
- TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i].f, rdata[i].f)) {
+ TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n", (int)i,
+ (double)wdata[i].f, (int)i, (double)rdata[i].f);
continue;
} /* end if */
- if(wdata[i].v.len != rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) {
- if(t1->len != t2->len) {
- TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
+ for (t1 = (hvl_t *)(wdata[i].v.p), t2 = (hvl_t *)(rdata[i].v.p), j = 0; j < rdata[i].v.len;
+ j++, t1++, t2++) {
+ if (t1->len != t2->len) {
+ TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",
+ __LINE__, (int)i, (int)j, (int)t1->len, (int)t2->len);
continue;
} /* end if */
- for(k=0; k<t2->len; k++) {
- if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) {
- TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k]) {
+ TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n", (int)k,
+ (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -1145,6 +1174,10 @@ test_vltypes_compound_vlen_vlen(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
+
+ /* Release buffers */
+ HDfree(wdata);
+ HDfree(rdata);
} /* end test_vltypes_compound_vlen_vlen() */
/****************************************************************
@@ -1158,51 +1191,47 @@ test_vltypes_compound_vlen_vlen(void)
static void
test_vltypes_compound_vlstr(void)
{
- typedef enum {
- red,
- blue,
- green
- } e1;
+ typedef enum { red, blue, green } e1;
typedef struct {
char *string;
- e1 color;
+ e1 color;
} s2;
- typedef struct { /* Struct that the compound type are composed of */
+ typedef struct { /* Struct that the compound type are composed of */
hvl_t v;
} s1;
- s1 wdata[SPACE1_DIM1]; /* data to write */
- s1 wdata2[SPACE1_DIM1]; /* data to write */
- s1 rdata[SPACE1_DIM1]; /* data to read */
- s1 rdata2[SPACE1_DIM1]; /* data to read */
- char str[64] = "a\0";
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, dset2; /* Dataset ID */
- hid_t sid1, sid2, filespace, filespace2; /* Dataspace ID */
- hid_t tid1, tid2, tid3, tid4, tid5; /* Datatype IDs */
- hid_t cparms;
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t chunk_dims[] = {SPACE1_DIM1/2};
- hsize_t maxdims[] = {H5S_UNLIMITED};
- hsize_t size[] = {SPACE1_DIM1};
- hsize_t offset[] = {0};
- unsigned i,j; /* counting variables */
- s2 *t1, *t2; /* Temporary pointer to VL information */
- int val;
- herr_t ret; /* Generic return value */
+ s1 wdata[SPACE1_DIM1]; /* data to write */
+ s1 wdata2[SPACE1_DIM1]; /* data to write */
+ s1 rdata[SPACE1_DIM1]; /* data to read */
+ s1 rdata2[SPACE1_DIM1]; /* data to read */
+ char str[64] = "a\0";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, dset2; /* Dataset ID */
+ hid_t sid1, sid2, filespace, filespace2; /* Dataspace ID */
+ hid_t tid1, tid2, tid3, tid4, tid5; /* Datatype IDs */
+ hid_t cparms;
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t chunk_dims[] = {SPACE1_DIM1 / 2};
+ hsize_t maxdims[] = {H5S_UNLIMITED};
+ hsize_t size[] = {SPACE1_DIM1};
+ hsize_t offset[] = {0};
+ unsigned i, j; /* counting variables */
+ s2 * t1, *t2; /* Temporary pointer to VL information */
+ int val;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing VL Datatype of Compound Datatype with VL String Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2));
- wdata[i].v.len=i+L3_INCM;
- for(t1=(wdata[i].v).p, j=0; j<(i+L3_INCM); j++, t1++) {
- strcat(str, "m");
- t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1);
- strcpy(t1->string, str);
- /*t1->color = red;*/
- t1->color = blue;
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].v.p = (s2 *)HDmalloc((i + L3_INCM) * sizeof(s2));
+ wdata[i].v.len = i + L3_INCM;
+ for (t1 = (s2 *)((wdata[i].v).p), j = 0; j < (i + L3_INCM); j++, t1++) {
+ HDstrcat(str, "m");
+ t1->string = (char *)HDmalloc(HDstrlen(str) * sizeof(char) + 1);
+ HDstrcpy(t1->string, str);
+ /*t1->color = red;*/
+ t1->color = blue;
}
} /* end for */
@@ -1215,15 +1244,15 @@ test_vltypes_compound_vlstr(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL string type*/
- tid4 = H5Tcopy (H5T_C_S1);
+ tid4 = H5Tcopy(H5T_C_S1);
CHECK(tid4, FAIL, "H5Tcopy");
- ret = H5Tset_size (tid4,H5T_VARIABLE);
+ ret = H5Tset_size(tid4, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
/* Create an enum type */
tid3 = H5Tenum_create(H5T_STD_I32LE);
- val = 0;
- ret = H5Tenum_insert(tid3, "RED", &val);
+ val = 0;
+ ret = H5Tenum_insert(tid3, "RED", &val);
CHECK(ret, FAIL, "H5Tenum_insert");
val = 1;
ret = H5Tenum_insert(tid3, "BLUE", &val);
@@ -1236,13 +1265,12 @@ test_vltypes_compound_vlstr(void)
tid5 = H5Tcreate(H5T_COMPOUND, sizeof(s2));
CHECK(tid5, FAIL, "H5Tcreate");
/* Insert fields */
- ret=H5Tinsert(tid5, "string", HOFFSET(s2, string), tid4);
+ ret = H5Tinsert(tid5, "string", HOFFSET(s2, string), tid4);
CHECK(ret, FAIL, "H5Tinsert");
/* Insert fields */
- ret=H5Tinsert(tid5, "enumerate", HOFFSET(s2, color), tid3);
+ ret = H5Tinsert(tid5, "enumerate", HOFFSET(s2, color), tid3);
CHECK(ret, FAIL, "H5Tinsert");
-
/* Create a VL datatype of first layer compound type */
tid1 = H5Tvlen_create(tid5);
CHECK(tid1, FAIL, "H5Tvlen_create");
@@ -1257,7 +1285,7 @@ test_vltypes_compound_vlstr(void)
/* Modify dataset creation properties, i.e. enable chunking */
cparms = H5Pcreate(H5P_DATASET_CREATE);
- ret = H5Pset_chunk(cparms, SPACE1_RANK, chunk_dims);
+ ret = H5Pset_chunk(cparms, SPACE1_RANK, chunk_dims);
CHECK(ret, FAIL, "H5Pset_chunk");
/* Create a dataset */
@@ -1270,7 +1298,7 @@ test_vltypes_compound_vlstr(void)
/* Select a hyperslab */
filespace = H5Dget_space(dataset);
- ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dims1, NULL);
+ ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dims1, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Write dataset to disk */
@@ -1316,7 +1344,6 @@ test_vltypes_compound_vlstr(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1334,49 +1361,52 @@ test_vltypes_compound_vlstr(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(wdata[i].v.len != rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) {
- if( strcmp(t1->string, t2->string) ) {
- TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string);
- continue;
- } /* end if */
- if(t1->color != t2->color) {
- TestErrPrintf("VL data values don't match!, t1->color=%d, t2->color=%d\n",t1->color, t2->color);
- continue;
- } /* end if */
- } /* end for */
- } /* end for */
+ for (t1 = (s2 *)(wdata[i].v.p), t2 = (s2 *)(rdata[i].v.p), j = 0; j < rdata[i].v.len;
+ j++, t1++, t2++) {
+ if (HDstrcmp(t1->string, t2->string)) {
+ TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n", t1->string,
+ t2->string);
+ continue;
+ } /* end if */
+ if (t1->color != t2->color) {
+ TestErrPrintf("VL data values don't match!, t1->color=%d, t2->color=%d\n", t1->color,
+ t2->color);
+ continue;
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Use this part for new data */
- strcpy(str, "bbbbbbbb\0");
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata2[i].v.p=(s2*)HDmalloc((i+1)*sizeof(s2));
- wdata2[i].v.len=i+1;
- for(t1=(s2*)(wdata2[i].v).p, j=0; j<i+1; j++, t1++) {
- strcat(str, "pp");
- t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1);
- strcpy(t1->string, str);
- t1->color = green;
+ HDstrcpy(str, "bbbbbbbb\0");
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata2[i].v.p = (s2 *)HDmalloc((i + 1) * sizeof(s2));
+ wdata2[i].v.len = i + 1;
+ for (t1 = (s2 *)(wdata2[i].v).p, j = 0; j < i + 1; j++, t1++) {
+ HDstrcat(str, "pp");
+ t1->string = (char *)HDmalloc(HDstrlen(str) * sizeof(char) + 1);
+ HDstrcpy(t1->string, str);
+ t1->color = green;
}
} /* end for */
/* Select a hyperslab */
- filespace2 = H5Dget_space (dset2);
- ret = H5Sselect_hyperslab (filespace2, H5S_SELECT_SET, offset, NULL,
- dims1, NULL);
+ filespace2 = H5Dget_space(dset2);
+ ret = H5Sselect_hyperslab(filespace2, H5S_SELECT_SET, offset, NULL, dims1, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create dataspace for datasets */
@@ -1384,38 +1414,42 @@ test_vltypes_compound_vlstr(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Write dataset to disk */
- ret=H5Dwrite(dset2,tid2,sid2,filespace2,H5P_DEFAULT, &wdata2);
+ ret = H5Dwrite(dset2, tid2, sid2, filespace2, H5P_DEFAULT, &wdata2);
CHECK(ret, FAIL, "H5Dwrite");
/* Read dataset from disk */
- ret=H5Dread(dset2,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata2);
+ ret = H5Dread(dset2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata2[i].v.len!=rdata2[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata2[%d].v.len=%d, rdata2[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata2[i].v.len,(int)i,(int)rdata2[i].v.len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata2[i].v.len != rdata2[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata2[%d].v.len=%d, rdata2[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata2[i].v.len, (int)i, (int)rdata2[i].v.len);
continue;
} /* end if */
- for(t1=wdata2[i].v.p, t2=rdata2[i].v.p, j=0; j<rdata2[i].v.len; j++, t1++, t2++) {
- if( strcmp(t1->string, t2->string) ) {
- TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string);
- continue;
- } /* end if */
- if(t1->color != t2->color) {
- TestErrPrintf("VL data values don't match!, t1->color=%d, t2->color=%d\n",t1->color, t2->color);
- continue;
- } /* end if */
- } /* end for */
- } /* end for */
+ for (t1 = (s2 *)(wdata2[i].v.p), t2 = (s2 *)(rdata2[i].v.p), j = 0; j < rdata2[i].v.len;
+ j++, t1++, t2++) {
+ if (HDstrcmp(t1->string, t2->string)) {
+ TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n", t1->string,
+ t2->string);
+ continue;
+ } /* end if */
+ if (t1->color != t2->color) {
+ TestErrPrintf("VL data values don't match!, t1->color=%d, t2->color=%d\n", t1->color,
+ t2->color);
+ continue;
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata2);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata2);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,rdata2);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, rdata2);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
ret = H5Dclose(dset2);
@@ -1451,37 +1485,37 @@ test_vltypes_compound_vlstr(void)
static void
test_vltypes_compound_vlen_atomic(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
hvl_t v;
} s1;
- s1 wdata[SPACE1_DIM1]; /* Information to write */
- s1 rdata[SPACE1_DIM1]; /* Information read in */
- s1 fill; /* Fill value */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hid_t dcpl_pid; /* Dataset creation property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ s1 wdata[SPACE1_DIM1]; /* Information to write */
+ s1 rdata[SPACE1_DIM1]; /* Information read in */
+ s1 fill; /* Fill value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hid_t dcpl_pid; /* Dataset creation property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int));
- wdata[i].v.len=i+1;
- for(j=0; j<(i+1); j++)
- ((unsigned int *)wdata[i].v.p)[j]=i*10+j;
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + 1) * sizeof(unsigned int));
+ wdata[i].v.len = i + 1;
+ for (j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
/* Create file */
@@ -1493,7 +1527,7 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL datatype to refer to */
- tid1 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create the base compound type */
@@ -1520,7 +1554,8 @@ test_vltypes_compound_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -1536,29 +1571,34 @@ test_vltypes_compound_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].i!=rdata[i].i) {
- TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].i != rdata[i].i) {
+ TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n", (int)i,
+ (int)wdata[i].i, (int)i, (int)rdata[i].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
- TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i].f, rdata[i].f)) {
+ TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n", (int)i,
+ (double)wdata[i].f, (int)i, (double)rdata[i].f);
continue;
} /* end if */
- if(wdata[i].v.len!=rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(j=0; j<rdata[i].v.len; j++) {
- if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]);
+ for (j = 0; j < rdata[i].v.len; j++) {
+ if (((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",
+ (int)i, (int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].v.p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
ret = H5Dvlen_reclaim(tid2, sid1, xfer_pid, rdata);
@@ -1592,9 +1632,13 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].i != 0 || !FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 || rdata[i].v.p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ if (rdata[i].i != 0 || !H5_FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 ||
+ rdata[i].v.p != NULL)
+ TestErrPrintf(
+ "VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",
+ (int)i, rdata[i].i, (int)i, (double)rdata[i].f, (int)i, (unsigned)rdata[i].v.len, (int)i,
+ rdata[i].v.p);
/* Write dataset to disk */
ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -1605,29 +1649,34 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++) {
- if(wdata[i].i != rdata[i].i) {
- TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].i != rdata[i].i) {
+ TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n", (int)i,
+ (int)wdata[i].i, (int)i, (int)rdata[i].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
- TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i].f, rdata[i].f)) {
+ TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n", (int)i,
+ (double)wdata[i].f, (int)i, (double)rdata[i].f);
continue;
} /* end if */
- if(wdata[i].v.len!=rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(j=0; j<rdata[i].v.len; j++) {
- if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]);
+ for (j = 0; j < rdata[i].v.len; j++) {
+ if (((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",
+ (int)i, (int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].v.p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -1635,7 +1684,7 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dclose");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close datatype */
@@ -1663,42 +1712,43 @@ test_vltypes_compound_vlen_atomic(void)
/****************************************************************
**
** rewrite_vltypes_compound_vlen_atomic(): Check memory leak for
-** basic VL datatype code.
+** basic VL datatype code.
** Check memory leak for compound datatypes with VL datatypes
-** of atomic datatypes.
+** of atomic datatypes.
**
****************************************************************/
static void
rewrite_vltypes_compound_vlen_atomic(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
hvl_t v;
} s1;
- s1 wdata[SPACE1_DIM1]; /* Information to write */
- s1 rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
- herr_t ret; /* Generic return value */
+ s1 wdata[SPACE1_DIM1]; /* Information to write */
+ s1 rdata[SPACE1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 4;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
- MESSAGE(5, ("Checking memory leak for compound datatype with VL Atomic Datatype Component Functionality\n"));
+ MESSAGE(5,
+ ("Checking memory leak for compound datatype with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].i = i * 40;
- wdata[i].f = (float)((i * 50) / 3.0F);
- wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 40);
+ wdata[i].f = (float)(i * 50) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
wdata[i].v.len = i + increment;
- for(j = 0; j < (i + increment); j++)
+ for (j = 0; j < (i + increment); j++)
((unsigned int *)wdata[i].v.p)[j] = i * 60 + j;
} /* end for */
@@ -1738,7 +1788,8 @@ rewrite_vltypes_compound_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
@@ -1746,47 +1797,52 @@ rewrite_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 22 elements allocated = 4+5+6+7 elements for each array position */
- VERIFY(size, 22*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+ VERIFY(size, 22 * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 22 elements allocated = 4+5+6+7 elements for each array position */
- VERIFY(mem_used,22*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, 22 * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].i!=rdata[i].i) {
- TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].i != rdata[i].i) {
+ TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n", (int)i,
+ (int)wdata[i].i, (int)i, (int)rdata[i].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
- TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i].f, rdata[i].f)) {
+ TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n", (int)i,
+ (double)wdata[i].f, (int)i, (double)rdata[i].f);
continue;
} /* end if */
- if(wdata[i].v.len!=rdata[i].v.len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
+ if (wdata[i].v.len != rdata[i].v.len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",
+ __LINE__, (int)i, (int)wdata[i].v.len, (int)i, (int)rdata[i].v.len);
continue;
} /* end if */
- for(j=0; j<rdata[i].v.len; j++) {
- if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]);
+ for (j = 0; j < rdata[i].v.len; j++) {
+ if (((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",
+ (int)i, (int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i, (int)j,
+ (int)((unsigned int *)rdata[i].v.p)[j]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -1821,18 +1877,19 @@ rewrite_vltypes_compound_vlen_atomic(void)
** Tests VL datatype with VL datatypes of atomic datatypes.
**
****************************************************************/
-static size_t vlen_size_func(unsigned long n)
+static size_t
+vlen_size_func(unsigned long n)
{
- size_t u=1;
- size_t tmp=1;
- size_t result=1;
+ size_t u = 1;
+ size_t tmp = 1;
+ size_t result = 1;
- while(u<n) {
+ while (u < n) {
u++;
- tmp+=u;
- result+=tmp;
+ tmp += u;
+ result += tmp;
}
- return(result);
+ return (result);
}
/****************************************************************
@@ -1844,42 +1901,42 @@ static size_t vlen_size_func(unsigned long n)
static void
test_vltypes_vlen_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j,k; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j, k; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing VL Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+1)*sizeof(hvl_t));
- if(wdata[i].p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(hvl_t));
+ if (wdata[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
- wdata[i].len=i+1;
- for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) {
- t1->p=HDmalloc((j+1)*sizeof(unsigned int));
- if(t1->p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ wdata[i].len = i + 1;
+ for (t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + 1); j++, t1++) {
+ t1->p = HDmalloc((j + 1) * sizeof(unsigned int));
+ if (t1->p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return;
} /* end if */
- t1->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)t1->p)[k]=i*100+j*10+k;
+ t1->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)t1->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1890,11 +1947,11 @@ test_vltypes_vlen_vlen_atomic(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL datatype to refer to */
- tid1 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create the base VL type */
- tid2 = H5Tvlen_create (tid1);
+ tid2 = H5Tvlen_create(tid1);
CHECK(tid2, FAIL, "H5Tvlen_create");
/* Create a dataset */
@@ -1949,7 +2006,8 @@ test_vltypes_vlen_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
@@ -1958,7 +2016,10 @@ test_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size,
+ (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) +
+ vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)),
+ "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
@@ -1967,37 +2028,43 @@ test_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dread");
+ VERIFY(mem_used,
+ (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) +
+ vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)),
+ "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) {
- if(t1->len!=t2->len) {
- TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
+ for (t1 = (hvl_t *)wdata[i].p, t2 = (hvl_t *)(rdata[i].p), j = 0; j < rdata[i].len; j++, t1++, t2++) {
+ if (t1->len != t2->len) {
+ TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",
+ __LINE__, (int)i, (int)j, (int)t1->len, (int)t2->len);
continue;
} /* end if */
- for(k=0; k<t2->len; k++) {
- if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) {
- TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k]) {
+ TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n", (int)k,
+ (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -2035,42 +2102,42 @@ test_vltypes_vlen_vlen_atomic(void)
static void
rewrite_longer_vltypes_vlen_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j,k; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j, k; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 1;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Check memory leak for VL Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
wdata[i].p = HDmalloc((i + increment) * sizeof(hvl_t));
- if(wdata[i].p == NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ if (wdata[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
wdata[i].len = i + increment;
- for(t1 = wdata[i].p, j = 0; j < (i + increment); j++, t1++) {
+ for (t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) {
t1->p = HDmalloc((j + 1) * sizeof(unsigned int));
- if(t1->p == NULL) {
+ if (t1->p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return;
} /* end if */
t1->len = j + 1;
- for(k = 0; k < (j + 1); k++)
+ for (k = 0; k < (j + 1); k++)
((unsigned int *)t1->p)[k] = i * 1000 + j * 100 + k * 10;
} /* end for */
- } /* end for */
+ } /* end for */
/* Open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -2108,7 +2175,6 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file for data checking */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -2129,7 +2195,8 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
@@ -2150,34 +2217,38 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
/*VERIFY(mem_used,18*sizeof(hvl_t)+52*sizeof(unsigned int),"H5Dread");*/
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) {
- if(t1->len!=t2->len) {
- TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
+ for (t1 = (hvl_t *)(wdata[i].p), t2 = (hvl_t *)(rdata[i].p), j = 0; j < rdata[i].len;
+ j++, t1++, t2++) {
+ if (t1->len != t2->len) {
+ TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",
+ __LINE__, (int)i, (int)j, (int)t1->len, (int)t2->len);
continue;
} /* end if */
- for(k=0; k<t2->len; k++) {
- if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) {
- TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k]) {
+ TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n", (int)k,
+ (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -2211,42 +2282,42 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
static void
rewrite_shorter_vltypes_vlen_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid2; /* Datatype IDs */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- unsigned i,j,k; /* counting variables */
- size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1]; /* Information read in */
+ hvl_t * t1, *t2; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid2; /* Datatype IDs */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ unsigned i, j, k; /* counting variables */
+ size_t mem_used = 0; /* Memory used during allocation */
+ unsigned increment = 1;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Check memory leak for VL Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+increment)*sizeof(hvl_t));
- if(wdata[i].p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + increment) * sizeof(hvl_t));
+ if (wdata[i].p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
- wdata[i].len=i+increment;
- for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) {
- t1->p=HDmalloc((j+1)*sizeof(unsigned int));
- if(t1->p==NULL) {
- TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ wdata[i].len = i + increment;
+ for (t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) {
+ t1->p = HDmalloc((j + 1) * sizeof(unsigned int));
+ if (t1->p == NULL) {
+ TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return;
} /* end if */
- t1->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)t1->p)[k]=i*100000+j*1000+k*10;
+ t1->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)t1->p)[k] = i * 100000 + j * 1000 + k * 10;
} /* end for */
- } /* end for */
+ } /* end for */
/* Open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -2284,7 +2355,6 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file for data checking */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -2305,7 +2375,8 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
@@ -2314,46 +2385,56 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size,
+ (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) +
+ vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)),
+ "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used,
+ (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) +
+ vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)),
+ "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].len!=rdata[i].len) {
- TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (wdata[i].len != rdata[i].len) {
+ TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n", __LINE__,
+ (int)i, (int)wdata[i].len, (int)i, (int)rdata[i].len);
continue;
} /* end if */
- for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) {
- if(t1->len!=t2->len) {
- TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
+ for (t1 = (hvl_t *)(wdata[i].p), t2 = (hvl_t *)(rdata[i].p), j = 0; j < rdata[i].len;
+ j++, t1++, t2++) {
+ if (t1->len != t2->len) {
+ TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",
+ __LINE__, (int)i, (int)j, (int)t1->len, (int)t2->len);
continue;
} /* end if */
- for(k=0; k<t2->len; k++) {
- if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) {
- TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
+ for (k = 0; k < t2->len; k++) {
+ if (((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k]) {
+ TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n", (int)k,
+ (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close Dataset */
@@ -2389,52 +2470,55 @@ static void
test_vltypes_fill_value(void)
{
typedef struct dtype1_struct {
- unsigned int gui;
- unsigned int pgui;
- char *str_id;
- char *str_name;
- char *str_desc;
- char *str_orig;
- char *str_stat;
- unsigned int ver;
- double val;
- double ma;
- double mi;
- char *str_form;
- char *str_unit;
+ unsigned int gui;
+ unsigned int pgui;
+ char * str_id;
+ char * str_name;
+ char * str_desc;
+ char * str_orig;
+ char * str_stat;
+ unsigned int ver;
+ double val;
+ double ma;
+ double mi;
+ char * str_form;
+ char * str_unit;
} dtype1_struct;
- herr_t ret;
- hid_t file_id;
- hid_t dtype1_id = -1;
- hid_t str_id = -1;
- hid_t small_dspace_id; /* Dataspace ID for small datasets */
- hid_t large_dspace_id; /* Dataspace ID for large datasets */
- hid_t small_select_dspace_id; /* Dataspace ID for selection in small datasets */
- hid_t large_select_dspace_id; /* Dataspace ID for selection in large datasets */
- hid_t dset_dspace_id; /* Dataspace ID for a particular dataset */
- hid_t dset_select_dspace_id; /* Dataspace ID for selection in a particular dataset */
- hid_t scalar_dspace_id; /* Dataspace ID for scalar dataspace */
- hid_t single_dspace_id; /* Dataspace ID for single element selection */
- hsize_t single_offset[] = {2}; /* Offset of single element selection */
- hsize_t single_block[] = {1}; /* Block size of single element selection */
- hsize_t select_offset[] = {0}; /* Offset of non-contiguous element selection */
- hsize_t select_stride[] = {2}; /* Stride size of non-contiguous element selection */
- hsize_t small_select_count[] = {SPACE4_DIM_SMALL / 2}; /* Count of small non-contiguous element selection */
- hsize_t large_select_count[] = {SPACE4_DIM_LARGE / 2}; /* Count of large non-contiguous element selection */
- hsize_t select_block[] = {1}; /* Block size of non-contiguous element selection */
- hid_t dcpl_id, xfer_pid;
- hid_t dset_id;
- hsize_t small_dims[] = {SPACE4_DIM_SMALL};
- hsize_t large_dims[] = {SPACE4_DIM_LARGE};
- size_t dset_elmts; /* Number of elements in a particular dataset */
- const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"};
+ herr_t ret;
+ hid_t file_id;
+ hid_t dtype1_id = -1;
+ hid_t str_id = -1;
+ hid_t small_dspace_id; /* Dataspace ID for small datasets */
+ hid_t large_dspace_id; /* Dataspace ID for large datasets */
+ hid_t small_select_dspace_id; /* Dataspace ID for selection in small datasets */
+ hid_t large_select_dspace_id; /* Dataspace ID for selection in large datasets */
+ hid_t dset_dspace_id; /* Dataspace ID for a particular dataset */
+ hid_t dset_select_dspace_id; /* Dataspace ID for selection in a particular dataset */
+ hid_t scalar_dspace_id; /* Dataspace ID for scalar dataspace */
+ hid_t single_dspace_id; /* Dataspace ID for single element selection */
+ hsize_t single_offset[] = {2}; /* Offset of single element selection */
+ hsize_t single_block[] = {1}; /* Block size of single element selection */
+ hsize_t select_offset[] = {0}; /* Offset of non-contiguous element selection */
+ hsize_t select_stride[] = {2}; /* Stride size of non-contiguous element selection */
+ hsize_t small_select_count[] = {SPACE4_DIM_SMALL /
+ 2}; /* Count of small non-contiguous element selection */
+ hsize_t large_select_count[] = {SPACE4_DIM_LARGE /
+ 2}; /* Count of large non-contiguous element selection */
+ hsize_t select_block[] = {1}; /* Block size of non-contiguous element selection */
+ hid_t dcpl_id, xfer_pid;
+ hid_t dset_id;
+ hsize_t small_dims[] = {SPACE4_DIM_SMALL};
+ hsize_t large_dims[] = {SPACE4_DIM_LARGE};
+ size_t dset_elmts; /* Number of elements in a particular dataset */
+ const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead",
+ 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"};
const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"};
- dtype1_struct *rbuf = NULL; /* Buffer for reading data */
- size_t mem_used = 0; /* Memory used during allocation */
- H5D_layout_t layout; /* Dataset storage layout */
- char dset_name1[64], dset_name2[64]; /* Dataset names */
- unsigned i;
+ dtype1_struct * rbuf = NULL; /* Buffer for reading data */
+ size_t mem_used = 0; /* Memory used during allocation */
+ H5D_layout_t layout; /* Dataset storage layout */
+ char dset_name1[64], dset_name2[64]; /* Dataset names */
+ unsigned i;
/* Output message about test being performed */
MESSAGE(5, ("Check fill value for VL data\n"));
@@ -2442,61 +2526,59 @@ test_vltypes_fill_value(void)
/* Create a string datatype */
str_id = H5Tcopy(H5T_C_S1);
CHECK(str_id, FAIL, "H5Tcopy");
- ret = H5Tset_size(str_id,H5T_VARIABLE);
+ ret = H5Tset_size(str_id, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
/* Create a compound data type */
dtype1_id = H5Tcreate(H5T_COMPOUND, sizeof(struct dtype1_struct));
CHECK(dtype1_id, FAIL, "H5Tcreate");
- ret = H5Tinsert(dtype1_id,"guid",HOFFSET(struct dtype1_struct,gui),H5T_NATIVE_UINT);
+ ret = H5Tinsert(dtype1_id, "guid", HOFFSET(struct dtype1_struct, gui), H5T_NATIVE_UINT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"pguid",HOFFSET(struct dtype1_struct,pgui),H5T_NATIVE_UINT);
+ ret = H5Tinsert(dtype1_id, "pguid", HOFFSET(struct dtype1_struct, pgui), H5T_NATIVE_UINT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_id",HOFFSET(dtype1_struct,str_id),str_id);
+ ret = H5Tinsert(dtype1_id, "str_id", HOFFSET(dtype1_struct, str_id), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_name",HOFFSET(dtype1_struct,str_name),str_id);
+ ret = H5Tinsert(dtype1_id, "str_name", HOFFSET(dtype1_struct, str_name), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_desc",HOFFSET(dtype1_struct,str_desc),str_id);
+ ret = H5Tinsert(dtype1_id, "str_desc", HOFFSET(dtype1_struct, str_desc), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_orig",HOFFSET(dtype1_struct,str_orig),str_id);
+ ret = H5Tinsert(dtype1_id, "str_orig", HOFFSET(dtype1_struct, str_orig), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_stat",HOFFSET(dtype1_struct,str_stat),str_id);
+ ret = H5Tinsert(dtype1_id, "str_stat", HOFFSET(dtype1_struct, str_stat), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"ver",HOFFSET(struct dtype1_struct,ver),H5T_NATIVE_UINT);
+ ret = H5Tinsert(dtype1_id, "ver", HOFFSET(struct dtype1_struct, ver), H5T_NATIVE_UINT);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"val",HOFFSET(struct dtype1_struct,val),H5T_NATIVE_DOUBLE);
+ ret = H5Tinsert(dtype1_id, "val", HOFFSET(struct dtype1_struct, val), H5T_NATIVE_DOUBLE);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"ma",HOFFSET(struct dtype1_struct,ma),H5T_NATIVE_DOUBLE);
+ ret = H5Tinsert(dtype1_id, "ma", HOFFSET(struct dtype1_struct, ma), H5T_NATIVE_DOUBLE);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"mi",HOFFSET(struct dtype1_struct,mi),H5T_NATIVE_DOUBLE);
+ ret = H5Tinsert(dtype1_id, "mi", HOFFSET(struct dtype1_struct, mi), H5T_NATIVE_DOUBLE);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_form",HOFFSET(dtype1_struct,str_form),str_id);
+ ret = H5Tinsert(dtype1_id, "str_form", HOFFSET(dtype1_struct, str_form), str_id);
CHECK(ret, FAIL, "H5Tinsert");
- ret = H5Tinsert(dtype1_id,"str_unit",HOFFSET(dtype1_struct,str_unit),str_id);
+ ret = H5Tinsert(dtype1_id, "str_unit", HOFFSET(dtype1_struct, str_unit), str_id);
CHECK(ret, FAIL, "H5Tinsert");
/* Close string datatype */
ret = H5Tclose(str_id);
CHECK(ret, FAIL, "H5Tclose");
-
/* Allocate space for the buffer to read data */
- rbuf = HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct));
- CHECK(rbuf, NULL, "HDmalloc");
-
+ rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct));
+ CHECK_PTR(rbuf, "HDmalloc");
/* Create the small & large dataspaces to use */
small_dspace_id = H5Screate_simple(SPACE4_RANK, small_dims, NULL);
@@ -2509,15 +2591,15 @@ test_vltypes_fill_value(void)
small_select_dspace_id = H5Scopy(small_dspace_id);
CHECK(small_select_dspace_id, FAIL, "H5Scopy");
- ret = H5Sselect_hyperslab(small_select_dspace_id, H5S_SELECT_SET,
- select_offset, select_stride, small_select_count, select_block);
+ ret = H5Sselect_hyperslab(small_select_dspace_id, H5S_SELECT_SET, select_offset, select_stride,
+ small_select_count, select_block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
large_select_dspace_id = H5Scopy(large_dspace_id);
CHECK(large_select_dspace_id, FAIL, "H5Scopy");
- ret = H5Sselect_hyperslab(large_select_dspace_id, H5S_SELECT_SET,
- select_offset, select_stride, large_select_count, select_block);
+ ret = H5Sselect_hyperslab(large_select_dspace_id, H5S_SELECT_SET, select_offset, select_stride,
+ large_select_count, select_block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a scalar dataspace */
@@ -2536,32 +2618,32 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fcreate");
/* Create datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
- unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
- unsigned test_loop; /* Loop over datasets */
+ for (layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
+ unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
+ unsigned test_loop; /* Loop over datasets */
#ifdef H5_HAVE_FILTER_DEFLATE
- if(layout == H5D_CHUNKED)
+ if (layout == H5D_CHUNKED)
compress_loop = 2;
else
#endif /* H5_HAVE_FILTER_DEFLATE */
compress_loop = 1;
/* Loop over dataset operations */
- for(test_loop = 0; test_loop < compress_loop; test_loop++) {
- hid_t tmp_dcpl_id; /* Temporary copy of the dataset creation property list */
+ for (test_loop = 0; test_loop < compress_loop; test_loop++) {
+ hid_t tmp_dcpl_id; /* Temporary copy of the dataset creation property list */
/* Make a copy of the dataset creation property list */
tmp_dcpl_id = H5Pcopy(dcpl_id);
CHECK(tmp_dcpl_id, FAIL, "H5Pcopy");
/* Layout specific actions */
- switch(layout) {
+ switch (layout) {
case H5D_COMPACT:
HDstrcpy(dset_name1, "dataset1-compact");
HDstrcpy(dset_name2, "dataset2-compact");
dset_dspace_id = small_dspace_id;
- ret = H5Pset_layout(tmp_dcpl_id, H5D_COMPACT);
+ ret = H5Pset_layout(tmp_dcpl_id, H5D_COMPACT);
CHECK(ret, FAIL, "H5Pset_layout");
break;
@@ -2571,29 +2653,27 @@ test_vltypes_fill_value(void)
dset_dspace_id = large_dspace_id;
break;
- case H5D_CHUNKED:
- {
- hsize_t chunk_dims[1] = {SPACE4_DIM_LARGE / 4};
+ case H5D_CHUNKED: {
+ hsize_t chunk_dims[1] = {SPACE4_DIM_LARGE / 4};
- dset_dspace_id = large_dspace_id;
- ret = H5Pset_chunk(tmp_dcpl_id, 1, chunk_dims);
- CHECK(ret, FAIL, "H5Pset_chunk");
+ dset_dspace_id = large_dspace_id;
+ ret = H5Pset_chunk(tmp_dcpl_id, 1, chunk_dims);
+ CHECK(ret, FAIL, "H5Pset_chunk");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(test_loop == 1) {
- HDstrcpy(dset_name1, "dataset1-chunked-compressed");
- HDstrcpy(dset_name2, "dataset2-chunked-compressed");
- ret = H5Pset_deflate(tmp_dcpl_id, 3);
- CHECK(ret, FAIL, "H5Pset_deflate");
- } /* end if */
- else {
+ if (test_loop == 1) {
+ HDstrcpy(dset_name1, "dataset1-chunked-compressed");
+ HDstrcpy(dset_name2, "dataset2-chunked-compressed");
+ ret = H5Pset_deflate(tmp_dcpl_id, 3);
+ CHECK(ret, FAIL, "H5Pset_deflate");
+ } /* end if */
+ else {
#endif /* H5_HAVE_FILTER_DEFLATE */
- HDstrcpy(dset_name1, "dataset1-chunked");
- HDstrcpy(dset_name2, "dataset2-chunked");
+ HDstrcpy(dset_name1, "dataset1-chunked");
+ HDstrcpy(dset_name2, "dataset2-chunked");
#ifdef H5_HAVE_FILTER_DEFLATE
- } /* end else */
-#endif /* H5_HAVE_FILTER_DEFLATE */
- }
- break;
+ } /* end else */
+#endif /* H5_HAVE_FILTER_DEFLATE */
+ } break;
default:
assert(0 && "Unknown layout type!");
@@ -2601,13 +2681,13 @@ test_vltypes_fill_value(void)
} /* end switch */
/* Create first data set with default setting - no space is allocated */
- dset_id = H5Dcreate2(file_id, dset_name1, dtype1_id, dset_dspace_id, H5P_DEFAULT, tmp_dcpl_id, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, dset_name1, dtype1_id, dset_dspace_id, H5P_DEFAULT, tmp_dcpl_id,
+ H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
-
/* Create a second data set with space allocated and fill value written */
ret = H5Pset_fill_time(tmp_dcpl_id, H5D_FILL_TIME_IFSET);
CHECK(ret, FAIL, "H5Pset_fill_time");
@@ -2615,7 +2695,8 @@ test_vltypes_fill_value(void)
ret = H5Pset_alloc_time(tmp_dcpl_id, H5D_ALLOC_TIME_EARLY);
CHECK(ret, FAIL, "H5Pset_alloc_time");
- dset_id = H5Dcreate2(file_id, dset_name2, dtype1_id, dset_dspace_id, H5P_DEFAULT, tmp_dcpl_id, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, dset_name2, dtype1_id, dset_dspace_id, H5P_DEFAULT, tmp_dcpl_id,
+ H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
ret = H5Dclose(dset_id);
@@ -2625,7 +2706,7 @@ test_vltypes_fill_value(void)
ret = H5Pclose(tmp_dcpl_id);
CHECK(ret, FAIL, "H5Pclose");
} /* end for */
- } /* end for */
+ } /* end for */
ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
@@ -2633,12 +2714,12 @@ test_vltypes_fill_value(void)
ret = H5Pclose(dcpl_id);
CHECK(ret, FAIL, "H5Pclose");
-
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Open the file to check data set value */
@@ -2646,41 +2727,41 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fopen");
/* Read empty datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
- unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
- unsigned test_loop; /* Loop over datasets */
+ for (layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
+ unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
+ unsigned test_loop; /* Loop over datasets */
#ifdef H5_HAVE_FILTER_DEFLATE
- if(layout == H5D_CHUNKED)
+ if (layout == H5D_CHUNKED)
compress_loop = 2;
else
#endif /* H5_HAVE_FILTER_DEFLATE */
compress_loop = 1;
/* Loop over dataset operations */
- for(test_loop = 0; test_loop < compress_loop; test_loop++) {
+ for (test_loop = 0; test_loop < compress_loop; test_loop++) {
/* Layout specific actions */
- switch(layout) {
+ switch (layout) {
case H5D_COMPACT:
HDstrcpy(dset_name1, "dataset1-compact");
HDstrcpy(dset_name2, "dataset2-compact");
- dset_dspace_id = small_dspace_id;
+ dset_dspace_id = small_dspace_id;
dset_select_dspace_id = small_select_dspace_id;
- dset_elmts = SPACE4_DIM_SMALL;
+ dset_elmts = SPACE4_DIM_SMALL;
break;
case H5D_CONTIGUOUS:
HDstrcpy(dset_name1, "dataset1-contig");
HDstrcpy(dset_name2, "dataset2-contig");
- dset_dspace_id = large_dspace_id;
+ dset_dspace_id = large_dspace_id;
dset_select_dspace_id = large_select_dspace_id;
- dset_elmts = SPACE4_DIM_LARGE;
+ dset_elmts = SPACE4_DIM_LARGE;
break;
case H5D_CHUNKED:
#ifdef H5_HAVE_FILTER_DEFLATE
- if(test_loop == 1) {
+ if (test_loop == 1) {
HDstrcpy(dset_name1, "dataset1-chunked-compressed");
HDstrcpy(dset_name2, "dataset2-chunked-compressed");
} /* end if */
@@ -2690,10 +2771,10 @@ test_vltypes_fill_value(void)
HDstrcpy(dset_name2, "dataset2-chunked");
#ifdef H5_HAVE_FILTER_DEFLATE
} /* end else */
-#endif /* H5_HAVE_FILTER_DEFLATE */
- dset_dspace_id = large_dspace_id;
+#endif /* H5_HAVE_FILTER_DEFLATE */
+ dset_dspace_id = large_dspace_id;
dset_select_dspace_id = large_select_dspace_id;
- dset_elmts = SPACE4_DIM_LARGE;
+ dset_elmts = SPACE4_DIM_LARGE;
break;
default:
@@ -2710,18 +2791,15 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ for (i = 0; i < dset_elmts; i++) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Release the space */
ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2735,28 +2813,24 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if((i % 2) == select_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ for (i = 0; i < dset_elmts; i++) {
+ if ((i % 2) == select_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc
- || rbuf[i].str_orig || rbuf[i].str_stat
- || rbuf[i].str_form || rbuf[i].str_unit) {
+ if (rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc || rbuf[i].str_orig ||
+ rbuf[i].str_stat || rbuf[i].str_form || rbuf[i].str_unit) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
/* Release the space */
ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2765,7 +2839,6 @@ test_vltypes_fill_value(void)
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
-
/* Open the second data set to check the value of data */
dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dopen2");
@@ -2775,18 +2848,15 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Release the space */
ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2800,28 +2870,24 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if((i % 2) == select_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ for (i = 0; i < dset_elmts; i++) {
+ if ((i % 2) == select_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc
- || rbuf[i].str_orig || rbuf[i].str_stat
- || rbuf[i].str_form || rbuf[i].str_unit) {
+ if (rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc || rbuf[i].str_orig ||
+ rbuf[i].str_stat || rbuf[i].str_form || rbuf[i].str_unit) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
/* Release the space */
ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
@@ -2830,52 +2896,51 @@ test_vltypes_fill_value(void)
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
} /* end for */
- } /* end for */
+ } /* end for */
ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
-
/* Open the file to check data set value */
file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(file_id, FAIL, "H5Fopen");
/* Write one element & fill values to datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
- unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
- unsigned test_loop; /* Loop over datasets */
+ for (layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
+ unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
+ unsigned test_loop; /* Loop over datasets */
#ifdef H5_HAVE_FILTER_DEFLATE
- if(layout == H5D_CHUNKED)
+ if (layout == H5D_CHUNKED)
compress_loop = 2;
else
#endif /* H5_HAVE_FILTER_DEFLATE */
compress_loop = 1;
/* Loop over dataset operations */
- for(test_loop = 0; test_loop < compress_loop; test_loop++) {
+ for (test_loop = 0; test_loop < compress_loop; test_loop++) {
/* Layout specific actions */
- switch(layout) {
+ switch (layout) {
case H5D_COMPACT:
HDstrcpy(dset_name1, "dataset1-compact");
HDstrcpy(dset_name2, "dataset2-compact");
- dset_dspace_id = small_dspace_id;
+ dset_dspace_id = small_dspace_id;
dset_select_dspace_id = small_select_dspace_id;
- dset_elmts = SPACE4_DIM_SMALL;
+ dset_elmts = SPACE4_DIM_SMALL;
break;
case H5D_CONTIGUOUS:
HDstrcpy(dset_name1, "dataset1-contig");
HDstrcpy(dset_name2, "dataset2-contig");
- dset_dspace_id = large_dspace_id;
+ dset_dspace_id = large_dspace_id;
dset_select_dspace_id = large_select_dspace_id;
- dset_elmts = SPACE4_DIM_LARGE;
+ dset_elmts = SPACE4_DIM_LARGE;
break;
case H5D_CHUNKED:
#ifdef H5_HAVE_FILTER_DEFLATE
- if(test_loop == 1) {
+ if (test_loop == 1) {
HDstrcpy(dset_name1, "dataset1-chunked-compressed");
HDstrcpy(dset_name2, "dataset2-chunked-compressed");
} /* end if */
@@ -2885,10 +2950,10 @@ test_vltypes_fill_value(void)
HDstrcpy(dset_name2, "dataset2-chunked");
#ifdef H5_HAVE_FILTER_DEFLATE
} /* end else */
-#endif /* H5_HAVE_FILTER_DEFLATE */
- dset_dspace_id = large_dspace_id;
+#endif /* H5_HAVE_FILTER_DEFLATE */
+ dset_dspace_id = large_dspace_id;
dset_select_dspace_id = large_select_dspace_id;
- dset_elmts = SPACE4_DIM_LARGE;
+ dset_elmts = SPACE4_DIM_LARGE;
break;
default:
@@ -2901,8 +2966,8 @@ test_vltypes_fill_value(void)
CHECK(single_dspace_id, FAIL, "H5Scopy");
/* Set a single element in the dataspace */
- ret = H5Sselect_hyperslab(single_dspace_id, H5S_SELECT_SET, single_offset,
- NULL, single_block, NULL);
+ ret = H5Sselect_hyperslab(single_dspace_id, H5S_SELECT_SET, single_offset, NULL, single_block,
+ NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Open first data set */
@@ -2917,32 +2982,28 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(i == single_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, wdata.str_id)
- || rbuf[i].str_name
- || HDstrcmp(rbuf[i].str_desc, wdata.str_desc)
- || HDstrcmp(rbuf[i].str_orig, wdata.str_orig)
- || HDstrcmp(rbuf[i].str_stat, wdata.str_stat)
- || HDstrcmp(rbuf[i].str_form, wdata.str_form)
- || HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (i == single_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name ||
+ HDstrcmp(rbuf[i].str_desc, wdata.str_desc) ||
+ HDstrcmp(rbuf[i].str_orig, wdata.str_orig) ||
+ HDstrcmp(rbuf[i].str_stat, wdata.str_stat) ||
+ HDstrcmp(rbuf[i].str_form, wdata.str_form) ||
+ HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig,"\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Release the space */
ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2956,42 +3017,37 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(i == single_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, wdata.str_id)
- || rbuf[i].str_name
- || HDstrcmp(rbuf[i].str_desc, wdata.str_desc)
- || HDstrcmp(rbuf[i].str_orig, wdata.str_orig)
- || HDstrcmp(rbuf[i].str_stat, wdata.str_stat)
- || HDstrcmp(rbuf[i].str_form, wdata.str_form)
- || HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (i == single_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name ||
+ HDstrcmp(rbuf[i].str_desc, wdata.str_desc) ||
+ HDstrcmp(rbuf[i].str_orig, wdata.str_orig) ||
+ HDstrcmp(rbuf[i].str_stat, wdata.str_stat) ||
+ HDstrcmp(rbuf[i].str_form, wdata.str_form) ||
+ HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if((i % 2) == select_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ if ((i % 2) == select_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc
- || rbuf[i].str_orig || rbuf[i].str_stat
- || rbuf[i].str_form || rbuf[i].str_unit) {
+ if (rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc || rbuf[i].str_orig ||
+ rbuf[i].str_stat || rbuf[i].str_form || rbuf[i].str_unit) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end else */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end else */
+ } /* end for */
/* Release the space */
ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
@@ -3000,7 +3056,6 @@ test_vltypes_fill_value(void)
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
-
/* Open the second data set to check the value of data */
dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dopen2");
@@ -3013,32 +3068,28 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(i == single_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, wdata.str_id)
- || rbuf[i].str_name
- || HDstrcmp(rbuf[i].str_desc, wdata.str_desc)
- || HDstrcmp(rbuf[i].str_orig, wdata.str_orig)
- || HDstrcmp(rbuf[i].str_stat, wdata.str_stat)
- || HDstrcmp(rbuf[i].str_form, wdata.str_form)
- || HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (i == single_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name ||
+ HDstrcmp(rbuf[i].str_desc, wdata.str_desc) ||
+ HDstrcmp(rbuf[i].str_orig, wdata.str_orig) ||
+ HDstrcmp(rbuf[i].str_stat, wdata.str_stat) ||
+ HDstrcmp(rbuf[i].str_form, wdata.str_form) ||
+ HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig,"\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
/* Release the space */
ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
@@ -3052,42 +3103,37 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < dset_elmts; i++) {
- if(i == single_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, wdata.str_id)
- || rbuf[i].str_name
- || HDstrcmp(rbuf[i].str_desc, wdata.str_desc)
- || HDstrcmp(rbuf[i].str_orig, wdata.str_orig)
- || HDstrcmp(rbuf[i].str_stat, wdata.str_stat)
- || HDstrcmp(rbuf[i].str_form, wdata.str_form)
- || HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
- TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n",__LINE__,(int)i);
+ for (i = 0; i < dset_elmts; i++) {
+ if (i == single_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, wdata.str_id) || rbuf[i].str_name ||
+ HDstrcmp(rbuf[i].str_desc, wdata.str_desc) ||
+ HDstrcmp(rbuf[i].str_orig, wdata.str_orig) ||
+ HDstrcmp(rbuf[i].str_stat, wdata.str_stat) ||
+ HDstrcmp(rbuf[i].str_form, wdata.str_form) ||
+ HDstrcmp(rbuf[i].str_unit, wdata.str_unit)) {
+ TestErrPrintf("%d: VL data doesn't match!, index(i)=%d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if((i % 2) == select_offset[0]) {
- if(HDstrcmp(rbuf[i].str_id, "foobar")
- || HDstrcmp(rbuf[i].str_name, "")
- || rbuf[i].str_desc
- || HDstrcmp(rbuf[i].str_orig, "\0")
- || HDstrcmp(rbuf[i].str_stat, "dead")
- || HDstrcmp(rbuf[i].str_form, "liquid")
- || HDstrcmp(rbuf[i].str_unit, "meter")) {
+ if ((i % 2) == select_offset[0]) {
+ if (HDstrcmp(rbuf[i].str_id, "foobar") || HDstrcmp(rbuf[i].str_name, "") ||
+ rbuf[i].str_desc || HDstrcmp(rbuf[i].str_orig, "\0") ||
+ HDstrcmp(rbuf[i].str_stat, "dead") || HDstrcmp(rbuf[i].str_form, "liquid") ||
+ HDstrcmp(rbuf[i].str_unit, "meter")) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc
- || rbuf[i].str_orig || rbuf[i].str_stat
- || rbuf[i].str_form || rbuf[i].str_unit) {
+ if (rbuf[i].str_id || rbuf[i].str_name || rbuf[i].str_desc || rbuf[i].str_orig ||
+ rbuf[i].str_stat || rbuf[i].str_form || rbuf[i].str_unit) {
TestErrPrintf("%d: VL data doesn't match!, index(i) = %d\n", __LINE__, (int)i);
continue;
} /* end if */
- } /* end else */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end else */
+ } /* end for */
/* Release the space */
ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
@@ -3100,12 +3146,11 @@ test_vltypes_fill_value(void)
ret = H5Sclose(single_dspace_id);
CHECK(ret, FAIL, "H5Sclose");
} /* end for */
- } /* end for */
+ } /* end for */
ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
-
/* Clean up rest of IDs */
ret = H5Pclose(xfer_pid);
CHECK(ret, FAIL, "H5Pclose");
@@ -3144,32 +3189,31 @@ test_vltypes(void)
MESSAGE(5, ("Testing Variable-Length Datatypes\n"));
/* These next tests use the same file */
- test_vltypes_dataset_create(); /* Check dataset of VL when fill value
- * won't be rewritten to it.*/
- test_vltypes_funcs(); /* Test functions with VL types */
- test_vltypes_vlen_atomic(); /* Test VL atomic datatypes */
- rewrite_vltypes_vlen_atomic(); /* Check VL memory leak */
- test_vltypes_vlen_compound(); /* Test VL compound datatypes */
- rewrite_vltypes_vlen_compound(); /* Check VL memory leak */
- test_vltypes_compound_vlen_atomic(); /* Test compound datatypes with VL atomic components */
- rewrite_vltypes_compound_vlen_atomic();/* Check VL memory leak */
- test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */
+ test_vltypes_dataset_create(); /* Check dataset of VL when fill value
+ * won't be rewritten to it.*/
+ test_vltypes_funcs(); /* Test functions with VL types */
+ test_vltypes_vlen_atomic(); /* Test VL atomic datatypes */
+ rewrite_vltypes_vlen_atomic(); /* Check VL memory leak */
+ test_vltypes_vlen_compound(); /* Test VL compound datatypes */
+ rewrite_vltypes_vlen_compound(); /* Check VL memory leak */
+ test_vltypes_compound_vlen_atomic(); /* Test compound datatypes with VL atomic components */
+ rewrite_vltypes_compound_vlen_atomic(); /* Check VL memory leak */
+ test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */
rewrite_longer_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of longer sequence*/
- rewrite_shorter_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of shorted sequence*/
- test_vltypes_compound_vlen_vlen();/* Test compound datatypes with VL atomic components */
- test_vltypes_compound_vlstr(); /* Test data rewritten of nested VL data */
- test_vltypes_fill_value(); /* Test fill value for VL data */
-} /* test_vltypes() */
+ rewrite_shorter_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of shorted sequence*/
+ test_vltypes_compound_vlen_vlen(); /* Test compound datatypes with VL atomic components */
+ test_vltypes_compound_vlstr(); /* Test data rewritten of nested VL data */
+ test_vltypes_fill_value(); /* Test fill value for VL data */
+} /* test_vltypes() */
-
/*-------------------------------------------------------------------------
- * Function: cleanup_vltypes
+ * Function: cleanup_vltypes
*
- * Purpose: Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return: none
+ * Return: none
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* June 8, 1999
*
* Modifications: