summaryrefslogtreecommitdiffstats
path: root/test/tarray.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/tarray.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/tarray.c')
-rw-r--r--test/tarray.c1567
1 files changed, 834 insertions, 733 deletions
diff --git a/test/tarray.c b/test/tarray.c
index a32b5b8..072df28 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -6,74 +6,96 @@
* 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: tarray
-*
-* Test the Array Datatype functionality
-*
-*************************************************************/
+ *
+ * Test program: tarray
+ *
+ * Test the Array Datatype functionality
+ *
+ *************************************************************/
#include "testhdf5.h"
#include "H5srcdir.h"
-#include "hdf5.h"
-
-#define FILENAME "tarray1.h5"
-#define TESTFILE "tarrold.h5"
+#define FILENAME "tarray1.h5"
+#define TESTFILE "tarrold.h5"
/* 1-D array datatype */
-#define ARRAY1_RANK 1
+#define ARRAY1_RANK 1
#define ARRAY1_DIM1 4
/* 3-D array datatype */
-#define ARRAY2_RANK 3
+#define ARRAY2_RANK 3
#define ARRAY2_DIM1 3
#define ARRAY2_DIM2 4
#define ARRAY2_DIM3 5
/* 2-D array datatype */
-#define ARRAY3_RANK 2
+#define ARRAY3_RANK 2
#define ARRAY3_DIM1 6
#define ARRAY3_DIM2 3
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
+
+/* Parameters used with the test_array_bkg() test */
+#define FIELDNAME "ArrayofStructures"
+#define LENGTH 5
+#define ALEN 10
+#define RANK 1
+#define NMAX 100
+
+/* Struct used with test_array_bkg() test */
+typedef struct {
+ int nsubfields;
+ char * name[NMAX];
+ size_t offset[NMAX];
+ hid_t datatype[NMAX];
-/****************************************************************
-**
-** test_array_atomic_1d(): Test basic array datatype code.
-** Tests 1-D array of atomic datatypes
-**
-****************************************************************/
+} CmpDTSinfo;
+
+/* Forward declarations for custom vlen memory manager functions */
+void *test_array_alloc_custom(size_t size, void *info);
+void test_array_free_custom(void *mem, void *info);
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_atomic_1d
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_atomic_1d(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- int rdata[SPACE1_DIM1][ARRAY1_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 */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ int rdata[SPACE1_DIM1][ARRAY1_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 */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i, j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Atomic Datatypes Functionality\n"));
/* Allocate and initialize array data to write */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++)
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
wdata[i][j] = i * 10 + j;
/* Create file */
@@ -112,7 +134,6 @@ test_array_atomic_1d(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -122,7 +143,7 @@ test_array_atomic_1d(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the datatype */
- tid1 = H5Dget_type (dataset);
+ tid1 = H5Dget_type(dataset);
CHECK(tid1, FAIL, "H5Dget_type");
/* Check the array rank */
@@ -134,9 +155,10 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims; i++)
- if(rdims1[i] != tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
@@ -145,10 +167,11 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++)
- if(wdata[i][j] != rdata[i][j]) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d]=%d, rdata[%d][%d]=%d\n", (int)i, (int)j, (int)wdata[i][j], (int)i, (int)j, (int)rdata[i][j]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ if (wdata[i][j] != rdata[i][j]) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d]=%d, rdata[%d][%d]=%d\n",
+ (int)i, (int)j, (int)wdata[i][j], (int)i, (int)j, (int)rdata[i][j]);
continue;
} /* end if */
@@ -165,94 +188,100 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_atomic_1d() */
-/****************************************************************
-**
-** test_array_funcs(): Test some type functions that are and
-** aren't supposed to work with array type.
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_array_funcs
+ *
+ * Purpose: Test some type functions that are and aren't supposed to
+ * work with array type.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_funcs(void)
{
- hid_t type; /* Datatype ID */
- hsize_t tdims1[] = {ARRAY1_DIM1};
- 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 */
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ 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 */
/* Create a datatype to refer to */
type = H5Tarray_create2(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1);
CHECK(type, FAIL, "H5Tarray_create2");
- 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);
+ inpad = H5Tget_inpad(type);
CHECK(inpad, FAIL, "H5Tget_inpad");
- norm=H5Tget_norm(type);
+ norm = H5Tget_norm(type);
CHECK(norm, FAIL, "H5Tget_norm");
- ret=H5Tset_offset(type, (size_t)16);
+ 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 */
ret = H5Tclose(type);
CHECK(ret, FAIL, "H5Tclose");
-} /* end test_array_funcs */
+} /* end test_array_funcs() */
-/****************************************************************
-**
-** test_array_atomic_3d(): Test basic array datatype code.
-** Tests 3-D array of atomic datatypes
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_array_atomic_3d
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 3-D array of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_atomic_3d(void)
{
- int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
- int rdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information read in */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
- int ndims; /* Array rank for reading */
- hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
+ int rdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information read in */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims2[] = {ARRAY2_DIM1, ARRAY2_DIM2, ARRAY2_DIM3};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i, j, k, l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 3-D Array of Atomic Datatypes Functionality\n"));
/* Allocate and initialize array data to write */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY2_DIM1; j++)
- for(k = 0; k < ARRAY2_DIM2; k++)
- for(l = 0; l < ARRAY2_DIM3; l++)
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY2_DIM1; j++)
+ for (k = 0; k < ARRAY2_DIM2; k++)
+ for (l = 0; l < ARRAY2_DIM3; l++)
wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l;
/* Create file */
@@ -291,7 +320,6 @@ test_array_atomic_3d(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -301,7 +329,7 @@ test_array_atomic_3d(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the datatype */
- tid = H5Dget_type (dataset);
+ tid = H5Dget_type(dataset);
CHECK(tid, FAIL, "H5Dget_type");
/* Check the array rank */
@@ -313,9 +341,10 @@ test_array_atomic_3d(void)
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims; i++)
- if(rdims2[i] != tdims2[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n", (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims2[i] != tdims2[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",
+ (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]);
continue;
} /* end if */
@@ -324,12 +353,15 @@ test_array_atomic_3d(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY2_DIM1; j++)
- for(k = 0; k < ARRAY2_DIM2; k++)
- for(l = 0; l < ARRAY2_DIM3; l++)
- if(wdata[i][j][k][l] != rdata[i][j][k][l]) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n", (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j, (int)k, (int)l, (int)rdata[i][j][k][l]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY2_DIM1; j++)
+ for (k = 0; k < ARRAY2_DIM2; k++)
+ for (l = 0; l < ARRAY2_DIM3; l++)
+ if (wdata[i][j][k][l] != rdata[i][j][k][l]) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, "
+ "rdata[%d][%d][%d][%d]=%d\n",
+ (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j,
+ (int)k, (int)l, (int)rdata[i][j][k][l]);
continue;
} /* end if */
@@ -347,40 +379,44 @@ test_array_atomic_3d(void)
} /* end test_array_atomic_3d() */
-/****************************************************************
-**
-** test_array_array_atomic(): Test basic array datatype code.
-** Tests 1-D array 2-D arrays of atomic datatypes
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_array_array_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array 2-D arrays of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_array_atomic(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
- int rdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information read in */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid1; /* 1-D array Datatype ID */
- hid_t tid2; /* 2-D array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
- int ndims1; /* Array rank for reading */
- int ndims2; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
+ int rdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information read in */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid1; /* 1-D array Datatype ID */
+ hid_t tid2; /* 2-D array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t tdims2[] = {ARRAY3_DIM1, ARRAY3_DIM2};
+ int ndims1; /* Array rank for reading */
+ int ndims2; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i, j, k, l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array 2-D Arrays of Atomic Datatypes Functionality\n"));
/* Allocate and initialize array data to write */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++)
- for(k = 0; k < ARRAY3_DIM1; k++)
- for(l = 0; l < ARRAY3_DIM2; l++)
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ for (k = 0; k < ARRAY3_DIM1; k++)
+ for (l = 0; l < ARRAY3_DIM2; l++)
wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l;
/* Create file */
@@ -425,7 +461,6 @@ test_array_array_atomic(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -447,9 +482,10 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims1; i++)
- if(rdims1[i] != tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
+ for (i = 0; i < ndims1; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
@@ -466,9 +502,10 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims2; i++)
- if(rdims2[i] != tdims2[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n", (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]);
+ for (i = 0; i < ndims2; i++)
+ if (rdims2[i] != tdims2[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",
+ (int)i, (int)rdims2[i], (int)i, (int)tdims2[i]);
continue;
} /* end if */
@@ -477,12 +514,15 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++)
- for(k = 0; k < ARRAY3_DIM1; k++)
- for(l = 0; l < ARRAY3_DIM2; l++)
- if(wdata[i][j][k][l] != rdata[i][j][k][l]) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n", (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j, (int)k, (int)l, (int)rdata[i][j][k][l]);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ for (k = 0; k < ARRAY3_DIM1; k++)
+ for (l = 0; l < ARRAY3_DIM2; l++)
+ if (wdata[i][j][k][l] != rdata[i][j][k][l]) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, "
+ "rdata[%d][%d][%d][%d]=%d\n",
+ (int)i, (int)j, (int)k, (int)l, (int)wdata[i][j][k][l], (int)i, (int)j,
+ (int)k, (int)l, (int)rdata[i][j][k][l]);
continue;
} /* end if */
@@ -501,45 +541,50 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_array_atomic() */
-/****************************************************************
-**
-** test_array_compound_atomic(): Test basic array datatype code.
-** Tests 1-D array of compound datatypes (with no array fields)
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_array_compound_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of compound datatypes (with no array fields).
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_compound_atomic(void)
{
- typedef struct { /* Typedef for compound datatype */
- int i;
+ typedef struct { /* Typedef for compound datatype */
+ int i;
float f;
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- int i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int nmemb; /* Number of compound members */
+ char * mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ int i, j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Compound Atomic Datatypes Functionality\n"));
/* Initialize array data to write */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++) {
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
wdata[i][j].i = i * 10 + j;
- wdata[i][j].f = (float)(i * 2.5F + j);
+ wdata[i][j].f = (float)i * 2.5F + (float)j;
} /* end for */
/* Create file */
@@ -594,7 +639,6 @@ test_array_compound_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -609,31 +653,32 @@ test_array_compound_atomic(void)
/* Check the array rank */
ndims = H5Tget_array_ndims(tid1);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid1, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i = 0; i < ndims; i++)
- if(rdims1[i] != tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n", (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Get the compound datatype */
- tid2 = H5Tget_super (tid1);
+ tid2 = H5Tget_super(tid1);
CHECK(tid2, FAIL, "H5Tget_super");
/* Check the number of members */
nmemb = H5Tget_nmembers(tid2);
- VERIFY(nmemb,2,"H5Tget_nmembers");
+ VERIFY(nmemb, 2, "H5Tget_nmembers");
/* Check the 1st field's name */
mname = H5Tget_member_name(tid2, 0);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname, "i") != 0)
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (HDstrcmp(mname, "i") != 0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
@@ -644,15 +689,15 @@ test_array_compound_atomic(void)
/* Check the 1st field's datatype */
mtid = H5Tget_member_type(tid2, 0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret = H5Tequal(mtid,H5T_NATIVE_INT)) <= 0)
+ if ((ret = H5Tequal(mtid, H5T_NATIVE_INT)) <= 0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
mname = H5Tget_member_name(tid2, 1);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname, "f") != 0)
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (HDstrcmp(mname, "f") != 0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
@@ -663,7 +708,7 @@ test_array_compound_atomic(void)
/* Check the 2nd field's datatype */
mtid = H5Tget_member_type(tid2, 1);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret = H5Tequal(mtid, H5T_NATIVE_FLOAT)) <= 0)
+ if ((ret = H5Tequal(mtid, H5T_NATIVE_FLOAT)) <= 0)
TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
@@ -677,17 +722,21 @@ test_array_compound_atomic(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i = 0; i < SPACE1_DIM1; i++)
- for(j = 0; j < ARRAY1_DIM1; j++) {
- if(wdata[i][j].i != rdata[i][j].i) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", (int)i, (int)j, (int)wdata[i][j].i, (int)i, (int)j, (int)rdata[i][j].i);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ if (wdata[i][j].i != rdata[i][j].i) {
+ TestErrPrintf(
+ "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", (int)i,
+ (int)j, (int)wdata[i][j].i, (int)i, (int)j, (int)rdata[i][j].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i][j].f, rdata[i][j].f)) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n", (int)i, (int)j, wdata[i][j].f, (int)i, (int)j, rdata[i][j].f);
+ if (!H5_FLT_ABS_EQUAL(wdata[i][j].f, rdata[i][j].f)) {
+ TestErrPrintf(
+ "Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n", (int)i,
+ (int)j, (double)wdata[i][j].f, (int)i, (int)j, (double)rdata[i][j].f);
continue;
} /* end if */
- } /* end for */
+ } /* end for */
/* Close Datatype */
ret = H5Tclose(tid1);
@@ -702,48 +751,53 @@ test_array_compound_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_compound_atomic() */
-/****************************************************************
-**
-** test_array_compound_array(): Test basic array datatype code.
-** Tests 1-D array of compound datatypes (with array fields)
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_array_compound_array
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of compound datatypes (with array fields).
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_compound_array(void)
{
- typedef struct { /* Typedef for compound datatype */
- int i;
+ typedef struct { /* Typedef for compound datatype */
+ int i;
float f[ARRAY1_DIM1];
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- H5T_class_t mclass; /* Datatype class for field */
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int nmemb; /* Number of compound members */
+ char * mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ H5T_class_t mclass; /* Datatype class for field */
+ int i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Compound Array Datatypes Functionality\n"));
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].i=i*10+j;
- for(k=0; k<ARRAY1_DIM1; k++)
- wdata[i][j].f[k]=(float)(i * 10.0F + j * 2.5F + k);
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].i = i * 10 + j;
+ for (k = 0; k < ARRAY1_DIM1; k++)
+ wdata[i][j].f[k] = (float)i * 10.0F + (float)j * 2.5F + (float)k;
} /* end for */
/* Create file */
@@ -759,7 +813,7 @@ test_array_compound_array(void)
CHECK(tid2, FAIL, "H5Tcreate");
/* Insert integer field */
- ret = H5Tinsert (tid2, "i", HOFFSET(s1_t,i), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid2, "i", HOFFSET(s1_t, i), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
/* Create an array of floats datatype */
@@ -806,7 +860,6 @@ test_array_compound_array(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -816,98 +869,100 @@ test_array_compound_array(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the datatype */
- tid1 = H5Dget_type (dataset);
+ tid1 = H5Dget_type(dataset);
CHECK(tid1, FAIL, "H5Dget_type");
/* Check the array rank */
- ndims=H5Tget_array_ndims(tid1);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(tid1);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid1, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Get the compound datatype */
- tid2 = H5Tget_super (tid1);
+ tid2 = H5Tget_super(tid1);
CHECK(tid2, FAIL, "H5Tget_super");
/* Check the number of members */
- nmemb=H5Tget_nmembers(tid2);
- VERIFY(nmemb,2,"H5Tget_nmembers");
+ nmemb = H5Tget_nmembers(tid2);
+ VERIFY(nmemb, 2, "H5Tget_nmembers");
/* Check the 1st field's name */
- mname=H5Tget_member_name(tid2,0);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"i")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ mname = H5Tget_member_name(tid2, 0);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (HDstrcmp(mname, "i") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 1st field's offset */
- off=H5Tget_member_offset(tid2,0);
- VERIFY(off, HOFFSET(s1_t,i), "H5Tget_member_offset");
+ off = H5Tget_member_offset(tid2, 0);
+ VERIFY(off, HOFFSET(s1_t, i), "H5Tget_member_offset");
/* Check the 1st field's datatype */
- mtid=H5Tget_member_type(tid2,0);
+ mtid = H5Tget_member_type(tid2, 0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_NATIVE_INT)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
- mname=H5Tget_member_name(tid2,1);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"f")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ mname = H5Tget_member_name(tid2, 1);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (HDstrcmp(mname, "f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 2nd field's offset */
- off=H5Tget_member_offset(tid2,1);
- VERIFY(off, HOFFSET(s1_t,f), "H5Tget_member_offset");
+ off = H5Tget_member_offset(tid2, 1);
+ VERIFY(off, HOFFSET(s1_t, f), "H5Tget_member_offset");
/* Check the 2nd field's datatype */
- mtid=H5Tget_member_type(tid2,1);
+ mtid = H5Tget_member_type(tid2, 1);
CHECK(mtid, FAIL, "H5Tget_member_type");
/* Get the 2nd field's class */
- mclass=H5Tget_class(mtid);
+ mclass = H5Tget_class(mtid);
VERIFY(mclass, H5T_ARRAY, "H5Tget_class");
/* Check the array rank */
- ndims=H5Tget_array_ndims(mtid);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(mtid);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(mtid, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Nested array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Nested array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Check the nested array's datatype */
- tid3=H5Tget_super(mtid);
+ tid3 = H5Tget_super(mtid);
CHECK(tid3, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid3,H5T_NATIVE_FLOAT))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
+ if ((ret = H5Tequal(tid3, H5T_NATIVE_FLOAT)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
/* Close the array's base type datatype */
- ret=H5Tclose(tid3);
+ ret = H5Tclose(tid3);
CHECK(mtid, FAIL, "H5Tclose");
/* Close the member datatype */
- ret=H5Tclose(mtid);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Close Compound Datatype */
@@ -915,23 +970,28 @@ test_array_compound_array(void)
CHECK(ret, FAIL, "H5Tclose");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- for(j=0; j<ARRAY1_DIM1; j++) {
- if(wdata[i][j].i!=rdata[i][j].i) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",(int)i,(int)j,(int)wdata[i][j].i,(int)i,(int)j,(int)rdata[i][j].i);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ if (wdata[i][j].i != rdata[i][j].i) {
+ TestErrPrintf(
+ "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", (int)i,
+ (int)j, (int)wdata[i][j].i, (int)i, (int)j, (int)rdata[i][j].i);
continue;
} /* end if */
- for(k=0; k<ARRAY1_DIM1; k++)
- if(!FLT_ABS_EQUAL(wdata[i][j].f[k],rdata[i][j].f[k])) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, rdata[%d][%d].f[%d]=%f\n",(int)i,(int)j,(int)k,wdata[i][j].f[k],(int)i,(int)j,(int)k,rdata[i][j].f[k]);
+ for (k = 0; k < ARRAY1_DIM1; k++)
+ if (!H5_FLT_ABS_EQUAL(wdata[i][j].f[k], rdata[i][j].f[k])) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, "
+ "rdata[%d][%d].f[%d]=%f\n",
+ (int)i, (int)j, (int)k, (double)wdata[i][j].f[k], (int)i, (int)j, (int)k,
+ (double)rdata[i][j].f[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Close Datatype */
ret = H5Tclose(tid1);
@@ -947,9 +1007,6 @@ test_array_compound_array(void)
} /* end test_array_compound_array() */
-void *test_array_alloc_custom(size_t size, void *info);
-void test_array_free_custom(void *mem, void *info);
-
/****************************************************************
**
** test_array_alloc_custom(): Test VL datatype custom memory
@@ -958,91 +1015,122 @@ void test_array_free_custom(void *mem, void *info);
** allocated.
**
****************************************************************/
-void *test_array_alloc_custom(size_t size, void *info)
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_alloc_custom
+ *
+ * Purpose: Memory allocator for testing VL datatype custom memory
+ * allocation routines.
+ *
+ * This routine just uses malloc to allocate the memory and
+ * increments the amount of memory allocated.
+ *
+ * Return:
+ *
+ * Success: A memory buffer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+test_array_alloc_custom(size_t size, void *info)
{
- void *ret_value=NULL; /* Pointer to return */
- int *mem_used=(int *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ void * ret_value = NULL; /* Pointer to return */
+ size_t *mem_used = (size_t *)info; /* Pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *), sizeof(size_t));
- if((ret_value=HDmalloc(extra+size))!=NULL) {
- *(size_t *)ret_value=size;
- *mem_used+=size;
+ if ((ret_value = HDmalloc(extra + size)) != NULL) {
+ *(size_t *)ret_value = size;
+ *mem_used += size;
} /* end if */
- ret_value=((unsigned char *)ret_value)+extra;
- return(ret_value);
-}
-/****************************************************************
-**
-** test_array_free_custom(): Test VL datatype custom memory
-** allocation routines. This routine just uses free to
-** release the memory and decrements the amount of memory
-** allocated.
-**
-****************************************************************/
-void test_array_free_custom(void *_mem, void *info)
+ ret_value = ((unsigned char *)ret_value) + extra;
+ return ret_value;
+} /* end test_array_alloc_custom() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_free_custom
+ *
+ * Purpose: Memory free function for testing VL datatype custom memory
+ * allocation routines.
+ *
+ * This routine just uses free to free the memory and
+ * decrements the amount of memory allocated.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+test_array_free_custom(void *_mem, void *info)
{
- unsigned char *mem;
- int *mem_used=(int *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ unsigned char *mem = NULL; /* Pointer to mem to be freed */
+ size_t * mem_used = (size_t *)info; /* Pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *), sizeof(size_t));
- if(_mem!=NULL) {
- mem=((unsigned char *)_mem)-extra;
- *mem_used-=*(size_t *)mem;
+ if (_mem != NULL) {
+ mem = ((unsigned char *)_mem) - extra;
+ *mem_used -= *(size_t *)((void *)mem);
HDfree(mem);
} /* end if */
-}
-/****************************************************************
-**
-** test_array_vlen_atomic(): Test basic array datatype code.
-** Tests 1-D array of atomic VL datatypes
-**
-****************************************************************/
+ return;
+} /* end test_array_free_custom() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_vlen_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of atomic VL datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Atomic Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- int mem_used=0; /* Memory used during allocation */
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Atomic Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ size_t mem_used = 0; /* Memory used during allocation */
+ int i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Atomic Variable-Length Datatypes Functionality\n"));
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int));
- wdata[i][j].len=i+j+1;
- for(k=0; k<(i+j+1); k++)
- ((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k;
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for (k = 0; k < (i + j + 1); k++)
+ ((unsigned int *)wdata[i][j].p)[k] = (unsigned int)(i * 100 + j * 10 + k);
} /* end for */
/* Create file */
@@ -1089,7 +1177,6 @@ test_array_vlen_atomic(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1099,45 +1186,46 @@ test_array_vlen_atomic(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the dataspace */
- sid1 = H5Dget_space (dataset);
+ sid1 = H5Dget_space(dataset);
CHECK(sid1, FAIL, "H5Dget_space");
/* Get the datatype */
- tid1 = H5Dget_type (dataset);
+ tid1 = H5Dget_type(dataset);
CHECK(tid1, FAIL, "H5Dget_type");
/* Check the array rank */
- ndims=H5Tget_array_ndims(tid1);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(tid1);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid1, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Get the VL datatype */
- tid2 = H5Tget_super (tid1);
+ tid2 = H5Tget_super(tid1);
CHECK(tid2, FAIL, "H5Tget_super");
/* Get the 2nd field's class */
- mclass=H5Tget_class(tid2);
+ mclass = H5Tget_class(tid2);
VERIFY(mclass, H5T_VLEN, "H5Tget_class");
/* Check the VL datatype's base type */
- tid3=H5Tget_super(tid2);
+ tid3 = H5Tget_super(tid2);
CHECK(tid3, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid3,H5T_NATIVE_UINT))<=0)
- TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret);
+ if ((ret = H5Tequal(tid3, H5T_NATIVE_UINT)) <= 0)
+ TestErrPrintf("VL base datatype is incorrect!, ret=%d\n", (int)ret);
/* Close the array's base type datatype */
- ret=H5Tclose(tid3);
+ ret = H5Tclose(tid3);
CHECK(ret, FAIL, "H5Tclose");
/* Close VL Datatype */
@@ -1145,56 +1233,61 @@ test_array_vlen_atomic(void)
CHECK(ret, FAIL, "H5Tclose");
/* 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_array_alloc_custom,&mem_used,test_array_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_array_alloc_custom, &mem_used, test_array_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* # elements allocated = (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +
* (3 + 4 + 5 + 6) + (4 + 5 + 6 + 7) = 64 elements
*/
- VERIFY(size,64*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+ VERIFY(size, 64 * 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 */
/* # elements allocated = (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +
* (3 + 4 + 5 + 6) + (4 + 5 + 6 + 7) = 64 elements
*/
- VERIFY(mem_used,64*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, 64 * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- for(j=0; j<ARRAY1_DIM1; j++) {
- if(wdata[i][j].len!=rdata[i][j].len) {
- TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",(int)i,(int)j,(int)wdata[i][j].len,(int)i,(int)j,(int)rdata[i][j].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ if (wdata[i][j].len != rdata[i][j].len) {
+ TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",
+ (int)i, (int)j, (int)wdata[i][j].len, (int)i, (int)j, (int)rdata[i][j].len);
continue;
} /* end if */
- for(k=0; k<(int)rdata[i][j].len; k++) {
- if( ((unsigned int *)wdata[i][j].p)[k] != ((unsigned int *)rdata[i][j].p)[k] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d][%d].p[%d]=%d, rdata[%d][%d].p[%d]=%d\n",(int)i,(int)j,(int)k, (int)((unsigned int *)wdata[i][j].p)[k], (int)i,(int)j,(int)k, (int)((unsigned int *)rdata[i][j].p)[k]);
+ for (k = 0; k < (int)rdata[i][j].len; k++) {
+ if (((unsigned int *)wdata[i][j].p)[k] != ((unsigned int *)rdata[i][j].p)[k]) {
+ TestErrPrintf(
+ "VL data values don't match!, wdata[%d][%d].p[%d]=%d, rdata[%d][%d].p[%d]=%d\n",
+ (int)i, (int)j, (int)k, (int)((unsigned int *)wdata[i][j].p)[k], (int)i, (int)j,
+ (int)k, (int)((unsigned int *)rdata[i][j].p)[k]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* 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 transfer property list */
@@ -1215,47 +1308,52 @@ test_array_vlen_atomic(void)
} /* end test_array_vlen_atomic() */
-/****************************************************************
-**
-** test_array_vlen_array(): Test basic array datatype code.
-** Tests 1-D array of 1-D array VL datatypes
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_array_vlen_array
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of 1-D array VL datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_vlen_array(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hid_t tid4; /* Atomic Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- int mem_used=0; /* Memory used during allocation */
- int i,j,k,l; /* Index variables */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hid_t tid4; /* Atomic Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ size_t mem_used = 0; /* Memory used during allocation */
+ int i, j, k, l; /* Index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of 1-D Array Variable-Length Datatypes Functionality\n"));
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1));
- wdata[i][j].len=i+j+1;
- for(k=0; k<(i+j+1); k++)
- for(l=0; l<ARRAY1_DIM1; l++)
- ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l]=i*1000+j*100+k*10+l;
- } /* end for */
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int) * (size_t)ARRAY1_DIM1);
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for (k = 0; k < (i + j + 1); k++)
+ for (l = 0; l < ARRAY1_DIM1; l++)
+ ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] =
+ (unsigned int)(i * 1000 + j * 100 + k * 10 + l);
+ }
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1309,7 +1407,6 @@ test_array_vlen_array(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open file */
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
@@ -1319,73 +1416,74 @@ test_array_vlen_array(void)
CHECK(dataset, FAIL, "H5Dopen2");
/* Get the dataspace */
- sid1 = H5Dget_space (dataset);
+ sid1 = H5Dget_space(dataset);
CHECK(sid1, FAIL, "H5Dget_space");
/* Get the datatype */
- tid1 = H5Dget_type (dataset);
+ tid1 = H5Dget_type(dataset);
CHECK(tid1, FAIL, "H5Dget_type");
/* Check the array rank */
- ndims=H5Tget_array_ndims(tid1);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(tid1);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid1, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Get the VL datatype */
- tid2 = H5Tget_super (tid1);
+ tid2 = H5Tget_super(tid1);
CHECK(tid2, FAIL, "H5Tget_super");
/* Get the VL datatype's class */
- mclass=H5Tget_class(tid2);
+ mclass = H5Tget_class(tid2);
VERIFY(mclass, H5T_VLEN, "H5Tget_class");
/* Check the VL datatype's base type */
- tid3=H5Tget_super(tid2);
+ tid3 = H5Tget_super(tid2);
CHECK(tid3, FAIL, "H5Tget_super");
/* Get the nested array datatype's class */
- mclass=H5Tget_class(tid3);
+ mclass = H5Tget_class(tid3);
VERIFY(mclass, H5T_ARRAY, "H5Tget_class");
/* Check the array rank */
- ndims=H5Tget_array_ndims(tid3);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(tid3);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(tid3, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Check the array's base type */
- tid4=H5Tget_super(tid3);
+ tid4 = H5Tget_super(tid3);
CHECK(tid4, FAIL, "H5Tget_super");
-
- if((ret=H5Tequal(tid4,H5T_NATIVE_UINT))<=0)
- TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret);
+ if ((ret = H5Tequal(tid4, H5T_NATIVE_UINT)) <= 0)
+ TestErrPrintf("VL base datatype is incorrect!, ret=%d\n", (int)ret);
/* Close the array's base type datatype */
- ret=H5Tclose(tid4);
+ ret = H5Tclose(tid4);
CHECK(ret, FAIL, "H5Tclose");
/* Close the nested array datatype */
- ret=H5Tclose(tid3);
+ ret = H5Tclose(tid3);
CHECK(ret, FAIL, "H5Tclose");
/* Close VL Datatype */
@@ -1393,58 +1491,66 @@ test_array_vlen_array(void)
CHECK(ret, FAIL, "H5Tclose");
/* 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_array_alloc_custom,&mem_used,test_array_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_array_alloc_custom, &mem_used, test_array_free_custom,
+ &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* # elements allocated = (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +
* (3 + 4 + 5 + 6) + (4 + 5 + 6 + 7) = 64*ARRAY1_DIM1 elements
*/
- VERIFY(size,64*(sizeof(unsigned int)*ARRAY1_DIM1),"H5Dvlen_get_buf_size");
+ VERIFY(size, 64 * (sizeof(unsigned int) * ARRAY1_DIM1), "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 */
/* # elements allocated = (1 + 2 + 3 + 4) + (2 + 3 + 4 + 5) +
* (3 + 4 + 5 + 6) + (4 + 5 + 6 + 7) = 64*ARRAY1_DIM1 elements
*/
- VERIFY(mem_used,64*(sizeof(unsigned int)*ARRAY1_DIM1),"H5Dread");
+ VERIFY(mem_used, 64 * (sizeof(unsigned int) * ARRAY1_DIM1), "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- for(j=0; j<ARRAY1_DIM1; j++) {
- if(wdata[i][j].len!=rdata[i][j].len) {
- TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",(int)i,(int)j,(int)wdata[i][j].len,(int)i,(int)j,(int)rdata[i][j].len);
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ if (wdata[i][j].len != rdata[i][j].len) {
+ TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",
+ (int)i, (int)j, (int)wdata[i][j].len, (int)i, (int)j, (int)rdata[i][j].len);
continue;
} /* end if */
- for(k=0; k<(int)rdata[i][j].len; k++) {
- for(l=0; l<ARRAY1_DIM1; l++) {
- if( ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l] != ((unsigned int *)rdata[i][j].p)[k*ARRAY1_DIM1+l] ) {
- TestErrPrintf("VL data values don't match!, wdata[%d][%d].p[%d][%d]=%d, rdata[%d][%d].p[%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l, (int)((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l], (int)i,(int)j,(int)k,(int)l, (int)((unsigned int *)rdata[i][j].p)[k*ARRAY1_DIM1+l]);
+ for (k = 0; k < (int)rdata[i][j].len; k++) {
+ for (l = 0; l < ARRAY1_DIM1; l++) {
+ if (((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] !=
+ ((unsigned int *)rdata[i][j].p)[k * ARRAY1_DIM1 + l]) {
+ TestErrPrintf("VL data values don't match!, wdata[%d][%d].p[%d][%d]=%d, "
+ "rdata[%d][%d].p[%d][%d]=%d\n",
+ (int)i, (int)j, (int)k, (int)l,
+ (int)((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l], (int)i,
+ (int)j, (int)k, (int)l,
+ (int)((unsigned int *)rdata[i][j].p)[k * ARRAY1_DIM1 + l]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* 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 transfer property list */
@@ -1465,105 +1571,90 @@ test_array_vlen_array(void)
} /* end test_array_vlen_array() */
-#define FIELDNAME "ArrayofStructures"
-#define LENGTH 5
-#define ALEN 10
-#define RANK 1
-#define NMAX 100
-
-typedef struct
-{
- int nsubfields;
- char *name[NMAX];
- size_t offset[NMAX];
- hid_t datatype[NMAX];
-
-} CmpDTSinfo;
-
-/****************************************************************
-**
-** test_array_bkg(): Test basic array datatype code.
-** Tests reading compound datatype with array fields and
-** writing partial fields.
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_array_bkg
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests reading compound datatype with array fields and
+ * writing partial fields.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_bkg(void)
{
- herr_t status = -1;
+ herr_t status = -1;
- hid_t fid, array_dt;
- hid_t space;
- hid_t type;
- hid_t dataset;
+ hid_t fid, array_dt;
+ hid_t space;
+ hid_t type;
+ hid_t dataset;
- hsize_t dim[] = {LENGTH};
- hsize_t dima[] = {ALEN};
+ hsize_t dim[] = {LENGTH};
+ hsize_t dima[] = {ALEN};
- int i, j;
- unsigned ndims[3] = {1,1,1};
+ int i, j;
+ unsigned ndims[3] = {1, 1, 1};
- typedef struct
- {
- int a[ALEN];
- float b[ALEN];
- double c[ALEN];
+ typedef struct {
+ int a[ALEN];
+ float b[ALEN];
+ double c[ALEN];
} CmpField;
- CmpField cf[LENGTH];
- CmpField cfr[LENGTH];
- CmpDTSinfo dtsinfo;
+ CmpField cf[LENGTH];
+ CmpField cfr[LENGTH];
+ CmpDTSinfo *dtsinfo = NULL;
- typedef struct
- {
- float b[ALEN];
+ typedef struct {
+ float b[ALEN];
} fld_t;
- fld_t fld[LENGTH];
- fld_t fldr[LENGTH];
+ fld_t fld[LENGTH];
+ fld_t fldr[LENGTH];
/* Output message about test being performed */
MESSAGE(5, ("Testing Partial I/O of Array Fields in Compound Datatype Functionality\n"));
/* Initialize the data */
/* ------------------- */
- for (i = 0; i < LENGTH; i++)
- {
- for (j = 0; j < ALEN; j++)
- {
- cf[i].a[j] = 100*(i+1) + j;
- cf[i].b[j] = (float)(100.0F*(i+1) + 0.01F*j);
- cf[i].c[j] = (double)(100.0F*(i+1) + 0.02F*j);
- }
- }
-
+ dtsinfo = (CmpDTSinfo *)HDmalloc(sizeof(CmpDTSinfo));
+ CHECK_PTR(dtsinfo, "HDmalloc");
+ HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo));
+ for (i = 0; i < LENGTH; i++) {
+ for (j = 0; j < ALEN; j++) {
+ cf[i].a[j] = 100 * (i + 1) + j;
+ cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j;
+ cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j);
+ } /* end for */
+ } /* end for */
/* Set the number of data members */
/* ------------------------------ */
- dtsinfo.nsubfields = 3;
+ dtsinfo->nsubfields = 3;
/* Initialize the offsets */
/* ----------------------- */
- dtsinfo.offset[0] = HOFFSET(CmpField, a);
- dtsinfo.offset[1] = HOFFSET(CmpField, b);
- dtsinfo.offset[2] = HOFFSET(CmpField, c);
+ dtsinfo->offset[0] = HOFFSET(CmpField, a);
+ dtsinfo->offset[1] = HOFFSET(CmpField, b);
+ dtsinfo->offset[2] = HOFFSET(CmpField, c);
/* Initialize the data type IDs */
/* ---------------------------- */
- dtsinfo.datatype[0] = H5T_NATIVE_INT;
- dtsinfo.datatype[1] = H5T_NATIVE_FLOAT;
- dtsinfo.datatype[2] = H5T_NATIVE_DOUBLE;
-
+ dtsinfo->datatype[0] = H5T_NATIVE_INT;
+ dtsinfo->datatype[1] = H5T_NATIVE_FLOAT;
+ dtsinfo->datatype[2] = H5T_NATIVE_DOUBLE;
/* Initialize the names of data members */
/* ------------------------------------ */
- for (i = 0; i < dtsinfo.nsubfields; i++)
- dtsinfo.name[i] = (char *)HDcalloc((size_t)20, sizeof(char));
-
- strcpy(dtsinfo.name[0], "One");
- strcpy(dtsinfo.name[1], "Two");
- strcpy(dtsinfo.name[2], "Three");
+ for (i = 0; i < dtsinfo->nsubfields; i++)
+ dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char));
+ HDstrcpy(dtsinfo->name[0], "One");
+ HDstrcpy(dtsinfo->name[1], "Two");
+ HDstrcpy(dtsinfo->name[2], "Three");
/* Create file */
/* ----------- */
@@ -1572,28 +1663,26 @@ test_array_bkg(void)
/* Create data space */
/* ----------------- */
- space = H5Screate_simple(RANK, dim, NULL);
+ space = H5Screate_simple(RANK, dim, NULL);
CHECK(space, FAIL, "H5Screate_simple");
/* Create the memory data type */
/* --------------------------- */
- type = H5Tcreate(H5T_COMPOUND, sizeof(CmpField));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(CmpField));
CHECK(type, FAIL, "H5Tcreate");
-
/* Add members to the compound data type */
/* -------------------------------------- */
- for ( i = 0; i < dtsinfo.nsubfields; i++)
- {
- array_dt = H5Tarray_create2(dtsinfo.datatype[i], ndims[i], dima);
+ for (i = 0; i < dtsinfo->nsubfields; i++) {
+ array_dt = H5Tarray_create2(dtsinfo->datatype[i], ndims[i], dima);
CHECK(array_dt, FAIL, "H5Tarray_create2");
- status = H5Tinsert (type, dtsinfo.name[i], dtsinfo.offset[i], array_dt);
+ status = H5Tinsert(type, dtsinfo->name[i], dtsinfo->offset[i], array_dt);
CHECK(status, FAIL, "H5Tinsert");
status = H5Tclose(array_dt);
CHECK(status, FAIL, "H5Tclose");
- }
+ } /* end for */
/* Create the dataset */
/* ------------------ */
@@ -1612,27 +1701,28 @@ test_array_bkg(void)
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
for (j = 0; j < ALEN; j++) {
- if(cf[i].a[j]!=cfr[i].a[j]) {
- TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
+ if (cf[i].a[j] != cfr[i].a[j]) {
+ TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n", (int)i,
+ (int)j, (int)cf[i].a[j], (int)i, (int)j, (int)cfr[i].a[j]);
continue;
- }
- if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]);
+ } /* end if */
+ if (!H5_FLT_ABS_EQUAL(cf[i].b[j], cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].b[j], (int)i, (int)j, (double)cfr[i].b[j]);
continue;
- }
- if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]);
+ } /* end if */
+ if (!H5_DBL_ABS_EQUAL(cf[i].c[j], cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].c[j], (int)i, (int)j, (double)cfr[i].c[j]);
continue;
- }
- }
- }
-
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Release memory resources */
/* ------------------------ */
- for (i = 0; i < dtsinfo.nsubfields; i++)
- HDfree(dtsinfo.name[i]);
-
+ for (i = 0; i < dtsinfo->nsubfields; i++)
+ HDfree(dtsinfo->name[i]);
/* Release IDs */
/* ----------- */
@@ -1648,10 +1738,9 @@ test_array_bkg(void)
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
-
-/******************************/
-/* Reopen the file and update */
-/******************************/
+ /******************************/
+ /* Reopen the file and update */
+ /******************************/
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -1665,33 +1754,34 @@ test_array_bkg(void)
array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dima);
CHECK(array_dt, FAIL, "H5Tarray_create2");
- status = H5Tinsert (type, "Two", HOFFSET(fld_t, b), array_dt);
+ status = H5Tinsert(type, "Two", HOFFSET(fld_t, b), array_dt);
CHECK(status, FAIL, "H5Tinsert");
/* Initialize the data to overwrite */
/* -------------------------------- */
- for (i=0; i< LENGTH; i++)
+ for (i = 0; i < LENGTH; i++)
for (j = 0; j < ALEN; j++)
- cf[i].b[j]=fld[i].b[j] = 1.313F;
+ cf[i].b[j] = fld[i].b[j] = 1.313F;
- status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld);
+ status = H5Dwrite(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld);
CHECK(status, FAIL, "H5Dwrite");
/* Read just the field changed */
- status = H5Dread (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fldr);
+ status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fldr);
CHECK(status, FAIL, "H5Dread");
- for (i=0; i< LENGTH; i++)
+ for (i = 0; i < LENGTH; i++)
for (j = 0; j < ALEN; j++)
- if(!FLT_ABS_EQUAL(fld[i].b[j],fldr[i].b[j])) {
- TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(float)fld[i].b[j],(int)i,(int)j,(float)fldr[i].b[j]);
+ if (!H5_FLT_ABS_EQUAL(fld[i].b[j], fldr[i].b[j])) {
+ TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)fld[i].b[j], (int)i, (int)j, (double)fldr[i].b[j]);
continue;
- }
+ } /* end if */
- status = H5Tclose (type);
+ status = H5Tclose(type);
CHECK(status, FAIL, "H5Tclose");
- status = H5Tclose (array_dt);
+ status = H5Tclose(array_dt);
CHECK(status, FAIL, "H5Tclose");
type = H5Dget_type(dataset);
@@ -1705,33 +1795,36 @@ test_array_bkg(void)
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
for (j = 0; j < ALEN; j++) {
- if(cf[i].a[j]!=cfr[i].a[j]) {
- TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
+ if (cf[i].a[j] != cfr[i].a[j]) {
+ TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n", (int)i,
+ (int)j, (int)cf[i].a[j], (int)i, (int)j, (int)cfr[i].a[j]);
continue;
- }
- if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]);
+ } /* end if */
+ if (!H5_FLT_ABS_EQUAL(cf[i].b[j], cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].b[j], (int)i, (int)j, (double)cfr[i].b[j]);
continue;
- }
- if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]);
+ } /* end if */
+ if (!H5_DBL_ABS_EQUAL(cf[i].c[j], cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].c[j], (int)i, (int)j, (double)cfr[i].c[j]);
continue;
- }
- }
- }
+ } /* end if */
+ } /* end for */
+ } /* end for */
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
- status = H5Tclose (type);
+ status = H5Tclose(type);
CHECK(status, FAIL, "H5Tclose");
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
-/****************************************************/
-/* Reopen the file and print out all the data again */
-/****************************************************/
+ /****************************************************/
+ /* Reopen the file and print out all the data again */
+ /****************************************************/
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -1742,10 +1835,9 @@ test_array_bkg(void)
type = H5Dget_type(dataset);
CHECK(type, FAIL, "H5Dget_type");
-
/* Reset the data to read in */
/* ------------------------- */
- memset(cfr, 0, sizeof(CmpField)*LENGTH);
+ HDmemset(cfr, 0, sizeof(CmpField) * LENGTH);
status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfr);
CHECK(status, FAIL, "H5Dread");
@@ -1754,58 +1846,67 @@ test_array_bkg(void)
/* ------------------- */
for (i = 0; i < LENGTH; i++) {
for (j = 0; j < ALEN; j++) {
- if(cf[i].a[j]!=cfr[i].a[j]) {
- TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
+ if (cf[i].a[j] != cfr[i].a[j]) {
+ TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n", (int)i,
+ (int)j, (int)cf[i].a[j], (int)i, (int)j, (int)cfr[i].a[j]);
continue;
- }
- if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]);
+ } /* end if */
+ if (!H5_FLT_ABS_EQUAL(cf[i].b[j], cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].b[j], (int)i, (int)j, (double)cfr[i].b[j]);
continue;
- }
- if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]);
+ } /* end if */
+ if (!H5_DBL_ABS_EQUAL(cf[i].c[j], cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n", (int)i,
+ (int)j, (double)cf[i].c[j], (int)i, (int)j, (double)cfr[i].c[j]);
continue;
- }
- }
- }
+ } /* end if */
+ } /* end for */
+ } /* end for */
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
- status = H5Tclose (type);
+ status = H5Tclose(type);
CHECK(status, FAIL, "H5Tclose");
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
+
+ HDfree(dtsinfo);
} /* end test_array_bkg() */
-/****************************************************************
-**
-** test_compat(): Test array datatype compatibility code.
-** Reads file containing old version of datatype object header
-** messages for compound datatypes and verifies reading the older
-** version of the is working correctly.
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_compat
+ *
+ * Purpose: Test array datatype compatibility code.
+ *
+ * Reads file containing old version of datatype object header
+ * messages for compound datatypes and verifies reading the older
+ * version of the is working correctly.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_compat(void)
{
- char testfile[512]=""; /* Character buffer for corrected test file name */
- char *srcdir = getenv("srcdir"); /* Pointer to the directory the source code is located within */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Datatype ID */
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- int i; /* Index variables */
- herr_t ret; /* Generic return value */
+ const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Datatype ID */
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ int nmemb; /* Number of compound members */
+ char * mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ int i; /* Index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Array Datatypes Compatibility Functionality\n"));
@@ -1819,90 +1920,84 @@ test_compat(void)
* changed, follow the instructions in gen_old_array.c for regenerating
* the tarrold.h5 file.
*/
- /* Generate the correct name for the test file, by prepending the source path */
- if (srcdir && ((strlen(srcdir) + strlen(TESTFILE) + 1) < sizeof(testfile))) {
- strcpy(testfile, srcdir);
- strcat(testfile, "/");
- }
- strcat(testfile, TESTFILE);
/* Open the testfile */
fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK_I(fid1, "H5Fopen");
/* Only try to proceed if the file is around */
- if (fid1 >= 0){
+ if (fid1 >= 0) {
/* Open the first dataset (with no array fields) */
dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
CHECK_I(dataset, "H5Dopen2");
/* Get the datatype */
- tid1=H5Dget_type(dataset);
+ tid1 = H5Dget_type(dataset);
CHECK_I(tid1, "H5Dget_type");
/* Verify datatype class */
- mclass=H5Tget_class(tid1);
+ mclass = H5Tget_class(tid1);
VERIFY(mclass, H5T_COMPOUND, "H5Tget_class");
/* Get the number of compound datatype fields */
- nmemb=H5Tget_nmembers(tid1);
- VERIFY(nmemb,3,"H5Tget_nmembers");
+ nmemb = H5Tget_nmembers(tid1);
+ VERIFY(nmemb, 3, "H5Tget_nmembers");
/* Check the 1st field's name */
- mname=H5Tget_member_name(tid1,0);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"i")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ mname = H5Tget_member_name(tid1, 0);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (HDstrcmp(mname, "i") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 1st field's offset */
- off=H5Tget_member_offset(tid1,0);
+ off = H5Tget_member_offset(tid1, 0);
VERIFY(off, 0, "H5Tget_member_offset");
/* Check the 1st field's datatype */
- mtid=H5Tget_member_type(tid1,0);
+ mtid = H5Tget_member_type(tid1, 0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_STD_I16LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
- mname=H5Tget_member_name(tid1,1);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"f")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ mname = H5Tget_member_name(tid1, 1);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (HDstrcmp(mname, "f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 2nd field's offset */
- off=H5Tget_member_offset(tid1,1);
+ off = H5Tget_member_offset(tid1, 1);
VERIFY(off, 4, "H5Tget_member_offset");
/* Check the 2nd field's datatype */
- mtid=H5Tget_member_type(tid1,1);
+ mtid = H5Tget_member_type(tid1, 1);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_IEEE_F32LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_IEEE_F32LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 3rd field's name */
- mname=H5Tget_member_name(tid1,2);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(HDstrcmp(mname,"l")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
+ mname = H5Tget_member_name(tid1, 2);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (HDstrcmp(mname, "l") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
/* Check the 3rd field's offset */
- off=H5Tget_member_offset(tid1,2);
+ off = H5Tget_member_offset(tid1, 2);
VERIFY(off, 8, "H5Tget_member_offset");
/* Check the 3rd field's datatype */
- mtid=H5Tget_member_type(tid1,2);
+ mtid = H5Tget_member_type(tid1, 2);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I32LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_STD_I32LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Close the datatype */
@@ -1913,149 +2008,154 @@ test_compat(void)
ret = H5Dclose(dataset);
CHECK_I(ret, "H5Dclose");
-
/* Open the second dataset (with array fields) */
dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT);
CHECK_I(dataset, "H5Dopen2");
/* Get the datatype */
- tid1=H5Dget_type(dataset);
+ tid1 = H5Dget_type(dataset);
CHECK_I(tid1, "H5Dget_type");
/* Verify datatype class */
- mclass=H5Tget_class(tid1);
+ mclass = H5Tget_class(tid1);
VERIFY(mclass, H5T_COMPOUND, "H5Tget_class");
/* Get the number of compound datatype fields */
- nmemb=H5Tget_nmembers(tid1);
- VERIFY(nmemb,4,"H5Tget_nmembers");
+ nmemb = H5Tget_nmembers(tid1);
+ VERIFY(nmemb, 4, "H5Tget_nmembers");
/* Check the 1st field's name */
- mname=H5Tget_member_name(tid1,0);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(mname && HDstrcmp(mname,"i")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- if(mname) H5free_memory(mname);
+ mname = H5Tget_member_name(tid1, 0);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (mname && HDstrcmp(mname, "i") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
+ if (mname)
+ H5free_memory(mname);
/* Check the 1st field's offset */
- off=H5Tget_member_offset(tid1,0);
+ off = H5Tget_member_offset(tid1, 0);
VERIFY(off, 0, "H5Tget_member_offset");
/* Check the 1st field's datatype */
- mtid=H5Tget_member_type(tid1,0);
+ mtid = H5Tget_member_type(tid1, 0);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_STD_I16LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Check the 2nd field's name */
- mname=H5Tget_member_name(tid1,1);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(mname && HDstrcmp(mname,"f")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- if(mname) H5free_memory(mname);
+ mname = H5Tget_member_name(tid1, 1);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (mname && HDstrcmp(mname, "f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
+ if (mname)
+ H5free_memory(mname);
/* Check the 2nd field's offset */
- off=H5Tget_member_offset(tid1,1);
+ off = H5Tget_member_offset(tid1, 1);
VERIFY(off, 4, "H5Tget_member_offset");
/* Check the 2nd field's datatype */
- mtid=H5Tget_member_type(tid1,1);
+ mtid = H5Tget_member_type(tid1, 1);
CHECK(mtid, FAIL, "H5Tget_member_type");
/* Verify datatype class */
- mclass=H5Tget_class(mtid);
+ mclass = H5Tget_class(mtid);
VERIFY(mclass, H5T_ARRAY, "H5Tget_class");
/* Check the array rank */
- ndims=H5Tget_array_ndims(mtid);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(mtid);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(mtid, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Check the array's base datatype */
- tid2=H5Tget_super(mtid);
+ tid2 = H5Tget_super(mtid);
CHECK(tid2, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid2,H5T_IEEE_F32LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(tid2);
+ if ((ret = H5Tequal(tid2, H5T_IEEE_F32LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(tid2);
CHECK(ret, FAIL, "H5Tclose");
- ret=H5Tclose(mtid);
+ ret = H5Tclose(mtid);
CHECK(ret, FAIL, "H5Tclose");
/* Check the 3rd field's name */
- mname=H5Tget_member_name(tid1,2);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(mname && HDstrcmp(mname,"l")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- if(mname) H5free_memory(mname);
+ mname = H5Tget_member_name(tid1, 2);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (mname && HDstrcmp(mname, "l") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
+ if (mname)
+ H5free_memory(mname);
/* Check the 3rd field's offset */
- off=H5Tget_member_offset(tid1,2);
+ off = H5Tget_member_offset(tid1, 2);
VERIFY(off, 20, "H5Tget_member_offset");
/* Check the 3rd field's datatype */
- mtid=H5Tget_member_type(tid1,2);
+ mtid = H5Tget_member_type(tid1, 2);
CHECK(mtid, FAIL, "H5Tget_member_type");
/* Verify datatype class */
- mclass=H5Tget_class(mtid);
+ mclass = H5Tget_class(mtid);
VERIFY(mclass, H5T_ARRAY, "H5Tget_class");
/* Check the array rank */
- ndims=H5Tget_array_ndims(mtid);
- VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims");
+ ndims = H5Tget_array_ndims(mtid);
+ VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
/* Get the array dimensions */
ret = H5Tget_array_dims2(mtid, rdims1);
CHECK(ret, FAIL, "H5Tget_array_dims2");
/* Check the array dimensions */
- for(i=0; i<ndims; i++)
- if(rdims1[i]!=tdims1[i]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]);
+ for (i = 0; i < ndims; i++)
+ if (rdims1[i] != tdims1[i]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",
+ (int)i, (int)rdims1[i], (int)i, (int)tdims1[i]);
continue;
} /* end if */
/* Check the array's base datatype */
- tid2=H5Tget_super(mtid);
+ tid2 = H5Tget_super(mtid);
CHECK(tid2, FAIL, "H5Tget_super");
- if((ret=H5Tequal(tid2,H5T_STD_I32LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(tid2);
+ if ((ret = H5Tequal(tid2, H5T_STD_I32LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(tid2);
CHECK(ret, FAIL, "H5Tclose");
- ret=H5Tclose(mtid);
+ ret = H5Tclose(mtid);
CHECK(ret, FAIL, "H5Tclose");
/* Check the 4th field's name */
- mname=H5Tget_member_name(tid1,3);
- CHECK(mname, NULL, "H5Tget_member_name");
- if(mname && HDstrcmp(mname,"d")!=0)
- TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
- if(mname) H5free_memory(mname);
+ mname = H5Tget_member_name(tid1, 3);
+ CHECK_PTR(mname, "H5Tget_member_name");
+ if (mname && HDstrcmp(mname, "d") != 0)
+ TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
+ if (mname)
+ H5free_memory(mname);
/* Check the 4th field's offset */
- off=H5Tget_member_offset(tid1,3);
+ off = H5Tget_member_offset(tid1, 3);
VERIFY(off, 36, "H5Tget_member_offset");
/* Check the 4th field's datatype */
- mtid=H5Tget_member_type(tid1,3);
+ mtid = H5Tget_member_type(tid1, 3);
CHECK(mtid, FAIL, "H5Tget_member_type");
- if((ret=H5Tequal(mtid,H5T_IEEE_F64LE))<=0)
- TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret);
- ret=H5Tclose(mtid);
+ if ((ret = H5Tequal(mtid, H5T_IEEE_F64LE)) <= 0)
+ TestErrPrintf("Compound data type is incorrect!, ret=%d\n", (int)ret);
+ ret = H5Tclose(mtid);
CHECK(mtid, FAIL, "H5Tclose");
/* Close the datatype */
@@ -2069,17 +2169,21 @@ test_compat(void)
/* Close the file */
ret = H5Fclose(fid1);
CHECK_I(ret, "H5Fclose");
- }
+ } /* end if */
else
- printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile);
+ HDprintf("***cannot open the pre-created compound datatype test file (%s)\n", testfile);
} /* end test_compat() */
-/****************************************************************
-**
-** test_array(): Main array datatype testing routine.
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_array
+ *
+ * Purpose: Main array datatype testing routine.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
void
test_array(void)
{
@@ -2087,39 +2191,36 @@ test_array(void)
MESSAGE(5, ("Testing Array Datatypes\n"));
/* These tests use the same file... */
- test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */
- test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */
- test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */
- test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */
- test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */
- test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */
- test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
- test_array_funcs(); /* Test type functions with array types */
+ test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */
+ test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */
+ test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */
+ test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */
+ test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */
+ test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */
+ test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
+ test_array_funcs(); /* Test type functions with array types */
- test_array_bkg(); /* Read compound datatype with array fields and background fields read */
+ test_array_bkg(); /* Read compound datatype with array fields and background fields read */
/* This test uses a custom file */
- test_compat(); /* Test compatibility changes for compound datatype fields */
-} /* test_array() */
+ test_compat(); /* Test compatibility changes for compound datatype fields */
+
+} /* end test_array() */
-
/*-------------------------------------------------------------------------
- * Function: cleanup_array
+ * Function: cleanup_array
*
- * Purpose: Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return: none
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* June 8, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
cleanup_array(void)
{
remove(FILENAME);
-}
-
+} /* end cleanup_array() */